Re: Buglets in dlgFunction

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: Buglets in dlgFunction
Дата
Msg-id 48F743CE.6060100@lelarge.info
обсуждение исходный текст
Ответ на Re: Buglets in dlgFunction  ("Dave Page" <dpage@pgadmin.org>)
Ответы Re: Buglets in dlgFunction  ("Dave Page" <dpage@pgadmin.org>)
Re: Buglets in dlgFunction  ("Dave Page" <dpage@pgadmin.org>)
Список pgadmin-hackers
Dave Page a écrit :
> On Thu, Oct 9, 2008 at 5:30 PM, Guillaume Lelarge
> <guillaume@lelarge.info> wrote:
>
>> OK, problem was in the CreateColumns function, file
>> pgadmin/ctl/ctlListView.cpp. Complete patch attached.
>
> Okey-doke. So the latest testing shows:
>
> dlgTable:
> [...]
> dlgView:
>
> Existing view: Privileges listview may be mis-sized/missing until resized
> New view: Privileges listview may be mis-sized/missing until resized
>
> So it's definitely getting better :-). We seem be be down to one bug
> now (with the exception of dlgPackage) which I now realise seems to
> manifest itself when any dialogue (with a privileges tab) opens with a
> different size than it's default/minimum. In that case, the listview
> will either be displayed at the standard height (thus looking too
> small if the height of the dialogue is greater than normal), or
> entirely mis-sized or missing. Should be relatively easy to force the
> pane to resize I hope.
>
> :-)
>

Sorry for giving you so many testing work... :-/

Here is a new (complete) patch. I don't like at all what I did but it
seems to fix your issues.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: pgadmin/ctl/ctlListView.cpp
===================================================================
--- pgadmin/ctl/ctlListView.cpp    (revision 7489)
+++ pgadmin/ctl/ctlListView.cpp    (working copy)
@@ -73,13 +73,22 @@
     int rightSize;
     if (leftSize < 0)
     {
-        leftSize = rightSize = GetClientSize().GetWidth()/2;
+#ifdef __WXMAC__
+        leftSize = rightSize = (GetParent()->GetSize().GetWidth() - 20)/2;
+#else
+        leftSize = rightSize = GetSize().GetWidth()/2;
+#endif
     }
     else
     {
         if (leftSize)
             leftSize = ConvertDialogToPixels(wxPoint(leftSize, 0)).x;
+
+#ifdef __WXMAC__
+        rightSize = (GetParent()->GetSize().GetWidth() - 20) - leftSize;
+#else
         rightSize = GetClientSize().GetWidth()-leftSize;
+#endif
     }
     if (!leftSize)
     {
Index: pgadmin/include/dlg/dlgView.h
===================================================================
--- pgadmin/include/dlg/dlgView.h    (revision 7489)
+++ pgadmin/include/dlg/dlgView.h    (working copy)
@@ -40,10 +40,6 @@
     pgView *view;
     wxString oldDefinition;

-#ifdef __WXMAC__
-    void OnChangeSize(wxSizeEvent &ev);
-#endif
-
     DECLARE_EVENT_TABLE()
 };

Index: pgadmin/include/dlg/dlgProperty.h
===================================================================
--- pgadmin/include/dlg/dlgProperty.h    (revision 7489)
+++ pgadmin/include/dlg/dlgProperty.h    (working copy)
@@ -183,14 +183,14 @@
     virtual wxString GetHelpPage() const;
     virtual int Go(bool modal=false);
     bool DisablePrivilege(const wxString &priv);
-    void SetPrivilegesSize(int width, int height);
+    void SetPrivilegesLayout();

-private:
-
 #ifdef __WXMAC__
     void OnChangeSize(wxSizeEvent &ev);
 #endif

+private:
+
     void OnAddPriv(wxCommandEvent& ev);
     void OnDelPriv(wxCommandEvent& ev);
     bool securityChanged;
Index: pgadmin/agent/dlgJob.cpp
===================================================================
--- pgadmin/agent/dlgJob.cpp    (revision 7489)
+++ pgadmin/agent/dlgJob.cpp    (working copy)
@@ -119,6 +119,8 @@

 int dlgJob::Go(bool modal)
 {
+    int returncode;
+
     pgSet *jcl=connection->ExecuteSet(wxT("SELECT jclname FROM pgagent.pga_jobclass"));
     if (jcl)
     {
@@ -214,7 +216,14 @@
         btnChangeSchedule->Hide();
     }

-    return dlgProperty::Go(modal);
+    returncode = dlgProperty::Go(modal);
+
+    #ifdef __WXMAC__
+    wxSizeEvent event(wxSize(GetSize().GetWidth() - 20, GetSize().GetHeight() + 200));
+    OnChangeSize(event);
+    #endif
+
+    return returncode;
 }


