From: Mark Johnson Date: Tue, 25 Jul 2000 12:15:55 +0000 (+0000) Subject: dbbrowse.cpp dbgrid.cpp dbtree.cpp doc.cpp pgmctrl.cpp X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ca7408bd9ab49ba525517eb03c6b861c850c3199 dbbrowse.cpp dbgrid.cpp dbtree.cpp doc.cpp pgmctrl.cpp dbbrowse.dsp dbbrowse.dsw dummy.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/demos/dbbrowse/dbbrowse.cpp b/demos/dbbrowse/dbbrowse.cpp index a51faf47e2..c75312caab 100644 --- a/demos/dbbrowse/dbbrowse.cpp +++ b/demos/dbbrowse/dbbrowse.cpp @@ -269,6 +269,11 @@ MainFrame::MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxS //---------------------------------------------------------------------------------------- MainFrame::~MainFrame(void) { + // Close the help frame; this will cause the config data to get written. + if (p_Help->GetFrame()) // returns NULL if no help frame active + p_Help->GetFrame()->Close(TRUE); + delete p_Help; // Memory Leak + p_Help = NULL; // save the control's values to the config if (p_ProgramCfg == NULL) return; @@ -292,9 +297,6 @@ MainFrame::~MainFrame(void) //---------------------------------------------------------------------------------------- void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - // Close the help frame; this will cause the config data to get written. - if (p_Help->GetFrame()) // returns NULL if no help frame active - p_Help->GetFrame()->Close(TRUE); Close(TRUE); } //---------------------------------------------------------------------------------------- diff --git a/demos/dbbrowse/dbbrowse.dsp b/demos/dbbrowse/dbbrowse.dsp new file mode 100644 index 0000000000..a35645f4c3 --- /dev/null +++ b/demos/dbbrowse/dbbrowse.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="dbbrowse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=dbbrowse - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "dbbrowse.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "dbbrowse.mak" CFG="dbbrowse - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "dbbrowse - Win32 Release" (basierend auf "Win32 (x86) Application") +!MESSAGE "dbbrowse - Win32 Debug" (basierend auf "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dbbrowse - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "__WXMSW__" /D "__WIN95__" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"wx/wxprec.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 wx.lib jpeg.lib png.lib tiff.lib xpm.lib zlib.lib advapi32.lib comctl32.lib comdlg32.lib gdi32.lib kernel32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib rpcrt4.lib shell32.lib user32.lib uuid.lib winspool.lib wsock32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" + +!ELSEIF "$(CFG)" == "dbbrowse - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "__WXDEBUG__" /D WXDEBUG=1 /D "__WXMSW__" /D "__WIN95__" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_MBCS" /D "__WINDOWS__" /Yu"wx/wxprec.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 wxd.lib jpegd.lib pngd.lib tiffd.lib xpmd.lib zlibd.lib advapi32.lib comctl32.lib comdlg32.lib gdi32.lib kernel32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib rpcrt4.lib shell32.lib user32.lib uuid.lib winspool.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcmt.lib" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "dbbrowse - Win32 Release" +# Name "dbbrowse - Win32 Debug" +# Begin Group "Quellcodedateien" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\browsedb.cpp +# End Source File +# Begin Source File + +SOURCE=.\dbbrowse.cpp +# End Source File +# Begin Source File + +SOURCE=.\dbgrid.cpp +# End Source File +# Begin Source File + +SOURCE=.\dbtree.cpp +# End Source File +# Begin Source File + +SOURCE=.\dlguser.cpp + +!IF "$(CFG)" == "dbbrowse - Win32 Release" + +# ADD CPP /Yu + +!ELSEIF "$(CFG)" == "dbbrowse - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\doc.cpp +# End Source File +# Begin Source File + +SOURCE=.\dummy.cpp +# ADD CPP /Yc"wx/wxprec.h" +# End Source File +# Begin Source File + +SOURCE=.\pgmctrl.cpp +# End Source File +# Begin Source File + +SOURCE=.\tabpgwin.cpp +# End Source File +# End Group +# Begin Group "Header-Dateien" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\std.h +# End Source File +# End Group +# Begin Group "Ressourcendateien" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\dbbrowse.rc +# End Source File +# End Group +# End Target +# End Project diff --git a/demos/dbbrowse/dbbrowse.dsw b/demos/dbbrowse/dbbrowse.dsw new file mode 100644 index 0000000000..1b66ac463c --- /dev/null +++ b/demos/dbbrowse/dbbrowse.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "dbbrowse"=".\dbbrowse.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/demos/dbbrowse/dbgrid.cpp b/demos/dbbrowse/dbgrid.cpp index eb4ff84a5e..f84b628f96 100644 --- a/demos/dbbrowse/dbgrid.cpp +++ b/demos/dbbrowse/dbgrid.cpp @@ -74,6 +74,8 @@ DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wx //---------------------------------------------------------------------------------------- DBGrid::~DBGrid() { + delete popupMenu1; + delete popupMenu2; } //---------------------------------------------------------------------------------------- int DBGrid::OnTableView(wxString Table) @@ -122,7 +124,7 @@ int DBGrid::OnTableView(wxString Table) } if (z % 50 == 0) { - Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d has been read."),Table.c_str(),z); + Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records); pDoc->p_MainFrame->SetStatusText(Temp0, 0); } } // for (z=0;z<(db_Br+i_Which)->i_Records;z++) diff --git a/demos/dbbrowse/dbtree.cpp b/demos/dbbrowse/dbtree.cpp index f3541f6fc3..1ee46028e4 100644 --- a/demos/dbbrowse/dbtree.cpp +++ b/demos/dbbrowse/dbtree.cpp @@ -88,18 +88,26 @@ DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const w p_imageListNormal->Add(wxICON(DocOpen)); SetImageList(p_imageListNormal); ct_BrowserDB = NULL; + popupMenu1 = NULL; + popupMenu2 = NULL; } //---------------------------------------------------------------------------------------- DBTree::~DBTree() { +// delete (pDoc->db_Br+i_Which); // wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()"); (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; (pDoc->db_Br+i_Which)->cl_BrowserDB = NULL; + delete ct_BrowserDB; delete p_imageListNormal; + if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! + delete popupMenu1; + if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! + delete popupMenu2; } //---------------------------------------------------------------------------------------- #undef TREE_EVENT_HANDLER @@ -202,7 +210,7 @@ int DBTree::OnPopulate() z++; if (z % 10 == 0) { - Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z); + 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); } } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW) diff --git a/demos/dbbrowse/doc.cpp b/demos/dbbrowse/doc.cpp index 01dedcc357..59acac8256 100644 --- a/demos/dbbrowse/doc.cpp +++ b/demos/dbbrowse/doc.cpp @@ -63,7 +63,8 @@ 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; @@ -108,6 +109,8 @@ bool MainDoc::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 //--------------------------------------------------------------------------------------- diff --git a/demos/dbbrowse/dummy.cpp b/demos/dbbrowse/dummy.cpp new file mode 100644 index 0000000000..4829376c7c --- /dev/null +++ b/demos/dbbrowse/dummy.cpp @@ -0,0 +1,36 @@ +/* + * File: dummy.cc + * Purpose: See below + * Author: Julian Smart + * Created: 1993 + * Updated: + * Copyright: (c) 1993, AIAI, University of Edinburgh + */ + +/* A dummy file to include wx.h. If precompiling wx.h, I + * always start by compiling this and producing the PCH file. + * Then subsequent source files use the PCH file. + * + * If precompiling wx.h for wxWindows and derived apps, + * link dummy.obj with your program (the MSC 7 linker complains otherwise). + * + * This is the only convenient way I found to use precompiled headers + * under MSC 7. + * + * This will produce a big PCH file. + */ + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/msw/msvcrt.h" + +// Foils optimizations in Visual C++ (see also app.cpp). Without it, +// dummy.obj isn't linked and we get a linker error. +#if defined(__VISUALC__) && defined(__WIN16__) + char wxDummyChar = 0; +#endif + diff --git a/demos/dbbrowse/pgmctrl.cpp b/demos/dbbrowse/pgmctrl.cpp index 7e80d77d53..6006503a5a 100644 --- a/demos/dbbrowse/pgmctrl.cpp +++ b/demos/dbbrowse/pgmctrl.cpp @@ -88,6 +88,7 @@ PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const PgmCtrl::~PgmCtrl() { delete p_imageListNormal; + delete popupMenu1; } //---------------------------------------------------------------------------------------- #undef TREE_EVENT_HANDLER @@ -242,7 +243,7 @@ void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) } //-------------------------------------------------------------------------------------- } -} +} // void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) //---------------------------------------------------------------------------------------- void PgmCtrl::OnMouseMove(wxMouseEvent &event) {