Author Topic: size of "add include path dialog"  (Read 6246 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
size of "add include path dialog"
« on: August 09, 2015, 09:37:56 am »
IS anyone else seeing this :
(already for some months now) I have this on all my openSuse boxes :

Project->Build Options -> Search Directories -> Compiler -> Add :

Add Repository Dialog :
 - a very small Directory input field (one can hardly see antyhing of the path)
- a way oversized "..." button


Note : even if this would be back to normal size as before, think this dialog should be bigger anyway (one needs space when showing paths)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: size of "add include path dialog"
« Reply #1 on: August 09, 2015, 10:15:19 am »
I think we have discussed this kind of issue already, see: Re: The 19 June 2015 build (10341) is out. about the discussion.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: size of "add include path dialog"
« Reply #2 on: August 09, 2015, 10:35:40 am »
in there I think another dialog is being discussed , no ?

Without any conclusion, so what should we do.
Bluntly putting that minsize back ?

Or I think on the dialog I am mentioning, the button "..." can have a fixed sized (as well as the "Directory" label), and all the rest of the line can be consumed by the input field, together we a substantially enlarged dialog itself.

...

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: size of "add include path dialog"
« Reply #3 on: August 09, 2015, 10:41:23 am »
Hi, killerbot, the dialog your reported I think is the one: "src/sdk/resources/edit_path.xrc"

With the commit 10260, some minimal size value is removed. See the diff below:
Code
 src/sdk/resources/edit_path.xrc | 115 +++++++++++++++++++---------------------
 1 file changed, 55 insertions(+), 60 deletions(-)

diff --git a/src/sdk/resources/edit_path.xrc b/src/sdk/resources/edit_path.xrc
index f8ec156..8ac9103 100644
--- a/src/sdk/resources/edit_path.xrc
+++ b/src/sdk/resources/edit_path.xrc
@@ -1,63 +1,58 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
-  <object class="wxScrollingDialog" name="dlgEditPath">
-    <title>Edit path</title>
-    <centered>1</centered>
-    <object class="wxBoxSizer">
-      <orient>wxVERTICAL</orient>
-      <object class="sizeritem">
-        <object class="wxBoxSizer">
-          <orient>wxHORIZONTAL</orient>
-          <object class="sizeritem">
-            <object class="wxStaticText" name="lblText">
-              <label>Directory:</label>
-            </object>
-            <flag>wxTOP</flag>
-            <border>4</border>
-          </object>
-          <object class="sizeritem">
-            <object class="wxTextCtrl" name="txtPath"/>
-            <option>1</option>
-            <flag>wxLEFT|wxRIGHT|wxGROW</flag>
-            <border>8</border>
-            <minsize>240,-1</minsize>
-          </object>
-          <object class="sizeritem">
-            <object class="wxButton" name="btnBrowse">
-              <label>...</label>
-              <tooltip>Browse</tooltip>
-            </object>
-            <minsize>24,24</minsize>
-          </object>
-        </object>
-        <option>1</option>
-        <flag>wxALL|wxGROW</flag>
-        <border>8</border>
-      </object>
-      <object class="sizeritem">
-        <object class="wxStaticLine"/>
-        <flag>wxLEFT|wxRIGHT|wxGROW</flag>
-        <border>8</border>
-      </object>
-      <object class="sizeritem">
-        <object class="wxStdDialogButtonSizer">
-          <object class="button">
-            <object class="wxButton" name="wxID_OK">
-              <label></label>
-              <label>&amp;Ok</label>
-              <default>1</default>
-            </object>
-          </object>
-          <object class="button">
-            <object class="wxButton" name="wxID_CANCEL">
-              <label></label>
-              <label>&amp;Cancel</label>
-            </object>
-          </object>
-        </object>
-        <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
-        <border>8</border>
-      </object>
-    </object>
-  </object>
+ <object class="wxScrollingDialog" name="dlgEditPath">
+ <title>Edit path</title>
+ <centered>1</centered>
+ <object class="wxBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <object class="wxBoxSizer">
+ <object class="sizeritem">
+ <object class="wxStaticText" name="lblText">
+ <label>Directory:</label>
+ </object>
+ <flag>wxTOP</flag>
+ <border>4</border>
+ </object>
+ <object class="sizeritem">
+ <object class="wxTextCtrl" name="txtPath" />
+ <flag>wxLEFT|wxRIGHT|wxEXPAND</flag>
+ <border>8</border>
+ <option>1</option>
+ </object>
+ <object class="sizeritem">
+ <object class="wxButton" name="btnBrowse">
+ <label>...</label>
+ <tooltip>Browse</tooltip>
+ </object>
+ <flag></flag>
+ </object>
+ </object>
+ <flag>wxALL|wxEXPAND</flag>
+ <border>8</border>
+ <option>1</option>
+ </object>
+ <object class="sizeritem">
+ <object class="wxStaticLine" name="ID_STATICLINE1" />
+ <flag>wxLEFT|wxRIGHT|wxEXPAND</flag>
+ <border>8</border>
+ </object>
+ <object class="sizeritem">
+ <object class="wxStdDialogButtonSizer">
+ <object class="button">
+ <object class="wxButton" name="wxID_OK">
+ <label></label>
+ </object>
+ </object>
+ <object class="button">
+ <object class="wxButton" name="wxID_CANCEL">
+ <label></label>
+ </object>
+ </object>
+ </object>
+ <flag>wxALL|wxALIGN_CENTER_HORIZONTAL</flag>
+ <border>8</border>
+ </object>
+ </object>
+ </object>
 </resource>


I think we should add those minimal size value back.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: size of "add include path dialog"
« Reply #4 on: August 09, 2015, 11:15:45 am »
I know what happens and when.
It happens for many dialogs (I think).
I currently work on a patch to fix this.
Please do not touch this files (if possible) at least not in trunk, or fixing will be more work, because of merge conflicts.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: size of "add include path dialog"
« Reply #5 on: August 15, 2015, 10:59:41 pm »
this is now back as it was before thanks to the changes Jens made :-)

