You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(153) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(48) |
Feb
(46) |
Mar
(12) |
Apr
(4) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(263) |
Mar
(235) |
Apr
(66) |
May
(42) |
Jun
(270) |
Jul
(65) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Oliver O. <fr...@us...> - 2007-06-22 13:56:25
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1722 Modified Files: Tag: projectx contactjointhandler.h Log Message: update from rcssserver3D Index: contactjointhandler.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/contactjointhandler.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** contactjointhandler.h 12 Feb 2006 11:25:36 -0000 1.2 --- contactjointhandler.h 22 Jun 2007 13:56:19 -0000 1.2.4.1 *************** *** 66,70 **** CollisionHandler creates */ ! const dSurfaceParameters& SetSurfaceParameter() const; /** sets or resets a contact mode flag in the surface parameter*/ --- 66,70 ---- CollisionHandler creates */ ! const dSurfaceParameters& GetSurfaceParameter() const; /** sets or resets a contact mode flag in the surface parameter*/ |
From: Oliver O. <fr...@us...> - 2007-06-22 13:51:53
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32348 Modified Files: Tag: projectx body.cpp Log Message: update from rcssserver3D Index: body.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/body.cpp,v retrieving revision 1.2.2.1.2.1 retrieving revision 1.2.2.1.2.2 diff -C2 -d -r1.2.2.1.2.1 -r1.2.2.1.2.2 *** body.cpp 17 Jun 2007 08:16:06 -0000 1.2.2.1.2.1 --- body.cpp 22 Jun 2007 13:51:45 -0000 1.2.2.1.2.2 *************** *** 35,38 **** --- 35,43 ---- Body::~Body() { + if (mODEBody) + { + dBodyDestroy(mODEBody); + mODEBody = 0; + } } *************** *** 362,365 **** --- 367,379 ---- } + salt::Matrix + Body::GetRotation() const + { + const dReal* m = dBodyGetRotation(mODEBody); + salt::Matrix rot; + ConvertRotationMatrix(m,rot); + return rot; + } + Vector3f Body::GetAngularVelocity() const |
From: Oliver O. <fr...@us...> - 2007-06-22 13:50:51
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31893 Modified Files: Tag: projectx body.h Log Message: update from rcssserver3D Index: body.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/body.h,v retrieving revision 1.2.2.1.2.1 retrieving revision 1.2.2.1.2.2 diff -C2 -d -r1.2.2.1.2.1 -r1.2.2.1.2.2 *** body.h 17 Jun 2007 08:15:36 -0000 1.2.2.1.2.1 --- body.h 22 Jun 2007 13:50:47 -0000 1.2.2.1.2.2 *************** *** 202,205 **** --- 202,208 ---- void SetRotation(const salt::Matrix& rot); + /** gets the rotation of this body */ + salt::Matrix GetRotation() const; + /** returns the current angular velocity of this body */ salt::Vector3f GetAngularVelocity() const; |
From: Oliver O. <fr...@us...> - 2007-06-22 13:48:23
|
Update of /cvsroot/simspark/simspark/spark/oxygen/geometryserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30985 Modified Files: Tag: projectx stdmeshimporter.cpp Log Message: update from rcssserver3D Index: stdmeshimporter.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/geometryserver/stdmeshimporter.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.1.2.1 diff -C2 -d -r1.1.2.1 -r1.1.2.1.2.1 *** stdmeshimporter.cpp 9 Feb 2007 20:11:56 -0000 1.1.2.1 --- stdmeshimporter.cpp 22 Jun 2007 13:48:20 -0000 1.1.2.1.2.1 *************** *** 42,45 **** --- 42,46 ---- static const string gBoxStr = "StdUnitBox"; static const string gCCylinderStr = "StdCCylinder"; + static const string gCylinderStr = "StdUnitCylinder"; shared_ptr<TriMesh> *************** *** 61,64 **** --- 62,70 ---- } + if (name == gCylinderStr) + { + return UnitCylinder(); + } + return shared_ptr<TriMesh>(); } *************** *** 435,436 **** --- 441,739 ---- } + // + // unit cylinder (radius = 1, length = 1) + // + + static const int gNumCylinderVertices = 66; + static const int gNumCylinderFaces = 128; + + static float gCylinderVertices[gNumCylinderVertices*3] = + { + 0.70711,0.70711,-0.5, + 0.83147,0.55557,-0.5, + 0.92388,0.38268,-0.5, + 0.98079,0.19509,-0.5, + 1.0,0.0,-0.5, + 0.98079,-0.19509,-0.5, + 0.92388,-0.38268,-0.5, + 0.83147,-0.55557,-0.5, + 0.70711,-0.70711,-0.5, + 0.55557,-0.83147,-0.5, + 0.38268,-0.92388,-0.5, + 0.19509,-0.98079,-0.5, + -0.0,-1.0,-0.5, + -0.19509,-0.98079,-0.5, + -0.38268,-0.92388,-0.5, + -0.55557,-0.83147,-0.5, + -0.70711,-0.70711,-0.5, + -0.83147,-0.55557,-0.5, + -0.92388,-0.38268,-0.5, + -0.98079,-0.19509,-0.5, + -1.0,0.0,-0.5, + -0.98079,0.19509,-0.5, + -0.92388,0.38268,-0.5, + -0.83147,0.55557,-0.5, + -0.70711,0.70711,-0.5, + -0.55557,0.83147,-0.5, + -0.38268,0.92388,-0.5, + -0.19509,0.98079,-0.5, + 0.0,1.0,-0.5, + 0.19509,0.98078,-0.5, + 0.38269,0.92388,-0.5, + 0.55557,0.83147,-0.5, + 0.70711,0.70711,0.5, + 0.83147,0.55557,0.5, + 0.92388,0.38268,0.5, + 0.98079,0.19509,0.5, + 1.0,-0.0,0.5, + 0.98078,-0.19509,0.5, + 0.92388,-0.38268,0.5, + 0.83147,-0.55557,0.5, + 0.70711,-0.70711,0.5, + 0.55557,-0.83147,0.5, + 0.38268,-0.92388,0.5, + 0.19509,-0.98079,0.5, + 0.0,-1.0,0.5, + -0.19509,-0.98079,0.5, + -0.38268,-0.92388,0.5, + -0.55557,-0.83147,0.5, + -0.7071,-0.70711,0.5, + -0.83147,-0.55557,0.5, + -0.92388,-0.38269,0.5, + -0.98078,-0.19509,0.5, + -1.0,-0.0,0.5, + -0.98079,0.19509,0.5, + -0.92388,0.38268,0.5, + -0.83147,0.55557,0.5, + -0.70711,0.7071,0.5, + -0.55558,0.83147,0.5, + -0.38269,0.92388,0.5, + -0.1951,0.98078,0.5, + -1e-05,1.0,0.5, + 0.19508,0.98079,0.5, + 0.38268,0.92388,0.5, + 0.55556,0.83147,0.5, + 0.0,-0.0,-0.5, + 0.0,0.0,0.5 + }; + + static float gCylinderNormals[gNumCylinderVertices*3] = + { + 0.49876,0.49876,-0.70879, + 0.5865,0.39189,-0.70879, + 0.65169,0.26994,-0.70879, + 0.69182,0.13761,-0.70879, + 0.70537,0.0,-0.70879, + 0.69182,-0.13761,-0.70879, + 0.65169,-0.26994,-0.70879, + 0.5865,-0.39189,-0.70879, + 0.49876,-0.49876,-0.70879, + 0.39189,-0.5865,-0.70879, + 0.26994,-0.65169,-0.70879, + 0.13761,-0.69182,-0.70879, + 0.0,-0.70537,-0.70879, + -0.13761,-0.69182,-0.70879, + -0.26994,-0.65169,-0.70879, + -0.39189,-0.5865,-0.70879, + -0.49876,-0.49876,-0.70879, + -0.5865,-0.39189,-0.70879, + -0.65169,-0.26994,-0.70879, + -0.69182,-0.13761,-0.70879, + -0.70537,0.0,-0.70879, + -0.69182,0.13761,-0.70879, + -0.65169,0.26994,-0.70879, + -0.5865,0.39189,-0.70879, + -0.49876,0.49876,-0.70879, + -0.39189,0.5865,-0.70879, + -0.26994,0.65169,-0.70879, + -0.13761,0.69182,-0.70879, + 0.0,0.70537,-0.70879, + 0.13761,0.69182,-0.70879, + 0.26994,0.65169,-0.70879, + 0.39189,0.5865,-0.70879, + 0.49876,0.49876,0.70879, + 0.5865,0.39189,0.70879, + 0.65169,0.26994,0.70879, + 0.69182,0.13761,0.70879, + 0.70537,0.0,0.70879, + 0.69182,-0.13761,0.70879, + 0.65169,-0.26994,0.70879, + 0.5865,-0.39189,0.70879, + 0.49876,-0.49876,0.70879, + 0.39189,-0.5865,0.70879, + 0.26994,-0.65169,0.70879, + 0.13761,-0.69182,0.70879, + 0.0,-0.70537,0.70879, + -0.13761,-0.69182,0.70879, + -0.26994,-0.65169,0.70879, + -0.39189,-0.5865,0.70879, + -0.49876,-0.49876,0.70879, + -0.5865,-0.39189,0.70879, + -0.65169,-0.26994,0.70879, + -0.69182,-0.13761,0.70879, + -0.70537,0.0,0.70879, + -0.69182,0.13761,0.70879, + -0.65169,0.26994,0.70879, + -0.5865,0.39189,0.70879, + -0.49876,0.49876,0.70879, + -0.39189,0.5865,0.70879, + -0.26994,0.65169,0.70879, + -0.13761,0.69182,0.70879, + 0.0,0.70537,0.70879, + 0.13761,0.69182,0.70879, + 0.26994,0.65169,0.70879, + 0.39189,0.5865,0.70879, + 0.0,0.0,-1.0, + 0.0,0.0,1.0 + }; + + static unsigned int gCylinderFaces[gNumCylinderFaces*3] = + { + 64,0,1, + 65,33,32, + 64,1,2, + 65,34,33, + 64,2,3, + 65,35,34, + 64,3,4, + 65,36,35, + 64,4,5, + 65,37,36, + 64,5,6, + 65,38,37, + 64,6,7, + 65,39,38, + 64,7,8, + 65,40,39, + 64,8,9, + 65,41,40, + 64,9,10, + 65,42,41, + 64,10,11, + 65,43,42, + 64,11,12, + 65,44,43, + 64,12,13, + 65,45,44, + 64,13,14, + 65,46,45, + 64,14,15, + 65,47,46, + 64,15,16, + 65,48,47, + 64,16,17, + 65,49,48, + 64,17,18, + 65,50,49, + 64,18,19, + 65,51,50, + 64,19,20, + 65,52,51, + 64,20,21, + 65,53,52, + 64,21,22, + 65,54,53, + 64,22,23, + 65,55,54, + 64,23,24, + 65,56,55, + 64,24,25, + 65,57,56, + 64,25,26, + 65,58,57, + 64,26,27, + 65,59,58, + 64,27,28, + 65,60,59, + 64,28,29, + 65,61,60, + 64,29,30, + 65,62,61, + 64,30,31, + 65,63,62, + 31,0,64, + 65,32,63, + 0,32,33, + 33,1,0, + 1,33,34, + 34,2,1, + 2,34,35, + 35,3,2, + 3,35,36, + 36,4,3, + 4,36,37, + 37,5,4, + 5,37,38, + 38,6,5, + 6,38,39, + 39,7,6, + 7,39,40, + 40,8,7, + 8,40,41, + 41,9,8, + 9,41,42, + 42,10,9, + 10,42,43, + 43,11,10, + 11,43,44, + 44,12,11, + 12,44,45, + 45,13,12, + 13,45,46, + 46,14,13, + 14,46,47, + 47,15,14, + 15,47,48, + 48,16,15, + 16,48,49, + 49,17,16, + 17,49,50, + 50,18,17, + 18,50,51, + 51,19,18, + 19,51,52, + 52,20,19, + 20,52,53, + 53,21,20, + 21,53,54, + 54,22,21, + 22,54,55, + 55,23,22, + 23,55,56, + 56,24,23, + 24,56,57, + 57,25,24, + 25,57,58, + 58,26,25, + 26,58,59, + 59,27,26, + 27,59,60, + 60,28,27, + 28,60,61, + 61,29,28, + 29,61,62, + 62,30,29, + 30,62,63, + 63,31,30, + 32,0,31, + 31,63,32 + }; + + shared_ptr<TriMesh> StdMeshImporter::UnitCylinder() + { + shared_ptr<TriMesh> mesh(new TriMesh()); + + shared_array<float> pos(new float[gNumCylinderVertices*3]); + memcpy(pos.get(),gCylinderVertices,gNumCylinderVertices*3*sizeof(float)); + mesh->SetPos(pos,gNumCylinderVertices); + + shared_array<float> normals(new float[gNumCylinderVertices*3]); + memcpy(normals.get(),gCylinderNormals,gNumCylinderVertices*3*sizeof(float)); + mesh->SetNormals(normals); + + shared_ptr<IndexBuffer> idx(new IndexBuffer()); + idx->Cache(gNumCylinderFaces*3,gCylinderFaces); + mesh->AddFace(idx); + + return mesh; + } |
From: Oliver O. <fr...@us...> - 2007-06-22 13:47:09
|
Update of /cvsroot/simspark/simspark/spark/oxygen/geometryserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30238 Modified Files: Tag: projectx stdmeshimporter.h Log Message: update from rcssserver3D Index: stdmeshimporter.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/geometryserver/stdmeshimporter.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** stdmeshimporter.h 5 Dec 2005 21:16:49 -0000 1.1 --- stdmeshimporter.h 22 Jun 2007 13:47:05 -0000 1.1.4.1 *************** *** 57,60 **** --- 57,63 ---- boost::shared_ptr<TriMesh> UnitCCylinder (const zeitgeist::ParameterList& parameter); + + /** constructs a flat unit cylinder */ + boost::shared_ptr<TriMesh> UnitCylinder(); }; |
From: Oliver O. <fr...@us...> - 2007-06-22 13:44:36
|
Update of /cvsroot/simspark/simspark/spark/oxygen/gamecontrolserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29410 Modified Files: Tag: projectx gamecontrolserver.cpp Log Message: update from rcssserver3D Index: gamecontrolserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/gamecontrolserver/gamecontrolserver.cpp,v retrieving revision 1.1.2.2.2.2 retrieving revision 1.1.2.2.2.3 diff -C2 -d -r1.1.2.2.2.2 -r1.1.2.2.2.3 *** gamecontrolserver.cpp 1 Jun 2007 12:17:58 -0000 1.1.2.2.2.2 --- gamecontrolserver.cpp 22 Jun 2007 13:44:28 -0000 1.1.2.2.2.3 *************** *** 78,82 **** return false; } - aspect->SetName(aspectName); AddChildReference(aspect); --- 78,81 ---- *************** *** 306,312 **** --- 305,336 ---- } + void + GameControlServer::GetAgentAspectList(TAgentAspectList & list) + { + for ( + TAgentMap::iterator iter = mAgentMap.begin(); + iter != mAgentMap.end(); + ++iter + ) + { + list.push_back(iter->second); + } + } + void GameControlServer::Update(float deltaTime) { + // remove disappeared agent + for( + vector<int>::iterator iter = mDisappearedAgent.begin(); + iter != mDisappearedAgent.end(); + ++iter + ) + { + AgentDisappear(*iter); + } + + mDisappearedAgent.clear(); + // build list of ControlAspects, NOT searching recursively TLeafList control; *************** *** 338,339 **** --- 362,369 ---- return mExit; } + + void + GameControlServer::pushDisappearedAgent(int id) + { + mDisappearedAgent.push_back(id); + } |
From: Oliver O. <fr...@us...> - 2007-06-22 13:43:44
|
Update of /cvsroot/simspark/simspark/spark/oxygen/gamecontrolserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28988 Modified Files: Tag: projectx gamecontrolserver.h Log Message: update from rcssserver3D Index: gamecontrolserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/gamecontrolserver/gamecontrolserver.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.1.2.1 diff -C2 -d -r1.1.2.1 -r1.1.2.1.2.1 *** gamecontrolserver.h 28 Feb 2007 20:38:38 -0000 1.1.2.1 --- gamecontrolserver.h 22 Jun 2007 13:43:39 -0000 1.1.2.1.2.1 *************** *** 37,40 **** --- 37,44 ---- { public: + + typedef std::list<boost::shared_ptr<AgentAspect> > TAgentAspectList; + + public: GameControlServer(); ~GameControlServer(); *************** *** 109,112 **** --- 113,119 ---- boost::shared_ptr<AgentAspect> GetAgentAspect(int id); + /** get a list with shared pointers to all the AgentAspects */ + void GetAgentAspectList(TAgentAspectList & list); + /** This method is used to notify the GameControlServer that the game has advanced deltaTime seconds. The GameControlServer will in turn *************** *** 125,128 **** --- 132,138 ---- void Quit(); + /** put the agent id into the disconnected vector */ + void pushDisappearedAgent(int id); + protected: /** helper method that queries the SceneServer for the currently *************** *** 146,149 **** --- 156,162 ---- /** flag if the simulation is over */ bool mExit; + + /** vector of disappeared agents, they will be removed in next Update */ + std::vector<int> mDisappearedAgent; }; |
From: Markus R. <rol...@us...> - 2007-06-21 19:32:09
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30159 Modified Files: Tag: RSGEDIT_SCINTILLA sparkedit.cpp Log Message: - enable minimal coloring of .rb files Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.cpp,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** sparkedit.cpp 21 Jun 2007 19:26:38 -0000 1.1.2.5 --- sparkedit.cpp 21 Jun 2007 19:32:06 -0000 1.1.2.6 *************** *** 201,204 **** --- 201,205 ---- { edit->SetLexer(wxSCI_LEX_RUBY); + edit->StyleSetForeground(wxSCI_RB_COMMENTLINE, COL_COMMENT); // todo: set ruby color styles break; |
From: Markus R. <rol...@us...> - 2007-06-21 19:27:34
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28095 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp Log Message: - open ruby start script in editor tab after sourcing it Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21.2.4 retrieving revision 1.21.2.5 diff -C2 -d -r1.21.2.4 -r1.21.2.5 *** mainframe.cpp 21 Jun 2007 19:18:48 -0000 1.21.2.4 --- mainframe.cpp 21 Jun 2007 19:27:27 -0000 1.21.2.5 *************** *** 780,784 **** #endif ! wxScintilla* edit = SparkEdit::GetEdit(fname,mCtrNotebook); if (edit != 0) { --- 780,785 ---- #endif ! bool select = true; ! wxScintilla* edit = SparkEdit::GetEdit(fname,mCtrNotebook,select); if (edit != 0) { *************** *** 900,903 **** --- 901,906 ---- } + bool select = false; + SparkEdit::GetEdit(fname, mCtrNotebook, select); UpdateCached(); |
From: Markus R. <rol...@us...> - 2007-06-21 19:26:41
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27689 Modified Files: Tag: RSGEDIT_SCINTILLA sparkedit.cpp sparkedit.h Log Message: - added 'select' option to GetEdit() method that allows to open an edit control in the background Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.cpp,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** sparkedit.cpp 21 Jun 2007 19:18:00 -0000 1.1.2.4 --- sparkedit.cpp 21 Jun 2007 19:26:38 -0000 1.1.2.5 *************** *** 59,63 **** } ! wxScintilla* SparkEdit::GetEdit(const wxString& fname, wxFlatNotebook* notebook) { if (notebook == 0) --- 59,63 ---- } ! wxScintilla* SparkEdit::GetEdit(const wxString& fname, wxFlatNotebook* notebook, bool select) { if (notebook == 0) *************** *** 79,86 **** if (fn.GetFullPath() == entry.fname) { - notebook->SetSelection(entry.page); - wxScintilla* edit = (*iter).first; ! edit->SetFocus(); return edit; --- 79,89 ---- if (fn.GetFullPath() == entry.fname) { wxScintilla* edit = (*iter).first; ! ! if (select) ! { ! notebook->SetSelection(entry.page); ! edit->SetFocus(); ! } return edit; *************** *** 99,106 **** } - bool select = true; wxString title(GetTitle(edit, entry)); notebook->AddPage(edit,title,select); ! edit->SetFocus(); entry.page = static_cast<int>(notebook->GetPageCount() - 1); --- 102,112 ---- } wxString title(GetTitle(edit, entry)); notebook->AddPage(edit,title,select); ! ! if (select) ! { ! edit->SetFocus(); ! } entry.page = static_cast<int>(notebook->GetPageCount() - 1); Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** sparkedit.h 21 Jun 2007 19:18:00 -0000 1.1.2.3 --- sparkedit.h 21 Jun 2007 19:26:38 -0000 1.1.2.4 *************** *** 48,52 **** public: ! static wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook); static void PutEdit(wxScintilla* edit); static void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); --- 48,52 ---- public: ! static wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook, bool select); static void PutEdit(wxScintilla* edit); static void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); |
From: Markus R. <rol...@us...> - 2007-06-21 19:19:19
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24804 Modified Files: Tag: RSGEDIT_SCINTILLA rsgedit.wxg Log Message: - added file save to menu - added keyboard shortcuts for 'open file', 'save file' and 'reload simulation' Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** rsgedit.wxg 21 Jun 2007 17:54:23 -0000 1.9.2.1 --- rsgedit.wxg 21 Jun 2007 19:19:15 -0000 1.9.2.2 *************** *** 1,4 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.5 on Thu Jun 21 19:53:46 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6" is_template="0"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.5 on Thu Jun 21 21:17:25 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6" is_template="0"> *************** *** 13,28 **** <menu name="" label="&File"> <item> ! <label>&Open</label> <id>ID_FILE_OPEN</id> </item> <item> ! <label>Start &Agent</label> ! <id>ID_AGENT_OPEN</id> </item> <item> ! <label>&Reload</label> <id>ID_FILE_RELOAD</id> </item> <item> <label>&Exit</label> <id>wxID_EXIT</id> --- 13,37 ---- <menu name="" label="&File"> <item> ! <label>&Open\tctrl+o</label> <id>ID_FILE_OPEN</id> </item> <item> ! <label>&Save\tctrl+s</label> ! <id>ID_FILE_SAVE</id> </item> <item> ! <label>&Reload\tctrl+r</label> <id>ID_FILE_RELOAD</id> </item> <item> + <label>---</label> + <id>---</id> + <name>---</name> + </item> + <item> + <label>Start &Agent</label> + <id>ID_AGENT_OPEN</id> + </item> + <item> <label>&Exit</label> <id>wxID_EXIT</id> |
From: Markus R. <rol...@us...> - 2007-06-21 19:18:53
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24402 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp mainframe.h Log Message: - added file save icon to toolbar - added OnFileSave and OnUpdateFileSave handler Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -C2 -d -r1.15.2.2 -r1.15.2.3 *** mainframe.h 21 Jun 2007 18:42:41 -0000 1.15.2.2 --- mainframe.h 21 Jun 2007 19:18:48 -0000 1.15.2.3 *************** *** 101,104 **** --- 101,107 ---- void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnFileSave(wxCommandEvent& event); + void OnUpdateFileSave(wxUpdateUIEvent& event); + void OnFileReload(wxCommandEvent& event); void OnUpdateFileReload(wxUpdateUIEvent& event); Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21.2.3 retrieving revision 1.21.2.4 diff -C2 -d -r1.21.2.3 -r1.21.2.4 *** mainframe.cpp 21 Jun 2007 18:42:41 -0000 1.21.2.3 --- mainframe.cpp 21 Jun 2007 19:18:48 -0000 1.21.2.4 *************** *** 35,38 **** --- 35,39 ---- #include <rsgedit/res/xpm_pause.xpm> #include <rsgedit/res/xpm_open.xpm> + #include <rsgedit/res/xpm_save.xpm> #include <rsgedit/res/xpm_reload.xpm> #include <rsgedit/res/xpm_agent.xpm> *************** *** 76,79 **** --- 77,83 ---- EVT_UPDATE_UI(ID_FILE_OPEN, mainframe::OnUpdateFileOpen) + EVT_MENU(ID_FILE_SAVE, mainframe::OnFileSave) + EVT_UPDATE_UI(ID_FILE_SAVE, mainframe::OnUpdateFileSave) + EVT_MENU(ID_AGENT_OPEN, mainframe::OnAgentOpen) *************** *** 135,141 **** SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxEmptyString, wxITEM_NORMAL); - wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); --- 139,147 ---- SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open\tctrl+o"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_SAVE, wxT("&Save\tctrl+s"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload\tctrl+r"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->AppendSeparator(); wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); *************** *** 188,191 **** --- 194,198 ---- mToolBar->AddTool(ID_FILE_OPEN, wxT("Open"), wxBitmap(xpm_open)); mToolBar->AddTool(ID_FILE_RELOAD, wxT("Reload"), wxBitmap(xpm_reload)); + mToolBar->AddTool(ID_FILE_SAVE, wxT("Save"), wxBitmap(xpm_save)); mToolBar->AddSeparator(); mToolBar->AddTool(ID_AGENT_OPEN, wxT("Start Agent"), wxBitmap(xpm_agent)); *************** *** 920,923 **** --- 927,947 ---- } + void mainframe::OnUpdateFileSave(wxUpdateUIEvent& event) + { + wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); + event.Enable(edit != 0); + } + + void mainframe::OnFileSave(wxCommandEvent& event) + { + wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); + if (edit == 0) + { + return; + } + + SparkEdit::SaveFile(edit); + } + void mainframe::OnFileOpen(wxCommandEvent& event) { |
From: Markus R. <rol...@us...> - 2007-06-21 19:18:04
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23936 Modified Files: Tag: RSGEDIT_SCINTILLA sparkedit.cpp sparkedit.h Log Message: - added SparkEdit::SaveFile method Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.cpp,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** sparkedit.cpp 21 Jun 2007 18:42:41 -0000 1.1.2.3 --- sparkedit.cpp 21 Jun 2007 19:18:00 -0000 1.1.2.4 *************** *** 239,240 **** --- 239,252 ---- notebook->SetPageText(entry.page, GetTitle(edit, entry)); } + + void SparkEdit::SaveFile(wxScintilla* edit) + { + TEditMap::iterator iter = mEditMap.find(edit); + if (iter == mEditMap.end()) + { + return; + } + + const EditEntry& entry = (*iter).second; + edit->SaveFile(entry.fname); + } Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** sparkedit.h 21 Jun 2007 18:42:41 -0000 1.1.2.2 --- sparkedit.h 21 Jun 2007 19:18:00 -0000 1.1.2.3 *************** *** 51,54 **** --- 51,55 ---- static void PutEdit(wxScintilla* edit); static void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); + static void SaveFile(wxScintilla* edit); protected: |
From: Markus R. <rol...@us...> - 2007-06-21 19:17:21
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23906 Modified Files: Tag: RSGEDIT_SCINTILLA constants.h Log Message: - added ID_FILE_SAVE constant Index: constants.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/constants.h,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** constants.h 15 Jun 2007 10:42:40 -0000 1.8 --- constants.h 21 Jun 2007 19:17:17 -0000 1.8.2.1 *************** *** 61,65 **** ID_LOG_CHANNEL_NORMAL = (wxID_HIGHEST+37), ID_LOG_CHANNEL_WARNING = (wxID_HIGHEST+38), ! ID_LOG_CHANNEL_ERROR = (wxID_HIGHEST+39) }; --- 61,67 ---- ID_LOG_CHANNEL_NORMAL = (wxID_HIGHEST+37), ID_LOG_CHANNEL_WARNING = (wxID_HIGHEST+38), ! ID_LOG_CHANNEL_ERROR = (wxID_HIGHEST+39), ! ! ID_FILE_SAVE = (wxID_HIGHEST+40) }; |
From: Markus R. <rol...@us...> - 2007-06-21 19:17:00
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23521 Added Files: Tag: RSGEDIT_SCINTILLA xpm_save.xpm Log Message: - added file save icon --- NEW FILE: xpm_save.xpm --- /* XPM */ static const char *xpm_save[] = { "16 16 3 1", " c #C0C0C0", ". c #000000", "X c #808000", " ", " .............. ", " .X. . . ", " .X. ... ", " .X. .X. ", " .X. .X. ", " .X. .X. ", " .X. .X. ", " .XX........XX. ", " .XXXXXXXXXXXX. ", " .XX.........X. ", " .XX...... .X. ", " .XX...... .X. ", " .XX...... .X. ", " ............. ", " "}; |
From: Markus R. <rol...@us...> - 2007-06-21 18:43:18
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9861 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp mainframe.h sparkedit.cpp sparkedit.h Log Message: - track modified state of scintilla tabs and indicate it with an asterisk in the tab label Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -C2 -d -r1.15.2.1 -r1.15.2.2 *** mainframe.h 21 Jun 2007 17:55:43 -0000 1.15.2.1 --- mainframe.h 21 Jun 2007 18:42:41 -0000 1.15.2.2 *************** *** 29,32 **** --- 29,33 ---- #include <wx/image.h> #include <wx/wxflatnotebook/wxflatnotebook.h> + #include <wx/wxscintilla.h> #include "constants.h" #include "sparktree.h" *************** *** 152,155 **** --- 153,159 ---- void OnTabClosing(wxFlatNotebookEvent& event); + void OnEditSavePointReached(wxScintillaEvent& event); + void OnEditSavePointLeft(wxScintillaEvent& event); + void OnSparkContext(SparkContextEvent& event); Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.cpp,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** sparkedit.cpp 21 Jun 2007 18:22:39 -0000 1.1.2.2 --- sparkedit.cpp 21 Jun 2007 18:42:41 -0000 1.1.2.3 *************** *** 46,49 **** --- 46,62 ---- } + wxString SparkEdit::GetTitle(wxScintilla* edit, const EditEntry& entry) + { + + wxString title(wxFileName(entry.fname).GetFullName()); + + if (edit->GetModify()) + { + title += "*"; + } + + return title; + } + wxScintilla* SparkEdit::GetEdit(const wxString& fname, wxFlatNotebook* notebook) { *************** *** 87,91 **** bool select = true; ! notebook->AddPage(edit,wxFileName(fname).GetFullName(), select); edit->SetFocus(); --- 100,105 ---- bool select = true; ! wxString title(GetTitle(edit, entry)); ! notebook->AddPage(edit,title,select); edit->SetFocus(); *************** *** 207,208 **** --- 221,240 ---- mEditMap.erase(iter); } + + void SparkEdit::UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit) + { + if (notebook == 0) + { + assert(false); + return; + } + + TEditMap::iterator iter = mEditMap.find(edit); + if (iter == mEditMap.end()) + { + return; + } + + const EditEntry& entry = (*iter).second; + notebook->SetPageText(entry.page, GetTitle(edit, entry)); + } Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21.2.2 retrieving revision 1.21.2.3 diff -C2 -d -r1.21.2.2 -r1.21.2.3 *** mainframe.cpp 21 Jun 2007 18:22:39 -0000 1.21.2.2 --- mainframe.cpp 21 Jun 2007 18:42:41 -0000 1.21.2.3 *************** *** 105,108 **** --- 105,111 ---- EVT_FLATNOTEBOOK_PAGE_CLOSING(wxID_ANY, mainframe::OnTabClosing) + EVT_SCI_SAVEPOINTREACHED(wxID_ANY, mainframe::OnEditSavePointReached) + EVT_SCI_SAVEPOINTLEFT(wxID_ANY, mainframe::OnEditSavePointLeft) + EVT_SPARK_CONTEXT(ID_SPARK_CONTEXT, mainframe::OnSparkContext) END_EVENT_TABLE() *************** *** 1105,1106 **** --- 1108,1122 ---- event.Skip(); } + + void mainframe::OnEditSavePointReached(wxScintillaEvent& event) + { + SparkEdit::UpdateTitle(mCtrNotebook,static_cast<wxScintilla*>(event.GetEventObject())); + event.Skip(); + } + + void mainframe::OnEditSavePointLeft(wxScintillaEvent& event) + { + SparkEdit::UpdateTitle(mCtrNotebook,static_cast<wxScintilla*>(event.GetEventObject())); + event.Skip(); + } + Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** sparkedit.h 21 Jun 2007 17:56:39 -0000 1.1.2.1 --- sparkedit.h 21 Jun 2007 18:42:41 -0000 1.1.2.2 *************** *** 50,53 **** --- 50,54 ---- static wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook); static void PutEdit(wxScintilla* edit); + static void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); protected: *************** *** 55,58 **** --- 56,60 ---- static bool LoadFile(wxScintilla* edit, EditEntry& entry); static void PrepareEdit(wxScintilla* edit, const EditEntry& entry); + static wxString GetTitle(wxScintilla* edit, const EditEntry& entry); protected: |
From: Markus R. <rol...@us...> - 2007-06-21 18:22:55
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1856 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp sparkedit.cpp Log Message: - add tooltips to the tabs Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/sparkedit.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** sparkedit.cpp 21 Jun 2007 17:56:39 -0000 1.1.2.1 --- sparkedit.cpp 21 Jun 2007 18:22:39 -0000 1.1.2.2 *************** *** 115,118 **** --- 115,119 ---- } + edit->SetToolTip(entry.fname); wxString ext(fn.GetExt().Lower()); Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -C2 -d -r1.21.2.1 -r1.21.2.2 *** mainframe.cpp 21 Jun 2007 17:55:43 -0000 1.21.2.1 --- mainframe.cpp 21 Jun 2007 18:22:39 -0000 1.21.2.2 *************** *** 177,180 **** --- 177,181 ---- mCtrNotebook->RemovePage(0); mCanvas = new SparkGLCanvas(mCtrNotebook, wxID_ANY); + mCanvas->SetToolTip("simulation window"); mCtrNotebook->AddPage(mCanvas, wxT("Canvas")); |
From: Markus R. <rol...@us...> - 2007-06-21 17:58:59
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24922 Modified Files: Tag: RSGEDIT_SCINTILLA aboutDlg.cpp agentframe.cpp propertyframe.cpp Log Message: - minor changes in autogenerated code due to more recent wxGlade version Index: agentframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/agentframe.cpp,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** agentframe.cpp 15 Mar 2007 07:26:24 -0000 1.2 --- agentframe.cpp 21 Jun 2007 17:58:53 -0000 1.2.6.1 *************** *** 49,53 **** // begin wxGlade: agentframe::agentframe ! mCtrLog = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY); set_properties(); --- 49,53 ---- // begin wxGlade: agentframe::agentframe ! mCtrLog = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY); set_properties(); *************** *** 81,86 **** // begin wxGlade: agentframe::do_layout wxBoxSizer* sizer_10 = new wxBoxSizer(wxVERTICAL); ! sizer_10->Add(mCtrLog, 1, wxEXPAND|wxADJUST_MINSIZE, 0); ! SetAutoLayout(true); SetSizer(sizer_10); Layout(); --- 81,85 ---- // begin wxGlade: agentframe::do_layout wxBoxSizer* sizer_10 = new wxBoxSizer(wxVERTICAL); ! sizer_10->Add(mCtrLog, 1, wxEXPAND, 0); SetSizer(sizer_10); Layout(); Index: propertyframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.cpp,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** propertyframe.cpp 17 May 2007 17:49:23 -0000 1.4 --- propertyframe.cpp 21 Jun 2007 17:58:53 -0000 1.4.4.1 *************** *** 36,40 **** { // begin wxGlade: propertyframe::propertyframe ! mCtrPropList = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER); set_properties(); --- 36,40 ---- { // begin wxGlade: propertyframe::propertyframe ! mCtrPropList = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER); set_properties(); *************** *** 58,62 **** wxBoxSizer* sizer_3 = new wxBoxSizer(wxVERTICAL); sizer_3->Add(mCtrPropList, 1, wxEXPAND, 0); - SetAutoLayout(true); SetSizer(sizer_3); Layout(); --- 58,61 ---- Index: aboutDlg.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/aboutDlg.cpp,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** aboutDlg.cpp 15 Mar 2007 07:26:24 -0000 1.2 --- aboutDlg.cpp 21 Jun 2007 17:58:53 -0000 1.2.6.1 *************** *** 8,13 **** { // begin wxGlade: aboutDlg::aboutDlg ! mBitmap = new wxStaticBitmap(this, -1, wxNullBitmap); ! label_1 = new wxStaticText(this, -1, wxT("SimSpark Copyright (C) RoboCup Soccer Server 3D Maintenance Group")); button_1 = new wxButton(this, wxID_OK, wxT("&Ok")); --- 8,13 ---- { // begin wxGlade: aboutDlg::aboutDlg ! mBitmap = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap); ! label_1 = new wxStaticText(this, wxID_ANY, wxT("SimSpark Copyright (C) RoboCup Soccer Server 3D Maintenance Group")); button_1 = new wxButton(this, wxID_OK, wxT("&Ok")); *************** *** 33,43 **** // begin wxGlade: aboutDlg::do_layout wxBoxSizer* sizer_9 = new wxBoxSizer(wxVERTICAL); ! sizer_9->Add(mBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE, 5); ! sizer_9->Add(label_1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE, 5); ! sizer_9->Add(button_1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE, 5); ! SetAutoLayout(true); SetSizer(sizer_9); sizer_9->Fit(this); - sizer_9->SetSizeHints(this); Layout(); // end wxGlade --- 33,41 ---- // begin wxGlade: aboutDlg::do_layout wxBoxSizer* sizer_9 = new wxBoxSizer(wxVERTICAL); ! sizer_9->Add(mBitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5); ! sizer_9->Add(label_1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5); ! sizer_9->Add(button_1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5); SetSizer(sizer_9); sizer_9->Fit(this); Layout(); // end wxGlade |
From: Markus R. <rol...@us...> - 2007-06-21 17:56:44
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24132 Added Files: Tag: RSGEDIT_SCINTILLA sparkedit.cpp sparkedit.h Log Message: - added SparkEdit, a class to manage wxScintilla instances --- NEW FILE: sparkedit.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2003 Koblenz University $Id: sparkedit.cpp,v 1.1.2.1 2007/06/21 17:56:39 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "sparkedit.h" #include <wx/colour.h> #include <wx/filename.h> static wxColour COL_COMMENT(0,128,0); static wxColour COL_KEYWORD(0,0,255); SparkEdit::TEditMap SparkEdit::mEditMap; wxScintilla* SparkEdit::Create(wxWindow* parent) { wxScintilla* edit = new wxScintilla(parent, wxID_ANY); // setup basic styles edit->SetMarginWidth(0, 24); edit->SetMarginWidth(1, 0); edit->SetMarginWidth(2, 0); edit->SetMarginType(0, wxSCI_MARGIN_NUMBER); edit->StyleSetVisible(wxSCI_STYLE_LINENUMBER, true); edit->SetCaretLineBackground(wxColour(255,255,0)); edit->SetCaretLineVisible(true); return edit; } wxScintilla* SparkEdit::GetEdit(const wxString& fname, wxFlatNotebook* notebook) { if (notebook == 0) { assert(false); return 0; } wxFileName fn(fname); fn.Normalize(); for ( TEditMap::iterator iter = mEditMap.begin(); iter != mEditMap.end(); ++iter ) { EditEntry& entry = (*iter).second; if (fn.GetFullPath() == entry.fname) { notebook->SetSelection(entry.page); wxScintilla* edit = (*iter).first; edit->SetFocus(); return edit; } } wxScintilla* edit = Create(notebook); EditEntry entry; entry.fname = fn.GetFullPath(); if (! LoadFile(edit, entry)) { edit->Destroy(); return 0; } bool select = true; notebook->AddPage(edit,wxFileName(fname).GetFullName(), select); edit->SetFocus(); entry.page = static_cast<int>(notebook->GetPageCount() - 1); mEditMap[edit] = entry; return edit; } bool SparkEdit::LoadFile(wxScintilla* edit, EditEntry& entry) { if (edit == 0) { assert(false); return false; } wxFileName fn(entry.fname); if ( (! fn.FileExists()) || (! edit->LoadFile(entry.fname)) ) { edit->ClearAll(); return false; } wxString ext(fn.GetExt().Lower()); if (ext == "rsg") { entry.type = ET_RSG; } else if (ext == "rb") { entry.type = ET_RB; } else if ( (ext == "c") || (ext == "cpp") || (ext == "cxx") || (ext == "h") || (ext == "hpp") ) { entry.type = ET_C; } else { entry.type = ET_TEXT; } PrepareEdit(edit, entry); return true; } void SparkEdit::PrepareEdit(wxScintilla* edit, const EditEntry& entry) { if (edit == 0) { assert(false); return; } switch (entry.type) { default: assert(false); // fall through case ET_TEXT: { edit->SetLexer(wxSCI_LEX_NULL); break; } case ET_RSG: { edit->SetLexer(wxSCI_LEX_LISP); edit->SetKeyWords(0, "node select pwd template define attach RubyDeltaScene RubySceneGraph " "nd sel pwd templ def attach RDS RSG" ); edit->StyleSetForeground(wxSCI_LISP_KEYWORD, COL_KEYWORD); edit->StyleSetForeground(wxSCI_LISP_COMMENT, COL_COMMENT); edit->StyleSetForeground(wxSCI_LISP_MULTI_COMMENT, COL_COMMENT); break; } case ET_RB: { edit->SetLexer(wxSCI_LEX_RUBY); // todo: set ruby color styles break; } case ET_C: { edit->SetLexer(wxSCI_LEX_CPP); // todo: set c color styles break; } } edit->Colourise(0,-1); } void SparkEdit::PutEdit(wxScintilla* edit) { TEditMap::iterator iter = mEditMap.find(edit); if (iter == mEditMap.end()) { assert(false); return; } mEditMap.erase(iter); } --- NEW FILE: sparkedit.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2003 Koblenz University $Id: sparkedit.h,v 1.1.2.1 2007/06/21 17:56:39 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef SPARKEDIT_H__ #define SPARKEDIT_H__ #include <wx/string.h> #include <wx/wxscintilla.h> #include <wx/wxflatnotebook/wxflatnotebook.h> #include <map> class SparkEdit { public: enum EEditType { ET_RSG, ET_RB, ET_C, ET_TEXT }; struct EditEntry { EEditType type; wxString fname; int page; }; typedef std::map<wxScintilla*, EditEntry > TEditMap; public: static wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook); static void PutEdit(wxScintilla* edit); protected: static wxScintilla* Create(wxWindow* parent); static bool LoadFile(wxScintilla* edit, EditEntry& entry); static void PrepareEdit(wxScintilla* edit, const EditEntry& entry); protected: static TEditMap mEditMap; }; #endif // SPARKEDIT_H__ |
From: Markus R. <rol...@us...> - 2007-06-21 17:55:47
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23736 Modified Files: Tag: RSGEDIT_SCINTILLA mainframe.cpp mainframe.h Log Message: - add the OpenGl window as a tab to the notebook control - use wxScintilla edit controls to open ruby and rsg files - use the SparkEdit class to manage edit controls Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** mainframe.h 15 Jun 2007 10:42:40 -0000 1.15 --- mainframe.h 21 Jun 2007 17:55:43 -0000 1.15.2.1 *************** *** 23,28 **** --- 23,32 ---- #endif + #ifndef MAINFRAME_H + #define MAINFRAME_H + #include <wx/wx.h> #include <wx/image.h> + #include <wx/wxflatnotebook/wxflatnotebook.h> #include "constants.h" #include "sparktree.h" *************** *** 30,36 **** #include <oxygen/sceneserver/scenedict.h> - #ifndef MAINFRAME_H - #define MAINFRAME_H - class SparkGLCanvas; class SparkContextEvent; --- 34,37 ---- *************** *** 149,152 **** --- 150,155 ---- void OnTreeItemRightClick(wxTreeEvent& event); + void OnTabClosing(wxFlatNotebookEvent& event); + void OnSparkContext(SparkContextEvent& event); *************** *** 179,183 **** wxSplitterWindow* window_1; wxPanel* mLeftPane; ! SparkGLCanvas* mCanvas; wxPanel* mTopPane; wxTextCtrl* mCtrLog; --- 182,186 ---- wxSplitterWindow* window_1; wxPanel* mLeftPane; ! wxFlatNotebook* mCtrNotebook; wxPanel* mTopPane; wxTextCtrl* mCtrLog; *************** *** 217,220 **** --- 220,225 ---- wxString mSimFName; + SparkGLCanvas* mCanvas; + DECLARE_EVENT_TABLE() }; // wxGlade: end class Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** mainframe.cpp 15 Jun 2007 10:42:40 -0000 1.21 --- mainframe.cpp 21 Jun 2007 17:55:43 -0000 1.21.2.1 *************** *** 24,27 **** --- 24,28 ---- #include "propertyframe.h" #include "agentframe.h" + #include "sparkedit.h" #include <wx/filename.h> *************** *** 102,105 **** --- 103,108 ---- EVT_TREE_ITEM_RIGHT_CLICK(1, mainframe::OnTreeItemRightClick) + EVT_FLATNOTEBOOK_PAGE_CLOSING(wxID_ANY, mainframe::OnTabClosing) + EVT_SPARK_CONTEXT(ID_SPARK_CONTEXT, mainframe::OnSparkContext) END_EVENT_TABLE() *************** *** 117,136 **** // begin wxGlade: mainframe::mainframe ! mCtrVertSplitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_NOBORDER); ! mRightPane = new wxPanel(mCtrVertSplitter, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL); ! mCtrHorSplitter = new wxSplitterWindow(mRightPane, -1, wxDefaultPosition, wxDefaultSize, wxSP_NOBORDER); ! mBottomPane = new wxPanel(mCtrHorSplitter, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! mTopPane = new wxPanel(mCtrHorSplitter, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! mLeftPane = new wxPanel(mCtrVertSplitter, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL); ! window_1 = new wxSplitterWindow(mLeftPane, -1, wxDefaultPosition, wxDefaultSize, wxSP_3DBORDER|wxSP_BORDER); ! window_1_pane_2 = new wxPanel(window_1, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! window_1_pane_1 = new wxPanel(window_1, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxT(""), wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxT(""), wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload"), wxT(""), wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxT(""), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); wxMenu* wxglade_tmp_menu_2 = new wxMenu(); --- 120,139 ---- // begin wxGlade: mainframe::mainframe ! mCtrVertSplitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_NOBORDER); ! mRightPane = new wxPanel(mCtrVertSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL); ! mCtrHorSplitter = new wxSplitterWindow(mRightPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_NOBORDER); ! mBottomPane = new wxPanel(mCtrHorSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! mTopPane = new wxPanel(mCtrHorSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! mLeftPane = new wxPanel(mCtrVertSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL); ! window_1 = new wxSplitterWindow(mLeftPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DBORDER|wxSP_BORDER); ! window_1_pane_2 = new wxPanel(window_1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); ! window_1_pane_1 = new wxPanel(window_1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL); MainFrame_menubar = new wxMenuBar(); SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); ! wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_AGENT_OPEN, wxT("Start &Agent"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload"), wxEmptyString, wxITEM_NORMAL); ! wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); wxMenu* wxglade_tmp_menu_2 = new wxMenu(); *************** *** 139,158 **** MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&View")); wxMenu* wxglade_tmp_menu_3 = new wxMenu(); ! wxglade_tmp_menu_3->Append(ID_SIM_STEP, wxT("St&ep"), wxT(""), wxITEM_NORMAL); wxglade_tmp_menu_3->Append(ID_SIM_START, wxT("&Start"), wxT("Start simulation"), wxITEM_NORMAL); wxglade_tmp_menu_3->Append(ID_SIM_PAUSE, wxT("&Pause"), wxT("Pause Simulation"), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_3, wxT("&Simulation")); wxMenu* wxglade_tmp_menu_4 = new wxMenu(); ! wxglade_tmp_menu_4->Append(ID_HELP_ABOUT, wxT("&About"), wxT(""), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_4, wxT("&Help")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCtrPropList = new wxListCtrl(window_1_pane_1, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSIMPLE_BORDER); mCtrTree = new wxTreeCtrl(window_1_pane_2, 1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_LINES_AT_ROOT|wxTR_DEFAULT_STYLE|wxSIMPLE_BORDER); ! mCanvas = new SparkGLCanvas(mTopPane, -1); ! mCtrLog = new wxTextCtrl(mBottomPane, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxNO_BORDER); button_2 = new wxButton(mBottomPane, ID_LOG_CLEAR, wxT("Clear")); button_3 = new wxButton(mBottomPane, ID_LOG_COPY, wxT("Copy")); ! static_line_1 = new wxStaticLine(mBottomPane, -1); ! label_2 = new wxStaticText(mBottomPane, -1, wxT("Log Channels")); mCtrLogChannelDebug = new wxCheckBox(mBottomPane, ID_LOG_CHANNEL_DEBUG, wxT("Debug")); mCtrLogChannelNormal = new wxCheckBox(mBottomPane, ID_LOG_CHANNEL_NORMAL, wxT("Normal")); --- 142,161 ---- MainFrame_menubar->Append(wxglade_tmp_menu_2, wxT("&View")); wxMenu* wxglade_tmp_menu_3 = new wxMenu(); ! wxglade_tmp_menu_3->Append(ID_SIM_STEP, wxT("St&ep"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_3->Append(ID_SIM_START, wxT("&Start"), wxT("Start simulation"), wxITEM_NORMAL); wxglade_tmp_menu_3->Append(ID_SIM_PAUSE, wxT("&Pause"), wxT("Pause Simulation"), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_3, wxT("&Simulation")); wxMenu* wxglade_tmp_menu_4 = new wxMenu(); ! wxglade_tmp_menu_4->Append(ID_HELP_ABOUT, wxT("&About"), wxEmptyString, wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_4, wxT("&Help")); MainFrame_statusbar = CreateStatusBar(1, 0); ! mCtrPropList = new wxListCtrl(window_1_pane_1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSIMPLE_BORDER); mCtrTree = new wxTreeCtrl(window_1_pane_2, 1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_LINES_AT_ROOT|wxTR_DEFAULT_STYLE|wxSIMPLE_BORDER); ! mCtrNotebook = new wxFlatNotebook(mTopPane, wxID_ANY); ! mCtrLog = new wxTextCtrl(mBottomPane, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL|wxNO_BORDER); button_2 = new wxButton(mBottomPane, ID_LOG_CLEAR, wxT("Clear")); button_3 = new wxButton(mBottomPane, ID_LOG_COPY, wxT("Copy")); ! static_line_1 = new wxStaticLine(mBottomPane, wxID_ANY); ! label_2 = new wxStaticText(mBottomPane, wxID_ANY, wxT("Log Channels")); mCtrLogChannelDebug = new wxCheckBox(mBottomPane, ID_LOG_CHANNEL_DEBUG, wxT("Debug")); mCtrLogChannelNormal = new wxCheckBox(mBottomPane, ID_LOG_CHANNEL_NORMAL, wxT("Normal")); *************** *** 164,167 **** --- 167,182 ---- // end wxGlade + mCtrNotebook->SetWindowStyleFlag + (mCtrNotebook->GetWindowStyleFlag() + | wxFNB_DROPDOWN_TABS_LIST + | wxFNB_X_ON_TAB + | wxFNB_MOUSE_MIDDLE_CLOSES_TABS + | wxFNB_VC8 + ); + + mCtrNotebook->RemovePage(0); + mCanvas = new SparkGLCanvas(mCtrNotebook, wxID_ANY); + mCtrNotebook->AddPage(mCanvas, wxT("Canvas")); + // create toolbar mToolBar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL, wxID_ANY ); *************** *** 248,252 **** // begin wxGlade: mainframe::set_properties SetTitle(wxT("RsgEdit")); ! SetSize(wxSize(1024, 770)); int MainFrame_statusbar_widths[] = { 0 }; MainFrame_statusbar->SetStatusWidths(1, MainFrame_statusbar_widths); --- 263,267 ---- // begin wxGlade: mainframe::set_properties SetTitle(wxT("RsgEdit")); ! SetSize(wxSize(1076, 786)); int MainFrame_statusbar_widths[] = { 0 }; MainFrame_statusbar->SetStatusWidths(1, MainFrame_statusbar_widths); *************** *** 272,318 **** wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL); sizer_4->Add(mCtrPropList, 1, wxEXPAND, 0); - window_1_pane_1->SetAutoLayout(true); window_1_pane_1->SetSizer(sizer_4); - sizer_4->Fit(window_1_pane_1); - sizer_4->SetSizeHints(window_1_pane_1); sizer_8->Add(mCtrTree, 1, wxEXPAND, 0); - window_1_pane_2->SetAutoLayout(true); window_1_pane_2->SetSizer(sizer_8); - sizer_8->Fit(window_1_pane_2); - sizer_8->SetSizeHints(window_1_pane_2); window_1->SplitHorizontally(window_1_pane_1, window_1_pane_2); sizer_7->Add(window_1, 1, wxEXPAND, 0); - mLeftPane->SetAutoLayout(true); mLeftPane->SetSizer(sizer_7); ! sizer_7->Fit(mLeftPane); ! sizer_7->SetSizeHints(mLeftPane); ! sizer_5->Add(mCanvas, 1, wxEXPAND, 0); ! mTopPane->SetAutoLayout(true); mTopPane->SetSizer(sizer_5); - sizer_5->Fit(mTopPane); - sizer_5->SetSizeHints(mTopPane); sizer_6->Add(mCtrLog, 1, wxEXPAND, 0); ! sizer_11->Add(button_2, 0, wxALL|wxEXPAND|wxADJUST_MINSIZE, 5); ! sizer_11->Add(button_3, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxADJUST_MINSIZE, 5); sizer_11->Add(static_line_1, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5); ! sizer_11->Add(label_2, 0, wxALL|wxADJUST_MINSIZE, 5); ! sizer_11->Add(mCtrLogChannelDebug, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5); ! sizer_11->Add(mCtrLogChannelNormal, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5); ! sizer_11->Add(mCtrLogChannelWarning, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5); ! sizer_11->Add(mCtrLogChannelError, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5); sizer_6->Add(sizer_11, 0, 0, 0); - mBottomPane->SetAutoLayout(true); mBottomPane->SetSizer(sizer_6); - sizer_6->Fit(mBottomPane); - sizer_6->SetSizeHints(mBottomPane); mCtrHorSplitter->SplitHorizontally(mTopPane, mBottomPane); sizer_2->Add(mCtrHorSplitter, 1, wxEXPAND, 0); - mRightPane->SetAutoLayout(true); mRightPane->SetSizer(sizer_2); - sizer_2->Fit(mRightPane); - sizer_2->SetSizeHints(mRightPane); mCtrVertSplitter->SplitVertically(mLeftPane, mRightPane); sizer_1->Add(mCtrVertSplitter, 1, wxEXPAND, 0); - SetAutoLayout(true); SetSizer(sizer_1); Layout(); --- 287,314 ---- wxBoxSizer* sizer_4 = new wxBoxSizer(wxVERTICAL); sizer_4->Add(mCtrPropList, 1, wxEXPAND, 0); window_1_pane_1->SetSizer(sizer_4); sizer_8->Add(mCtrTree, 1, wxEXPAND, 0); window_1_pane_2->SetSizer(sizer_8); window_1->SplitHorizontally(window_1_pane_1, window_1_pane_2); sizer_7->Add(window_1, 1, wxEXPAND, 0); mLeftPane->SetSizer(sizer_7); ! sizer_5->Add(mCtrNotebook, 1, wxEXPAND, 0); mTopPane->SetSizer(sizer_5); sizer_6->Add(mCtrLog, 1, wxEXPAND, 0); ! sizer_11->Add(button_2, 0, wxALL|wxEXPAND, 5); ! sizer_11->Add(button_3, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 5); sizer_11->Add(static_line_1, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 5); ! sizer_11->Add(label_2, 0, wxALL, 5); ! sizer_11->Add(mCtrLogChannelDebug, 0, wxLEFT|wxRIGHT|wxBOTTOM, 5); ! sizer_11->Add(mCtrLogChannelNormal, 0, wxLEFT|wxRIGHT|wxBOTTOM, 5); ! sizer_11->Add(mCtrLogChannelWarning, 0, wxLEFT|wxRIGHT|wxBOTTOM, 5); ! sizer_11->Add(mCtrLogChannelError, 0, wxLEFT|wxRIGHT|wxBOTTOM, 5); sizer_6->Add(sizer_11, 0, 0, 0); mBottomPane->SetSizer(sizer_6); mCtrHorSplitter->SplitHorizontally(mTopPane, mBottomPane); sizer_2->Add(mCtrHorSplitter, 1, wxEXPAND, 0); mRightPane->SetSizer(sizer_2); mCtrVertSplitter->SplitVertically(mLeftPane, mRightPane); sizer_1->Add(mCtrVertSplitter, 1, wxEXPAND, 0); SetSizer(sizer_1); Layout(); *************** *** 754,757 **** --- 750,754 ---- void mainframe::EditFile(const wxString& fname, int line) { + #if 0 wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain"); if (ft == 0) *************** *** 770,773 **** --- 767,784 ---- wxExecute(cmd); + #endif + + wxScintilla* edit = SparkEdit::GetEdit(fname,mCtrNotebook); + if (edit != 0) + { + edit->GotoLine(line); + } + + if (edit == 0) + { + return; + } + + edit->GotoLine(line); } *************** *** 1075,1076 **** --- 1086,1105 ---- spark->SetLogPriority(mask); } + + void mainframe::OnTabClosing(wxFlatNotebookEvent& event) + { + wxWindow* page = mCtrNotebook->GetPage(event.GetSelection()); + if (page == mCanvas) + { + event.Veto(); + return; + } + + wxScintilla* edit = dynamic_cast<wxScintilla*>(page); + if (edit != 0) + { + SparkEdit::PutEdit(edit); + } + + event.Skip(); + } |
From: Markus R. <rol...@us...> - 2007-06-21 17:55:03
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23315 Modified Files: Tag: RSGEDIT_SCINTILLA rsgedit.wxg Log Message: - replaced main OpenGl window with a tabbed wxFlatNotebook control Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** rsgedit.wxg 15 Jun 2007 10:42:40 -0000 1.9 --- rsgedit.wxg 21 Jun 2007 17:54:23 -0000 1.9.2.1 *************** *** 1,6 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4.1 on Fri Jun 15 12:41:21 2007 --> ! <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> <object class="mainframe" name="MainFrame" base="EditFrame"> <style>wxICONIZE|wxCAPTION|wxMINIMIZE|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxCLIP_CHILDREN</style> --- 1,6 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.5 on Thu Jun 21 19:53:46 2007 --> ! <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6" is_template="0"> <object class="mainframe" name="MainFrame" base="EditFrame"> <style>wxICONIZE|wxCAPTION|wxMINIMIZE|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxCLIP_CHILDREN</style> *************** *** 8,12 **** <menubar>1</menubar> <statusbar>1</statusbar> ! <size>1024, 770</size> <object class="wxMenuBar" name="MainFrame_menubar" base="EditMenuBar"> <menus> --- 8,12 ---- <menubar>1</menubar> <statusbar>1</statusbar> ! <size>1076, 786</size> <object class="wxMenuBar" name="MainFrame_menubar" base="EditMenuBar"> <menus> *************** *** 150,154 **** <border>0</border> <option>1</option> ! <object class="SparkGLCanvas" name="mCanvas" base="CustomWidget"> <arguments> <argument>$parent</argument> --- 150,154 ---- <border>0</border> <option>1</option> ! <object class="wxFlatNotebook" name="mCtrNotebook" base="CustomWidget"> <arguments> <argument>$parent</argument> *************** *** 177,181 **** <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxALL|wxEXPAND|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 177,181 ---- <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxALL|wxEXPAND</flag> <border>5</border> <option>0</option> *************** *** 186,190 **** </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 186,190 ---- </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND</flag> <border>5</border> <option>0</option> *************** *** 204,208 **** </object> <object class="sizeritem"> ! <flag>wxALL|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 204,208 ---- </object> <object class="sizeritem"> ! <flag>wxALL</flag> <border>5</border> <option>0</option> *************** *** 213,217 **** </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 213,217 ---- </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM</flag> <border>5</border> <option>0</option> *************** *** 222,226 **** </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 222,226 ---- </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM</flag> <border>5</border> <option>0</option> *************** *** 231,235 **** </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 231,235 ---- </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM</flag> <border>5</border> <option>0</option> *************** *** 240,244 **** </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 240,244 ---- </object> <object class="sizeritem"> ! <flag>wxLEFT|wxRIGHT|wxBOTTOM</flag> <border>5</border> <option>0</option> *************** *** 282,286 **** <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 282,286 ---- <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag> <border>5</border> <option>0</option> *************** *** 291,295 **** </object> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 291,295 ---- </object> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag> <border>5</border> <option>0</option> *************** *** 300,304 **** </object> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxADJUST_MINSIZE</flag> <border>5</border> <option>0</option> --- 300,304 ---- </object> <object class="sizeritem"> ! <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag> <border>5</border> <option>0</option> *************** *** 317,321 **** <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxEXPAND|wxADJUST_MINSIZE</flag> <border>0</border> <option>1</option> --- 317,321 ---- <orient>wxVERTICAL</orient> <object class="sizeritem"> ! <flag>wxEXPAND</flag> <border>0</border> <option>1</option> |
From: Markus R. <rol...@us...> - 2007-06-21 17:53:48
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22935 Modified Files: Tag: RSGEDIT_SCINTILLA rsgedit.vcproj Log Message: - added wxFlatNotebook files - added SparkEdit files Index: rsgedit.vcproj =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.vcproj,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.2 diff -C2 -d -r1.4.6.1 -r1.4.6.2 *** rsgedit.vcproj 19 Jun 2007 05:20:35 -0000 1.4.6.1 --- rsgedit.vcproj 21 Jun 2007 17:53:40 -0000 1.4.6.2 *************** *** 41,45 **** Name="VCCLCompilerTool" Optimization="0" ! AdditionalIncludeDirectories="..\..\spark\win32;..\..\spark;..\..\spark\utility;..\;wxscintilla\include;wxscintilla\src\scintilla\include;wxscintilla\src\scintilla\src" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;SCI_LEXER" MinimalRebuild="true" --- 41,45 ---- Name="VCCLCompilerTool" Optimization="0" ! AdditionalIncludeDirectories="..\..\spark\win32;..\..\spark;..\..\spark\utility;..\;wxscintilla\include;wxscintilla\src\scintilla\include;wxscintilla\src\scintilla\src;wxflatnotebook\include;wxflatnotebook\isrc" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;SCI_LEXER" MinimalRebuild="true" *************** *** 647,650 **** --- 647,698 ---- </Filter> </Filter> + <Filter + Name="wxflatnotebook" + > + <File + RelativePath=".\wxflatnotebook\src\wxflatnotebook\fnb_resources.cpp" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\fnb_resources.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\src\wxflatnotebook\popup_dlg.cpp" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\popup_dlg.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\src\wxflatnotebook\renderer.cpp" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\renderer.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\singleton.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\smart_ptr.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\src\wxflatnotebook\wxFlatNotebook.cpp" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\wxflatnotebook.h" + > + </File> + <File + RelativePath=".\wxflatnotebook\include\wx\wxflatnotebook\wxfnbdroptarget.h" + > + </File> + </Filter> <File RelativePath=".\aboutDlg.cpp" *************** *** 752,755 **** --- 800,811 ---- </File> <File + RelativePath=".\sparkedit.cpp" + > + </File> + <File + RelativePath=".\sparkedit.h" + > + </File> + <File RelativePath=".\sparkglcanvas.cpp" > |
From: Markus R. <rol...@us...> - 2007-06-21 17:52:51
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/wxflatnotebook/include/wx/wxflatnotebook In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22509/include/wx/wxflatnotebook Added Files: Tag: RSGEDIT_SCINTILLA fnb_resources.h popup_dlg.h renderer.h singleton.h smart_ptr.h wxflatnotebook.h wxfnbdroptarget.h Log Message: - added wxFlatNotebook files, a custom wxWidgets control that implements tabbed windows (taken from http://sourceforge.net/projects/wxflatnotebook) --- NEW FILE: popup_dlg.h --- #ifndef FNB_POPUPDLG_H #define FNB_POPUPDLG_H #include <wx/dialog.h> #include <map> #include <wx/bitmap.h> class wxListBox; class wxFlatNotebook; class wxPanel; class wxTabNavigatorWindow : public wxDialog { protected: wxListBox *m_listBox; long m_selectedItem; std::map<int, int> m_indexMap; wxPanel *m_panel; static wxBitmap m_bmp; protected: void CloseDialog(); public: /** * Parameterized constructor * \param parent dialog parent window */ wxTabNavigatorWindow(wxWindow* parent); /** * Default constructor */ wxTabNavigatorWindow(); /** * Destructor */ virtual ~wxTabNavigatorWindow(); /** * Create the dialog, usually part of the two steps construction of a * dialog * \param parent dialog parent window */ void Create(wxWindow* parent); /// Event handling void OnKeyUp(wxKeyEvent &event); void OnNavigationKey(wxNavigationKeyEvent &event); void OnItemSelected(wxCommandEvent &event); void OnPanelPaint(wxPaintEvent &event); void OnPanelEraseBg(wxEraseEvent &event); void PopulateListControl(wxFlatNotebook *book); }; #endif // FNB_POPUPDLG_H --- NEW FILE: wxflatnotebook.h --- /////////////////////////////////////////////////////////////////////////////// // Name: wxFlatNotebook.cpp // Purpose: generic implementation of flat style notebook class. // Author: Eran Ifrah <er...@be...> // Modified by: Priyank Bolia <so...@pr...> // Created: 30/12/2005 // Modified: 01/01/2006 // Copyright: Eran Ifrah (c) // Licence: wxWindows license <http://www.wxwidgets.org/licence3.txt> /////////////////////////////////////////////////////////////////////////////// #ifndef WXFLATNOTEBOOK_H #define WXFLATNOTEBOOK_H #include <wx/wx.h> #include <wx/frame.h> #include <wx/dynarray.h> #ifdef __WXMSW__ #ifdef _DEBUG //#include <crtdbg.h> #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) #else #define DEBUG_NEW new #endif #endif // __WXMSW__ #ifdef WXMAKINGDLL_FNB # define WXDLLIMPEXP_FNB WXEXPORT #elif defined(WXUSINGDLL_FNB) # define WXDLLIMPEXP_FNB WXIMPORT #else /* not making nor using FNB as DLL */ # define WXDLLIMPEXP_FNB #endif // WXMAKINGDLL_FNB #include <wx/dcbuffer.h> #include <wx/dataobj.h> #include <wx/dnd.h> #include <wx/wxflatnotebook/wxfnbdroptarget.h> class wxPageContainer; #ifndef M_PI #define M_PI 3.14159265358979 #endif #ifndef wxFNB_HEIGHT_SPACER #define wxFNB_HEIGHT_SPACER 10 #endif // forward declerations class wxFNBRenderer; class wxFNBRendererDefault; class wxFNBRendererVC71; class wxFNBRendererVC8; class wxTabNavigatorWindow; class wxMenu; // Since some compiler complains about std::min, we define our own macro #define FNB_MIN(a, b) ((a > b) ? b : a) WX_DECLARE_USER_EXPORTED_OBJARRAY(wxBitmap, wxFlatNotebookImageList, WXDLLIMPEXP_FNB); WX_DECLARE_USER_EXPORTED_OBJARRAY(wxWindow*, wxWindowPtrArray, WXDLLIMPEXP_FNB); /// wxFlatNotebook styles #define wxFNB_DEFAULT_STYLE wxFNB_MOUSE_MIDDLE_CLOSES_TABS #define wxFNB_VC71 0x00000001 #define wxFNB_FANCY_TABS 0x00000002 #define wxFNB_TABS_BORDER_SIMPLE 0x00000004 #define wxFNB_NO_X_BUTTON 0x00000008 #define wxFNB_NO_NAV_BUTTONS 0x00000010 #define wxFNB_MOUSE_MIDDLE_CLOSES_TABS 0x00000020 #define wxFNB_BOTTOM 0x00000040 #define wxFNB_NODRAG 0x00000080 #define wxFNB_VC8 0x00000100 #define wxFNB_X_ON_TAB 0x00000200 #define wxFNB_BACKGROUND_GRADIENT 0x00000400 #define wxFNB_COLORFUL_TABS 0x00000800 #define wxFNB_DCLICK_CLOSES_TABS 0x00001000 #define wxFNB_SMART_TABS 0x00002000 #define wxFNB_DROPDOWN_TABS_LIST 0x00004000 #define wxFNB_ALLOW_FOREIGN_DND 0x00008000 /// General macros #define VERTICAL_BORDER_PADDING 4 #define BUTTON_SPACE 16 #define VC8_SHAPE_LEN 16 #define MASK_COLOR wxColor(0, 128, 128) /** * \brief Nice cross-platform flat notebook with X-button, navigation arrows and much more */ class WXDLLIMPEXP_FNB wxFlatNotebook : public wxPanel { private: friend class wxPageContainer; public: ///Default constructor wxFlatNotebook() : m_popupWin(NULL) {} /// Parametrized constructor /** \param parent - parent window \param id - window ID \param pos - window position \param size - window size \param style - window style \param name - window class name */ wxFlatNotebook(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("Flat Notebook")); /// Destructor virtual ~wxFlatNotebook(void); /// Advances the selection /** \param bForward - if set to true then selection should be advanced forward otherwise - backward */ void AdvanceSelection(bool bForward); /// Apends new notebook page /** \param windows - window to be appended \param caption - tab caption \param selected - determines if new page should be selected automatically \param imgindex - page image index */ bool AddPage(wxWindow* windows, const wxString& caption, const bool selected = false, const int imgindex = -1); /// Inserts new notebook page /** \param index - page index \param page - window to be appended \param text - tab caption \param select - determines if new page should be selected automatically \param imgindex - page image index */ bool InsertPage(size_t index, wxWindow* page, const wxString& text, bool select = false, const int imgindex = -1); /// Changes the selection from currently visible/selected page to the page given by index. /** \param page - index of page to be selected */ void SetSelection(size_t page); /// Removes the window from the notebook, and destroys the window associated with that notebook page. /** * \param page - index of page to be deleted * \param notify - by default wxFlatNotebook fires two events: * - wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED * - wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING * to disable this functionality set notify to false */ void DeletePage(size_t page, bool notify = true); /// Deletes all notebook pages and destroys all windows associated with pages bool DeleteAllPages(); /// Returns the total number of pages in the notebook. int GetPageCount() const; /// Returns the window object associated with selected notebook page. wxWindow * GetCurrentPage() const; /// Returns the window object associated with a notebook page. /** \param page - page index */ wxWindow * GetPage(size_t page) const; /// Returns the page index of the window object. /** \param win - window object */ int GetPageIndex(wxWindow* win) const; /// Returns the currently visible/selected notebook page 0 based index. int GetSelection() const; /** * Return the previous selection, useful when implementing smart tabulation * \return previous selection, or wxNOT_FOUND */ int GetPreviousSelection() const; /// Returns tab header inclination angle of specified page /** \param page_index - page index \param result - pointer to the variable that receives the result */ bool GetPageShapeAngle(int page_index, unsigned int * result); /// Sets tab header inclination angle of specified page /** \param page_index - page index \param angle - new value of tab header inclination angle */ void SetPageShapeAngle(int page_index, unsigned int angle); /// Sets tab header inclination angle for all pages /** \param angle - new value of tab header inclination angle */ void SetAllPagesShapeAngle(unsigned int angle); /// Returns the best size for a page wxSize GetPageBestSize(); /// Sets the caption/text of the notebook page /** \param page - page index \param text - new value of tab caption */ bool SetPageText(size_t page, const wxString& text); /** * Removes the window from the notebook, and destroys the window associated with that notebook page. * \param page - index of page to be deleted * \param notify - by default wxFlatNotebook fires two events: * - wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED * - wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING * to disable this functionality set notify to false */ bool RemovePage(size_t page, bool notify = true); /// Sets the amount of space around each page's icon and label, in pixels. /** NB: The vertical padding cannot be changed in for wxFlatNotebook. \param padding - new amount of space around each page's icon and label */ void SetPadding(const wxSize& padding); /// Alters the notebook style /** \param style - new value of notebook style */ virtual void SetWindowStyleFlag(long style); /// Sets a right click menu to the notebook /** \param menu - right click menu object */ void SetRightClickMenu(wxMenu* menu); /// Returns the page text /** \param page - page index */ wxString GetPageText(size_t page); /// Sets an image index of specified page /** \param page - page index \param imgindex - new image index */ void SetPageImageIndex(size_t page, int imgindex); /// Returns an image index of specified page /** \param page - page index */ int GetPageImageIndex(size_t page); /// Sets gradient colors (only applicable when using the wxFNB_FANCY_TABS) /** \param from - first gradient colour \param to - second gradient colour \param border - page border colour */ void SetGradientColors(const wxColour& from, const wxColour& to, const wxColour& border); /// Sets first gradient colour /** \param from - new value of first gradient colour */ void SetGradientColorFrom(const wxColour& from); /// Sets second gradient colour /** \param to - new value of second gradient colour */ void SetGradientColorTo(const wxColour& to); /// Sets the colour of page border /** \param border - new value of the colour of page border */ void SetGradientColorBorder(const wxColour& border); /// Sets an image list associated with notebook pages /** \param imglist - image list object. Image list assigned with this method will not be deleted by wxFlatNotebook's destructor, you must delete it yourself. */ void SetImageList(wxFlatNotebookImageList * imglist); /// Returns an image list object associated with wxFlatNotebook wxFlatNotebookImageList * GetImageList(); /** * \brief Drop event handler, to be passed as function pointer to CTextDropTarget class. * \param x X coordinate where the drop take place * \param y Y coordinate where the drop take place * \param nTabPage page index * \param wnd_oldContainer pointer to wxPageContainer object that contained dragged page * \return Drag operation identifier */ wxDragResult OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer); /// Enable / Disable page /** \param page - page to enable/diable \param enabled - set to true to enable the tab, false otherwise */ void Enable(size_t page, bool enabled); /// Return Returns true if if the page is enabled /** \param page - page index */ bool GetEnabled(size_t page); /// Set the active tab text /** \param textColour - the active tab text colour */ void SetActiveTabTextColour(const wxColour& textColour); /// Gets first gradient colour const wxColour& GetGradientColorFrom(); /// Gets second gradient colour const wxColour& GetGradientColorTo(); /// Gets the tab border colour const wxColour& SetGradientColorBorder(); /// Get the active tab text const wxColour& GetActiveTabTextColour(); /// Get the non-active tab text color const wxColour& GetNonActiveTabTextColour(); /// Set the non-active tab text color void SetNonActiveTabTextColour(const wxColour& color); /// Return the tab area panel wxPanel* GetTabArea() { return (wxPanel*)m_pages; } /// Get the tab area background colour const wxColour& GetTabAreaColour(); /// Set the tab area background colour void SetTabAreaColour(const wxColour& color); /// Get the active tab color const wxColour& GetActiveTabColour(); /// Set the active tab color void SetActiveTabColour(const wxColour& color); /** * Return the padding used between the text and icons, text and borders, etc. * \return padding in pixels */ int GetPadding() { return m_nPadding; } protected: /// Initialization function, called internally virtual void Init(); wxPageContainer *m_pages; private: /// Internal flag to force selection of page, /// even if this page is disabled. /// used incase such that the book itself need to update its selection. /// e.g. after DeletePage() bool m_bForceSelection; wxBoxSizer* m_mainSizer; /// vector of all the windows associated with the notebook pages. wxWindowPtrArray m_windows; wxFNBDropTarget<wxFlatNotebook> *m_pDropTarget; int m_nFrom; int m_nPadding; wxTabNavigatorWindow *m_popupWin; bool m_sendPageChangeEvent; ///< Ugly but needed to allow SetSelection to send / dont send event DECLARE_DYNAMIC_CLASS(wxFlatNotebook) DECLARE_EVENT_TABLE() void OnNavigationKey(wxNavigationKeyEvent& event); }; /** * \brief Contains parameters of notebook page */ class WXDLLIMPEXP_FNB wxPageInfo { private: // Members /// Page caption wxString m_strCaption; /// Page position wxPoint m_pos; /// Page size wxSize m_size; /// Page region wxRegion m_region; /// Angle for painting tab unsigned int m_TabAngle; /// Page image index int m_ImageIndex; /// Page enable/disabled flag bool m_bEnabled; /// Tab 'x' button rectangle wxRect m_xRect; /// Tab color wxColor m_color; public: /// Default constructor wxPageInfo(): m_strCaption(wxEmptyString), m_TabAngle(0), m_ImageIndex(-1), m_bEnabled(true){}; /// Parametrized constructor /** \param caption - page caption \param imgindex - image index */ wxPageInfo(const wxString& caption, int imgindex) : m_strCaption(caption), m_pos(-1, -1), m_size(-1, -1), m_TabAngle(0), m_ImageIndex(imgindex), m_bEnabled(true){} /// Destructor ~wxPageInfo(){}; /// Sets page caption /** \param value - new page caption */ void SetCaption(wxString value) {m_strCaption = value;} ///Returns page caption wxString GetCaption() {return m_strCaption;} /// Sets page position /** \param value - new page position */ void SetPosition(wxPoint value) {m_pos = value;} ///Returns page position const wxPoint & GetPosition() {return m_pos;} /// Sets page size /** \param value - new page size */ void SetSize(wxSize value) {m_size = value;} ///Returns page size const wxSize & GetSize() {return m_size;} /// Sets the tab header inclination angle /** \param value - new tab header inclination angle */ void SetTabAngle(unsigned int value) {m_TabAngle = FNB_MIN((unsigned int)(45), (unsigned int)(value));} /// Returns an inclination of tab header borders unsigned int GetTabAngle() {return m_TabAngle;} /// Sets page image index /** \param value - new image index */ void SetImageIndex(int value) {m_ImageIndex = value;} /// Returns an image index int GetImageIndex() {return m_ImageIndex;} /// Return true if the page is enabled bool GetEnabled() { return m_bEnabled; } /// Set the page enable/disable flag /** \param enabled - new page enable status */ void Enable(bool enabled) { m_bEnabled = enabled; } /// Set the page region /** \param n - number of points \param points - array of points that construct the region */ void SetRegion(const size_t n, const wxPoint points[]) { m_region = wxRegion(n, points); } /// Get the page region wxRegion& GetRegion() { return m_region ; } /// Set the 'x' button rectangle area /** \param xrect - the 'x' button rectangle */ void SetXRect(const wxRect& xrect) { m_xRect = xrect; } /// Get the 'x' button rectangle wxRect& GetXRect() { return m_xRect; } /** * * \return The tab color */ wxColor GetColor() { return m_color; } /** * * \param color Tab face color */ void SetColor(wxColor& color) { m_color = color; } }; WX_DECLARE_USER_EXPORTED_OBJARRAY(wxPageInfo, wxPageInfoArray, WXDLLIMPEXP_FNB); /// Button status enum { wxFNB_BTN_PRESSED, wxFNB_BTN_HOVER, wxFNB_BTN_NONE }; /// Hit Test results enum { wxFNB_TAB, ///< On a tab wxFNB_X, ///< On the X button wxFNB_TAB_X, ///< On the 'X' button (tab's X button) wxFNB_LEFT_ARROW, ///< On the rotate left arrow button wxFNB_RIGHT_ARROW, ///< On the rotate right arrow button wxFNB_DROP_DOWN_ARROW, ///< On the drop down arrow button wxFNB_NOWHERE ///< Anywhere else }; /** * \brief Notebook page */ class WXDLLIMPEXP_FNB wxPageContainer : public wxPanel { protected: friend class wxFlatNotebook; friend class wxFNBRenderer; friend class wxFNBRendererDefault; friend class wxFNBRendererVC71; friend class wxFNBRendererVC8; wxFlatNotebookImageList * m_ImageList; public: /// Parametrized constructor /** \param parent - parent window \param id - window ID \param pos - window position \param size - window size \param style - window style */ wxPageContainer(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); /// Destructor virtual ~wxPageContainer(void); /// Sets an image list associated with notebook pages /** \param imglist - image list object. Image list assigned with this method will not be deleted by wxFlatNotebook's destructor, you must delete it yourself. */ virtual void SetImageList(wxFlatNotebookImageList * imglist) {m_ImageList = imglist;} /// Returns an image list object associated with wxFlatNotebook virtual wxFlatNotebookImageList * GetImageList() {return m_ImageList;} /// Apends new notebook page /** \param caption - tab caption \param selected - determines if new page should be selected automatically \param imgindex - page image index */ virtual bool AddPage(const wxString& caption, const bool selected = false, const int imgindex = -1); /// Inserts new notebook page /** \param index - page index \param page - window to be appended \param text - tab caption \param select - determines if new page should be selected automatically \param imgindex - page image index */ virtual bool InsertPage(size_t index, wxWindow* page, const wxString& text, bool select = false, const int imgindex = -1); /// Changes the selection from currently visible/selected page to the page given by index. /** \param page - index of page to be selected */ virtual void SetSelection(size_t page); /// Returns the current selection page index virtual int GetSelection() { return m_iActivePage; } /// Advances the selection /** \param bForward - if set to true then selection should be advanced forward otherwise - backward */ virtual void AdvanceSelection(bool bForward); /// Return the number of pages virtual size_t GetPageCount() { return m_pagesInfoVec.size(); } /// Returns the page caption /** \param page - page index */ virtual wxString GetPageText(size_t page) { return m_pagesInfoVec[page].GetCaption(); } /// Set the caption of the page /** \param page - page index \param text - new page caption */ virtual bool SetPageText(size_t page, const wxString& text) { m_pagesInfoVec[page].SetCaption(text); return true; } /// Sets an image index of specified page /** \param page - page index \param imgindex - new image index */ virtual void SetPageImageIndex(size_t page, int imgindex); /// Returns an image index of specified page /** \param page - page index */ virtual int GetPageImageIndex(size_t page); /// Enable / Disable page /** \param page - page to enable/diable \param enabled - set to true to enable the tab, false otherwise */ virtual void Enable(size_t page, bool enabled); /// Return Returns true if if the page is enabled /** \param page - page index */ virtual bool GetEnabled(size_t page); /// Style helper methods bool HasFlag(int flag); /** * Return a vector containing the tabs informations (used by the redereres) * \return tabs info vector */ wxPageInfoArray& GetPageInfoVector() { return m_pagesInfoVec; } /** * Return the first graident colour ("from") * \return gradient colour 1 */ const wxColour& GetGradientColourFrom() const { return m_colorFrom; } /** * Return the second graident colour ("to") * \return gradient colour 2 */ const wxColour& GetGradientColourTo() const { return m_colorTo; } /** * Return tab's border colour * \return border colour */ const wxColour& GetBorderColour() const { return m_colorBorder; } /** * Return non active tab's text colour * \return non active tab's text colour */ const wxColour& GetNonoActiveTextColor() const { return m_nonActiveTextColor; } /** * Return the active tab colour * \return tab colour */ const wxColour& GetActiveTabColour() const { return m_activeTabColor; } /** * Get the previous selected tab, wxNOT_FOUND if none * \return index of previous selected tab */ int GetPreviousSelection() const { return m_iPreviousActivePage; } /** * Draw a tab preview */ void DrawDragHint(); DECLARE_EVENT_TABLE() // Event handlers virtual void OnPaint(wxPaintEvent& event); virtual void OnSize(wxSizeEvent& WXUNUSED(event)); virtual void OnMouseMove(wxMouseEvent& event); virtual void OnLeftDown(wxMouseEvent& event); virtual void OnLeftUp(wxMouseEvent& event); virtual void OnRightDown(wxMouseEvent& event); virtual void OnMiddleDown(wxMouseEvent& event); virtual void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) { } virtual void OnMouseLeave(wxMouseEvent& event); virtual void OnMouseEnterWindow(wxMouseEvent& event); virtual void OnLeftDClick(wxMouseEvent &event); virtual void OnTabMenuSelection(wxCommandEvent &event); protected: /** * Popup a menu that contains all the tabs to be selected by user */ void PopupTabsMenu(); void ClearFlag(int flag); /// return true if tabIdx has image bool TabHasImage(int tabIdx); /// Check whether the style is set to default virtual bool IsDefaultTabs(); /// Return the color of the single line border virtual wxColor GetSingleLineBorderColor(); /// Return true if page is visible virtual bool IsTabVisible(size_t page); /// Return if pt is anywhere on a tab, button or anywhere else virtual int HitTest(const wxPoint& pt, wxPageInfo& pageInfo, int &tabIdx); /// Display tool tip when mouse is hovering a tab virtual void ShowTabTooltip(int tabIdx); /// A wrapper from calling the DoDeletePage() virtual void DeletePage(size_t page); /// Remove all pages from the container (it also deletes them) virtual void DeleteAllPages(); /// Perform the actual deletion of a tab from the container /// The window is also deleted using this function virtual void DoDeletePage(size_t page); /// Preform the actual page selection virtual void DoSetSelection(size_t page); /// Return the index of the last visible index virtual int GetLastVisibleTab(); /// Return the number of tabs that can be scrolled left /// starting from the first visible tab (i.e. m_nFrom) virtual int GetNumTabsCanScrollLeft(); /// Return the number of visible tabs virtual int GetNumOfVisibleTabs(); /** * \brief Drop event handler, to be passed as function pointer to CTextDropTarget class. * \param x X coordinate where the drop take place * \param y Y coordinate where the drop take place * \param nTabPage page index * \param wnd_oldContainer pointer to wxPageContainer object that contained dragged page * \return Drag operation identifier */ virtual wxDragResult OnDropTarget(wxCoord x, wxCoord y, int nTabPage, wxWindow * wnd_oldContainer); /** * \brief Moves the tab page from one location to another * \param nMove The index of the tab page to be moved. * \param nMoveTo The index for the tab page, where it has to be moved */ virtual void MoveTabPage(int nMove, int nMoveTo); /// Check whether page can fit to the current /// screen or a scrolling is required /** \param page - page index */ virtual bool CanFitToScreen(size_t page); protected: wxPageInfoArray m_pagesInfoVec; int m_iActivePage; int m_nFrom; /// Drop target for enabling drag'n'drop of tabs wxFNBDropTarget<wxPageContainer> *m_pDropTarget; /// Pointer to the parent window wxWindow *m_pParent; /// The right click menu wxMenu* m_pRightClickMenu; /// Gradient colors wxColour m_colorFrom, m_colorTo, m_colorBorder, m_activeTextColor, m_nonActiveTextColor, m_tabAreaColor, m_activeTabColor; /// X,>,< buttons status, can be one of /// - Pressed /// - Hover /// - None int m_nXButtonStatus, m_nLeftButtonStatus, m_nRightButtonStatus, m_nTabXButtonStatus; /// holds the button id in case a left click is done on one of them int m_nLeftClickZone; int m_iPreviousActivePage; int m_nArrowDownButtonStatus; }; /** * \brief Holds information about events associated with wxFlatNotebook objects */ class WXDLLIMPEXP_FNB wxFlatNotebookEvent : public wxNotifyEvent { DECLARE_DYNAMIC_CLASS(wxFlatNotebookEvent) size_t sel, oldsel; public: /// Constructor /** \param commandType - event type \param winid - window ID \param nSel - current selection \param nOldSel - old selection */ wxFlatNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, int nSel = -1, int nOldSel = -1) : wxNotifyEvent(commandType, winid), sel(nSel), oldsel(nOldSel) {} /// Sets the value of current selection /** \param s - index of currently selected page */ void SetSelection(int s) { sel = s; } /// Sets the value of previous selection /** \param s - index of previously selected page */ void SetOldSelection(int s) { oldsel = s; } /// Returns the index of currently selected page int GetSelection() { return (int)sel; } /// Returns the index of previously selected page int GetOldSelection() { return (int)oldsel; } }; BEGIN_DECLARE_EVENT_TYPES() DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED, 50000) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING, 50001) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, 50002) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, 50003) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_FNB, wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, 50004) END_DECLARE_EVENT_TYPES() typedef void (wxEvtHandler::*wxFlatNotebookEventFunction)(wxFlatNotebookEvent&); #define wxFlatNotebookEventHandler(func) \ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFlatNotebookEventFunction, &func) #define EVT_FLATNOTEBOOK_PAGE_CHANGED(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGED, winid, wxFlatNotebookEventHandler(fn)) #define EVT_FLATNOTEBOOK_PAGE_CHANGING(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CHANGING, winid, wxFlatNotebookEventHandler(fn)) #define EVT_FLATNOTEBOOK_PAGE_CLOSING(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSING, winid, wxFlatNotebookEventHandler(fn)) #define EVT_FLATNOTEBOOK_CONTEXT_MENU(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_CONTEXT_MENU, winid, wxFlatNotebookEventHandler(fn)) #define EVT_FLATNOTEBOOK_PAGE_CLOSED(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_FLATNOTEBOOK_PAGE_CLOSED, winid, wxFlatNotebookEventHandler(fn)) #endif // WXFLATNOTEBOOK_H --- NEW FILE: renderer.h --- #ifndef RENDERE_H #define RENDERE_H #include <wx/dc.h> #include <wx/string.h> #include <wx/wxflatnotebook/singleton.h> #include <wx/wxflatnotebook/smart_ptr.h> #include <map> #include <vector> #include <wx/event.h> class wxFNBRenderer { protected: // A bitmap that holds the background of the // x button which is drawn on a tab wxBitmap m_tabXBgBmp, m_xBgBmp, m_leftBgBmp, m_rightBgBmp; wxBitmap m_arrowDown, m_arrowUp; public: wxFNBRenderer(); virtual ~wxFNBRenderer(); /** * Generic function that draws the tabs and updates values in the page container * MAC requires that the event will be skipped, so we must pass it * \param pageContainer window that contains the tabs drawing * \param dc device context */ virtual void DrawTabs(wxWindow* pageContainer, wxDC &dc, wxEvent &event); /** * Draw a small 'x' button on top of the tab * \param pageContainer parent window on which to draw * \param dc device context to use * \param rect button rectangle * \param tabIdx tab index * \param btnStatus button status, can be one of * - wxFNB_BTN_PRESSED * - wxFNB_BTN_HOVER * - wxFNB_BTN_NONE * \param tabXBgBmp [output] background bitmap of the area of the button (just before it is painted) */ virtual void DrawTabX(wxWindow* pageContainer, wxDC& dc, const wxRect& rect, const int& tabIdx, const int btnStatus); /** * Draw tab * \param pageContainer parent window on which to draw * \param dc device context to use * \param posx tab x coordinate * \param tabIdx tab index * \param tabWidth tab width * \param tabHeight tab height * \param btnStatus btnStatus the little 'x' button (on top of the active tab) status, can be one of * - wxFNB_BTN_PRESSED * - wxFNB_BTN_HOVER * - wxFNB_BTN_NONE */ virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus) = 0; /** * Calculate tab width , based on its index (for image, x button on tab) * \param pageContainer pageContainer parent window on which to draw * \param tabIdx tab index * \param tabHeight the tab height (used for tan() function calculations) * \return tab bouding rectangle size */ virtual int CalcTabWidth (wxWindow* pageContainer, int tabIdx, int tabHeight); /** * Calculate tab height * \param pageContainer pageContainer parent window on which to draw * \return tab bouding rectangle size */ virtual int CalcTabHeight(wxWindow* pageContainer); /** * Get a bitmap from device context, with rect size * \param dc device context * \param rect bitmap rectangle * \param bmp [output] bitmap */ virtual void GetBitmap(wxDC& dc, const wxRect &rect, wxBitmap &bmp); /** * Draw a bottom line for the tabs area */ void DrawTabsLine(wxWindow *pageContainer, wxDC& dc); /** * Brighten a given colour with amount * \param color starting colour * \param percent percent, 0 - no change, 100 - white * \return brighten colour */ static wxColor LightColour(const wxColour& color, int percent); /** * Paint rectangle with gradient colouring * \param dc device context * \param rect rectangle * \param startColor gradient colour 1 * \param endColor gradient colour 2 * \param vertical use vertical gradient or horizontal */ static void PaintStraightGradientBox(wxDC& dc, const wxRect& rect, const wxColour& startColor, const wxColour& endColor, bool vertical = true); // Navigation buttons position int GetLeftButtonPos(wxWindow *pageContainer); int GetRightButtonPos(wxWindow *pageContainer); int GetXPos(wxWindow *pageContainer); int GetButtonsAreaLength(wxWindow *pageContainer); int GetDropArrowButtonPos(wxWindow *pageContainer); /// Draw right arrow button to the right area of the tabs virtual void DrawRightArrow(wxWindow *pageContainer, wxDC &dc); /// Draw left arrow button to the right area of the tabs virtual void DrawLeftArrow (wxWindow *pageContainer, wxDC &dc); /// Draw 'x' button to the right area of the tabs virtual void DrawX (wxWindow *pageContainer, wxDC &dc); /** * Draw tab drag hint, the default implementation is to do nothing ... * u can override this function to provide a nice feedback to user * \param pageContainer a pointer to the owner wxPageContainer * \param tabIdx index of the tab that will be replaced with the dragged tab */ virtual void DrawDragHint(wxWindow *pageContainer, int tabIdx); /** * Draw drop down arrow on the right corner * \param pageContainer window tabs container * \param dc device context */ void DrawDropDownArrow(wxWindow* pageContainer, wxDC& dc); /** * Return an array of tabs info that can fit to screen starting from 'from' * \param pageContainer * \param [output] vTabInfo * \param from */ virtual void NumberTabsCanFit(wxWindow *pageContainer, std::vector<wxRect> &vTabInfo, int from = -1); protected: /** * Generate random colour * \return random colour */ wxColour RandomColor(); }; typedef SmartPtr<wxFNBRenderer> wxFNBRendererPtr; class wxFNBRendererDefault : public wxFNBRenderer { public: wxFNBRendererDefault(){} virtual ~wxFNBRendererDefault(){} virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus); }; class wxFNBRendererVC71 : public wxFNBRenderer { public: wxFNBRendererVC71(){} virtual ~wxFNBRendererVC71(){} virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus); }; class wxFNBRendererFancy : public wxFNBRenderer { public: wxFNBRendererFancy(){} virtual ~wxFNBRendererFancy(){} virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus); }; class wxFNBRendererVC8 : public wxFNBRenderer { int m_factor; bool m_first; public: wxFNBRendererVC8() : m_factor(1), m_first(true) {} virtual ~wxFNBRendererVC8(){} virtual void DrawTab(wxWindow* pageContainer, wxDC &dc, const int &posx, const int &tabIdx, const int &tabWidth, const int &tabHeight, const int btnStatus); virtual void DrawTabs(wxWindow *pageContainer, wxDC &dc, wxEvent &event); void NumberTabsCanFit(wxWindow *pageContainer, std::vector<wxRect> &vTabInfo, int from = -1); private: void FillVC8GradientColor(wxWindow* pageContainer, wxDC &dc, const wxPoint tabPoints[], const bool bSelectedTab, const int tabIdx); int GetEndX(const wxPoint tabPoints[], const int &y, long style); int GetStartX(const wxPoint tabPoints[], const int &y, long style); }; //----------------------------------- // Renderer manager class //----------------------------------- class wxFNBRendererMgr { friend class Singleton<wxFNBRendererMgr>; std::map<int, wxFNBRendererPtr> m_renderers; public: /** * Return the renderer according to the style flag, the returned pointer should not be * deleted by caller, it is owned by this class * \param style window style flag * \return wxFNBRenderer */ wxFNBRendererPtr GetRenderer(long style); private: wxFNBRendererMgr(); virtual ~wxFNBRendererMgr(); }; typedef Singleton<wxFNBRendererMgr> wxFNBRendererMgrST; #endif // RENDERE_H --- NEW FILE: smart_ptr.h --- #ifndef CODELITE_SMART_PTR_H #define CODELITE_SMART_PTR_H /** * A smart pointer class that provides a reference counting and auto delete memory. * * This class is similar to std::auto_ptr, with 2 exceptions: * - This class uses reference counting * - We dont provide a release() function (because of the reference counting) * It is recommended to use this class instead of using raw pointer wherever possible. * * \note smart pointer to NULL is valid. * * \ingroup CodeLite * \version 1.0 * first version * \date 09-17-2006 * \author Eran */ template <typename T> class SmartPtr { typedef T* type_ptr; /** * The reference counting class * * \ingroup CodeLite * \version 1.0 * first version * * \date 09-17-2006 * \author Eran */ class SmartPtrRef { type_ptr m_data; int m_refCount; public: /** * Construct a reference counting class for row pointer data * \param data pointer */ SmartPtrRef(type_ptr data) : m_data( data ) , m_refCount( 1 ) { } /** * Destructor */ virtual ~SmartPtrRef() { delete m_data; } /** * \return Pointer to the row data */ type_ptr GetData() { return m_data; } /** * Increase reference counting by 1 */ void IncRef() { m_refCount ++ ; } /** * Decrease reference counting by 1 */ void DecRef() { m_refCount -- ; } /** * Return the current reference counting * \return current reference counting */ int GetRefCount() { return m_refCount; } }; SmartPtrRef *m_ref; public: /** * Construct smart pointer from ptr * \param ptr pointer */ SmartPtr(type_ptr ptr) { // create a fresh copy CreateFresh( ptr ); } /** * Default constructor */ SmartPtr() : m_ref(NULL) { } /** * Copy constructor * \param rhs right hand side */ SmartPtr(const SmartPtr& rhs) : m_ref(NULL) { *this = rhs; } /** * Assignment operator * \param rhs right hand side * \return reference to this */ SmartPtr& operator=(const SmartPtr& rhs) { // increase the reference count if( m_ref == rhs.m_ref ) return *this; // Delete previous reference DeleteRefCount(); if( !rhs.m_ref ) return *this; m_ref = rhs.m_ref; m_ref->IncRef(); return *this; } /** * Destructor */ virtual ~SmartPtr() { DeleteRefCount(); } /** * Replace the current pointer with ptr * if the current ptr is not NULL, it will be freed (reference counting free) before assingning the new ptr * \param ptr new pointer */ void Reset(type_ptr ptr) { DeleteRefCount(); CreateFresh( ptr ); } /** * Return pointer the row data pointer * \return pointer to the row data pointer */ type_ptr Get() { return m_ref->GetData(); } /** * Overload the '->' operator * \return pointer to the row data pointer */ type_ptr operator->() const { return m_ref->GetData(); } /** * Dereference operator * \return dereference the row data */ T& operator*() const { return *(m_ref->GetData()); } /** * Test for NULL operator * \return true if the internal row data or the reference counting class are NULL false otherwise */ bool operator!() const { if( !m_ref ) return true; return m_ref->GetData() == NULL; } private: void DeleteRefCount() { // decrease the ref count (or delete pointer if it is 1) if( m_ref ) { if( m_ref->GetRefCount() == 1 ) { delete m_ref; m_ref = NULL; } else m_ref->DecRef(); } }; void CreateFresh(type_ptr ptr) { m_ref = new SmartPtrRef( ptr ); } }; #endif // CODELITE_SMART_PTR_H --- NEW FILE: singleton.h --- #ifndef CODELITE_SINGLETON_H #define CODELITE_SINGLETON_H /** * A template class that implements the Singleton pattern. * * \date 08-23-2006 * \author eran */ template <typename T> class Singleton { static T* ms_instance; public: /** * Static method to access the only pointer of this instance. * \return a pointer to the only instance of this */ static T* Get(); /** * Release resources. */ static void Free(); protected: /** * Default constructor. */ Singleton(); /** * Destructor. */ virtual ~Singleton(); }; template <typename T> T* Singleton<T>::ms_instance = 0; template <typename T> Singleton<T>::Singleton() { } template <typename T> Singleton<T>::~Singleton() { } template <typename T> T* Singleton<T>::Get() { if(!ms_instance) ms_instance = new T(); return ms_instance; } template <typename T> void Singleton<T>::Free() { if( ms_instance ) { delete ms_instance; ms_instance = 0; } } #endif // CODELITE_SINGLETON_H --- NEW FILE: fnb_resources.h --- #ifndef FNB_RESOURCES_H #define FNB_RESOURCES_H extern size_t tab_selection_png_size; extern unsigned char tab_selection_png[]; // Control left arrow images extern char *left_arrow_disabled_xpm[]; extern char *left_arrow_hilite_xpm[]; extern char *left_arrow_xpm[]; extern char *left_arrow_pressed_xpm[]; // Control right arrow extern char *right_arrow_hilite_xpm[]; extern char *right_arrow_pressed_xpm[]; extern char *right_arrow_xpm[]; extern char *right_arrow_disabled_xpm[]; // Cotrol down arrow extern char *down_arrow_hilite_xpm[]; extern char *down_arrow_pressed_xpm[]; extern char *down_arrow_xpm[]; // X button extern char *x_button_hilite_xpm[]; extern char *x_button_pressed_xpm[]; extern char *x_button_xpm[]; // Popup dialog xpm extern unsigned char signpost_alpha[]; extern char *signpost_xpm[]; // Drag hint arrows extern char *arrow_down_blue_xpm[]; extern char *arrow_up_blue_xpm[]; extern unsigned char arrow_down_blue_alpha[]; extern unsigned char arrow_up_blue_alpha[]; #endif // FNB_RESOURCES_H --- NEW FILE: wxfnbdroptarget.h --- #ifndef _WX_FNB_DROP_TARGET_H #define _WX_FNB_DROP_TARGET_H #include <wx/wx.h> #include <wx/dnd.h> /** \brief Contains the information about dragged page (page index and container). */ class wxFNBDragInfo { wxWindow * m_Container; int m_PageIndex; public: /** Constructor \param container - pointer to wxPageContainer object which contains dragged page \param pageindex - index of dragged page */ wxFNBDragInfo(wxWindow * container, int pageindex) : m_Container(container), m_PageIndex(pageindex){} /** * \brief default constructor */ wxFNBDragInfo() : m_Container(0), m_PageIndex(0){} /** Returns wxPageContainer object which contains dragged page */ wxWindow * GetContainer() {return m_Container;} /** Returns the index of dragged page */ int GetPageIndex() {return m_PageIndex;} }; class wxFNBDragInfoDataObject : public wxDataObjectSimple { public: wxFNBDragInfoDataObject(const wxDataFormat& format):wxDataObjectSimple(format) {} wxFNBDragInfo DragInfo; wxFNBDragInfo *GetData() { return &DragInfo; } // get the size of our data virtual size_t GetDataSize() const { return sizeof(wxFNBDragInfo); } // copy our data to the buffer virtual bool GetDataHere(void *buf) const { memcpy(buf, &DragInfo, sizeof(wxFNBDragInfo)); return true; } // copy data from buffer to our data virtual bool SetData(size_t WXUNUSED(len), const void *buf) { // don't check the len. Under Win98 the value of 'len' == 0 memcpy(&DragInfo, buf, sizeof(wxFNBDragInfo)); return true; } }; /** \brief Used for processing drag-n-drop opeartions */ template <class T> class wxFNBDropTarget : public wxDropTarget { private: typedef wxDragResult (T::*pt2Func)(wxCoord, wxCoord, int, wxWindow *); T* m_pParent; pt2Func m_pt2CallbackFunc; wxFNBDragInfoDataObject * m_DataObject; public: /** \brief Constructor \param pParent - Object that will handle drag-n-drop operation \param pt2CallbackFunc - Pointer to callback method which should be called after dragging the notebook page */ wxFNBDropTarget(T* pParent, pt2Func pt2CallbackFunc) : m_pParent(pParent) , m_pt2CallbackFunc(pt2CallbackFunc) , m_DataObject(NULL) { m_DataObject = new wxFNBDragInfoDataObject(wxDataFormat(wxT("wxFNB"))); SetDataObject(m_DataObject); } /** \brief Virtual Destructor */ virtual ~wxFNBDropTarget(void) {} /** \brief Used for processing drop operation \param x - X-coordinate \param y - Y-coordinate \param def - Result of drag-n-drop operation */ virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult WXUNUSED(def)) { GetData(); wxFNBDragInfo * draginfo = (wxFNBDragInfo *)m_DataObject->GetData(); if(!draginfo) { return wxDragNone; } return (m_pParent->*m_pt2CallbackFunc)(x, y, draginfo->GetPageIndex(), (T *)draginfo->GetContainer()); } }; /** * \ingroup wxFlatNotebook * This class represents a source for a drag and drop operation * We override wxDropSource class to provide user with a feedback * * \version 1.0 * first version * * \date 10-11-2006 * * \author Eran */ class wxFNBDropSource : public wxDropSource { wxWindow* m_win; public: /** * Parameterized constructor * \param win * \param iconCopy * \param iconMove * \param iconNone */ wxFNBDropSource(wxWindow* win = NULL) : wxDropSource(win) , m_win( win ) { } /** * Destructor */ virtual ~wxFNBDropSource() { } /** * give some custom UI feedback during the drag and drop operation in this function. It is called on each mouse move, so your implementation must not be too slow * \param effect The effect to implement. One of wxDragCopy, wxDragMove, wxDragLink and wxDragNone * \return */ virtual bool GiveFeedback(wxDragResult effect); }; #endif |
From: Markus R. <rol...@us...> - 2007-06-21 17:52:51
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/wxflatnotebook/src/wxflatnotebook In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22509/src/wxflatnotebook Added Files: Tag: RSGEDIT_SCINTILLA fnb_resources.cpp popup_dlg.cpp renderer.cpp wxFlatNotebook.cpp Log Message: - added wxFlatNotebook files, a custom wxWidgets control that implements tabbed windows (taken from http://sourceforge.net/projects/wxflatnotebook) --- NEW FILE: fnb_resources.cpp --- #include <stdlib.h> /////////////////////////////////////////////////////////////////////////////// // // XPM Images required by this control // /////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Images used by the control //////////////////////////////////////////////////////////// /* XPM */ char *signpost_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 104 2", " c Black", "M c #3FB524", "3 c #4CBAFF", "{ c #004C00", "1 c #006BE9", "P c #007200", "! c #0065DD", "- c #003FE5", "Q c #0056BC", "* c #0062E4", "t c #0945A7", "7 c #2BBF1F", "W c #0050B8", ") c #D59700", "L c #0E8508", "A c #0047B0", "u c #3D93E5", "x c #0044AD", ": c #46C733", "( c #B18800", "X c #E3C247", "O. c #D69B00", "E c #0041B1", "` c #824400", "| c #C59200", ".. c #7B4000", "*. c #763C00", "G c #056ED4", "f c #088806", "[ c #005100", "p c #006DDF", "g c #007700", "U c #6D6A00", "< c #4A4357", "Z c #0038B7", "% c #E1B024", "K c #16A40B", " . c #986500", "h c #007100", "e c #002C9F", "J c #018101", "C c #4A3D58", "; c #009400", "v c #078BF0", "$. c #AC6F00", "F c #0055BC", "s c #36B01A", "D c #0052B8", ", c #138E00", "= c #0058D3", "5 c #47A9FF", "~ c #006500", "S c #004CB2", "n c #047F02", "T c #572E17", "m c #37BA1A", "X. c #D89D00", "} c #E49C00", "6 c #0084FF", "+ c #D3990C", "l c #0040A6", "a c #008200", "_ c #9C6700", "d c #86EA4D", "O c #DCC042", "# c #C7C334", "&. c #835000", "B c #007900", "k c #0037A9", "#. c #7B3F00", "y c #3879CB", "%. c #A26F00", "N c #007300", ". c #D0A000", "& c #626651", "j c #594855", "' c #0031B3", "q c #007000", "2 c #31AAFF", "Y c #A96700", "] c #0034C6", "R c #0028A7", "@. c #9B6800", "o c #EAD96A", "V c #006700", "4 c #4CACFB", "9 c #9EFF63", "^ c #006400", "o. c #7A4000", "b c #0080E5", "z c #0045AC", "> c #66DD42", "I c #005E00", "c c #125EBE", "H c #0080F5", "w c #584955", "8 c #8BF35A", "@ c #8E9300", "/ c #005800", "+. c #CA9700", "i c #0071DE", "0 c #2DA51D", "$ c #FFDE65", "r c #003098", /* pixels */ " ", " ", " . X o O + ", " @ # $ % & * = - ", " ; : > , < 1 2 3 4 5 6 ", " 7 8 9 0 q w e r t y u i p ", " a s d f g h j k l z x c v b ", " n m M N B V C Z A S D F G H ", " J K L P I U Y T R E W Q ! ", " h ~ ^ / ( ) _ ` ' ] ", " [ { } | ... ", " X.| .o. ", " O.+.@.#. ", " $.%.&.*. ", " ", " " }; unsigned char signpost_alpha[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 174, 240, 238, 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 254, 255, 255, 253, 104, 48, 4, 0, 0, 0, 0, 0, 0, 0, 60, 221, 255, 255, 255, 254, 254, 254, 244, 193, 51, 0, 0, 0, 0, 126, 252, 255, 255, 255, 255, 255, 255, 254, 254, 254, 224, 20, 0, 0, 33, 252, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 183, 0, 0, 137, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 128, 0, 0, 211, 254, 254, 255, 255, 255, 255, 246, 147, 216, 254, 225, 81, 0, 0, 0, 20, 162, 246, 234, 248, 255, 255, 238, 0, 0, 29, 11, 0, 0, 0, 0, 0, 0, 11, 20, 231, 255, 255, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 255, 255, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 255, 255, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 240, 236, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* XPM */ char *left_arrow_disabled_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #555555", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "````````.```````", "```````..```````", "``````.`.```````", "`````.``.```````", "````.```.```````", "`````.``.```````", "``````.`.```````", "```````..```````", "````````.```````", "````````````````", "````````````````", "````````````````", "````````````````" }; /* XPM */ char *x_button_pressed_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #9e9ede", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.############.`", "`.############.`", "`.###aa####aa#.`", "`.####aa##aa##.`", "`.#####aaaa###.`", "`.######aa####.`", "`.#####aaaa###.`", "`.####aa##aa##.`", "`.###aa####aa#.`", "`.############.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *left_arrow_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #555555", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "````````.```````", "```````..```````", "``````...```````", "`````....```````", "````.....```````", "`````....```````", "``````...```````", "```````..```````", "````````.```````", "````````````````", "````````````````", "````````````````", "````````````````" }; /* XPM */ char *x_button_hilite_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #c9dafb", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.############.`", "`.##aa####aa##.`", "`.###aa##aa###.`", "`.####aaaa####.`", "`.#####aa#####.`", "`.####aaaa####.`", "`.###aa##aa###.`", "`.##aa####aa##.`", "`.############.`", "`.############.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *x_button_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #555555", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "````````````````", "````..````..````", "`````..``..`````", "``````....``````", "```````..```````", "``````....``````", "`````..``..`````", "````..````..````", "````````````````", "````````````````", "````````````````", "````````````````", "````````````````" }; /* XPM */ char *left_arrow_pressed_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #9e9ede", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.############.`", "`.#######a####.`", "`.######aa####.`", "`.#####aaa####.`", "`.####aaaa####.`", "`.###aaaaa####.`", "`.####aaaa####.`", "`.#####aaa####.`", "`.######aa####.`", "`.#######a####.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *left_arrow_hilite_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #c9dafb", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.######a#####.`", "`.#####aa#####.`", "`.####aaa#####.`", "`.###aaaa#####.`", "`.##aaaaa#####.`", "`.###aaaa#####.`", "`.####aaa#####.`", "`.#####aa#####.`", "`.######a#####.`", "`.############.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *right_arrow_disabled_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #555555", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "```````.````````", "```````..```````", "```````.`.``````", "```````.``.`````", "```````.```.````", "```````.``.`````", "```````.`.``````", "```````..```````", "```````.````````", "````````````````", "````````````````", "````````````````", "````````````````" }; /* XPM */ char *right_arrow_hilite_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #c9dafb", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.####a#######.`", "`.####aa######.`", "`.####aaa#####.`", "`.####aaaa####.`", "`.####aaaaa###.`", "`.####aaaa####.`", "`.####aaa#####.`", "`.####aa######.`", "`.####a#######.`", "`.############.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *right_arrow_pressed_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #9e9ede", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "`..............`", "`.############.`", "`.############.`", "`.#####a######.`", "`.#####aa#####.`", "`.#####aaa####.`", "`.#####aaaa###.`", "`.#####aaaaa##.`", "`.#####aaaa###.`", "`.#####aaa####.`", "`.#####aa#####.`", "`.#####a######.`", "`..............`", "````````````````", "````````````````" }; /* XPM */ char *right_arrow_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #555555", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "```````.````````", "```````..```````", "```````...``````", "```````....`````", "```````.....````", "```````....`````", "```````...``````", "```````..```````", "```````.````````", "````````````````", "````````````````", "````````````````", "````````````````" }; // Arrow down bitmaps /* XPM */ char *down_arrow_hilite_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #c9dafb", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "``.............`", "``.###########.`", "``.###########.`", "``.###########.`", "``.#aaaaaaaaa#.`", "``.##aaaaaaa##.`", "``.###aaaaa###.`", "``.####aaa####.`", "``.#####a#####.`", "``.###########.`", "``.###########.`", "``.###########.`", "``.............`", "````````````````", "````````````````" }; /* XPM */ char *down_arrow_pressed_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #4766e0", "# c #9e9ede", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "``.............`", "``.###########.`", "``.###########.`", "``.###########.`", "``.###########.`", "``.###########.`", "``.#aaaaaaaaa#.`", "``.##aaaaaaa##.`", "``.###aaaaa###.`", "``.####aaa####.`", "``.#####a#####.`", "``.###########.`", "``.............`", "````````````````", "````````````````" }; /* XPM */ char *down_arrow_xpm[] = { /* width height num_colors chars_per_pixel */ " 16 16 8 1", /* colors */ "` c #008080", ". c #000000", "# c #000000", "a c #000000", "b c #000000", "c c #000000", "d c #000000", "e c #000000", /* pixels */ "````````````````", "````````````````", "````````````````", "````````````````", "````````````````", "````````````````", "````.........```", "`````.......````", "``````.....`````", "```````...``````", "````````.```````", "````````````````", "````````````````", "````````````````", "````````````````", "````````````````" }; // Arrow down bitmaps const int tab_x_size = 9; // arrow_down_blue.xpm 16x16 unsigned char arrow_down_blue_alpha[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 250, 250, 248, 246, 245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 2, 11, 11, 0, 255, 255, 255, 255, 255, 255, 0, 11, 11, 2, 0, 0, 7, 190, 254, 254, 255, 255, 255, 255, 255, 255, 254, 254, 186, 5, 0, 0, 0, 15, 209, 255, 255, 255, 255, 255, 255, 255, 255, 206, 13, 0, 0, 0, 0, 0, 28, 226, 255, 255, 255, 255, 255, 255, 223, 25, 0, 0, 0, 0, 0, 0, 0, 43, 238, 255, 255, 255, 255, 236, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 247, 255, 255, 245, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 253, 252, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /* XPM */ char *arrow_down_blue_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 99 2", "a c #3E8FDC", " c Black", "+. c #0068E2", "Y c #77B5F4", "# c #206BC4", " . c #0065E7", "I c #0F68CE", ", c #1C7AD3", ": c #217ED9", "` c #0F62C4", "o. c #377FCB", "U c #89C2FA", "N c #0050B8", "u c #84BBF1", "d c #004DB4", "( c #7DBAF7", "& c #338BE0", "c c #539DE8", "E c #62A9EE", "X. c #3A7DC4", "[ c #2E84DF", "! c #0053E1", "M c #0D56B4", "k c #1F6FCA", "@ c #003BA2", "D c #60A6EB", "o c #0345AC", "w c #1054AA", "A c #8DC4F8", "x c #8DC1F2", "e c #000087", ".. c #006AEC", "b c #4893DD", "g c #00008E", "V c #0067E5", "* c #177BD5", "O. c #0067EA", "] c #0064E8", "9 c #3C8EE0", "% c #4B9AE4", "' c #0061E1", "< c #074DA7", "~ c #0064EC", "s c #1155AA", "> c #217DD8", "G c #559FE9", "F c #5AA3EA", "3 c #3086DD", "X c #074AAF", "^ c #1C73D5", "W c #508CC5", "P c #005BE7", "| c #1C6DC6", "5 c #2982D6", "/ c #91C9FE", "l c #3077CB", "= c #034AA7", "Q c #065ABF", "Z c #8AC5FD", "+ c #0347AC", "- c #246CC4", "p c #4594E4", "J c #4084C2", "L c #0043D9", "K c #0454BA", "q c #3488D9", "@. c #0069E0", "} c #79A7D3", "H c #52A0EB", "j c #005AC2", "m c #115AB4", "y c #2F78CE", "f c #0057C0", "1 c #2A71C9", "2 c #70AFEC", "8 c #7AB7EF", "h c #005AD6", "C c #0D66CA", "6 c #0A50A9", "v c #4E9AE6", "_ c #6498C9", "r c #0054DD", "4 c #2E85DB", "{ c #9BD0FF", "O c #0546A9", "T c #6CAFF0", "R c #67ABF0", ". c #0042AA", ") c #76B7F7", "i c #4796E4", "; c #60A7E7", "B c #003FAF", "t c #0048D1", "n c #246BBA", "7 c #2E76CC", "$ c #7EBCF0", "z c #5696DD", "S c #79B5F0", "0 c #398EE0", /* pixels */ " ", " ", " . X o O + @ ", " # $ % & * = ", " - ; : > , < ", " 1 2 3 4 5 6 ", " 7 8 9 0 q w ", " e r t y u i p a s d f g ", " h j k l z x c v b n m M N B ", " V C Z A S D F G H J K L ", " P I U Y T R E W Q ! ", " ~ ^ / ( ) _ ` ' ", " ] [ { } | . ", " ..X.o.O. ", " +.@. ", " " }; // arrow_up_blue.xpm 16x16 unsigned char arrow_up_blue_alpha[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 250, 252, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 242, 255, 255, 247, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 232, 255, 255, 255, 255, 238, 44, 0, 0, 0, 0, 0, 0, 0, 21, 218, 255, 255, 255, 255, 255, 255, 226, 28, 0, 0, 0, 0, 0, 11, 200, 255, 255, 255, 255, 255, 255, 255, 255, 210, 16, 0, 0, 0, 4, 180, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 192, 7, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 244, 245, 243, 241, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /* XPM */ char *arrow_up_blue_xpm[] = { /* columns rows colors chars-per-pixel */ "16 16 93 2", " c Black", "n c #2262AB", "@ c #006BED", "! c #237ED9", "# c #006BF2", "G c #81BAF0", "( c #4B9EE8", "/ c #1B67C2", ": c #BFE1FF", "{ c #0444A8", "B c #005CD7", "2 c #005CDF", "N c #0050B8", ") c #1F81DC", "D c #145AAC", "I c #73B2EC", "T c #2983D9", "> c #7DBAF5", "O c #4998EA", "z c #3F8ADB", "9 c #62A9EC", "5 c #B6DAFD", "h c #004DD2", "s c #519DE5", "t c #B4DAFE", "L c #1057AD", "C c #8FC1F3", "4 c #0768CF", "< c #79B7F5", "a c #549EE7", "* c #257DDA", "J c #398DDF", "R c #0E54A9", ", c #72B3F4", "% c #C6E4FF", "; c #1471D3", "$ c #2881DE", "i c #61A7EB", "m c #115BB5", "u c #66ABEF", "Q c #2681D9", "c c #559FE8", "3 c #0061EC", "- c #0061ED", "K c #358ADC", "k c #1C70CD", "r c #0666CD", "` c #1378D5", "Y c #2E86DD", "[ c #054AAF", "W c #67A9E8", "^ c #084EA6", "q c #0B61C7", "f c #065AC3", " . c #003AA0", "H c #3B8FE1", "8 c #65A9ED", "y c #94C7F8", "v c #4F9CE6", "6 c #7EBAF5", ". c #006FE6", "_ c #197DDB", "F c #2773CB", "} c #0141A0", "E c #1D68C5", "o c #006FF1", "& c #9CCFFF", "j c #0060C2", "| c #013EA0", "0 c #61A9EF", "= c #0066E9", "7 c #6BAEEF", "S c #4191E0", "w c #0060DD", "l c #2373CE", "+ c #509DEC", "U c #3088DD", "M c #0F5DBC", "p c #5AA2E9", "A c #4495E4", "' c #054CA7", "~ c #1F7CD5", "b c #4996E0", "1 c #156ED0", "d c #51A1EC", "Z c #4796E4", "e c #004EE0", "V c #2975CC", "g c #0048D5", "P c #226EC8", "x c #6DB0EE", "X c #006BE1", "] c #0143A8", /* pixels */ " ", " . X ", " o O + @ ", " # $ % & * = ", " - ; : > , < 1 2 ", " 3 4 5 6 7 8 9 0 q w ", " e r t y u i p a s d f g ", " h j k l z x c v b n m M N B ", " V C Z A S D ", " F G H J K L ", " P I U Y T R ", " E W Q ! ~ ^ ", " / ( ) _ ` ' ", " ] [ { } | . ", " ", " " }; ////////////////////////////////////////////////////////////////////////////////////////////////// // // End of XPM Images // ////////////////////////////////////////////////////////////////////////////////////////////////// --- NEW FILE: renderer.cpp --- #include <wx/wxFlatNotebook/renderer.h> #include <wx/wxFlatNotebook/wxFlatNotebook.h> // for the styles #include <wx/wxFlatNotebook/fnb_resources.h> #include <wx/image.h> wxFNBRenderer::wxFNBRenderer() : m_tabXBgBmp(16, 16) , m_xBgBmp(16, 14) , m_leftBgBmp(16, 14) , m_rightBgBmp(16, 14) { } wxFNBRenderer::~wxFNBRenderer() { } int wxFNBRenderer::GetLeftButtonPos(wxWindow* pageContainer) { [...1618 lines suppressed...] int posx = ((wxFlatNotebook *)pc->m_pParent)->GetPadding(); if( from < 0 ) from = pc->m_nFrom; for(int i = from; i<(int)pc->GetPageInfoVector().GetCount(); i++) { int vc8glitch = tabHeight + wxFNB_HEIGHT_SPACER; int tabWidth = CalcTabWidth( pageContainer, i, tabHeight ); if(posx + tabWidth + vc8glitch + GetButtonsAreaLength( pc ) >= clientWidth) break; /// Add a result to the returned vector wxRect tabRect(posx, VERTICAL_BORDER_PADDING, tabWidth , tabHeight); vTabInfo.push_back(tabRect); /// Advance posx posx += tabWidth + wxFNB_HEIGHT_SPACER; } } --- NEW FILE: popup_dlg.cpp --- #include <wx/wxFlatNotebook/popup_dlg.h> #include <wx/listctrl.h> #include <wx/wxFlatNotebook/wxFlatNotebook.h> #include <wx/wxFlatNotebook/renderer.h> #include <wx/listbox.h> #include <wx/image.h> //#include <wx/mstream.h> #include <wx/wxFlatNotebook/fnb_resources.h> wxBitmap wxTabNavigatorWindow::m_bmp; wxTabNavigatorWindow::wxTabNavigatorWindow(wxWindow* parent) : m_listBox(NULL) , m_selectedItem(-1) , m_panel(NULL) { Create(parent); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); GetSizer()->Layout(); Centre(); } wxTabNavigatorWindow::wxTabNavigatorWindow() : wxDialog() , m_listBox(NULL) , m_selectedItem(-1) , m_panel(NULL) { } wxTabNavigatorWindow::~wxTabNavigatorWindow() { } void wxTabNavigatorWindow::Create(wxWindow* parent) { long style = 0; if( !wxDialog::Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style) ) return; wxBoxSizer *sz = new wxBoxSizer( wxVERTICAL ); SetSizer( sz ); long flags = wxLB_SINGLE | wxNO_BORDER ; m_listBox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(200, 150), 0, NULL, flags); static int panelHeight = 0; if( panelHeight == 0 ) { wxMemoryDC mem_dc; // bitmap must be set before it can be used for anything wxBitmap bmp(10, 10); mem_dc.SelectObject(bmp); wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); font.SetWeight( wxBOLD ); mem_dc.SetFont(font); int w; mem_dc.GetTextExtent(wxT("Tp"), &w, &panelHeight); panelHeight += 4; // Place a spacer of 2 pixels // Out signpost bitmap is 24 pixels if( panelHeight < 24 ) panelHeight = 24; } m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize(200, panelHeight)); sz->Add( m_panel ); sz->Add( m_listBox, 1, wxEXPAND ); SetSizer( sz ); // Connect events to the list box m_listBox->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(wxTabNavigatorWindow::OnKeyUp), NULL, this); m_listBox->Connect(wxID_ANY, wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(wxTabNavigatorWindow::OnNavigationKey), NULL, this); m_listBox->Connect(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(wxTabNavigatorWindow::OnItemSelected), NULL, this); // Connect paint event to the panel m_panel->Connect(wxID_ANY, wxEVT_PAINT, wxPaintEventHandler(wxTabNavigatorWindow::OnPanelPaint), NULL, this); m_panel->Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(wxTabNavigatorWindow::OnPanelEraseBg), NULL, this); SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) ); m_listBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); PopulateListControl( static_cast<wxFlatNotebook*>( parent ) ); // Create the bitmap, only once if( !m_bmp.Ok() ) { wxImage img(signpost_xpm); img.SetAlpha(signpost_alpha, true); m_bmp = wxBitmap(img); } } void wxTabNavigatorWindow::OnKeyUp(wxKeyEvent &event) { if( event.GetKeyCode() == WXK_CONTROL ) { CloseDialog(); } } void wxTabNavigatorWindow::OnNavigationKey(wxNavigationKeyEvent &event) { long selected = m_listBox->GetSelection(); wxFlatNotebook* bk = static_cast<wxFlatNotebook*>(GetParent()); long maxItems = bk->GetPageCount(); long itemToSelect; if( event.GetDirection() ) { // Select next page if (selected == maxItems - 1) itemToSelect = 0; else itemToSelect = selected + 1; } else { // Previous page if( selected == 0 ) itemToSelect = maxItems - 1; else itemToSelect = selected - 1; } m_listBox->SetSelection( itemToSelect ); } void wxTabNavigatorWindow::PopulateListControl(wxFlatNotebook *book) { int selection = book->GetSelection(); int count = book->GetPageCount(); m_listBox->Append( book->GetPageText(static_cast<int>(selection)) ); m_indexMap[0] = selection; int itemIdx(1); int prevSel = book->GetPreviousSelection(); if( prevSel != wxNOT_FOUND ) { // Insert the previous selection as second entry m_listBox->Append( book->GetPageText(static_cast<int>(prevSel)) ); m_indexMap[1] = prevSel; itemIdx++; } for(int c=0; c<count; c++) { // Skip selected page if( c == selection ) continue; // Skip previous selected page as well if( c == prevSel ) continue; m_listBox->Append( book->GetPageText(static_cast<int>(c)) ); m_indexMap[itemIdx] = c; itemIdx++; } // Select the next entry after the current selection m_listBox->SetSelection( 0 ); wxNavigationKeyEvent dummy; dummy.SetDirection(true); OnNavigationKey(dummy); } void wxTabNavigatorWindow::OnItemSelected(wxCommandEvent & event ) { wxUnusedVar( event ); CloseDialog(); } void wxTabNavigatorWindow::CloseDialog() { wxFlatNotebook* bk = static_cast<wxFlatNotebook*>(GetParent()); m_selectedItem = m_listBox->GetSelection(); std::map<int, int>::iterator iter = m_indexMap.find(m_selectedItem); bk->SetSelection( iter->second ); EndModal( wxID_OK ); } void wxTabNavigatorWindow::OnPanelPaint(wxPaintEvent &event) { wxUnusedVar(event); wxPaintDC dc(m_panel); wxRect rect = m_panel->GetClientRect(); static bool first = true; static wxBitmap bmp( rect.width, rect.height ); if( first ) { first = false; wxMemoryDC mem_dc; mem_dc.SelectObject( bmp ); wxColour endColour( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW) ); wxColour startColour( wxFNBRenderer::LightColour(endColour, 50) ); wxFNBRenderer::PaintStraightGradientBox(mem_dc, rect, startColour, endColour); // Draw the caption title and place the bitmap wxPoint bmpPt; wxPoint txtPt; // get the bitmap optimal position, and draw it bmpPt.y = (rect.height - m_bmp.GetHeight()) / 2; bmpPt.x = 3; mem_dc.DrawBitmap( m_bmp, bmpPt, true ); // get the text position, and draw it int fontHeight(0), w(0); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); font.SetWeight( wxBOLD ); mem_dc.SetFont( font ); mem_dc.GetTextExtent( wxT("Tp"), &w, &fontHeight ); txtPt.x = bmpPt.x + m_bmp.GetWidth() + 4; txtPt.y = (rect.height - fontHeight)/2; mem_dc.SetTextForeground( *wxWHITE ); mem_dc.DrawText( wxT("Opened tabs:"), txtPt ); mem_dc.SelectObject( wxNullBitmap ); } dc.DrawBitmap( bmp, 0, 0 ); } void wxTabNavigatorWindow::OnPanelEraseBg(wxEraseEvent &event) { wxUnusedVar(event); } --- NEW FILE: wxFlatNotebook.cpp --- /////////////////////////////////////////////////////////////////////////////// // Name: wxFlatNotebook.cpp // Purpose: generic implementation of flat style notebook class. // Author: Eran Ifrah <er...@be...> // Modified by: Priyank Bolia <so...@pr...> // Created: 30/12/2005 // Modified: 01/01/2006 // Copyright: Eran Ifrah (c) // Licence: wxWindows license <http://www.wxwidgets.org/licence3.txt> /////////////////////////////////////////////////////////////////////////////// #include <wx/wxflatnotebook/wxflatnotebook.h> #include <wx/wxflatnotebook/renderer.h> #include <wx/wxflatnotebook/popup_dlg.h> #include <algorithm> #include <wx/tooltip.h> #include <wx/tipwin.h> #include <wx/arrimpl.cpp> [...1695 lines suppressed...] PopupMenu( &popupMenu ); } void wxPageContainer::OnTabMenuSelection(wxCommandEvent &event) { int selection = event.GetId(); static_cast<wxFlatNotebook*>(m_pParent)->SetSelection( (size_t)selection ); } // Draw small arrow at the place that the tab will be placed void wxPageContainer::DrawDragHint() { // get the index of tab that will be replaced with the dragged tab wxPageInfo info; int tabIdx; wxPoint pt = ::wxGetMousePosition(); wxPoint client_pt = ScreenToClient(pt); HitTest(client_pt, info, tabIdx); wxFNBRendererMgrST::Get()->GetRenderer( GetParent()->GetWindowStyleFlag() )->DrawDragHint(this, tabIdx); } |
From: Markus R. <rol...@us...> - 2007-06-21 17:50:57
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/wxflatnotebook/src/wxflatnotebook In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21728/wxflatnotebook Log Message: Directory /cvsroot/simspark/simspark/contrib/rsgedit/wxflatnotebook/src/wxflatnotebook added to the repository --> Using per-directory sticky tag `RSGEDIT_SCINTILLA' |