Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ollydbg on January 17, 2012, 04:30:39 pm

Title: Debugger branch: Placement of Windows
Post by: ollydbg on January 17, 2012, 04:30:39 pm
There is another issue, see the screen shot:
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2012-01-17231734.png)
Is it possible to show at least the "OK" button. (move the dialog a little UP)
Title: Debugger branch: Placement of Windows
Post by: ollydbg on January 18, 2012, 02:51:28 am
ollydbg: I don't get what is your problem? As far as I know the newly shown windows are not placed by C::B, but by your Explorer.exe.
I mean that when the debugger setting dialog is shown, can you make it centered on the screen?
I just test the compiler setting dialog, it shows centered which looks fine to me.
Title: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 18, 2012, 08:40:56 am
ollydbg: you'll have to debug it yourself, because here it works as intended, but I'm running bigger screens than yours (1600x1200 and 1920x1080). The code for compiler settings and debugger settings is pretty much the same. The only difference is that the Compiler settings are created from xrc resource, but debugger settings are created with wxSmith.

Morten: I wouldn't be surprised if the wx guys have messed the API, once again. But I'll be happy if you take some time and try to find the real cause for the problem.
Title: Debugger branch: Placement of Windows
Post by: ollydbg on January 18, 2012, 01:50:52 pm
ollydbg: you'll have to debug it yourself, because here it works as intended, but I'm running bigger screens than yours (1600x1200 and 1920x1080). The code for compiler settings and debugger settings is pretty much the same. The only difference is that the Compiler settings are created from xrc resource, but debugger settings are created with wxSmith.
I just debug it myself, and please add one line statement to fix this issue.

Code
Center();

In the end of function body, in file: src\debuggersettingsdlg.cpp around line 108.
Code
DebuggerSettingsDlg::DebuggerSettingsDlg(wxWindow* parent) 
Title: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 18, 2012, 02:17:57 pm
In fact looking at the code of Compiler settings the correct function should be CenterOnParent(). I will add it...
Title: Debugger branch: Placement of Windows
Post by: MortenMacFly on January 18, 2012, 02:56:04 pm
In fact looking at the code of Compiler settings the correct function should be CenterOnParent(). I will add it...
I believe there is a C::B API (PlaceWindow, IIRC) that should do this gracefully, also on Multi-Monitor systems...
Title: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 18, 2012, 03:09:43 pm
Yes, I know and I use it, but it seems that it doesn't work.
Title: Debugger branch: Placement of Windows
Post by: Jenna on January 18, 2012, 03:48:38 pm
It seems to work here (debian 64bit) with wx 2.8.12 .
Title: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 18, 2012, 09:09:13 pm
PlaceWindow might be broken on Windows, because it uses some win32 api stuff.
Someone should debug it to see what is going on.


@admins: Can you extract the related posts in a separate topic, because they are not related to the debugger:)
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 18, 2012, 10:31:35 pm
ollydbg: Can you try in a trunk version to remove the CenterToParent call in the Compiler dialog and to see if it places the dialog at the center of the screen?
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 19, 2012, 02:01:28 am
ollydbg: Can you try in a trunk version to remove the CenterToParent call in the Compiler dialog and to see if it places the dialog at the center of the screen?
I just test it by removing "CentreOnParent();" in the line 104 of cb_trunk\src\src\compilersettingsdlg.cpp.
The result is: dialog does NOT show on the center of the parent window.

PS: CentreOnParent() function works OK on my WinXP without any problem. (wx2.8.12)
Title: Re: Debugger branch: Placement of Windows
Post by: Jenna on January 19, 2012, 06:33:57 am
ollydbg: Can you try in a trunk version to remove the CenterToParent call in the Compiler dialog and to see if it places the dialog at the center of the screen?
I just test it by removing "CentreOnParent();" in the line 104 of cb_trunk\src\src\compilersettingsdlg.cpp.
The result is: dialog does NOT show on the center of the parent window.

PS: CentreOnParent() function works OK on my WinXP without any problem. (wx2.8.12)
What are your settings in "Settings -> View" for Multimonitor placement ?
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 19, 2012, 07:01:54 am
ollydbg: Can you try in a trunk version to remove the CenterToParent call in the Compiler dialog and to see if it places the dialog at the center of the screen?
I just test it by removing "CentreOnParent();" in the line 104 of cb_trunk\src\src\compilersettingsdlg.cpp.
The result is: dialog does NOT show on the center of the parent window.

PS: CentreOnParent() function works OK on my WinXP without any problem. (wx2.8.12)
What are your settings in "Settings -> View" for Multimonitor placement ?
Unchecked. (I do not have multi monitors, I have never changed this option, so it is by default)
Title: Re: Debugger branch: Placement of Windows
Post by: Jenna on January 19, 2012, 07:50:10 am
ollydbg: Can you try in a trunk version to remove the CenterToParent call in the Compiler dialog and to see if it places the dialog at the center of the screen?
I just test it by removing "CentreOnParent();" in the line 104 of cb_trunk\src\src\compilersettingsdlg.cpp.
The result is: dialog does NOT show on the center of the parent window.

PS: CentreOnParent() function works OK on my WinXP without any problem. (wx2.8.12)
What are your settings in "Settings -> View" for Multimonitor placement ?
Unchecked. (I do not have multi monitors, I have never changed this option, so it is by default)
If the Multimonitor placement checkbox  is unchecked and PlaceWindow() is not called with the third parameter set to true (defaults to false), it does nothing.
See sdk/globals.cpp:1017 .

That is obviously not the best way to implement it (or more exactly) the name is misleading).

You can call PlaceWindow with pdlCentre as second and true as third parameter to enforce placing the window (more or less) regardless the settings in "Settings -> View" .
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 19, 2012, 08:48:36 am
So, what should we/I do to fix this problem? Use both functions?
Title: Re: Debugger branch: Placement of Windows
Post by: Jenna on January 19, 2012, 09:03:02 am
So, what should we/I do to fix this problem? Use both functions?
I would try this:
You can call PlaceWindow with pdlCentre as second and true as third parameter to enforce placing the window (more or less) regardless the settings in "Settings -> View" .

But I think we should wait until ollydbg has tested, if it really works without additional tweaking inside the dialog-constructor
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 19, 2012, 09:53:19 am
But I think we should wait until ollydbg has tested, if it really works without additional tweaking inside the dialog-constructor
@jens: I got confused :(, adding "CentreOnParent()" in the constructor works fine here. (WinXP, Single Monitor)
What should I do right now?
Do I need to test the PlaceWindow() function? How to test it?

Quote
If the Multimonitor placement checkbox  is unchecked and PlaceWindow() is not called with the third parameter set to true (defaults to false), it does nothing.
See sdk/globals.cpp:1017 .
The line 1017 is related to wxGTK, I have only Windows XP here.

Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 19, 2012, 09:57:38 am
ollydbg: you have to test without CenterToParent and with PlaceWindow(..., pdlCentre, ...) instead.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 19, 2012, 10:15:36 am
ollydbg: you have to test without CenterToParent and with PlaceWindow(..., pdlCentre, ...) instead.
I just add one line in the end of constructor.
Code
PlaceWindow(this,pdlCentre,true);
It works fine.
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 19, 2012, 10:19:23 am
Can you change the PlaceWindow line, where ShowModal is called (it is in main.cpp) and remove your PlaceWindow from the constructor?
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 19, 2012, 10:26:26 am
Can you change the PlaceWindow line, where ShowModal is called (it is in main.cpp) and remove your PlaceWindow from the constructor?
Ok, I just test it like:
Code
void MainFrame::OnSettingsDebugger(wxCommandEvent& /*event*/)
{
    DebuggerSettingsDlg dlg(this);
    PlaceWindow(&dlg,pdlCentre,true);  //change here
    if (dlg.ShowModal() == wxID_OK)
    {
        CodeBlocksEvent event(cbEVT_SETTINGS_CHANGED);
        event.SetInt(cbSettingsType::Debugger);
        Manager::Get()->ProcessEvent(event);
    }
}

Works fine too.

PS: PlaceWindow(&dlg,pdlCentre,true) does not consider the parent window position, it always set window pos based on the screen.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on January 27, 2012, 07:01:37 am
Any news about this issue?
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on January 27, 2012, 09:12:42 am
Any news about this issue?
The code from your previous post in this thread looks good to me. I guess it will be applied with the next commit of oBFusCATed.
Edit: BTW: Shouldn't this be the same with the compiler settings dialog then, too?
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on January 27, 2012, 01:13:27 pm
I have no intention to fix this, because I don't see the problem on linux, so I can't test it.

And yes, both dialogs should behave the same.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on February 11, 2012, 10:30:16 am
RFA:
Is this patch OK?
Code
Index: E:/code/cb/cb_debugger_branch/src/src/main.cpp
===================================================================
--- E:/code/cb/cb_debugger_branch/src/src/main.cpp (revision 7791)
+++ E:/code/cb/cb_debugger_branch/src/src/main.cpp (working copy)
@@ -4403,7 +4403,7 @@
     bool needRestart = false;
 
     EnvironmentSettingsDlg dlg(this, m_LayoutManager.GetArtProvider());
-    PlaceWindow(&dlg);
+    PlaceWindow(&dlg,pdlCentre,true);
     if (dlg.ShowModal() == wxID_OK)
     {
         DoUpdateEditorStyle();
@@ -4431,7 +4431,7 @@
 void MainFrame::OnSettingsCompiler(wxCommandEvent& /*event*/)
 {
     CompilerSettingsDlg dlg(this);
-    PlaceWindow(&dlg);
+    PlaceWindow(&dlg,pdlCentre,true);
     if (dlg.ShowModal() == wxID_OK)
     {
         CodeBlocksEvent event(cbEVT_SETTINGS_CHANGED);
@@ -4443,7 +4443,7 @@
 void MainFrame::OnSettingsDebugger(wxCommandEvent& /*event*/)
 {
     DebuggerSettingsDlg dlg(this);
-    PlaceWindow(&dlg);
+    PlaceWindow(&dlg,pdlCentre,true);
     if (dlg.ShowModal() == wxID_OK)
     {
         CodeBlocksEvent event(cbEVT_SETTINGS_CHANGED);

I change three places, compiler/debugger/environment dialog setting placement.

EDIT

I see the code in trunk code:
Code
void MainFrame::OnSettingsCompilerDebugger(wxCommandEvent& /*event*/)
{
    CompilerSettingsDlg dlg(this);
    PlaceWindow(&dlg);
    dlg.ShowModal();
}

But the compilerdebugger dialog shows correctly. I'm not sure why this does not works under debugger_branch.

Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on February 11, 2012, 10:59:58 am
But the compilerdebugger dialog shows correctly. I'm not sure why this does not works under debugger_branch.
You can debug it, can't you?
If it does work in trunk, then it is a bug in the branch, so your patch is not correct.
The bug should be fixed.

(If you remember Thomas had an old signature, which was 100% true: 'Never fix a bug you don't understand!')
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on February 11, 2012, 11:53:16 am
You can debug it, can't you?
If it does work in trunk, then it is a bug in the branch, so your patch is not correct.
The bug should be fixed.
(If you remember Thomas had an old signature, which was 100% true: 'Never fix a bug you don't understand!')
Ok, I debugged it and find the reason:

The trunk code:
Code
CompilerSettingsDlg::CompilerSettingsDlg(wxWindow* parent)
{
......

    // make sure everything is laid out properly
    GetSizer()->SetSizeHints(this);
    CentreOnParent();
}
See, it is already CentreOnparent() on the constructor of the dialog.

But the debugger branch, there is no such code in DebuggerSettingsDlg::DebuggerSettingsDlg().

But the debugger branch, it DO have a CentreOnParent(); in the CompilerSettingsDlg::CompilerSettingsDlg().
Code
CompilerSettingsDlg::CompilerSettingsDlg(wxWindow* parent)
{
    // make sure everything is laid out properly
    GetSizer()->SetSizeHints(this);
    CentreOnParent();
}

The solution should be:

Adding  CentreOnParent(); in DebuggerSettingsDlg::DebuggerSettingsDlg(), right?
Title: Re: Debugger branch: Placement of Windows
Post by: Jenna on February 11, 2012, 12:31:50 pm
The solution should be:

Adding  CentreOnParent(); in DebuggerSettingsDlg::DebuggerSettingsDlg(), right?


It will most likely break the configuration made in "Settings -> View -> Enhanced multi-monitor placement", and if it does, these settings are ignored in trunk already.
I can not test at the moment.

I think this should be th eplace for changes:
The settings dialog, to be clear that it can be used for multimonitor systems and for single monitors, and possible the ability to centre a dialog oin the parent and not only on the screen (Changes in PlaceWindow).
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on February 11, 2012, 12:39:52 pm
The solution should be:

Adding  CentreOnParent(); in DebuggerSettingsDlg::DebuggerSettingsDlg(), right?


It will most likely break the configuration made in "Settings -> View -> Enhanced multi-monitor placement", and if it does, these settings are ignored in trunk already.
I'm not fully understand your meaning, here is the code:
Code
void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode, bool enforce)
{
    HMONITOR hMonitor;
    MONITORINFO mi;
    RECT        r;

    int the_mode;

    if (!w)
        cbThrow(_T("Passed NULL pointer to PlaceWindow."));

    wxWindow* referenceWindow = Manager::Get()->GetAppWindow();

    if (!referenceWindow)    // no application window available, so this is as good as we can get
        referenceWindow = w;

    wxRect windowRect = w->GetRect();

    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
    if (!enforce && cfg->ReadBool(_T("/dialog_placement/do_place")) == false)
        return;

    if (mode == pdlBest)
        the_mode = cfg->ReadInt(_T("/dialog_placement/dialog_position"), (int) pdlCentre);
    else
        the_mode = (int) mode;


    static MonitorFromWindow_t MonitorFromWindowProc = (MonitorFromWindow_t) GetProcAddress(GetModuleHandle(_T("user32.dll")), "MonitorFromWindow");
    static GetMonitorInfo_t    GetMonitorInfoProc    = (GetMonitorInfo_t)    GetProcAddress(GetModuleHandle(_T("user32.dll")), "GetMonitorInfoA");
    int monitorWidth;
    int monitorHeight;

    if (GetMonitorInfoProc)
    {
        hMonitor = MonitorFromWindowProc((HWND) referenceWindow->GetHandle(), MONITOR_DEFAULTTONEAREST);

        mi.cbSize = sizeof(mi);
        GetMonitorInfoProc(hMonitor, &mi);
        r = mi.rcWork;

        monitorWidth  = r.right - r.left;
        monitorHeight = r.bottom - r. top;
    }
    else // Win95, NT4: support only single monitor
    {
        wxDisplaySize(&monitorWidth, &monitorHeight);
        r.left = r.top = 0;
    }


    switch(the_mode)
    {
        case pdlCentre:
        {
            windowRect.x = r.left + (monitorWidth  - windowRect.width)/2;
            windowRect.y = r.top  + (monitorHeight - windowRect.height)/2;
        }
        break;


        case pdlHead:
        {
            windowRect.x = r.left + (monitorWidth  - windowRect.width)/2;
            windowRect.y = r.top  + (monitorHeight - windowRect.height)/3;
        }
        break;


        case pdlConstrain:
        {
            int x1 = windowRect.x;
            int x2 = windowRect.x + windowRect.width;
            int y1 = windowRect.y;
            int y2 = windowRect.y + windowRect.height;

            if (windowRect.width > monitorWidth) // cannot place without clipping, so centre it
            {
                x1 = r.left + (monitorWidth  - windowRect.width)/2;
                x2 = x1 + windowRect.width;
            }
            else
            {
                x2 = std::min((int) r.right, windowRect.GetRight());
                x1 = std::max(x2 - windowRect.width, (int) r.left);
                x2 = x1 + windowRect.width;
            }
            if (windowRect.height > monitorHeight) // cannot place without clipping, so centre it
            {
                y1 = r.top + (monitorHeight  - windowRect.height)/2;
                y2 = y1 + windowRect.height;
            }
            else
            {
                y2 = std::min((int) r.bottom, windowRect.GetBottom());
                y1 = std::max(y2 - windowRect.height, (int) r.top);
                y2 = y1 + windowRect.height;
            }
            windowRect = wxRect(x1, y1, x2-x1, y2-y1);
        }
        break;


        case pdlClip:
        {
            int x1 = windowRect.x;
            int x2 = windowRect.x + windowRect.width;
            int y1 = windowRect.y;
            int y2 = windowRect.y + windowRect.height;

            x1 = std::max(x1, (int) r.left);
            x2 = std::min(x2, (int) r.right);
            y1 = std::max(y1, (int) r.top);
            y2 = std::min(y2, (int) r.bottom);

            windowRect = wxRect(x1, y1, x2-x1, y2-y1);
        }
        break;
    }

    w->SetSize(windowRect.x,  windowRect.y, windowRect.width, windowRect.height, wxSIZE_ALLOW_MINUS_ONE);
}


I do not check on any multiply-monitor related options, so this function is in fact do nothing and return from:
Code
    if (!enforce && cfg->ReadBool(_T("/dialog_placement/do_place")) == false)
        return;

So, if you have  "Settings -> View -> Enhanced multi-monitor placement" settings check on, this function will go further to adjust the dialog position.

Quote
I think this should be th eplace for changes:
The settings dialog, to be clear that it can be used for multimonitor systems and for single monitors, and possible the ability to centre a dialog oin the parent and not only on the screen (Changes in PlaceWindow).
Not fully understand this either. Sorry. :), you mean the dialog SHOULD be placed in the center of parent window or screen?
Title: Re: Debugger branch: Placement of Windows
Post by: Jenna on February 11, 2012, 12:46:50 pm
The settings dialog should be overworked, to make clear we can place windows in multimonitor and standard mode.
The user can decide where the window should be opened and not be forced to always get it centred on parent.

We can have centre on screen (that's what we have already, if I remember correctly), centre on parent (that is forced by the congtructor in trunk at the moment (for debuggersettings), and possible other settings, like left-top, at mouse-üposition, on left monitor, on right monitor or whatever might be useful.

It should not be so hard to implement.

I can see if I find the time and provide a patch for testing.
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 16, 2012, 02:23:15 pm
BTW, notice that the PlaceWindow method uses "pdlBest" as default argument for the method. So unless its really provided/enforced by the caller, the following code:
Code
    if (mode == pdlBest)
        the_mode = cfg->ReadInt(_T("/dialog_placement/dialog_position"), (int) pdlCentre);
    else
        the_mode = (int) mode;
...makes sure that the method does the right thing which is "centre" by default unless the user said different, as you see. So if there is no good reason you should always call PlaceWindow without additional argument.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 17, 2012, 08:32:34 am
So if there is no good reason you should always call PlaceWindow without additional argument.
You mean we should always do like below (call PlaceWindow() with only first parameter)
Code
     CompilerSettingsDlg dlg(this);
     PlaceWindow(&dlg);

In this case, If I would like place dlg in the center of the screen. I need to check on both:
View->Enhance multi-monitor dialog place and Move to "head up" position. Otherwise, the dialog place badly as my original post in this discussion thread.

That's not intuitive, because I work on a Single monitor Laptop.

Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 17, 2012, 08:50:08 am
That's not intuitive, because I work on a Single monitor Laptop.
But that's what PlaceWindow is for. If you want to change the default behaviour of of dialogs you should position them in their constructor before calling PlaceWindow. PlaceWindow IMHO is only for multi-monitor placement.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 17, 2012, 09:14:08 am
That's not intuitive, because I work on a Single monitor Laptop.
But that's what PlaceWindow is for. If you want to change the default behaviour of of dialogs you should position them in their constructor before calling PlaceWindow. PlaceWindow IMHO is only for multi-monitor placement.
Ok, I presume that those two options should not be selected.
But if I do not select both, the dialog position is too bad. see the screen shot of my whole screen.
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2012-04-17150826.png)
I even can't see the buttons of the dialog. This is the same behavior in both Windows and Ubuntu 10.10.
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 17, 2012, 09:22:25 am
I even can't see the buttons of the dialog. This is the same behavior in both Windows and Ubuntu 10.10.
That's why I said its an improper design of the dialog itself then. the constructor should make everything needed/possible to properly position the dialog initially. Then PlaceWindow may adjust it to the users needs in case of multiple monitors.

For the debugger settings pane I see two drawbacks in its contructor:
1.) its wxSmith based, but sets:
Code
	SetMinSize(wxSize(600, 600));
SetSize(wxSize(600, 600));
manually -> no good style.
2.) it does not center itself on the parent (if any).

Both should be adjusted using wxSmith. Than you should be happy.

The same applies to all other dialogs that do not behave / position correctly.
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on April 17, 2012, 10:00:06 am
Sorry, but these two calls are needed in order to make the dialog large enough and they are there because a bug/missing feature of wxSmith.
The missing feature/bug is that wxSmith adds the setsize/setminsize, right after the creation of the dialog and thus they are useless and doesn't enforce the minimal size.

If you know how to make it work show patches, I do not.
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 17, 2012, 01:27:15 pm
If you know how to make it work show patches, I do not.
Well surely you should not adjust the min-size flag of the dialog (this is useless most of the time), but the controls on the dialog, that are too small - such as the wxTreeBook.

If I set the min-size of the wxTreeBook (and only that flag, otherwise you screw sizing) to e.g. 500x500 using wxSmith it works just fine.
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on April 17, 2012, 02:19:41 pm
Can I see a patch?
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 17, 2012, 04:59:28 pm
Can I see a patch?
Are you serious? OK, here it is at your service - what I did:
- remove the hand-crafted SetSize stuff
- open the dialog in wxSmith
- adjust the min size of the tree control
- hit compile.

Not sure why this was too hard for you, but anyways... ;D ;D
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on April 17, 2012, 10:05:53 pm
Not sure why this was too hard for you, but anyways... ;D ;D
Because you had the changes already made and to make sure I've understood what you've meant.

Any idea how to force the dialog to auto-resize in order to fit the panel for the debuggergdb options?
Currently using your patch, the disassembly options are clipped.

ollydbg: Does Morten's patch fix your problem?
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 18, 2012, 02:02:24 am
ollydbg: Does Morten's patch fix your problem?
No, I just test this patch, but the problem still exists.  ???
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on April 18, 2012, 08:49:45 am
2.) it does not center itself on the parent (if any).

Both should be adjusted using wxSmith. Than you should be happy.
How do we set the 2.) in wxSmith? Using the ExtraCode field?
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 18, 2012, 09:33:15 pm
Any idea how to force the dialog to auto-resize in order to fit the panel for the debuggergdb options?
Currently using your patch, the disassembly options are clipped.
IMHO, the panels are badly design because they do not allow expanding (thats what I recall from the options). Maybe that's the issue. (Cannot look into it ATM.)

2.) it does not center itself on the parent (if any).
Yes, enable the "Centered" flag in the wxSmith options (of the wxScrollingDialog). - I didn't do it in the patch.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 25, 2012, 04:36:40 pm
@morten:
Did you fixed this in the trunk? rev7941? I don't have many time to test it right now. :)
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 25, 2012, 06:02:20 pm
Did you fixed this in the trunk? rev7941? I don't have many time to test it right now. :)
The first part, yes. That actually what I sent to oBFusCATed. To be honest: It was actually more an accident because in the revision before, a file of that patch file slipped in. Thus I thought: "What the heck lets try...". ;-)

