Enhanced stock labels usage. Source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -70,7 +70,7 @@ wxChar *GetExtendedDBErrorMsg(wxChar *ErrFile, int ErrLine)
|
|||||||
if (pDbList->PtrDb->errorList[i])
|
if (pDbList->PtrDb->errorList[i])
|
||||||
{
|
{
|
||||||
msg.Append(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"));
|
msg.Append(_T("\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,9 +83,9 @@ wxChar *GetExtendedDBErrorMsg(wxChar *ErrFile, int ErrLine)
|
|||||||
BrowserDB::BrowserDB()
|
BrowserDB::BrowserDB()
|
||||||
{
|
{
|
||||||
PointerToNULL(0);
|
PointerToNULL(0);
|
||||||
ODBCSource = _T(""); // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
ODBCSource = wxEmptyString; // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
||||||
UserName = _T(""); // database username - must already exist in the data source
|
UserName = wxEmptyString; // database username - must already exist in the data source
|
||||||
Password = _T(""); // password database username
|
Password = wxEmptyString; // password database username
|
||||||
OnFillSqlTyp();
|
OnFillSqlTyp();
|
||||||
OnFilldbTyp();
|
OnFilldbTyp();
|
||||||
} // BrowserDB Constructor
|
} // BrowserDB Constructor
|
||||||
@@ -126,7 +126,7 @@ bool BrowserDB::OnStartDB(int Quiet)
|
|||||||
// Connect to datasource
|
// Connect to datasource
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
DlgUser *p_Dlg;
|
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_DSN = ODBCSource;
|
||||||
p_Dlg->s_User = UserName;
|
p_Dlg->s_User = UserName;
|
||||||
p_Dlg->s_Password = Password;
|
p_Dlg->s_Password = Password;
|
||||||
@@ -153,9 +153,9 @@ bool BrowserDB::OnStartDB(int Quiet)
|
|||||||
// wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
|
// wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
|
||||||
if (db_BrowserDB == NULL)
|
if (db_BrowserDB == NULL)
|
||||||
{
|
{
|
||||||
DbConnectInf.SetDsn(wxT(""));
|
DbConnectInf.SetDsn(wxEmptyString);
|
||||||
DbConnectInf.SetUserID(wxT(""));
|
DbConnectInf.SetUserID(wxEmptyString);
|
||||||
DbConnectInf.SetPassword(wxT(""));
|
DbConnectInf.SetPassword(wxEmptyString);
|
||||||
if (!Quiet)
|
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)"));
|
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)
|
switch(i_dbDataType)
|
||||||
{
|
{
|
||||||
case DB_DATA_TYPE_VARCHAR:
|
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))
|
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);
|
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[21] = SQL_NUMERIC; s_SqlTyp[21] = _T("SQL_NUMERIC");
|
||||||
i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = _T("SQL_LONGVARCHAR");
|
i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = _T("SQL_LONGVARCHAR");
|
||||||
i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = _T("SQL_REAL");
|
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[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[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[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;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/stockitem.h"
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
#ifndef __WXMSW__
|
#ifndef __WXMSW__
|
||||||
#include "bitmaps/logo.xpm"
|
#include "bitmaps/logo.xpm"
|
||||||
@@ -39,9 +41,9 @@
|
|||||||
//-- Some Global Vars for this file ------------------------------------------------------
|
//-- Some Global Vars for this file ------------------------------------------------------
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
|
||||||
EVT_MENU(QUIT, MainFrame::OnQuit) // Program End
|
EVT_MENU(wxID_EXIT, MainFrame::OnQuit) // Program End
|
||||||
EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription
|
EVT_MENU(wxID_ABOUT, MainFrame::OnAbout) // Program Discription
|
||||||
EVT_MENU(HELP, MainFrame::OnHelp) // Program Help
|
EVT_MENU(wxID_HELP, MainFrame::OnHelp) // Program Help
|
||||||
END_EVENT_TABLE()
|
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()
|
// Win-Registry : Workplace\HKEY_CURRENT_USERS\Software\%GetVendorName()\%GetAppName()
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
SetVendorName(_T("mj10777")); // Needed to get Configuration Information
|
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
|
// 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
|
// config object when it's used for the first time. It has a number of
|
||||||
// advantages compared with explicitly creating our wxConfig:
|
// advantages compared with explicitly creating our wxConfig:
|
||||||
// 1) we don't pay for it if we don't use it
|
// 1) we don't pay for it if we don't use it
|
||||||
// 2) there is no danger to create it twice
|
// 2) there is no danger to create it twice
|
||||||
|
|
||||||
// application and vendor name are used by wxConfig to construct the name
|
// 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
|
// 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
|
// 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();
|
Temp0.Empty();
|
||||||
p_ProgramCfg->Read(_T("/Local/langid"),&Temp0); // >const char *langid< can't be used here
|
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
|
langid = _T("std"); // Standard language is "std" = english
|
||||||
else
|
else
|
||||||
langid = Temp0;
|
langid = Temp0;
|
||||||
@@ -206,12 +208,12 @@ bool MainApp::OnInit(void) // Does everything needed for a program start
|
|||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *file_menu = new wxMenu;
|
wxMenu *file_menu = new wxMenu;
|
||||||
wxMenu *help_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->AppendSeparator();
|
||||||
help_menu->Append(ABOUT, _("&About"));
|
help_menu->Append(wxID_ABOUT, _("&About"));
|
||||||
file_menu->Append(QUIT, _("E&xit"));
|
file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT));
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
menu_bar->Append(file_menu, _("&File"));
|
menu_bar->Append(file_menu, _("&File"));
|
||||||
menu_bar->Append(help_menu, _("&Help"));
|
menu_bar->Append(help_menu, _("&Help"));
|
||||||
|
@@ -15,7 +15,7 @@ class MainFrame: public wxFrame
|
|||||||
public:
|
public:
|
||||||
MainFrame(wxFrame *frame, wxChar *title, const wxPoint& pos, const wxSize& size);
|
MainFrame(wxFrame *frame, wxChar *title, const wxPoint& pos, const wxSize& size);
|
||||||
~MainFrame(void);
|
~MainFrame(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// menu callbacks
|
// menu callbacks
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
@@ -46,9 +46,6 @@ public:
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// ID for the menu quit command
|
// ID for the menu quit command
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
#define QUIT 777
|
|
||||||
#define ABOUT 778
|
|
||||||
#define HELP 779
|
|
||||||
#define TREE_CTRL_PGM 102
|
#define TREE_CTRL_PGM 102
|
||||||
#define GRID_CTRL 103
|
#define GRID_CTRL 103
|
||||||
#define TREE_CTRL_DB 104
|
#define TREE_CTRL_DB 104
|
||||||
|
@@ -67,9 +67,9 @@ wxGrid(parent, id, pos, size, style)
|
|||||||
{
|
{
|
||||||
b_EditModus = false;
|
b_EditModus = false;
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
popupMenu1 = new wxMenu(_T(""));
|
popupMenu1 = new wxMenu;
|
||||||
popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
|
popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
|
||||||
popupMenu2 = new wxMenu(_T(""));
|
popupMenu2 = new wxMenu;
|
||||||
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
|
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ void DBGrid::OnEditorHidden( wxGridEvent& ev )
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
void DBGrid::OnSelectCell( wxGridEvent& ev )
|
void DBGrid::OnSelectCell( wxGridEvent& ev )
|
||||||
{
|
{
|
||||||
logBuf = _T("");
|
logBuf = wxEmptyString;
|
||||||
logBuf << _T("Selected cell at row ") << ev.GetRow()
|
logBuf << _T("Selected cell at row ") << ev.GetRow()
|
||||||
<< _T(" col ") << ev.GetCol();
|
<< _T(" col ") << ev.GetCol();
|
||||||
wxLogMessage( _T("%s"), logBuf.c_str() );
|
wxLogMessage( _T("%s"), logBuf.c_str() );
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
static inline const wxChar *bool2String(bool b)
|
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);
|
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));
|
Docu = AppendItem(Folder,Temp2,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1));
|
||||||
Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName;
|
Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName;
|
||||||
if (Temp2 == _T(""))
|
if (Temp2.empty())
|
||||||
Temp2 = _("None");
|
Temp2 = _("None");
|
||||||
Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2.c_str());
|
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")));
|
Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(_T("KEY")));
|
||||||
@@ -250,12 +250,12 @@ int DBTree::OnPopulate()
|
|||||||
Expand(Root);
|
Expand(Root);
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
popupMenu1 = NULL;
|
popupMenu1 = NULL;
|
||||||
popupMenu1 = new wxMenu(_T(""));
|
popupMenu1 = new wxMenu;
|
||||||
popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h "));
|
popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h "));
|
||||||
popupMenu1->AppendSeparator();
|
popupMenu1->AppendSeparator();
|
||||||
popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes"));
|
popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes"));
|
||||||
popupMenu2 = NULL;
|
popupMenu2 = NULL;
|
||||||
popupMenu2 = new wxMenu(_T(""));
|
popupMenu2 = new wxMenu;
|
||||||
popupMenu2->Append(DATA_SHOW, _("Show Data"));
|
popupMenu2->Append(DATA_SHOW, _("Show Data"));
|
||||||
popupMenu2->AppendSeparator();
|
popupMenu2->AppendSeparator();
|
||||||
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
|
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
|
||||||
|
@@ -92,7 +92,7 @@ DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
|
|||||||
//layout->height.AsIs();
|
//layout->height.AsIs();
|
||||||
m_Password->SetConstraints(layout);
|
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);
|
m_OK->SetFont(* pDoc->ft_Doc);
|
||||||
layout = new wxLayoutConstraints;
|
layout = new wxLayoutConstraints;
|
||||||
layout->left.SameAs(this, wxLeft, 10);
|
layout->left.SameAs(this, wxLeft, 10);
|
||||||
@@ -101,7 +101,7 @@ DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
|
|||||||
layout->width.Absolute(75);
|
layout->width.Absolute(75);
|
||||||
m_OK->SetConstraints(layout);
|
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);
|
m_Cancel->SetFont(* pDoc->ft_Doc);
|
||||||
layout = new wxLayoutConstraints;
|
layout = new wxLayoutConstraints;
|
||||||
layout->left.SameAs(m_OK, wxRight, 10);
|
layout->left.SameAs(m_OK, wxRight, 10);
|
||||||
|
@@ -157,7 +157,7 @@ bool MainDoc::OnInitODBC()
|
|||||||
{
|
{
|
||||||
wxChar Dsn[SQL_MAX_DSN_LENGTH+1];
|
wxChar Dsn[SQL_MAX_DSN_LENGTH+1];
|
||||||
wxChar DsDesc[254+1]; // BJO20002501 instead of 512
|
wxChar DsDesc[254+1]; // BJO20002501 instead of 512
|
||||||
Temp0 = _T("");
|
Temp0 = wxEmptyString;
|
||||||
i_DSN = 0; // Counter
|
i_DSN = 0; // Counter
|
||||||
int i;
|
int i;
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
@@ -183,7 +183,7 @@ bool MainDoc::OnInitODBC()
|
|||||||
s_SortDSNList.Add(Dsn);
|
s_SortDSNList.Add(Dsn);
|
||||||
s_SortDsDescList.Add(KeyString);
|
s_SortDsDescList.Add(KeyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
// Allocate n ODBC-DSN objects to hold the information
|
// Allocate n ODBC-DSN objects to hold the information
|
||||||
// Allocate n wxDatabase objects to hold the column information
|
// Allocate n wxDatabase objects to hold the column information
|
||||||
@@ -197,8 +197,8 @@ bool MainDoc::OnInitODBC()
|
|||||||
// ODBC-DSN object
|
// ODBC-DSN object
|
||||||
(p_DSN+i)->Dsn = s_SortDSNList[i];
|
(p_DSN+i)->Dsn = s_SortDSNList[i];
|
||||||
(p_DSN+i)->Drv = KeyString;
|
(p_DSN+i)->Drv = KeyString;
|
||||||
(p_DSN+i)->Usr = _T("");
|
(p_DSN+i)->Usr = wxEmptyString;
|
||||||
(p_DSN+i)->Pas = _T("");
|
(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());
|
Temp0.Printf(_T("%02d) Dsn(%s) DsDesc(%s)"),i,(p_DSN+i)->Dsn.c_str(),(p_DSN+i)->Drv.c_str());
|
||||||
wxLogMessage(Temp0);
|
wxLogMessage(Temp0);
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ bool MainDoc::OnChosenDSN(int Which)
|
|||||||
p_TabArea->Show(false); // Deactivate the Window
|
p_TabArea->Show(false); // Deactivate the Window
|
||||||
p_TabArea->RemoveTab(p_DBTree->i_ViewNr);
|
p_TabArea->RemoveTab(p_DBTree->i_ViewNr);
|
||||||
p_TabArea->Show(true); // Activate the Window
|
p_TabArea->Show(true); // Activate the Window
|
||||||
OnChosenTbl(77,_T(""));
|
OnChosenTbl(77,wxEmptyString);
|
||||||
}
|
}
|
||||||
//-------------------------
|
//-------------------------
|
||||||
p_TabArea->Show(false); // Deactivate the Window
|
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_TabArea->Show(false); // Deactivate the Window
|
||||||
p_DBGrid = new DBGrid(p_TabArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
p_DBGrid = new DBGrid(p_TabArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||||
wxSUNKEN_BORDER);
|
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->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||||
p_DBGrid->pDoc = this;
|
p_DBGrid->pDoc = this;
|
||||||
p_DBGrid->db_Br = db_Br;
|
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_PageArea->Show(false); // Deactivate the Window
|
||||||
p_DBGrid = new DBGrid(p_PageArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
p_DBGrid = new DBGrid(p_PageArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||||
wxSUNKEN_BORDER);
|
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->i_ViewNr = p_PageArea->GetTabCount()-1;
|
||||||
p_DBGrid->pDoc = this;
|
p_DBGrid->pDoc = this;
|
||||||
p_DBGrid->db_Br = db_Br;
|
p_DBGrid->db_Br = db_Br;
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
static inline const wxChar *bool2String(bool b)
|
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()
|
PgmCtrl::~PgmCtrl()
|
||||||
{
|
{
|
||||||
delete p_imageListNormal;
|
delete p_imageListNormal;
|
||||||
delete popupMenu1;
|
delete popupMenu1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
@@ -122,7 +122,7 @@ int PgmCtrl::OnPopulate()
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
popupMenu1 = NULL;
|
popupMenu1 = NULL;
|
||||||
popupMenu1 = new wxMenu(_T(""));
|
popupMenu1 = new wxMenu;
|
||||||
popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password"));
|
popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password"));
|
||||||
// popupMenu1->AppendSeparator();
|
// popupMenu1->AppendSeparator();
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
@@ -262,7 +262,7 @@ void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event))
|
|||||||
// wxMessageBox(SaveDSN);
|
// wxMessageBox(SaveDSN);
|
||||||
int i;
|
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++)
|
for (i=0;i<pDoc->i_DSN;i++)
|
||||||
{
|
{
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
|||||||
void OnRightSelect(wxTreeEvent& event);
|
void OnRightSelect(wxTreeEvent& event);
|
||||||
void OnMouseMove(wxMouseEvent& event);
|
void OnMouseMove(wxMouseEvent& event);
|
||||||
void OnUserPassword(wxCommandEvent& event);
|
void OnUserPassword(wxCommandEvent& event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS()
|
// NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS()
|
||||||
|
@@ -137,7 +137,7 @@ void FortyCanvas::ShowPlayerDialog()
|
|||||||
int wins, games, score;
|
int wins, games, score;
|
||||||
m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
|
m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
|
||||||
m_game->NewPlayer(wins, games, score);
|
m_game->NewPlayer(wins, games, score);
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
dc.SetFont(* m_font);
|
dc.SetFont(* m_font);
|
||||||
m_game->DisplayScore(dc);
|
m_game->DisplayScore(dc);
|
||||||
@@ -152,7 +152,7 @@ void FortyCanvas::ShowPlayerDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the main frame is closed
|
Called when the main frame is closed
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +172,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
int mouseX = (int)event.GetX();
|
int mouseX = (int)event.GetX();
|
||||||
int mouseY = (int)event.GetY();
|
int mouseY = (int)event.GetY();
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
dc.SetFont(* m_font);
|
dc.SetFont(* m_font);
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
void FortyCanvas::SetCursorStyle(int x, int y)
|
void FortyCanvas::SetCursorStyle(int x, int y)
|
||||||
{
|
{
|
||||||
// Only set cursor to a hand if 'helping hand' is enabled and
|
// 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)
|
if (m_game->CanYouGo(x, y) && m_helpingHand)
|
||||||
{
|
{
|
||||||
SetCursor(* m_handCursor);
|
SetCursor(* m_handCursor);
|
||||||
@@ -253,7 +253,7 @@ void FortyCanvas::NewGame()
|
|||||||
|
|
||||||
void FortyCanvas::Undo()
|
void FortyCanvas::Undo()
|
||||||
{
|
{
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
dc.SetFont(* m_font);
|
dc.SetFont(* m_font);
|
||||||
m_game->Undo(dc);
|
m_game->Undo(dc);
|
||||||
@@ -261,7 +261,7 @@ void FortyCanvas::Undo()
|
|||||||
|
|
||||||
void FortyCanvas::Redo()
|
void FortyCanvas::Redo()
|
||||||
{
|
{
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
dc.SetFont(* m_font);
|
dc.SetFont(* m_font);
|
||||||
m_game->Redo(dc);
|
m_game->Redo(dc);
|
||||||
|
@@ -37,13 +37,15 @@
|
|||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/stockitem.h"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
|
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_EXIT, FortyFrame::Exit)
|
||||||
EVT_MENU(wxID_ABOUT, FortyFrame::About)
|
EVT_MENU(wxID_ABOUT, FortyFrame::About)
|
||||||
EVT_MENU(wxID_HELP_CONTENTS, FortyFrame::Help)
|
EVT_MENU(wxID_HELP_CONTENTS, FortyFrame::Help)
|
||||||
EVT_MENU(UNDO, FortyFrame::Undo)
|
EVT_MENU(wxID_UNDO, FortyFrame::Undo)
|
||||||
EVT_MENU(REDO, FortyFrame::Redo)
|
EVT_MENU(wxID_REDO, FortyFrame::Redo)
|
||||||
EVT_MENU(SCORES, FortyFrame::Scores)
|
EVT_MENU(SCORES, FortyFrame::Scores)
|
||||||
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
|
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
|
||||||
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
|
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
|
||||||
@@ -151,13 +153,13 @@ FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos
|
|||||||
|
|
||||||
// Make a menu bar
|
// Make a menu bar
|
||||||
wxMenu* gameMenu = new wxMenu;
|
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(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;
|
wxMenu* editMenu = new wxMenu;
|
||||||
editMenu->Append(UNDO, _T("&Undo"), _T("Undo the last move"));
|
editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO), _T("Undo the last move"));
|
||||||
editMenu->Append(REDO, _T("&Redo"), _T("Redo a move that has been undone"));
|
editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO), _T("Redo a move that has been undone"));
|
||||||
|
|
||||||
wxMenu* optionsMenu = new wxMenu;
|
wxMenu* optionsMenu = new wxMenu;
|
||||||
optionsMenu->Append(RIGHT_BUTTON_UNDO,
|
optionsMenu->Append(RIGHT_BUTTON_UNDO,
|
||||||
@@ -308,6 +310,7 @@ FortyFrame::ToggleCardSize(wxCommandEvent& event)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(FortyAboutDialog,wxDialog)
|
BEGIN_EVENT_TABLE(FortyAboutDialog,wxDialog)
|
||||||
|
EVT_BUTTON(wxID_CLOSE, wxDialog::OnOK)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
FortyAboutDialog::FortyAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
|
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>"));
|
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 );
|
wxASSERT( item1 );
|
||||||
item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
|
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->SetDefault();
|
||||||
item2->SetFocus();
|
item2->SetFocus();
|
||||||
|
|
||||||
|
@@ -61,10 +61,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
enum MenuCommands {
|
enum MenuCommands {
|
||||||
NEW_GAME = 10,
|
SCORES = 10,
|
||||||
SCORES,
|
|
||||||
UNDO,
|
|
||||||
REDO,
|
|
||||||
RIGHT_BUTTON_UNDO,
|
RIGHT_BUTTON_UNDO,
|
||||||
HELPING_HAND,
|
HELPING_HAND,
|
||||||
LARGE_CARDS
|
LARGE_CARDS
|
||||||
|
@@ -63,8 +63,8 @@ PlayerSelectionDialog::PlayerSelectionDialog(
|
|||||||
|
|
||||||
m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
m_OK = new wxButton(this, wxID_OK, _T("OK"));
|
m_OK = new wxButton(this, wxID_OK);
|
||||||
m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel"));
|
m_cancel = new wxButton(this, wxID_CANCEL);
|
||||||
|
|
||||||
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
button_sizer->Add( m_OK, 0, wxALL, 10 );
|
button_sizer->Add( m_OK, 0, wxALL, 10 );
|
||||||
|
@@ -191,7 +191,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
|
|||||||
// locate and resize with sizers
|
// locate and resize with sizers
|
||||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
topsizer->Add( list, 1, wxALL|wxGROW, 10 );
|
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 );
|
topsizer->Add( button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL , 10 );
|
||||||
button->SetFocus();
|
button->SetFocus();
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@ hack doesn't fix.
|
|||||||
#endif //precompiled headers
|
#endif //precompiled headers
|
||||||
|
|
||||||
#include "wx/math.h"
|
#include "wx/math.h"
|
||||||
|
#include "wx/stockitem.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -101,7 +102,7 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *file_menu = new wxMenu;
|
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 = new wxMenuBar;
|
||||||
menuBar->Append(file_menu, _T("&File"));
|
menuBar->Append(file_menu, _T("&File"));
|
||||||
frame->SetMenuBar(menuBar);
|
frame->SetMenuBar(menuBar);
|
||||||
|
@@ -114,9 +114,9 @@ bool LifeCellBox::SetCell(int dx, int dy, bool alive)
|
|||||||
Life::Life()
|
Life::Life()
|
||||||
{
|
{
|
||||||
// pattern description
|
// pattern description
|
||||||
m_name = _("");
|
m_name = wxEmptyString;
|
||||||
m_rules = _("");
|
m_rules = wxEmptyString;
|
||||||
m_description = _("");
|
m_description = wxEmptyString;
|
||||||
|
|
||||||
// pattern data
|
// pattern data
|
||||||
m_numcells = 0;
|
m_numcells = 0;
|
||||||
@@ -173,9 +173,9 @@ void Life::Clear()
|
|||||||
m_available = NULL;
|
m_available = NULL;
|
||||||
|
|
||||||
// reset state
|
// reset state
|
||||||
m_name = _("");
|
m_name = wxEmptyString;
|
||||||
m_rules = _("");
|
m_rules = wxEmptyString;
|
||||||
m_description = _("");
|
m_description = wxEmptyString;
|
||||||
m_numcells = 0;
|
m_numcells = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ LifeCell Life::FindNorth()
|
|||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
cell.i = first? 0 : x + CELLBOX / 2;
|
cell.i = first? 0 : x + CELLBOX / 2;
|
||||||
cell.j = first? 0 : y + CELLBOX / 2;
|
cell.j = first? 0 : y + CELLBOX / 2;
|
||||||
@@ -423,7 +423,7 @@ LifeCell Life::FindSouth()
|
|||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
cell.i = first? 0 : x + CELLBOX / 2;
|
cell.i = first? 0 : x + CELLBOX / 2;
|
||||||
cell.j = first? 0 : y + CELLBOX / 2;
|
cell.j = first? 0 : y + CELLBOX / 2;
|
||||||
@@ -443,7 +443,7 @@ LifeCell Life::FindWest()
|
|||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
cell.i = first? 0 : x + CELLBOX / 2;
|
cell.i = first? 0 : x + CELLBOX / 2;
|
||||||
cell.j = first? 0 : y + CELLBOX / 2;
|
cell.j = first? 0 : y + CELLBOX / 2;
|
||||||
@@ -463,7 +463,7 @@ LifeCell Life::FindEast()
|
|||||||
y = c->m_y;
|
y = c->m_y;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LifeCell cell;
|
LifeCell cell;
|
||||||
cell.i = first? 0 : x + CELLBOX / 2;
|
cell.i = first? 0 : x + CELLBOX / 2;
|
||||||
cell.j = first? 0 : y + 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 & 0x0000ffff) << 4 ) + ((t3 >> 24) & 0xf) ] << 24;
|
||||||
t2 |= g_tab[ ((t4 & 0xffff0000) >> 12) + ((t3 >> 28) & 0xf) ] << 28;
|
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_on[4] = c->m_on[5] = c->m_on[6] = c->m_on[7] = 0;
|
||||||
c->m_live1 = t1;
|
c->m_live1 = t1;
|
||||||
c->m_live2 = t2;
|
c->m_live2 = t2;
|
||||||
@@ -1136,7 +1136,7 @@ int g_tab1[]=
|
|||||||
0x11112110,
|
0x11112110,
|
||||||
0x11112121,
|
0x11112121,
|
||||||
0x11112221,
|
0x11112221,
|
||||||
0x11112232,
|
0x11112232,
|
||||||
0x11122100,
|
0x11122100,
|
||||||
0x11122111,
|
0x11122111,
|
||||||
0x11122211,
|
0x11122211,
|
||||||
|
@@ -47,8 +47,8 @@ public:
|
|||||||
m_rules = rules;
|
m_rules = rules;
|
||||||
m_shape = shape;
|
m_shape = shape;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A more convenient ctor for the built-in samples
|
// A more convenient ctor for the built-in samples
|
||||||
LifePattern(wxString name,
|
LifePattern(wxString name,
|
||||||
wxString description,
|
wxString description,
|
||||||
int width,
|
int width,
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_description = description;
|
m_description = description;
|
||||||
m_rules = _("");
|
m_rules = wxEmptyString;
|
||||||
m_shape.Add( wxString::Format(_T("%i %i"), -width/2, -height/2) );
|
m_shape.Add( wxString::Format(_T("%i %i"), -width/2, -height/2) );
|
||||||
for(int j = 0; j < height; j++)
|
for(int j = 0; j < height; j++)
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ struct LifeCell
|
|||||||
{
|
{
|
||||||
wxInt32 i;
|
wxInt32 i;
|
||||||
wxInt32 j;
|
wxInt32 j;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A private class that contains data about a block of cells
|
// A private class that contains data about a block of cells
|
||||||
class LifeCellBox;
|
class LifeCellBox;
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "wx/statline.h"
|
#include "wx/statline.h"
|
||||||
#include "wx/wfstream.h"
|
#include "wx/wfstream.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
|
#include "wx/stockitem.h"
|
||||||
|
|
||||||
#include "life.h"
|
#include "life.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
@@ -84,14 +85,11 @@ enum
|
|||||||
ID_SOUTH,
|
ID_SOUTH,
|
||||||
ID_EAST,
|
ID_EAST,
|
||||||
ID_WEST,
|
ID_WEST,
|
||||||
ID_ZOOMIN,
|
|
||||||
ID_ZOOMOUT,
|
|
||||||
ID_INFO,
|
ID_INFO,
|
||||||
|
|
||||||
// game menu
|
// game menu
|
||||||
ID_START,
|
ID_START,
|
||||||
ID_STEP,
|
ID_STEP,
|
||||||
ID_STOP,
|
|
||||||
ID_TOPSPEED,
|
ID_TOPSPEED,
|
||||||
|
|
||||||
// speed selection slider
|
// speed selection slider
|
||||||
@@ -104,28 +102,28 @@ enum
|
|||||||
|
|
||||||
// Event tables
|
// Event tables
|
||||||
BEGIN_EVENT_TABLE(LifeFrame, wxFrame)
|
BEGIN_EVENT_TABLE(LifeFrame, wxFrame)
|
||||||
EVT_MENU (wxID_NEW, LifeFrame::OnMenu)
|
EVT_MENU (wxID_NEW, LifeFrame::OnMenu)
|
||||||
EVT_MENU (wxID_OPEN, LifeFrame::OnOpen)
|
EVT_MENU (wxID_OPEN, LifeFrame::OnOpen)
|
||||||
EVT_MENU (ID_SAMPLES, LifeFrame::OnSamples)
|
EVT_MENU (ID_SAMPLES, LifeFrame::OnSamples)
|
||||||
EVT_MENU (wxID_ABOUT, LifeFrame::OnMenu)
|
EVT_MENU (wxID_ABOUT, LifeFrame::OnMenu)
|
||||||
EVT_MENU (wxID_EXIT, LifeFrame::OnMenu)
|
EVT_MENU (wxID_EXIT, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_SHOWNAV, LifeFrame::OnMenu)
|
EVT_MENU (ID_SHOWNAV, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_ORIGIN, LifeFrame::OnNavigate)
|
EVT_MENU (ID_ORIGIN, LifeFrame::OnNavigate)
|
||||||
EVT_BUTTON (ID_CENTER, LifeFrame::OnNavigate)
|
EVT_BUTTON (ID_CENTER, LifeFrame::OnNavigate)
|
||||||
EVT_BUTTON (ID_NORTH, LifeFrame::OnNavigate)
|
EVT_BUTTON (ID_NORTH, LifeFrame::OnNavigate)
|
||||||
EVT_BUTTON (ID_SOUTH, LifeFrame::OnNavigate)
|
EVT_BUTTON (ID_SOUTH, LifeFrame::OnNavigate)
|
||||||
EVT_BUTTON (ID_EAST, LifeFrame::OnNavigate)
|
EVT_BUTTON (ID_EAST, LifeFrame::OnNavigate)
|
||||||
EVT_BUTTON (ID_WEST, LifeFrame::OnNavigate)
|
EVT_BUTTON (ID_WEST, LifeFrame::OnNavigate)
|
||||||
EVT_MENU (ID_ZOOMIN, LifeFrame::OnZoom)
|
EVT_MENU (wxID_ZOOM_IN, LifeFrame::OnZoom)
|
||||||
EVT_MENU (ID_ZOOMOUT, LifeFrame::OnZoom)
|
EVT_MENU (wxID_ZOOM_OUT,LifeFrame::OnZoom)
|
||||||
EVT_MENU (ID_INFO, LifeFrame::OnMenu)
|
EVT_MENU (ID_INFO, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_START, LifeFrame::OnMenu)
|
EVT_MENU (ID_START, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_STEP, LifeFrame::OnMenu)
|
EVT_MENU (ID_STEP, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_STOP, LifeFrame::OnMenu)
|
EVT_MENU (wxID_STOP, LifeFrame::OnMenu)
|
||||||
EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu)
|
EVT_MENU (ID_TOPSPEED, LifeFrame::OnMenu)
|
||||||
EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider)
|
EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider)
|
||||||
EVT_TIMER (ID_TIMER, LifeFrame::OnTimer)
|
EVT_TIMER (ID_TIMER, LifeFrame::OnTimer)
|
||||||
EVT_CLOSE ( LifeFrame::OnClose)
|
EVT_CLOSE ( LifeFrame::OnClose)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(LifeNavigator, wxMiniFrame)
|
BEGIN_EVENT_TABLE(LifeNavigator, wxMiniFrame)
|
||||||
@@ -197,11 +195,11 @@ LifeFrame::LifeFrame() : wxFrame( (wxFrame *) NULL, wxID_ANY,
|
|||||||
wxMenu *menuGame = new wxMenu(wxMENU_TEAROFF);
|
wxMenu *menuGame = new wxMenu(wxMENU_TEAROFF);
|
||||||
wxMenu *menuHelp = new wxMenu(wxMENU_TEAROFF);
|
wxMenu *menuHelp = new wxMenu(wxMENU_TEAROFF);
|
||||||
|
|
||||||
menuFile->Append(wxID_NEW, _("&New"), _("Start a new game"));
|
menuFile->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), _("Start a new game"));
|
||||||
menuFile->Append(wxID_OPEN, _("&Open..."), _("Open an existing Life pattern"));
|
menuFile->Append(wxID_OPEN, wxGetStockLabel(wxID_OPEN), _("Open an existing Life pattern"));
|
||||||
menuFile->Append(ID_SAMPLES, _("&Sample game..."), _("Select a sample configuration"));
|
menuFile->Append(ID_SAMPLES, _("&Sample game..."), _("Select a sample configuration"));
|
||||||
menuFile->AppendSeparator();
|
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->Append(ID_SHOWNAV, _("Navigation &toolbox"), _("Show or hide toolbox"), wxITEM_CHECK);
|
||||||
menuView->Check(ID_SHOWNAV, true);
|
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_EAST, _("&East"), _("Find easternmost cell"));
|
||||||
menuView->Append(ID_WEST, _("&West"), _("Find westernmost cell"));
|
menuView->Append(ID_WEST, _("&West"), _("Find westernmost cell"));
|
||||||
menuView->AppendSeparator();
|
menuView->AppendSeparator();
|
||||||
menuView->Append(ID_ZOOMIN, _("Zoom &in\tCtrl-I"), _("Zoom in"));
|
menuView->Append(wxID_ZOOM_IN, wxGetStockLabel(wxID_ZOOM_IN, true, _T("Ctrl-I")), _("Zoom in"));
|
||||||
menuView->Append(ID_ZOOMOUT, _("Zoom &out\tCtrl-O"), _("Zoom out"));
|
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"));
|
menuView->Append(ID_INFO, _("&Description\tCtrl-D"), _("View pattern description"));
|
||||||
|
|
||||||
menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start"));
|
menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start"));
|
||||||
menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step"));
|
menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step"));
|
||||||
menuGame->Append(ID_STOP, _("S&top\tCtrl-T"), _("Stop"));
|
menuGame->Append(wxID_STOP, wxGetStockLabel(wxID_STOP, true, _T("Ctrl-T")), _("Stop"));
|
||||||
menuGame->Enable(ID_STOP, false);
|
menuGame->Enable(wxID_STOP, false);
|
||||||
menuGame->AppendSeparator();
|
menuGame->AppendSeparator();
|
||||||
menuGame->Append(ID_TOPSPEED, _("T&op speed!"), _("Go as fast as possible"));
|
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->SetMargins(5, 5);
|
||||||
toolBar->SetToolBitmapSize(wxSize(16, 16));
|
toolBar->SetToolBitmapSize(wxSize(16, 16));
|
||||||
|
|
||||||
ADD_TOOL(wxID_NEW, tbBitmaps[0], _("New"), _("Start a new game"));
|
ADD_TOOL(wxID_NEW, tbBitmaps[0], wxGetStockLabel(wxID_NEW, false), _("Start a new game"));
|
||||||
ADD_TOOL(wxID_OPEN, tbBitmaps[1], _("Open"), _("Open an existing Life pattern"));
|
ADD_TOOL(wxID_OPEN, tbBitmaps[1], wxGetStockLabel(wxID_OPEN, false), _("Open an existing Life pattern"));
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
ADD_TOOL(ID_ZOOMIN, tbBitmaps[2], _("Zoom in"), _("Zoom in"));
|
ADD_TOOL(wxID_ZOOM_IN, tbBitmaps[2], wxGetStockLabel(wxID_ZOOM_IN, false), _("Zoom in"));
|
||||||
ADD_TOOL(ID_ZOOMOUT, tbBitmaps[3], _("Zoom out"), _("Zoom out"));
|
ADD_TOOL(wxID_ZOOM_OUT, tbBitmaps[3], wxGetStockLabel(wxID_ZOOM_OUT, false), _("Zoom out"));
|
||||||
ADD_TOOL(ID_INFO, tbBitmaps[4], _("Description"), _("Show description"));
|
ADD_TOOL(ID_INFO, tbBitmaps[4], _("Description"), _("Show description"));
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
ADD_TOOL(ID_START, tbBitmaps[5], _("Start"), _("Start"));
|
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->Realize();
|
||||||
toolBar->EnableTool(ID_STOP, false); // must be after Realize() !
|
toolBar->EnableTool(wxID_STOP, false); // must be after Realize() !
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
// status bar
|
// status bar
|
||||||
@@ -357,18 +355,18 @@ void LifeFrame::UpdateUI()
|
|||||||
{
|
{
|
||||||
// start / stop
|
// start / stop
|
||||||
GetToolBar()->EnableTool(ID_START, !m_running);
|
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_START, !m_running);
|
||||||
GetMenuBar()->Enable(ID_STEP, !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);
|
GetMenuBar()->Enable(ID_TOPSPEED, !m_topspeed);
|
||||||
|
|
||||||
// zooming
|
// zooming
|
||||||
int cellsize = m_canvas->GetCellSize();
|
int cellsize = m_canvas->GetCellSize();
|
||||||
GetToolBar()->EnableTool(ID_ZOOMIN, cellsize < 32);
|
GetToolBar()->EnableTool(wxID_ZOOM_IN, cellsize < 32);
|
||||||
GetToolBar()->EnableTool(ID_ZOOMOUT, cellsize > 1);
|
GetToolBar()->EnableTool(wxID_ZOOM_OUT, cellsize > 1);
|
||||||
GetMenuBar()->Enable(ID_ZOOMIN, cellsize < 32);
|
GetMenuBar()->Enable(wxID_ZOOM_IN, cellsize < 32);
|
||||||
GetMenuBar()->Enable(ID_ZOOMOUT, cellsize > 1);
|
GetMenuBar()->Enable(wxID_ZOOM_OUT, cellsize > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event handlers -----------------------------------------------------------
|
// Event handlers -----------------------------------------------------------
|
||||||
@@ -410,7 +408,7 @@ void LifeFrame::OnMenu(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxString desc = m_life->GetDescription();
|
wxString desc = m_life->GetDescription();
|
||||||
|
|
||||||
if ( desc.IsEmpty() )
|
if ( desc.empty() )
|
||||||
desc = _("Not available");
|
desc = _("Not available");
|
||||||
|
|
||||||
// should we make the description editable here?
|
// should we make the description editable here?
|
||||||
@@ -420,7 +418,7 @@ void LifeFrame::OnMenu(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
case ID_START : OnStart(); break;
|
case ID_START : OnStart(); break;
|
||||||
case ID_STEP : OnStep(); break;
|
case ID_STEP : OnStep(); break;
|
||||||
case ID_STOP : OnStop(); break;
|
case wxID_STOP : OnStop(); break;
|
||||||
case ID_TOPSPEED:
|
case ID_TOPSPEED:
|
||||||
{
|
{
|
||||||
m_running = true;
|
m_running = true;
|
||||||
@@ -493,12 +491,12 @@ void LifeFrame::OnZoom(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
int cellsize = m_canvas->GetCellSize();
|
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);
|
m_canvas->SetCellSize(cellsize * 2);
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
else if ((event.GetId() == ID_ZOOMOUT) && cellsize > 1)
|
else if ((event.GetId() == wxID_ZOOM_OUT) && cellsize > 1)
|
||||||
{
|
{
|
||||||
m_canvas->SetCellSize(cellsize / 2);
|
m_canvas->SetCellSize(cellsize / 2);
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
|
@@ -92,9 +92,9 @@ private:
|
|||||||
wxInt32 m_viewportY; // first visible cell (y coord)
|
wxInt32 m_viewportY; // first visible cell (y coord)
|
||||||
wxInt32 m_viewportW; // number of visible cells (w)
|
wxInt32 m_viewportW; // number of visible cells (w)
|
||||||
wxInt32 m_viewportH; // number of visible cells (h)
|
wxInt32 m_viewportH; // number of visible cells (h)
|
||||||
int m_thumbX; // horiz. scrollbar thumb position
|
int m_thumbX; // horiz. scrollbar thumb position
|
||||||
int m_thumbY; // vert. scrollbar thumb position
|
int m_thumbY; // vert. scrollbar thumb position
|
||||||
wxInt32 m_mi, m_mj; // last mouse position
|
wxInt32 m_mi, m_mj; // last mouse position
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ private:
|
|||||||
void OnStop();
|
void OnStop();
|
||||||
void OnStep();
|
void OnStep();
|
||||||
|
|
||||||
Life *m_life;
|
Life *m_life;
|
||||||
LifeCanvas *m_canvas;
|
LifeCanvas *m_canvas;
|
||||||
LifeNavigator *m_navigator;
|
LifeNavigator *m_navigator;
|
||||||
wxStaticText *m_text;
|
wxStaticText *m_text;
|
||||||
|
@@ -47,7 +47,7 @@ LifeReader::LifeReader(wxInputStream& is)
|
|||||||
{
|
{
|
||||||
wxBufferedInputStream buff_is(is);
|
wxBufferedInputStream buff_is(is);
|
||||||
wxTextInputStream text_is(buff_is);
|
wxTextInputStream text_is(buff_is);
|
||||||
wxString line, rest;
|
wxString line, rest;
|
||||||
|
|
||||||
// check stream
|
// check stream
|
||||||
m_ok = is.IsOk();
|
m_ok = is.IsOk();
|
||||||
@@ -58,7 +58,7 @@ LifeReader::LifeReader(wxInputStream& is)
|
|||||||
LIFE_CHECKVAL(_("Error reading signature. Not a Life pattern?"));
|
LIFE_CHECKVAL(_("Error reading signature. Not a Life pattern?"));
|
||||||
|
|
||||||
// read description
|
// read description
|
||||||
m_description = wxT("");
|
m_description = wxEmptyString;
|
||||||
line = text_is.ReadLine();
|
line = text_is.ReadLine();
|
||||||
while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest))
|
while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest))
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@ LifeReader::LifeReader(wxInputStream& is)
|
|||||||
{
|
{
|
||||||
line = ( text_is.ReadLine() ).Trim();
|
line = ( text_is.ReadLine() ).Trim();
|
||||||
|
|
||||||
if (!line.IsEmpty())
|
if (!line.empty())
|
||||||
{
|
{
|
||||||
if (line.StartsWith(wxT("#P "), &rest))
|
if (line.StartsWith(wxT("#P "), &rest))
|
||||||
m_shape.Add(rest);
|
m_shape.Add(rest);
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
inline wxArrayString GetShape() const { return m_shape; };
|
inline wxArrayString GetShape() const { return m_shape; };
|
||||||
inline LifePattern GetPattern() const
|
inline LifePattern GetPattern() const
|
||||||
{
|
{
|
||||||
return LifePattern(_(""), m_description, m_rules, m_shape);
|
return LifePattern(wxEmptyString, m_description, m_rules, m_shape);
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user