You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
(11) |
Jul
(8) |
Aug
(7) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
(9) |
2010 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(5) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(12) |
Jun
(21) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2013 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
From: Eran I. <era...@gm...> - 2009-06-15 14:30:08
|
The best and probably the only way to do it is to add new events before the debuggers starts / stops etc. To do this: 1) Add the new events to the enum in plugin.h (make sure you comment them properly 2) Send the events from codelite to the plugins using the 'SendCmdEvent' method located in globals.h 3) Connect your plugin to thses events 4) Increment the plugin interface version number found in plugins_version.h file make sure you use the latest SVN trunk, since I added some events myself The events should be sent from 2 locations: 1) From Frame::OnQuickDebug - this method is called when using the 'Debug -> Quick Debug' from the menu 2) From Manager::DbgStart - this method is called when debugging a codelite project Ofc, dont forget to send me the patch for the new events On Mon, Jun 15, 2009 at 5:15 PM, Mattia Barbon <ma...@de...> wrote: > Hi again, > for my plugin, I need to run some commands before the debugger > starts and after it stops (to automate the launch of gdbserver). Is > there a way to do it? Would it be OK to add some more > events to the plugin notification interface (debuggger starting, > debugger started, debugger stopped)? > > Thanks! > Mattia > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Codelite-developers mailing list > Cod...@li... > https://lists.sourceforge.net/lists/listinfo/codelite-developers > -- Eran Ifrah Cross platform, open source C++ IDE: http://www.codelite.org |
From: Mattia B. <ma...@de...> - 2009-06-15 14:15:46
|
Hi again, for my plugin, I need to run some commands before the debugger starts and after it stops (to automate the launch of gdbserver). Is there a way to do it? Would it be OK to add some more events to the plugin notification interface (debuggger starting, debugger started, debugger stopped)? Thanks! Mattia |
From: Mattia B. <ma...@de...> - 2009-06-11 16:27:42
|
Hi, I am trying to access the type information stored in the tags database that is used for code completion, and I am failing miserably. I am trying to create a context help plugin: when the plugin is correctly configured, hitting "F1" when the cursor is over an expression should bring up the help topic for the type under the cursor. To do that I need to retrieve the type of the expression under the cursor; for example wxString foo; - I need to know that "foo" has type wxString window->GetBackgroundColour().GetAsString().length() - I need to retrieve the type of "window" - when the cursor is over "length" I'd like to know that the left-hand side has type wxString I experimented with Language::ProcessExpression and TagsManager::AutoCompleteCandidates but I could not make them work even in relatively simple test cases, like the two above. Could somebody point me in the right direction? Thanks! Mattia P.S.: the examples above are C++/wxWidgets, but I'd be happy even if the solution worked for C code only |
From: Eran I. <era...@gm...> - 2009-04-23 10:37:25
|
Hi Mattia, Patch is now applied to SVN trunk with an addition fix (if the old file was open in the editor, codelite did not closed it properly) Eran On Tue, Apr 21, 2009 at 6:27 PM, Eran Ifrah <era...@gm...> wrote: > Thanks, I will have a look at it tomorrow morning > Eran > > On Tue, Apr 21, 2009 at 4:29 PM, Mattia Barbon <ma...@de...> wrote: > >> Hi, >> the patch is fairly straightforward: it moves relevant code from >> fileview.cpp to manager.cpp (not necessary, but seemed the right place >> for the functionality) and adds a "file added" notification event. >> >> Best regards, >> Mattia >> >> >> ------------------------------------------------------------------------------ >> Stay on top of everything new and different, both inside and >> around Java (TM) technology - register by April 22, and save >> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >> 300 plus technical and hands-on sessions. Register today. >> Use priority code J9JMT32. http://p.sf.net/sfu/p >> _______________________________________________ >> Codelite-developers mailing list >> Cod...@li... >> https://lists.sourceforge.net/lists/listinfo/codelite-developers >> >> > > > -- > Eran Ifrah > Cross platform, open source C++ IDE: http://www.codelite.org > > -- Eran Ifrah Cross platform, open source C++ IDE: http://www.codelite.org |
From: Eran I. <era...@gm...> - 2009-04-21 15:28:07
|
Thanks, I will have a look at it tomorrow morning Eran On Tue, Apr 21, 2009 at 4:29 PM, Mattia Barbon <ma...@de...> wrote: > Hi, > the patch is fairly straightforward: it moves relevant code from > fileview.cpp to manager.cpp (not necessary, but seemed the right place > for the functionality) and adds a "file added" notification event. > > Best regards, > Mattia > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Codelite-developers mailing list > Cod...@li... > https://lists.sourceforge.net/lists/listinfo/codelite-developers > > -- Eran Ifrah Cross platform, open source C++ IDE: http://www.codelite.org |
From: Mattia B. <ma...@de...> - 2009-04-21 13:56:47
|
Hi, the patch is fairly straightforward: it moves relevant code from fileview.cpp to manager.cpp (not necessary, but seemed the right place for the functionality) and adds a "file added" notification event. Best regards, Mattia |
From: Mattia B. <ma...@de...> - 2009-04-21 10:23:10
|
Eran Ifrah ha scritto: > Sorry I did a little mess with the emails :D > > Anyways, you are more than welcome to send a patch for adding the > missing functionality. Good :-) > Remember that whenever the interface between the plugins and the > application is modified (changing content of event is an example of API > changes), you need to increase the API version which is located at > plugin_version.h header file, this makes sure that codelite and the > plugins shares the same API and void crashes. The changes I plan to implement are only additions (adding new events); does this require an API version bump as well? Thanks! Mattia > On Mon, Apr 20, 2009 at 6:14 PM, Mattia Barbon <ma...@de... > <mailto:ma...@de...>> wrote: > > Hi everybody! > I am writing a custom CodeLite plugin to integrate BeRTOS > (http://bertos.org/) makefiles in CodeLite (it's nothing complicated: > it only needs to intercept file add/delete/rename and update a > file list in a Makefile). > > I had no problem intercepting file additions. > > For deletions, it seems there is no way to determine the project the > file has been removed from, since when the notification is sent the file > has already been removed from the project. At the moment I am iterating > over all projects and guessing the right one from project path. Is > there a better way to do it? > > I found no way to intercept file renames: for each rename I get a file > remove event, but the file path passed to the event handler only > contains the file name, not the full path like in file add/delete. I > get no add event. If the intended effect is to send a > delete(old file name) + add(new file name) event, I can prepare a patch > to that effect. > > Best regards, > Mattia > > P.S.: please CC me on replies, I am not subscribed > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Codelite-developers mailing list > Cod...@li... > <mailto:Cod...@li...> > https://lists.sourceforge.net/lists/listinfo/codelite-developers > > > > > -- > Eran Ifrah > Cross platform, open source C++ IDE: http://www.codelite.org > |
From: Eran I. <era...@gm...> - 2009-04-21 07:19:39
|
Sorry I did a little mess with the emails :D Anyways, you are more than welcome to send a patch for adding the missing functionality. Remember that whenever the interface between the plugins and the application is modified (changing content of event is an example of API changes), you need to increase the API version which is located at plugin_version.h header file, this makes sure that codelite and the plugins shares the same API and void crashes. Eran On Mon, Apr 20, 2009 at 6:14 PM, Mattia Barbon <ma...@de...> wrote: > Hi everybody! > I am writing a custom CodeLite plugin to integrate BeRTOS > (http://bertos.org/) makefiles in CodeLite (it's nothing complicated: > it only needs to intercept file add/delete/rename and update a > file list in a Makefile). > > I had no problem intercepting file additions. > > For deletions, it seems there is no way to determine the project the > file has been removed from, since when the notification is sent the file > has already been removed from the project. At the moment I am iterating > over all projects and guessing the right one from project path. Is > there a better way to do it? > > I found no way to intercept file renames: for each rename I get a file > remove event, but the file path passed to the event handler only > contains the file name, not the full path like in file add/delete. I > get no add event. If the intended effect is to send a > delete(old file name) + add(new file name) event, I can prepare a patch > to that effect. > > Best regards, > Mattia > > P.S.: please CC me on replies, I am not subscribed > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Codelite-developers mailing list > Cod...@li... > https://lists.sourceforge.net/lists/listinfo/codelite-developers > -- Eran Ifrah Cross platform, open source C++ IDE: http://www.codelite.org |
From: Mattia B. <ma...@de...> - 2009-04-20 16:31:26
|
Hi again, I see there are events delivered to plugins for build start/end; would it be OK if I added similar events for debug start/end? Best regards, Mattia |
From: Mattia B. <ma...@de...> - 2009-04-20 15:41:56
|
Hi everybody! I am writing a custom CodeLite plugin to integrate BeRTOS (http://bertos.org/) makefiles in CodeLite (it's nothing complicated: it only needs to intercept file add/delete/rename and update a file list in a Makefile). I had no problem intercepting file additions. For deletions, it seems there is no way to determine the project the file has been removed from, since when the notification is sent the file has already been removed from the project. At the moment I am iterating over all projects and guessing the right one from project path. Is there a better way to do it? I found no way to intercept file renames: for each rename I get a file remove event, but the file path passed to the event handler only contains the file name, not the full path like in file add/delete. I get no add event. If the intended effect is to send a delete(old file name) + add(new file name) event, I can prepare a patch to that effect. Best regards, Mattia P.S.: please CC me on replies, I am not subscribed |
From: Eran I. <era...@gm...> - 2008-10-23 17:15:51
|
Hi Rodrigez! I am sorry for the late reply, but it seems that I did not receive any emails from the mailing list... I will go ahead and test your patch and will let you know Thanks, -- Eran Ifrah Cross Platform C++ IDE: http://www.codelite.org |
From: Eran I. <era...@gm...> - 2008-10-23 15:34:58
|
Hi, It looks like the SF mailing list does not allows passing huge message via the mailing list... Can u please send me the patch to my private email? Also, make sure it is attachment and not inline - as it appears it breaks the patch Thanks, -- Eran Ifrah Cross Platform C++ IDE: http://www.codelite.org |
From: Scott D. <sd...@ya...> - 2008-10-22 16:13:43
|
Eran, I think I've managed to address most of the concerns in your comment to this FR (except for altering stable code... :-) I'm including the entire revised patch here, because I don't have an easy way to do a patch of a patch. In addition, another tiny change is included because I had already completed it before remaking the patch. That one adds a couple of entries to the editor tab context menu, Show in Workspace, and Show in Explorer. They just call the appropriate-file-tree::ExpandToPath(editor-filename) method. I use it when I turn off Link to Editor. Scott Index: CodeLite/ctags_manager.cpp =================================================================== --- CodeLite/ctags_manager.cpp (revision 2304) +++ CodeLite/ctags_manager.cpp (working copy) @@ -349,13 +349,27 @@ TagTreePtr TagsManager::Load(const wxFileName& fileName) { + return Load(std::vector<wxFileName>(1, fileName)); +} + +TagTreePtr TagsManager::Load(const std::vector<wxFileName> &files) +{ + wxString sql = wxT("select * from tags "); + if (!files.empty()) { + sql << wxT("where file in ('") << files[0].GetFullPath() << wxT("'"); + for (size_t i = 1; i < files.size(); i++) { + sql << wxT(", '") << files[i].GetFullPath() << wxT("'"); + } + sql << wxT(") "); + } + // Make this call threadsafe wxCriticalSectionLocker locker(m_cs); // Incase empty file path is provided, use the current file name TagTreePtr tree; try { - wxSQLite3ResultSet rs = m_workspaceDatabase->SelectTagsByFile(fileName.GetFullPath()); + wxSQLite3ResultSet rs = m_workspaceDatabase->Query(sql); // Load the records and build a language tree TagEntry root; Index: CodeLite/ctags_manager.h =================================================================== --- CodeLite/ctags_manager.h (revision 2304) +++ CodeLite/ctags_manager.h (working copy) @@ -253,6 +253,14 @@ TagTreePtr Load(const wxFileName& fileName); /** + * load all symbols of fileNames from the database and return them + * to user as tree + * @param fileNames file sto load symbols from + * @return tag tree + */ + TagTreePtr Load(const std::vector<wxFileName>& fileNames); + + /** * Open sqlite database. * @param fileName Database file name */ Index: CodeLite/symbol_tree.cpp =================================================================== --- CodeLite/symbol_tree.cpp (revision 2304) +++ CodeLite/symbol_tree.cpp (working copy) @@ -23,6 +23,7 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #include "precompiled_header.h" +#include <wx/settings.h> #ifdef __VISUALC__ #ifdef _DEBUG @@ -57,14 +58,17 @@ //-------------------------------------------------------- // Initialise the images map (kind:icon_index) //-------------------------------------------------------- - m_imagesMap[wxT("class_view")] = 14; + m_imagesMap[wxT("class_view")] = 18; + m_imagesMap[wxT("project")] = 0; m_imagesMap[wxT("namespace")] = 1; m_imagesMap[wxT("globals")] = 2; m_imagesMap[wxT("class")] = 3; + m_imagesMap[wxT("interface")] = 3; m_imagesMap[wxT("interface_private")] = 3; m_imagesMap[wxT("interface_protected")] = 3; + m_imagesMap[wxT("class_private")] = 3; m_imagesMap[wxT("class_public")] = 3; m_imagesMap[wxT("class_protected")] = 3; @@ -74,38 +78,44 @@ m_imagesMap[wxT("struct_public")] = 4; m_imagesMap[wxT("struct_protected")] = 4; - m_imagesMap[wxT("function")] = 5; m_imagesMap[wxT("prototype")] = 5; - m_imagesMap[wxT("function_public")] = 5; m_imagesMap[wxT("prototype_public")] = 5; - - m_imagesMap[wxT("function_protected")] = 6; m_imagesMap[wxT("prototype_protected")] = 6; - m_imagesMap[wxT("function_private")] = 7; m_imagesMap[wxT("prototype_private")] = 7; - m_imagesMap[wxT("variable")] = 8; - m_imagesMap[wxT("member")] = 8; - m_imagesMap[wxT("member_public")] = 8; - m_imagesMap[wxT("member_protected")] = 9; - m_imagesMap[wxT("member_private")] = 10; - m_imagesMap[wxT("typedef")] = 11; - m_imagesMap[wxT("typedef_public")] = 11; - m_imagesMap[wxT("typedef_private")] = 11; - m_imagesMap[wxT("typedef_protected")] = 11; - m_imagesMap[wxT("macro")] = 12; - m_imagesMap[wxT("macro_private")] = 12; - m_imagesMap[wxT("macro_protected")] = 12; - m_imagesMap[wxT("macro_public")] = 12; - m_imagesMap[wxT("enum")] = 13; - m_imagesMap[wxT("enum_private")] = 13; - m_imagesMap[wxT("enum_public")] = 13; - m_imagesMap[wxT("enum_protected")] = 13; - m_imagesMap[wxT("enumerator")] = 14; + + m_imagesMap[wxT("function")] = 8; + m_imagesMap[wxT("function_public")] = 8; + m_imagesMap[wxT("function_protected")] = 9; + m_imagesMap[wxT("function_private")] = 10; + + m_imagesMap[wxT("method")] = 8; + m_imagesMap[wxT("method_public")] = 8; + m_imagesMap[wxT("method_protected")] = 9; + m_imagesMap[wxT("method_private")] = 10; - m_imagesMap[wxT("method")] = 5; - m_imagesMap[wxT("method_public")] = 5; - m_imagesMap[wxT("method_protected")] = 6; - m_imagesMap[wxT("method_private")] = 7; + m_imagesMap[wxT("variable")] = 11; + + m_imagesMap[wxT("member")] = 11; + m_imagesMap[wxT("member_public")] = 11; + m_imagesMap[wxT("member_protected")] = 12; + m_imagesMap[wxT("member_private")] = 13; + + m_imagesMap[wxT("typedef")] = 14; + m_imagesMap[wxT("typedef_public")] = 14; + m_imagesMap[wxT("typedef_private")] = 14; + m_imagesMap[wxT("typedef_protected")] = 14; + + m_imagesMap[wxT("macro")] = 15; + m_imagesMap[wxT("macro_private")] = 15; + m_imagesMap[wxT("macro_protected")] = 15; + m_imagesMap[wxT("macro_public")] = 15; + + m_imagesMap[wxT("enum")] = 16; + m_imagesMap[wxT("enum_private")] = 16; + m_imagesMap[wxT("enum_public")] = 16; + m_imagesMap[wxT("enum_protected")] = 16; + + m_imagesMap[wxT("enumerator")] = 17; //----------------------------------------------------------- // Populate globals kind @@ -128,7 +138,7 @@ BuildTree( wxFileName() ); } -void SymbolTree::BuildTree(const wxFileName &fileName) +void SymbolTree::BuildTree(const wxFileName &treeFileName, const std::vector<wxFileName> &tagFileNames) { // Clear the tree DeleteAllItems(); @@ -138,16 +148,19 @@ m_macrosNode = wxTreeItemId(); m_sortItems.clear(); - m_fileName = fileName; + if (!treeFileName.IsOk()) { + // if name is empty, leave tree completely empty (it will be filled in later) + return; + } + + m_fileName = treeFileName; // Get the current tree - m_tree = TagsManagerST::Get()->Load(m_fileName); + m_tree = TagsManagerST::Get()->Load(tagFileNames); if ( !m_tree ) { return; } - // Add invisible root node - wxTreeItemId root; - root = AddRoot(fileName.GetFullName(), 15, 15); + wxTreeItemId root = AddRoot(treeFileName.GetFullName(), 18, 18); TreeWalker<wxString, TagEntry> walker(m_tree->GetRoot()); @@ -174,6 +187,7 @@ } SortTree(m_sortItems); + Expand(root); Thaw(); //select the root node by default @@ -190,6 +204,7 @@ int iconIndex = GetItemIconIndex(nodeData.GetKind(), nodeData.GetAccess()); wxString displayName(nodeData.GetDisplayName()); + displayName.Replace(wxT(": [prototype]"), wxT("")); wxTreeItemId parentHti; if (nodeData.GetName().IsEmpty()) @@ -221,12 +236,19 @@ parentHti = GetRootItem(); } + // put prototypes in italic so they stand out from definitions + wxFont prototypeFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + prototypeFont.SetStyle(wxFONTSTYLE_ITALIC); + if (parentHti.IsOk()) { hti = AppendItem(parentHti, // parent displayName, // display name iconIndex, // item image index iconIndex, // selected item image new MyTreeItemData(node->GetData().GetFile(), node->GetData().GetPattern())); + if (nodeData.GetKind() == wxT("prototype")) { + SetItemFont(hti, prototypeFont); + } node->GetData().SetTreeItemId( hti ); m_sortItems[parentHti.m_pItem] = true; m_items[nodeData.Key()] = hti.m_pItem; Index: CodeLite/symbol_tree.h =================================================================== --- CodeLite/symbol_tree.h (revision 2304) +++ CodeLite/symbol_tree.h (working copy) @@ -114,12 +114,21 @@ * \param size Window size * \param style Window style */ - virtual void Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS); + virtual void Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS); /** - * Construct a outline tree for fileName + * Construct an outline tree for a group of filenames. + * \param treeFileName the name of this tree (file, project, or workspace) + * \param tagFileNames the files whose tags are loaded into this tree */ - void BuildTree(const wxFileName &fileName); + void BuildTree(const wxFileName &treeFileName, const std::vector<wxFileName> &tagFileNames); + + /** + * Construct an outline tree for a single source file. + * \param fileName the name of the file to load + */ + void BuildTree(const wxFileName &fileName) + { BuildTree(fileName, std::vector<wxFileName>(1, fileName)); } /** * User provided icons for the symbols tree. Index: LiteEditor/cpp_symbol_tree.cpp =================================================================== --- LiteEditor/cpp_symbol_tree.cpp (revision 2304) +++ LiteEditor/cpp_symbol_tree.cpp (working copy) @@ -48,33 +48,40 @@ images->Add(wxXmlResource::Get()->LoadBitmap(_T("globals"))); // 2 images->Add(wxXmlResource::Get()->LoadBitmap(_T("class"))); // 3 images->Add(wxXmlResource::Get()->LoadBitmap(_T("struct"))); // 4 - images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_public"))); // 5 + + // load bitmaps for function prototypes + images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_public"))); // 5 images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_protected"))); // 6 images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_private"))); // 7 - images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_public"))); // 8 - images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_protected")));// 9 - images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_private"))); // 10 + // load them again for function/method definitions + images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_public"))); // 8 + images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_protected"))); // 9 + images->Add(wxXmlResource::Get()->LoadBitmap(_T("func_private"))); // 10 + + images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_public"))); // 11 + images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_protected")));// 12 + images->Add(wxXmlResource::Get()->LoadBitmap(_T("member_private"))); // 13 wxBitmap bmp; // typedef - bmp = wxXmlResource::Get()->LoadBitmap(_T("typedef")); // 11 + bmp = wxXmlResource::Get()->LoadBitmap(_T("typedef")); // 14 bmp.SetMask(new wxMask(bmp, wxColor(0, 128, 128))); images->Add(bmp); // macro (same icon as typedef) - bmp = wxXmlResource::Get()->LoadBitmap(_T("typedef")); // 12 + bmp = wxXmlResource::Get()->LoadBitmap(_T("typedef")); // 15 bmp.SetMask(new wxMask(bmp, wxColor(0, 128, 128))); images->Add(bmp); - bmp = wxXmlResource::Get()->LoadBitmap(_T("enum")); // 13 + bmp = wxXmlResource::Get()->LoadBitmap(_T("enum")); // 16 bmp.SetMask(new wxMask(bmp, wxColor(0, 128, 128))); images->Add(bmp); - bmp = wxXmlResource::Get()->LoadBitmap(wxT("enumerator")); //14 + bmp = wxXmlResource::Get()->LoadBitmap(wxT("enumerator")); //17 images->Add(bmp); - bmp = wxXmlResource::Get()->LoadBitmap(wxT("class_view")); //15 + bmp = wxXmlResource::Get()->LoadBitmap(wxT("class_view")); //18 images->Add(bmp); return images; } @@ -165,6 +172,7 @@ e.SetEventObject(this); wxPostEvent(GetEventHandler(), e); } + return true; } Index: LiteEditor/cpp_symbol_tree.h =================================================================== --- LiteEditor/cpp_symbol_tree.h (revision 2304) +++ LiteEditor/cpp_symbol_tree.h (working copy) @@ -40,7 +40,7 @@ CppSymbolTree(); /// Nothing special here, just call our parent constructor - CppSymbolTree(wxWindow *parent, const wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS); + CppSymbolTree(wxWindow *parent, const wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTR_HAS_BUTTONS); /// destructor Index: LiteEditor/fileexplorer.cpp =================================================================== --- LiteEditor/fileexplorer.cpp (revision 2304) +++ LiteEditor/fileexplorer.cpp (working copy) @@ -25,6 +25,7 @@ #include "wx/xrc/xmlres.h" #include "fileexplorer.h" #include "fileexplorertree.h" +#include "frame.h" #include "wx/sizer.h" #include "wx/tokenzr.h" @@ -192,4 +193,8 @@ m_isLinkedToEditor = !m_isLinkedToEditor; // save the value EditorConfigST::Get()->SaveLongValue(wxT("LinkFileExplorerToEditor"), m_isLinkedToEditor ? 1 : 0); + if (m_isLinkedToEditor) { + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, XRCID("show_in_explorer")); + Frame::Get()->AddPendingEvent(event); + } } Index: LiteEditor/frame.cpp =================================================================== --- LiteEditor/frame.cpp (revision 2304) +++ LiteEditor/frame.cpp (working copy) @@ -107,6 +107,7 @@ #include "globals.h" #include "workspacetab.h" #include "fileexplorer.h" +#include "symbolview.h" #include "custom_notebook.h" #ifdef __WXGTK20__ @@ -164,6 +165,10 @@ EVT_MENU(XRCID("close_other_tabs"), Frame::OnCloseAllButThis) EVT_MENU(XRCID("copy_file_name"), Frame::OnCopyFilePath) EVT_MENU(XRCID("copy_file_path"), Frame::OnCopyFilePathOnly) + EVT_MENU(XRCID("show_in_workspace"), Frame::OnShowInWorkspace) + EVT_UPDATE_UI(XRCID("show_in_workspace"), Frame::OnShowInWorkspaceUI) + EVT_MENU(XRCID("show_in_explorer"), Frame::OnShowInExplorer) + EVT_UPDATE_UI(XRCID("show_in_explorer"), Frame::OnShowInExplorerUI) EVT_MENU(XRCID("open_shell_from_filepath"), Frame::OnOpenShellFromFilePath) EVT_UPDATE_UI(XRCID("open_shell_from_filepath"), Frame::OnFileExistUpdateUI) @@ -1366,12 +1371,7 @@ ClosePage(editor, true, event.GetSelection(), false, veto); if ( veto ) { event.Veto(); - } else { - //update the symbol view - if (!editor->GetProject().IsEmpty()) { - GetWorkspacePane()->DeleteSymbolTree(editor->GetFileName()); - } - } + } //update the titlebar SetFrameTitle(NULL); @@ -1395,7 +1395,7 @@ //update the symbol view as well in case we are in a workspace context if (!editor->GetProject().IsEmpty()) { - GetWorkspacePane()->DisplaySymbolTree(editor->GetFileName()); + GetSymbolView()->DisplaySymbolTree(editor->GetFileName()); if (GetWorkspaceTab()->GetIsLinkedToEditor()) { GetWorkspacePane()->GetFileViewTree()->ExpandToPath(editor->GetProject(), editor->GetFileName()); } @@ -1433,9 +1433,12 @@ //clean the navigation bar GetMainBook()->Clear(); - // if no more editors are available, collapse the workspace tree - if (GetWorkspaceTab()->GetIsLinkedToEditor() && GetMainBook()->GetNotebook()->GetPageCount() == 0) { - GetWorkspacePane()->CollpaseAll(); + if (GetMainBook()->GetNotebook()->GetPageCount() == 0) { + // no more editors are left + if (GetWorkspaceTab()->GetIsLinkedToEditor()) { + // collapse the workspace tree + GetWorkspacePane()->CollpaseAll(); + } } } @@ -1475,7 +1478,6 @@ return; } else { if ( doDelete ) { - GetWorkspacePane()->DeleteSymbolTree(editor->GetFileName()); GetNotebook()->DeletePage(index, notify); } } @@ -1487,7 +1489,6 @@ case wxNO: // just delete the tab without saving the changes if ( doDelete ) { - GetWorkspacePane()->DeleteSymbolTree(editor->GetFileName()); GetNotebook()->DeletePage(index, notify); } break; @@ -1495,10 +1496,11 @@ } else { // file is not modified, just remove the tab if ( doDelete ) { - GetWorkspacePane()->DeleteSymbolTree(editor->GetFileName()); GetNotebook()->DeletePage(index, notify); } // if( doDelete ) } + if (!editor->GetProject().IsEmpty()) + GetSymbolView()->DeleteSymbolTree(editor->GetFileName()); } void Frame::OnSearchThread(wxCommandEvent &event) @@ -2331,27 +2333,17 @@ void Frame::OnAddSymbols(SymbolTreeEvent &event) { - SymbolTree *tree = GetWorkspacePane()->GetSymbolTree(event.GetFileName()); - if (tree) { - tree->AddSymbols(event); - } + GetSymbolView()->OnAddSymbols(event); } void Frame::OnDeleteSymbols(SymbolTreeEvent &event) { - // make sure we direct the events to the correct tree - SymbolTree *tree = GetWorkspacePane()->GetSymbolTree(event.GetFileName()); - if (tree) { - tree->DeleteSymbols(event); - } + GetSymbolView()->OnDeleteSymbols(event); } void Frame::OnUpdateSymbols(SymbolTreeEvent &event) { - SymbolTree *tree = GetWorkspacePane()->GetSymbolTree(event.GetFileName()); - if (tree) { - tree->UpdateSymbols(event); - } + GetSymbolView()->OnUpdateSymbols(event); } wxString Frame::CreateWorkspaceTable() @@ -3021,6 +3013,11 @@ return GetWorkspacePane()->GetFileExplorer(); } +SymbolView *Frame::GetSymbolView() +{ + return GetWorkspacePane()->GetSymbolView(); +} + void Frame::OnLoadWelcomePage(wxCommandEvent &event) { SetFrameFlag(event.IsChecked(), CL_SHOW_WELCOME_PAGE); @@ -3703,3 +3700,54 @@ wxUnusedVar( event ); ManagerST::Get()->RetagWorkspace(); } + +void Frame::OnShowInExplorer(wxCommandEvent& e) +{ + LEditor *editor = ManagerST::Get()->GetActiveEditor(); + if (editor) { + wxFileName filepath = editor->GetFileName(); + if (filepath.FileExists()) { + GetFileExplorer()->GetFileTree()->ExpandToPath(filepath); + ManagerST::Get()->ShowWorkspacePane(WorkspacePane::EXPLORER); + } + } +} + +void Frame::OnShowInExplorerUI(wxUpdateUIEvent& e) +{ + e.Enable(false); + LEditor *editor = ManagerST::Get()->GetActiveEditor(); + if (editor) { + wxFileName filepath = editor->GetFileName(); + if (filepath.FileExists()) { + e.Enable(true); + } + } +} + +void Frame::OnShowInWorkspace(wxCommandEvent& e) +{ + LEditor *editor = ManagerST::Get()->GetActiveEditor(); + if (editor) { + wxString project = editor->GetProject(); + wxFileName filepath = editor->GetFileName(); + if (!project.IsEmpty()) { + GetWorkspaceTab()->GetFileView()->ExpandToPath(project, filepath); + ManagerST::Get()->ShowWorkspacePane(WorkspacePane::FILE_VIEW); + } + } +} + +void Frame::OnShowInWorkspaceUI(wxUpdateUIEvent& e) +{ + e.Enable(false); + LEditor *editor = ManagerST::Get()->GetActiveEditor(); + if (editor) { + wxString project = editor->GetProject(); + wxFileName filepath = editor->GetFileName(); + if (!project.IsEmpty()) { + e.Enable(true); + } + } +} + Index: LiteEditor/frame.h =================================================================== --- LiteEditor/frame.h (revision 2304) +++ LiteEditor/frame.h (working copy) @@ -51,6 +51,7 @@ class WorkspacePane; class wxToolBar; class Notebook; +class SymbolView; class OpenWindowsPanel; class WorkspaceTab; class FileExplorer; @@ -184,6 +185,11 @@ */ OpenWindowsPanel *GetOpenWindowsPane(); + /** + * return the symbol view pane + */ + SymbolView *GetSymbolView(); + /** * \return return AUI docking manager */ @@ -374,6 +380,10 @@ void OnHighlightWord(wxCommandEvent &event); void OnShowNavBar(wxCommandEvent &e); void OnShowNavBarUI(wxUpdateUIEvent &e); + void OnShowInWorkspace(wxCommandEvent &e); + void OnShowInWorkspaceUI(wxUpdateUIEvent &e); + void OnShowInExplorer(wxCommandEvent &e); + void OnShowInExplorerUI(wxUpdateUIEvent &e); void OnOpenShellFromFilePath(wxCommandEvent &e); void OnQuickDebug(wxCommandEvent &e); void OnQuickDebugUI(wxUpdateUIEvent &e); Index: LiteEditor/LiteEditor.project =================================================================== --- LiteEditor/LiteEditor.project (revision 2304) +++ LiteEditor/LiteEditor.project (working copy) @@ -355,6 +355,8 @@ <File Name="taskbasepanel.cpp"/> <File Name="taskbasepanel.h"/> <File Name="taskpanel.cpp"/> + <File Name="symbolview.cpp"/> + <File Name="symbolview.h"/> </VirtualDirectory> <VirtualDirectory Name="Plugins"> <File Name="pluginmanager.h"/> Index: LiteEditor/manager.cpp =================================================================== --- LiteEditor/manager.cpp (revision 2304) +++ LiteEditor/manager.cpp (working copy) @@ -86,6 +86,7 @@ #include "custom_notebook.h" #include "sessionmanager.h" #include "workspacetab.h" +#include "symbolview.h" #include <vector> extern unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); @@ -199,14 +200,7 @@ bool Manager::OpenFile(const wxString &file_name, const wxString &projectName, int lineno, long position) { - wxFileName fileName(file_name); - wxString projName(projectName); - Notebook *notebook = Frame::Get()->GetNotebook(); - bool updTree = false; - bool fileWasOpenedInNB(false); - int selection(wxNOT_FOUND); wxWindow *returnFocusWin(NULL); - wxWindow *focusWin = wxWindow::FindFocus(); if (focusWin == Frame::Get()->GetOutputPane()->GetDebugWindow()->GetInWin()) { returnFocusWin = focusWin; @@ -219,19 +213,21 @@ Frame::Get()->GetDockingManager().Update(); } - // Search to see if this file is already opened - // in the notebook + wxFileName fileName(file_name); + Notebook *notebook = Frame::Get()->GetNotebook(); + + // Search to see if this file is already opened in the notebook LEditor* editor = NULL; - size_t nCount = 0; - for (; nCount < (size_t)notebook ->GetPageCount(); nCount++) { + int selection(wxNOT_FOUND); + for (size_t nCount = 0; nCount < (size_t)notebook ->GetPageCount(); nCount++) { editor = dynamic_cast<LEditor*>(notebook ->GetPage(nCount)); if ( editor ) { wxString f1 = editor->GetFileName().GetFullPath(); wxString f2 = fileName.GetFullPath(); if (f1 == f2) { - notebook->SetSelection( nCount ); + //notebook->SetSelection( nCount ); selection = (int)nCount; - fileWasOpenedInNB = true; + //fileWasOpenedInNB = true; break; } editor = NULL; @@ -241,6 +237,7 @@ //even in cases were a project name is empty, we try //to match a project name to the actual file. otherwise, CC may not work //since it depends on a valid project name in the editor + wxString projName(projectName); if (projectName.IsEmpty()) { projName = GetProjectNameByFile(fileName.GetFullPath()); } @@ -260,55 +257,32 @@ // Create new editor and add it to the notebook notebook->Freeze(); - // create new instance from pool editor = EditorCreatorST::Get()->NewInstance(); editor->Create(projName, fileName); editor->SetSyntaxHighlight(editor->GetContext()->GetName()); - notebook->AddPage(editor, fileName.GetFullName(), wxNullBitmap, true); + notebook->AddPage(editor, fileName.GetFullName(), wxNullBitmap, false); notebook->Thaw(); selection = (int)notebook->GetPageCount()-1; - updTree = true; } + editor->SetProject( projName ); + // Go to tag line number and gives scintilla the focus if ( position != wxNOT_FOUND ) { - int lineno = editor->LineFromPosition(position); - editor->GotoLine( lineno ); editor->SetCaretAt( position ); - editor->EnsureVisible(lineno); - } else { - if (!(fileWasOpenedInNB && lineno == wxNOT_FOUND)) { - editor->GotoLine( lineno ); - editor->EnsureVisible(lineno); - } + } else if (lineno != wxNOT_FOUND) { + editor->GotoLine( lineno ); } + editor->EnsureCaretVisible(); - //update the symbol tree - if (updTree && !editor->GetProject().IsEmpty()) - Frame::Get()->GetWorkspacePane()->BuildSymbolTree(fileName); + notebook->SetSelection(selection); + //update the open files list + Frame::Get()->GetOpenWindowsPane()->UpdateList(); + //update the 'Recent file' history AddToRecentlyOpenedFiles(fileName.GetFullPath()); - if (selection != wxNOT_FOUND) { - notebook->SetSelection(selection); - } - - editor->SetProject( projName ); - - //Synchronize the file view tree - if (IsWorkspaceOpen() && Frame::Get()->GetWorkspacePane()->GetWorkspaceTab()->GetIsLinkedToEditor()) { - Frame::Get()->GetWorkspacePane()->GetFileViewTree()->ExpandToPath(editor->GetProject(), editor->GetFileName()); - } - - if (Frame::Get()->GetFileExplorer()->GetIsLinkedToEditor()) { - Frame::Get()->GetFileExplorer()->GetFileTree()->ExpandToPath(editor->GetFileName()); - } - - //update the open files list - Frame::Get()->GetOpenWindowsPane()->UpdateList(); - editor->SetActive(); - if (returnFocusWin) { returnFocusWin->SetFocus(); } @@ -525,6 +499,7 @@ } } + Frame::Get()->GetSymbolView()->DeleteAllSymbolTrees(); Frame::Get()->GetNotebook()->Refresh(); Frame::Get()->GetWorkspacePane()->BuildFileTree(); @@ -613,6 +588,9 @@ RetagProject(projectName); RebuildFileView(); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(fn); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); + //notify plugins SendCmdEvent(wxEVT_PROJ_ADDED, (void*)&projectName); } @@ -642,6 +620,8 @@ proj->GetFiles(projectFiles, true); TagsManagerST::Get()->DeleteFilesTags(projectFiles); RemoveProjectNameFromOpenFiles(projectFiles); + Frame::Get()->GetSymbolView()->DeleteSymbolTree(proj->GetFileName()); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); } // if(proj) Frame::Get()->GetWorkspacePane()->GetFileViewTree()->BuildTree(); @@ -665,6 +645,7 @@ for (size_t j=0; j<project_files.size(); j++) { if (openFileFP == project_files.at(j).GetFullPath()) { editor->SetProject(wxEmptyString); + Frame::Get()->GetSymbolView()->DeleteSymbolTree(project_files.at(j)); break; } } @@ -712,6 +693,9 @@ bool res = WorkspaceST::Get()->RemoveVirtualDirectory(virtualDirFullPath, errMsg); CHECK_MSGBOX(res); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(p->GetFileName()); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); + SendCmdEvent(wxEVT_PROJ_FILE_REMOVED, (void*)&files); } @@ -746,10 +730,6 @@ return false; } - if ( openIt ) { - OpenFile(fileName, project); - } - TagTreePtr ttp; if ( project.IsEmpty() == false ) { std::vector<DbRecordPtr> comments; @@ -762,6 +742,16 @@ TagsManagerST::Get()->Store(ttp); } + ProjectPtr proj = GetProject(project); + if (proj) { + Frame::Get()->GetSymbolView()->RefreshSymbolTree(proj->GetFileName()); + } + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); + + if ( openIt ) { + OpenFile(fileName, project); + } + //send notification command event that files was added to //project wxArrayString files; @@ -805,6 +795,12 @@ TagsManagerST::Get()->RetagFiles(vFiles); } + ProjectPtr proj = GetProject(project); + if (proj) { + Frame::Get()->GetSymbolView()->RefreshSymbolTree(proj->GetFileName()); + } + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); + SendCmdEvent(wxEVT_PROJ_FILE_ADDED, (void*)&actualAdded); } @@ -838,6 +834,12 @@ CHECK_MSGBOX_BOOL(res); RemoveFileFromSymbolTree(absPath, project); + ProjectPtr proj = GetProject(project); + if (proj) { + Frame::Get()->GetSymbolView()->RefreshSymbolTree(proj->GetFileName()); + } + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); + return true; } @@ -1425,6 +1427,8 @@ //call tags manager for re-tagging TagsManagerST::Get()->RetagFiles(projectFiles); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(proj->GetFileName()); + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); } } @@ -1447,6 +1451,13 @@ } //call tags manager for re-tagging TagsManagerST::Get()->RetagFiles(projectFiles); + for (size_t i = 0; i < projects.GetCount(); i++) { + ProjectPtr proj = GetProject(projects.Item(i)); + if (proj) { + Frame::Get()->GetSymbolView()->RefreshSymbolTree(proj->GetFileName()); + } + } + Frame::Get()->GetSymbolView()->RefreshSymbolTree(WorkspaceST::Get()->GetWorkspaceFileName()); } void Manager::WriteProgram(const wxString &line) @@ -1713,8 +1724,7 @@ dlg->Destroy(); } - //remove all symbol trees from the outline view - Frame::Get()->GetWorkspacePane()->DeleteAllSymbolTrees(); + Frame::Get()->GetSymbolView()->DisplaySymbolTree(); } bool Manager::MoveFileToVD(const wxString &fileName, const wxString &srcVD, const wxString &targetVD) @@ -3139,6 +3149,7 @@ } } + Frame::Get()->GetSymbolView()->RefreshSymbolTree(path); SendCmdEvent(wxEVT_WORKSPACE_LOADED); } Index: LiteEditor/symbolview.cpp =================================================================== --- LiteEditor/symbolview.cpp (revision 0) +++ LiteEditor/symbolview.cpp (revision 0) @@ -0,0 +1,352 @@ +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +// +// copyright : (C) 2008 by Eran Ifrah +// file name : symbolview.h +// +// ------------------------------------------------------------------------- +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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; either version 2 of the License, or +// (at your option) any later version. +// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +#include <wx/xrc/xmlres.h> +#include <wx/sizer.h> +#include "macros.h" +#include "frame.h" +#include "manager.h" +#include "ctags_manager.h" +#include "editor_config.h" +#include "cpp_symbol_tree.h" +#include "symbolview.h" +#include "parse_thread.h" +#include "windowstack.h" + +extern wxImageList* CreateSymbolTreeImages(); + + +static wxArrayString s_viewModeNames; + + +SymbolView::SymbolView(wxWindow *parent) + : wxPanel(parent) + , m_viewMode(0) + , m_winStack(NULL) + , m_isLinkedToEditor(false) +{ + long link(0); + EditorConfigST::Get()->GetLongValue(wxT("LinkSymbolViewToEditor"), link); + m_isLinkedToEditor = link ? true : false; + s_viewModeNames.Add(wxT("Current File")); + s_viewModeNames.Add(wxT("Current Project")); + s_viewModeNames.Add(wxT("Current Workspace")); + CreateGUIControls(); +} + +SymbolView::~SymbolView() +{ +} + +BEGIN_EVENT_TABLE(SymbolView, wxPanel) + EVT_MENU(XRCID("link_editor"), SymbolView::OnLinkEditor) + EVT_MENU(XRCID("collapse_all"), SymbolView::OnCollapseAll) + EVT_UPDATE_UI(XRCID("collapse_all"), SymbolView::OnCollapseAllUI) + EVT_MENU(XRCID("gohome"), SymbolView::OnGoHome) + EVT_UPDATE_UI(XRCID("gohome"), SymbolView::OnGoHomeUI) + EVT_UPDATE_UI(wxID_ANY, SymbolView::OnUpdateUI) +END_EVENT_TABLE() + +void SymbolView::CreateGUIControls() +{ + wxBoxSizer *sz = new wxBoxSizer(wxVERTICAL); + SetSizer(sz); + + m_viewChoice = new wxChoice(this, wxID_ANY); + m_viewChoice->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(SymbolView::OnViewModeMouseDown), NULL, this); + ConnectChoice(m_viewChoice, SymbolView::OnViewTypeChanged); + m_viewChoice->Append(s_viewModeNames[m_viewMode]); + m_viewChoice->Select(m_viewMode); + sz->Add(m_viewChoice, 0, wxEXPAND|wxALL, 1); + + m_winStack = new WindowStack(this); + sz->Add(m_winStack, 1, wxEXPAND|wxALL, 1); + + wxToolBar *tb = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT|wxTB_HORIZONTAL); + tb->AddTool(XRCID("link_editor"), wxEmptyString, wxXmlResource::Get()->LoadBitmap(wxT("link_editor")), wxT("Link Editor"), wxITEM_CHECK); + tb->ToggleTool(XRCID("link_editor"), m_isLinkedToEditor); + tb->AddTool(XRCID("collapse_all"), wxEmptyString, wxXmlResource::Get()->LoadBitmap(wxT("collapse")), wxT("Collapse All"), wxITEM_NORMAL); + tb->AddTool(XRCID("gohome"), wxEmptyString, wxXmlResource::Get()->LoadBitmap(wxT("gohome")), wxEmptyString, wxITEM_NORMAL); + tb->Realize(); + sz->Add(tb, 0, wxEXPAND); + + sz->Layout(); +} + +void SymbolView::OnViewModeMouseDown(wxMouseEvent &event) +{ + if (ManagerST::Get()->IsWorkspaceOpen()) { + m_viewChoice->Freeze(); + m_viewChoice->Clear(); + m_viewChoice->Append(s_viewModeNames); + m_viewChoice->Select(m_viewMode); + m_viewChoice->Thaw(); + } + event.Skip(); +} + +void SymbolView::OnViewTypeChanged(wxCommandEvent &event) +{ + if (m_viewMode != event.GetSelection()) { + m_viewMode = event.GetSelection(); + DisplaySymbolTree(); + } + event.Skip(); +} + +SymbolTree *SymbolView::GetSymbolTree(const wxString &fileName) +{ + return dynamic_cast<CppSymbolTree*>(m_winStack->Find(fileName)); +} + +wxString SymbolView::GetSelected() +{ + SymbolTree *tree = dynamic_cast<CppSymbolTree*>(m_winStack->GetSelected()); + return tree ? tree->GetFilename().GetFullPath() : wxString(); +} + +void SymbolView::DisplaySymbolTree(const wxFileName &file_name, bool immediate) +{ + if (!ManagerST::Get()->IsWorkspaceOpen()) { + m_winStack->SelectNone(); + return; + } + + wxFileName fileName = file_name; + if (!fileName.IsOk()) { + // no name was given, so try to pick a reasonable default + LEditor *editor = ManagerST::Get()->GetActiveEditor(); + wxString project = ManagerST::Get()->GetActiveProjectName(); + wxString dummy; + + if (editor && editor->GetFileName().IsOk() && !editor->GetProject().IsEmpty()) + fileName = editor->GetFileName(); + else if (!project.IsEmpty()) + fileName = WorkspaceST::Get()->FindProjectByName(project, dummy)->GetFileName(); + else + fileName = WorkspaceST::Get()->GetWorkspaceFileName(); + } + + // now enforce user's view mode selection + if (m_viewMode == 2) { + // substitute workspace path + fileName = WorkspaceST::Get()->GetWorkspaceFileName(); + } else if (m_viewMode == 1) { + if (fileName == WorkspaceST::Get()->GetWorkspaceFileName()) { + m_winStack->SelectNone(); + return; + } + wxString projName = ManagerST::Get()->GetProjectNameByFile(fileName.GetFullPath()); + ProjectPtr project = !projName.IsEmpty() ? ManagerST::Get()->GetProject(projName) : ProjectPtr(); + if (project) { + // replace file path with file's project + fileName = project->GetFileName(); + } + } else { + if (!TagsManagerST::Get()->IsValidCtagsFile(fileName)) { + m_winStack->SelectNone(); + return; + } + } + + // get the symbol tree for the specified path (make if necessary) + SymbolTree *tree = GetSymbolTree(fileName.GetFullPath()); + if (tree == NULL) { + tree = new CppSymbolTree(m_winStack, wxID_ANY); + tree->SetSymbolsImages(CreateSymbolTreeImages()); + m_winStack->Add(tree, fileName.GetFullPath()); + } + + Freeze(); + + if (tree->IsEmpty() && (immediate || IsShown())) { + // tree neds to be built, so choose files to load tags from + std::vector<wxFileName> filesToLoad; + if (fileName == WorkspaceST::Get()->GetWorkspaceFileName()) { + // leave filesToLoad empty, which actually will load all files in WS + } else { + ProjectPtr project = ManagerST::Get()->GetProject(fileName.GetName()); + if (project && project->GetFileName() == fileName) { + // get all files in the project + project->GetFiles(filesToLoad, true); + } else if (TagsManagerST::Get()->IsValidCtagsFile(fileName)) { + // just use this file itself + filesToLoad.push_back(fileName); + } else { + Thaw(); + return; // invalid filename + } + } + tree->BuildTree(fileName, filesToLoad); + } else if (m_winStack->GetSelectedKey() == fileName.GetFullPath()) { + // this tree is already visible + Thaw(); + return; + } + + m_winStack->Select(fileName.GetFullPath()); + m_viewChoice->Clear(); + m_viewChoice->Append(s_viewModeNames[m_viewMode]); + m_viewChoice->Select(0); + + Thaw(); +} + +void SymbolView::DeleteSymbolTree(const wxFileName &filename) +{ + m_winStack->Delete(filename.GetFullPath()); +} + +void SymbolView::DeleteAllSymbolTrees() +{ + m_winStack->Clear(); +} + +void SymbolView::RefreshSymbolTree(const wxFileName& filename) +{ + Freeze(); + DeleteSymbolTree(filename); + DisplaySymbolTree(filename); + Thaw(); +} + +void SymbolView::OnAddSymbols(SymbolTreeEvent &event) +{ + wxString path = event.GetFileName(); + SymbolTree *tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->AddSymbols(event); + } + + wxString projectName = ManagerST::Get()->GetProjectNameByFile(path); + if (!projectName.IsEmpty()) { + ProjectPtr project = ManagerST::Get()->GetProject(projectName); + path = project->GetFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->AddSymbols(event); + } + } + + path = WorkspaceST::Get()->GetWorkspaceFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->AddSymbols(event); + } +} + +void SymbolView::OnDeleteSymbols(SymbolTreeEvent &event) +{ + wxString path = event.GetFileName(); + SymbolTree *tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->DeleteSymbols(event); + } + + wxString projectName = ManagerST::Get()->GetProjectNameByFile(path); + if (!projectName.IsEmpty()) { + ProjectPtr project = ManagerST::Get()->GetProject(projectName); + path = project->GetFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->DeleteSymbols(event); + } + } + + path = WorkspaceST::Get()->GetWorkspaceFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->DeleteSymbols(event); + } +} + +void SymbolView::OnUpdateSymbols(SymbolTreeEvent &event) +{ + wxString path = event.GetFileName(); + SymbolTree *tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->UpdateSymbols(event); + } + + wxString projectName = ManagerST::Get()->GetProjectNameByFile(path); + if (!projectName.IsEmpty()) { + ProjectPtr project = ManagerST::Get()->GetProject(projectName); + path = project->GetFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->UpdateSymbols(event); + } + } + + path = WorkspaceST::Get()->GetWorkspaceFileName().GetFullPath(); + tree = GetSymbolTree(path); + if (tree && !tree->IsEmpty()) { + tree->UpdateSymbols(event); + } +} + +void SymbolView::OnLinkEditor(wxCommandEvent &e) +{ + wxUnusedVar(e); + m_isLinkedToEditor = !m_isLinkedToEditor; + // save the value + EditorConfigST::Get()->SaveLongValue(wxT("LinkSymbolViewToEditor"), m_isLinkedToEditor ? 1 : 0); +} + +void SymbolView::OnCollapseAll(wxCommandEvent& event) +{ + SymbolTree *tree = dynamic_cast<SymbolTree*>(m_winStack->GetSelected()); + if (tree && !tree->IsEmpty()) { + tree->Freeze(); + tree->CollapseAll(); + tree->Expand(tree->GetRootItem()); + tree->Thaw(); + } +} + +void SymbolView::OnCollapseAllUI(wxUpdateUIEvent& event) +{ + SymbolTree *tree = dynamic_cast<SymbolTree*>(m_winStack->GetSelected()); + event.Enable(tree != NULL && !tree->IsEmpty()); +} + +void SymbolView::OnGoHome(wxCommandEvent& event) +{ + wxUnusedVar(event); +} + +void SymbolView::OnGoHomeUI(wxUpdateUIEvent& event) +{ + event.Enable(false); +} + +void SymbolView::OnUpdateUI(wxUpdateUIEvent& event) +{ + SymbolTree *tree = dynamic_cast<CppSymbolTree*>(m_winStack->GetSelected()); + if (tree && tree->IsEmpty()) { + DisplaySymbolTree(m_winStack->GetSelectedKey(), true); + } + event.Skip(); +} + Index: LiteEditor/symbolview.h =================================================================== --- LiteEditor/symbolview.h (revision 0) +++ LiteEditor/symbolview.h (revision 0) @@ -0,0 +1,80 @@ +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +// +// copyright : (C) 2008 by Eran Ifrah +// file name : symbolview.h +// +// ------------------------------------------------------------------------- +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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; either version 2 of the License, or +// (at your option) any later version. +// +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +#ifndef __symbolview__ +#define __symbolview__ + +#include <wx/panel.h> + +// forward decls +class WindowStack; +class SymbolTree; +class SymbolTreeEvent; + + +class SymbolView : public wxPanel { +private: + wxChoice *m_viewChoice; + int m_viewMode; + WindowStack *m_winStack; + bool m_isLinkedToEditor; + + void OnViewModeMouseDown(wxMouseEvent &event); + void OnViewTypeChanged(wxCommandEvent &event); + void OnLinkEditor(wxCommandEvent &e); + void OnCollapseAll(wxCommandEvent &event); + void OnCollapseAllUI(wxUpdateUIEvent &event); + void OnGoHome(wxCommandEvent &event); + void OnGoHomeUI(wxUpdateUIEvent &event); + void OnUpdateUI(wxUpdateUIEvent &event); + +protected: + void CreateGUIControls(); + + SymbolTree *GetSymbolTree(const wxString &fileName); + +public: + SymbolView(wxWindow *parent); + virtual ~SymbolView(); + + wxString GetSelected(); + + //handle symbol tree events + void OnAddSymbols(SymbolTreeEvent &event); + void OnDeleteSymbols(SymbolTreeEvent &event); + void OnUpdateSymbols(SymbolTreeEvent &event); + + void DisplaySymbolTree(const wxFileName &filename = wxFileName(), bool immediate = false); + void DeleteSymbolTree(const wxFileName &filename); + void DeleteAllSymbolTrees(); + + void RefreshSymbolTree(const wxFileName &filename); + + bool GetIsLinkedToEditor() const { return m_isLinkedToEditor; } + +private: + DECLARE_EVENT_TABLE() +}; + +#endif // __symbolview__ Index: LiteEditor/windowstack.cpp =================================================================== --- LiteEditor/windowstack.cpp (revision 2304) +++ LiteEditor/windowstack.cpp (working copy) @@ -26,7 +26,8 @@ WindowStack::WindowStack(wxWindow *parent, wxWindowID id) : wxPanel(parent, id) -, m_selection(NULL) +, m_selection(NULL) +, m_selectionKey(wxEmptyString) { m_mainSizer = new wxBoxSizer(wxVERTICAL); SetSizer(m_mainSizer); @@ -72,9 +73,21 @@ m_mainSizer->Add(win, 1, wxEXPAND); win->Show(); - m_selection = win; + m_selection = win; + m_selectionKey = key; m_mainSizer->Layout(); Thaw(); +} + +void WindowStack::SelectNone() +{ + if (m_selection) { + Freeze(); + m_mainSizer->Detach(m_selection); + m_selection->Hide(); + m_selectionKey.Empty(); + Thaw(); + } } void WindowStack::Clear() @@ -85,7 +98,8 @@ } m_mainSizer->Layout(); - m_selection = NULL; + m_selection = NULL; + m_selectionKey.Empty(); m_windows.clear(); } @@ -107,7 +121,8 @@ win->Hide(); //if the removed page was also the selection, unselect it if(win == m_selection){ - m_selection = NULL; + m_selection = NULL; + m_selectionKey.Empty(); } m_windows.erase(iter); win->Destroy(); Index: LiteEditor/windowstack.h =================================================================== --- LiteEditor/windowstack.h (revision 2304) +++ LiteEditor/windowstack.h (working copy) @@ -32,17 +32,22 @@ class WindowStack : public wxPanel { std::map<wxString, wxWindow*> m_windows; wxBoxSizer *m_mainSizer; - wxWindow *m_selection; + wxWindow *m_selection; + wxString m_selectionKey; public: WindowStack(wxWindow *parent, wxWindowID id = wxID_ANY); virtual ~WindowStack(); void Add(wxWindow *win, const wxString &key); - void Select(const wxString &key); + void Select(const wxString &key); + void SelectNone(); void Clear(); void Delete(const wxString &key); - wxWindow *Find(const wxString &key); + wxWindow *Find(const wxString &key); + + wxWindow *GetSelected() {return m_selection;} + wxString GetSelectedKey() const { return m_selectionKey; } }; #endif //WINDOWSTACK_H Index: LiteEditor/workspace_pane.cpp =================================================================== --- LiteEditor/workspace_pane.cpp (revision 2304) +++ LiteEditor/workspace_pane.cpp (working copy) @@ -30,11 +30,10 @@ #include "manager.h" #include "custom_notebook.h" #include "fileview.h" -#include "cpp_symbol_tree.h" #include <wx/xrc/xmlres.h> #include "frame.h" #include "checkdirtreectrl.h" -#include "windowstack.h" +#include "symbolview.h" #include "openwindowspanel.h" #include "macros.h" #include "fileexplorer.h" @@ -129,8 +128,8 @@ m_explorer = new FileExplorer(m_book, wxT("Explorer")); ADD_WORKSPACE_PAGE(m_explorer, WorkspacePane::EXPLORER); - m_winStack = new WindowStack(m_book, wxID_ANY); - ADD_WORKSPACE_PAGE(m_winStack, WorkspacePane::SYMBOL_VIEW); + m_symView = new SymbolView(m_book); + ADD_WORKSPACE_PAGE(m_symView, WorkspacePane::SYMBOL_VIEW); m_openWindowsPane = new OpenWindowsPanel(m_book); ADD_WORKSPACE_PAGE(m_openWindowsPane, WorkspacePane::OPEN_FILES); @@ -141,69 +140,21 @@ m_mgr->Update(); } -CppSymbolTree *WorkspacePane::GetTreeByFilename(const wxFileName &filename) -{ - wxWindow *win = m_winStack->Find(filename.GetFullPath()); - if (win) { - return dynamic_cast<CppSymbolTree *>(win); - } - return NULL; -} - -void WorkspacePane::BuildSymbolTree(const wxFileName &filename) -{ - CppSymbolTree *tree = GetTreeByFilename(filename); - if (!tree) { - tree = new CppSymbolTree(m_winStack, wxID_ANY); - tree->SetSymbolsImages(CreateSymbolTreeImages()); - m_winStack->Add(tree, filename.GetFullPath()); - m_winStack->Select(filename.GetFullPath()); - } - tree->BuildTree(filename); -} - void WorkspacePane::BuildFileTree() { m_workspaceTab->BuildFileTree(); } -SymbolTree *WorkspacePane::GetSymbolTree(const wxString &fileName) +FileViewTree* WorkspacePane::GetFileViewTree() { - // if fileName is not empty use it to find the tree - if (fileName.IsEmpty()) { - int id = Frame::Get()->GetNotebook()->GetSelection(); - if (id != wxNOT_FOUND) { - LEditor *editor = dynamic_cast<LEditor*>( Frame::Get()->GetNotebook()->GetPage((size_t)id)); - if (editor) { - return GetTreeByFilename(editor->GetFileName()); - } - } - } else { - return GetTreeByFilename(wxFileName(fileName)); - } - return NULL; + return m_workspaceTab->GetFileView(); } -void WorkspacePane::DisplaySymbolTree(const wxFileName &filename) +SymbolView* WorkspacePane::GetSymbolView() { - m_winStack->Select(filename.GetFullPath()); + return m_symView; } -void WorkspacePane::DeleteSymbolTree(const wxFileName &filename) -{ - m_winStack->Delete(filename.GetFullPath()); -} - -void WorkspacePane::DeleteAllSymbolTrees() -{ - m_winStack->Clear(); -} - -FileViewTree* WorkspacePane::GetFileViewTree() -{ - return m_workspaceTab->GetFileView(); -} - wxComboBox* WorkspacePane::GetConfigCombBox() { return m_workspaceConfig; Index: LiteEditor/workspace_pane.h =================================================================== --- LiteEditor/workspace_pane.h (revision 2304) +++ LiteEditor/workspace_pane.h (working copy) @@ -31,11 +31,9 @@ #include "wx/filename.h" class FileViewTree; -class SymbolTree; -class CppSymbolTree; -class WindowStack; class OpenWindowsPanel; class wxComboBox; +class SymbolView; class FileExplorer; class WorkspaceTab; class Notebook; @@ -51,7 +49,7 @@ Notebook *m_book; wxString m_caption; - WindowStack *m_winStack; + SymbolView *m_symView; OpenWindowsPanel *m_openWindowsPane; FileExplorer *m_explorer; WorkspaceTab *m_workspaceTab; @@ -60,7 +58,6 @@ private: void CreateGUIControls(); - CppSymbolTree *GetTreeByFilename(const wxFileName &filename); public: WorkspacePane(wxWindow *parent, const wxString &caption, wxAuiManager *mgr); @@ -69,11 +66,7 @@ //----------------------------------------------- // Operations //----------------------------------------------- - void BuildSymbolTree(const wxFileName &filename); void BuildFileTree(); - void DisplaySymbolTree(const wxFileName &filename); - void DeleteSymbolTree(const wxFileName &filename); - void DeleteAllSymbolTrees(); void CollpaseAll(); void OnConfigurationManager(wxCommandEvent &e); void OnConfigurationManagerUI(wxUpdateUIEvent &e); @@ -86,7 +79,7 @@ //----------------------------------------------- Notebook *GetNotebook() { return m_book; } - SymbolTree *GetSymbolTree(const wxString &fileName = wxEmptyString); + SymbolView *GetSymbolView(); FileViewTree *GetFileViewTree(); OpenWindowsPanel *GetOpenedWindows() {return m_openWindowsPane;} const wxString &GetCaption() const {return m_caption;} Index: LiteEditor/workspacetab.cpp =================================================================== --- LiteEditor/workspacetab.cpp (revision 2304) +++ LiteEditor/workspacetab.cpp (working copy) @@ -136,6 +136,10 @@ m_isLinkedToEditor = !m_isLinkedToEditor; // save the value EditorConfigST::Get()->SaveLongValue(wxT("LinkWorkspaceViewToEditor"), m_isLinkedToEditor ? 1 : 0); + if (m_isLinkedToEditor) { + wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, XRCID("show_in_workspace")); + Frame::Get()->AddPendingEvent(event); + } } void WorkspaceTab::OnGoHome(wxCommandEvent &e) Index: Runtime/rc/menu.xrc =================================================================== --- Runtime/rc/menu.xrc (revision 2304) +++ Runtime/rc/menu.xrc (working copy) @@ -523,6 +523,13 @@ <object class="wxMenuItem" name="save_file_as"> <label>Save As</label> </object> + <object class="wxMenuItem" name="wxID_SEPARATOR"/> + <object class="wxMenuItem" name="show_in_workspace"> + <label>Show In Workspace</label> + </object> + <object class="wxMenuItem" name="show_in_explorer"> + <label>Show In Explorer</label> + </object> <object class="wxMenuItem" name="wxID_SEPARATOR"/> <object class="wxMenuItem" name="copy_file_name"> <label>Copy Full Path to Clipboard</label> |
From: Rodrigo G. <rjg...@gm...> - 2008-10-16 15:37:16
|
This patch just move 10 items back or after current selected item when pressing page down or page up. The only "bad" thing is that 10 is a magic number, I don't know how to know how many items are shown in the listbox. Thanks Rodrigo Index: cc_box.cpp =================================================================== --- cc_box.cpp (revision 2294) +++ cc_box.cpp (working copy) @@ -209,6 +209,53 @@ } } +void CCBox::NextPage() + if (m_selectedItem != wxNOT_FOUND) { + if (m_selectedItem + 1 < m_listCtrl->GetItemCount()) { +#ifdef __WXMAC__ + // unselect current item + m_listCtrl->Select(m_selectedItem, false); +#endif + m_selectedItem += 10; + // select next item + SelectItem(m_selectedItem); + } else { +#ifdef __WXMAC__ + // unselect current item + m_listCtrl->Select(m_selectedItem, false); +#endif + m_selectedItem = m_listCtrl->GetItemCount() - 1; + // select next item + SelectItem(m_selectedItem); + } + } +} + +void CCBox::PreviousPage() +{ + if (m_selectedItem != wxNOT_FOUND) { + if (m_selectedItem - 10 >= 0) { +#ifdef __WXMAC__ + // unselect current item + m_listCtrl->Select(m_selectedItem, false); +#endif + m_selectedItem -= 10; + + // select previous item + SelectItem(m_selectedItem); + } else { +#ifdef __WXMAC__ + // unselect current item + m_listCtrl->Select(m_selectedItem, false); +#endif + m_selectedItem = 0; + + // select previous item + SelectItem(m_selectedItem); + } + } +} + void CCBox::SelectItem(long item) { m_listCtrl->Select(item); Index: cc_box.h =================================================================== --- cc_box.h (revision 2294) +++ cc_box.h (working copy) @@ -80,6 +80,8 @@ void SelectWord(const wxString &word); void Next(); void Previous(); + void NextPage(); + void PreviousPage(); //Setters void SetAutoHide(const bool& autoHide) { Index: cl_editor.cpp =================================================================== --- cl_editor.cpp (revision 2294) +++ cl_editor.cpp (working copy) @@ -1802,6 +1802,12 @@ case WXK_DOWN: m_ccBox->Next(); return; + case WXK_PAGEUP: + m_ccBox->PreviousPage(); + return; + case WXK_PAGEDOWN: + m_ccBox->NextPage(); + return; case WXK_BACK: { if (event.ControlDown()) { |