SVN Commit by andreas: r4586 - in trunk/pgadmin3: . src/dlg src/include src/main src/schema - Mailing list pgadmin-hackers

From svn@pgadmin.org
Subject SVN Commit by andreas: r4586 - in trunk/pgadmin3: . src/dlg src/include src/main src/schema
Date
Msg-id 200510211634.j9LGYBQ1004343@developer.pgadmin.org
Whole thread Raw
List pgadmin-hackers
Author: andreas
Date: 2005-10-21 17:34:10 +0100 (Fri, 21 Oct 2005)
New Revision: 4586

Modified:
   trunk/pgadmin3/BUGS.txt
   trunk/pgadmin3/CHANGELOG.txt
   trunk/pgadmin3/src/dlg/dlgIndexConstraint.cpp
   trunk/pgadmin3/src/dlg/dlgProperty.cpp
   trunk/pgadmin3/src/include/dlgProperty.h
   trunk/pgadmin3/src/include/pgConstraints.h
   trunk/pgadmin3/src/main/events.cpp
   trunk/pgadmin3/src/schema/pgConstraints.cpp
   trunk/pgadmin3/src/schema/pgFunction.cpp
Log:
Fix Create a.. toolbar button on collection

Modified: trunk/pgadmin3/BUGS.txt
===================================================================
--- trunk/pgadmin3/BUGS.txt    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/BUGS.txt    2005-10-21 16:34:10 UTC (rev 4586)
@@ -1,5 +1,6 @@
 <b>Known issues</b>
 <ul>
+    <li>[Property] Working with property dialog after the corresponding node is refreshed crashes
     <li>[Edit grid] Editing very large columns freezes (might be restricted to bytea)
     <li>[Edit grid] bool editing doesn't know NULL; major redesign needed
     <li>[Edit grid] sqlGridTextEditor is broken on Mac. We're currently using wxGridCellAutoWrapStringEditor which
worksbut isn't overly user friendly 

Modified: trunk/pgadmin3/CHANGELOG.txt
===================================================================
--- trunk/pgadmin3/CHANGELOG.txt    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/CHANGELOG.txt    2005-10-21 16:34:10 UTC (rev 4586)
@@ -17,6 +17,7 @@
 </ul>
 <br>
 <ul>
+    <li>2005-10-21 AP  1.4B4 Fix Create a.. toolbar button on collection (r: Li Fei)
     <li>2005-10-20 AP  1.4B4 Fix Maintenance crash of disconnected DBs (r: A.J.Langereis)
     <li>2005-10-20 AP  1.4B4 Fix Unicode/pgsql80win32 hint (r: Oryza Triznyak)
     <li>2005-10-20 DP  1.4B4 Ensure the user can cancel the maintenance dialogue when it is running.

Modified: trunk/pgadmin3/src/dlg/dlgIndexConstraint.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgIndexConstraint.cpp    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/dlg/dlgIndexConstraint.cpp    2005-10-21 16:34:10 UTC (rev 4586)
@@ -119,8 +119,8 @@
         sql = wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier()
             + wxT(" ADD");
         AppendIfFilled(sql, wxT(" CONSTRAINT "), qtIdent(name));
-        pgaFactory *f=pgaFactory::GetFactory(objectType);
-        sql +=wxT(" ") + wxString(f->GetTypeName()).Upper() + wxT(" ") + GetDefinition()
+
+        sql +=wxT(" ") + wxString(factory->GetTypeName()).Upper() + wxT(" ") + GetDefinition()
             + wxT(";\n");
     }


Modified: trunk/pgadmin3/src/dlg/dlgProperty.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgProperty.cpp    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/dlg/dlgProperty.cpp    2005-10-21 16:34:10 UTC (rev 4586)
@@ -86,7 +86,6 @@
 dlgProperty::dlgProperty(pgaFactory *f, frmMain *frame, const wxString &resName) : DialogWithHelp(frame)
 {
     readOnly=false;
-    objectType=-1;
     sqlPane=0;
     processing=false;
     mainForm=frame;
@@ -106,7 +105,6 @@
         wxMessageBox(wxString::Format(_("Problem with resource %s: Notebook not found.\nPrepare to crash!"),
resName.c_str()));
         return;
     }
