Author Topic: Multi File editing  (Read 75028 times)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Multi File editing
« Reply #30 on: June 25, 2008, 08:02:10 pm »
I love the idea, but it's the Don who has the last word about it.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #31 on: June 25, 2008, 10:41:48 pm »
I clearly vote for it and I already had some discussions with "the Don" about it. It seems he is willing to accept. In the end it's a major new (cool) feature. I am already using it in daily work... ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

mariocup

  • Guest
Re: Multi File editing
« Reply #32 on: June 26, 2008, 08:09:18 am »
I would cleary vote for it. I am using it on my personal PC and it is a real benefit for me and if you are used to it you can't live without it. :D
I think that CB has so many users that a willing in testing, so if the feature is added, then it should be soon quite stable.

I suggest that we keep the split view feature, since sometimes it makes sense to see different parts of the same file, if a software module contains a lot of lines and navigating with bookmarks is to annoying.

I do not know if wxAuiNotebook support the following feature but if so we should think about it.

If you open the different files in multiple views it could be helpful to have a minimize button for the different views.

Bye,

Mario

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Multi File editing
« Reply #33 on: June 26, 2008, 08:54:07 am »
Before I put more effort into this I would like to ask the devs a question: Is this patch desired and will it be applied somewhere in the future? I know it won't be applied immediately because this patch implies big changes (MortenMacFly already named the issues) but I don't want to sacrifice a lot of work for it if no one is willing to apply it to the main codeline.

We were planning to move completely to wxAuiNotebook anyway (which would already be an API breaking change) so the answer is 'yes': when this patch reaches a mature state it will be applied to trunk.

Btw, there's a hack for this sort of thing already in trunk/src/src/app.cpp. At the very bottom of the file. That would be a nice place to start looking for this editor-focus problem (don't know, maybe it's the cause too, have a look).
« Last Edit: June 26, 2008, 08:56:49 am by mandrav »
Be patient!
This bug will be fixed soon...

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #34 on: June 27, 2008, 07:10:15 pm »
No, it's not the cause. And the Linux-hack doesn't do anything for me.

However, I found the cause for this focus bug: The problem is in EditorManager::SetActiveEditor. This function first gave the active editor the focus and then updated the selection of the notebook. But when changing the selected page wxAuiNotebook sets the focus to the tab of the selected page and therefore removes the focus from the editor. Changing the order of these two steps (e.g. first select the page and then set the focus to the editor) fixed this problem.

Edit: I just updated the patch to reflect the current status of my working copy
Already done/already working:
  • Completly replaced wxFlatNotebook with wxAuiNotebook
  • Splitting the notebook to allow editing of multiple files (already worked with the first version of the patch)
  • Focus bug should be solved
  • Splitting of an editor is possible again

What doesn't work yet/needs to be done:
  • Project files update
  • Saving the layout of the editors
  • Styling of the notebooks. Currently 'Settings->Environment->Notebook appearance' has just no effect.

The patch is quit big this time because I deleted the complete wxFlatNotebook sources and this is included in the diff and accounts for about 90% of the patch. Some contrib plugins need additional patches. Most of these patches are trivial, except for wxSmith.
« Last Edit: June 27, 2008, 08:22:49 pm by Der Meister »
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Re: Multi File editing
« Reply #35 on: June 27, 2008, 11:01:51 pm »
Sounds great. The layout saving might be a problem though, as far as I know wxAuiNotebook cannot do that. There is a patch on the Kirix forums about that though that was reported to work (I have applied it in my local wxWidgets copy, but haven't worked the functionality into my app yet).

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #36 on: June 27, 2008, 11:05:37 pm »
I haven't looked into this issue yet, but as I saw no obvious way for saving the layout I already feared that it might get tricky. However, patching wxWidgets is probably a no-go which means that if this is the only way for implementing this feature we would have to wait until wxWidgets officially provides an api for it.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #37 on: July 04, 2008, 09:30:48 am »
Ok - here are some testing results
1.) The patch does not work under Windows (it stops while trying to remove AUTHORS from wxFlatNotebook)
2.) wxContribItems is broken heavily afterwards because this relies on the wxFlatNotebook library
3.) same applies to lib_finder
4.) I had to exchange some includes with the wxAUI ones in addition to the ones in the patch (I only recall codesnippets atm).

