diff --git a/pgadmin/agent/pgaJob.cpp b/pgadmin/agent/pgaJob.cpp index 4d28fef..3b85086 100644 --- a/pgadmin/agent/pgaJob.cpp +++ b/pgadmin/agent/pgaJob.cpp @@ -149,7 +149,7 @@ pgObject *pgaJob::Refresh(ctlTree *browser, const wxTreeItemId item) pgObject *job = 0; pgObject *obj = browser->GetObject(browser->GetItemParent(item)); - if (obj->IsCollection()) + if (obj && obj->IsCollection()) job = jobFactory.CreateObjects((pgCollection *)obj, 0, wxT("\n WHERE j.jobid=") + NumToStr(GetRecId())); return job; diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp index b07d3e7..687cfdf 100644 --- a/pgadmin/ctl/ctlSQLBox.cpp +++ b/pgadmin/ctl/ctlSQLBox.cpp @@ -236,7 +236,7 @@ bool ctlSQLBox::ReplaceAll(const wxString &find, const wxString &replace, bool w wxString msg; msg.Printf(wxPLURAL("%d replacement made.", "%d replacements made.", count), count); - wxMessageBox(msg, _("Replace all")); + wxMessageBox(msg, _("Replace all"), wxOK | wxICON_INFORMATION); if (count) return true; diff --git a/pgadmin/db/pgConn.cpp b/pgadmin/db/pgConn.cpp index ea2dc23..7e9895c 100644 --- a/pgadmin/db/pgConn.cpp +++ b/pgadmin/db/pgConn.cpp @@ -664,7 +664,7 @@ void pgConn::Notice(const char *msg) // Display the notice if required if (settings->GetShowNotices()) - wxMessageBox(str, _("Notice"), wxICON_INFORMATION); + wxMessageBox(str, _("Notice"), wxICON_INFORMATION | wxOK); wxLogNotice(wxT("%s"), str.Trim().c_str()); } diff --git a/pgadmin/dd/dditems/figures/ddRelationshipFigure.cpp b/pgadmin/dd/dditems/figures/ddRelationshipFigure.cpp index 92dbbf3..b097a1c 100644 --- a/pgadmin/dd/dditems/figures/ddRelationshipFigure.cpp +++ b/pgadmin/dd/dditems/figures/ddRelationshipFigure.cpp @@ -241,7 +241,7 @@ void ddRelationshipFigure::updateForeignKey() } else { - wxMessageBox(wxT("Error invalid kind of start figure at relationship"), wxT("Error invalid kind of start figure at relationship"), wxICON_ERROR); + wxMessageBox(wxT("Error invalid kind of start figure at relationship"), wxT("Error invalid kind of start figure at relationship"), wxICON_ERROR | wxOK); } } diff --git a/pgadmin/dd/ddmodel/ddDBReverseEnginering.cpp b/pgadmin/dd/ddmodel/ddDBReverseEnginering.cpp index 3762f14..7377371 100644 --- a/pgadmin/dd/ddmodel/ddDBReverseEnginering.cpp +++ b/pgadmin/dd/ddmodel/ddDBReverseEnginering.cpp @@ -172,7 +172,7 @@ OID ddImportDBUtils::getSchemaOID(pgConn *connection, wxString schemaName) if(times > 1 || schemaOID == -1) { - wxMessageBox(_("Schema not found"), _("getting table OID"), wxICON_ERROR); + wxMessageBox(_("Schema not found"), _("getting table OID"), wxICON_ERROR | wxOK); return -1; } return schemaOID; @@ -213,7 +213,7 @@ OID ddImportDBUtils::getTableOID(pgConn *connection, wxString schemaName, wxStri if(times > 1 || tableOID == -1) { - wxMessageBox(_("Table not found"), _("getting table OID"), wxICON_ERROR); + wxMessageBox(_("Table not found"), _("getting table OID"), wxICON_ERROR | wxOK); return -1; } return tableOID; @@ -657,7 +657,7 @@ void ddImportDBUtils::getAllRelationships(pgConn *connection, stubTablesHashMap if(baseUkIdxSourceCol != baseUkIdxSourceCol) { error = true; - wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR | wxOK); return; } } @@ -670,7 +670,7 @@ void ddImportDBUtils::getAllRelationships(pgConn *connection, stubTablesHashMap //Last check of consistency if(fkFromPk == false && ukIndex < 0) { - wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR | wxOK); return; } @@ -776,7 +776,7 @@ void ddImportDBUtils::getAllRelationships(pgConn *connection, stubTablesHashMap } else { - wxMessageBox(_("Error detecting kind of foreign key: null or not null"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key: null or not null"), _("Error importing relationship"), wxICON_ERROR | wxOK); return; } @@ -1136,7 +1136,7 @@ bool ddImportDBUtils::isModelSameDbFk(pgConn *connection, OID destTableOid, wxSt if(baseUkIdxSourceCol != baseUkIdxSourceCol) { error = true; - wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR | wxOK); return false; } } @@ -1149,7 +1149,7 @@ bool ddImportDBUtils::isModelSameDbFk(pgConn *connection, OID destTableOid, wxSt //Last check of consistency if(fkFromPk == false && ukIndex < 0) { - wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key source: from Pk or from Uk"), _("Error importing relationship"), wxICON_ERROR | wxOK); return false; } @@ -1249,7 +1249,7 @@ bool ddImportDBUtils::isModelSameDbFk(pgConn *connection, OID destTableOid, wxSt } else { - wxMessageBox(_("Error detecting kind of foreign key: null or not null"), _("Error importing relationship"), wxICON_ERROR); + wxMessageBox(_("Error detecting kind of foreign key: null or not null"), _("Error importing relationship"), wxICON_ERROR | wxOK); return false; } delete sourceStubTable; @@ -1319,7 +1319,7 @@ bool ddImportDBUtils::isModelSameDbFk(pgConn *connection, OID destTableOid, wxSt } else { - wxMessageBox(_("Error fk is repeated"), _("Error comparing relationships"), wxICON_ERROR); + wxMessageBox(_("Error fk is repeated"), _("Error comparing relationships"), wxICON_ERROR | wxOK); } delete foreignKeys; diff --git a/pgadmin/dd/ddmodel/ddDatabaseDesign.cpp b/pgadmin/dd/ddmodel/ddDatabaseDesign.cpp index 10e3283..ba54440 100644 --- a/pgadmin/dd/ddmodel/ddDatabaseDesign.cpp +++ b/pgadmin/dd/ddmodel/ddDatabaseDesign.cpp @@ -139,7 +139,7 @@ wxString ddDatabaseDesign::generateList(wxArrayString tables, wxArrayInt options if(tables.Count() != options.Count()) { // shouldn't it be a WXASSERT? - wxMessageBox(_("Invalid number of arguments in call of function generate tables of list"), _("Error at generation process"), wxICON_ERROR); + wxMessageBox(_("Invalid number of arguments in call of function generate tables of list"), _("Error at generation process"), wxICON_ERROR | wxOK); return wxEmptyString; } @@ -150,7 +150,7 @@ wxString ddDatabaseDesign::generateList(wxArrayString tables, wxArrayInt options if(table == NULL) { // shouldn't it be a WXASSERT? - wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error at generation process"), wxICON_ERROR); + wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error at generation process"), wxICON_ERROR | wxOK); return wxEmptyString; } } @@ -240,14 +240,14 @@ wxString ddDatabaseDesign::generateList(wxArrayString tables, wxArrayInt options if(countAlter > 0 && connection == NULL) { - wxMessageBox(_("No connection found when building ALTER objects DDL."), _("Error at generation process"), wxICON_ERROR); + wxMessageBox(_("No connection found when building ALTER objects DDL."), _("Error at generation process"), wxICON_ERROR | wxOK); return out; } else if(countAlter > 0 && connection != NULL) { if(schemaName.IsEmpty()) { - wxMessageBox(_("Schema defined when building ALTER TABLE DDL"), _("Error at generation process"), wxICON_ERROR); + wxMessageBox(_("Schema defined when building ALTER TABLE DDL"), _("Error at generation process"), wxICON_ERROR | wxOK); return out; } out += wxT(" \n"); @@ -559,13 +559,13 @@ bool ddDatabaseDesign::writeXmlModel(wxString file) xmlWriter = xmlNewTextWriterFilename(file.mb_str(wxConvUTF8), 0); if (xmlWriter == NULL) { - wxMessageBox(_("Failed to write the model file!"), _("Error"), wxICON_ERROR); + wxMessageBox(_("Failed to write the model file!"), _("Error"), wxICON_ERROR | wxOK); return false; } rc = xmlTextWriterStartDocument(xmlWriter, NULL, "UTF-8" , NULL); if(rc < 0) { - wxMessageBox(_("Failed to write the model file!"), _("Error"), wxICON_ERROR); + wxMessageBox(_("Failed to write the model file!"), _("Error"), wxICON_ERROR | wxOK); return false; } else diff --git a/pgadmin/dd/ddmodel/ddDrawingView.cpp b/pgadmin/dd/ddmodel/ddDrawingView.cpp index c996fab..7ffaa68 100644 --- a/pgadmin/dd/ddmodel/ddDrawingView.cpp +++ b/pgadmin/dd/ddmodel/ddDrawingView.cpp @@ -83,7 +83,7 @@ bool ddDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString &text) { if(target->includes(t)) { - wxMessageBox(_("Table exists already at this diagram"), _("Drag and drop warning"), wxICON_EXCLAMATION); + wxMessageBox(_("Table exists already at this diagram"), _("Drag and drop warning"), wxICON_EXCLAMATION | wxOK); return true; } else diff --git a/pgadmin/dd/ddmodel/ddGenerationWizard.cpp b/pgadmin/dd/ddmodel/ddGenerationWizard.cpp index a948d07..c00ee3c 100644 --- a/pgadmin/dd/ddmodel/ddGenerationWizard.cpp +++ b/pgadmin/dd/ddmodel/ddGenerationWizard.cpp @@ -576,7 +576,7 @@ void ReportGridPage::populateGrid() } else if(table == NULL) { - wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error at generation process"), wxICON_ERROR); + wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error at generation process"), wxICON_ERROR | wxOK); return; } } @@ -595,7 +595,7 @@ void ReportGridPage::populateGrid() } else if(table == NULL) { - wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error importing at generation process"), wxICON_ERROR); + wxMessageBox(_("Metadata of table to be generated not found at database designer model"), _("Error importing at generation process"), wxICON_ERROR | wxOK); return; } diff --git a/pgadmin/dd/ddmodel/ddModelBrowser.cpp b/pgadmin/dd/ddmodel/ddModelBrowser.cpp index 882c725..6ce7eb4 100644 --- a/pgadmin/dd/ddmodel/ddModelBrowser.cpp +++ b/pgadmin/dd/ddmodel/ddModelBrowser.cpp @@ -108,7 +108,7 @@ void ddModelBrowser::OnBeginDrag(wxTreeEvent &event) wxDragResult result = dragSource.DoDragDrop(wxDrag_CopyOnly); if(result != wxDragCopy) { - wxMessageBox(wxT("Invalid kind of data during drag and drop operation"), wxT("Drag and drop error"), wxICON_ERROR); + wxMessageBox(wxT("Invalid kind of data during drag and drop operation"), wxT("Drag and drop error"), wxICON_ERROR | wxOK); } } } diff --git a/pgadmin/dlg/dlgEditGridOptions.cpp b/pgadmin/dlg/dlgEditGridOptions.cpp index 0e17960..803311c 100644 --- a/pgadmin/dlg/dlgEditGridOptions.cpp +++ b/pgadmin/dlg/dlgEditGridOptions.cpp @@ -253,7 +253,7 @@ void dlgEditGridOptions::OnChangeSize(wxSizeEvent &ev) void dlgEditGridOptions::OnValidate(wxCommandEvent &ev) { if (Validate()) - wxMessageBox(_("Filter string syntax validates OK!"), _("Syntax Validation"), wxICON_INFORMATION); + wxMessageBox(_("Filter string syntax validates OK!"), _("Syntax Validation"), wxICON_INFORMATION | wxOK); } void dlgEditGridOptions::OnCboColumnsChange(wxCommandEvent &ev) diff --git a/pgadmin/dlg/dlgManageMacros.cpp b/pgadmin/dlg/dlgManageMacros.cpp index 526e9d6..6cc03f4 100644 --- a/pgadmin/dlg/dlgManageMacros.cpp +++ b/pgadmin/dlg/dlgManageMacros.cpp @@ -174,7 +174,7 @@ void dlgManageMacros::SetMacro(bool silent) else if ((Name.IsEmpty() && !query.IsEmpty()) || (!Name.IsEmpty() && query.IsEmpty())) { if (!silent) - wxMessageBox(_("You must specify a query and a name for the macro"), _("Save macro"), wxICON_EXCLAMATION); + wxMessageBox(_("You must specify a query and a name for the macro"), _("Save macro"), wxICON_EXCLAMATION | wxOK); return; } else diff --git a/pgadmin/dlg/dlgSelectConnection.cpp b/pgadmin/dlg/dlgSelectConnection.cpp index 89f0de9..568f747 100644 --- a/pgadmin/dlg/dlgSelectConnection.cpp +++ b/pgadmin/dlg/dlgSelectConnection.cpp @@ -322,7 +322,7 @@ int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; cbServer->Append(server->GetIdentifier(), (void *)server); diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp index 49ac0fd..0063349 100644 --- a/pgadmin/frm/events.cpp +++ b/pgadmin/frm/events.cpp @@ -1086,7 +1086,7 @@ void frmMain::OnAuiNotebookPageClose(wxAuiNotebookEvent &event) // Prevent the user closing the four main tabs. if (event.GetSelection() < 4) { - wxMessageBox(_("This tab cannot be closed."), _("Close tab"), wxICON_INFORMATION); + wxMessageBox(_("This tab cannot be closed."), _("Close tab"), wxICON_INFORMATION | wxOK); event.Veto(); return; } diff --git a/pgadmin/frm/frmConfig.cpp b/pgadmin/frm/frmConfig.cpp index f3a9e68..10e2620 100644 --- a/pgadmin/frm/frmConfig.cpp +++ b/pgadmin/frm/frmConfig.cpp @@ -425,7 +425,7 @@ void frmConfig::DisplayHint(bool force) str = _("No configuration setting detected that appears doubtful."); } - wxMessageBox(str, _("Backend Configuration Hints"), wxICON_EXCLAMATION); + wxMessageBox(str, _("Backend Configuration Hints"), wxICON_EXCLAMATION | wxOK); } diff --git a/pgadmin/frm/frmDatabaseDesigner.cpp b/pgadmin/frm/frmDatabaseDesigner.cpp index e9b8a5e..b99e3cd 100644 --- a/pgadmin/frm/frmDatabaseDesigner.cpp +++ b/pgadmin/frm/frmDatabaseDesigner.cpp @@ -185,7 +185,7 @@ frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString &_title, sqltext = new ctlSQLBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2); //Now, the Objects Browser - wxSizer *browserSizer = new wxBoxSizer(wxALL); + wxSizer *browserSizer = new wxBoxSizer(wxHORIZONTAL); browserPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); // Add the database designer @@ -425,7 +425,7 @@ void frmDatabaseDesigner::OnAddTable(wxCommandEvent &event) } else if(existsTable && answer == wxID_OK) { - wxMessageBox(_("You have to change the table name because there is already a table with that name in this model."), _("Table already existing"), wxICON_EXCLAMATION); + wxMessageBox(_("You have to change the table name because there is already a table with that name in this model."), _("Table already existing"), wxICON_EXCLAMATION | wxOK); } } while (answer != wxID_CANCEL && !done); @@ -491,7 +491,7 @@ void frmDatabaseDesigner::OnAddColumn(wxCommandEvent &event) } else { - wxMessageBox(_("Warning about adding a column to a table without a diagram"), _("Please create a model diagram first"), wxICON_EXCLAMATION); + wxMessageBox(_("Warning about adding a column to a table without a diagram"), _("Please create a model diagram first"), wxICON_EXCLAMATION | wxOK); } } @@ -779,7 +779,7 @@ wxColour frmDatabaseDesigner::GetServerColour(pgConn *connection) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; if (server->GetConnected() && @@ -833,7 +833,11 @@ void frmDatabaseDesigner::OnChangeConnection(wxCommandEvent &event) pgConn *newconn = dlg.CreateConn(applicationname, createdNewConn); if (newconn && createdNewConn) { - cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (void *)newconn); +#if wxCHECK_VERSION(2, 9, 0) + cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (wxClientData*)newconn); +#else + cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (void*)newconn); +#endif cbConnection->SetSelection(sel); OnChangeConnection(event); } diff --git a/pgadmin/frm/frmMain.cpp b/pgadmin/frm/frmMain.cpp index adc10d4..6cec72d 100644 --- a/pgadmin/frm/frmMain.cpp +++ b/pgadmin/frm/frmMain.cpp @@ -946,7 +946,7 @@ wxTreeItemId frmMain::RestoreEnvironment(pgServer *server) while (item) { data = browser->GetObject(item); - if (data->IsCreatedBy(databaseFactory.GetCollectionFactory())) + if (data && data->IsCreatedBy(databaseFactory.GetCollectionFactory())) break; // Get the next item item = browser->GetNextChild(server->GetId(), cookie); @@ -963,7 +963,7 @@ wxTreeItemId frmMain::RestoreEnvironment(pgServer *server) while (item) { data = browser->GetObject(item); - if (data->IsCreatedBy(databaseFactory) && data->GetName() == lastDatabase) + if (data && data->IsCreatedBy(databaseFactory) && data->GetName() == lastDatabase) break; // Get the next item item = browser->GetNextChild(lastItem, cookie); @@ -983,7 +983,7 @@ wxTreeItemId frmMain::RestoreEnvironment(pgServer *server) while (item) { data = browser->GetObject(item); - if (data->GetMetaType() == PGM_SCHEMA) + if (data && data->GetMetaType() == PGM_SCHEMA) break; // Get the next item item = browser->GetNextChild(lastItem, cookie); @@ -999,7 +999,7 @@ wxTreeItemId frmMain::RestoreEnvironment(pgServer *server) while (item) { data = browser->GetObject(item); - if (data->GetMetaType() == PGM_SCHEMA && data->GetName() == lastSchema) + if (data && data->GetMetaType() == PGM_SCHEMA && data->GetName() == lastSchema) break; // Get the next item item = browser->GetNextChild(lastItem, cookie); @@ -1162,7 +1162,7 @@ void frmMain::StoreServers() while (serveritem) { server = (pgServer *)browser->GetItemData(serveritem); - if (server->IsCreatedBy(serverFactory)) + if (server != NULL && server->IsCreatedBy(serverFactory)) { wxString key; ++numServers; @@ -1256,7 +1256,7 @@ pgServer *frmMain::ConnectToServer(const wxString &servername, bool restore) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; if (server->GetDescription() == servername) diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp index 0b02b67..b11129c 100644 --- a/pgadmin/frm/frmOptions.cpp +++ b/pgadmin/frm/frmOptions.cpp @@ -548,7 +548,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) if (!pickerPostgresqlPath->GetPath().IsEmpty() && !isPgApp(pickerPostgresqlPath->GetPath() + wxT("/pg_dump"))) #endif { - wxMessageBox(_("The PostgreSQL bin path specified is not valid or does not contain a PostgreSQL pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("The PostgreSQL bin path specified is not valid or does not contain a PostgreSQL pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); return; } @@ -558,7 +558,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) if (!pickerEnterprisedbPath->GetPath().IsEmpty() && !isEdbApp(pickerEnterprisedbPath->GetPath() + wxT("/pg_dump"))) #endif { - wxMessageBox(_("The EnterpriseDB bin path specified is not valid or does not contain an EnterpriseDB pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("The EnterpriseDB bin path specified is not valid or does not contain an EnterpriseDB pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); return; } @@ -568,7 +568,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) if (!pickerGPDBPath->GetPath().IsEmpty() && !isGpApp(pickerGPDBPath->GetPath() + wxT("/pg_dump"))) #endif { - wxMessageBox(_("The Greenplum bin path specified is not valid or does not contain a Greenplum pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("The Greenplum bin path specified is not valid or does not contain a Greenplum pg_dump executable.\n\nPlease select another directory, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); return; } @@ -576,7 +576,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) txtPgHelpPath->SetValue(CleanHelpPath(txtPgHelpPath->GetValue())); if (!HelpPathValid(txtPgHelpPath->GetValue())) { - wxMessageBox(_("An invalid PostgreSQL help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("An invalid PostgreSQL help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); txtPgHelpPath->SetFocus(); return; } @@ -584,7 +584,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) txtEdbHelpPath->SetValue(CleanHelpPath(txtEdbHelpPath->GetValue())); if (!HelpPathValid(txtEdbHelpPath->GetValue())) { - wxMessageBox(_("An invalid EnterpriseDB help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("An invalid EnterpriseDB help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); txtEdbHelpPath->SetFocus(); return; } @@ -592,7 +592,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) txtGpHelpPath->SetValue(CleanHelpPath(txtGpHelpPath->GetValue())); if (!HelpPathValid(txtGpHelpPath->GetValue())) { - wxMessageBox(_("An invalid GreenplumDB help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("An invalid GreenplumDB help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); txtGpHelpPath->SetFocus(); return; } @@ -600,7 +600,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) txtSlonyHelpPath->SetValue(CleanHelpPath(txtSlonyHelpPath->GetValue())); if (!HelpPathValid(txtSlonyHelpPath->GetValue())) { - wxMessageBox(_("An invalid Slony help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR); + wxMessageBox(_("An invalid Slony help path was specified.\n\nPlease enter another filename, directory or URL, or leave the path blank."), _("Error"), wxICON_ERROR | wxOK); txtSlonyHelpPath->SetFocus(); return; } @@ -864,7 +864,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) // Did any display options change? Display this message last, so it's // in the selected language. if (changed) - wxMessageBox(_("Changes to the display options may not be visible until the browser tree is refreshed."), _("Display options"), wxICON_INFORMATION); + wxMessageBox(_("Changes to the display options may not be visible until the browser tree is refreshed."), _("Display options"), wxICON_INFORMATION | wxOK); Destroy(); } diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp index a8c29c1..805f11e 100644 --- a/pgadmin/frm/frmQuery.cpp +++ b/pgadmin/frm/frmQuery.cpp @@ -1008,7 +1008,11 @@ void frmQuery::OnChangeConnection(wxCommandEvent &ev) pgConn *newconn = dlg.CreateConn(applicationname, createdNewConn); if (newconn && createdNewConn) { - cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (void *)newconn); +#if wxCHECK_VERSION(2, 9, 0) + cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (wxClientData*)newconn); +#else + cbConnection->Insert(newconn->GetName(), CreateBitmap(GetServerColour(newconn)), sel, (void*)newconn); +#endif cbConnection->SetSelection(sel); OnChangeConnection(ev); } @@ -1792,7 +1796,7 @@ void frmQuery::SetLineEndingStyle() (haveLF && haveCRLF) || (haveCR && haveCRLF)) { - wxMessageBox(_("This file contains mixed line endings. They will be converted to the current setting."), _("Warning"), wxICON_INFORMATION); + wxMessageBox(_("This file contains mixed line endings. They will be converted to the current setting."), _("Warning"), wxICON_INFORMATION | wxOK); sqlQuery->ConvertEOLs(mode); changed = true; setExtendedTitle(); @@ -2119,7 +2123,7 @@ bool frmQuery::updateFromGqb(bool executing) { if (controller->getTableCount() > 0) { - wxMessageBox(_("No SQL query was generated."), _("Graphical Query Builder"), wxICON_INFORMATION); + wxMessageBox(_("No SQL query was generated."), _("Graphical Query Builder"), wxICON_INFORMATION | wxOK); } gqbUpdateRunning = false; return false; @@ -2197,7 +2201,7 @@ void frmQuery::OnExecScript(wxCommandEvent &event) // Required because the pgScript parser isn't currently thread-safe :-( if (frmQuery::ms_pgScriptRunning == true) { - wxMessageBox(_("pgScript already running."), _("Concurrent execution of pgScripts is not supported at this time."), wxICON_WARNING); + wxMessageBox(_("pgScript already running."), _("Concurrent execution of pgScripts is not supported at this time."), wxICON_WARNING | wxOK); return; } frmQuery::ms_pgScriptRunning = true; @@ -2298,7 +2302,7 @@ void frmQuery::OnMacroInvoke(wxCommandEvent &event) wxString selection = sqlQuery->GetSelectedText(); if (selection.IsEmpty()) { - wxMessageBox(_("This macro includes a text substitution. Please select some text in the SQL pane and re-run the macro."), _("Execute macro"), wxICON_EXCLAMATION); + wxMessageBox(_("This macro includes a text substitution. Please select some text in the SQL pane and re-run the macro."), _("Execute macro"), wxICON_EXCLAMATION | wxOK); return; } query.Replace(wxT("$SELECTION$"), selection); @@ -2897,7 +2901,7 @@ wxColour frmQuery::GetServerColour(pgConn *connection) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; if (server->GetConnected() && diff --git a/pgadmin/hotdraw/main/hdDrawingView.cpp b/pgadmin/hotdraw/main/hdDrawingView.cpp index 35981d2..ce5dd94 100644 --- a/pgadmin/hotdraw/main/hdDrawingView.cpp +++ b/pgadmin/hotdraw/main/hdDrawingView.cpp @@ -54,7 +54,13 @@ hdDrawingView::hdDrawingView(int diagram, wxWindow *ddParent, hdDrawingEditor *e drawing = initialDrawing; drawingEditor = editor; canvasSize = size; + +#if wxCHECK_VERSION(2, 9, 0) + FitInside(); +#else SetVirtualSizeHints(canvasSize); +#endif + // Hack to avoid selection rectangle drawing bug drawSelRect = false; // Hack to avoid event problem with simpleTextTool wxTextCrtl at EVT_TEXT event diff --git a/pgadmin/include/ctl/explainCanvas.h b/pgadmin/include/ctl/explainCanvas.h index 4908c2c..c34e726 100644 --- a/pgadmin/include/ctl/explainCanvas.h +++ b/pgadmin/include/ctl/explainCanvas.h @@ -5,7 +5,7 @@ // Copyright (C) 2002 - 2012, The pgAdmin Development Team // This software is released under the PostgreSQL Licence // -// explainCanvas.cpp - Explain Canvas +// explainCanvas.h - Explain Canvas // ////////////////////////////////////////////////////////////////////////// diff --git a/pgadmin/include/utils/sysLogger.h b/pgadmin/include/utils/sysLogger.h index 5e17f7f..96fca79 100644 --- a/pgadmin/include/utils/sysLogger.h +++ b/pgadmin/include/utils/sysLogger.h @@ -30,7 +30,12 @@ enum LOG_LEVEL class sysLogger : public wxLog { public: +#if wxCHECK_VERSION(2, 9, 0) + void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); +#else virtual void DoLog(wxLogLevel level, const wxChar *msg, time_t timestamp); +#endif + static wxLogLevel logLevel; static wxString logFile; diff --git a/pgadmin/schema/pgForeignKey.cpp b/pgadmin/schema/pgForeignKey.cpp index 272bfea..2af2cfe 100644 --- a/pgadmin/schema/pgForeignKey.cpp +++ b/pgadmin/schema/pgForeignKey.cpp @@ -218,7 +218,7 @@ void pgForeignKey::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView * while (item) { pgTable *table = (pgTable *)browser->GetObject(item); - if (table->IsCreatedBy(tableFactory)) + if (table && table->IsCreatedBy(tableFactory)) { coveringIndex = table->GetCoveringIndex(browser, fkColumns); break; diff --git a/pgadmin/schema/pgObject.cpp b/pgadmin/schema/pgObject.cpp index da57e01..6d86a2e 100644 --- a/pgadmin/schema/pgObject.cpp +++ b/pgadmin/schema/pgObject.cpp @@ -1171,7 +1171,7 @@ void pgServerObject::FillOwned(ctlTree *browser, ctlListView *referencedBy, cons while (item) { pgDatabase *db = (pgDatabase *)browser->GetObject(item); - if (db->GetMetaType() == PGM_DATABASE && db->GetName() == dbname) + if (db && db->GetMetaType() == PGM_DATABASE && db->GetName() == dbname) { if (db->GetConnected()) conn = db->GetConnection(); diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp index 2d52ccd..6ccd5f8 100644 --- a/pgadmin/schema/pgServer.cpp +++ b/pgadmin/schema/pgServer.cpp @@ -225,7 +225,10 @@ bool pgServer::Disconnect(frmMain *form) versionNum = wxT(""); lastSystemOID = 0; } - UpdateIcon(form->GetBrowser()); + + if (form) + UpdateIcon(form->GetBrowser()); + return true; } diff --git a/pgadmin/slony/dlgRepCluster.cpp b/pgadmin/slony/dlgRepCluster.cpp index 684991f..92f7ae4 100644 --- a/pgadmin/slony/dlgRepCluster.cpp +++ b/pgadmin/slony/dlgRepCluster.cpp @@ -470,7 +470,7 @@ int dlgRepCluster::Go(bool modal) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; if (server == database->GetServer()) @@ -1130,7 +1130,7 @@ int dlgRepClusterUpgrade::Go(bool modal) while (serveritem) { object = browser->GetObject(serveritem); - if (object->IsCreatedBy(serverFactory)) + if (object && object->IsCreatedBy(serverFactory)) { server = (pgServer *)object; cbServer->Append(browser->GetItemText(server->GetId()), (void *)server); diff --git a/pgadmin/ui/dlgConnect.xrc b/pgadmin/ui/dlgConnect.xrc index 5d151a0..ba90e6d 100644 --- a/pgadmin/ui/dlgConnect.xrc +++ b/pgadmin/ui/dlgConnect.xrc @@ -3,7 +3,7 @@ Connect to Server 205,83d - + 1 5 diff --git a/pgadmin/ui/dlgForeignDataWrapper.xrc b/pgadmin/ui/dlgForeignDataWrapper.xrc index cf891ca..1c6f8d1 100644 --- a/pgadmin/ui/dlgForeignDataWrapper.xrc +++ b/pgadmin/ui/dlgForeignDataWrapper.xrc @@ -3,7 +3,7 @@ 300,265d - + 1 0 diff --git a/pgadmin/ui/dlgForeignServer.xrc b/pgadmin/ui/dlgForeignServer.xrc index 118dc53..66fdc40 100644 --- a/pgadmin/ui/dlgForeignServer.xrc +++ b/pgadmin/ui/dlgForeignServer.xrc @@ -3,7 +3,7 @@ 300,265d - + 1 0 diff --git a/pgadmin/ui/dlgSearchObject.xrc b/pgadmin/ui/dlgSearchObject.xrc index 268772d..1e17b22 100644 --- a/pgadmin/ui/dlgSearchObject.xrc +++ b/pgadmin/ui/dlgSearchObject.xrc @@ -30,7 +30,7 @@ 5 5 0 - 2 + 0 Enter part of the object's name you're looking for diff --git a/pgadmin/ui/dlgSelectConnection.xrc b/pgadmin/ui/dlgSelectConnection.xrc index 2a22ccc..0424936 100644 --- a/pgadmin/ui/dlgSelectConnection.xrc +++ b/pgadmin/ui/dlgSelectConnection.xrc @@ -3,7 +3,7 @@ Connect to Server 205,98d - + 5,7d diff --git a/pgadmin/ui/dlgUserMapping.xrc b/pgadmin/ui/dlgUserMapping.xrc index 2426bcb..a3725d6 100644 --- a/pgadmin/ui/dlgUserMapping.xrc +++ b/pgadmin/ui/dlgUserMapping.xrc @@ -3,7 +3,7 @@ 300,265d - + 1 0 diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc index f77f08c..5208309 100644 --- a/pgadmin/ui/frmOptions.xrc +++ b/pgadmin/ui/frmOptions.xrc @@ -24,7 +24,7 @@ 1 - 2 + 17 5 5 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 diff --git a/pgadmin/ui/frmPassword.xrc b/pgadmin/ui/frmPassword.xrc index 499b072..d672510 100644 --- a/pgadmin/ui/frmPassword.xrc +++ b/pgadmin/ui/frmPassword.xrc @@ -3,7 +3,7 @@ Change Password 175,73d - + 5,7d diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp index d8049c4..6cafadc 100644 --- a/pgadmin/utils/misc.cpp +++ b/pgadmin/utils/misc.cpp @@ -175,7 +175,11 @@ wxString NumToStr(double value) wxString NumToStr(wxLongLong value) { wxString str; +#if wxCHECK_VERSION(2, 9, 0) + str.Printf("%" wxLongLongFmtSpec "d", value.GetValue()); +#else str.Printf(wxT("%") wxLongLongFmtSpec wxT("d"), value.GetValue()); +#endif return str; } diff --git a/pgadmin/utils/sysLogger.cpp b/pgadmin/utils/sysLogger.cpp index 78f501e..9f4a13c 100644 --- a/pgadmin/utils/sysLogger.cpp +++ b/pgadmin/utils/sysLogger.cpp @@ -132,7 +132,11 @@ void wxLogScriptVerbose(const wxChar *szFormat, ...) #endif -void sysLogger::DoLog(wxLogLevel level, const wxChar *msg, time_t timestamp) +#if wxCHECK_VERSION(2, 9, 0) + void sysLogger::DoLogTextAtLevel(wxLogLevel level, const wxString& msg) +#else + void sysLogger::DoLog(wxLogLevel level, const wxChar *msg, time_t timestamp) +#endif { wxString msgtype, preamble; int icon = 0; @@ -205,16 +209,22 @@ void sysLogger::DoLog(wxLogLevel level, const wxChar *msg, time_t timestamp) break; } + wxString fullmsg; + +#if wxCHECK_VERSION(2, 9, 0) + // Build the message. + fullmsg << msgtype << wxT(": ") << msg; +#else // Convert the timestamp wxDateTime *time = new wxDateTime(timestamp); - wxString fullmsg; // Build the message. fullmsg << time->FormatISODate() << wxT(" ") << - time->FormatISOTime() << wxT(" ") << msgtype << wxT(": ") << msg; + time->FormatISOTime() << wxT(" ") << msgtype << wxT(": ") << msg; // Make sure to delete the time that we allocated delete time; +#endif // Display the message if required switch (logLevel)