Author Topic: Multi File editing  (Read 75020 times)

tereshkosg

  • Guest
Multi File editing
« on: June 12, 2008, 07:57:54 pm »
Hi everyone,

First of all thanks to the developers for CodeBlocks IDE.

Is it possible to edit two files simultaneously ... basically place them next to each other. In other word split the view .. but with two different files?

Thanks

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #1 on: June 13, 2008, 08:53:46 am »
Is it possible to edit two files simultaneously ... basically place them next to each other. In other word split the view .. but with two different files?
A search in the forums would have revealed the answer, too... Hence I am giving it another time: No.
Split view does only work on the same file.
Hence if I really need another file for comparison I have setup C::B as a "tool" within the tools menu and provide the file I want to see as parameter. This will just open another (temporary) C::B session. Another options would be to use just "another" editor as tool, e.g. SciTE.
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

tereshkosg

  • Guest
Re: Multi File editing
« Reply #2 on: June 13, 2008, 02:39:49 pm »
I appologize if I have re-asked the "asked so many times" question.

  Do you know if it is planned to incorporate this feature in the IDE? I would strongly suggest that. This is something that so far Eclipse is ahead of C::B with. I have 1680x1050 screen resolution on my 22" Samsung Syncmaster and having one edit window in front of me is totally inefficient.

Besides that, great job!

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Multi File editing
« Reply #3 on: June 13, 2008, 04:05:50 pm »
You should use a smaller screen  :lol:

I agree this should be a great improvement.
You can try code snippets plugin or even ThreadSearch plugin to have 2 views on 2 different files at the same time but they don't provide an integrated C::B editor.

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #4 on: June 13, 2008, 05:04:48 pm »
Do you know if it is planned to incorporate this feature in the IDE?
I believe the only good way to do it is through a(ny kind of) layout manager. Thus if wxFlatNotebook would allow to detach tabs we are "done". I am not sure if probably wxAuiNotebook can do this... there was a patch IIRC somewhere in the patch tracker that tried to achieve this behaviour.
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 Alexis

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: Multi File editing - strongly agree...
« Reply #5 on: June 13, 2008, 05:35:41 pm »
... that it is an important feature C::B is lacking.

Visual Studio and Eclipse have it.

And I know C::B developpers are aware of it ; but it seems quite complicated to implement.

Anyway, thanks a lot to devs for their great work !

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #6 on: June 15, 2008, 03:18:32 pm »
I am not sure if probably wxAuiNotebook can do this... there was a patch IIRC somewhere in the patch tracker that tried to achieve this behaviour.
wxAuiNotebook can do this. However, I couldn't find the patch you were talking about. Therefore I wrote my one patch:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2495&group_id=5358

This patch replaces the wxFlatNotebook containing the open editors by wxAuiNotebook. This allows detaching the editor and dragging it at another position. That way it is possible to edit two different files at one.
This patch also removes the old editor splitting mechanism as it is no more required.

Small drawback: The style of the tabs looks different than the style of wxFlatNotebook and cannot be changed from the application (yet). I see two possible solutions here: Either change replace all occurences of wxFlatNotebook by wxAuiNotebook or provide a custon wxAuiTabArt that implements the necessary styles.

Edit:
One thing I forgot about: Some contrib plugins need changes when the patch mentioned above is applied. I don't want to file an extra ticket on berlios for this therefore I'm just posting the necessary changes here:
Code
Index: src/plugins/contrib/ThreadSearch/ThreadSearchThread.cpp
===================================================================
--- src/plugins/contrib/ThreadSearch/ThreadSearchThread.cpp (revision 5095)
+++ src/plugins/contrib/ThreadSearch/ThreadSearchThread.cpp (working copy)
@@ -20,7 +20,7 @@
  #include "configmanager.h"
 #endif
 
-#include <wx/wxFlatNotebook/wxFlatNotebook.h>
+#include <wx/aui/auibook.h>
 
 #include "ThreadSearchThread.h"
 #include "ThreadSearchEvent.h"
Index: src/plugins/contrib/wxSmith/wxsresource.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxsresource.cpp (revision 5095)
+++ src/plugins/contrib/wxSmith/wxsresource.cpp (working copy)
@@ -24,7 +24,7 @@
 #include "wxsextresmanager.h"
 #include "wxsresourcetreeitemdata.h"
 
-#include <wx/wxFlatNotebook/wxFlatNotebook.h>
+#include <wx/aui/auibook.h>
 #include <editormanager.h>
 
 namespace
Index: src/plugins/contrib/keybinder/cbkeybinder.cpp
===================================================================
--- src/plugins/contrib/keybinder/cbkeybinder.cpp (revision 5095)
+++ src/plugins/contrib/keybinder/cbkeybinder.cpp (working copy)
@@ -1002,25 +1002,14 @@
     {
         wxWindow* pWindow = (wxWindow*)(event.GetEventObject());
         cbEditor* ed = 0;
-        cbStyledTextCtrl* p_cbStyledTextCtrl = 0;
-        cbStyledTextCtrl* pLeftSplitWin = 0;
-        cbStyledTextCtrl* pRightSplitWin = 0;
         ed  = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
         if (ed)
-        {   p_cbStyledTextCtrl = ed->GetControl();
-            pLeftSplitWin = ed->GetLeftSplitViewControl();
-            pRightSplitWin = ed->GetRightSplitViewControl();
-            //Has this window been split?
+        {
             //**This is a temporary hack until some cbEvents are defined**
-            if ( pWindow && (pRightSplitWin == 0) )
-            {
-                //-if (pRightSplitWin eq pWindow)
-                //-{    Attach(pRightSplitWin);
-                if (pWindow->GetParent() == ed)
-                {   LOGIT( _T("OnWindowCreateEvent Attaching:%p"), pWindow );
-                    AttachEditor(pWindow);
-                }
-            }
+ if ( pWindow && pWindow->GetParent() == ed)
+ {   LOGIT( _T("OnWindowCreateEvent Attaching:%p"), pWindow );
+ AttachEditor(pWindow);
+ }
         }
     }//if m_bBound...
 
« Last Edit: June 15, 2008, 04:26:54 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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #7 on: June 16, 2008, 10:00:29 am »
I am not sure if probably wxAuiNotebook can do this... there was a patch IIRC somewhere in the patch tracker that tried to achieve this behaviour.
wxAuiNotebook can do this. However, I couldn't find the patch you were talking about. Therefore I wrote my one patch:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2495&group_id=5358
Wow... To be honest: I am speechless. I applied the patch and it just works. Very no... VERY nice work this is! Pretty cool!
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #8 on: June 16, 2008, 10:38:06 am »
I am not sure if probably wxAuiNotebook can do this... there was a patch IIRC somewhere in the patch tracker that tried to achieve this behaviour.
wxAuiNotebook can do this. However, I couldn't find the patch you were talking about. Therefore I wrote my one patch:
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=2495&group_id=5358
Wow... To be honest: I am speechless. I applied the patch and it just works. Very no... VERY nice work this is! Pretty cool!
Ok: here are some testing results:
- Opening files works (it opens them as another tab in the current active view)
- Searching / activating (in) files from a list works
- Different styles work (C++/XML for example)
- Undocking/Re-attaching works
- (Re-)Ordering tabs works
- Debugging across multiple files in different views / tabs work (cool!)
- Opening an already open file works (activates the right view/tab)
- Replacing in multiple file works (all files get "dirty")
- Saving all modified files works.
- (...continuing...)

Who is willing to test this under Linux?
« Last Edit: June 16, 2008, 10:40:08 am by MortenMacFly »
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 Alexis

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: Multi File editing
« Reply #9 on: June 16, 2008, 11:15:23 am »
Congratulations, guys, for this nice achievement.

mariocup

  • Guest
Re: Multi File editing
« Reply #10 on: June 16, 2008, 11:38:00 am »
Hi,

I tested the patch yesterday under windows and had the following problem working with BrowseTracker. If I switch between different files using ALT+right/left the selected file gets the focus but then the focus returns again to the current opened file. Can you reproduce this behaviour?

Thx,

Mario

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multi File editing
« Reply #11 on: June 16, 2008, 11:50:04 am »
I tested the patch yesterday under windows and had the following problem working with BrowseTracker.
I don't use this plugin but I compiled/installed it now.

It seems the "right" tab get's quickly activated but then the current active one is re-activated. However, for the first choice it works. Seems like a bug in BrowseTracker to me... I don't know this plugin... probably Pecan can have a look into?!
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 #12 on: June 16, 2008, 11:52:20 am »
Note that this problem does not appear on Linux.
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 Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Multi File editing
« Reply #13 on: June 16, 2008, 12:03:39 pm »
- Opening files works (it opens them as another tab in the current active view)
- Searching / activating (in) files from a list works
- Different styles work (C++/XML for example)
- Undocking/Re-attaching works
- (Re-)Ordering tabs works
- Debugging across multiple files in different views / tabs work (cool!)
- Opening an already open file works (activates the right view/tab)
- Replacing in multiple file works (all files get "dirty")
- Saving all modified files works.
- (...continuing...)

Who is willing to test this under Linux?
Just tested on Linux and all tests passed without problems.
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Multi File editing
« Reply #14 on: June 16, 2008, 01:23:21 pm »
I tested the patch yesterday under windows and had the following problem working with BrowseTracker.
I don't use this plugin but I compiled/installed it now.

It seems the "right" tab get's quickly activated but then the current active one is re-activated. However, for the first choice it works. Seems like a bug in BrowseTracker to me... I don't know this plugin... probably Pecan can have a look into?!

Acknowledged. I'm not in a position to test/debug right now, but will do so some time this week.