Web pgadmin.org
 Home 
 ·  ·  ·  ·  ·  ·  · 
CVS Commit by andreas: Workaround for wxGrid bug not returning selected

CVS Commit by andreas: Workaround for wxGrid bug not returning selected



Log Message:
-----------
Workaround for wxGrid bug not returning selected rows
Fix user/group selection in privileges (r: Walter Haslbeck, Gary Doades)
Fix refresh when dropping single object from collection listview

Modified Files:
--------------
    pgadmin3:
        CHANGELOG.txt (r1.154 -> r1.155)
    pgadmin3/src/include:
        ctlSecurityPanel.h (r1.3 -> r1.4)
        frmEditGrid.h (r1.18 -> r1.19)
    pgadmin3/src/ui:
        ctlSecurityPanel.cpp (r1.6 -> r1.7)
        dlgProperty.cpp (r1.102 -> r1.103)
        events.cpp (r1.118 -> r1.119)
        frmEditGrid.cpp (r1.61 -> r1.62)
        frmMain.cpp (r1.110 -> r1.111)

Index: CHANGELOG.txt
===================================================================
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.154
retrieving revision 1.155
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.154 -r1.155
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -17,6 +17,10 @@
 </ul>
 <br>
 <ul>
+    <li>2004-10-27 AP  1.2B4 Workaround for wxGrid bug not returning selected rows
+    <li>2004-10-27 AP  1.2B4 Fix user/group selection in privileges (r: Walter Haslbeck, Gary Doades)
+    <li>2004-10-27 AP  1.2B4 Fix refresh when dropping single object from collection listview
+    <li>2004-10-26 AP  1.2B4 fix $$ translation problem (r: Miha Radej)
     <li>2004-10-22 AP  1.2B4 fix Edit Tool to store data when selecting a row (r: Virgil Frum)
     <li>2004-10-22 AP  1.2B4 fix Query Tool which marked text as changed when scrolling (r: Gary Doades)
     <li>2004-10-22 AP  1.2B4 Workaround for wxMSW-2.5.3 malfunctioning combobox (r: Gary Doades)
Index: frmEditGrid.h
===================================================================
RCS file: /projects/pgadmin3/src/include/frmEditGrid.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lsrc/include/frmEditGrid.h -Lsrc/include/frmEditGrid.h -u -w -r1.18 -r1.19
--- src/include/frmEditGrid.h
+++ src/include/frmEditGrid.h
@@ -74,6 +74,7 @@
     sqlTable *GetTable() { return (sqlTable*)wxGrid::GetTable(); }
     wxSize GetBestSize(int row, int col);
     void ResizeEditor(int row, int col);
+    wxArrayInt GetSelectedRows() const;
 
 #if wxCHECK_VERSION(2,5,0)
     // problems are fixed
Index: ctlSecurityPanel.h
===================================================================
RCS file: /projects/pgadmin3/src/include/ctlSecurityPanel.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lsrc/include/ctlSecurityPanel.h -Lsrc/include/ctlSecurityPanel.h -u -w -r1.3 -r1.4
--- src/include/ctlSecurityPanel.h
+++ src/include/ctlSecurityPanel.h
@@ -58,6 +58,7 @@
 
     void OnPrivSelChange(wxListEvent &ev);
     void OnAddPriv(wxCommandEvent& ev);
+    void OnGroupChange(wxCommandEvent &ev);
     void OnDelPriv(wxCommandEvent& ev);
     void OnPrivCheck(wxCommandEvent& ev);
     void OnPrivCheckAll(wxCommandEvent& ev);
Index: dlgProperty.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.102 -r1.103
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -398,24 +398,24 @@
         {
             wxString nodeName=data->GetFullName();
             size_t pos=0;
-            wxTreeItemId item;
+            wxTreeItemId newItem;
 
             if (data->GetType() != PG_COLUMN)
             {
                 // columns should be appended, not inserted alphabetically
 
                 wxCookieType cookie;
-                item=browser->GetFirstChild(collectionItem, cookie);
-                while (item)
+                newItem=browser->GetFirstChild(collectionItem, cookie);
+                while (newItem)
                 {
-                    if (browser->GetItemText(item) > nodeName)
+                    if (browser->GetItemText(newItem) > nodeName)
                         break;
                     pos++;
-                    item=browser->GetNextChild(collectionItem, cookie);
+                    newItem=browser->GetNextChild(collectionItem, cookie);
                 }
             }
 
-            if (item)
+            if (newItem)
                 browser->InsertItem(collectionItem, pos, nodeName, data->GetIcon(), -1, data);
             else    
                 browser->AppendItem(collectionItem, nodeName, data->GetIcon(), -1, data);
@@ -423,7 +423,7 @@
             if (data->WantDummyChild())
                 browser->AppendItem(data->GetId(), wxT("Dummy"));
 
-            if (browser->GetSelection() == collectionItem)
+            if (browser->GetSelection() == item)
                 collection->ShowTreeDetail(browser, 0, mainForm->GetProperties());
             else
                 collection->UpdateChildCount(browser);
@@ -479,6 +479,7 @@
                 break;
             collectionItem=mainForm->GetBrowser()->GetItemParent(collectionItem);
         }
