Web pgadmin.org
 Home 
 ·  ·  ·  ·  ·  ·  · 
CVS Commit by andreas: fix Query Tool which marked text as changed when

CVS Commit by andreas: fix Query Tool which marked text as changed when



Log Message:
-----------
fix Query Tool which marked text as changed when scrolling
Workaround for wxMSW-2.5.3 malfunctioning combobox
fix Query Tool recent menu
fix column type change sql

Modified Files:
--------------
    pgadmin3/src/include:
        ctlComboBox.h (r1.2 -> r1.3)
        dlgClasses.h (r1.13 -> r1.14)
        dlgOperator.h (r1.8 -> r1.9)
        misc.h (r1.46 -> r1.47)
        version.h (r1.13 -> r1.14)
    pgadmin3/src/ui:
        dlgClasses.cpp (r1.16 -> r1.17)
        dlgColumn.cpp (r1.32 -> r1.33)
        dlgOperator.cpp (r1.20 -> r1.21)
        dlgProperty.cpp (r1.101 -> r1.102)
        frmEditGrid.cpp (r1.59 -> r1.60)
        frmQuery.cpp (r1.75 -> r1.76)

Index: misc.h
===================================================================
RCS file: /projects/pgadmin3/src/include/misc.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -Lsrc/include/misc.h -Lsrc/include/misc.h -u -w -r1.46 -r1.47
--- src/include/misc.h
+++ src/include/misc.h
@@ -57,7 +57,7 @@
 #define CTRL_TEXT(id)           (XRCCTRL(*this, id, wxTextCtrl))
 #define CTRL_LISTBOX(id)        (XRCCTRL(*this, id, wxListBox))
 #define CTRL_LISTCTRL(id)       (XRCCTRL(*this, id, wxListCtrl))
-#define CTRL_COMBOBOX(id)       (XRCCTRL(*this, id, wxComboBox))
+#define CTRL_COMBOBOX(id)       (XRCCTRL(*this, id, wxComboBoxFix))
 #define CTRL_LISTVIEW(id)       ((ctlListView*)(XRCCTRL(*this, id, wxListCtrl)))
 #define CTRL_COMBOBOX2(id)      (XRCCTRL(*this, id, ctlComboBox))
 #define CTRL_CHECKBOX(id)       (XRCCTRL(*this, id, wxCheckBox))
Index: dlgOperator.h
===================================================================
RCS file: /projects/pgadmin3/src/include/dlgOperator.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/include/dlgOperator.h -Lsrc/include/dlgOperator.h -u -w -r1.8 -r1.9
--- src/include/dlgOperator.h
+++ src/include/dlgOperator.h
@@ -35,7 +35,7 @@
     void OnChangeTypeRight(wxCommandEvent &ev);
     void OnChangeJoin(wxCommandEvent &ev);
 
-    void AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBox *cb);
+    void AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBoxFix *cb);
 
     pgSchema *schema;
     pgOperator *oper;
Index: dlgClasses.h
===================================================================
RCS file: /projects/pgadmin3/src/include/dlgClasses.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lsrc/include/dlgClasses.h -Lsrc/include/dlgClasses.h -u -w -r1.13 -r1.14
--- src/include/dlgClasses.h
+++ src/include/dlgClasses.h
@@ -49,6 +49,7 @@
 public:
     pgFrame(wxFrame *parent, const wxString &title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long flags=wxDEFAULT_FRAME_STYLE) 
         : wxFrame(parent, -1, title, pos, size, flags) { changed=false; recentFileMenu=0; }
+    ~pgFrame();
     void RestorePosition(int defaultX=-1, int defaultY=-1, int defaultW=-1, int defaultH=-1, int minW=100, int minH=70);
     void SavePosition();
 
@@ -58,9 +59,11 @@
     void OnExit(wxCommandEvent& event);
     void OnRecent(wxCommandEvent& event);
     void OnAbout(wxCommandEvent& event);
+    void OnHelp(wxCommandEvent& event);
     void OnBugreport(wxCommandEvent& event);
 
     virtual void OpenLastFile() {}
+    virtual wxString GetHelpPage() const { return wxEmptyString; }
 
     void UpdateRecentFiles();
 
Index: ctlComboBox.h
===================================================================
RCS file: /projects/pgadmin3/src/include/ctlComboBox.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/include/ctlComboBox.h -Lsrc/include/ctlComboBox.h -u -w -r1.2 -r1.3
--- src/include/ctlComboBox.h
+++ src/include/ctlComboBox.h
@@ -17,6 +17,16 @@
 #include <wx/wx.h>
 
 
+#ifdef __WXMSW__
+class wxComboBoxFix : public wxComboBox
+{
+public:
+    wxString GetValue() const { return wxGetWindowText(GetHwnd()); }
+};
+#else
+#define wxComboBoxFix wxComboBox
+#endif
+
 class ctlComboBox : public wxComboBox
 {
 public:
@@ -24,6 +34,9 @@
     int GuessSelection();
     int GetGuessedSelection() const;
     wxString GetGuessedStringSelection() const;
+#ifdef __WXMSW__
+    wxString GetValue() const { return wxGetWindowText(GetHwnd()); }
+#endif
 private:
     // MS VC6 will call wxComboBox::GetSelection instead, so we can't overload these.
     int GetSelection() const;
Index: version.h
===================================================================
RCS file: /projects/pgadmin3/src/include/version.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lsrc/include/version.h -Lsrc/include/version.h -u -w -r1.13 -r1.14
--- src/include/version.h
+++ src/include/version.h
@@ -11,9 +11,9 @@
 
 
 // Application Versions
-#define VERSION_STR     wxT("1.2.0 Beta 3")
+#define VERSION_STR     wxT("1.2.0 Post-Beta 3")
 #define VERSION_NUM     1,2,0,0
-#define VERSION_PACKAGE 1.2.0-beta3
+#define VERSION_PACKAGE 1.2.0-post-beta3
 
 #define PRERELEASE 1
 // #define BUILD "..."
Index: dlgClasses.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgClasses.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lsrc/ui/dlgClasses.cpp -Lsrc/ui/dlgClasses.cpp -u -w -r1.16 -r1.17
--- src/ui/dlgClasses.cpp
+++ src/ui/dlgClasses.cpp
@@ -142,6 +142,7 @@
     EVT_MENU(MNU_RECENT+8,              pgFrame::OnRecent)
     EVT_MENU(MNU_RECENT+9,              pgFrame::OnRecent)
     EVT_MENU(MNU_BUGREPORT,             pgFrame::OnBugreport)
+    EVT_MENU(MNU_HELP,                  pgFrame::OnHelp)
     EVT_MENU(MNU_ABOUT,                 pgFrame::OnAbout)
 #ifdef __WXGTK__
     EVT_KEY_DOWN(                       pgFrame::OnKeyDown)
@@ -149,6 +150,12 @@
 END_EVENT_TABLE()
 
 
+pgFrame::~pgFrame()
+{
+    if (!dlgName.IsEmpty())
+        SavePosition();
+}
+
 // Event handlers
 void pgFrame::OnKeyDown(wxKeyEvent& event)
 {
@@ -163,6 +170,13 @@
 }
 
 
+void pgFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
+{
+    wxString page=GetHelpPage();
+    DisplayHelp(this, page);
+}
+
+
 void pgFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     frmAbout *winAbout = new frmAbout(this);
@@ -179,7 +193,7 @@
 void pgFrame::OnRecent(wxCommandEvent& event)
 {
     int fileNo=event.GetId() - MNU_RECENT;
-    lastPath = settings->Read(wxT("RecentFiles/") + wxString::Format(wxT("/%d"), fileNo), wxT(""));
+    lastPath = settings->Read(recentKey + wxString::Format(wxT("/%d"), fileNo), wxT(""));
 
     if (!lastPath.IsNull())
     {
@@ -195,6 +209,12 @@
 
 void pgFrame::UpdateRecentFiles()
 {
+    if (!recentFileMenu)
+        return;
+
+    if (recentKey.IsEmpty())
+        recentKey = dlgName + wxT("/RecentFiles");
+
     wxString lastFiles[10]; // 0 will be unused for convenience
     int i, maxFiles=9;
     int recentIndex=maxFiles;
@@ -226,8 +246,7 @@
 
     for (i=1 ; i <= maxFiles ; i++)
     {
-        settings->Write(wxT("RecentFiles/") + wxString::Format(wxT("%d"), i), lastFiles[i]);
-
+        settings->Write(recentKey + wxString::Format(wxT("/%d"), i), lastFiles[i]);
 
         if (!lastFiles[i].IsNull())
             recentFileMenu->Append(MNU_RECENT+i, wxT("&") + wxString::Format(wxT("%d"), i) + wxT("  ") + lastFiles[i]);
Index: dlgProperty.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.101 -r1.102
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -189,7 +189,7 @@
     if (pos.x >= 0 && pos.y >= 0)
         Move(pos);
 
-    wxComboBox *cbowner = cbOwner;
+    wxComboBoxFix *cbowner = (wxComboBoxFix*)cbOwner;
 
     if (cbowner && !cbowner->GetCount())
     {
Index: dlgOperator.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgOperator.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lsrc/ui/dlgOperator.cpp -Lsrc/ui/dlgOperator.cpp -u -w -r1.20 -r1.21
--- src/ui/dlgOperator.cpp
+++ src/ui/dlgOperator.cpp
@@ -351,7 +351,7 @@
 
 
 
-void dlgOperator::AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBox *cb)
+void dlgOperator::AppendFilledOperator(wxString &sql, wxChar *txt, wxComboBoxFix *cb)
 {
     wxString op=cb->GetValue().Trim();
     if (!op.IsNull())
Index: dlgColumn.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgColumn.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lsrc/ui/dlgColumn.cpp -Lsrc/ui/dlgColumn.cpp -u -w -r1.32 -r1.33
--- src/ui/dlgColumn.cpp
+++ src/ui/dlgColumn.cpp
@@ -193,7 +193,8 @@
                 {
                     sql += wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier()
                         +  wxT(" ALTER ") + qtIdent(name) + wxT(" TYPE ")
-                        +  GetQuotedTypename(cbDatatype->GetGuessedSelection());
+                        +  GetQuotedTypename(cbDatatype->GetGuessedSelection())
+                        +  wxT(";\n");
                 }
             }
             else
Index: frmQuery.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmQuery.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -Lsrc/ui/frmQuery.cpp -Lsrc/ui/frmQuery.cpp -u -w -r1.75 -r1.76
--- src/ui/frmQuery.cpp
+++ src/ui/frmQuery.cpp
@@ -42,7 +42,7 @@
 
 
 
-BEGIN_EVENT_TABLE(frmQuery, wxFrame)
+BEGIN_EVENT_TABLE(frmQuery, pgFrame)
     EVT_CLOSE(                      frmQuery::OnClose)
 	EVT_SET_FOCUS(                  frmQuery::OnSetFocus)
     EVT_MENU(MNU_OPEN,              frmQuery::OnOpen)
@@ -216,6 +216,8 @@
     horizontal->SplitHorizontally(sqlQuery, output, splitpos);
 
     sqlQuery->SetText(query);
+    sqlQuery->Colourise(0, query.Length());
+
     changed = !query.IsNull() && settings->GetStickySql();
     if (changed)
         setExtendedTitle();
@@ -240,7 +242,7 @@
     msgHistory->Disconnect(wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&frmQuery::OnFocus);
 
     mainForm->RemoveFrame(this);
-    SavePosition();
+
     settings->Write(wxT("frmQuery/Split"), horizontal->GetSashPosition());
     settings->SetExplainAnalyze(queryMenu->IsChecked(MNU_ANALYZE));
     settings->SetExplainVerbose(queryMenu->IsChecked(MNU_VERBOSE));
@@ -679,6 +681,7 @@
     if (!str.IsEmpty())
     {
         sqlQuery->SetText(str);
+        sqlQuery->Colourise(0, str.Length());
         wxYield();  // needed to process sqlQuery modify event
         changed = false;
         setExtendedTitle();
Index: frmEditGrid.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmEditGrid.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lsrc/ui/frmEditGrid.cpp -Lsrc/ui/frmEditGrid.cpp -u -w -r1.59 -r1.60
--- src/ui/frmEditGrid.cpp
+++ src/ui/frmEditGrid.cpp
@@ -669,7 +669,7 @@
 {
     wxLogInfo(wxT("Destroying SQL EditGrid"));
     mainForm->RemoveFrame(this);
-    SavePosition();
+
     if (connection)
         delete connection;
 }


Home | Main Index | Thread Index

top