Other that that... looks fine! ;-)
For the issues, including:
What doesn't work yet/needs to be done:
  • Project files update
  • Saving the layout of the editors
  • Styling of the notebooks. Currently 'Settings->Environment->Notebook appearance' has just no effect.

The "solutions" are:
Project files update I have done.
Saving layout and the styling of notebooks remains (IMHO styling we could just remove).
"1.)" I don't know how to resolve but that's not an issue as one of the devs will just do it right when committing... ;-)
"2.)" I resolved by putting wxFlatNotebook under wxContribItems and adding a target to the wxContribItems project file accordingly.
"3.)" I resolved "not so nice" by pointing to wxContribItems. Hence it should be resolved by exchanging the wxFlatNotebook with a "default" one in lib_finder (I don't see the need for a wxFlatNotebook there). Exchanging with wxAUI is not possible atm as lib_finder does it's GUI with wxSmith which does not support wxAUI (yet)... Byo!!! ;-) So this is a work-around anyways.
"4.)" is obviously done, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #38 on: July 04, 2008, 09:46:44 am »
1.) The patch does not work under Windows (it stops while trying to remove AUTHORS from wxFlatNotebook)
Well, the patch just removes these files therefore this shouldn't be a big problem.

2.) wxContribItems is broken heavily afterwards because this relies on the wxFlatNotebook library
Yes, wxSmith might need its own copy of wxFlatNotebook to work with this patch.


Saving layout and the styling of notebooks remains (IMHO styling we could just remove).
I wouldn't remove the sytling. I think most of it can be implemented as wxAuiNotebook gives you almost complete control over drawing the tabs. The styles used with wxFlatNotebooks should be possible to implement (possibly with borrowing some code from wxFlatNotebook ;) ). Maybe the gradient colors should be removed as wxAuiNotebook automatically grabs the wxAUI colors. The smart-tab option is also useless and I already removed it from my working copy. The option regarding the list or scroll buttons works in my working copy, too.

I will try to implement the styles and then provide another version of the patch. But this may take some time as I'm quite busy working on my diploma thesis and therefore only work on this patch in some little spare time. So don't expect an update in the next few days ;)
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: Multi File editing
« Reply #39 on: July 07, 2008, 12:41:31 am »
Hi all.

I've found some bug with tabs drawing. If switch tabs appear at top/bottom then tab line is drawn twice. The doubled wrong tab line is drown above text window (if at top) or scroll bar (if at bottom)

I have compiled a revision 5109 from trunk with dermeister's patch updated at the 27th of July applyed. It has been compiled for Windows with mingw (gcc 3.4.2)

PS: Thank you for the work, is seems perfect!

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #40 on: July 22, 2008, 06:24:39 pm »
After a long period of silence I updated the patch again. It should apply to the current svn revision. The main thing that changed compared to the last update is that styling of the tabs is possible again (at least to some extend). This means that the page in the enviroment settings dialog is working again, however I removed large parts of the original dialog. Maybe the remaining elements should be merged with some other page in that dialog.

This version of the patch provides three different styles for tabs: The two provided by wxWidgets (Default and Simple) and a Visual Studio 2003 like style. I wrote the rendering class for the last one based on the code of wxDefaultArtProvider and the renderer included in wxFlatNotebook. It's not perfect but working and the main reason for including this was to show how new styles can be added. Little drawback: Due to a bug in wxWidgets changing the art provider for the tabs only works if the height of the tabs differes between the current and the new art provider. I already reported this in the bug tracker for wxWidgets but got no reaction yet.

What still doesn't work yet/needs to be done:
  • Testing, especially on Windows (patch was developed on Linux)
  • Project files update
  • Saving the layout of the editors (Doesn't seem to be possible yet without serious hacking/rewriting of wxAuiNotebook.)
  • There were some additional feature requests and comments. Maybe some of the should get some attention
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #41 on: July 22, 2008, 07:58:19 pm »
After a long period of silence I updated the patch again.
...nice! :-) Just compiling...

  • Testing, especially on Windows (patch was developed on Linux)
I do test it in everyday use on Windows XP and Vista. If I don't report any issues - all is fine (for me)... so at least 4 eyes see more than 2.

  • Project files update
Don't worry about this - I have done it in my local copy already. In addition some (newer) plugins required modification, too, which I did (e.g. code snippets).

I have in mind to introduce this wxAUI version of C::B at work, soon. So most likely we get some more feedback. For me (again) it's just working great.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #42 on: July 27, 2008, 04:34:24 pm »
I just updated the patch again. The only thing I changed was to fix a regression introduced with one of the last updates (moving a tab around wasn't possible any more).

Currently the patch is in a state where I would say it is feature complete. There were some additional feature requests but not all of them would be really helpfull and for most of them the implementation would be at least very difficult with the current implementation of wxAuiNotebook. For example saving and loading the layout isn't possible yet but as far as I know this is already a feature request in their bug tracker.

So, please go on and test this patch and drop me a note if there are problems. If no issues should be discovered I would like to see this patch applied rather soon because it touches a lot of different files and keeping it in sync with the current trunk for a long time is some tedious work. However, the plugin developer should also have a look at the patch because some plugins need to be changed because they used the wxFlatNotebook implementation of Code::Blocks. The patch already includes the necessary changes for the core plugins but some contrib plugins are affected, too. But most of these changes should be rather trivial.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: Multi File editing
« Reply #43 on: July 29, 2008, 12:43:19 am »
I've created a small patch for some contrib plugins. It simply replaces wxFlatNotebook with wxAuiNotebook.
Quote
Index: BrowseTracker/BrowseSelector.h
===================================================================
--- BrowseTracker/BrowseSelector.h   (revision 5170)
+++ BrowseTracker/BrowseSelector.h   (working copy)
@@ -26,7 +26,7 @@
 #include <wx/bitmap.h>
 
 class wxListBox;
-class wxFlatNotebook;
+class wxAuiNotebook;
 class wxPanel;
 
 // ----------------------------------------------------------------------------
Index: BrowseTracker/BrowseTracker.h
===================================================================
--- BrowseTracker/BrowseTracker.h   (revision 5170)
+++ BrowseTracker/BrowseTracker.h   (working copy)
@@ -33,7 +33,7 @@
 class ProjectData;
 class BrowseMarks;
 class cbStyledTextCtrl;
-class wxFlatNotebookEvent;
+class wxAuiNotebookEvent;
 
 // ----------------------------------------------------------------------------
 // The following have been moved to BrowseTrackerDefs.h
@@ -215,7 +215,7 @@
         void OnProjectLoadingHook(cbProject* project, TiXmlElement* elem, bool loading);
 
         void OnStartShutdown(CodeBlocksEvent& event);
-        void OnPageChanged(wxFlatNotebookEvent& event);
+        void OnPageChanged(wxAuiNotebookEvent& event);
 
         void OnMenuBrowseMarkPrevious(wxCommandEvent& event);
         void OnMenuBrowseMarkNext(wxCommandEvent& event);
Index: headerfixup/defaults.cpp
===================================================================
--- headerfixup/defaults.cpp   (revision 5170)
+++ headerfixup/defaults.cpp   (working copy)
@@ -153,7 +153,7 @@
   AddBinding(_T("CodeBlocks"),_T("GetLogManager"),                _T("logmanager.h"));
   AddBinding(_T("CodeBlocks"),_T("GetMacrosManager"),             _T("macrosmanager.h"));
   AddBinding(_T("CodeBlocks"),_T("GetMessageManager"),            _T("messagemanager.h"));
-  AddBinding(_T("CodeBlocks"),_T("GetNotebook"),                  _T("wx/wxFlatNotebook/wxFlatNotebook.h"));
+  AddBinding(_T("CodeBlocks"),_T("GetNotebook"),                  _T("wx/aui/auibook.h"));
   AddBinding(_T("CodeBlocks"),_T("GetParentProject"),             _T("cbproject.h"));
   AddBinding(_T("CodeBlocks"),_T("GetPersonalityManager"),        _T("personalitymanager.h"));
   AddBinding(_T("CodeBlocks"),_T("GetPlatformsFromString"),       _T("globals.h"));
Index: ThreadSearch/ThreadSearchThread.cpp
===================================================================
--- ThreadSearch/ThreadSearchThread.cpp   (revision 5170)
+++ ThreadSearch/ThreadSearchThread.cpp   (working copy)
@@ -21,7 +21,7 @@
    #include "projectbuildtarget.h"
 #endif
 
-#include <wx/wxFlatNotebook/wxFlatNotebook.h>
+#include <wx/aui/auibook.h>
 
 #include "ThreadSearchThread.h"
 #include "ThreadSearchEvent.h"

As minimum it enables the ThreadSearch plugin.
The BrowseTracker plugin is compiled successfully but failed to start with the next messages:

Quote
02:11:32: BrowseTracker Plugin Logging Started[1.2.74 2008/03/15]
02:11:32: Argv[0][C:\proj\CB\work\src\output\codeblocks.exe] Cwd[C:\proj\CB\work\src\output]
02:11:32: FindAppPath: AbsolutePath[C:\proj\CB\work\src\output]
02:11:32: CfgFolder[C:\Documents and Settings\lexis\Application Data\codeblocks]
02:11:32: ExecFolder[C:\proj\CB\work\src\output]
02:11:32: TrackerCfgFullPath[C:\Documents and Settings\lexis\Application Data\codeblocks\BrowseTracker.ini]
02:11:32: Menubar[0153F008]idMenuViewTracker[953]
02:11:35: Error: Execution of command 'pkg-config --version' failed (error 2: .... .)
02:11:35: Error: Can not enumerate files in directory 'C:\proj\CB\work\src\output/share/codeblocks\lib_finder/predefined' (error 3: .... .)
02:11:35: Error: Can not enumerate files in directory 'C:\Documents and Settings\lexis\Application Data\codeblocks/share/codeblocks\lib_finder/predefined' (error 3: .... .)
Please note: I've replaced real system messages descriptions with dots since it was in Russian at my system...

I've prepaired the patch above an SVN revision 5170 with Der Meister's patch.
It have to be applied to src/plugins/contrib/ dir!

The patch completely skips the Codesnippets, wxSmith (and ContribItems), lib_finder plugins...
« Last Edit: July 29, 2008, 06:04:50 pm by lexis »

Offline lexis

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: Multi File editing
« Reply #44 on: July 29, 2008, 05:03:10 pm »
You need to compile contrib plugins to use my patch. And you need to apply it over an src/plugins/contrib/ dir.

The patch just replaces wxFlatNotebook related identificators and headers with wxAuiNotebook related ones in ThreadSearch and BrowseTracker plugins.
The Der Meister's patch fixes core CB sources, not contrib plugins.

The ThreadSearch plugin should fail to compile without my patch. Since I use it very often I prepaired the patch for it.

PS: I use WinXP as well

Edit:
As I understand the post I've replied is already removed. But the comments may be useful for some else
« Last Edit: July 29, 2008, 05:12:52 pm by lexis »