+
         /*
         if (!collectionItem)
         {
Index: frmEditGrid.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmEditGrid.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -Lsrc/ui/frmEditGrid.cpp -Lsrc/ui/frmEditGrid.cpp -u -w -r1.61 -r1.62
--- src/ui/frmEditGrid.cpp
+++ src/ui/frmEditGrid.cpp
@@ -835,6 +835,45 @@
 
 
 
+wxArrayInt ctlSQLGrid::GetSelectedRows() const
+{
+    wxArrayInt rows, rows2;
+
+    wxGridCellCoordsArray tl=GetSelectionBlockTopLeft(), br=GetSelectionBlockBottomRight();
+
+    int maxCol=((ctlSQLGrid*)this)->GetNumberCols() -1;
+    size_t i;
+    for (i=0 ; i < tl.GetCount() ; i++)
+    {
+        wxGridCellCoords c1=tl.Item(i), c2=br.Item(i);
+        if (c1.GetCol() != 0 || c2.GetCol() != maxCol)
+            return rows2;
+
+        int j;
+        for (j=c1.GetRow() ; j <= c2.GetRow() ; j++)
+            rows.Add(j);
+    }
+
+    rows2=wxGrid::GetSelectedRows();
+
+    rows.Sort(ArrayCmp);
+    rows2.Sort(ArrayCmp);
+
+    size_t i2=0, cellRowMax=rows.GetCount();
+
+    for (i=0 ; i < rows2.GetCount() ; i++)
+    {
+        int row=rows2.Item(i);
+        while (i2 < cellRowMax && rows.Item(i2) < row)
+            i2++;
+        if (i2 == cellRowMax || row != rows.Item(i2))
+            rows.Add(row);
+    }
+
+    return rows;
+}
+
+
 class sqlGridTextEditor : public wxGridCellTextEditor
 {
 public:
Index: events.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/events.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -Lsrc/ui/events.cpp -Lsrc/ui/events.cpp -u -w -r1.118 -r1.119
--- src/ui/events.cpp
+++ src/ui/events.cpp
@@ -685,6 +685,8 @@
 
 void frmMain::execSelChange(wxTreeItemId item, bool currentNode)
 {
+    if (currentNode)
+    {
     properties->ClearAll();
     properties->AddColumn(_("Properties"), 500);
     properties->InsertItem(0, _("No properties are available for the current selection"), PGICON_PROPERTY);
@@ -693,7 +695,7 @@
     // Reset the toolbar & password menu options
 	// Handle the menus associated with the buttons
     SetButtons(0);
-
+    }
 
     // Get the item data, and feed it to the relevant handler,
     // cast as required.
@@ -1136,9 +1138,9 @@
                 if (properties->GetSelectedItemCount() == 1)
                 {
                     dropSingleObject(data, false);
-                    return;
                 }
-
+                else
+                {
                 if (data->RequireDropConfirm() || settings->GetConfirmDelete())
                 {
                     wxMessageDialog msg(this, _("Are you sure you wish to drop multiple objects?"),
@@ -1174,6 +1176,7 @@
                             data=collection->FindChild(browser, index);
                     }
                 }
+                }
                 Refresh(collection);
             }
         }
Index: frmMain.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmMain.cpp,v
retrieving revision 1.110
retrieving revision 1.111
diff -Lsrc/ui/frmMain.cpp -Lsrc/ui/frmMain.cpp -u -w -r1.110 -r1.111
--- src/ui/frmMain.cpp
+++ src/ui/frmMain.cpp
@@ -431,7 +431,7 @@
         }
     }
     if (currentItem)
-        execSelChange(currentItem, true);
+        execSelChange(currentItem, currentItem == browser->GetSelection());
     browser->Thaw();
     EndMsg();
 }
Index: ctlSecurityPanel.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/ctlSecurityPanel.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lsrc/ui/ctlSecurityPanel.cpp -Lsrc/ui/ctlSecurityPanel.cpp -u -w -r1.6 -r1.7
--- src/ui/ctlSecurityPanel.cpp
+++ src/ui/ctlSecurityPanel.cpp
@@ -27,6 +27,7 @@
     EVT_LIST_ITEM_SELECTED(CTL_LBPRIV,  ctlSecurityPanel::OnPrivSelChange)
     EVT_BUTTON(CTL_ADDPRIV,             ctlSecurityPanel::OnAddPriv)
     EVT_BUTTON(CTL_DELPRIV,             ctlSecurityPanel::OnDelPriv)
+    EVT_TEXT(CTL_CBGROUP,               ctlSecurityPanel::OnGroupChange)
     EVT_CHECKBOX(CTL_ALLPRIV,           ctlSecurityPanel::OnPrivCheckAll)
     EVT_CHECKBOX(CTL_ALLPRIVGRANT,      ctlSecurityPanel::OnPrivCheckAllGrant)
     EVT_CHECKBOX(CTL_PRIVCB,            ctlSecurityPanel::OnPrivCheck)
@@ -215,6 +216,15 @@
 }
 
 
+void ctlSecurityPanel::OnGroupChange(wxCommandEvent &ev)
+{
+    cbGroups->GuessSelection();
+    wxString name=cbGroups->GetGuessedStringSelection();
+
+    btnAddPriv->Enable(!name.Strip(wxString::both).IsEmpty());
+}
+
+    
 void ctlSecurityPanel::OnPrivCheckAll(wxCommandEvent& ev)
 {
     bool all=allPrivileges->GetValue();
@@ -278,7 +288,7 @@
 
 void ctlSecurityPanel::OnAddPriv(wxCommandEvent &ev)
 {
-    wxString name=cbGroups->GetValue();
+    wxString name=cbGroups->GetGuessedStringSelection();
 
     long pos=lbPrivileges->FindItem(-1, name);
     if (pos < 0)
@@ -348,6 +358,7 @@
             CheckGrantOpt(i);
         }
     }
+    btnAddPriv->Enable();
 }
 
 


Home | Main Index | Thread Index

top