From: Włodzimierz Skiba Date: Mon, 31 Jan 2005 18:18:18 +0000 (+0000) Subject: Enhanced stock labels usage. Source cleaning. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5d2ac6b8c652a4aac703ba03f143820e978b33d4 Enhanced stock labels usage. Source cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/demos/dbbrowse/browsedb.cpp b/demos/dbbrowse/browsedb.cpp index 813beeb8dd..c4a2c6f585 100644 --- a/demos/dbbrowse/browsedb.cpp +++ b/demos/dbbrowse/browsedb.cpp @@ -70,7 +70,7 @@ wxChar *GetExtendedDBErrorMsg(wxChar *ErrFile, int ErrLine) if (pDbList->PtrDb->errorList[i]) { msg.Append(pDbList->PtrDb->errorList[i]); - if (wxStrcmp(pDbList->PtrDb->errorList[i],_T("")) != 0) + if (wxStrcmp(pDbList->PtrDb->errorList[i],wxEmptyString) != 0) msg.Append(_T("\n")); } } @@ -83,9 +83,9 @@ wxChar *GetExtendedDBErrorMsg(wxChar *ErrFile, int ErrLine) BrowserDB::BrowserDB() { PointerToNULL(0); - ODBCSource = _T(""); // ODBC data source name (created with ODBC Administrator under Win95/NT) - UserName = _T(""); // database username - must already exist in the data source - Password = _T(""); // password database username + ODBCSource = wxEmptyString; // ODBC data source name (created with ODBC Administrator under Win95/NT) + UserName = wxEmptyString; // database username - must already exist in the data source + Password = wxEmptyString; // password database username OnFillSqlTyp(); OnFilldbTyp(); } // BrowserDB Constructor @@ -126,7 +126,7 @@ bool BrowserDB::OnStartDB(int Quiet) // Connect to datasource //--------------------------------------------------------------------------------------- DlgUser *p_Dlg; - p_Dlg = new DlgUser(pDoc->p_MainFrame,pDoc,_T("")); + p_Dlg = new DlgUser(pDoc->p_MainFrame,pDoc,wxEmptyString); p_Dlg->s_DSN = ODBCSource; p_Dlg->s_User = UserName; p_Dlg->s_Password = Password; @@ -153,9 +153,9 @@ bool BrowserDB::OnStartDB(int Quiet) // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str()); if (db_BrowserDB == NULL) { - DbConnectInf.SetDsn(wxT("")); - DbConnectInf.SetUserID(wxT("")); - DbConnectInf.SetPassword(wxT("")); + DbConnectInf.SetDsn(wxEmptyString); + DbConnectInf.SetUserID(wxEmptyString); + DbConnectInf.SetPassword(wxEmptyString); if (!Quiet) { wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)")); @@ -251,7 +251,7 @@ bool BrowserDB::OnGetNext(int Cols,int WXUNUSED(Quiet)) switch(i_dbDataType) { case DB_DATA_TYPE_VARCHAR: - wxStrcpy(s_temp,_T("")); + wxStrcpy(s_temp,wxEmptyString); if (!db_BrowserDB->GetData((UWORD)(i+1),(SWORD)((cl_BrowserDB+i)->pColFor->i_dbDataType),&s_temp[0],sizeof(s_temp), &cb)) { Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName); @@ -490,7 +490,7 @@ void BrowserDB::OnFillSqlTyp() i_SqlTyp[21] = SQL_NUMERIC; s_SqlTyp[21] = _T("SQL_NUMERIC"); i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = _T("SQL_LONGVARCHAR"); i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = _T("SQL_REAL"); - i_SqlTyp[0] = 23; s_SqlTyp[0] = _T(""); + i_SqlTyp[0] = 23; s_SqlTyp[0] = wxEmptyString; } //---------------------------------------------------------------------------------------- @@ -500,6 +500,6 @@ void BrowserDB::OnFilldbTyp() i_dbTyp[2] = DB_DATA_TYPE_INTEGER; s_dbTyp[2] = _T("DB_DATA_TYPE_INTEGER"); i_dbTyp[3] = DB_DATA_TYPE_FLOAT; s_dbTyp[3] = _T("DB_DATA_TYPE_FLOAT"); i_dbTyp[4] = DB_DATA_TYPE_DATE; s_dbTyp[4] = _T("DB_DATA_TYPE_DATE"); - i_dbTyp[0] = 4; s_dbTyp[0] = _T(""); + i_dbTyp[0] = 4; s_dbTyp[0] = wxEmptyString; } //---------------------------------------------------------------------------------------- diff --git a/demos/dbbrowse/dbbrowse.cpp b/demos/dbbrowse/dbbrowse.cpp index 8460f30e3d..dba13513bb 100644 --- a/demos/dbbrowse/dbbrowse.cpp +++ b/demos/dbbrowse/dbbrowse.cpp @@ -26,6 +26,8 @@ #ifndef WX_PRECOMP #include "wx/wx.h" #endif + +#include "wx/stockitem.h" //---------------------------------------------------------------------------------------- #ifndef __WXMSW__ #include "bitmaps/logo.xpm" @@ -39,9 +41,9 @@ //-- Some Global Vars for this file ------------------------------------------------------ //---------------------------------------------------------------------------------------- BEGIN_EVENT_TABLE(MainFrame, wxFrame) - EVT_MENU(QUIT, MainFrame::OnQuit) // Program End - EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription - EVT_MENU(HELP, MainFrame::OnHelp) // Program Help + EVT_MENU(wxID_EXIT, MainFrame::OnQuit) // Program End + EVT_MENU(wxID_ABOUT, MainFrame::OnAbout) // Program Discription + EVT_MENU(wxID_HELP, MainFrame::OnHelp) // Program Help END_EVENT_TABLE() //---------------------------------------------------------------------------------------- @@ -97,14 +99,14 @@ bool MainApp::OnInit(void) // Does everything needed for a program start // Win-Registry : Workplace\HKEY_CURRENT_USERS\Software\%GetVendorName()\%GetAppName() //--------------------------------------------------------------------------------------- SetVendorName(_T("mj10777")); // Needed to get Configuration Information - SetAppName(_T("DBBrowse")); // "" , also needed for s_LangHelp + SetAppName(_T("DBBrowse")); // "" , also needed for s_LangHelp //--------------------------------------------------------------------------------------- // we're using wxConfig's "create-on-demand" feature: it will create the // config object when it's used for the first time. It has a number of // advantages compared with explicitly creating our wxConfig: // 1) we don't pay for it if we don't use it // 2) there is no danger to create it twice - + // application and vendor name are used by wxConfig to construct the name // of the config file/registry key and must be set before the first call // to Get() if you want to override the default values (the application @@ -120,7 +122,7 @@ bool MainApp::OnInit(void) // Does everything needed for a program start { Temp0.Empty(); p_ProgramCfg->Read(_T("/Local/langid"),&Temp0); // >const char *langid< can't be used here - if (Temp0 == _T("")) + if (Temp0.empty()) langid = _T("std"); // Standard language is "std" = english else langid = Temp0; @@ -206,12 +208,12 @@ bool MainApp::OnInit(void) // Does everything needed for a program start // Make a menubar wxMenu *file_menu = new wxMenu; wxMenu *help_menu = new wxMenu; - - help_menu->Append(HELP, _("&Help")); + + help_menu->Append(wxID_HELP, wxGetStockLabel(wxID_HELP)); help_menu->AppendSeparator(); - help_menu->Append(ABOUT, _("&About")); - file_menu->Append(QUIT, _("E&xit")); - + help_menu->Append(wxID_ABOUT, _("&About")); + file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT)); + wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, _("&File")); menu_bar->Append(help_menu, _("&Help")); diff --git a/demos/dbbrowse/dbbrowse.h b/demos/dbbrowse/dbbrowse.h index 58470b80b6..0bf41ebd3a 100644 --- a/demos/dbbrowse/dbbrowse.h +++ b/demos/dbbrowse/dbbrowse.h @@ -15,7 +15,7 @@ class MainFrame: public wxFrame public: MainFrame(wxFrame *frame, wxChar *title, const wxPoint& pos, const wxSize& size); ~MainFrame(void); - + public: // menu callbacks void OnAbout(wxCommandEvent& event); @@ -46,9 +46,6 @@ public: //---------------------------------------------------------------------------------------- // ID for the menu quit command //---------------------------------------------------------------------------------------- -#define QUIT 777 -#define ABOUT 778 -#define HELP 779 #define TREE_CTRL_PGM 102 #define GRID_CTRL 103 #define TREE_CTRL_DB 104 diff --git a/demos/dbbrowse/dbgrid.cpp b/demos/dbbrowse/dbgrid.cpp index 3821a84cca..8647a88c44 100644 --- a/demos/dbbrowse/dbgrid.cpp +++ b/demos/dbbrowse/dbgrid.cpp @@ -67,9 +67,9 @@ wxGrid(parent, id, pos, size, style) { b_EditModus = false; //--------------------------------------------------------------------------------------- - popupMenu1 = new wxMenu(_T("")); + popupMenu1 = new wxMenu; popupMenu1->Append(GRID_EDIT, _("Edit Modus")); - popupMenu2 = new wxMenu(_T("")); + popupMenu2 = new wxMenu; popupMenu2->Append(GRID_BROWSE, _("Browse Modus")); } @@ -192,7 +192,7 @@ void DBGrid::OnEditorHidden( wxGridEvent& ev ) //---------------------------------------------------------------------------------------- void DBGrid::OnSelectCell( wxGridEvent& ev ) { - logBuf = _T(""); + logBuf = wxEmptyString; logBuf << _T("Selected cell at row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); wxLogMessage( _T("%s"), logBuf.c_str() ); diff --git a/demos/dbbrowse/dbtree.cpp b/demos/dbbrowse/dbtree.cpp index b2e6f15a29..9a0c7b217b 100644 --- a/demos/dbbrowse/dbtree.cpp +++ b/demos/dbbrowse/dbtree.cpp @@ -38,7 +38,7 @@ //---------------------------------------------------------------------------------------- static inline const wxChar *bool2String(bool b) { - return b ? _T("") : _T("not "); + return b ? wxEmptyString : _T("not "); } //---------------------------------------------------------------------------------------- @@ -174,7 +174,7 @@ int DBTree::OnPopulate() Temp2.Printf(_T("(%d) - %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName); Docu = AppendItem(Folder,Temp2,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1)); Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName; - if (Temp2 == _T("")) + if (Temp2.empty()) Temp2 = _("None"); Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2.c_str()); Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(_T("KEY"))); @@ -250,12 +250,12 @@ int DBTree::OnPopulate() Expand(Root); //--------------------------------------------------------------------------------------- popupMenu1 = NULL; - popupMenu1 = new wxMenu(_T("")); + popupMenu1 = new wxMenu; popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h ")); popupMenu1->AppendSeparator(); popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes")); popupMenu2 = NULL; - popupMenu2 = new wxMenu(_T("")); + popupMenu2 = new wxMenu; popupMenu2->Append(DATA_SHOW, _("Show Data")); popupMenu2->AppendSeparator(); popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h ")); diff --git a/demos/dbbrowse/dlguser.cpp b/demos/dbbrowse/dlguser.cpp index 9c2f60bff7..0e08dbb640 100644 --- a/demos/dbbrowse/dlguser.cpp +++ b/demos/dbbrowse/dlguser.cpp @@ -92,7 +92,7 @@ DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : //layout->height.AsIs(); m_Password->SetConstraints(layout); - m_OK = new wxButton(this, wxID_OK, _("OK")); + m_OK = new wxButton(this, wxID_OK); m_OK->SetFont(* pDoc->ft_Doc); layout = new wxLayoutConstraints; layout->left.SameAs(this, wxLeft, 10); @@ -101,7 +101,7 @@ DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : layout->width.Absolute(75); m_OK->SetConstraints(layout); - m_Cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); + m_Cancel = new wxButton(this, wxID_CANCEL); m_Cancel->SetFont(* pDoc->ft_Doc); layout = new wxLayoutConstraints; layout->left.SameAs(m_OK, wxRight, 10); diff --git a/demos/dbbrowse/doc.cpp b/demos/dbbrowse/doc.cpp index c8044d37a1..637de5a016 100644 --- a/demos/dbbrowse/doc.cpp +++ b/demos/dbbrowse/doc.cpp @@ -157,7 +157,7 @@ bool MainDoc::OnInitODBC() { wxChar Dsn[SQL_MAX_DSN_LENGTH+1]; wxChar DsDesc[254+1]; // BJO20002501 instead of 512 - Temp0 = _T(""); + Temp0 = wxEmptyString; i_DSN = 0; // Counter int i; //--------------------------------------------------------------------------------------- @@ -183,7 +183,7 @@ bool MainDoc::OnInitODBC() s_SortDSNList.Add(Dsn); s_SortDsDescList.Add(KeyString); } - + //--------------------------------------------------------------------------------------- // Allocate n ODBC-DSN objects to hold the information // Allocate n wxDatabase objects to hold the column information @@ -197,8 +197,8 @@ bool MainDoc::OnInitODBC() // ODBC-DSN object (p_DSN+i)->Dsn = s_SortDSNList[i]; (p_DSN+i)->Drv = KeyString; - (p_DSN+i)->Usr = _T(""); - (p_DSN+i)->Pas = _T(""); + (p_DSN+i)->Usr = wxEmptyString; + (p_DSN+i)->Pas = wxEmptyString; Temp0.Printf(_T("%02d) Dsn(%s) DsDesc(%s)"),i,(p_DSN+i)->Dsn.c_str(),(p_DSN+i)->Drv.c_str()); wxLogMessage(Temp0); @@ -236,7 +236,7 @@ bool MainDoc::OnChosenDSN(int Which) p_TabArea->Show(false); // Deactivate the Window p_TabArea->RemoveTab(p_DBTree->i_ViewNr); p_TabArea->Show(true); // Activate the Window - OnChosenTbl(77,_T("")); + OnChosenTbl(77,wxEmptyString); } //------------------------- p_TabArea->Show(false); // Deactivate the Window @@ -286,7 +286,7 @@ bool MainDoc::OnChosenTbl(int Tab,wxString Table) p_TabArea->Show(false); // Deactivate the Window p_DBGrid = new DBGrid(p_TabArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER); - p_TabArea->AddTab(p_DBGrid, Table, _T("")); + p_TabArea->AddTab(p_DBGrid, Table, wxEmptyString); p_DBGrid->i_ViewNr = p_TabArea->GetTabCount()-1; p_DBGrid->pDoc = this; p_DBGrid->db_Br = db_Br; @@ -299,7 +299,7 @@ bool MainDoc::OnChosenTbl(int Tab,wxString Table) p_PageArea->Show(false); // Deactivate the Window p_DBGrid = new DBGrid(p_PageArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER); - p_PageArea->AddTab(p_DBGrid, Table, _T("")); + p_PageArea->AddTab(p_DBGrid, Table, wxEmptyString); p_DBGrid->i_ViewNr = p_PageArea->GetTabCount()-1; p_DBGrid->pDoc = this; p_DBGrid->db_Br = db_Br; diff --git a/demos/dbbrowse/pgmctrl.cpp b/demos/dbbrowse/pgmctrl.cpp index e4e40333d3..5e6138fdcc 100644 --- a/demos/dbbrowse/pgmctrl.cpp +++ b/demos/dbbrowse/pgmctrl.cpp @@ -45,7 +45,7 @@ //---------------------------------------------------------------------------------------- static inline const wxChar *bool2String(bool b) { - return b ? _T("") : _T("not "); + return b ? wxEmptyString : _T("not "); } //---------------------------------------------------------------------------------------- @@ -88,7 +88,7 @@ PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const PgmCtrl::~PgmCtrl() { delete p_imageListNormal; - delete popupMenu1; + delete popupMenu1; } //---------------------------------------------------------------------------------------- @@ -122,7 +122,7 @@ int PgmCtrl::OnPopulate() } //--------------------------------------------------------------------------------------- popupMenu1 = NULL; - popupMenu1 = new wxMenu(_T("")); + popupMenu1 = new wxMenu; popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password")); // popupMenu1->AppendSeparator(); //--------------------------------------------------------------------------------------- @@ -262,7 +262,7 @@ void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event)) // wxMessageBox(SaveDSN); int i; //-------------------------------------------- - DlgUser *p_Dlg = new DlgUser(this,pDoc,_T("")); + DlgUser *p_Dlg = new DlgUser(this,pDoc,wxEmptyString); //------------------------------------------- for (i=0;ii_DSN;i++) { diff --git a/demos/dbbrowse/pgmctrl.h b/demos/dbbrowse/pgmctrl.h index 29037010e5..6bb27f07a8 100644 --- a/demos/dbbrowse/pgmctrl.h +++ b/demos/dbbrowse/pgmctrl.h @@ -56,7 +56,7 @@ public: void OnRightSelect(wxTreeEvent& event); void OnMouseMove(wxMouseEvent& event); void OnUserPassword(wxCommandEvent& event); - + public: //---------------------------------------------------------------------------------------- // NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS() diff --git a/demos/forty/canvas.cpp b/demos/forty/canvas.cpp index 013576c088..30eb0fe394 100644 --- a/demos/forty/canvas.cpp +++ b/demos/forty/canvas.cpp @@ -137,7 +137,7 @@ void FortyCanvas::ShowPlayerDialog() int wins, games, score; m_scoreFile->ReadPlayersScore(m_player, wins, games, score); m_game->NewPlayer(wins, games, score); - + wxClientDC dc(this); dc.SetFont(* m_font); m_game->DisplayScore(dc); @@ -152,7 +152,7 @@ void FortyCanvas::ShowPlayerDialog() } } } - + /* Called when the main frame is closed */ @@ -172,7 +172,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event) int mouseX = (int)event.GetX(); int mouseY = (int)event.GetY(); - wxClientDC dc(this); + wxClientDC dc(this); PrepareDC(dc); dc.SetFont(* m_font); @@ -233,7 +233,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event) void FortyCanvas::SetCursorStyle(int x, int y) { // Only set cursor to a hand if 'helping hand' is enabled and - // the card under the cursor can go somewhere + // the card under the cursor can go somewhere if (m_game->CanYouGo(x, y) && m_helpingHand) { SetCursor(* m_handCursor); @@ -253,7 +253,7 @@ void FortyCanvas::NewGame() void FortyCanvas::Undo() { - wxClientDC dc(this); + wxClientDC dc(this); PrepareDC(dc); dc.SetFont(* m_font); m_game->Undo(dc); @@ -261,7 +261,7 @@ void FortyCanvas::Undo() void FortyCanvas::Redo() { - wxClientDC dc(this); + wxClientDC dc(this); PrepareDC(dc); dc.SetFont(* m_font); m_game->Redo(dc); diff --git a/demos/forty/forty.cpp b/demos/forty/forty.cpp index 7713b93d50..b981aa9774 100644 --- a/demos/forty/forty.cpp +++ b/demos/forty/forty.cpp @@ -37,13 +37,15 @@ #include "wx/html/htmlwin.h" #endif +#include "wx/stockitem.h" + BEGIN_EVENT_TABLE(FortyFrame, wxFrame) - EVT_MENU(NEW_GAME, FortyFrame::NewGame) + EVT_MENU(wxID_NEW, FortyFrame::NewGame) EVT_MENU(wxID_EXIT, FortyFrame::Exit) EVT_MENU(wxID_ABOUT, FortyFrame::About) EVT_MENU(wxID_HELP_CONTENTS, FortyFrame::Help) - EVT_MENU(UNDO, FortyFrame::Undo) - EVT_MENU(REDO, FortyFrame::Redo) + EVT_MENU(wxID_UNDO, FortyFrame::Undo) + EVT_MENU(wxID_REDO, FortyFrame::Redo) EVT_MENU(SCORES, FortyFrame::Scores) EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo) EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand) @@ -151,13 +153,13 @@ FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos // Make a menu bar wxMenu* gameMenu = new wxMenu; - gameMenu->Append(NEW_GAME, _T("&New"), _T("Start a new game")); + gameMenu->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), _T("Start a new game")); gameMenu->Append(SCORES, _T("&Scores..."), _T("Displays scores")); - gameMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exits Forty Thieves")); + gameMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), _T("Exits Forty Thieves")); wxMenu* editMenu = new wxMenu; - editMenu->Append(UNDO, _T("&Undo"), _T("Undo the last move")); - editMenu->Append(REDO, _T("&Redo"), _T("Redo a move that has been undone")); + editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO), _T("Undo the last move")); + editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO), _T("Redo a move that has been undone")); wxMenu* optionsMenu = new wxMenu; optionsMenu->Append(RIGHT_BUTTON_UNDO, @@ -308,6 +310,7 @@ FortyFrame::ToggleCardSize(wxCommandEvent& event) //---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(FortyAboutDialog,wxDialog) + EVT_BUTTON(wxID_CLOSE, wxDialog::OnOK) END_EVENT_TABLE() FortyAboutDialog::FortyAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title, @@ -336,7 +339,7 @@ bool FortyAboutDialog::AddControls(wxWindow* parent) } } - if (htmlText.IsEmpty()) + if (htmlText.empty()) { htmlText.Printf(wxT("Warning

Sorry, could not find resource for About dialog

")); } @@ -366,7 +369,7 @@ bool FortyAboutDialog::AddControls(wxWindow* parent) wxASSERT( item1 ); item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 ); - wxButton *item2 = new wxButton( parent, wxID_CANCEL, _T("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton *item2 = new wxButton( parent, wxID_CLOSE ); item2->SetDefault(); item2->SetFocus(); diff --git a/demos/forty/forty.h b/demos/forty/forty.h index c0e7e6f12b..91b847749d 100644 --- a/demos/forty/forty.h +++ b/demos/forty/forty.h @@ -61,10 +61,7 @@ public: private: enum MenuCommands { - NEW_GAME = 10, - SCORES, - UNDO, - REDO, + SCORES = 10, RIGHT_BUTTON_UNDO, HELPING_HAND, LARGE_CARDS diff --git a/demos/forty/playerdg.cpp b/demos/forty/playerdg.cpp index e5b5ee8267..1454290692 100644 --- a/demos/forty/playerdg.cpp +++ b/demos/forty/playerdg.cpp @@ -63,8 +63,8 @@ PlayerSelectionDialog::PlayerSelectionDialog( m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize); - m_OK = new wxButton(this, wxID_OK, _T("OK")); - m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel")); + m_OK = new wxButton(this, wxID_OK); + m_cancel = new wxButton(this, wxID_CANCEL); wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); button_sizer->Add( m_OK, 0, wxALL, 10 ); diff --git a/demos/forty/scoredg.cpp b/demos/forty/scoredg.cpp index eca8a7bd8d..dce78ba2ab 100644 --- a/demos/forty/scoredg.cpp +++ b/demos/forty/scoredg.cpp @@ -191,7 +191,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) : // locate and resize with sizers wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); topsizer->Add( list, 1, wxALL|wxGROW, 10 ); - wxButton *button = new wxButton(this, wxID_OK, _("OK")); + wxButton *button = new wxButton(this, wxID_OK); topsizer->Add( button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL , 10 ); button->SetFocus(); diff --git a/demos/fractal/fractal.cpp b/demos/fractal/fractal.cpp index 51df2ed7c2..5f73ce6ace 100644 --- a/demos/fractal/fractal.cpp +++ b/demos/fractal/fractal.cpp @@ -43,6 +43,7 @@ hack doesn't fix. #endif //precompiled headers #include "wx/math.h" +#include "wx/stockitem.h" #include #include @@ -101,7 +102,7 @@ bool MyApp::OnInit() // Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(wxID_EXIT, _T("E&xit")); + file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT)); menuBar = new wxMenuBar; menuBar->Append(file_menu, _T("&File")); frame->SetMenuBar(menuBar); diff --git a/demos/life/game.cpp b/demos/life/game.cpp index 93bc26c418..119b06bb3c 100644 --- a/demos/life/game.cpp +++ b/demos/life/game.cpp @@ -114,9 +114,9 @@ bool LifeCellBox::SetCell(int dx, int dy, bool alive) Life::Life() { // pattern description - m_name = _(""); - m_rules = _(""); - m_description = _(""); + m_name = wxEmptyString; + m_rules = wxEmptyString; + m_description = wxEmptyString; // pattern data m_numcells = 0; @@ -173,9 +173,9 @@ void Life::Clear() m_available = NULL; // reset state - m_name = _(""); - m_rules = _(""); - m_description = _(""); + m_name = wxEmptyString; + m_rules = wxEmptyString; + m_description = wxEmptyString; m_numcells = 0; } @@ -403,7 +403,7 @@ LifeCell Life::FindNorth() y = c->m_y; first = false; } - + LifeCell cell; cell.i = first? 0 : x + CELLBOX / 2; cell.j = first? 0 : y + CELLBOX / 2; @@ -423,7 +423,7 @@ LifeCell Life::FindSouth() y = c->m_y; first = false; } - + LifeCell cell; cell.i = first? 0 : x + CELLBOX / 2; cell.j = first? 0 : y + CELLBOX / 2; @@ -443,7 +443,7 @@ LifeCell Life::FindWest() y = c->m_y; first = false; } - + LifeCell cell; cell.i = first? 0 : x + CELLBOX / 2; cell.j = first? 0 : y + CELLBOX / 2; @@ -463,7 +463,7 @@ LifeCell Life::FindEast() y = c->m_y; first = false; } - + LifeCell cell; cell.i = first? 0 : x + CELLBOX / 2; cell.j = first? 0 : y + CELLBOX / 2; @@ -870,7 +870,7 @@ bool Life::NextTic() t2 |= g_tab[ ((t4 & 0x0000ffff) << 4 ) + ((t3 >> 24) & 0xf) ] << 24; t2 |= g_tab[ ((t4 & 0xffff0000) >> 12) + ((t3 >> 28) & 0xf) ] << 28; - c->m_on[0] = c->m_on[1] = c->m_on[2] = c->m_on[3] = + c->m_on[0] = c->m_on[1] = c->m_on[2] = c->m_on[3] = c->m_on[4] = c->m_on[5] = c->m_on[6] = c->m_on[7] = 0; c->m_live1 = t1; c->m_live2 = t2; @@ -1136,7 +1136,7 @@ int g_tab1[]= 0x11112110, 0x11112121, 0x11112221, - 0x11112232, + 0x11112232, 0x11122100, 0x11122111, 0x11122211, diff --git a/demos/life/game.h b/demos/life/game.h index 6693c2aeef..323fd2b06f 100644 --- a/demos/life/game.h +++ b/demos/life/game.h @@ -47,8 +47,8 @@ public: m_rules = rules; m_shape = shape; }; - - // A more convenient ctor for the built-in samples + + // A more convenient ctor for the built-in samples LifePattern(wxString name, wxString description, int width, @@ -57,7 +57,7 @@ public: { m_name = name; m_description = description; - m_rules = _(""); + m_rules = wxEmptyString; m_shape.Add( wxString::Format(_T("%i %i"), -width/2, -height/2) ); for(int j = 0; j < height; j++) { @@ -88,7 +88,7 @@ struct LifeCell { wxInt32 i; wxInt32 j; -}; +}; // A private class that contains data about a block of cells class LifeCellBox; diff --git a/demos/life/life.cpp b/demos/life/life.cpp index c08bb17c4f..ca0e56200d 100644 --- a/demos/life/life.cpp +++ b/demos/life/life.cpp @@ -31,6 +31,7 @@ #include "wx/statline.h" #include "wx/wfstream.h" #include "wx/filedlg.h" +#include "wx/stockitem.h" #include "life.h" #include "game.h" @@ -84,14 +85,11 @@ enum ID_SOUTH, ID_EAST, ID_WEST, - ID_ZOOMIN, - ID_ZOOMOUT, ID_INFO, // game menu ID_START, ID_STEP, - ID_STOP, ID_TOPSPEED, // speed selection slider @@ -104,28 +102,28 @@ enum // Event tables BEGIN_EVENT_TABLE(LifeFrame, wxFrame) - EVT_MENU (wxID_NEW, LifeFrame::OnMenu) - EVT_MENU (wxID_OPEN, LifeFrame::OnOpen) - EVT_MENU (ID_SAMPLES, LifeFrame::OnSamples) - EVT_MENU (wxID_ABOUT, LifeFrame::OnMenu) - EVT_MENU (wxID_EXIT, LifeFrame::OnMenu) - EVT_MENU (ID_SHOWNAV, LifeFrame::OnMenu) - EVT_MENU (ID_ORIGIN, LifeFrame::OnNavigate) - EVT_BUTTON (ID_CENTER, LifeFrame::OnNavigate) - EVT_BUTTON (ID_NORTH, LifeFrame::OnNavigate) - EVT_BUTTON (ID_SOUTH, LifeFrame::OnNavigate) - EVT_BUTTON (ID_EAST, LifeFrame::OnNavigate) - EVT_BUTTON (ID_WEST, LifeFrame::OnNavigate) - EVT_MENU (ID_ZOOMIN, LifeFrame::OnZoom) - EVT_MENU (ID_ZOOMOUT, LifeFrame::OnZoom) - EVT_MENU (ID_INFO, LifeFrame::OnMenu) - EVT_MENU (ID_START, LifeFrame::OnMenu) - EVT_MENU (ID_STEP, LifeFrame::OnMenu) - EVT_MENU (ID_STOP, LifeFrame::OnMenu) - EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu) - EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider) - EVT_TIMER (ID_TIMER, LifeFrame::OnTimer) - EVT_CLOSE ( LifeFrame::OnClose) + EVT_MENU (wxID_NEW, LifeFrame::OnMenu) + EVT_MENU (wxID_OPEN, LifeFrame::OnOpen) + EVT_MENU (ID_SAMPLES, LifeFrame::OnSamples) + EVT_MENU (wxID_ABOUT, LifeFrame::OnMenu) + EVT_MENU (wxID_EXIT, LifeFrame::OnMenu) + EVT_MENU (ID_SHOWNAV, LifeFrame::OnMenu) + EVT_MENU (ID_ORIGIN, LifeFrame::OnNavigate) + EVT_BUTTON (ID_CENTER, LifeFrame::OnNavigate) + EVT_BUTTON (ID_NORTH, LifeFrame::OnNavigate) + EVT_BUTTON (ID_SOUTH, LifeFrame::OnNavigate) + EVT_BUTTON (ID_EAST, LifeFrame::OnNavigate) + EVT_BUTTON (ID_WEST, LifeFrame::OnNavigate) + EVT_MENU (wxID_ZOOM_IN, LifeFrame::OnZoom) + EVT_MENU (wxID_ZOOM_OUT,LifeFrame::OnZoom) + EVT_MENU (ID_INFO, LifeFrame::OnMenu) + EVT_MENU (ID_START, LifeFrame::OnMenu) + EVT_MENU (ID_STEP, LifeFrame::OnMenu) + EVT_MENU (wxID_STOP, LifeFrame::OnMenu) + EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu) + EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider) + EVT_TIMER (ID_TIMER, LifeFrame::OnTimer) + EVT_CLOSE ( LifeFrame::OnClose) END_EVENT_TABLE() BEGIN_EVENT_TABLE(LifeNavigator, wxMiniFrame) @@ -197,11 +195,11 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY, wxMenu *menuGame = new wxMenu(wxMENU_TEAROFF); wxMenu *menuHelp = new wxMenu(wxMENU_TEAROFF); - menuFile->Append(wxID_NEW, _("&New"), _("Start a new game")); - menuFile->Append(wxID_OPEN, _("&Open..."), _("Open an existing Life pattern")); + menuFile->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), _("Start a new game")); + menuFile->Append(wxID_OPEN, wxGetStockLabel(wxID_OPEN), _("Open an existing Life pattern")); menuFile->Append(ID_SAMPLES, _("&Sample game..."), _("Select a sample configuration")); menuFile->AppendSeparator(); - menuFile->Append(wxID_EXIT, _("E&xit\tAlt-X"), _("Quit this program")); + menuFile->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT, true, _T("Alt-X")), _("Quit this program")); menuView->Append(ID_SHOWNAV, _("Navigation &toolbox"), _("Show or hide toolbox"), wxITEM_CHECK); menuView->Check(ID_SHOWNAV, true); @@ -213,14 +211,14 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY, menuView->Append(ID_EAST, _("&East"), _("Find easternmost cell")); menuView->Append(ID_WEST, _("&West"), _("Find westernmost cell")); menuView->AppendSeparator(); - menuView->Append(ID_ZOOMIN, _("Zoom &in\tCtrl-I"), _("Zoom in")); - menuView->Append(ID_ZOOMOUT, _("Zoom &out\tCtrl-O"), _("Zoom out")); + menuView->Append(wxID_ZOOM_IN, wxGetStockLabel(wxID_ZOOM_IN, true, _T("Ctrl-I")), _("Zoom in")); + menuView->Append(wxID_ZOOM_OUT, wxGetStockLabel(wxID_ZOOM_OUT, true, _T("Ctrl-O")), _("Zoom out")); menuView->Append(ID_INFO, _("&Description\tCtrl-D"), _("View pattern description")); menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start")); menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step")); - menuGame->Append(ID_STOP, _("S&top\tCtrl-T"), _("Stop")); - menuGame->Enable(ID_STOP, false); + menuGame->Append(wxID_STOP, wxGetStockLabel(wxID_STOP, true, _T("Ctrl-T")), _("Stop")); + menuGame->Enable(wxID_STOP, false); menuGame->AppendSeparator(); menuGame->Append(ID_TOPSPEED, _("T&op speed!"), _("Go as fast as possible")); @@ -248,18 +246,18 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY, toolBar->SetMargins(5, 5); toolBar->SetToolBitmapSize(wxSize(16, 16)); - ADD_TOOL(wxID_NEW, tbBitmaps[0], _("New"), _("Start a new game")); - ADD_TOOL(wxID_OPEN, tbBitmaps[1], _("Open"), _("Open an existing Life pattern")); + ADD_TOOL(wxID_NEW, tbBitmaps[0], wxGetStockLabel(wxID_NEW, false), _("Start a new game")); + ADD_TOOL(wxID_OPEN, tbBitmaps[1], wxGetStockLabel(wxID_OPEN, false), _("Open an existing Life pattern")); toolBar->AddSeparator(); - ADD_TOOL(ID_ZOOMIN, tbBitmaps[2], _("Zoom in"), _("Zoom in")); - ADD_TOOL(ID_ZOOMOUT, tbBitmaps[3], _("Zoom out"), _("Zoom out")); + ADD_TOOL(wxID_ZOOM_IN, tbBitmaps[2], wxGetStockLabel(wxID_ZOOM_IN, false), _("Zoom in")); + ADD_TOOL(wxID_ZOOM_OUT, tbBitmaps[3], wxGetStockLabel(wxID_ZOOM_OUT, false), _("Zoom out")); ADD_TOOL(ID_INFO, tbBitmaps[4], _("Description"), _("Show description")); toolBar->AddSeparator(); ADD_TOOL(ID_START, tbBitmaps[5], _("Start"), _("Start")); - ADD_TOOL(ID_STOP, tbBitmaps[6], _("Stop"), _("Stop")); + ADD_TOOL(wxID_STOP, tbBitmaps[6], wxGetStockLabel(wxID_STOP, false), _("Stop")); toolBar->Realize(); - toolBar->EnableTool(ID_STOP, false); // must be after Realize() ! + toolBar->EnableTool(wxID_STOP, false); // must be after Realize() ! #if wxUSE_STATUSBAR // status bar @@ -357,18 +355,18 @@ void LifeFrame::UpdateUI() { // start / stop GetToolBar()->EnableTool(ID_START, !m_running); - GetToolBar()->EnableTool(ID_STOP, m_running); + GetToolBar()->EnableTool(wxID_STOP, m_running); GetMenuBar()->Enable(ID_START, !m_running); GetMenuBar()->Enable(ID_STEP, !m_running); - GetMenuBar()->Enable(ID_STOP, m_running); + GetMenuBar()->Enable(wxID_STOP, m_running); GetMenuBar()->Enable(ID_TOPSPEED, !m_topspeed); // zooming int cellsize = m_canvas->GetCellSize(); - GetToolBar()->EnableTool(ID_ZOOMIN, cellsize < 32); - GetToolBar()->EnableTool(ID_ZOOMOUT, cellsize > 1); - GetMenuBar()->Enable(ID_ZOOMIN, cellsize < 32); - GetMenuBar()->Enable(ID_ZOOMOUT, cellsize > 1); + GetToolBar()->EnableTool(wxID_ZOOM_IN, cellsize < 32); + GetToolBar()->EnableTool(wxID_ZOOM_OUT, cellsize > 1); + GetMenuBar()->Enable(wxID_ZOOM_IN, cellsize < 32); + GetMenuBar()->Enable(wxID_ZOOM_OUT, cellsize > 1); } // Event handlers ----------------------------------------------------------- @@ -410,7 +408,7 @@ void LifeFrame::OnMenu(wxCommandEvent& event) { wxString desc = m_life->GetDescription(); - if ( desc.IsEmpty() ) + if ( desc.empty() ) desc = _("Not available"); // should we make the description editable here? @@ -420,7 +418,7 @@ void LifeFrame::OnMenu(wxCommandEvent& event) } case ID_START : OnStart(); break; case ID_STEP : OnStep(); break; - case ID_STOP : OnStop(); break; + case wxID_STOP : OnStop(); break; case ID_TOPSPEED: { m_running = true; @@ -493,12 +491,12 @@ void LifeFrame::OnZoom(wxCommandEvent& event) { int cellsize = m_canvas->GetCellSize(); - if ((event.GetId() == ID_ZOOMIN) && cellsize < 32) + if ((event.GetId() == wxID_ZOOM_IN) && cellsize < 32) { m_canvas->SetCellSize(cellsize * 2); UpdateUI(); } - else if ((event.GetId() == ID_ZOOMOUT) && cellsize > 1) + else if ((event.GetId() == wxID_ZOOM_OUT) && cellsize > 1) { m_canvas->SetCellSize(cellsize / 2); UpdateUI(); diff --git a/demos/life/life.h b/demos/life/life.h index 48e9aca92a..9e06260115 100644 --- a/demos/life/life.h +++ b/demos/life/life.h @@ -92,9 +92,9 @@ private: wxInt32 m_viewportY; // first visible cell (y coord) wxInt32 m_viewportW; // number of visible cells (w) wxInt32 m_viewportH; // number of visible cells (h) - int m_thumbX; // horiz. scrollbar thumb position - int m_thumbY; // vert. scrollbar thumb position - wxInt32 m_mi, m_mj; // last mouse position + int m_thumbX; // horiz. scrollbar thumb position + int m_thumbY; // vert. scrollbar thumb position + wxInt32 m_mi, m_mj; // last mouse position }; @@ -151,7 +151,7 @@ private: void OnStop(); void OnStep(); - Life *m_life; + Life *m_life; LifeCanvas *m_canvas; LifeNavigator *m_navigator; wxStaticText *m_text; diff --git a/demos/life/reader.cpp b/demos/life/reader.cpp index 26002d1904..95c10691f3 100644 --- a/demos/life/reader.cpp +++ b/demos/life/reader.cpp @@ -47,7 +47,7 @@ LifeReader::LifeReader(wxInputStream& is) { wxBufferedInputStream buff_is(is); wxTextInputStream text_is(buff_is); - wxString line, rest; + wxString line, rest; // check stream m_ok = is.IsOk(); @@ -58,7 +58,7 @@ LifeReader::LifeReader(wxInputStream& is) LIFE_CHECKVAL(_("Error reading signature. Not a Life pattern?")); // read description - m_description = wxT(""); + m_description = wxEmptyString; line = text_is.ReadLine(); while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest)) { @@ -79,7 +79,7 @@ LifeReader::LifeReader(wxInputStream& is) { line = ( text_is.ReadLine() ).Trim(); - if (!line.IsEmpty()) + if (!line.empty()) { if (line.StartsWith(wxT("#P "), &rest)) m_shape.Add(rest); diff --git a/demos/life/reader.h b/demos/life/reader.h index 803d219637..2a88cd065f 100644 --- a/demos/life/reader.h +++ b/demos/life/reader.h @@ -45,7 +45,7 @@ public: inline wxArrayString GetShape() const { return m_shape; }; inline LifePattern GetPattern() const { - return LifePattern(_(""), m_description, m_rules, m_shape); + return LifePattern(wxEmptyString, m_description, m_rules, m_shape); }; private: