Author Topic: Notebook layout configuration (patch to test)  (Read 23652 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Notebook layout configuration (patch to test)
« on: March 25, 2014, 12:14:43 am »
After this discussion (http://forums.codeblocks.org/index.php/topic,19067.msg130499.html#msg130499) I started to think about this feature again.
And it looks like I found a solution.

I attach a patch that automatically saves the notebook layout in the project and workspace layout files.

Any tests, comments etc are welcome.

EDIT:
Incorrect patch removed, see next post.
new patch in http://forums.codeblocks.org/index.php/topic,19100.msg130737.html#msg130737

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:28:28 am by jens »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #1 on: March 25, 2014, 07:40:08 am »
Updated patch attached.
The former one was missing two lines, must have get lost when cleaning the code from debug messages.

Sorry !

The new patch also has tiny wx30 fixes.

You have to remove the old one and apply the new.

EDIT:
Tiny changes in a ew patch in: http://forums.codeblocks.org/index.php/topic,19100.msg130737.html#msg130737

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:28:14 am by jens »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #2 on: March 26, 2014, 07:19:47 am »
Another new patch, no real functional change.
But it makes sure the active tab of a control gets restored correctly (Split() always sets it to 0).

EDIT:
new patch with fixes for NOPCH build is attached here.

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:28:00 am by jens »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Notebook layout configuration (patch to test)
« Reply #3 on: March 26, 2014, 10:25:47 am »
Please fix the nopch build, too:

Code
In file included from cbproject.cpp:46:0:
../../src/include/projectlayoutloader.h: In member function ‘bool ProjectLayoutLoader::LoadNotebookLayout()’:
../../src/include/projectlayoutloader.h:22:91: error: invalid use of incomplete type ‘class cbAuiNotebook’
In file included from ../../src/include/cbproject.h:19:0,
                 from cbproject.cpp:24:
../../src/include/projectmanager.h:29:7: error: forward declaration of ‘class cbAuiNotebook’
Makefile:961: recipe for target 'cbproject.lo' failed
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #4 on: March 26, 2014, 11:01:58 am »
Please fix the nopch build, too:

This evening, if I'm back from work.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #5 on: March 26, 2014, 10:26:25 pm »
Please fix the nopch build, too:

This evening, if I'm back from work.
New patch atttached.
No changes except the NOPCH fixes.

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:27:43 am by jens »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Notebook layout configuration (patch to test)
« Reply #6 on: March 26, 2014, 10:36:01 pm »
Building... I'll report if I see any problems...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Notebook layout configuration (patch to test)
« Reply #7 on: March 27, 2014, 01:28:40 am »
I've got this crash. It happened after I've quickly closed some files just after I've opened a workspace with many test projects.
Code
#42 0x00007f1ccb1370ac in wxFatalSignalHandler () at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/unix/utilsunx.cpp:1109
#43 <signal handler called>
#44 0x00007f1c9ff3a800 in CodeCompletion::OnEditorClosed (this=0x1bc5c10, event=...) at codecompletion.cpp:2432
#45 0x00007f1cccadcae9 in Manager::ProcessEvent (this=<optimized out>, event=...) at manager.cpp:261
#46 0x00007f1cccae90e2 in PluginManager::NotifyPlugins (this=<optimized out>, event=...) at pluginmanager.cpp:1445
#47 0x00007f1ccca9f9f1 in EditorBase::~EditorBase (this=0x5abfc70, __in_chrg=<optimized out>) at editorbase.cpp:133
#48 0x00007f1ccca34131 in cbEditor::~cbEditor (this=0x5abfc70, __in_chrg=<optimized out>) at cbeditor.cpp:728
#49 0x00007f1ccb8a9c0f in wxWindowBase::Destroy (this=<optimized out>) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/wincmn.cpp:415
#50 0x00007f1ccc665467 in wxAuiNotebook::DeletePage (this=this@entry=0x1086ff0, page_idx=page_idx@entry=0) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/aui/auibook.cpp:3302
#51 0x00007f1ccca28928 in cbAuiNotebook::DeletePage (this=0x1086ff0, page=page@entry=0) at cbauibook.cpp:492
#52 0x00007f1cccaadc15 in EditorManager::Close (this=0x96dde0, editor=0x5abfc70, dontsave=dontsave@entry=false) at editormanager.cpp:646
#53 0x00007f1cccaadee3 in EditorManager::CloseActive (this=<optimized out>, dontsave=dontsave@entry=false) at editormanager.cpp:607
#54 0x0000000000492a93 in MainFrame::OnFileClose (this=0x168f920, event=...) at main.cpp:2642
#55 0x00007f1ccb133dfe in ProcessEventIfMatches (event=..., handler=<optimized out>, entry=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1239
#56 wxEvtHandler::ProcessEventIfMatches (entry=..., handler=<optimized out>, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1214
#57 0x00007f1ccb133f7c in wxEventHashTable::HandleEvent (this=<optimized out>, event=..., self=self@entry=0x168f920) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:906
#58 0x00007f1ccb134297 in ProcessEvent (event=..., this=0x168f920) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1301
#59 wxEvtHandler::ProcessEvent (this=0x168f920, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1272
#60 0x00007f1ccb134220 in ProcessEvent (event=..., this=0x168fc20) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1308
#61 wxEvtHandler::ProcessEvent (this=0x168fc20, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1272
#62 0x00007f1ccb134220 in ProcessEvent (event=..., this=0xf6b928) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1308
#63 wxEvtHandler::ProcessEvent (this=0xf6b928, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1272
#64 0x00007f1ccb134220 in ProcessEvent (event=..., this=0xf666c0) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1308
#65 wxEvtHandler::ProcessEvent (this=0xf666c0, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1272
#66 0x00007f1ccb134220 in ProcessEvent (event=..., this=0x100a900) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1308
#67 wxEvtHandler::ProcessEvent (this=0x100a900, event=...) at /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r1/work/wxPython-src-2.8.12.1/src/common/event.cpp:1272
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #9 on: March 27, 2014, 07:22:10 am »
Can you try this workspaces: http://cmpt.benbmp.org/codeblocks/test_projects/workspace_crashs.tar.bz2
The crash is confirmed-
The cause is that the caption is not enough to distinguish between the tabs (obviously) if it's the same, so rebuilding the pane layout is broken, even if not closing any of the tabs.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #10 on: March 27, 2014, 08:04:13 am »
Can you try this workspaces: http://cmpt.benbmp.org/codeblocks/test_projects/workspace_crashs.tar.bz2
The crash is confirmed-
The cause is that the caption is not enough to distinguish between the tabs (obviously) if it's the same, so rebuilding the pane layout is broken, even if not closing any of the tabs.

Attached is a quick patch that should work unless the project/workspace path did not move.
If it has moved we run in trouble again, but that should also be fixable.
I will look into it this evening (hopefully).


EDIT:
New patch in next post.
Unfortunately the patch does not work with layout files created by the previous patch(es), so the layout files have to be cleared manually, saved with an unpatched C::B or removed.
Sorry.
« Last Edit: March 29, 2014, 01:19:25 pm by jens »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #11 on: March 29, 2014, 01:18:54 pm »
And another one.
Should work if the project gets moved around, because it uses relative pathnames and projectname as unique identifier.
This will still fail, if two projects in one workspace have the same name and files with the same name and relative path opened.

And if a new project gets opened in an already opened workspace the actual layout will be destroyed.

Catching the first issue is not easy, the second one should be easier to fix (hopefully).

For the first one, we could of course use some kind of hash (e.g. md5), but this might slow down loading, and it will (of course) not work, if files get changed from outside, which happens often in with vcs and it will still not work if two projects share the same file.

EDIT:

Just changed the patch, to one that works with newest wx-svn.

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:27:21 am by jens »

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Notebook layout configuration (patch to test)
« Reply #12 on: May 24, 2014, 12:25:12 pm »
@jens
I just tried this patch on svn9778, with the configuration described below.
Unfortunately it does not give the expected result.
I tried with and without plugin and the result is the same.
The first picture: two windows. The second image after reopening.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #13 on: May 24, 2014, 04:08:46 pm »
@jens
I just tried this patch on svn9778, with the configuration described below.
Unfortunately it does not give the expected result.
I tried with and without plugin and the result is the same.
The first picture: two windows. The second image after reopening.
The patch should already work.
Nevertheless here comes a neweer version that tries to take care of newly loaded projects, so the perspectives of both layout-files get merged together.
All this will probably not longer work with the upcoming dynamic-aui, which will probably be merged before wx3.1.
The new aui also breaks a lot other stuff in our class derived from wxAuibook, but  have fixes for almost any problems with the dynamic aui-branch in my local repo.

EDIT:
actual patch in http://forums.codeblocks.org/index.php/topic,19100.msg133926.html#msg133926
« Last Edit: September 05, 2014, 10:27:02 am by jens »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #14 on: May 24, 2014, 04:09:43 pm »
If it still does not work try to remove the *.layout-files and if it still does not work, it would be great if you could send me your default.conf .

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Notebook layout configuration (patch to test)
« Reply #15 on: May 24, 2014, 07:08:35 pm »
@jens
1-I deleted all the configuration files(after backup).
2-I opened 'C::B' svn9778 with patch 'save_tab_layout_viii.patch'
3-I selected   'Settings->Environment->Open default workspace'
4-I loaded 'CodeBlocks.cbp' svn9778
5-I opened two windows files
6-I closed 'C::B'
7-I re-opened'C::B' -> one window!

I attach the 'config.7z' obtained.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #16 on: May 24, 2014, 08:50:24 pm »
I never used the default-workspace to save real projects.
I can confirm, that it does not work as you do it.
Can you try it with  "Settings->Environment->Open blank workspace" and open the project directly or use a "real" workspace ?

At the moment I do not have the power to work on the default workspace stuff.

I'm even not sure if I will be able to build a new nightly this weekend, too much work the last weeks, too much private stuff that takes precedence, sorry.


Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Notebook layout configuration (patch to test)
« Reply #17 on: May 24, 2014, 11:21:24 pm »
Thank you very much Jens.

1-I've renamed the workspace by another name and open more windows, then closed and reopened, it looks ok, except that you select a file in the handler for either correct (multiple windows)

2-By the way you explain it works fine.

Instead, make your work and when you have time ...

This does not prevent me from using 'C::B'.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Notebook layout configuration (patch to test)
« Reply #18 on: June 24, 2014, 05:38:40 pm »
Just for the record: While I really like the idea it also somehow screws the start_here page. The effect is, when I start C::B I see only one editor tab with the title "start_here" (not the start here page!) and when I close this tab all the other tabs left opened last time "come back". At that point the layout is OK.
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: Notebook layout configuration (patch to test)
« Reply #19 on: June 24, 2014, 05:46:03 pm »
...to visualise what I mean I've attached an image:
This is what happens if I start C::B:
- the start here page is shown
- I open a project that had two open editor windows when closing
- environment settings are "open last open files" (on project load)
- I cannot click the "x" symbol
- the layout looks screwed (notice the left border of the start here page)
- if I close the window (via CTRL+F4) I see the actual 2 editor tabs just fine.

I guess that the start here page is being drawn after the editor layout has been restored on top of these - or the other way round the editor position does not account for the start here page and just draws above it... the latter is more likely.
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 LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Notebook layout configuration (patch to test)
« Reply #20 on: August 20, 2014, 09:36:04 am »
Hello,
with svn 9855 everything is correct.
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Notebook layout configuration (patch to test)
« Reply #21 on: August 20, 2014, 08:41:08 pm »
Some questions:
1. I see no versioning in the file, wouldn't be a good idea to introduce one?
2. I guess the patches posted here modify the EditorTabsLayout, can this be made a bit more user-readable?
3. Is it safe to upgrade from an older version of the patch to the latest?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Notebook layout configuration (patch to test)
« Reply #22 on: September 05, 2014, 09:00:05 am »
Version 8 of the patch doesn't apply anymore :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #23 on: September 05, 2014, 10:25:51 am »
Version 8 of the patch doesn't apply anymore :(
New patch attached.
Still no versioning for the layout files, so old layout-files might lead to layout-issues and/or crashes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Notebook layout configuration (patch to test)
« Reply #24 on: October 12, 2014, 12:20:53 pm »
I just committed ths and some other changes (read-only icon) to sf (svn r9940 - 9949) in the hope it does not break anything.
Please test and report back.
For large workspaces you might need to hide the annoying dialog about project layoutfile versioning, when first opening an existing workspacce (or delete the *.layout files before).