diff --git a/pgadmin/agent/pgaJob.cpp b/pgadmin/agent/pgaJob.cpp index 20b77b7..8d4b431 100644 --- a/pgadmin/agent/pgaJob.cpp +++ b/pgadmin/agent/pgaJob.cpp @@ -349,7 +349,9 @@ runNowFactory::runNowFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar wxWindow *runNowFactory::StartDialog(frmMain *form, pgObject *obj) { if (!((pgaJob *)(obj))->RunNow()) + { wxLogError(_("Failed to reschedule the job.")); + } form->Refresh(obj); diff --git a/pgadmin/ctl/calbox.cpp b/pgadmin/ctl/calbox.cpp index cca5b11..0443e08 100644 --- a/pgadmin/ctl/calbox.cpp +++ b/pgadmin/ctl/calbox.cpp @@ -114,7 +114,7 @@ bool wxCalendarBox::Create(wxWindow *parent, m_dlg->SetFont(GetFont()); wxPanel *panel = new wxPanel(m_dlg, CTRLID_PAN, wxPoint(0, 0), wxDefaultSize, wxSUNKEN_BORDER | wxCLIP_CHILDREN); - m_cal = new wxCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime, wxPoint(0, 0), wxDefaultSize, wxSUNKEN_BORDER); + m_cal = new pgCompatCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime, wxPoint(0, 0), wxDefaultSize, wxSUNKEN_BORDER); m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEventHandler(wxCalendarBox::OnSelChange), 0, this); m_cal->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(wxCalendarBox::OnCalKey), 0, this); m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DOUBLECLICKED, wxCalendarEventHandler(wxCalendarBox::OnSelChange), 0, this); @@ -271,7 +271,7 @@ bool wxCalendarBox::SetFormat(const wxChar *fmt) wxDateTime dt; dt.ParseFormat(wxT("2003-10-13"), wxT("%Y-%m-%d")); wxString str = dt.Format(fmt); - wxChar *p = (wxChar *)str.c_str(); + const wxChar *p = (const wxChar*) str; m_format = wxEmptyString; @@ -303,7 +303,7 @@ bool wxCalendarBox::SetFormat(const wxChar *fmt) wxChar c; for (c = '0'; c <= '9'; c++) valArray.Add(wxString(c, 1)); - wxChar *p = (wxChar *)m_format.c_str(); + const wxChar *p = (const wxChar*) m_format; while (*p) { if (*p == '%') @@ -448,7 +448,13 @@ void wxCalendarBox::OnSelChange(wxCalendarEvent &ev) } ev.SetEventObject(this); ev.SetId(GetId()); + +#if wxCHECK_VERSION(2, 9, 0) + GetParent()->GetEventHandler()->ProcessEvent(ev); +#else GetParent()->ProcessEvent(ev); +#endif + } @@ -456,21 +462,35 @@ void wxCalendarBox::OnText(wxCommandEvent &ev) { ev.SetEventObject(this); ev.SetId(GetId()); + +#if wxCHECK_VERSION(2, 9, 0) + GetParent()->GetEventHandler()->ProcessEvent(ev); +#else GetParent()->ProcessEvent(ev); +#endif // We'll create an additional event if the date is valid. - // If the date isn't valid, the user's probable in the middle of typing + // If the date isn't valid, the user's probably in the middle of typing wxString txt = m_txt->GetValue(); wxDateTime dt; if (!txt.IsEmpty()) dt.ParseFormat(txt, m_format); +#if wxCHECK_VERSION(2, 9, 0) + wxCalendarEvent cev(m_cal, dt, wxEVT_CALENDAR_SEL_CHANGED); +#else wxCalendarEvent cev(m_cal, wxEVT_CALENDAR_SEL_CHANGED); + cev.SetDate(dt); +#endif cev.SetEventObject(this); cev.SetId(GetId()); - cev.SetDate(dt); +#if wxCHECK_VERSION(2, 9, 0) + GetParent()->GetEventHandler()->ProcessEvent(cev); +#else GetParent()->ProcessEvent(cev); +#endif + } diff --git a/pgadmin/ctl/ctlListView.cpp b/pgadmin/ctl/ctlListView.cpp index 236d024..aff2223 100644 --- a/pgadmin/ctl/ctlListView.cpp +++ b/pgadmin/ctl/ctlListView.cpp @@ -43,7 +43,7 @@ wxString ctlListView::GetText(long row, long col) }; -void ctlListView::AddColumn(const wxChar *text, int size, int format) +void ctlListView::AddColumn(const wxString &text, int size, int format) { if (size == wxLIST_AUTOSIZE || size == wxLIST_AUTOSIZE_USEHEADER) { @@ -56,14 +56,14 @@ void ctlListView::AddColumn(const wxChar *text, int size, int format) } -long ctlListView::AppendItem(int icon, const wxChar *val, const wxChar *val2, const wxChar *val3, const wxChar *val4) +long ctlListView::AppendItem(int icon, const wxString &val, const wxString &val2, const wxString &val3, const wxString &val4) { long pos = InsertItem(GetItemCount(), val, icon); - if (val2 && *val2) + if (!val2.IsEmpty()) SetItem(pos, 1, val2); - if (val3 && *val3) + if (!val3.IsEmpty()) SetItem(pos, 2, val3); - if (val4 && *val4) + if (!val4.IsEmpty()) SetItem(pos, 3, val4); return pos; diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp index b161331..9f5e165 100644 --- a/pgadmin/ctl/ctlSQLBox.cpp +++ b/pgadmin/ctl/ctlSQLBox.cpp @@ -21,6 +21,7 @@ #include "ctl/ctlSQLBox.h" #include "dlg/dlgFindReplace.h" #include "frm/menu.h" +#include // Must be last for reasons I haven't fully grokked... #include @@ -703,14 +704,13 @@ char *pg_query_to_single_ordered_string(char *query, void *dbptr) } - // Find some text in the document. CharacterRange ctlSQLBox::RegexFindText(int minPos, int maxPos, const wxString &text) { TextToFind ft; ft.chrg.cpMin = minPos; ft.chrg.cpMax = maxPos; - wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text); + wxWX2MBbuf buf = text.mb_str(wxConvUTF8); ft.lpstrText = (char *)(const char *)buf; if (SendMsg(2150, wxSTC_FIND_REGEXP, (long)&ft) == -1) @@ -721,3 +721,4 @@ CharacterRange ctlSQLBox::RegexFindText(int minPos, int maxPos, const wxString & return ft.chrgText; } + diff --git a/pgadmin/ctl/explainShape.cpp b/pgadmin/ctl/explainShape.cpp index 3da1fb7..411d0c3 100644 --- a/pgadmin/ctl/explainShape.cpp +++ b/pgadmin/ctl/explainShape.cpp @@ -382,7 +382,7 @@ ExplainShape *ExplainShape::Create(long level, ExplainShape *last, const wxStrin if (costPos > 0) { - wxChar *cl = (wxChar *)str.c_str() + costPos + 6; + wxChar *cl = const_cast((const wxChar*)str + costPos + 6); wxChar *ch = wxStrstr(cl, wxT("..")); if (ch) { diff --git a/pgadmin/ctl/timespin.cpp b/pgadmin/ctl/timespin.cpp index 56cd403..c9cf571 100644 --- a/pgadmin/ctl/timespin.cpp +++ b/pgadmin/ctl/timespin.cpp @@ -198,7 +198,7 @@ int wxTimeSpinCtrl::GetTimePart() { wxString strAfter = m_txt->GetRange(m_txt->GetInsertionPoint(), 9999); int cnt = 0; - wxChar *p = (wxChar *)strAfter.c_str(); + const wxChar *p = (const wxChar*)strAfter; while (*p) { if (*p++ == ':') @@ -304,7 +304,12 @@ void wxTimeSpinCtrl::DoSpin(int diff) wxSpinEvent ev; ev.SetEventObject(this); ev.SetId(GetId()); + +#if wxCHECK_VERSION(2, 9, 0) + GetParent()->GetEventHandler()->ProcessEvent(ev); +#else GetParent()->ProcessEvent(ev); +#endif } } @@ -317,7 +322,11 @@ void wxTimeSpinCtrl::OnText(wxCommandEvent &ev) spinValue = time; ev.SetEventObject(this); ev.SetId(GetId()); +#if wxCHECK_VERSION(2, 9, 0) + GetParent()->GetEventHandler()->ProcessEvent(ev); +#else GetParent()->ProcessEvent(ev); +#endif } } diff --git a/pgadmin/db/pgConn.cpp b/pgadmin/db/pgConn.cpp index b23f46b..4bd15ea 100644 --- a/pgadmin/db/pgConn.cpp +++ b/pgadmin/db/pgConn.cpp @@ -241,7 +241,9 @@ bool pgConn::DoConnect() wxLogInfo(wxT("Setting client_encoding to '%s'"), encoding.c_str()); if (PQsetClientEncoding(conn, encoding.ToAscii())) - wxLogError(wxT("%s"), GetLastError().c_str()); + { + wxLogError(wxT("%s"), (const wxChar*) GetLastError()); + } delete set; @@ -595,7 +597,7 @@ void pgConn::Notice(const char *msg) else { wxString str(msg, *conv); - wxLogNotice(wxT("%s"), str.Trim().c_str()); + wxLogNotice(wxT("%s"), (const wxChar*) str.Trim()); } } @@ -633,7 +635,7 @@ bool pgConn::ExecuteVoid(const wxString &sql, bool reportError) // Execute the query and get the status. PGresult *qryRes; - wxLogSql(wxT("Void query (%s:%d): %s"), this->GetHost().c_str(), this->GetPort(), sql.c_str()); + wxLogSql(wxT("Void query (%s:%d): %s"), (const wxChar*)this->GetHost(), this->GetPort(), (const wxChar*)sql); qryRes = PQexec(conn, sql.mb_str(*conv)); lastResultStatus = PQresultStatus(qryRes); SetLastResultError(qryRes); @@ -662,7 +664,7 @@ wxString pgConn::ExecuteScalar(const wxString &sql) { // Execute the query and get the status. PGresult *qryRes; - wxLogSql(wxT("Scalar query (%s:%d): %s"), this->GetHost().c_str(), this->GetPort(), sql.c_str()); + wxLogSql(wxT("Scalar query (%s:%d): %s"), (const wxChar*) this->GetHost(), this->GetPort(), (const wxChar*) sql); qryRes = PQexec(conn, sql.mb_str(*conv)); lastResultStatus = PQresultStatus(qryRes); SetLastResultError(qryRes); @@ -686,7 +688,7 @@ wxString pgConn::ExecuteScalar(const wxString &sql) // Retrieve the query result and return it. result = wxString(PQgetvalue(qryRes, 0, 0), *conv); - wxLogSql(wxT("Query result: %s"), result.c_str()); + wxLogSql(wxT("Query result: %s"), (const wxChar*)result); // Cleanup & exit PQclear(qryRes); @@ -701,7 +703,7 @@ pgSet *pgConn::ExecuteSet(const wxString &sql) if (GetStatus() == PGCONN_OK) { PGresult *qryRes; - wxLogSql(wxT("Set query (%s:%d): %s"), this->GetHost().c_str(), this->GetPort(), sql.c_str()); + wxLogSql(wxT("Set query (%s:%d): %s"), (const wxChar*) this->GetHost(), this->GetPort(), (const wxChar*) sql); qryRes = PQexec(conn, sql.mb_str(*conv)); lastResultStatus = PQresultStatus(qryRes); @@ -758,7 +760,7 @@ void pgConn::LogError(const bool quiet) { if (quiet) { - wxLogQuietError(wxT("%s"), GetLastError().Trim().c_str()); + wxLogQuietError(wxT("%s"), (const wxChar*) GetLastError().Trim()); } else { diff --git a/pgadmin/db/pgQueryThread.cpp b/pgadmin/db/pgQueryThread.cpp index 56c6303..cb33cf0 100644 --- a/pgadmin/db/pgQueryThread.cpp +++ b/pgadmin/db/pgQueryThread.cpp @@ -27,7 +27,7 @@ static void pgNoticeProcessor(void *arg, const char *message) { wxString str(message, wxConvUTF8); - wxLogNotice(wxT("%s"), str.Trim().c_str()); + wxLogNotice(wxT("%s"), (const wxChar*) str.Trim()); ((pgQueryThread *)arg)->appendMessage(str); } @@ -45,7 +45,7 @@ pgQueryThread::pgQueryThread(pgConn *_conn, const wxString &qry, int _resultToRe eventId = _eventId; data = _data; - wxLogSql(wxT("Thread query (%s:%d): %s"), conn->GetHost().c_str(), conn->GetPort(), qry.c_str()); + wxLogSql(wxT("Thread query (%s:%d): %s"), (const wxChar*) conn->GetHost(), conn->GetPort(), (const wxChar*) qry); conn->RegisterNoticeProcessor(pgNoticeProcessor, this); if (conn->conn) @@ -197,8 +197,13 @@ int pgQueryThread::raiseEvent(int retval) #if !defined(PGSCLI) wxCommandEvent resultEvent(wxEVT_COMMAND_MENU_SELECTED, eventId); resultEvent.SetClientData(data); +#if wxCHECK_VERSION(2, 9, 0) + caller->GetEventHandler()->AddPendingEvent(resultEvent); +#else caller->AddPendingEvent(resultEvent); #endif + +#endif } return retval; } diff --git a/pgadmin/db/pgSet.cpp b/pgadmin/db/pgSet.cpp index 78b8716..f99973c 100644 --- a/pgadmin/db/pgSet.cpp +++ b/pgadmin/db/pgSet.cpp @@ -209,7 +209,9 @@ int pgSet::ColNumber(const wxString &colname) const col = PQfnumber(res, colname.mb_str(conv)); if (col < 0) + { wxLogError(__("Column not found in pgSet: %s"), colname.c_str()); + } return col; } diff --git a/pgadmin/debugger/dbgPgConn.cpp b/pgadmin/debugger/dbgPgConn.cpp index d2ad372..dffaea5 100644 --- a/pgadmin/debugger/dbgPgConn.cpp +++ b/pgadmin/debugger/dbgPgConn.cpp @@ -145,7 +145,7 @@ void dbgPgConn::Init( const wxString &server, const wxString &database, const wx connectParams.Append(hostip); } - if( port.Length()) + if(port.Length()) { connectParams += wxT(" port="); connectParams += port; @@ -155,7 +155,7 @@ void dbgPgConn::Init( const wxString &server, const wxString &database, const wx } - if( database.Length()) + if(database.Length()) { connectParams.Append(wxT(" dbname=")); connectParams.Append(qtConnString(database)); @@ -331,14 +331,14 @@ PGconn *dbgPgConn::getConnection() void dbgPgConn::startCommand( const wxString &command, wxEvtHandler *caller, wxEventType eventType, dbgPgParams *params ) { - wxLogSql(wxT("%s"), command.c_str()); + wxLogSql(wxT("%s"), (const wxChar*) command); m_workerThread->startCommand(command, caller, eventType, params); } PGresult *dbgPgConn::waitForCommand( const wxString &command ) { - wxLogSql(wxT("%s"), command.c_str()); + wxLogSql(wxT("%s"), (const wxChar*) command); PGresult *result = PQexec( m_pgConn, command.mb_str( wxConvUTF8 )); diff --git a/pgadmin/dlg/dlgClasses.cpp b/pgadmin/dlg/dlgClasses.cpp index 6fd7afe..2cb3b76 100644 --- a/pgadmin/dlg/dlgClasses.cpp +++ b/pgadmin/dlg/dlgClasses.cpp @@ -538,10 +538,14 @@ void ExecutionDialog::OnOK(wxCommandEvent &ev) bool isOk = (thread->ReturnCode() == PGRES_COMMAND_OK || thread->ReturnCode() == PGRES_TUPLES_OK); if (txtMessages) + { txtMessages->AppendText(thread->GetMessagesAndClear()); + } if (thread->DataSet() != NULL) + { wxLogInfo(wxString::Format(wxT("%d rows."), thread->DataSet()->NumRows())); + } if (isOk) { diff --git a/pgadmin/dlg/dlgDatabase.cpp b/pgadmin/dlg/dlgDatabase.cpp index 85f8c06..29b4f01 100644 --- a/pgadmin/dlg/dlgDatabase.cpp +++ b/pgadmin/dlg/dlgDatabase.cpp @@ -323,7 +323,9 @@ int dlgDatabase::Go(bool modal) { // Disable the checkbox if (!DisablePrivilege(wxT("CONNECT"))) + { wxLogError(_("Failed to disable the CONNECT privilege checkbox!")); + } } return dlgDefaultSecurityProperty::Go(modal, createDefPriv, strDefPrivsOnTables, strDefPrivsOnSeqs, strDefPrivsOnFuncs); diff --git a/pgadmin/dlg/dlgExtTable.cpp b/pgadmin/dlg/dlgExtTable.cpp index 5e7ee44..c193ab3 100644 --- a/pgadmin/dlg/dlgExtTable.cpp +++ b/pgadmin/dlg/dlgExtTable.cpp @@ -101,7 +101,7 @@ pgObject *dlgExtTable::CreateObject(pgCollection *collection) void dlgExtTable::CheckChange() { wxString name = GetName(); - if (name) + if(!name.IsEmpty()) { if (extTable) EnableOK(txtComment->GetValue() != extTable->GetComment() diff --git a/pgadmin/dlg/dlgSelectConnection.cpp b/pgadmin/dlg/dlgSelectConnection.cpp index 6d2f76e..5ebb861 100644 --- a/pgadmin/dlg/dlgSelectConnection.cpp +++ b/pgadmin/dlg/dlgSelectConnection.cpp @@ -57,9 +57,9 @@ dlgSelectConnection::dlgSelectConnection(wxWindow *parent, frmMain *form) : style |= wxCB_READONLY; cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(65, 5)), ConvertDialogToPixels(wxSize(135, 12)), style); - cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 20)), ConvertDialogToPixels(wxSize(135, 12)), NULL, style); - cbUsername = new wxComboBox(this, CTRLID_CBUSERNAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 35)), ConvertDialogToPixels(wxSize(135, 12)), NULL, style); - cbRolename = new wxComboBox(this, CTRLID_CBROLENAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 50)), ConvertDialogToPixels(wxSize(135, 12)), NULL, style); + cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 20)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style); + cbUsername = new wxComboBox(this, CTRLID_CBUSERNAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 35)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style); + cbRolename = new wxComboBox(this, CTRLID_CBROLENAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 50)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style); if (form == NULL) { diff --git a/pgadmin/dlg/dlgSequence.cpp b/pgadmin/dlg/dlgSequence.cpp index 97ad60a..8a02e69 100644 --- a/pgadmin/dlg/dlgSequence.cpp +++ b/pgadmin/dlg/dlgSequence.cpp @@ -107,20 +107,32 @@ int dlgSequence::Go(bool modal) { // Disable the checkbox if (!DisablePrivilege(wxT("USAGE"))) + { wxLogError(_("Failed to disable the USAGE privilege checkbox!")); + } } else { if (!DisablePrivilege(wxT("INSERT"))) + { wxLogError(_("Failed to disable the INSERT privilege checkbox!")); + } if (!DisablePrivilege(wxT("DELETE"))) + { wxLogError(_("Failed to disable the DELETE privilege checkbox!")); + } if (!DisablePrivilege(wxT("RULE"))) + { wxLogError(_("Failed to disable the RULE privilege checkbox!")); + } if (!DisablePrivilege(wxT("REFERENCES"))) + { wxLogError(_("Failed to disable the REFERENCES privilege checkbox!")); + } if (!DisablePrivilege(wxT("TRIGGER"))) + { wxLogError(_("Failed to disable the TRIGGER privilege checkbox!")); + } } return dlgSecurityProperty::Go(modal); diff --git a/pgadmin/dlg/dlgTable.cpp b/pgadmin/dlg/dlgTable.cpp index d57b819..d865fb2 100644 --- a/pgadmin/dlg/dlgTable.cpp +++ b/pgadmin/dlg/dlgTable.cpp @@ -738,7 +738,9 @@ int dlgTable::Go(bool modal) { // Disable the checkbox if (!DisablePrivilege(wxT("RULE"))) + { wxLogError(_("Failed to disable the RULE privilege checkbox!")); + } if (table) { diff --git a/pgadmin/dlg/dlgView.cpp b/pgadmin/dlg/dlgView.cpp index 8ed3104..7e3d946 100644 --- a/pgadmin/dlg/dlgView.cpp +++ b/pgadmin/dlg/dlgView.cpp @@ -77,7 +77,9 @@ int dlgView::Go(bool modal) { // Disable the checkbox if (!DisablePrivilege(wxT("RULE"))) + { wxLogError(_("Failed to disable the RULE privilege checkbox!")); + } } return dlgSecurityProperty::Go(modal); @@ -96,7 +98,7 @@ pgObject *dlgView::CreateObject(pgCollection *collection) void dlgView::CheckChange() { wxString name = GetName(); - if (name) + if(!name.IsEmpty()) { bool enable = true; if (view) diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp index c7d4c37..f84709a 100644 --- a/pgadmin/frm/events.cpp +++ b/pgadmin/frm/events.cpp @@ -434,8 +434,14 @@ void frmMain::setDisplay(pgObject *data, ctlListView *props, ctlSQLBox *sqlbox) for (i = 0 ; i < indivMenu->GetMenuItemCount() ; i++) { menuItem = indivMenu->GetMenuItems().Item(i)->GetData(); - newMenu->Append(menuItem->GetId(), menuItem->GetLabel(), menuItem->GetHelp()); - newContextMenu->Append(menuItem->GetId(), menuItem->GetLabel(), menuItem->GetHelp()); +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = menuItem->GetItemLabelText(); +#else + wxString lab = menuItem->GetLabel(); // deprecated +#endif + + newMenu->Append(menuItem->GetId(), lab, menuItem->GetHelp()); + newContextMenu->Append(menuItem->GetId(), lab, menuItem->GetHelp()); } } delete indivMenu; @@ -518,17 +524,29 @@ void frmMain::doPopup(wxWindow *win, wxPoint point, pgObject *object) wxMenu *indivMenu = object->GetNewMenu(); if (indivMenu) { + if (indivMenu->GetMenuItemCount() > 1) { wxMenuItem *menuItem = menuBar->FindItem(newMenuFactory->GetId()); - treeContextMenu->Insert(newItemPos, newMenuFactory->GetId(), menuItem->GetLabel(), indivMenu, menuItem->GetHelp()); +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = menuItem->GetItemLabelText(); +#else + wxString lab = menuItem->GetLabel(); // deprecated +#endif + + treeContextMenu->Insert(newItemPos, newMenuFactory->GetId(), lab, indivMenu, menuItem->GetHelp()); } else { if (indivMenu->GetMenuItemCount() == 1) { wxMenuItem *menuItem = indivMenu->GetMenuItems().Item(0)->GetData(); - treeContextMenu->Insert(newItemPos, menuItem->GetId(), menuItem->GetLabel(), menuItem->GetHelp()); +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = menuItem->GetItemLabelText(); +#else + wxString lab = menuItem->GetLabel(); // deprecated +#endif + treeContextMenu->Insert(newItemPos, menuItem->GetId(), lab, menuItem->GetHelp()); } delete indivMenu; } @@ -896,7 +914,9 @@ void frmMain::OnSaveDefinition(wxCommandEvent &event) { // Write the file if (!FileWrite(filename.GetPath(), sqlPane->GetText())) + { wxLogError(__("Could not write the file %s: Errcode=%d."), filename.GetPath().c_str(), wxSysErrorCode()); + } } else { diff --git a/pgadmin/frm/frmEditGrid.cpp b/pgadmin/frm/frmEditGrid.cpp index d72c55a..70dd885 100644 --- a/pgadmin/frm/frmEditGrid.cpp +++ b/pgadmin/frm/frmEditGrid.cpp @@ -143,9 +143,9 @@ frmEditGrid::frmEditGrid(frmMain *form, const wxString &_title, pgConn *_conn, p // Setup the limit bar #ifndef __WXMAC__ - cbLimit = new wxComboBox(this, CTRLID_LIMITCOMBO, wxEmptyString, wxPoint(0, 0), wxSize(GetCharWidth() * 12, -1), NULL, wxCB_DROPDOWN); + cbLimit = new wxComboBox(this, CTRLID_LIMITCOMBO, wxEmptyString, wxPoint(0, 0), wxSize(GetCharWidth() * 12, -1), wxArrayString(), wxCB_DROPDOWN); #else - cbLimit = new wxComboBox(this, CTRLID_LIMITCOMBO, wxEmptyString, wxPoint(0, 0), wxSize(GetCharWidth() * 24, -1), NULL, wxCB_DROPDOWN); + cbLimit = new wxComboBox(this, CTRLID_LIMITCOMBO, wxEmptyString, wxPoint(0, 0), wxSize(GetCharWidth() * 24, -1), wxArrayString(), wxCB_DROPDOWN); #endif cbLimit->Append(_("No limit")); cbLimit->Append(_("1000 rows")); @@ -1913,7 +1913,13 @@ public: virtual bool IsAcceptedKey(wxKeyEvent &event); virtual void BeginEdit(int row, int col, wxGrid *grid); + +#if wxCHECK_VERSION(2, 9, 0) + virtual void ApplyEdit(int row, int col, wxGrid* grid); // pure virtual in wx 2.9+, doesn't exist in prior versions + virtual bool EndEdit(int row, int col, const wxGrid *grid, const wxString&, wxString*); +#else virtual bool EndEdit(int row, int col, wxGrid *grid); +#endif virtual void Reset(); virtual void StartingClick(); @@ -2042,7 +2048,33 @@ void sqlGridBoolEditor::BeginEdit(int row, int col, wxGrid *grid) CBox()->SetFocus(); } +#define BOOL_EDIT_SWITCH switch (value) \ +{ \ + case wxCHK_UNCHECKED:\ + grid->GetTable()->SetValue(row, col, wxT("FALSE"));\ + break;\ + case wxCHK_CHECKED:\ + grid->GetTable()->SetValue(row, col, wxT("TRUE"));\ + break;\ + case wxCHK_UNDETERMINED:\ + grid->GetTable()->SetValue(row, col, wxEmptyString);\ + break;\ +}\ + +#if wxCHECK_VERSION(2, 9, 0) +// pure virtual in 2.9+, doesn't exist in prior versions +void sqlGridBoolEditor::ApplyEdit(int row, int col, wxGrid* grid) +{ + wxCheckBoxState value = CBox()->Get3StateValue(); + BOOL_EDIT_SWITCH +} +#endif + +#if wxCHECK_VERSION(2, 9, 0) +bool sqlGridBoolEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString&, wxString*) +#else bool sqlGridBoolEditor::EndEdit(int row, int col, wxGrid *grid) +#endif { wxASSERT_MSG(m_control, wxT("The sqlGridBoolEditor must be Created first!")); @@ -2051,21 +2083,12 @@ bool sqlGridBoolEditor::EndEdit(int row, int col, wxGrid *grid) if ( value != m_startValue ) changed = true; +#if !wxCHECK_VERSION(2, 9, 0) if ( changed ) { - switch (value) - { - case wxCHK_UNCHECKED: - grid->GetTable()->SetValue(row, col, wxT("FALSE")); - break; - case wxCHK_CHECKED: - grid->GetTable()->SetValue(row, col, wxT("TRUE")); - break; - case wxCHK_UNDETERMINED: - grid->GetTable()->SetValue(row, col, wxEmptyString); - break; - } + BOOL_EDIT_SWITCH } +#endif return changed; } diff --git a/pgadmin/frm/frmHbaConfig.cpp b/pgadmin/frm/frmHbaConfig.cpp index 8bdc3b4..c4615e5 100644 --- a/pgadmin/frm/frmHbaConfig.cpp +++ b/pgadmin/frm/frmHbaConfig.cpp @@ -189,7 +189,7 @@ void frmHbaConfig::DisplayFile(const wxString &str) { pgHbaConfigLine *line = new pgHbaConfigLine(); lines.Add(line); - line->item = listEdit->AppendItem(0, wxEmptyString); + line->item = listEdit->AppendItem(0, wxString(wxEmptyString)); } } @@ -328,7 +328,7 @@ void frmHbaConfig::OnEditSetting(wxListEvent &event) if (isLastLine) { - long pos = listEdit->AppendItem(0, wxEmptyString); + long pos = listEdit->AppendItem(0, wxString(wxEmptyString)); pgHbaConfigLine *line = new pgHbaConfigLine(); line->item = pos; lines.Add(line); diff --git a/pgadmin/frm/frmHint.cpp b/pgadmin/frm/frmHint.cpp index 27ca804..ba80eee 100644 --- a/pgadmin/frm/frmHint.cpp +++ b/pgadmin/frm/frmHint.cpp @@ -268,7 +268,7 @@ void frmHint::SetHint(const wxString &info) if (a < 0) a = 0; if (o < 0) - o = wxStringBase::npos; + o = wxString::npos; int ha = page.Find(wxT("

")); diff --git a/pgadmin/frm/frmMain.cpp b/pgadmin/frm/frmMain.cpp index d26cfde..b02e5f9 100644 --- a/pgadmin/frm/frmMain.cpp +++ b/pgadmin/frm/frmMain.cpp @@ -1078,12 +1078,17 @@ void frmMain::ReportConnError(pgServer *server) wantHint = reportError(error, __("Translator attention: must match libpq translation!Is the server running on host"), HINT_CONNECTSERVER); if (!wantHint) + { wantHint = reportError(error, __("Translator attention: must match backend translation!no pg_hba.conf entry for"), HINT_MISSINGHBA); + } if (!wantHint) + { wantHint = reportError(error, __("Translator attention: must match backend translation!Ident authentication failed"), HINT_MISSINGIDENT); - + } if (!wantHint) + { wxLogError(__("Error connecting to the server: %s"), error.c_str()); + } } diff --git a/pgadmin/frm/frmMainConfig.cpp b/pgadmin/frm/frmMainConfig.cpp index e3ce2aa..ab8752c 100644 --- a/pgadmin/frm/frmMainConfig.cpp +++ b/pgadmin/frm/frmMainConfig.cpp @@ -240,7 +240,6 @@ void frmMainConfig::OnUndo(wxCommandEvent &ev) if (!name.IsEmpty()) { pgSettingItem *item = options[name]; - wxASSERT(name); if (item->newLine) { delete item->newLine; @@ -258,7 +257,6 @@ void frmMainConfig::UpdateLine(int pos) if (!name.IsEmpty()) { pgSettingItem *item = options[name]; - wxASSERT(name); pgConfigLine *line = item->newLine; if (!line) diff --git a/pgadmin/frm/frmPgpassConfig.cpp b/pgadmin/frm/frmPgpassConfig.cpp index 00f96c7..7f51a82 100644 --- a/pgadmin/frm/frmPgpassConfig.cpp +++ b/pgadmin/frm/frmPgpassConfig.cpp @@ -162,7 +162,7 @@ void frmPgpassConfig::DisplayFile(const wxString &str) { pgPassConfigLine *line = new pgPassConfigLine(); lines.Add(line); - line->item = listEdit->AppendItem(0, wxEmptyString); + line->item = listEdit->AppendItem(0, wxString(wxEmptyString)); } } @@ -300,7 +300,7 @@ void frmPgpassConfig::OnEditSetting(wxListEvent &event) if (isLastLine) { - long pos = listEdit->AppendItem(0, wxEmptyString); + long pos = listEdit->AppendItem(0, wxString(wxEmptyString)); pgPassConfigLine *line = new pgPassConfigLine(); line->item = pos; lines.Add(line); diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp index b3df194..b67c5e2 100644 --- a/pgadmin/frm/frmQuery.cpp +++ b/pgadmin/frm/frmQuery.cpp @@ -415,7 +415,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w toolBar->Realize(); // Add the database selection bar - cbConnection = new wxBitmapComboBox(this, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), NULL, wxCB_READONLY | wxCB_DROPDOWN); + cbConnection = new wxBitmapComboBox(this, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN); cbConnection->Append(conn->GetName(), CreateBitmap(GetServerColour(conn)), (void *)conn); cbConnection->Append(_(""), wxNullBitmap, (void *)0); @@ -437,7 +437,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w boxHistory->Add(label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 1); // Query combobox - sqlQueries = new wxComboBox(pnlQuery, CTL_SQLQUERYCBOX, wxT(""), wxDefaultPosition, wxDefaultSize, NULL, wxCB_DROPDOWN | wxCB_READONLY); + sqlQueries = new wxComboBox(pnlQuery, CTL_SQLQUERYCBOX, wxT(""), wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_DROPDOWN | wxCB_READONLY); sqlQueries->SetToolTip(_("Previous queries")); LoadQueries(); boxHistory->Add(sqlQueries, 1, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, 1); @@ -2392,7 +2392,7 @@ void frmQuery::OnQueryComplete(wxCommandEvent &ev) { pgError err = sqlResult->GetResultError(); wxString errMsg = err.formatted_msg; - wxLogQuietError(wxT("%s"), conn->GetLastError().Trim().c_str()); + wxLogQuietError(wxT("%s"), (const wxChar*) conn->GetLastError().Trim()); long errPos; err.statement_pos.ToLong(&errPos); diff --git a/pgadmin/frm/frmReport.cpp b/pgadmin/frm/frmReport.cpp index 6935c12..9659ac7 100644 --- a/pgadmin/frm/frmReport.cpp +++ b/pgadmin/frm/frmReport.cpp @@ -1289,7 +1289,7 @@ void reportObjectDataDictionaryFactory::GenerateReport(frmReport *report, pgObje // Columns int section = report->XmlCreateSection(_("Columns")); - report->XmlSetSectionTableHeader(section, 6, _("Name"), _("Data type"), _("Not Null?"), _("Primary key?"), _("Default"), _("Comment")); + report->XmlSetSectionTableHeader(section, 6, (const wxChar*) _("Name"), (const wxChar*) _("Data type"), (const wxChar*) _("Not Null?"), (const wxChar*) _("Primary key?"), (const wxChar*) _("Default"), (const wxChar*) _("Comment")); ctlTree *browser = GetFrmMain()->GetBrowser(); pgCollection *columns = table->GetColumnCollection(browser); @@ -1312,14 +1312,14 @@ void reportObjectDataDictionaryFactory::GenerateReport(frmReport *report, pgObje } report->XmlAddSectionTableRow(section, - column->GetColNumber(), - 6, - colName.c_str(), - column->GetVarTypename().c_str(), - BoolToYesNo(column->GetNotNull()).c_str(), - BoolToYesNo(column->GetIsPK()).c_str(), - column->GetDefault().c_str(), - column->GetComment().c_str()); + column->GetColNumber(), + 6, + (const wxChar*) colName, + (const wxChar*) column->GetVarTypename(), + (const wxChar*) BoolToYesNo(column->GetNotNull()), + (const wxChar*) BoolToYesNo(column->GetIsPK()), + (const wxChar*) column->GetDefault(), + (const wxChar*) column->GetComment()); } } if (haveInherit) @@ -1342,7 +1342,7 @@ void reportObjectDataDictionaryFactory::GenerateReport(frmReport *report, pgObje if (x == 1) { section = report->XmlCreateSection(_("Constraints")); - report->XmlSetSectionTableHeader(section, 4, _("Name"), _("Type"), _("Definition"), _("Comment")); + report->XmlSetSectionTableHeader(section, 4, (const wxChar*) _("Name"), (const wxChar*) _("Type"), (const wxChar*) _("Definition"), (const wxChar*) _("Comment")); } constraint->ShowTreeDetail(browser); @@ -1372,12 +1372,12 @@ void reportObjectDataDictionaryFactory::GenerateReport(frmReport *report, pgObje } report->XmlAddSectionTableRow(section, - x, - 4, - constraint->GetName().c_str(), - type.c_str(), - definition.c_str(), - constraint->GetComment().c_str()); + x, + 4, + (const wxChar*) constraint->GetName(), + (const wxChar*) type, + (const wxChar*) definition, + (const wxChar*) constraint->GetComment()); x++; } } diff --git a/pgadmin/frm/frmRestore.cpp b/pgadmin/frm/frmRestore.cpp index e9b6138..6cc2033 100644 --- a/pgadmin/frm/frmRestore.cpp +++ b/pgadmin/frm/frmRestore.cpp @@ -430,7 +430,9 @@ wxString frmRestore::getCmdPart2(int step) if (restoreStrings[i] != wxEmptyString) { if (!tocFile.Write(restoreStrings[i] + wxT("\n"))) + { wxLogError(_("Error writing to the temporary file ") + restoreTOCFilename); + } } } @@ -660,7 +662,9 @@ void frmRestore::OnEndProcess(wxProcessEvent &ev) // if we are treating a comment, we use the schema of its // object (ie, the previous line) else if (type != wxT("COMMENT")) + { wxLogError(_("Schema node not found for object ") + type + wxT(" ") + name + wxT(" [") + _("owner") + wxT(": ") + owner + wxT("]")); + } } lastItem = ctvObjects->AppendItem(currentSchemaNode, type + wxT(" ") + name + wxT(" [") + _("owner") + wxT(": ") + owner + wxT("]"), 1); } diff --git a/pgadmin/frm/frmStatus.cpp b/pgadmin/frm/frmStatus.cpp index 183e5eb..a36125f 100644 --- a/pgadmin/frm/frmStatus.cpp +++ b/pgadmin/frm/frmStatus.cpp @@ -267,7 +267,7 @@ frmStatus::frmStatus(frmMain *form, const wxString &_title, pgConn *conn) : pgFr btnRotateLog = new wxButton(toolBar, CTL_ROTATEBTN, _("Rotate")); toolBar->AddControl(btnRotateLog); toolBar->AddSeparator(); - cbRate = new wxComboBox(toolBar, CTL_RATECBO, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), NULL, wxCB_READONLY | wxCB_DROPDOWN); + cbRate = new wxComboBox(toolBar, CTL_RATECBO, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN); toolBar->AddControl(cbRate); toolBar->AddSeparator(); cbDatabase = new ctlComboBoxFix(toolBar, CTRLID_DATABASE, wxDefaultPosition, wxSize(-1, -1), wxCB_READONLY | wxCB_DROPDOWN); @@ -963,7 +963,9 @@ void frmStatus::OnCopyQuery(wxCommandEvent &ev) } if (text.Length() == maxlength) + { wxLogError(_("The query you copied is at the maximum length.\nIt may have been truncated.")); + } // If we have some real query, launch the query tool if (text.Length() > 0 && dbname.Length() > 0 @@ -1631,9 +1633,9 @@ void frmStatus::OnRefreshLogTimer(wxTimerEvent &event) { logDirectory = wxT("-"); if (connection->BackendMinimumVersion(8, 3)) - logList->AppendItem(-1, _("logging_collector not enabled or log_filename misconfigured")); + logList->AppendItem(-1, wxString(_("logging_collector not enabled or log_filename misconfigured"))); else - logList->AppendItem(-1, _("redirect_stderr not enabled or log_filename misconfigured")); + logList->AppendItem(-1, wxString(_("redirect_stderr not enabled or log_filename misconfigured"))); cbLogfiles->Disable(); btnRotateLog->Disable(); } @@ -1811,8 +1813,8 @@ void frmStatus::addLogFile(const wxString &filename, const wxDateTime timestamp, read += strlen(raw); wxString str; - if (wxString(wxString(raw, wxConvLibc), wxConvUTF8).Len() > 0) - str = line + wxString(wxString(raw, wxConvLibc), wxConvUTF8); + if (wxString(wxString(raw, wxConvLibc).wx_str(), wxConvUTF8).Len() > 0) + str = line + wxString(wxString(raw, wxConvLibc).wx_str(), wxConvUTF8); else str = line + wxTextBuffer::Translate(wxString(raw, set->GetConversion()), wxTextFileType_Unix); @@ -1841,7 +1843,7 @@ void frmStatus::addLogFile(const wxString &filename, const wxDateTime timestamp, // In CSV logs, the first field must be a Timestamp, so must start with "2009" or "201" or "202" (at least for the next 20 years). if (str.length() > 4 && str.Left(4) != wxT("2009") && str.Left(3) != wxT("201") && str.Left(3) != wxT("202")) { - wxLogNotice(wxT("Log line does not start with timestamp: %s \n"), str.Mid(0, 100).c_str()); + wxLogNotice(wxT("Log line does not start with timestamp: %s \n"), (const wxChar*) str.Mid(0, 100)); // Something isn't right, as we are not at the beginning of a csv log record. // We should never get here, but if we do, try to handle it in a smart way. str = str.Mid(str.Find(wxT("\n20")) + 1); // Try to re-sync. @@ -1873,12 +1875,12 @@ void frmStatus::addLogFile(const wxString &filename, const wxDateTime timestamp, if (str.length() > 5 && str.Left(4) != wxT("2009") && str.Left(3) != wxT("201") && str.Left(3) != wxT("202")) { // BUG: We are out of sync on the log - wxLogNotice(wxT("Log line does not start with timestamp: %s\n"), str.c_str());; + wxLogNotice(wxT("Log line does not start with timestamp: %s\n"), (const wxChar*) str); } else if (str.length() < 20) { // BUG: We are out of sync on the log, or the log is garbled - wxLogNotice(wxT("Log line too short: %s\n"), str.c_str()); + wxLogNotice(wxT("Log line too short: %s\n"), (const wxChar*) str); } } diff --git a/pgadmin/frm/plugins.cpp b/pgadmin/frm/plugins.cpp index 246ad62..d35df47 100644 --- a/pgadmin/frm/plugins.cpp +++ b/pgadmin/frm/plugins.cpp @@ -342,7 +342,9 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj) // Let's go!! if (wxExecute(execCmd) == 0) + { wxLogError(_("Failed to execute plugin %s (%s)"), title.c_str(), command.c_str()); + } return 0; } diff --git a/pgadmin/gqb/gqbGraphSimple.cpp b/pgadmin/gqb/gqbGraphSimple.cpp index 24189c6..05d7af2 100644 --- a/pgadmin/gqb/gqbGraphSimple.cpp +++ b/pgadmin/gqb/gqbGraphSimple.cpp @@ -51,7 +51,12 @@ gqbGraphSimple::gqbGraphSimple() // (2)Need to set a font for the device context before get font metrics with GetTextExtent void gqbGraphSimple::drawTable(wxMemoryDC &bdc, wxPoint *origin, gqbQueryObject *queryTable) { + +#if wxCHECK_VERSION(2, 9, 0) + wxCoord w = 0, h = 0, height = 0, width = 0, margin = 5; +#else long w = 0, h = 0, height = 0, width = 0, margin = 5; +#endif // Get Value for row Height if(!rowHeight) diff --git a/pgadmin/gqb/gqbGridProjTable.cpp b/pgadmin/gqb/gqbGridProjTable.cpp index cef71f6..1db2ee0 100644 --- a/pgadmin/gqb/gqbGridProjTable.cpp +++ b/pgadmin/gqb/gqbGridProjTable.cpp @@ -274,7 +274,7 @@ void gqbGridProjTable::changesPositions(int sPos, int dPos) // Change a single row or a range to one pos up or down (but no more than one position) void gqbGridProjTable::changesRangeOnePos(int topPos, int bottomPos, int newTop) { - // Eliminate side effect of zero base array on calculations, but carefull newTop still it's zero based + // Eliminate side effect of zero base array on calculations, but careful newTop still it's zero based topPos++; bottomPos++; int sizeRange = bottomPos - (topPos - 1), size = GetNumberRows(); @@ -324,3 +324,4 @@ void gqbGridProjTable::emptyTableData() GetView()->ProcessTableMessage( msg ); } } + diff --git a/pgadmin/gqb/gqbView.cpp b/pgadmin/gqb/gqbView.cpp index 7874745..51a46be 100644 --- a/pgadmin/gqb/gqbView.cpp +++ b/pgadmin/gqb/gqbView.cpp @@ -106,7 +106,11 @@ gqbView::gqbView(wxWindow *gqbParent, wxAuiNotebook *gridParent, wxSize size, gq this->orderByRGridTable = new gqbGridOrderTable(2, model->getOrdByColumns(), model->getOrdByParents(), model->getOrdByKind()); this->orderPanel = new gqbOrderPanel(controller->getTabs(), orderByLGridTable, orderByRGridTable); - SetVirtualSizeHints(size); +#if !wxCHECK_VERSION(2, 9, 0) + // does nothing in 2.9+ + SetVirtualSizeHints(size); +#endif + } diff --git a/pgadmin/gqb/gqbViewPanels.cpp b/pgadmin/gqb/gqbViewPanels.cpp index 3937753..d3087f8 100644 --- a/pgadmin/gqb/gqbViewPanels.cpp +++ b/pgadmin/gqb/gqbViewPanels.cpp @@ -208,7 +208,8 @@ void gqbGridPanel::OnButtonUp(wxCommandEvent &) allowSelCells = false; if((selTop >= 0 && selBottom == -1) || (selTop == selBottom)) { - gModel->changesPositions(selTop, selTop--); + --selTop; + gModel->changesPositions(selTop, selTop + 1); if(selTop < 0) { selTop = 0; @@ -289,7 +290,8 @@ void gqbGridPanel::OnButtonDown(wxCommandEvent &) // A single row is selected if((selTop >= 0 && selBottom == -1) || (selTop == selBottom)) { - gModel->changesPositions(selTop, selTop++); + ++selTop; + gModel->changesPositions(selTop, selTop - 1); // Adjust selection when selected item it's last item. if(selTop == gModel->GetNumberRows()) @@ -1130,7 +1132,8 @@ void gqbOrderPanel::OnButtonUp(wxCommandEvent &) allowSelCells = false; if((selRightTop >= 0 && selRightBottom == -1) || (selRightTop == selRightBottom)) { - tableRight->changesPositions(selRightTop, selRightTop--); + --selRightTop; + tableRight->changesPositions(selRightTop, selRightTop + 1); if(selRightTop < 0) { selRightTop = 0; @@ -1211,7 +1214,8 @@ void gqbOrderPanel::OnButtonDown(wxCommandEvent &) // A single row is selected if((selRightTop >= 0 && selRightBottom == -1) || (selRightTop == selRightBottom)) { - tableRight->changesPositions(selRightTop, selRightTop++); + ++selRightTop; + tableRight->changesPositions(selRightTop, selRightTop - 1); // Adjust selection when selected item it's last item. if(selRightTop == tableRight->GetNumberRows()) diff --git a/pgadmin/include/ctl/calbox.h b/pgadmin/include/ctl/calbox.h index d3f33f9..b769637 100644 --- a/pgadmin/include/ctl/calbox.h +++ b/pgadmin/include/ctl/calbox.h @@ -13,6 +13,13 @@ #define _WX_CALBOX_H_ #include "wx/calctrl.h" +// pgCompatCalendarCtrl is a typedef for either wxGenericCalendarCtrl or wxCalendarCtrl +#if wxCHECK_VERSION(2, 9, 0) +#include "wx/generic/calctrlg.h" +typedef wxGenericCalendarCtrl pgCompatCalendarCtrl; +#else +typedef wxCalendarCtrl pgCompatCalendarCtrl; +#endif class wxCalendarBox : public wxControl { @@ -88,7 +95,7 @@ public: private: wxDialog *m_dlg; wxTextCtrl *m_txt; - wxCalendarCtrl *m_cal; + pgCompatCalendarCtrl *m_cal; wxButton *m_btn; wxString m_format; diff --git a/pgadmin/include/ctl/ctlListView.h b/pgadmin/include/ctl/ctlListView.h index 27a48a0..2fa6ad0 100644 --- a/pgadmin/include/ctl/ctlListView.h +++ b/pgadmin/include/ctl/ctlListView.h @@ -29,38 +29,38 @@ public: void CreateColumns(wxImageList *images, const wxString &left, const wxString &right, int leftSize = 60); void CreateColumns(wxImageList *images, const wxString &str1, const wxString &str2, const wxString &str3, int leftSize = 60); - void AddColumn(const wxChar *text, int size = wxLIST_AUTOSIZE_USEHEADER, int format = wxLIST_FORMAT_LEFT); + void AddColumn(const wxString &text, int size = wxLIST_AUTOSIZE_USEHEADER, int format = wxLIST_FORMAT_LEFT); - long AppendItem(int icon, const wxChar *val, const wxChar *val2 = 0, const wxChar *val3 = 0, const wxChar *val4 = 0); - long AppendItem(const wxChar *val, const wxChar *val2 = 0, const wxChar *val3 = 0) + long AppendItem(int icon, const wxString &val, const wxString &val2 = wxString(), const wxString &val3 = wxString(), const wxString &val4 = wxString()); + long AppendItem(const wxString &val, const wxString &val2 = wxString(), const wxString &val3 = wxString()) { return AppendItem(PGICON_PROPERTY, val, val2, val3); } - void AppendItem(const wxChar *str, const long l) + void AppendItem(const wxString &str, long l) { AppendItem(str, NumToStr(l)); } - void AppendItem(const wxChar *str, const bool b) + void AppendItem(const wxString &str, bool b) { AppendItem(str, BoolToYesNo(b)); } - void AppendItem(const wxChar *str, const double d) + void AppendItem(const wxString &str, double d) { AppendItem(str, NumToStr(d)); } - void AppendItem(const wxChar *str, const OID o) + void AppendItem(const wxString &str, OID o) { AppendItem(str, NumToStr(o)); } - void AppendItem(const wxChar *str, const wxDateTime &d) + void AppendItem(const wxString &str, const wxDateTime &d) { AppendItem(str, DateToStr(d)); } - void AppendItem(const wxChar *str, const wxLongLong &l) + void AppendItem(const wxString &str, const wxLongLong &l) { AppendItem(str, l.ToString()); } - void AppendItem(const wxChar *str, const wxULongLong &l) + void AppendItem(const wxString &str, const wxULongLong &l) { AppendItem(str, l.ToString()); } diff --git a/pgadmin/include/utils/sysLogger.h b/pgadmin/include/utils/sysLogger.h index eeeaef2..72bb627 100644 --- a/pgadmin/include/utils/sysLogger.h +++ b/pgadmin/include/utils/sysLogger.h @@ -45,9 +45,17 @@ private: #define wxLOG_Script (wxLOG_User+4) #define wxLOG_ScriptVerbose (wxLOG_User+5) +#if wxCHECK_VERSION(2, 9, 0) // we had a namechange of ATTRIBUTE_PRINTF_1 in Wx 2.9 +#define COMPAT_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF_1 +#else +#define COMPAT_ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF_1 +#endif + + + #define DECLARE_INT_LOG_FUNCTION(level) \ extern void wxVLog##level(const wxChar *szFormat, va_list argptr); \ -extern void wxLog##level(const wxChar *szFormat, ...) ATTRIBUTE_PRINTF_1 +extern void wxLog##level(const wxChar *szFormat, ...) COMPAT_ATTRIBUTE_PRINTF_1 DECLARE_INT_LOG_FUNCTION(Notice); DECLARE_INT_LOG_FUNCTION(Sql); diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h index ee4f2c3..7502ecc 100644 --- a/pgadmin/include/utils/sysSettings.h +++ b/pgadmin/include/utils/sysSettings.h @@ -670,7 +670,7 @@ public: } // Functions for storing settings - bool Write(const wxString &key, const wxChar *value) + bool Write(const wxString &key, const wxString &value) { return wxConfig::Write(key, value); } diff --git a/pgadmin/pgAdmin3.cpp b/pgadmin/pgAdmin3.cpp index 178413a..9a9315e 100644 --- a/pgadmin/pgAdmin3.cpp +++ b/pgadmin/pgAdmin3.cpp @@ -262,6 +262,21 @@ bool pgAdmin3::OnInit() static const wxCmdLineEntryDesc cmdLineDesc[] = { +#if wxCHECK_VERSION(2, 9, 0) + // wxCmdLineEntryDesc is one of the few places in 2.9 where wxT()s have any effect...they break the build + {wxCMD_LINE_SWITCH, "h", "help", _("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, + {wxCMD_LINE_OPTION, "s", "server", _("auto-connect to specified server"), wxCMD_LINE_VAL_STRING}, + {wxCMD_LINE_SWITCH, "S", "serverstatus", _("open server status window"), wxCMD_LINE_VAL_NONE}, + {wxCMD_LINE_OPTION, "Sc", "serverstatusconnect", _("connect server status window to database"), wxCMD_LINE_VAL_STRING}, + {wxCMD_LINE_SWITCH, "q", "query", _("open query tool"), wxCMD_LINE_VAL_NONE}, + {wxCMD_LINE_OPTION, "qc", "queryconnect", _("connect query tool to database"), wxCMD_LINE_VAL_STRING}, + {wxCMD_LINE_OPTION, "f", "file", _("file to load into the query tool in -q or -qc mode"), wxCMD_LINE_VAL_STRING}, + {wxCMD_LINE_OPTION, "cm", NULL, _("edit main configuration file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, + {wxCMD_LINE_OPTION, "ch", NULL, _("edit HBA configuration file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, + {wxCMD_LINE_OPTION, "cp", NULL, _("edit pgpass configuration file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, + {wxCMD_LINE_OPTION, "c", NULL, _("edit configuration files in cluster directory"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, + {wxCMD_LINE_SWITCH, "t", NULL, _("dialog translation test mode"), wxCMD_LINE_VAL_NONE}, +#else {wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), _("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, {wxCMD_LINE_OPTION, wxT("s"), wxT("server"), _("auto-connect to specified server"), wxCMD_LINE_VAL_STRING}, {wxCMD_LINE_SWITCH, wxT("S"), wxT("serverstatus"), _("open server status window"), wxCMD_LINE_VAL_NONE}, @@ -274,7 +289,9 @@ bool pgAdmin3::OnInit() {wxCMD_LINE_OPTION, wxT("cp"), NULL, _("edit pgpass configuration file"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, {wxCMD_LINE_OPTION, wxT("c"), NULL, _("edit configuration files in cluster directory"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE}, {wxCMD_LINE_SWITCH, wxT("t"), NULL, _("dialog translation test mode"), wxCMD_LINE_VAL_NONE}, +#endif {wxCMD_LINE_NONE} + }; frmConfig::tryMode configMode = frmConfig::NONE; @@ -633,7 +650,9 @@ bool pgAdmin3::OnInit() cmdParser.Found(wxT("f"), &fn); #endif if (!fn.IsEmpty()) + { wxLogInfo(wxT("Auto-loading file: %s"), fn.c_str()); + } frmQuery *fq = new frmQuery(NULL, wxEmptyString, conn, wxEmptyString, fn); fq->Go(); } @@ -662,7 +681,9 @@ bool pgAdmin3::OnInit() wxString fn; cmdParser.Found(wxT("f"), &fn); if (!fn.IsEmpty()) + { wxLogInfo(wxT("Auto-loading file: %s"), fn.c_str()); + } frmQuery *fq = new frmQuery(winMain, wxEmptyString, conn, wxEmptyString, fn); fq->Go(); winMain->AddFrame(fq); diff --git a/pgadmin/pgscript/generators/pgsDictionaryGen.cpp b/pgadmin/pgscript/generators/pgsDictionaryGen.cpp index 36f91e2..eddb89b 100644 --- a/pgadmin/pgscript/generators/pgsDictionaryGen.cpp +++ b/pgadmin/pgscript/generators/pgsDictionaryGen.cpp @@ -60,10 +60,10 @@ long pgsDictionaryGen::count_lines() wxTextInputStream text(input, wxT(" \t")); #endif wxString line; - while ((line = text.ReadLine()) && !input.Eof()) - { - ++result; - } + while (!(line = text.ReadLine()).IsEmpty() && !input.Eof()) + { + ++result; + } } } diff --git a/pgadmin/pgscript/generators/pgsReferenceGen.cpp b/pgadmin/pgscript/generators/pgsReferenceGen.cpp index 08f25e0..4db9a44 100644 --- a/pgadmin/pgscript/generators/pgsReferenceGen.cpp +++ b/pgadmin/pgscript/generators/pgsReferenceGen.cpp @@ -37,12 +37,11 @@ pgsReferenceGen::pgsReferenceGen(pgsThread *app, const wxString &table, { m_nb_rows = 0; } - wxLogScriptVerbose(wxT("REFGEN: Number of rows in %s: %s"), m_table.c_str(), - pgsMapm::pgs_mapm_str(m_nb_rows).c_str()); + wxLogScriptVerbose(wxT("REFGEN: Number of rows in %s: %s"), (const wxChar*) m_table, + (const wxChar*) pgsMapm::pgs_mapm_str(m_nb_rows)); // Create an integer generator with that number of lines - m_randomizer = pgsRandomizer(pnew pgsIntegerGen(0, m_nb_rows - 1, - is_sequence(), m_seed)); + m_randomizer = pgsRandomizer(pnew pgsIntegerGen(0, m_nb_rows - 1, is_sequence(), m_seed)); } bool pgsReferenceGen::is_sequence() const diff --git a/pgadmin/pgscript/generators/pgsRegexGen.cpp b/pgadmin/pgscript/generators/pgsRegexGen.cpp index fe5cd4c..0a0dd85 100644 --- a/pgadmin/pgscript/generators/pgsRegexGen.cpp +++ b/pgadmin/pgscript/generators/pgsRegexGen.cpp @@ -83,7 +83,7 @@ const long &pgsRegexGen::pgsRegex::get_second() const pgsRegexGen::pgsRegexGen(const wxString ®ex, const long &seed) : pgsObjectGen(seed), m_regex(regex), m_valid(true), m_string_gens(pgsVectorStringGen()) { - wxLogScriptVerbose(wxT("REGEXGEN: %s"), m_regex.c_str()); + wxLogScriptVerbose(wxT("REGEXGEN: %s"), (const wxChar*) m_regex); // Transform regular expression into XML structure bool escape = false, first_regex = true, list = false; @@ -168,7 +168,7 @@ pgsRegexGen::pgsRegexGen(const wxString ®ex, const long &seed) : result.Append(wxT(" \n")); result.Append(wxT("\n")); - wxLogScriptVerbose(wxT("REGEXGEN: %s"), result.c_str()); + wxLogScriptVerbose(wxT("REGEXGEN: %s"), (const wxChar*) result); // Load this XML structure with the wxXmlDocument from wxWidgets wxStringInputStream input(result); diff --git a/pgadmin/pgscript/parser.sh b/pgadmin/pgscript/parser.sh old mode 100644 new mode 100755 diff --git a/pgadmin/pgscript/pgsApplication.cpp b/pgadmin/pgscript/pgsApplication.cpp index d010d74..0622102 100644 --- a/pgadmin/pgscript/pgsApplication.cpp +++ b/pgadmin/pgscript/pgsApplication.cpp @@ -150,7 +150,12 @@ void pgsApplication::Complete() if (m_caller != 0) { wxCommandEvent resultEvent(wxEVT_COMMAND_MENU_SELECTED, m_event_id); + +#if wxCHECK_VERSION(2, 9, 0) + m_caller->GetEventHandler()->AddPendingEvent(resultEvent); +#else m_caller->AddPendingEvent(resultEvent); +#endif } #endif // PGSCLI diff --git a/pgadmin/pgscript/utilities/pgsContext.cpp b/pgadmin/pgscript/utilities/pgsContext.cpp index d1d6101..3f1aaf6 100644 --- a/pgadmin/pgscript/utilities/pgsContext.cpp +++ b/pgadmin/pgscript/utilities/pgsContext.cpp @@ -84,13 +84,13 @@ void pgsContext::clear_columns() void pgsContext::push_var(pgsExpression *var) { - wxLogScriptVerbose(wxT("PUSH EXPR %s"), var->value().c_str()); + wxLogScriptVerbose(wxT("PUSH EXPR %s"), (const wxChar*) var->value()); m_vars.push_back(var); } void pgsContext::pop_var() { - wxLogScriptVerbose(wxT("POP EXPR %s"), m_vars.back()->value().c_str()); + wxLogScriptVerbose(wxT("POP EXPR %s"), (const wxChar*) m_vars.back()->value()); m_vars.pop_back(); } @@ -101,15 +101,15 @@ size_t pgsContext::size_vars() const void pgsContext::push_stmt(pgsStmt *stmt) { - wxLogScriptVerbose(wxT("PUSH STMT %s"), wxString(typeid(*stmt).name(), - wxConvUTF8).c_str()); + wxLogScriptVerbose(wxT("PUSH STMT %s"), (const wxChar*) wxString(typeid(*stmt).name(), + wxConvUTF8)); m_stmts.push_back(stmt); } void pgsContext::pop_stmt() { - wxLogScriptVerbose(wxT("POP STMT %s"), wxString(typeid(*(m_stmts.back())) - .name(), wxConvUTF8).c_str()); + wxLogScriptVerbose(wxT("POP STMT %s"), (const wxChar*) wxString(typeid(*(m_stmts.back())) + .name(), wxConvUTF8)); m_stmts.pop_back(); } diff --git a/pgadmin/schema/pgIndex.cpp b/pgadmin/schema/pgIndex.cpp index 6a7e408..478f6b1 100644 --- a/pgadmin/schema/pgIndex.cpp +++ b/pgadmin/schema/pgIndex.cpp @@ -518,7 +518,7 @@ pgObject *pgIndexBaseFactory::CreateObjects(pgCollection *coll, ctlTree *browser { while (!indexes->Eof()) { - switch (indexes->GetVal(wxT("contype"))[0U]) + switch ( (wxChar)indexes->GetVal(wxT("contype"))[0U]) { case 0: index = new pgIndex(collection->GetTable(), indexes->GetVal(wxT("idxname"))); diff --git a/pgadmin/schema/pgObject.cpp b/pgadmin/schema/pgObject.cpp index d2debb6..900f003 100644 --- a/pgadmin/schema/pgObject.cpp +++ b/pgadmin/schema/pgObject.cpp @@ -443,7 +443,7 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString wxString typestr = set->GetVal(wxT("type")); pgaFactory *depFactory = 0; - switch (typestr.c_str()[0]) + switch ((wxChar)typestr.c_str()[0]) { case 'c': case 's': // we don't know these; internally handled @@ -495,7 +495,7 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString } case 'C': { - switch (typestr.c_str()[1]) + switch ((wxChar)typestr.c_str()[1]) { case 'c': depFactory = &checkFactory; @@ -554,7 +554,7 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString wxString deptype; - switch (set->GetVal(wxT("deptype")).c_str()[0]) + switch ( (wxChar) set->GetVal(wxT("deptype")).c_str()[0]) { case 'n': deptype = wxT("normal"); @@ -1236,7 +1236,7 @@ void pgServerObject::FillOwned(ctlTree *browser, ctlListView *referencedBy, cons relname += qtIdent(set->GetVal(wxT("relname"))); pgaFactory *ownerFactory = 0; - switch (set->GetVal(wxT("relkind")).c_str()[0]) + switch ( (wxChar)set->GetVal(wxT("relkind")).c_str()[0]) { case 'r': ownerFactory = &tableFactory; diff --git a/pgadmin/schema/pgRole.cpp b/pgadmin/schema/pgRole.cpp index 5571b90..e0012c5 100644 --- a/pgadmin/schema/pgRole.cpp +++ b/pgadmin/schema/pgRole.cpp @@ -301,7 +301,7 @@ void pgRole::ShowDependents(frmMain *form, ctlListView *referencedBy, const wxSt { if (set->GetBool(wxT("datallowconn"))) dblist.Add(name); - if (GetOidStr() == set->GetLong(wxT("datdba"))) + if (GetOidStr() == set->GetVal(wxT("datdba"))) referencedBy->AppendItem(databaseFactory.GetIconId(), _("Database"), name); } else diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp index adac2a6..8db34d0 100644 --- a/pgadmin/schema/pgServer.cpp +++ b/pgadmin/schema/pgServer.cpp @@ -694,11 +694,13 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool // Check the server version if (!(conn->BackendMinimumVersion(SERVER_MIN_VERSION_N >> 8, SERVER_MIN_VERSION_N & 0x00FF)) || (conn->BackendMinimumVersion(SERVER_MAX_VERSION_N >> 8, (SERVER_MAX_VERSION_N & 0x00FF) + 1))) + { wxLogWarning(_("The server you are connecting to is not a version that is supported by this release of %s.\n\n%s may not function as expected.\n\nSupported server versions are %s to %s."), appearanceFactory->GetLongAppName().c_str(), appearanceFactory->GetLongAppName().c_str(), wxString(SERVER_MIN_VERSION_T).c_str(), wxString(SERVER_MAX_VERSION_T).c_str()); + } connected = true; bool hasUptime = false; diff --git a/pgadmin/slony/dlgRepCluster.cpp b/pgadmin/slony/dlgRepCluster.cpp index 403c521..f12d9a2 100644 --- a/pgadmin/slony/dlgRepCluster.cpp +++ b/pgadmin/slony/dlgRepCluster.cpp @@ -865,14 +865,14 @@ wxString ReplaceString(const wxString &str, const wxString &oldStr, const wxStri wxChar *buf = new wxChar[buflen+1]; const wxChar *ptrIn = str.c_str(); - const wxChar *ptrFound = wxStrstr(ptrIn, oldStr.c_str()); + const wxChar *ptrFound = wxStrstr(ptrIn, oldStr); while (ptrFound) { AppendBuf(buf, buflen, len, ptrIn, ptrFound - ptrIn); AppendBuf(buf, buflen, len, newStr.c_str()); ptrIn = ptrFound + oldStr.Length(); - ptrFound = wxStrstr(ptrIn, oldStr.c_str()); + ptrFound = wxStrstr(ptrIn, oldStr); } AppendBuf(buf, buflen, len, ptrIn); diff --git a/pgadmin/slony/slSet.cpp b/pgadmin/slony/slSet.cpp index 3b0f891..546c002 100644 --- a/pgadmin/slony/slSet.cpp +++ b/pgadmin/slony/slSet.cpp @@ -112,7 +112,7 @@ void slSet::ShowDependencies(frmMain *form, ctlListView *list, const wxString &w wxString comment = set->GetVal(wxT("comment")); wxString typname; int icon = -1; - switch (typestr.c_str()[0]) + switch ( (wxChar)typestr.c_str()[0]) { case 'S': typname = _("Sequence"); diff --git a/pgadmin/utils/csvfiles.cpp b/pgadmin/utils/csvfiles.cpp index 807311b..07e14cd 100644 --- a/pgadmin/utils/csvfiles.cpp +++ b/pgadmin/utils/csvfiles.cpp @@ -80,7 +80,7 @@ wxString CSVTokenizer::GetNextToken() token.assign(m_string, m_pos, pos - m_pos); if (quoted_string && inquote) - wxLogNotice(wxT("unterminated double quoted string: %s\n"), token.c_str()); + wxLogNotice(wxT("unterminated double quoted string: %s\n"), (const wxChar*) token); m_pos = pos + 1; // Skip token and delimiter diff --git a/pgadmin/utils/factory.cpp b/pgadmin/utils/factory.cpp index dcf3275..742e82e 100644 --- a/pgadmin/utils/factory.cpp +++ b/pgadmin/utils/factory.cpp @@ -317,7 +317,12 @@ void menuFactoryList::AppendEnabledMenus(wxMenuBar *menuBar, wxMenu *treeContext { if (!menuItem->IsSubMenu()) { - lastItem = treeContextMenu->Append(id, menuItem->GetLabel(), menuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = menuItem->GetItemLabelText(); +#else + wxString lab = menuItem->GetLabel(); // deprecated +#endif + lastItem = treeContextMenu->Append(id, lab, menuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); if (menuItem->IsCheckable() && menuItem->IsChecked()) treeContextMenu->FindItem(id)->Check(); } @@ -335,7 +340,12 @@ void menuFactoryList::AppendEnabledMenus(wxMenuBar *menuBar, wxMenu *treeContext wxMenuItem *oldMenuItem = oldSubMenu->FindItemByPosition(i); if (oldMenuItem->IsEnabled()) { - newSubMenu->Append(oldMenuItem->GetId(), oldMenuItem->GetLabel(), oldMenuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); +#if wxCHECK_VERSION(2, 9, 0) + wxString oldLab = oldMenuItem->GetItemLabelText(); +#else + wxString oldLab = oldMenuItem->GetLabel(); // deprecated +#endif + newSubMenu->Append(oldMenuItem->GetId(), oldLab, oldMenuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); if (oldMenuItem->IsCheckable() && oldMenuItem->IsChecked()) newSubMenu->FindItem(oldMenuItem->GetId())->Check(); @@ -344,13 +354,25 @@ void menuFactoryList::AppendEnabledMenus(wxMenuBar *menuBar, wxMenu *treeContext } } if (itemCount > 1) - lastItem = treeContextMenu->Append(id, menuItem->GetLabel(), newSubMenu); + { +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = menuItem->GetItemLabelText(); +#else + wxString lab = menuItem->GetLabel(); // deprecated +#endif + lastItem = treeContextMenu->Append(id, lab, newSubMenu); + } else { delete newSubMenu; if (itemCount) { - lastItem = treeContextMenu->Append(singleMenuItem->GetId(), singleMenuItem->GetLabel(), singleMenuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); +#if wxCHECK_VERSION(2, 9, 0) + wxString lab = singleMenuItem->GetItemLabelText(); +#else + wxString lab = singleMenuItem->GetLabel(); // deprecated +#endif + lastItem = treeContextMenu->Append(singleMenuItem->GetId(), lab, singleMenuItem->GetHelp(), menuItem->IsCheckable() ? wxITEM_CHECK : wxITEM_NORMAL); if (singleMenuItem->IsCheckable() && singleMenuItem->IsChecked()) treeContextMenu->FindItem(singleMenuItem->GetId())->Check(); } diff --git a/pgadmin/utils/pgconfig.cpp b/pgadmin/utils/pgconfig.cpp index 87d97ca..b27ac50 100644 --- a/pgadmin/utils/pgconfig.cpp +++ b/pgadmin/utils/pgconfig.cpp @@ -207,7 +207,7 @@ pgSettingFileReader::pgSettingFileReader(bool localized) buffer = wxTextBuffer::Translate(buffer, wxTextFileType_Unix); columnNames = buffer.BeforeFirst('\n'); - bp = (wxChar *)buffer.c_str() + columnNames.Length() + 1; + bp = const_cast((const wxChar*)buffer + columnNames.Length() + 1); } } diff --git a/pgadmin/utils/utffile.cpp b/pgadmin/utils/utffile.cpp index 71c0ca3..ccfb5ed 100644 --- a/pgadmin/utils/utffile.cpp +++ b/pgadmin/utils/utffile.cpp @@ -80,7 +80,9 @@ off_t wxUtfFile::Read(wxString &str, off_t nCount) if (nLen == (size_t) - 1) { if (!m_strFileName.IsEmpty()) + { wxLogWarning(_("The file \"%s\" could not be opened because it contains characters that could not be interpreted."), m_strFileName.c_str()); + } Seek(decr - nLen, wxFromCurrent); return (size_t) - 1; }