For the "add include path" dialog, I would still suggest :

- to make the size bigger (it is still a small dialog)
- have it re-sizable

What do you think ?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: size of "add include path dialog"
« Reply #6 on: August 18, 2015, 01:27:29 am »
Great job, Jens.
@killerbot, I think the old revision(before revision10260), the add include path dialog is also quite small, right?
See the image shot below:

I also see a CodeBlocks error message box, which is similar as BlueHazzard's post said: Re: The 19 June 2015 build (10341) is out..

I'm using wx2.8.12 under WindowsXP.

Also, I see commit10394, it has the diff file:
Code
363159f1df8772cc374d00fa8923277d13ac488d
 src/plugins/scriptedwizard/resources/plugins/wizard.xrc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/plugins/scriptedwizard/resources/plugins/wizard.xrc b/src/plugins/scriptedwizard/resources/plugins/wizard.xrc
index ef24d27..6bca053 100644
--- a/src/plugins/scriptedwizard/resources/plugins/wizard.xrc
+++ b/src/plugins/scriptedwizard/resources/plugins/wizard.xrc
@@ -96,6 +96,7 @@
                             <style>wxTE_MULTILINE</style>
                         </object>
                         <flag>wxEXPAND</flag>
+                        <minsize>240,128</minsize>
                     </object>
                 </object>
                 <flag>wxALL|wxEXPAND</flag>
@@ -135,7 +136,7 @@
                         <object class="wxStaticText" name="ID_STATICTEXT3">
                             <label>Plugin type:</label>
                         </object>
-                        <flag></flag>
+                        <flag />
                     </object>
                     <object class="sizeritem">
                         <object class="wxComboBox" name="cmbPluginType">
@@ -148,7 +149,7 @@
                             <selection>1</selection>
                             <style>wxCB_READONLY</style>
                         </object>
-                        <flag></flag>
+                        <flag />
                     </object>
                 </object>
                 <flag>wxALL|wxEXPAND</flag>
Is that correct? for the flag field?

About the flag issue, I search the wx 2.8.12 source
There is a function which adds style
Code
void wxXmlResourceHandler::AddStyle(const wxString& name, int value)
{
    m_styleNames.Add(name);
    m_styleValues.Add(value);
}
And a macro to do this:
Code
#define XRC_ADD_STYLE(style) AddStyle(wxT(#style), style)


You can see all other align styles were added in wxWidgets-2.8.12\src\xrc\xh_sizer.cpp
Code
     XRC_ADD_STYLE(wxALIGN_CENTER);
     XRC_ADD_STYLE(wxALIGN_CENTRE);
     XRC_ADD_STYLE(wxALIGN_LEFT);
     XRC_ADD_STYLE(wxALIGN_TOP);
     XRC_ADD_STYLE(wxALIGN_RIGHT);
     XRC_ADD_STYLE(wxALIGN_BOTTOM);
But you have never see
Code
XRC_ADD_STYLE(wxALIGN_NOT);

Thus:
Code
int wxXmlResourceHandler::GetStyle(const wxString& param, int defaults)
{
    wxString s = GetParamValue(param);

    if (!s) return defaults;

    wxStringTokenizer tkn(s, wxT("| \t\n"), wxTOKEN_STRTOK);
    int style = 0;
    int index;
    wxString fl;
    while (tkn.HasMoreTokens())
    {
        fl = tkn.GetNextToken();
        index = m_styleNames.Index(fl);
        if (index != wxNOT_FOUND)
            style |= m_styleValues[index];
        else
            wxLogError(_("Unknown style flag ") + fl);
    }
    return style;
}
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: size of "add include path dialog"
« Reply #7 on: August 18, 2015, 07:16:05 am »
yes in the past it was also rather small, so my proposal is to enlarge it, unless there are objections ?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: size of "add include path dialog"
« Reply #8 on: August 18, 2015, 07:59:30 am »
I will fix the "wxALIGN_NOT" issue later this day.