Re: Buglets in dlgFunction - Mailing list pgadmin-hackers

From Guillaume Lelarge
Subject Re: Buglets in dlgFunction
Date
Msg-id 48EE31A8.5080204@lelarge.info
Whole thread Raw
In response to Re: Buglets in dlgFunction  (Guillaume Lelarge <guillaume@lelarge.info>)
Responses Re: Buglets in dlgFunction
List pgadmin-hackers
Guillaume Lelarge a écrit :
> Dave Page a écrit :
>> On Tue, Oct 7, 2008 at 1:26 PM, Guillaume Lelarge
>> <guillaume@lelarge.info> wrote:
>>> It seems I finally get something working. But not yet for dlgFunction.
>>> Can you take a look at it? I just want to know if I haven't break other
>>> things. If it works, I will commit this patch and work on the
>>> dlgFunction.cpp file.
>>>
>> OK, testing on OS X Leopard, I see
>>
>
> Only dlgSchema crashes on my Mac Mini. I'll work on this one tomorrow.
> None of the others crash. Did it crash for every table/sequence/view or
> just a specific one ?
>

OK, problem was in the CreateColumns function, file
pgadmin/ctl/ctlListView.cpp. Complete patch attached.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: pgadmin/ctl/ctlListView.cpp
===================================================================
--- pgadmin/ctl/ctlListView.cpp    (révision 7488)
+++ pgadmin/ctl/ctlListView.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/include/dlg/dlgView.h    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/include/dlg/dlgProperty.h    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/agent/dlgJob.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/dlg/dlgProperty.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/dlg/dlgFunction.cpp    (copie de travail)
@@ -153,6 +153,8 @@

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

     SetupVarEditor(1);
-    return dlgSecurityProperty::Go(modal);
+
+    returncode = dlgSecurityProperty::Go(modal);
+
+    #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    (révision 7488)
+++ pgadmin/dlg/dlgTable.cpp    (copie de travail)
@@ -931,12 +931,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    (révision 7488)
+++ pgadmin/dlg/dlgPackage.cpp    (copie de travail)
@@ -104,7 +104,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    (révision 7488)
+++ pgadmin/dlg/dlgTextSearchDictionary.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/dlg/dlgTablespace.cpp    (copie de travail)
@@ -83,7 +83,7 @@
 #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    (révision 7488)
+++ pgadmin/dlg/dlgDatabase.cpp    (copie de travail)
@@ -244,13 +244,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    (révision 7488)
+++ pgadmin/dlg/dlgIndex.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/dlg/dlgSequence.cpp    (copie de travail)
@@ -140,7 +140,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    (révision 7488)
+++ pgadmin/dlg/dlgView.cpp    (copie de travail)
@@ -92,18 +92,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    (révision 7488)
+++ pgadmin/dlg/dlgSchema.cpp    (copie de travail)
@@ -83,7 +83,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    (révision 7488)
+++ pgadmin/dlg/dlgTextSearchConfiguration.cpp    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/ui/dlgServer.xrc    (copie de travail)
@@ -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    (révision 7488)
+++ pgadmin/ui/dlgSequence.xrc    (copie de travail)
@@ -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 by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: Buglets in dlgFunction
Next
From: "Dave Page"
Date:
Subject: Re: Buglets in dlgFunction