X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c92b0f9abd8348df6c43e69e66cc428fb9aac59c..db89aa764f72e1f0a73d15d41f68bf13760e151b:/demos/dbbrowse/doc.cpp diff --git a/demos/dbbrowse/doc.cpp b/demos/dbbrowse/doc.cpp index 256a200505..59acac8256 100644 --- a/demos/dbbrowse/doc.cpp +++ b/demos/dbbrowse/doc.cpp @@ -33,13 +33,13 @@ //---------------------------------------------------------------------------------------- //-- Some Global Vars for all Files (extern in ?.h needed) ------------------------------- // Global structure for holding ODBC connection information -struct DbStuff DbConnectInf; +wxDbConnectInf DbConnectInf; //---------------------------------------------------------------------------------------- wxConfigBase *p_ProgramCfg; // All Config and Path information wxLogTextCtrl *p_LogBook; // All Log messages wxString LogBuf; // String for all Logs //---------------------------------------------------------------------------------------- -mjDoc::mjDoc() +MainDoc::MainDoc() { db_Br = NULL; p_DSN = NULL; @@ -58,12 +58,13 @@ mjDoc::mjDoc() ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT)); } //---------------------------------------------------------------------------------------- -mjDoc::~mjDoc() +MainDoc::~MainDoc() { // ---------------------------------------------------------- // -E-> The Tree Controls take to long to close : Why ?? // ---------------------------------------------------------- - // wxMessageBox("-I-> end Doc"); + delete ft_Doc; + ft_Doc = NULL; p_TabArea->Show(FALSE); // Deactivate the Window p_PageArea->Show(FALSE); // Deactivate the Window p_PgmCtrl = NULL; @@ -75,25 +76,25 @@ mjDoc::~mjDoc() p_Splitter = NULL; delete p_Splitter; delete [] db_Br; - // wxMessageBox("~mjDoc"); + // wxMessageBox("~MainDoc"); } //---------------------------------------------------------------------------------------- -bool mjDoc::OnNewDocument() +bool MainDoc::OnNewDocument() { + wxStopWatch sw; //--------------------------------------------------------------------------------------- if (!OnInitView()) - { return FALSE; - } p_PgmCtrl->OnPopulate(); //--------------------------------------------------------------------------------------- + wxLogMessage(_("-I-> MainDoc::OnNewDocument() - End - Time needed : %ld ms"),sw.Time()); return TRUE; } //---------------------------------------------------------------------------------------- -bool mjDoc::OnInitView() +bool MainDoc::OnInitView() { Sash = p_ProgramCfg->Read("/MainFrame/Sash", 200); - // wxMessageBox("OnInitView() - Begin ","-I->mjDoc::OnInitView"); + // wxMessageBox("OnInitView() - Begin ","-I->MainDoc::OnInitView"); //--------------------------------------------------------------------------------------- // create "workplace" window //--------------------------------------------------------------------------------------- @@ -108,6 +109,8 @@ bool mjDoc::OnInitView() wxBitmap *p_FolderClose = new wxBitmap("PgmCtrl"); //, wxBITMAP_TYPE_BMP_RESOURCE); // BJO20000115 //--------------------------------------------------------------------------------------- p_TabArea->AddTab(p_PgmCtrl,"PgmCtrl",p_FolderClose); + delete p_FolderClose; // Memory leak + p_FolderClose = NULL; //--------------------------------------------------------------------------------------- // now create "output" window //--------------------------------------------------------------------------------------- @@ -116,9 +119,7 @@ bool mjDoc::OnInitView() //--------------------------------------------------------------------------------------- p_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString, wxDefaultPosition, wxDefaultSize,wxTE_MULTILINE ); - //wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS"); - wxFont* ft_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT)); - p_LogWin->SetFont(* ft_Temp); + p_LogWin->SetFont(* ft_Doc); // Don't forget ! This is always : i_TabArt = 0 ; i_ViewNr = 1; //--------------------------------------------------------------------------------------- p_LogBook = new wxLogTextCtrl(p_LogWin); // make p_LogWin the LogBook @@ -135,16 +136,17 @@ bool mjDoc::OnInitView() p_Splitter->Initialize(p_TabArea); p_Splitter->SplitHorizontally(p_TabArea,p_PageArea,Sash); //--------------------------------------------------------------------------------------- - if (!OnInitODBC()) - return FALSE; + // if (!OnInitODBC()) + // return FALSE; + OnInitODBC(); //--------------------------------------------------------------------------------------- - Temp0.Printf("-I-> mjDoc::OnInitView() - End - %d DSN's found",i_DSN); + Temp0.Printf(_("-I-> MainDoc::OnInitView() - End - %d DSN's found"),i_DSN); p_MainFrame->SetStatusText(Temp0, 0); wxLogMessage(Temp0); return TRUE; } //---------------------------------------------------------------------------------------- -bool mjDoc::OnInitODBC() +bool MainDoc::OnInitODBC() { char Dsn[SQL_MAX_DSN_LENGTH + 1]; char DsDesc[255]; // BJO20002501 instead of 512 @@ -166,7 +168,7 @@ bool mjDoc::OnInitODBC() // The key will be removed after sorting wxString KeyString; //--------------------------------------------------------------------------------------- - while(GetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc))) + while(wxDbGetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc))) { i_DSN++; // How many Dsn have we ? KeyString.Printf("%s%c%s",Dsn, sep, DsDesc); @@ -206,7 +208,7 @@ bool mjDoc::OnInitODBC() (db_Br+i)->pDoc = this; (db_Br+i)->i_Which = i; } - if (SQLFreeEnv(&DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125 + if (SQLFreeEnv(DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125 / MJ10777.20000309 : no & { // Error freeing environment handle } @@ -224,7 +226,7 @@ bool mjDoc::OnInitODBC() return TRUE; } //---------------------------------------------------------------------------------------- -bool mjDoc::OnChosenDSN(int Which) +bool MainDoc::OnChosenDSN(int Which) { // wxLogMessage("OnChosenDSN(%d) - Begin",Which); //--------------------------------------------------------------------------------------- @@ -253,7 +255,7 @@ bool mjDoc::OnChosenDSN(int Which) return TRUE; } //---------------------------------------------------------------------------------------- -bool mjDoc::OnChosenTbl(int Tab,wxString Table) +bool MainDoc::OnChosenTbl(int Tab,wxString Table) { // wxLogMessage("OnChosenTbl(%d,%s)",Tab,Table.c_str()); //------------------------- @@ -309,10 +311,10 @@ bool mjDoc::OnChosenTbl(int Tab,wxString Table) return TRUE;; } //---------------------------------------------------------------------------------------- -void mjDoc::OnLeer(wxString Aufrufer) +void MainDoc::OnLeer(wxString Aufrufer) { - // Temp0.Printf(_("\nmjDoc::OnLeer(%s) : auch diese funktion steht eines Tages zur Verfügung !"),Aufrufer.c_str()); - Temp0.Printf(_("\nmjDoc::OnLeer(%s) : even this function will one day be available !"),Aufrufer.c_str()); + // Temp0.Printf(_("\nMainDoc::OnLeer(%s) : auch diese funktion steht eines Tages zur Verfügung !"),Aufrufer.c_str()); + Temp0.Printf(_("\nMainDoc::OnLeer(%s) : even this function will one day be available !"),Aufrufer.c_str()); wxLogMessage(Temp0); Temp0.Empty(); return; }