It works just fine here btw... so I don't expect any issues - its no functional change, just layout.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 27, 2012, 05:12:58 am
Did you fixed this in the trunk? rev7941? I don't have many time to test it right now. :)
The first part, yes. That actually what I sent to oBFusCATed. To be honest: It was actually more an accident because in the revision before, a file of that patch file slipped in. Thus I thought: "What the heck lets try...". ;-)

It works just fine here btw... so I don't expect any issues - its no functional change, just layout.
I build rev7945, but the debugger setting dialog is still in the wrong place.  :) So, I believe this is not fixed yet.
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on April 27, 2012, 03:37:40 pm
I build rev7945, but the debugger setting dialog is still in the wrong place.  :) So, I believe this is not fixed yet.
This revision does not position the dialog differently, it just has changed the layout in terms of size. For the other stuff what still applies is that "centering" is missing in the constructor. I see if I can give it a shot...
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on April 29, 2012, 04:16:38 pm
@morten:
I see you change in rev7950
Code
===================================================================
--- trunk/src/src/debuggersettingsdlg.cpp (revision 7949)
+++ trunk/src/src/debuggersettingsdlg.cpp (revision 7950)
@@ -60,15 +60,16 @@
  m_treebook->SetMinSize(wxSize(600,440));
  mainSizer->Add(m_treebook, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
  staticLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("wxID_ANY"));
