]> git.saurik.com Git - wxWidgets.git/commitdiff
Enhanced stock labels usage. Source cleaning.
authorWłodzimierz Skiba <abx@abx.art.pl>
Mon, 31 Jan 2005 18:18:18 +0000 (18:18 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Mon, 31 Jan 2005 18:18:18 +0000 (18:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

21 files changed:
demos/dbbrowse/browsedb.cpp
demos/dbbrowse/dbbrowse.cpp
demos/dbbrowse/dbbrowse.h
demos/dbbrowse/dbgrid.cpp
demos/dbbrowse/dbtree.cpp
demos/dbbrowse/dlguser.cpp
demos/dbbrowse/doc.cpp
demos/dbbrowse/pgmctrl.cpp
demos/dbbrowse/pgmctrl.h
demos/forty/canvas.cpp
demos/forty/forty.cpp
demos/forty/forty.h
demos/forty/playerdg.cpp
demos/forty/scoredg.cpp
demos/fractal/fractal.cpp
demos/life/game.cpp
demos/life/game.h
demos/life/life.cpp
demos/life/life.h
demos/life/reader.cpp
demos/life/reader.h

index 813beeb8dd3ea503cb918149b74c002abb259922..c4a2c6f58549d9baa5109e8babe9aa4fa509ab3e 100644 (file)
@@ -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;
 }
 //----------------------------------------------------------------------------------------
index 8460f30e3d82e4e9adf7fab33bbee9aed4dba8a4..dba13513bb8b5834a08980ed6251e4b70c42acfe 100644 (file)
@@ -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"));
index 58470b80b682dd00be5c2ee2e239c91bba2b893a..0bf41ebd3a0dfeba8ea736acbb2cbd6b03cbaea8 100644 (file)
@@ -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
index 3821a84cca87aeef1c32ddf30345de4bc5fb46f5..8647a88c441afe98f89146863ac77a117c5ed935 100644 (file)
@@ -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() );
index b2e6f15a29c8f41cf05dedc4b865be2c1ca49d6b..9a0c7b217b905544e8db47ad6fe7a39c9b31d781 100644 (file)
@@ -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 "));
index 9c2f60bff7cde1ec50efab6c6ecf7d797c4b9041..0e08dbb640bd0685084946d6ed31edfc5ae83efc 100644 (file)
@@ -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);
index c8044d37a160a0adbfc322e42db45cb03605a118..637de5a016bb4f9d95f241c54cfa048a678cba38 100644 (file)
@@ -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;
index e4e40333d3b8057c353b1d301808484eb84c334a..5e6138fdcc069d53ed2355b26d11ff00df5fecc1 100644 (file)
@@ -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;i<pDoc->i_DSN;i++)
     {
index 29037010e5d17f7b7539570556a5b693d213467e..6bb27f07a80ee128b1c7af7859c36be07f81aa4b 100644 (file)
@@ -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()
index 013576c088f3f3d8164a27463bed29e8e7cf8eed..30eb0fe3945564c250ca1bda1b511160bae15a17 100644 (file)
@@ -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);
index 7713b93d5009e9b81392371382a5a4543a1de5e3..b981aa9774628a0f995e2b77368c496bcaa90cb4 100644 (file)
 #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("<html><head><title>Warning</title></head><body><P>Sorry, could not find resource for About dialog<P></body></html>"));
     }
@@ -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();
 
index c0e7e6f12bd93306d89ab0c81dbff9153916ea96..91b847749db4bb056b7f9a43a25e466c076bf545 100644 (file)
@@ -61,10 +61,7 @@ public:
 
 private:
     enum MenuCommands {
-        NEW_GAME = 10,
-        SCORES,
-        UNDO,
-        REDO,
+        SCORES = 10,
         RIGHT_BUTTON_UNDO,
         HELPING_HAND,
         LARGE_CARDS
index e5b5ee8267c6d4c74427a7d9d771406ade5e708c..1454290692aebca0b771d7a04fef414150d5278f 100644 (file)
@@ -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 );
index eca8a7bd8db6359a1f6bdc7e738b5abe54481dde..dce78ba2ab3c299114d7ec3fc7a8780e7a8f9c97 100644 (file)
@@ -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();
 
index 51df2ed7c2974c95d75c63841ab8cd35fe792ed3..5f73ce6ace2bba7397e8f09078ae91c08674ce69 100644 (file)
@@ -43,6 +43,7 @@ hack doesn't fix.
 #endif //precompiled headers
 
 #include "wx/math.h"
+#include "wx/stockitem.h"
 
 #include <stdlib.h>
 #include <time.h>
@@ -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);
index 93bc26c418bd2c260e6c776eed1065abc69ca486..119b06bb3cdf7e5574511046001e1f955aae9d18 100644 (file)
@@ -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,
index 6693c2aeef5ad641bc30455f0706b9b62bdf68f3..323fd2b06fb049ea923e0be182ef5e16b3e17724 100644 (file)
@@ -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;
index c08bb17c4f172fc33d76d6ab704d4e31f7954afe..ca0e56200dd742e0d403cddf9f8e9902446e3f00 100644 (file)
@@ -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();
index 48e9aca92aa8a0809931634ca5ac46dbb1f15930..9e06260115fc8bcc076b2a1f1961e1d25ee69aac 100644 (file)
@@ -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;
index 26002d19048c62b5d58dc11283e065326a773c1b..95c10691f31790dce610d82d070a1ad4f4e67029 100644 (file)
@@ -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);
index 803d21963713bf37d776233841f3c2ecafbd6705..2a88cd065f313ac95fbb1e9e84222a8ce05cd905 100644 (file)
@@ -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: