Code::Blocks Forums

User forums => Help => Topic started by: Souliest on June 11, 2014, 11:04:22 pm

Title: Build target window not resizing correctly.
Post by: Souliest on June 11, 2014, 11:04:22 pm
Hi,

I'm not sure if this is a bug, or a feature that doesn't behave like I expect it to, but here goes.

I'm using C::B to follow along a book, which generates many small programs. I found that using a build target per exercise makes it easy to manage. It's less "wasteful" than using a project each time, yet more structured than using standalones sources, without project.

Here is the issue. The first screenshot shows the Project->Properties->Build targets window of a new "Hello World" type project, with two targets. Everything is normal. The second screenshot shows the same window, split in two (because it won't fit in a single screen), with a project that has nearly one hundred targets, and roughly the same amount of files.

Here is the behavior that I would have expected: when you add targets, the "Build targets" list should add scrollbars as needed, at least a vertical scrollbar and increased width to accomodate the target names. The window as a whole should pretty much retain the same height.

What happens, however, is that that the build targets list increases in height so as to maintain about 20 empty lines at the end, and never gets scrollbars. The complete window (for all the tabs) increases in height, which adds a scrollbar to the window. This is both unsightly and inefficient. For example, look at the three button clusters to the right of the list ("Add / Rename / Duplicate / Delete", "Virtual targets / Dependencies / Re-order / Build options", and "Create project from target"). The clusters were obviously meant to be placed one at the top, one in the middle and one at the bottom of the list area.With a small list (screen 1), this is perfectly okay. With a large list (screens 2 and 3), the clusters have a huge gap between them. Also, when setting a few new targets I have to scroll up to duplicate a target or create a new one, scroll down to select it and maybe reorder it, scroll up to set the new executable, scroll down to check or uncheck the included files. The problem is that I scroll the whole window, when I should (that's what I think, anyway) only have to scroll within the targets and within the files.

I'm fairly new at this, so I apologize if my terminology is confusing. Please tell me if it is, so I can learn. And is this a bug? Should I report it?

Thanks.

Edit: CB 13.12 rev.9501, wxWidgets 2.8.12, OS Windows 7 64-bit


[attachment deleted by admin]

[attachment deleted by admin]
Title: Re: Build target window not resizing correctly.
Post by: Souliest on June 29, 2014, 11:49:29 pm
Okay, I hate to do this, but... bump.

Almost three weeks without any input. It is either because nobody understands what on Earth I'm talking about, nobody is able to replicate it, or nobody cares.

Which is it? If it's the first option, tell me so I can provide details or simplification, as needed. In the case of the second option, how does it impact what I should do, or is it a behavior I can change myself. And in the case of the third option, well... whatever.

Any response would be appreciated.
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on June 30, 2014, 12:39:42 am
It works for me correctly; I suggest posting the normal info like CB version/svn, wxWidgets version, and OS name and version.

Edit: It worked correctly while adding the targets; once I closed the form and reentered it the effect was much like the complaint above.

Edit 2: Self built recent CB SVN trunk; wxWidgets 2.8.12; OS Windows 7 32-bit

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: Souliest on June 30, 2014, 07:32:00 am
Thank you Tim. It is comforting to know than I am not crazy/alone. And I updated my post with the requested info. I hadn't even thought of including those.

I am using Windows 7 64-bit, with CB 13.12 (the Win binary from codeblocks.org), with wxWidgets 2.8.12.

S.
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on June 30, 2014, 04:31:37 pm
If you self build Code::Blocks here is a patch to try.

The patch may NOT be safe to apply to CB SVN Truck
Because I edited the project_options.xrc file using text editor (I could not find the correct GUI method to edit it).
Because I am at beginner level at using wxWidgets GUI stuff like xrc and sizer.
Because the value of <size>120,360</size> was chosen almost at random; looks OK on Windows; no idea on other OSes.

Tim S.

Code
Index: src/src/resources/project_options.xrc
===================================================================
--- src/src/resources/project_options.xrc (revision 9841)
+++ src/src/resources/project_options.xrc (working copy)
@@ -255,8 +255,11 @@
  <object class="sizeritem">
  <object class="wxBoxSizer">
  <object class="sizeritem">
- <object class="wxListBox" name="lstBuildTarget" />
- <flag>wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+ <object class="wxListBox" name="lstBuildTarget">
+ <size>120,360</size>
+ <style>wxLB_HSCROLL</style>
+ </object>
+ <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
  </object>
  <object class="sizeritem">
  <object class="wxBoxSizer">
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on June 30, 2014, 05:24:22 pm
Directions to manually fix Windows CB version 13.12.

1. Must make sure CB is NOT running
2. Rename share/CodeBlocks/resources.zip to something like resources.zip.orig
3. Download patched resources.zip https://github.com/stahta01/cb_misc/raw/master/CB_13_12/share/CodeBlocks/resources.zip (https://github.com/stahta01/cb_misc/raw/master/CB_13_12/share/CodeBlocks/resources.zip)
4. Copy downloaded resources.zip to share/CodeBlocks/

Note: share/CodeBlocks is normally under the folder C:\Program Files\CodeBlocks on windows.

Tim S.

Title: Re:
Post by: MortenMacFly on June 30, 2014, 06:42:37 pm
Lol. You can edit xrc files with wxSmith. It looks like a good catch but the patch looks weird... Are you sure that is correct?
Title: Re:
Post by: stahta01 on June 30, 2014, 07:27:13 pm
Lol. You can edit xrc files with wxSmith. It looks like a good catch but the patch looks weird... Are you sure that is correct?

No, I am NOT sure it is correct; the changes are result of trial and error.
It does work better on windows; but, I think there must be a better fix than the one I found.

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on June 30, 2014, 10:09:33 pm
Can someone show a screen shot of this same dialog but from the C::B project.
On linux I can see that there is a vertical scroll as expected.
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 01, 2014, 12:55:58 am
Can someone show a screen shot of this same dialog but from the C::B project.
On linux I can see that there is a vertical scroll as expected.

On Windows 7 32 bit without any changes.
Link to image: http://github.com/stahta01/cb_misc/blob/master/Notes/Without_changes.png (http://github.com/stahta01/cb_misc/blob/master/Notes/Without_changes.png)

On Windows 7 32 bit with my change.
Link to image: http://github.com/stahta01/cb_misc/blob/master/Notes/With_TimS_change.png (http://github.com/stahta01/cb_misc/blob/master/Notes/With_TimS_change.png)

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 01, 2014, 01:40:34 am
Hm, you're using smaller font and all targets are visible. This is not the case for me.

Can someone share a test project?

BTW: Your fix is inappropriate.
Title: Re: Build target window not resizing correctly.
Post by: Jenna on July 01, 2014, 06:33:38 am
Hm, you're using smaller font and all targets are visible. This is not the case for me.

Can someone share a test project?

BTW: Your fix is inappropriate.
I attach a sample project-file with 52 targets.
It has a scrollbar on linux, but it shows a similar issue:the list-control is much too  large.
I did not try to do any further tests.
I guess the problem is, that we do a dynamic layout after the list-control is populated.
If there are very long target names, it's the same, but in horizontal direction.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 01, 2014, 10:04:33 am
Reproduced. I've even modified it to include a long target name.

By dynamic layout you're probably talking about this snippet:
Code
    // make sure everything is laid out properly
    // before adding panels from plugins
    // we don't want the dialog to become huge ;)
    // note that a similar situation in editor settings had been solved by commenting
    // the following line out...
    GetSizer()->SetSizeHints(this);
I've commented it and it fixed only the first problem. It didn't fix the very-long-named-target problem.
I've taken a look here http://docs.wxwidgets.org/trunk/classwx_list_box.html and it seems there are problems with the ListBox control.
Have we tried to use a wxListCtrl instead?
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 02, 2014, 01:18:46 am
I've just tried the wxListCtrl and it behaves pretty good.

Please test if the layout is correct with this test patch on windows: http://cmpt.benbmp.org/codeblocks/patches/project_options_layout_many_target.patch

NOTE: This patch is not meant for production use, it is meant to test the layout only. The dialog is totally broken, because I've not fixed all usages of the wxListBox!
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 02, 2014, 02:31:55 am
I've just tried the wxListCtrl and it behaves pretty good.

Please test if the layout is correct with this test patch on windows: http://cmpt.benbmp.org/codeblocks/patches/project_options_layout_many_target.patch

NOTE: This patch is not meant for production use, it is meant to test the layout only. The dialog is totally broken, because I've not fixed all usages of the wxListBox!

Windows 7 32 bit build with your patch.
https://github.com/stahta01/cb_misc/blob/master/Notes/project_options_layout_many_target.png (https://github.com/stahta01/cb_misc/blob/master/Notes/project_options_layout_many_target.png)

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 02, 2014, 02:48:50 am
Hm, it seems that the list ctrl has not been expanded to width==200 pixels...

Probably I need to call something else, too and SetMinSize is not enough. Does anyone know what should be called?
Title: Re:
Post by: MortenMacFly on July 02, 2014, 10:19:14 pm
Did you forget Layout()?
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 02, 2014, 11:36:09 pm
Probably, but I cannot test it, because it works even without calling Layout() (probably on this).
I need someone to test this on windows.
Also I need to know if we want to do this change, so I can finish this patch.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 05, 2014, 05:51:22 pm
Can someone post a screenshot from a windows machine with my patch and adding a Layout(); call after the lines
Code
     lstTargets->SetMinSize(wxSize(width, 200));
     DoTargetChange(false);"

?
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 06, 2014, 03:00:03 am
Can someone post a screenshot from a windows machine with my patch and adding a Layout(); call after the lines
Code
     lstTargets->SetMinSize(wxSize(width, 200));
     DoTargetChange(false);"

?

I noticed no change; I am starting to think it is a wxWidgets 2.8 and Windows 7 32 bit bug.

I think this line is not working correctly on my PC using wxWidgets 2.8 and Windows 7 32 bit.
Code
lstTargets->SetColumnWidth(0, wxLIST_AUTOSIZE);

It works different in wx3.0.0 build the Width is twice what is needed for max target.

I think we need a different tester to verify it is not a problem on my PC.

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 06, 2014, 12:32:34 pm
Have you tried to debug cb and see what is the value of width?
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 06, 2014, 08:47:26 pm
Have you tried to debug cb and see what is the value of width?

Trying for my forth time using wxWidgets 2.8; first three got the below message.

Code
Program received signal SIGSEGV, Segmentation fault.
In _pthread_cleanup_dest () (E:\OpenSourceCode\Apps\IDEs\CodeBlocks\codeblocks_custom_build\src\devel\share\codeblocks\plugins\xpmanifest.dll)

wx 3.0.0 width is 165

Tim S.

Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 06, 2014, 09:02:35 pm
After about 8 tries got this

wx 2.8.12 width is 150

So, the width value is NOT that much difference between wx 3.0.0 and wx 2.8.12.

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 07, 2014, 01:35:55 am
Ok, but the width of the control on your screen shot is just 100. So the SetMinSize has no effect. Can you try to replace it with SetSize()? (I'm just guessing here)
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 07, 2014, 01:56:52 am
Ok, but the width of the control on your screen shot is just 100. So the SetMinSize has no effect. Can you try to replace it with SetSize()? (I'm just guessing here)

Just did that very weird results.

https://github.com/stahta01/cb_misc/blob/master/Notes/SetSize.png (https://github.com/stahta01/cb_misc/blob/master/Notes/SetSize.png)

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: oBFusCATed on July 07, 2014, 02:22:37 am
This is close to the expected behaviour.
Now, the question is why SetMinSize doesn't work on windows?
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 07, 2014, 02:31:38 am
This is close to the expected behaviour.
Now, the question is why SetMinSize doesn't work on windows?

I added "Fit();" where you said to add Layout and it appears to be correct for wx 2.8 (It only cuts off one of the targets).

Edit: Still about twice too wide using wx 3.0.0; might try 3.0.1 tomorrow.

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 07, 2014, 04:08:47 pm
This is close to the expected behaviour.
Now, the question is why SetMinSize doesn't work on windows?

I added "Fit();" where you said to add Layout and it appears to be correct for wx 2.8 (It only cuts off one of the targets).

Edit: Still about twice too wide using wx 3.0.0; might try 3.0.1 tomorrow.

Tim S.


No visible diff between  wx 3.0.0 and 3.0.1; still about twice too wide.

Might try wx trunk.

Tim S.
Title: Re: Build target window not resizing correctly.
Post by: stahta01 on July 07, 2014, 04:57:27 pm
I considered the wxWidgets Windows 7 32 bit build to look very good with your patch with these two changes.
1. Added Fit();
2. Added include of header (needed to get win32 wx3.0 project to build)

Link to TESTING DISPLAY ONLY patch that has those two changes.
https://github.com/stahta01/cb_misc/blob/master/Patches/svn/project_options_layout_many_target.patch (https://github.com/stahta01/cb_misc/blob/master/Patches/svn/project_options_layout_many_target.patch)

Tim S.