- mainSizer->Add(staticLine, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
+ mainSizer->Add(staticLine, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
  stdDialogButtons = new wxStdDialogButtonSizer();
  stdDialogButtons->AddButton(new wxButton(this, wxID_OK, wxEmptyString));
  stdDialogButtons->AddButton(new wxButton(this, wxID_CANCEL, wxEmptyString));
  stdDialogButtons->Realize();
- mainSizer->Add(stdDialogButtons, 0, wxALL|wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 5);
+ mainSizer->Add(stdDialogButtons, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
  SetSizer(mainSizer);
  mainSizer->Fit(this);
  mainSizer->SetSizeHints(this);
+ Center();
 
  Connect(ID_TREEBOOK,wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&DebuggerSettingsDlg::OnPageChanged);
  //*)
But this does not solve the problem, because there are many code snippets after Center() call in the constructor of  DebuggerSettingsDlg::DebuggerSettingsDlg. And the size of the dialog is changed by those code snippets.

Please put the Center command in the end of the constructor like:
Code
Index: E:/code/cb/cb_trunk/src/src/debuggersettingsdlg.cpp
===================================================================
--- E:/code/cb/cb_trunk/src/src/debuggersettingsdlg.cpp (revision 7950)
+++ E:/code/cb/cb_trunk/src/src/debuggersettingsdlg.cpp (working copy)
@@ -100,6 +100,8 @@
 
     for (size_t ii = 0; ii < m_treebook->GetPageCount(); ++ii)
         m_treebook->ExpandNode(ii);
+
+    Center();
 }
 
 DebuggerSettingsDlg::~DebuggerSettingsDlg()

This works OK.

The another issue is: If you search the word "CentreOnParent", you will see many dialog's constructor will call this in the end. As we discussed before, We should be consistent. Either all Center() or all CentreOnParent().

What do you think? (As jens said here: Re: Debugger branch: Placement of Windows (http://forums.codeblocks.org/index.php/topic,15818.msg107377.html#msg107377))
I think Center() is preferred. Right?



Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on May 09, 2012, 10:05:12 am
FYI:
I commit the fix in rev7955.

BTW: I have read the wx's manual, and I see that
Quote
void wxWindow::CentreOnParent  ( int  direction = wxBOTH )  

Centres the window on its parent.

This is a more readable synonym for Centre().

Parameters:
direction Specifies the direction for the centring. May be wxHORIZONTAL, wxVERTICAL or wxBOTH.

Remarks:
This methods provides for a way to centre top level windows over their parents instead of the entire screen. If there is no parent or if the window is not a top level window, then behaviour is the same as Centre().
See also:
wxTopLevelWindow::CentreOnScreen

So, in these cases,  CentreOnParent is equal to Centre.
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on May 09, 2012, 11:40:16 am
I commit the fix in rev7955.
Next time, please use British English, so instead CentreOnParent(), use the British equivalent CenterOnParent(). wxWidgets supports both language styles (a bit strange, but true). We committed ourselves to use British English ages ago... you could not know that.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on May 09, 2012, 03:10:38 pm
I commit the fix in rev7955.
Next time, please use British English, so instead CentreOnParent(), use the British equivalent CenterOnParent(). wxWidgets supports both language styles (a bit strange, but true). We committed ourselves to use British English ages ago... you could not know that.
OK, I just updated all the instances of CentreOnParent() to CenterOnParent() in rev7956.
Title: Re: Debugger branch: Placement of Windows
Post by: Alpha on May 10, 2012, 01:55:34 am
Next time, please use British English, so instead CentreOnParent(), use the British equivalent CenterOnParent().
Wait... should not it be the reverse of that?  American and British English spelling differences (http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-re.2C_-er).
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on May 10, 2012, 06:53:13 am
Wait... should not it be the reverse of that?  American and British English spelling differences (http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-re.2C_-er).
Ouch, dammed - my mistake. The SpellChekcer plugin was set to American English all the time.
Title: Re: Debugger branch: Placement of Windows
Post by: ollydbg on May 10, 2012, 08:42:46 am
Wait... should not it be the reverse of that?  American and British English spelling differences (http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-re.2C_-er).
Ouch, dammed - my mistake. The SpellChekcer plugin was set to American English all the time.
1, thanks alpha for the info
2, @morten: Do you mean we should use: CentreOnParent() not CenterOnParent()?
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on May 10, 2012, 10:00:45 am
2, @morten: Do you mean we should use: CentreOnParent() not CenterOnParent()?
Yes - you were correct in the first place. I was wondering anyhow why there were so many places. British English is Centre, indeed. :-( I am very sorry for the confusion.

I pimped the SpellChecker plugin in my local copy, that it suggests spelling for CamelCase words and so Centre got underlined, but because SpellChecker used the American English dictionary. I should have thought twice.

BTW: Julian Smart (AFAIK) is British. ;-)
Title: Re: Debugger branch: Placement of Windows
Post by: oBFusCATed on May 10, 2012, 10:11:20 am
<facepalm> wx devs should be <spanked> for causing excessive time waste...
Title: Re: Debugger branch: Placement of Windows
Post by: MortenMacFly on May 10, 2012, 10:32:39 am
<facepalm> wx devs should be <spanked> for causing excessive time waste...
Well in that case it was just me. :-[

OT: But it can be worse: I recall the days when I was developing Excel macros in a German Excel, where MS translated the whole macro language to German. That is really some sort of fun. (I wonder if its still like that in recent MS Offices...)
Title: Re: Debugger branch: Placement of Windows
Post by: daniloz on May 10, 2012, 01:45:28 pm
OT: But it can be worse: I recall the days when I was developing Excel macros in a German Excel, where MS translated the whole macro language to German. That is really some sort of fun. (I wonder if its still like that in recent MS Offices...)

OT: Sorry to stay OT'd here, but it still like this, even in Excel 2010 !!! I understand that they show the localized version of the macro/formulas, but saving them localized in the file and not re-localizing them when opening with another language is just inexcusable !!! I also had lots of fun when I received an Excel file made with an English version and had to convert everything manually to German, so it would work in my German version of Excel 2010 (!!!!!). :o