Author Topic: Notebook layout configuration (patch to test)  (Read 23656 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 .