News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Multi File editing

Started by tereshkosg, June 12, 2008, 07:57:54 PM

Previous topic - Next topic

tereshkosg

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

MortenMacFly

Quote from: tereshkosg on June 12, 2008, 07:57:54 PM
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

tereshkosg

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!

dje

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

MortenMacFly

Quote from: tereshkosg on June 13, 2008, 02:39:49 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alexis

... 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 !

Der Meister

#6
Quote from: MortenMacFly on June 13, 2008, 05:04:48 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:

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...

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.

MortenMacFly

Quote from: Der Meister on June 15, 2008, 03:18:32 PM
Quote from: MortenMacFly on June 13, 2008, 05:04:48 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
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

#8
Quote from: MortenMacFly on June 16, 2008, 10:00:29 AM
Quote from: Der Meister on June 15, 2008, 03:18:32 PM
Quote from: MortenMacFly on June 13, 2008, 05:04:48 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
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?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alexis

Congratulations, guys, for this nice achievement.

mariocup

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

MortenMacFly

Quote from: mariocup on June 16, 2008, 11:38:00 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Der Meister

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.

Der Meister

Quote from: MortenMacFly on June 16, 2008, 10:38:06 AM
- 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.

Pecan

Quote from: MortenMacFly on June 16, 2008, 11:50:04 AM
Quote from: mariocup on June 16, 2008, 11:38:00 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?!

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