-    objectType = factory->GetId();
     SetIcon(wxIcon(factory->GetImage()));

     txtName = CTRL_TEXT("txtName");
@@ -272,7 +270,7 @@
         wxButton *btn=btnApply;
         if (btn)
             btn->Hide();
-        if (objectType >= 0)
+        if (factory)
             SetTitle(wxGetTranslation(factory->GetNewString()));
     }
     if (statusBar)
@@ -451,7 +449,7 @@
 {
     ctlTree *browser=mainForm->GetBrowser();
     pgCollection *collection = (pgCollection*)browser->GetObject(collectionItem);
-    if (collection && collection->IsCollection() && collection->IsCollectionForType(objectType))
+    if (collection && collection->IsCollection() && factory->GetCollectionFactory() == collection->GetFactory())
     {
         pgObject *data = CreateObject(collection);
         if (data)
@@ -647,14 +645,14 @@
         connection=node->GetConnection();
     database=node->GetDatabase();

-    if (objectType != node->GetType() && !node->IsCollection())
+    if (factory != node->GetFactory() && !node->IsCollection())
     {
         wxCookieType cookie;
         wxTreeItemId collectionItem=frame->GetBrowser()->GetFirstChild(node->GetId(), cookie);
         while (collectionItem)
         {
             pgCollection *collection=(pgCollection*)frame->GetBrowser()->GetObject(collectionItem);
-            if (collection && collection->IsCollection() && collection->IsCollectionForType(objectType))
+            if (collection && collection->IsCollection() && collection->IsCollectionFor(node))
                 break;

             collectionItem=frame->GetBrowser()->GetNextChild(node->GetId(), cookie);
@@ -666,13 +664,13 @@
 }


-dlgProperty *dlgProperty::CreateDlg(frmMain *frame, pgObject *node, bool asNew, int type)
+dlgProperty *dlgProperty::CreateDlg(frmMain *frame, pgObject *node, bool asNew, pgaFactory *factory)
 {
-    if (type < 0)
+    if (!factory)
     {
-        type=node->GetType();
+        factory=node->GetFactory();
         if (node->IsCollection())
-            type++;
+            factory = ((pgaCollectionFactory*)factory)->GetItemFactory();
     }

     pgObject *currentNode, *parentNode;
@@ -681,7 +679,7 @@
     else
         currentNode=node;

-    if (type != node->GetType())
+    if (factory != node->GetFactory())
         parentNode = node;
     else
         parentNode = frame->GetBrowser()->GetObject(
@@ -693,8 +691,6 @@

     dlgProperty *dlg=0;

-    pgaFactory *factory=pgaFactory::GetFactory(type);
-
     if (factory)
     {
         dlg = factory->CreateDialog(frame, currentNode, parentNode);
@@ -711,7 +707,7 @@
 }


-bool dlgProperty::CreateObjectDialog(frmMain *frame, pgObject *node, int type)
+bool dlgProperty::CreateObjectDialog(frmMain *frame, pgObject *node, pgaFactory *factory)
 {
     if (node->GetMetaType() != PGM_SERVER)
     {
@@ -719,7 +715,7 @@
         if (!conn || conn->GetStatus() != PGCONN_OK || !conn->IsAlive())
             return false;
     }
-    dlgProperty *dlg=CreateDlg(frame, node, true, type);
+    dlgProperty *dlg=CreateDlg(frame, node, true, factory);

     if (dlg)
     {
@@ -1344,7 +1340,7 @@

 wxWindow *createFactory::StartDialog(frmMain *form, pgObject *obj)
 {
-    if (!dlgProperty::CreateObjectDialog(form, obj, -1))
+    if (!dlgProperty::CreateObjectDialog(form, obj, 0))
         form->CheckAlive();

     return 0;

Modified: trunk/pgadmin3/src/include/dlgProperty.h
===================================================================
--- trunk/pgadmin3/src/include/dlgProperty.h    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/include/dlgProperty.h    2005-10-21 16:34:10 UTC (rev 4586)
@@ -31,7 +31,7 @@
 class dlgProperty : public DialogWithHelp
 {
 public:
-    static bool CreateObjectDialog(frmMain *frame, pgObject *node, int type);
+    static bool CreateObjectDialog(frmMain *frame, pgObject *node, pgaFactory *factory=0);
     static bool EditObjectDialog(frmMain *frame, ctlSQLBox *sqlbox, pgObject *node);
     void InitDialog(frmMain *frame, pgObject *node);

@@ -57,7 +57,7 @@
     void ShowObject();

     void CheckValid(bool &enable, const bool condition, const wxString &msg);
-    static dlgProperty *CreateDlg(frmMain *frame, pgObject *node, bool asNew, int type=-1);
+    static dlgProperty *CreateDlg(frmMain *frame, pgObject *node, bool asNew, pgaFactory *factory=0);
     void AppendNameChange(wxString &sql, const wxString &objname=wxEmptyString);
     void AppendOwnerChange(wxString &sql, const wxString &objName=wxEmptyString);
     void AppendOwnerNew(wxString &sql, const wxString &objname);
@@ -101,7 +101,6 @@

     int width, height;
     wxTreeItemId item;
-    int objectType;
     bool readOnly;
     bool processing;
     pgaFactory *factory;

Modified: trunk/pgadmin3/src/include/pgConstraints.h
===================================================================
--- trunk/pgadmin3/src/include/pgConstraints.h    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/include/pgConstraints.h    2005-10-21 16:34:10 UTC (rev 4586)
@@ -22,6 +22,7 @@
     pgConstraintCollection(pgaFactory *factory, pgTable *table);
     ~pgConstraintCollection();
     wxString GetHelpPage(bool forCreate) const { return wxT("pg/sql-altertable"); }
+    bool CanCreate() { return false; }
     wxMenu *GetNewMenu();

     void ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane);

Modified: trunk/pgadmin3/src/main/events.cpp
===================================================================
--- trunk/pgadmin3/src/main/events.cpp    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/main/events.cpp    2005-10-21 16:34:10 UTC (rev 4586)
@@ -692,7 +692,7 @@
             if (nextItem)
                 browser->SelectItem(nextItem);
         }
-        int droppedType = data->GetType();
+        pgaFactory *droppedCollFactory = data->GetFactory()->GetCollectionFactory();
         browser->Delete(data->GetId());
         // data is invalid now

@@ -704,7 +704,7 @@
             while (parentItem)
             {
                 collection = (pgCollection*)browser->GetObject(parentItem);
-                if (collection && collection->IsCollection() && collection->IsCollectionForType(droppedType))
+                if (collection && collection->IsCollection() && collection->GetFactory() == droppedCollFactory)
                 {
                     collection->UpdateChildCount(browser);
                     break;
@@ -733,7 +733,7 @@

     if (currentObject)
     {
-        if (!dlgProperty::CreateObjectDialog(this, currentObject, type))
+        if (!dlgProperty::CreateObjectDialog(this, currentObject, 0))
             CheckAlive();
     }
 }

Modified: trunk/pgadmin3/src/schema/pgConstraints.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgConstraints.cpp    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/schema/pgConstraints.cpp    2005-10-21 16:34:10 UTC (rev 4586)
@@ -77,7 +77,6 @@
 pgConstraintFactory::pgConstraintFactory()
 : pgTableObjFactory(__("Constraint"), 0, 0, 0)
 {
-    metaType = PGM_CHECK;
 }

 pgCollection *pgConstraintFactory::CreateCollection(pgObject *obj)

Modified: trunk/pgadmin3/src/schema/pgFunction.cpp
===================================================================
--- trunk/pgadmin3/src/schema/pgFunction.cpp    2005-10-20 15:35:27 UTC (rev 4585)
+++ trunk/pgadmin3/src/schema/pgFunction.cpp    2005-10-21 16:34:10 UTC (rev 4586)
@@ -388,8 +388,6 @@
     return AppendFunctions(collection, collection->GetSchema(), browser, funcRestriction);
 }

-//            if (parentNode->GetType() == PG_TRIGGER)
-//                parentNode = ((pgTrigger*)parentNode)->GetSchema();

 pgObject *pgProcedureFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restr)
 {


pgadmin-hackers by date:

Previous
From: "Dave Page"
Date:
Subject:
Next
From: Andreas Pflug
Date:
Subject: Re: