X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/daf06bb8bc05003007ad47eddcce8e33183cb6d4..c899416db0435f724ecf065fd4f9e821773bb2b5:/demos/dbbrowse/dbtree.cpp diff --git a/demos/dbbrowse/dbtree.cpp b/demos/dbbrowse/dbtree.cpp index 557b3c9adc..751e730d0d 100644 --- a/demos/dbbrowse/dbtree.cpp +++ b/demos/dbbrowse/dbtree.cpp @@ -8,13 +8,7 @@ // Copyright: (c) Mark Johnson, Berlin Germany // Licence: wxWindows license //---------------------------------------------------------------------------------------- -//-- all #ifdefs that the whole Project needs. ------------------------------------------- -//---------------------------------------------------------------------------------------- -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif -//---------------------------------------------------------------------------------------- + // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" //---------------------------------------------------------------------------------------- @@ -38,7 +32,7 @@ //---------------------------------------------------------------------------------------- static inline const wxChar *bool2String(bool b) { - return b ? _T("") : _T("not "); + return b ? wxEmptyString : _T("not "); } //---------------------------------------------------------------------------------------- @@ -67,7 +61,7 @@ DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const w { const int image_size = 16; // Make an image list containing small icons - p_imageListNormal = new wxImageList(image_size, image_size, TRUE); + p_imageListNormal = new wxImageList(image_size, image_size, true); // should correspond to TreeIc_xxx enum #if !defined(__WXMSW__) #include "bitmaps/logo.xpm" @@ -104,7 +98,7 @@ DBTree::~DBTree() // delete (pDoc->db_Br+i_Which); // wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()"); - (pDoc->db_Br+i_Which)->OnCloseDB(FALSE); + (pDoc->db_Br+i_Which)->OnCloseDB(false); // wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()"); (pDoc->db_Br+i_Which)->db_BrowserDB = NULL; (pDoc->db_Br+i_Which)->ct_BrowserDB = NULL; @@ -128,11 +122,11 @@ int DBTree::OnPopulate() wxString SQL_TYPE, DB_TYPE; SetFont(* pDoc->ft_Doc); //--------------------------------------------------------------------------------------- - if ((pDoc->db_Br+i_Which)->Initialize(FALSE)) + if ((pDoc->db_Br+i_Which)->Initialize(false)) { wxStopWatch sw; wxBeginBusyCursor(); - ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(FALSE); + ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(false); if (ct_BrowserDB) { // Use the wxDatabase Information Temp0.Printf(_T("%s - (%s) (%s)"), s_DSN.c_str(),ct_BrowserDB->catalog, ct_BrowserDB->schema); @@ -149,7 +143,7 @@ int DBTree::OnPopulate() { Temp1.Printf(_T("TN(%s"),(ct_BrowserDB->pTableInf+x)->tableName); //---- - (ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,FALSE); + (ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,false); //---- if ((ct_BrowserDB->pTableInf+x)->pColInf) { @@ -174,7 +168,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"))); @@ -212,7 +206,7 @@ int DBTree::OnPopulate() SQL_TYPE += DB_TYPE; Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE)); SQL_TYPE.Printf(_T("%10s %d,%d"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName, - ((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnSize,((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits); + ((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnLength,((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits); Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE)); } // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) } // if ((ct_BrowserDB->pTableInf+x)->pColInf) @@ -221,8 +215,10 @@ int DBTree::OnPopulate() z++; // if (z % 10 == 0) { +#if wxUSE_STATUSBAR Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d (from %d) has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z,ct_BrowserDB->numTables); pDoc->p_MainFrame->SetStatusText(Temp0, 0); +#endif // wxUSE_STATUSBAR } wxYield(); } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW) @@ -235,8 +231,10 @@ int DBTree::OnPopulate() wxEndBusyCursor(); Temp0.Printf(_("-I-> DBTree::OnPopulate() - %6d Tables have been read. - Time needed : %ld ms"),z,sw.Time()); wxLogMessage(Temp0); +#if wxUSE_STATUSBAR pDoc->p_MainFrame->SetStatusText(Temp0, 0); - } // if((pDoc->db_Br+i_Which)->Initialize(FALSE)) +#endif // wxUSE_STATUSBAR + } // if((pDoc->db_Br+i_Which)->Initialize(false)) else { wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed")); @@ -246,12 +244,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 ")); @@ -264,7 +262,9 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) { int i; Temp0.Empty(); +#if wxUSE_STATUSBAR pDoc->p_MainFrame->SetStatusText(Temp0,0); +#endif // wxUSE_STATUSBAR // Get the Information that we need wxTreeItemId itemId = GetSelection(); DBTreeData *item = (DBTreeData *)GetItemData(itemId); @@ -275,7 +275,7 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) //------------------------------------------------------------------------------------- if (Temp1.Contains(_T("ODBC-"))) { - Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); + Temp1 = Temp1.Mid(5); for (i=0;ii_DSN;i++) { if (Temp1 == (pDoc->p_DSN+i)->Dsn) @@ -355,7 +355,7 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event)) } //---------------------------------------------------------------------------------------- -void DBTree::OnDBGrid(wxCommandEvent& event) +void DBTree::OnDBGrid(wxCommandEvent& WXUNUSED(event)) { int i; // Get the Information that we need @@ -378,7 +378,7 @@ void DBTree::OnDBGrid(wxCommandEvent& event) } //---------------------------------------------------------------------------------------- -void DBTree::OnDBClass(wxCommandEvent& event) +void DBTree::OnDBClass(wxCommandEvent& WXUNUSED(event)) { // int i; // Get the Information that we need @@ -392,7 +392,7 @@ void DBTree::OnDBClass(wxCommandEvent& event) } //---------------------------------------------------------------------------------------- -void DBTree::OnTableClass(wxCommandEvent& event) +void DBTree::OnTableClass(wxCommandEvent& WXUNUSED(event)) { int i; // Get the Information that we need @@ -414,7 +414,7 @@ void DBTree::OnTableClass(wxCommandEvent& event) } //---------------------------------------------------------------------------------------- -void DBTree::OnTableClassAll(wxCommandEvent& event) +void DBTree::OnTableClassAll(wxCommandEvent& WXUNUSED(event)) { // int i; // Get the Information that we need