Index: pgadmin/dlg/dlgProperty.cpp
===================================================================
--- pgadmin/dlg/dlgProperty.cpp    (revision 7489)
+++ pgadmin/dlg/dlgProperty.cpp    (working copy)
@@ -208,10 +208,9 @@
 }


-void dlgSecurityProperty::SetPrivilegesSize(int width, int height)
+void dlgSecurityProperty::SetPrivilegesLayout()
 {
-    securityPage->lbPrivileges->SetSize(wxDefaultCoord, wxDefaultCoord,
-        width, height);
+    securityPage->lbPrivileges->GetParent()->Layout();
 }


@@ -1504,7 +1503,7 @@
 void dlgSecurityProperty::OnChangeSize(wxSizeEvent &ev)
 {
     securityPage->lbPrivileges->SetSize(wxDefaultCoord, wxDefaultCoord,
-        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 550);
     if (GetAutoLayout())
     {
         Layout();
@@ -1516,7 +1515,10 @@
 int dlgSecurityProperty::Go(bool modal)
 {
     if (securityPage)
+    {
         securityPage->SetConnection(connection);
+        //securityPage->Layout();
+    }

     return dlgProperty::Go(modal);
 }
Index: pgadmin/dlg/dlgFunction.cpp
===================================================================
--- pgadmin/dlg/dlgFunction.cpp    (revision 7489)
+++ pgadmin/dlg/dlgFunction.cpp    (working copy)
@@ -153,6 +153,8 @@

 int dlgFunction::Go(bool modal)
 {
+    int returncode;
+
     if (function)
     {
         rdbIn->Disable();
@@ -361,21 +363,35 @@
     OnSelChangeLanguage(event);

     SetupVarEditor(1);
-    return dlgSecurityProperty::Go(modal);
+
+    returncode = dlgSecurityProperty::Go(modal);
+
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
+/*
+    #ifdef __WXMAC__
+    wxSizeEvent event2(wxSize(GetSize().GetWidth() - 20, GetSize().GetHeight() + 100));
+    OnChangeSize(event2);
+    #endif
+*/
+
+    return returncode;
 }

 #ifdef __WXMAC__
 void dlgFunction::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
-    lstArguments->SetSize(wxDefaultCoord, wxDefaultCoord,
-        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
-    lstVariables->SetSize(wxDefaultCoord, wxDefaultCoord,
-        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
-    if (GetAutoLayout())
-    {
-        Layout();
-    }
+    lstArguments->SetSize(wxDefaultCoord, wxDefaultCoord,
+        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    lstVariables->SetSize(wxDefaultCoord, wxDefaultCoord,
+        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    dlgSecurityProperty::OnChangeSize(ev);
 }
 #endif

Index: pgadmin/dlg/dlgTable.cpp
===================================================================
--- pgadmin/dlg/dlgTable.cpp    (revision 7489)
+++ pgadmin/dlg/dlgTable.cpp    (working copy)
@@ -146,6 +146,8 @@

 int dlgTable::Go(bool modal)
 {
+    int returncode;
+
     if (!table)
         cbOwner->Append(wxT(""));
     AddGroups();
@@ -496,7 +498,14 @@
         txtFillFactor->Disable();
     }

-    return dlgSecurityProperty::Go();
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


@@ -931,12 +940,8 @@

     lstColumns->SetSize(wxDefaultCoord, wxDefaultCoord,
         ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 150);
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);

-    if (GetAutoLayout())
-    {
-        Layout();
-    }
+    dlgSecurityProperty::OnChangeSize(ev);
 }
 #endif

Index: pgadmin/dlg/dlgPackage.cpp
===================================================================
--- pgadmin/dlg/dlgPackage.cpp    (revision 7489)
+++ pgadmin/dlg/dlgPackage.cpp    (working copy)
@@ -60,6 +60,8 @@
 
 int dlgPackage::Go(bool modal)
 {
+    int returncode;
+
     if (!connection->EdbMinimumVersion(8, 2))
         txtComment->Disable();
 
@@ -82,7 +84,14 @@
 
     }
 
-    return dlgSecurityProperty::Go(modal);
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }
 
 
@@ -104,7 +113,7 @@
 #ifdef __WXMAC__
 void dlgPackage::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    SetPrivilegesLayout();
     if (GetAutoLayout())
     {
         Layout();
Index: pgadmin/dlg/dlgTextSearchDictionary.cpp
===================================================================
--- pgadmin/dlg/dlgTextSearchDictionary.cpp    (revision 7489)
+++ pgadmin/dlg/dlgTextSearchDictionary.cpp    (working copy)
@@ -69,6 +69,7 @@
 {
     wxString qry;
     pgSet *set;
+    int returncode;

     qry = wxT("SELECT tmplname, nspname\n")
           wxT("  FROM pg_ts_template\n")
@@ -120,7 +121,14 @@
     btnAdd->Disable();
     btnRemove->Disable();

-    return dlgProperty::Go(modal);
+    returncode = dlgProperty::Go(modal);
+
+    #ifdef __WXMAC__
+    wxSizeEvent event(wxSize(GetSize().GetWidth() - 25, GetSize().GetHeight() + 130));
+    OnChangeSize(event);
+    #endif
+
+    return returncode;
 }


Index: pgadmin/dlg/dlgTablespace.cpp
===================================================================
--- pgadmin/dlg/dlgTablespace.cpp    (revision 7489)
+++ pgadmin/dlg/dlgTablespace.cpp    (working copy)
@@ -54,6 +54,8 @@

 int dlgTablespace::Go(bool modal)
 {
+    int returncode;
+
     if (!tablespace)
         cbOwner->Append(wxEmptyString);
     AddGroups();
@@ -76,14 +78,21 @@
     if (!connection->BackendMinimumVersion(8, 2))
         txtComment->Disable();

-    return dlgSecurityProperty::Go(modal);
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


 #ifdef __WXMAC__
 void dlgTablespace::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    SetPrivilegesLayout();
     if (GetAutoLayout())
     {
         Layout();
Index: pgadmin/dlg/dlgDatabase.cpp
===================================================================
--- pgadmin/dlg/dlgDatabase.cpp    (revision 7489)
+++ pgadmin/dlg/dlgDatabase.cpp    (working copy)
@@ -95,6 +95,8 @@

 int dlgDatabase::Go(bool modal)
 {
+    int returncode;
+
     if (!database)
         cbOwner->Append(wxT(""));

@@ -228,7 +230,15 @@
     }

     SetupVarEditor(1);
-    return dlgSecurityProperty::Go(modal);
+
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


@@ -244,13 +254,17 @@
 #ifdef __WXMAC__
 void dlgDatabase::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
     lstVariables->SetSize(wxDefaultCoord, wxDefaultCoord,
-        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 550);
+    dlgSecurityProperty::OnChangeSize(ev);
+
+/*
+    SetPrivilegesLayout();
     if (GetAutoLayout())
     {
         Layout();
     }
+*/
 }
 #endif

Index: pgadmin/dlg/dlgIndex.cpp
===================================================================
--- pgadmin/dlg/dlgIndex.cpp    (revision 7489)
+++ pgadmin/dlg/dlgIndex.cpp    (working copy)
@@ -82,6 +82,8 @@

 int dlgIndexBase::Go(bool modal)
 {
+    int returncode;
+
     if (index)
     {
         // edit mode: view only
@@ -120,7 +122,15 @@
     btnAddCol->Disable();
     btnRemoveCol->Disable();

-    return dlgCollistProperty::Go(modal);
+    returncode = dlgCollistProperty::Go(modal);
+
+    #ifdef __WXMAC__
+    //wxSizeEvent event(wxSize(GetSize().GetWidth() - 25, GetSize().GetHeight() + 130));
+    wxSizeEvent event(wxSize(GetSize().GetWidth() - 25, GetSize().GetHeight() + 200));
+    OnChangeSize(event);
+    #endif
+
+    return returncode;
 }


Index: pgadmin/dlg/dlgSequence.cpp
===================================================================
--- pgadmin/dlg/dlgSequence.cpp    (revision 7489)
+++ pgadmin/dlg/dlgSequence.cpp    (working copy)
@@ -64,6 +64,8 @@

 int dlgSequence::Go(bool modal)
 {
+    int returncode;
+
     if (!sequence)
         cbOwner->Append(wxEmptyString);
     AddGroups();
@@ -123,7 +125,14 @@
             wxLogError(_("Failed to disable the TRIGGER privilege checkbox!"));
     }

-    return dlgSecurityProperty::Go(modal);
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


@@ -140,7 +149,7 @@
 #ifdef __WXMAC__
 void dlgSequence::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    SetPrivilegesLayout();
     if (GetAutoLayout())
     {
         Layout();
Index: pgadmin/dlg/dlgView.cpp
===================================================================
--- pgadmin/dlg/dlgView.cpp    (revision 7489)
+++ pgadmin/dlg/dlgView.cpp    (working copy)
@@ -56,6 +56,8 @@

 int dlgView::Go(bool modal)
 {
+    int returncode;
+
     AddGroups();
     AddUsers(cbOwner);

@@ -79,7 +81,14 @@
             wxLogError(_("Failed to disable the RULE privilege checkbox!"));
     }

-    return dlgSecurityProperty::Go(modal);
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


@@ -92,18 +101,6 @@
 }


-#ifdef __WXMAC__
-void dlgView::OnChangeSize(wxSizeEvent &ev)
-{
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
-    if (GetAutoLayout())
-    {
-        Layout();
-    }
-}
-#endif
-
-
 void dlgView::CheckChange()
 {
     wxString name=GetName();
Index: pgadmin/dlg/dlgSchema.cpp
===================================================================
--- pgadmin/dlg/dlgSchema.cpp    (revision 7489)
+++ pgadmin/dlg/dlgSchema.cpp    (working copy)
@@ -44,6 +44,8 @@

 int dlgSchema::Go(bool modal)
 {
+    int returncode;
+
     if (!schema)
         cbOwner->Append(wxT(""));

@@ -67,7 +69,14 @@
         // create mode
     }

-    return dlgSecurityProperty::Go(modal);
+    returncode = dlgSecurityProperty::Go(modal);
+
+#ifdef __WXMAC__
+    SetSize(GetSize().GetWidth()+1, GetSize().GetHeight());
+    SetSize(GetSize().GetWidth()-1, GetSize().GetHeight());
+#endif
+
+    return returncode;
 }


@@ -83,7 +92,7 @@
 #ifdef __WXMAC__
 void dlgSchema::OnChangeSize(wxSizeEvent &ev)
 {
-    SetPrivilegesSize(ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 350);
+    SetPrivilegesLayout();
     if (GetAutoLayout())
     {
         Layout();
Index: pgadmin/dlg/dlgTextSearchConfiguration.cpp
===================================================================
--- pgadmin/dlg/dlgTextSearchConfiguration.cpp    (revision 7489)
+++ pgadmin/dlg/dlgTextSearchConfiguration.cpp    (working copy)
@@ -81,6 +81,7 @@
 {
     wxString qry;
     pgSet *set;
+    int returncode;

     cbParser->Append(wxT(""));

@@ -176,7 +177,14 @@
     btnAdd->Disable();
     btnRemove->Disable();

-    return dlgProperty::Go(modal);
+    returncode = dlgProperty::Go(modal);
+
+    #ifdef __WXMAC__
+    wxSizeEvent event(wxSize(GetSize().GetWidth() - 25, GetSize().GetHeight() + 120));
+    OnChangeSize(event);
+    #endif
+
+    return returncode;
 }


Index: pgadmin/ui/dlgServer.xrc
===================================================================
--- pgadmin/ui/dlgServer.xrc    (revision 7489)
+++ pgadmin/ui/dlgServer.xrc    (working copy)
@@ -2,7 +2,7 @@
 <resource>
   <object class="wxDialog" name="dlgServer">
     <title></title>
-    <size>218,240d</size>
+    <size>218,250d</size>
     <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
     <object class="wxFlexGridSizer">
       <cols>1</cols>
@@ -10,7 +10,7 @@
       <growablecols>0</growablecols>
       <object class="sizeritem">
         <object class="wxNotebook" name="nbNotebook">
-          <size>214,215d</size>
+          <size>214,225d</size>
           <selected>0</selected>
           <object class="notebookpage">
             <label>Properties</label>
Index: pgadmin/ui/dlgSequence.xrc
===================================================================
--- pgadmin/ui/dlgSequence.xrc    (revision 7489)
+++ pgadmin/ui/dlgSequence.xrc    (working copy)
@@ -2,7 +2,7 @@
 <resource>
   <object class="wxDialog" name="dlgSequence">
     <title></title>
-    <size>218,240d</size>
+    <size>218,280d</size>
     <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
     <object class="wxFlexGridSizer">
       <cols>1</cols>
@@ -10,7 +10,7 @@
       <growablecols>0</growablecols>
       <object class="sizeritem">
         <object class="wxNotebook" name="nbNotebook">
-          <size>214,215d</size>
+          <size>214,255d</size>
           <selected>0</selected>
           <object class="notebookpage">
             <label>Properties</label>

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: "Gevik Babakhani"
Дата:
Сообщение: Re: extending functionality strategy
Следующее
От: "Gevik Babakhani"
Дата:
Сообщение: XRC editor DialogBlocks?