Huge cleanup of the code. Reformatting, spelling fixes, standardizing on wxWindows conventions, etc.

Changed the couple lines of code required to work with checkins of the new ODBC classes that use wxStrings.
Fixed a ton of memory leaks
Demo still crashes on exit though - this problem has exited for nearly a year though.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2001-02-01 20:24:44 +00:00
parent 4fdae9972d
commit 645889ad25
17 changed files with 3157 additions and 2979 deletions

View File

@@ -33,8 +33,10 @@
// Global structure for holding ODBC connection information // Global structure for holding ODBC connection information
// - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ? // - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ?
wxDbConnectInf ConnectInf; // F<>r DBase wxDbConnectInf ConnectInf; // F<>r DBase
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
extern WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */ extern WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
{ {
@@ -84,11 +86,13 @@ BrowserDB::BrowserDB()
OnFillSqlTyp(); OnFillSqlTyp();
OnFilldbTyp(); OnFilldbTyp();
} // BrowserDB Constructor } // BrowserDB Constructor
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BrowserDB::~BrowserDB() BrowserDB::~BrowserDB()
{ {
Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete) Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete)
} // BrowserDB destructor } // BrowserDB destructor
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::Initialize(int Quiet) bool BrowserDB::Initialize(int Quiet)
{ {
@@ -99,6 +103,7 @@ bool BrowserDB::Initialize(int Quiet)
} }
return TRUE; return TRUE;
} // BrowserDB:Initialize } // BrowserDB:Initialize
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnStartDB(int Quiet) bool BrowserDB::OnStartDB(int Quiet)
{ {
@@ -142,16 +147,16 @@ bool BrowserDB::OnStartDB(int Quiet)
if (OK) if (OK)
{ {
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) ConnectInf.Dsn = ODBCSource; // ODBC data source name (created with ODBC Administrator under Win95/NT)
strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source ConnectInf.Uid = UserName; // database username - must already exist in the data source
strcpy(ConnectInf.AuthStr, Password); // password database username ConnectInf.AuthStr= Password; // password database username
db_BrowserDB = wxDbGetConnection(&ConnectInf); db_BrowserDB = wxDbGetConnection(&ConnectInf);
// 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)
{ {
strcpy(ConnectInf.Dsn, ""); ConnectInf.Dsn = "";
strcpy(ConnectInf.Uid, ""); ConnectInf.Uid = "";
strcpy(ConnectInf.AuthStr, ""); ConnectInf.AuthStr = "";
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)"));
@@ -168,8 +173,11 @@ bool BrowserDB::OnStartDB(int Quiet)
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time()); wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
} }
return TRUE; return TRUE;
} else return FALSE; }
else
return FALSE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnCloseDB(int Quiet) bool BrowserDB::OnCloseDB(int Quiet)
{ {
@@ -177,20 +185,22 @@ bool BrowserDB::OnCloseDB(int Quiet)
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin ")); wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
if (db_BrowserDB) if (db_BrowserDB)
{ {
db_BrowserDB->Close(); // db_BrowserDB->Close();
wxDbFreeConnection(db_BrowserDB); wxDbFreeConnection(db_BrowserDB);
/*
// Free Environment Handle that ODBC uses // Free Environment Handle that ODBC uses
if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS) if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
{ {
// Error freeing environment handle // Error freeing environment handle
} }
*/
db_BrowserDB = NULL; db_BrowserDB = NULL;
} }
if (!Quiet) if (!Quiet)
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End ")); wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnGetNext(int Cols,int Quiet) bool BrowserDB::OnGetNext(int Cols,int Quiet)
{ {
@@ -319,12 +329,13 @@ bool BrowserDB::OnGetNext(int Cols,int Quiet)
Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType); Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str()); strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
break; break;
}; }; // switch
} } // for
} } // else
// wxLogMessage("-E-> BrowserDB::OnGetNext - End");
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnSelect(wxString tb_Name, int Quiet) bool BrowserDB::OnSelect(wxString tb_Name, int Quiet)
{ {
@@ -363,6 +374,7 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quiet)
} }
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet) bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet)
{ {
@@ -383,6 +395,7 @@ bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet)
} }
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
wxDbInf* BrowserDB::OnGetCatalog(int Quiet) wxDbInf* BrowserDB::OnGetCatalog(int Quiet)
{ {
@@ -391,6 +404,7 @@ wxDbInf* BrowserDB::OnGetCatalog(int Quiet)
ct_BrowserDB = db_BrowserDB->GetCatalog(UName); ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
return ct_BrowserDB; return ct_BrowserDB;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet) wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet)
{ {
@@ -406,6 +420,7 @@ wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet)
} }
return cl_BrowserDB; return cl_BrowserDB;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void BrowserDB::Zeiger_auf_NULL(int Art) void BrowserDB::Zeiger_auf_NULL(int Art)
{ {
@@ -432,6 +447,7 @@ void BrowserDB::Zeiger_auf_NULL(int Art)
db_BrowserDB = NULL; db_BrowserDB = NULL;
p_LogWindow = NULL; p_LogWindow = NULL;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void BrowserDB::OnFillSqlTyp() void BrowserDB::OnFillSqlTyp()
{ {
@@ -460,6 +476,7 @@ void BrowserDB::OnFillSqlTyp()
i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL"; i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL";
i_SqlTyp[0] = 23; s_SqlTyp[0] = ""; i_SqlTyp[0] = 23; s_SqlTyp[0] = "";
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void BrowserDB::OnFilldbTyp() void BrowserDB::OnFilldbTyp()
{ {

View File

@@ -16,10 +16,11 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
extern wxDbConnectInf DbConnectInf; extern wxDbConnectInf DbConnectInf;
class MainDoc; class MainDoc;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class BrowserDB class BrowserDB
{ {
public: public:
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Pointer to the main database connection used in the program. This // Pointer to the main database connection used in the program. This
// pointer would normally be used for doing things as database lookups // pointer would normally be used for doing things as database lookups
@@ -74,4 +75,4 @@ class BrowserDB
void OnFilldbTyp(); void OnFilldbTyp();
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
}; // BrowserDB class definition }; // BrowserDB class definition
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -12,23 +12,23 @@
//-- all #ifdefs that the whole Project needs. ------------------------------------------- //-- all #ifdefs that the whole Project needs. -------------------------------------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#pragma interface #pragma interface
#endif #endif
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h". // For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#ifndef __WXMSW__ #ifndef __WXMSW__
#include "bitmaps/logo.xpm" #include "bitmaps/logo.xpm"
#endif #endif
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- all #includes that every .cpp needs --- 19990807.mj10777 ---------------- //-- all #includes that every .cpp needs --- 19990807.mj10777 ----------------
@@ -43,8 +43,10 @@ BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription
EVT_MENU(HELP, MainFrame::OnHelp) // Program Help EVT_MENU(HELP, MainFrame::OnHelp) // Program Help
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
IMPLEMENT_APP(MainApp) // This declares wxApp::MainApp as "the" Application IMPLEMENT_APP(MainApp) // This declares wxApp::MainApp as "the" Application
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// 'Main program' equivalent, creating windows and returning main app frame // 'Main program' equivalent, creating windows and returning main app frame
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@@ -65,9 +67,9 @@ bool MainApp::OnInit(void) // Does everything needed for a program start
wxImage::AddHandler( new wxPNGHandler ); // needed for help System wxImage::AddHandler( new wxPNGHandler ); // needed for help System
#endif #endif
/* /*
#if wxUSE_LIBJPEG #if wxUSE_LIBJPEG
wxImage::AddHandler(new wxJPEGHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler(new wxJPEGHandler ); // use only when needed, otherwise big .exe's
#endif #endif
wxImage::AddHandler( new wxGIFHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler( new wxGIFHandler ); // use only when needed, otherwise big .exe's
wxImage::AddHandler( new wxPCXHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler( new wxPCXHandler ); // use only when needed, otherwise big .exe's
wxImage::AddHandler( new wxPNMHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler( new wxPNMHandler ); // use only when needed, otherwise big .exe's
@@ -257,15 +259,17 @@ bool MainApp::OnInit(void) // Does everything needed for a program start
p_ProgramCfg->Flush(TRUE); // save the configuration p_ProgramCfg->Flush(TRUE); // save the configuration
return TRUE; return TRUE;
} // bool MainApp::OnInit(void) } // bool MainApp::OnInit(void)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// My frame constructor // My frame constructor
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainFrame::MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxSize& size): MainFrame::MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxSize& size):
wxFrame(frame, -1, title, pos, size) wxFrame(frame, -1, title, pos, size)
{ {
p_Splitter = NULL; pDoc = NULL; p_Help = NULL; // Keep the Pointers clean ! p_Splitter = NULL; pDoc = NULL; p_Help = NULL; // Keep the Pointers clean !
//--- Everything else is done in MainApp::OnInit() -------------------------------------- //--- Everything else is done in MainApp::OnInit() --------------------------------------
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainFrame::~MainFrame(void) MainFrame::~MainFrame(void)
{ {
@@ -294,11 +298,13 @@ MainFrame::~MainFrame(void)
if (pDoc) // If we have a Valid Document if (pDoc) // If we have a Valid Document
delete pDoc; // Cleanup (MainDoc::~MainDoc) delete pDoc; // Cleanup (MainDoc::~MainDoc)
} // MainFrame::~MainFrame(void) } // MainFrame::~MainFrame(void)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
Close(TRUE); Close(TRUE);
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
@@ -308,6 +314,7 @@ void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
wxMessageDialog dialog(this, Temp0,Temp1,wxOK|wxCANCEL); wxMessageDialog dialog(this, Temp0,Temp1,wxOK|wxCANCEL);
dialog.ShowModal(); dialog.ShowModal();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::OnHelp(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
{ {

View File

@@ -12,11 +12,11 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainFrame: public wxFrame class MainFrame: public wxFrame
{ {
public: public:
MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxSize& size); MainFrame(wxFrame *frame, char *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);
void OnHelp(wxCommandEvent& event); void OnHelp(wxCommandEvent& event);
@@ -27,19 +27,22 @@ class MainFrame: public wxFrame
DocSplitterWindow *p_Splitter; // for Document Views DocSplitterWindow *p_Splitter; // for Document Views
MainDoc *pDoc; // Self made Document MainDoc *pDoc; // Self made Document
wxHtmlHelpController *p_Help; // Help System wxHtmlHelpController *p_Help; // Help System
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Define a new application type // Define a new application type
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainApp: public wxApp class MainApp: public wxApp
{ {
public: public:
MainFrame *frame; // The one and only MainFrame MainFrame *frame; // The one and only MainFrame
bool OnInit(void); // Programmstart bool OnInit(void); // Programmstart
wxLocale m_locale; // locale we'll be using and language support - MUST be here ! wxLocale m_locale; // locale we'll be using and language support - MUST be here !
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// ID for the menu quit command // ID for the menu quit command
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -53,6 +53,7 @@ BEGIN_EVENT_TABLE(DBGrid, wxGrid)
EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit) EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse) EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// wxListCtrl(parent, id, pos, size, style) // wxListCtrl(parent, id, pos, size, style)
// wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) ); // wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
@@ -62,7 +63,7 @@ END_EVENT_TABLE()
// DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size): // DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size):
// wxGrid(parent, id, pos, size) // wxGrid(parent, id, pos, size)
DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style): DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
wxGrid(parent, id, pos, size, style) wxGrid(parent, id, pos, size, style)
{ {
b_EditModus = FALSE; b_EditModus = FALSE;
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@@ -71,12 +72,14 @@ DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wx
popupMenu2 = new wxMenu(""); popupMenu2 = new wxMenu("");
popupMenu2->Append(GRID_BROWSE, _("Browse Modus")); popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBGrid::~DBGrid() DBGrid::~DBGrid()
{ {
delete popupMenu1; delete popupMenu1;
delete popupMenu2; delete popupMenu2;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int DBGrid::OnTableView(wxString Table) int DBGrid::OnTableView(wxString Table)
{ {
@@ -142,13 +145,14 @@ int DBGrid::OnTableView(wxString Table)
else else
wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed")); wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed"));
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Weiter: Weiter:
EnableEditing(b_EditModus); // Deactivate in-place Editing EnableEditing(b_EditModus); // Deactivate in-place Editing
wxEndBusyCursor(); wxEndBusyCursor();
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxLogMessage(_("-I-> DBGrid::OnTableView() - End")); wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
return 0; return 0;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnModusEdit(wxCommandEvent& event) void DBGrid::OnModusEdit(wxCommandEvent& event)
{ {
@@ -157,6 +161,7 @@ void DBGrid::OnModusEdit(wxCommandEvent& event)
UpdateDimensions(); // Redraw the Grid UpdateDimensions(); // Redraw the Grid
// wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End")); // wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnModusBrowse(wxCommandEvent& event) void DBGrid::OnModusBrowse(wxCommandEvent& event)
{ {
@@ -165,18 +170,22 @@ void DBGrid::OnModusBrowse(wxCommandEvent& event)
UpdateDimensions(); // Redraw the Grid UpdateDimensions(); // Redraw the Grid
// wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End")); // wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnEditorShown( wxGridEvent& ev ) void DBGrid::OnEditorShown( wxGridEvent& ev )
{ {
// wxLogMessage(_("-I-> DBGrid::OnEditorShown() - End")); // wxLogMessage(_("-I-> DBGrid::OnEditorShown() - End"));
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnEditorHidden( wxGridEvent& ev ) void DBGrid::OnEditorHidden( wxGridEvent& ev )
{ {
// wxLogMessage(_("-I-> DBGrid::OnEditorHidden() - End")); // wxLogMessage(_("-I-> DBGrid::OnEditorHidden() - End"));
ev.Skip(); ev.Skip();
} }
//----------------------------------------------------------------------------------------
void DBGrid::OnSelectCell( wxGridEvent& ev ) void DBGrid::OnSelectCell( wxGridEvent& ev )
{ {
logBuf = ""; logBuf = "";
@@ -187,11 +196,13 @@ void DBGrid::OnSelectCell( wxGridEvent& ev )
// to occur in wxGrid // to occur in wxGrid
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnMouseMove(wxMouseEvent &event) void DBGrid::OnMouseMove(wxMouseEvent &event)
{ {
MousePos = event.GetPosition(); MousePos = event.GetPosition();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelLeftClick( wxGridEvent& ev ) void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
{ {
@@ -210,11 +221,13 @@ void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
} }
if ( ev.ShiftDown() ) if ( ev.ShiftDown() )
logBuf << " (shift down)"; logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() ); // wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n"; logBuf += "\n";
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightClick( wxGridEvent& ev ) void DBGrid::OnLabelRightClick( wxGridEvent& ev )
{ {
@@ -239,11 +252,13 @@ void DBGrid::OnLabelRightClick( wxGridEvent& ev )
} }
if ( ev.ShiftDown() ) if ( ev.ShiftDown() )
logBuf << " (shift down)"; logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() ); // wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n"; logBuf += "\n";
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelLeftDClick( wxGridEvent& ev ) void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
{ {
@@ -262,11 +277,13 @@ void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
} }
if ( ev.ShiftDown() ) if ( ev.ShiftDown() )
logBuf << " (shift down)"; logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() ); // wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n"; logBuf += "\n";
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightDClick( wxGridEvent& ev ) void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
{ {
@@ -290,6 +307,7 @@ void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellLeftClick( wxGridEvent& ev ) void DBGrid::OnCellLeftClick( wxGridEvent& ev )
{ {
@@ -305,6 +323,7 @@ void DBGrid::OnCellLeftClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellRightClick( wxGridEvent& ev ) void DBGrid::OnCellRightClick( wxGridEvent& ev )
{ {
@@ -320,6 +339,7 @@ void DBGrid::OnCellRightClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellLeftDClick( wxGridEvent& ev ) void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
{ {
@@ -335,6 +355,7 @@ void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellRightDClick( wxGridEvent& ev ) void DBGrid::OnCellRightDClick( wxGridEvent& ev )
{ {
@@ -350,6 +371,7 @@ void DBGrid::OnCellRightDClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellChange( wxGridEvent& ev ) void DBGrid::OnCellChange( wxGridEvent& ev )
{ {
@@ -365,6 +387,7 @@ void DBGrid::OnCellChange( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnRowSize( wxGridSizeEvent& ev ) void DBGrid::OnRowSize( wxGridSizeEvent& ev )
{ {
@@ -375,6 +398,7 @@ void DBGrid::OnRowSize( wxGridSizeEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnColSize( wxGridSizeEvent& ev ) void DBGrid::OnColSize( wxGridSizeEvent& ev )
{ {
@@ -385,6 +409,7 @@ void DBGrid::OnColSize( wxGridSizeEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev ) void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
{ {

View File

@@ -9,14 +9,16 @@
// RCS-ID: $Id$ // RCS-ID: $Id$
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID) #if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
#error "DBGrid requires the new wxGrid class" #error "DBGrid requires the new wxGrid class"
#endif #endif
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainDoc; class MainDoc;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DBGrid: public wxGrid class DBGrid: public wxGrid
{ {
public: public:
DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style); DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style);
virtual ~DBGrid(); virtual ~DBGrid();
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@@ -57,9 +59,11 @@ class DBGrid: public wxGrid
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#define GRID_01_BEGIN 1200 #define GRID_01_BEGIN 1200
#define GRID_BROWSE 1201 #define GRID_BROWSE 1201
#define GRID_EDIT 1202 #define GRID_EDIT 1202
#define GRID_01_END 1203 #define GRID_01_END 1203
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -32,6 +32,7 @@
//-- all #includes that every .cpp needs --- 19990807.mj10777 ---------------- //-- all #includes that every .cpp needs --- 19990807.mj10777 ----------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#include "std.h" // sorgsam Pflegen ! #include "std.h" // sorgsam Pflegen !
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- Global functions -------------------------------------------------------------------- //-- Global functions --------------------------------------------------------------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@@ -39,6 +40,7 @@ static inline const char *bool2String(bool b)
{ {
return b ? "" : "not "; return b ? "" : "not ";
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl) BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl)
EVT_MOTION (DBTree::OnMouseMove) EVT_MOTION (DBTree::OnMouseMove)
@@ -53,28 +55,30 @@ END_EVENT_TABLE()
// DBTree implementation // DBTree implementation
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl) IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent) DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent)
{ {
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style) DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style)
: wxTreeCtrl(parent, id, pos, size, style) : wxTreeCtrl(parent, id, pos, size, style)
{ {
// Make an image list containing small icons // Make an image list containing small icons
p_imageListNormal = new wxImageList(16, 16, TRUE); p_imageListNormal = new wxImageList(16, 16, TRUE);
// should correspond to TreeIc_xxx enum // should correspond to TreeIc_xxx enum
#if !defined(__WXMSW__) #if !defined(__WXMSW__)
#include "bitmaps/logo.xpm" #include "bitmaps/logo.xpm"
#include "bitmaps/dsnclose.xpm" #include "bitmaps/dsnclose.xpm"
#include "bitmaps/dsnopen.xpm" #include "bitmaps/dsnopen.xpm"
#include "bitmaps/tab.xpm" #include "bitmaps/tab.xpm"
#include "bitmaps/view.xpm" #include "bitmaps/view.xpm"
#include "bitmaps/col.xpm" #include "bitmaps/col.xpm"
#include "bitmaps/key.xpm" #include "bitmaps/key.xpm"
#include "bitmaps/keyf.xpm" #include "bitmaps/keyf.xpm"
#include "bitmaps/d_open.xpm" #include "bitmaps/d_open.xpm"
#include "bitmaps/d_closed.xpm" #include "bitmaps/d_closed.xpm"
#endif #endif
p_imageListNormal->Add(wxICON(aLogo)); p_imageListNormal->Add(wxICON(aLogo));
p_imageListNormal->Add(wxICON(DsnClosed)); p_imageListNormal->Add(wxICON(DsnClosed));
@@ -91,10 +95,13 @@ DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const w
popupMenu1 = NULL; popupMenu1 = NULL;
popupMenu2 = NULL; popupMenu2 = NULL;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBTree::~DBTree() DBTree::~DBTree()
{ {
// delete (pDoc->db_Br+i_Which); delete ct_BrowserDB;
// delete (pDoc->db_Br+i_Which);
// wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()"); // wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()");
(pDoc->db_Br+i_Which)->OnCloseDB(FALSE); (pDoc->db_Br+i_Which)->OnCloseDB(FALSE);
// wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()"); // wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()");
@@ -102,15 +109,16 @@ DBTree::~DBTree()
(pDoc->db_Br+i_Which)->ct_BrowserDB = NULL; (pDoc->db_Br+i_Which)->ct_BrowserDB = NULL;
(pDoc->db_Br+i_Which)->cl_BrowserDB = NULL; (pDoc->db_Br+i_Which)->cl_BrowserDB = NULL;
delete ct_BrowserDB;
delete p_imageListNormal; delete p_imageListNormal;
if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! if (popupMenu1) // If the DSN has no Tables, then no delete should be done !
delete popupMenu1; delete popupMenu1;
if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! if (popupMenu1) // If the DSN has no Tables, then no delete should be done !
delete popupMenu2; delete popupMenu2;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#undef TREE_EVENT_HANDLER #undef TREE_EVENT_HANDLER
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int DBTree::OnPopulate() int DBTree::OnPopulate()
{ {
@@ -191,6 +199,7 @@ int DBTree::OnPopulate()
SQL_TYPE.Printf("%s(%d) ; ",(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]); SQL_TYPE.Printf("%s(%d) ; ",(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]);
} }
} // for (i=1;i<=i_SqlTyp[0];i++) } // for (i=1;i<=i_SqlTyp[0];i++)
wxYield();
for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++) for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++)
{ {
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i]) if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i])
@@ -198,6 +207,7 @@ int DBTree::OnPopulate()
DB_TYPE.Printf("%s(%d)",(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]); DB_TYPE.Printf("%s(%d)",(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]);
} }
} // for (i=1;i<=i_dbTyp[0];i++) } // for (i=1;i<=i_dbTyp[0];i++)
wxYield();
SQL_TYPE += DB_TYPE; SQL_TYPE += DB_TYPE;
Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE)); Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
SQL_TYPE.Printf("%10s %d,%d",((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName, SQL_TYPE.Printf("%10s %d,%d",((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName,
@@ -208,11 +218,12 @@ int DBTree::OnPopulate()
else else
Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1)); Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
z++; z++;
if (z % 10 == 0) // if (z % 10 == 0)
{ {
Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d (from %d) has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z,ct_BrowserDB->numTables); 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); pDoc->p_MainFrame->SetStatusText(Temp0, 0);
} }
wxYield();
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW) } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW)
// else // else
// wxLogMessage(_("\n-I-> if ! TABLE or VIEW >%s<"),(ct_BrowserDB->pTableInf+x)->tableType); // wxLogMessage(_("\n-I-> if ! TABLE or VIEW >%s<"),(ct_BrowserDB->pTableInf+x)->tableType);
@@ -245,7 +256,8 @@ int DBTree::OnPopulate()
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h ")); popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return 0; return 0;
} } // DBTree::OnPopulate()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{ {
@@ -292,6 +304,7 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
} }
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event)) void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
@@ -339,6 +352,7 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
} }
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnDBGrid(wxCommandEvent& event) void DBTree::OnDBGrid(wxCommandEvent& event)
{ {
@@ -361,6 +375,7 @@ void DBTree::OnDBGrid(wxCommandEvent& event)
} }
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnDBClass(wxCommandEvent& event) void DBTree::OnDBClass(wxCommandEvent& event)
{ {
@@ -374,6 +389,7 @@ void DBTree::OnDBClass(wxCommandEvent& event)
wxMessageBox(Temp0); wxMessageBox(Temp0);
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnTableClass(wxCommandEvent& event) void DBTree::OnTableClass(wxCommandEvent& event)
{ {
@@ -395,6 +411,7 @@ void DBTree::OnTableClass(wxCommandEvent& event)
} }
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnTableClassAll(wxCommandEvent& event) void DBTree::OnTableClassAll(wxCommandEvent& event)
{ {
@@ -408,6 +425,7 @@ void DBTree::OnTableClassAll(wxCommandEvent& event)
wxMessageBox(Temp0); wxMessageBox(Temp0);
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnMouseMove(wxMouseEvent &event) void DBTree::OnMouseMove(wxMouseEvent &event)
{ {

View File

@@ -1,5 +1,5 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DBTree.cpp/.h // Name: dbtree.cpp/.h
// Purpose: Tree with Table and Views, branches show Field information // Purpose: Tree with Table and Views, branches show Field information
// Author: Mark Johnson // Author: Mark Johnson
// Modified by: 19991129.mj10777 // Modified by: 19991129.mj10777
@@ -7,8 +7,10 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainDoc; // Declared in Doc.h file class MainDoc; // Declared in doc.h file
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DBTreeData : public wxTreeItemData class DBTreeData : public wxTreeItemData
{ {
@@ -17,10 +19,11 @@ public:
void ShowInfo(wxTreeCtrl *tree); void ShowInfo(wxTreeCtrl *tree);
wxString m_desc; wxString m_desc;
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DBTree : public wxTreeCtrl class DBTree : public wxTreeCtrl
{ {
public: public:
enum enum
{ // The order here must be the same as in m_imageListNormal ! { // The order here must be the same as in m_imageListNormal !
TreeIc_Logo, // logo.ico TreeIc_Logo, // logo.ico
@@ -37,14 +40,14 @@ class DBTree : public wxTreeCtrl
TreeIc_FolderOpen // f_open.ico TreeIc_FolderOpen // f_open.ico
}; };
wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5; wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBTree() { } DBTree() { }
DBTree(wxWindow *parent); DBTree(wxWindow *parent);
DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size,long style); DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size,long style);
virtual ~DBTree(); virtual ~DBTree();
MainDoc *pDoc; MainDoc *pDoc;
wxDbInf *ct_BrowserDB; wxDbInf *ct_BrowserDB;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int i_TabArt; // Tab = 0 ; Page = 1; int i_TabArt; // Tab = 0 ; Page = 1;
int i_ViewNr; // View Nummer in Tab / Page int i_ViewNr; // View Nummer in Tab / Page
int i_Which; // Which View, Database is this/using int i_Which; // Which View, Database is this/using
@@ -52,10 +55,10 @@ class DBTree : public wxTreeCtrl
wxMenu *popupMenu1; // OnDBClass wxMenu *popupMenu1; // OnDBClass
wxMenu *popupMenu2; // OnDBGrid & OnTableclass wxMenu *popupMenu2; // OnDBGrid & OnTableclass
wxPoint TreePos; wxPoint TreePos;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
wxImageList *p_imageListNormal; wxImageList *p_imageListNormal;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
public: public:
int OnPopulate(); int OnPopulate();
void OnSelChanged(wxTreeEvent& event); void OnSelChanged(wxTreeEvent& event);
void OnRightSelect(wxTreeEvent& event); void OnRightSelect(wxTreeEvent& event);
@@ -65,8 +68,8 @@ class DBTree : public wxTreeCtrl
void OnTableClassAll(wxCommandEvent& event); void OnTableClassAll(wxCommandEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& 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()
// if you want your overloaded OnCompareItems() to be called. // if you want your overloaded OnCompareItems() to be called.
// OTOH, if you don't want it you may omit the next line - this will // OTOH, if you don't want it you may omit the next line - this will
@@ -74,6 +77,7 @@ class DBTree : public wxTreeCtrl
DECLARE_DYNAMIC_CLASS(DBTree) DECLARE_DYNAMIC_CLASS(DBTree)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#define POPUP_01_BEGIN 1100 #define POPUP_01_BEGIN 1100
#define DATA_SHOW 1101 #define DATA_SHOW 1101

View File

@@ -31,15 +31,16 @@
//-- all #includes that every .cpp needs ----19990807.mj10777 ---------------- //-- all #includes that every .cpp needs ----19990807.mj10777 ----------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#include "std.h" #include "std.h"
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) : DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
wxDialog(parent, ID_DIALOG_DSN, title) wxDialog(parent, ID_DIALOG_DSN, title)
{ {
int chSize; // Height of Font * 1.4 = Height of wxTextCtrl int chSize; // Height of Font * 1.4 = Height of wxTextCtrl
float ratio = 1.4; float ratio = (float)1.4;
#ifdef __WXMOTIF__ #ifdef __WXMOTIF__
ratio = 2.1; ratio = (float)2.1;
#endif #endif
SetBackgroundColour("wheat"); SetBackgroundColour("wheat");
@@ -116,6 +117,7 @@ DlgUser::DlgUser(wxWindow *parent, MainDoc *p_Doc, const wxString& title) :
s_Password = ""; s_Password = "";
Layout(); Layout();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DlgUser::OnInit() void DlgUser::OnInit()
{ {
@@ -124,11 +126,13 @@ void DlgUser::OnInit()
m_UserName->SetLabel(s_User); m_UserName->SetLabel(s_User);
m_Password->SetLabel(s_Password); m_Password->SetLabel(s_Password);
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DlgUser, wxDialog) BEGIN_EVENT_TABLE(DlgUser, wxDialog)
EVT_BUTTON(wxID_OK, DlgUser::OnOk) EVT_BUTTON(wxID_OK, DlgUser::OnOk)
EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel) EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) ) void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
{ {
@@ -137,6 +141,7 @@ void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
s_Password = m_Password->GetValue(); s_Password = m_Password->GetValue();
EndModal(wxID_OK); EndModal(wxID_OK);
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) ) //void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
// { // {

View File

@@ -15,12 +15,14 @@
#define ID_USER 102 #define ID_USER 102
#define ID_PASSWORD 103 #define ID_PASSWORD 103
#define ID_TEXT 104 #define ID_TEXT 104
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainDoc; class MainDoc;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DlgUser: public wxDialog class DlgUser: public wxDialog
{ {
public: public:
wxString s_DSN, s_User, s_Password; wxString s_DSN, s_User, s_Password;
wxStaticText *m_Label1, *m_Label2; wxStaticText *m_Label1, *m_Label2;
wxTextCtrl *m_UserName, *m_Password; wxTextCtrl *m_UserName, *m_Password;
@@ -31,6 +33,7 @@ class DlgUser: public wxDialog
void OnInit(); void OnInit();
void OnOk(wxCommandEvent& event); void OnOk(wxCommandEvent& event);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,5 +1,5 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: Doc.cpp // Name: doc.cpp
// Purpose: Holds information for DBBrowser - (a do-it-yourself document) // Purpose: Holds information for DBBrowser - (a do-it-yourself document)
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
// Modified by: 19990808.mj10777 // Modified by: 19990808.mj10777
@@ -34,10 +34,12 @@
//-- Some Global Vars for all Files (extern in ?.h needed) ------------------------------- //-- Some Global Vars for all Files (extern in ?.h needed) -------------------------------
// Global structure for holding ODBC connection information // Global structure for holding ODBC connection information
wxDbConnectInf DbConnectInf; wxDbConnectInf DbConnectInf;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
wxConfigBase *p_ProgramCfg; // All Config and Path information wxConfigBase *p_ProgramCfg; // All Config and Path information
wxLogTextCtrl *p_LogBook; // All Log messages wxLogTextCtrl *p_LogBook; // All Log messages
wxString LogBuf; // String for all Logs wxString LogBuf; // String for all Logs
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainDoc::MainDoc() MainDoc::MainDoc()
{ {
@@ -57,27 +59,27 @@ MainDoc::MainDoc()
s_BColour = "WHEAT"; s_BColour = "WHEAT";
ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT)); ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainDoc::~MainDoc() MainDoc::~MainDoc()
{ {
p_TabArea->Show(FALSE); // Deactivate the Window
p_PageArea->Show(FALSE); // Deactivate the Window
// ---------------------------------------------------------- // ----------------------------------------------------------
// -E-> The Tree Controls take to long to close : Why ?? // -E-> The Tree Controls take to long to close : Why ??
// ---------------------------------------------------------- // ----------------------------------------------------------
delete ft_Doc; delete ft_Doc; ft_Doc = NULL;
ft_Doc = NULL; delete p_PgmCtrl; p_PgmCtrl = NULL;
p_TabArea->Show(FALSE); // Deactivate the Window
p_PageArea->Show(FALSE); // Deactivate the Window
p_PgmCtrl = NULL;
delete p_PgmCtrl;
delete [] p_DSN; delete [] p_DSN;
delete p_DBTree; delete p_DBTree;
p_TabArea = NULL; delete p_TabArea; delete p_TabArea; p_TabArea = NULL;
p_PageArea = NULL; delete p_PageArea; delete p_PageArea; p_PageArea = NULL;
p_Splitter = NULL; delete p_Splitter; p_Splitter = NULL;
delete p_Splitter; delete [] db_Br; db_Br = NULL;
delete [] db_Br;
// wxMessageBox("~MainDoc"); // wxMessageBox("~MainDoc");
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MainDoc::OnNewDocument() bool MainDoc::OnNewDocument()
{ {
@@ -90,6 +92,7 @@ bool MainDoc::OnNewDocument()
wxLogMessage(_("-I-> MainDoc::OnNewDocument() - End - Time needed : %ld ms"),sw.Time()); wxLogMessage(_("-I-> MainDoc::OnNewDocument() - End - Time needed : %ld ms"),sw.Time());
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MainDoc::OnInitView() bool MainDoc::OnInitView()
{ {
@@ -114,7 +117,7 @@ bool MainDoc::OnInitView()
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// now create "output" window // now create "output" window
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_PageArea = new wxPaggedWindow(); // Init the Pointer p_PageArea = new wxPagedWindow(); // Init the Pointer
p_PageArea->Create(p_Splitter, -1); p_PageArea->Create(p_Splitter, -1);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString, p_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString,
@@ -145,6 +148,7 @@ bool MainDoc::OnInitView()
wxLogMessage(Temp0); wxLogMessage(Temp0);
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MainDoc::OnInitODBC() bool MainDoc::OnInitODBC()
{ {
@@ -225,6 +229,7 @@ bool MainDoc::OnInitODBC()
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MainDoc::OnChosenDSN(int Which) bool MainDoc::OnChosenDSN(int Which)
{ {
@@ -254,6 +259,7 @@ bool MainDoc::OnChosenDSN(int Which)
// wxLogMessage("OnChosenDSN(%d) - End",Which); // wxLogMessage("OnChosenDSN(%d) - End",Which);
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MainDoc::OnChosenTbl(int Tab,wxString Table) bool MainDoc::OnChosenTbl(int Tab,wxString Table)
{ {
@@ -310,6 +316,7 @@ bool MainDoc::OnChosenTbl(int Tab,wxString Table)
//-------------------------- //--------------------------
return TRUE;; return TRUE;;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainDoc::OnLeer(wxString Aufrufer) void MainDoc::OnLeer(wxString Aufrufer)
{ {
@@ -318,9 +325,11 @@ void MainDoc::OnLeer(wxString Aufrufer)
wxLogMessage(Temp0); Temp0.Empty(); wxLogMessage(Temp0); Temp0.Empty();
return; return;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow) BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DocSplitterWindow::DocSplitterWindow(wxWindow *parent, wxWindowID id) : wxSplitterWindow(parent, id) DocSplitterWindow::DocSplitterWindow(wxWindow *parent, wxWindowID id) : wxSplitterWindow(parent, id)
{ // Define a constructor for my p_Splitter { // Define a constructor for my p_Splitter

View File

@@ -1,5 +1,5 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Name: Doc.h // Name: doc.h
// Purpose: a non-MFC Document (a do-it-yourself document) // Purpose: a non-MFC Document (a do-it-yourself document)
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
// Modified by: 19990808.mj10777 // Modified by: 19990808.mj10777
@@ -7,31 +7,36 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- Some Global Vars -------------------------------------------------------------------- //-- Some Global Vars --------------------------------------------------------------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DSN class DSN
{ {
public: public:
wxString Dsn; wxString Dsn;
wxString Drv; wxString Drv;
wxString Pas; wxString Pas;
wxString Usr; wxString Usr;
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Global structure for holding ODBC connection information // Global structure for holding ODBC connection information
extern wxDbConnectInf DbConnectInf; extern wxDbConnectInf DbConnectInf;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
extern wxConfigBase *p_ProgramCfg; // All Config and Path information extern wxConfigBase *p_ProgramCfg; // All Config and Path information
extern wxLogTextCtrl *p_LogBook; // All Log messages extern wxLogTextCtrl *p_LogBook; // All Log messages
extern wxString LogBuf; // String for all Logs extern wxString LogBuf; // String for all Logs
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class PgmCtrl; // Declared in PgmCtrl.h file class PgmCtrl; // Declared in PgmCtrl.h file
class DocSplitterWindow; // Declared at the end of the file class DocSplitterWindow; // Declared at the end of the file
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainDoc class MainDoc
{ {
public: public:
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
MainDoc(); MainDoc();
virtual ~MainDoc(); virtual ~MainDoc();
@@ -54,7 +59,7 @@ class MainDoc
DBGrid *p_DBGrid; DBGrid *p_DBGrid;
wxTextCtrl *p_LogWin; wxTextCtrl *p_LogWin;
wxTabbedWindow *p_TabArea; wxTabbedWindow *p_TabArea;
wxPaggedWindow *p_PageArea; wxPagedWindow *p_PageArea;
int i_TabNr; // Amount of active Views in Tab int i_TabNr; // Amount of active Views in Tab
int i_PageNr; // Amount of active Views in Page int i_PageNr; // Amount of active Views in Page
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@@ -69,9 +74,11 @@ class MainDoc
void OnLeer(wxString Aufrufer); // Dummy Funktion void OnLeer(wxString Aufrufer); // Dummy Funktion
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
}; };
//----------------------------------------------------------------------------------------
class DocSplitterWindow: public wxSplitterWindow class DocSplitterWindow: public wxSplitterWindow
{ {
public: public:
MainDoc *pDoc; MainDoc *pDoc;
DocSplitterWindow(wxWindow *parent, wxWindowID id); DocSplitterWindow(wxWindow *parent, wxWindowID id);
virtual bool OnSashPositionChange(int newSashPosition) virtual bool OnSashPositionChange(int newSashPosition)

View File

@@ -1,5 +1,5 @@
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: pgmctrl.h // Name: pgmctrl.cpp
// Purpose: Programm Control with a Tree // Purpose: Programm Control with a Tree
// Author: Mark Johnson // Author: Mark Johnson
// Modified by: 19990806.mj10777 // Modified by: 19990806.mj10777
@@ -39,6 +39,7 @@
//-- all #includes that every .cpp needs --- 19990807.mj10777 ---------------- //-- all #includes that every .cpp needs --- 19990807.mj10777 ----------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#include "std.h" // sorgsam Pflegen ! #include "std.h" // sorgsam Pflegen !
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- Global functions -------------------------------------------------------------------- //-- Global functions --------------------------------------------------------------------
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@@ -46,6 +47,7 @@ static inline const char *bool2String(bool b)
{ {
return b ? "" : "not "; return b ? "" : "not ";
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(PgmCtrl, wxTreeCtrl) BEGIN_EVENT_TABLE(PgmCtrl, wxTreeCtrl)
EVT_MOTION (PgmCtrl::OnMouseMove) EVT_MOTION (PgmCtrl::OnMouseMove)
@@ -53,17 +55,20 @@ BEGIN_EVENT_TABLE(PgmCtrl, wxTreeCtrl)
EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_PGM,PgmCtrl::OnRightSelect) EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_PGM,PgmCtrl::OnRightSelect)
EVT_MENU(PGMCTRL_ODBC_USER,PgmCtrl::OnUserPassword) EVT_MENU(PGMCTRL_ODBC_USER,PgmCtrl::OnUserPassword)
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// PgmCtrl implementation // PgmCtrl implementation
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(PgmCtrl, wxTreeCtrl) IMPLEMENT_DYNAMIC_CLASS(PgmCtrl, wxTreeCtrl)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
PgmCtrl::PgmCtrl(wxWindow *parent) : wxTreeCtrl(parent) PgmCtrl::PgmCtrl(wxWindow *parent) : wxTreeCtrl(parent)
{ {
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style) PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style)
: wxTreeCtrl(parent, id, pos, size, style) : wxTreeCtrl(parent, id, pos, size, style)
{ {
// Make an image list containing small icons // Make an image list containing small icons
p_imageListNormal = new wxImageList(16, 16, TRUE); p_imageListNormal = new wxImageList(16, 16, TRUE);
@@ -84,14 +89,17 @@ PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const
#endif #endif
SetImageList(p_imageListNormal); SetImageList(p_imageListNormal);
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
PgmCtrl::~PgmCtrl() PgmCtrl::~PgmCtrl()
{ {
delete p_imageListNormal; delete p_imageListNormal;
delete popupMenu1; delete popupMenu1;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#undef TREE_EVENT_HANDLER #undef TREE_EVENT_HANDLER
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int PgmCtrl::OnPopulate() int PgmCtrl::OnPopulate()
{ {
@@ -129,6 +137,7 @@ int PgmCtrl::OnPopulate()
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return 0; return 0;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnSelChanged(wxMouseEvent& WXUNUSED(event)) void PgmCtrl::OnSelChanged(wxMouseEvent& WXUNUSED(event))
{ {
@@ -198,6 +207,7 @@ void PgmCtrl::OnSelChanged(wxMouseEvent& WXUNUSED(event))
} }
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
@@ -244,11 +254,13 @@ void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
} }
} // void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) } // void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnMouseMove(wxMouseEvent &event) void PgmCtrl::OnMouseMove(wxMouseEvent &event)
{ {
TreePos = event.GetPosition(); TreePos = event.GetPosition();
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event)) void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event))
{ {
@@ -259,6 +271,7 @@ void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event))
//------------------------------------------- //-------------------------------------------
for (i=0;i<pDoc->i_DSN;i++) for (i=0;i<pDoc->i_DSN;i++)
{ {
wxYield();
if (SaveDSN == (pDoc->p_DSN+i)->Dsn) if (SaveDSN == (pDoc->p_DSN+i)->Dsn)
{ {
p_Dlg->pDoc = pDoc; p_Dlg->pDoc = pDoc;
@@ -280,7 +293,8 @@ void PgmCtrl::OnUserPassword(wxCommandEvent& WXUNUSED(event))
OK = TRUE; OK = TRUE;
} }
delete p_Dlg; delete p_Dlg;
if (!OK) return; if (!OK)
return;
//-------------------- //--------------------
break; // We have what we want, leave break; // We have what we want, leave
} }

View File

@@ -7,20 +7,23 @@
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Mark Johnson, Berlin Germany, mj10777@gmx.net // Copyright: (c) Mark Johnson, Berlin Germany, mj10777@gmx.net
// Licence: wxWindows license // Licence: wxWindows license
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class MainDoc; // Declared in doc.h file class MainDoc; // Declared in doc.h file
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class TreeData : public wxTreeItemData class TreeData : public wxTreeItemData
{ {
public: public:
TreeData(const wxString& desc) : m_desc(desc) { } TreeData(const wxString& desc) : m_desc(desc) { }
void ShowInfo(wxTreeCtrl *tree); void ShowInfo(wxTreeCtrl *tree);
wxString m_desc; wxString m_desc;
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class PgmCtrl : public wxTreeCtrl class PgmCtrl : public wxTreeCtrl
{ {
public: public:
enum enum
{ // The order here must be the same as in m_imageListNormal ! { // The order here must be the same as in m_imageListNormal !
TreeIc_Logo, // logo.ico TreeIc_Logo, // logo.ico
@@ -32,30 +35,30 @@ class PgmCtrl : public wxTreeCtrl
TreeIc_FolderOpen // f_open.ico TreeIc_FolderOpen // f_open.ico
}; };
wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5; wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
PgmCtrl() { } PgmCtrl() { }
PgmCtrl(wxWindow *parent); PgmCtrl(wxWindow *parent);
PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size,long style); PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size,long style);
virtual ~PgmCtrl(); virtual ~PgmCtrl();
MainDoc *pDoc; MainDoc *pDoc;
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int i_TabArt; // Tab = 0 ; Page = 1; int i_TabArt; // Tab = 0 ; Page = 1;
int i_ViewNr; // View Nummer in Tab / Page int i_ViewNr; // View Nummer in Tab / Page
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
wxImageList *p_imageListNormal; wxImageList *p_imageListNormal;
wxMenu *popupMenu1; // OnDBClass wxMenu *popupMenu1; // OnDBClass
wxPoint TreePos; wxPoint TreePos;
wxString SaveDSN; // Needed for User and Password wxString SaveDSN; // Needed for User and Password
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
public: public:
int OnPopulate(); int OnPopulate();
void OnSelChanged(wxMouseEvent& event); void OnSelChanged(wxMouseEvent& event);
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()
// if you want your overloaded OnCompareItems() to be called. // if you want your overloaded OnCompareItems() to be called.
// OTOH, if you don't want it you may omit the next line - this will // OTOH, if you don't want it you may omit the next line - this will
@@ -63,6 +66,7 @@ class PgmCtrl : public wxTreeCtrl
DECLARE_DYNAMIC_CLASS(PgmCtrl) DECLARE_DYNAMIC_CLASS(PgmCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#define PGMCTRL_01_BEGIN 1000 #define PGMCTRL_01_BEGIN 1000
#define PGMCTRL_ODBC_USER 1001 #define PGMCTRL_ODBC_USER 1001

View File

@@ -5,10 +5,10 @@
// Modified by: 19990908 : mj10777@gmx.net // Modified by: 19990908 : mj10777@gmx.net
// - rename to tabpgwin // - rename to tabpgwin
// - restruction of Variable declaration // - restruction of Variable declaration
// - to prevent Warnings under MingGW32 // - to prevent Warnings under MingW32
// Modified by: 19990909 : mj10777@gmx.net // Modified by: 19990909 : mj10777@gmx.net
// - mNoVertScroll TRUE = no / FALSE = Original Code // - mNoVertScroll TRUE = no / FALSE = Original Code
// the Original Code Paints a Vertical Scroll in wxPaggedWindow // the Original Code Paints a Vertical Scroll in wxPagedWindow
// which is not needed in this Version. Use TRUE for this. // which is not needed in this Version. Use TRUE for this.
// Created: 07/09/98 // Created: 07/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
@@ -17,7 +17,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "controlarea.h" #pragma implementation
// #pragma interface // #pragma interface
#endif #endif
@@ -39,79 +39,97 @@
#include "wx/utils.h" // import wxMin/wxMax macros and wxFileExist(..) #include "wx/utils.h" // import wxMin/wxMax macros and wxFileExist(..)
#include "tabpgwin.h" #include "tabpgwin.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Implementation for class twTabInfo // Implementation for class twTabInfo
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS( twTabInfo, wxObject ) IMPLEMENT_DYNAMIC_CLASS( twTabInfo, wxObject )
//---------------------------------------------------------------------------
twTabInfo::twTabInfo() //---------------------------------------------------------------------------
: mpContent( 0 ) twTabInfo::twTabInfo()
: mpContent( 0 )
{} {}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
twTabInfo::~twTabInfo() twTabInfo::~twTabInfo()
{ {
// FOR NOW:: nothing // FOR NOW:: nothing
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int twTabInfo::ImgWidth() int twTabInfo::ImgWidth()
{ {
if ( mBitMap.Ok() ) return mBitMap.GetWidth(); if ( mBitMap.Ok() ) return mBitMap.GetWidth();
else return 0; else return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int twTabInfo::ImgHeight() int twTabInfo::ImgHeight()
{ {
if ( mBitMap.Ok() ) return mBitMap.GetHeight(); if ( mBitMap.Ok() )
else return 0; return mBitMap.GetHeight();
else
return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int twTabInfo::ImageToTxtGap( int prefGap ) int twTabInfo::ImageToTxtGap( int prefGap )
{ {
if ( mBitMap.Ok() ) return prefGap; if ( mBitMap.Ok() )
else return 0; return prefGap;
else
return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool twTabInfo::HasImg() bool twTabInfo::HasImg()
{ {
return mBitMap.Ok(); return mBitMap.Ok();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// bool twTabInfo::HasText(); // bool twTabInfo::HasText();
unsigned int twTabInfo::HasText() unsigned int twTabInfo::HasText()
{ {
return mText.Length(); return mText.Length();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxBitmap& twTabInfo::GetImg() wxBitmap& twTabInfo::GetImg()
{ {
return mBitMap; return mBitMap;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxString& twTabInfo::GetText() wxString& twTabInfo::GetText()
{ {
return mText; return mText;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxWindow& twTabInfo::GetContent() wxWindow& twTabInfo::GetContent()
{ {
return *mpContent; return *mpContent;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Implementation for class wxTabbedWindow // Implementation for class wxTabbedWindow
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS( wxTabbedWindow, wxPanel ) IMPLEMENT_DYNAMIC_CLASS( wxTabbedWindow, wxPanel )
//---------------------------------------------------------------------------
BEGIN_EVENT_TABLE( wxTabbedWindow, wxPanel ) //---------------------------------------------------------------------------
BEGIN_EVENT_TABLE( wxTabbedWindow, wxPanel )
EVT_SIZE ( wxTabbedWindow::OnSize ) EVT_SIZE ( wxTabbedWindow::OnSize )
EVT_PAINT( wxTabbedWindow::OnPaint ) EVT_PAINT( wxTabbedWindow::OnPaint )
EVT_LEFT_DOWN( wxTabbedWindow::OnLButtonDown ) EVT_LEFT_DOWN( wxTabbedWindow::OnLButtonDown )
// TDB:: filciker reduction // TDB:: filciker reduction
// EVT_ERASE_BACKGROUND( wxTabbedWindow::OnBkErase ) // EVT_ERASE_BACKGROUND( wxTabbedWindow::OnBkErase )
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------
wxTabbedWindow::wxTabbedWindow()
: mpTabScroll ( NULL ), //---------------------------------------------------------------------------
wxTabbedWindow::wxTabbedWindow()
: mpTabScroll ( NULL ),
mpHorizScroll( NULL ), mpHorizScroll( NULL ),
mpVertScroll ( NULL ), mpVertScroll ( NULL ),
@@ -131,11 +149,11 @@ IMPLEMENT_DYNAMIC_CLASS( wxTabbedWindow, wxPanel )
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ), mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
// state variables // state variables
mActiveTab ( 0 ), mActiveTab ( 0 ),
mTitleHeight( 0 ), mTitleHeight( 0 ),
mLayoutType( wxTITLE_IMG_AND_TEXT ) mLayoutType( wxTITLE_IMG_AND_TEXT )
{} {}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxTabbedWindow::~wxTabbedWindow() wxTabbedWindow::~wxTabbedWindow()
{ {
@@ -147,6 +165,7 @@ wxTabbedWindow::~wxTabbedWindow()
pTab = pTab->Next(); pTab = pTab->Next();
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool repant) void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool repant)
{ {
@@ -176,6 +195,7 @@ void wxTabbedWindow::SizeTabs(int x,int y, int width, int height, bool repant)
++n; ++n;
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::AddTab( wxWindow* pContent, void wxTabbedWindow::AddTab( wxWindow* pContent,
wxString tabText, wxString tabText,
@@ -205,6 +225,7 @@ void wxTabbedWindow::AddTab( wxWindow* pContent,
OnTabAdded( pTab ); OnTabAdded( pTab );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::AddTab( wxWindow* pContent, void wxTabbedWindow::AddTab( wxWindow* pContent,
wxString tabText, wxBitmap* pImage ) wxString tabText, wxBitmap* pImage )
@@ -224,6 +245,7 @@ void wxTabbedWindow::AddTab( wxWindow* pContent,
RecalcLayout(TRUE); RecalcLayout(TRUE);
OnTabAdded( pTab ); OnTabAdded( pTab );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::RemoveTab( int tabNo ) void wxTabbedWindow::RemoveTab( int tabNo )
{ {
@@ -236,22 +258,26 @@ void wxTabbedWindow::RemoveTab( int tabNo )
mActiveTab = mTabs.Number() - 1; mActiveTab = mTabs.Number() - 1;
SetActiveTab( mActiveTab ); SetActiveTab( mActiveTab );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int wxTabbedWindow::GetTabCount() int wxTabbedWindow::GetTabCount()
{ {
return mTabs.Number(); return mTabs.Number();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxWindow* wxTabbedWindow::GetTab( int tabNo ) wxWindow* wxTabbedWindow::GetTab( int tabNo )
{ {
return ((twTabInfo*)(mTabs.Nth( tabNo )->Data()))->mpContent; return ((twTabInfo*)(mTabs.Nth( tabNo )->Data()))->mpContent;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxWindow* wxTabbedWindow::GetActiveTab() wxWindow* wxTabbedWindow::GetActiveTab()
{ {
// FIMXE:: this is lame // FIMXE:: this is lame
return GetTab( mActiveTab ); return GetTab( mActiveTab );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::SetActiveTab( int tabNo ) void wxTabbedWindow::SetActiveTab( int tabNo )
{ {
@@ -259,10 +285,12 @@ void wxTabbedWindow::SetActiveTab( int tabNo )
RecalcLayout(TRUE); RecalcLayout(TRUE);
Refresh(); Refresh();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// width of the decorations border (4 shade-lines), should not be changed // width of the decorations border (4 shade-lines), should not be changed
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define BORDER_SZ 4 #define BORDER_SZ 4
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::DrawShadedRect( int x, int y, int width, int height, void wxTabbedWindow::DrawShadedRect( int x, int y, int width, int height,
wxPen& upperPen, wxPen& lowerPen, wxDC& dc wxPen& upperPen, wxPen& lowerPen, wxDC& dc
@@ -280,6 +308,7 @@ void wxTabbedWindow::DrawShadedRect( int x, int y, int width, int height,
dc.DrawLine( x + width - 1, y, x + width - 1, y + height - 1 ); // vert dc.DrawLine( x + width - 1, y, x + width - 1, y + height - 1 ); // vert
dc.DrawLine( x, y + height - 1, x + width, y + height - 1 ); // horiz dc.DrawLine( x, y + height - 1, x + width, y + height - 1 ); // horiz
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::DrawDecorations( wxDC& dc ) void wxTabbedWindow::DrawDecorations( wxDC& dc )
{ {
@@ -412,7 +441,8 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc )
curX += xSize; curX += xSize;
} // end of `while (pNode)' } // end of `while (pNode)'
} } // wxTabbedWindow::DrawDecorations()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int wxTabbedWindow::HitTest( const wxPoint& pos ) int wxTabbedWindow::HitTest( const wxPoint& pos )
{ {
@@ -447,7 +477,8 @@ int wxTabbedWindow::HitTest( const wxPoint& pos )
} }
return -1; return -1;
} } // wxTabbedWindow::HitTest()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::HideInactiveTabs( bool andRepaint ) void wxTabbedWindow::HideInactiveTabs( bool andRepaint )
{ {
@@ -468,7 +499,8 @@ void wxTabbedWindow::HideInactiveTabs( bool andRepaint )
pNode = pNode->Next(); pNode = pNode->Next();
++tabNo; ++tabNo;
} }
} } // wxTabbedWindow::HideInactiveTabs()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxFont wxTabbedWindow::GetLabelingFont() wxFont wxTabbedWindow::GetLabelingFont()
{ {
@@ -488,7 +520,8 @@ wxFont wxTabbedWindow::GetLabelingFont()
#endif #endif
return font; return font;
} } // wxTabbedWindow::GetLabelingFont()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::RecalcLayout(bool andRepaint) void wxTabbedWindow::RecalcLayout(bool andRepaint)
{ {
@@ -565,7 +598,8 @@ void wxTabbedWindow::RecalcLayout(bool andRepaint)
curX = mFirstTitleGap; // the left-side gap curX = mFirstTitleGap; // the left-side gap
int denomiator = mTabs.Number(); int denomiator = mTabs.Number();
if ( denomiator == 0 ) ++denomiator; if ( denomiator == 0 )
++denomiator;
mBorderOnlyWidth = (width - mFirstTitleGap - mHorizGap) / denomiator; mBorderOnlyWidth = (width - mFirstTitleGap - mHorizGap) / denomiator;
@@ -610,7 +644,8 @@ void wxTabbedWindow::RecalcLayout(bool andRepaint)
pNode = pNode->Next(); pNode = pNode->Next();
} }
} } // wxTabbedWindow::RecalcLayout()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// wx event handlers // wx event handlers
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -619,17 +654,20 @@ void wxTabbedWindow::OnPaint( wxPaintEvent& event )
wxPaintDC dc(this); wxPaintDC dc(this);
DrawDecorations( dc ); DrawDecorations( dc );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::OnSize ( wxSizeEvent& event ) void wxTabbedWindow::OnSize ( wxSizeEvent& event )
{ {
SetBackgroundColour( wxColour( 192,192,192 ) ); SetBackgroundColour( wxColour( 192,192,192 ) );
RecalcLayout(TRUE); RecalcLayout(TRUE);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::OnBkErase( wxEraseEvent& event ) void wxTabbedWindow::OnBkErase( wxEraseEvent& event )
{ {
// do nothing // do nothing
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxTabbedWindow::OnLButtonDown( wxMouseEvent& event ) void wxTabbedWindow::OnLButtonDown( wxMouseEvent& event )
{ {
@@ -644,37 +682,37 @@ void wxTabbedWindow::OnLButtonDown( wxMouseEvent& event )
SetActiveTab( tabNo ); SetActiveTab( tabNo );
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Implementation for class wxPaggedWindow // Implementation for class wxPagedWindow
//---------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS( wxPagedWindow, wxTabbedWindow )
//---------------------------------------------------------------------------
BEGIN_EVENT_TABLE( wxPagedWindow, wxTabbedWindow )
EVT_SIZE ( wxPagedWindow::OnSize )
EVT_PAINT ( wxPagedWindow::OnPaint )
EVT_LEFT_DOWN( wxPagedWindow::OnLButtonDown )
EVT_LEFT_UP ( wxPagedWindow::OnLButtonUp )
EVT_MOTION ( wxPagedWindow::OnMouseMove )
EVT_SCROLL ( wxPagedWindow::OnScroll )
END_EVENT_TABLE()
//---------------------------------------------------------------------------
// border for paged-window is 2 shaded-lines
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS( wxPaggedWindow, wxTabbedWindow )
//---------------------------------------------------------------------------
BEGIN_EVENT_TABLE( wxPaggedWindow, wxTabbedWindow )
EVT_SIZE ( wxPaggedWindow::OnSize )
EVT_PAINT ( wxPaggedWindow::OnPaint )
EVT_LEFT_DOWN( wxPaggedWindow::OnLButtonDown )
EVT_LEFT_UP ( wxPaggedWindow::OnLButtonUp )
EVT_MOTION ( wxPaggedWindow::OnMouseMove )
EVT_SCROLL ( wxPaggedWindow::OnScroll )
END_EVENT_TABLE()
//---------------------------------------------------------------------------
// border for pagged-window is 2 shaded-lines
//---------------------------------------------------------------------------
#undef BORDER_SZ #undef BORDER_SZ
#define BORDER_SZ 2 #define BORDER_SZ 2
//---------------------------------------------------------------------------
wxPaggedWindow::wxPaggedWindow()
: mScrollEventInProgress( FALSE ), //---------------------------------------------------------------------------
wxPagedWindow::wxPagedWindow()
: mScrollEventInProgress( FALSE ),
mTabTrianGap(4), mTabTrianGap(4),
mWhiteBrush( wxColour(255,255,255), wxSOLID ), mWhiteBrush( wxColour(255,255,255), wxSOLID ),
mGrayBrush ( wxColour(192,192,192), wxSOLID ), mGrayBrush ( wxColour(192,192,192), wxSOLID ),
mCurentRowOfs( 0 ), mCurentRowOfs( 0 ),
mAdjustableTitleRowLen( 300 ), mAdjustableTitleRowLen( 300 ),
mIsDragged ( FALSE ), mIsDragged ( FALSE ),
mDagOrigin ( 0 ), mDagOrigin ( 0 ),
mCursorChanged( FALSE ), mCursorChanged( FALSE ),
@@ -685,13 +723,15 @@ IMPLEMENT_DYNAMIC_CLASS( wxPaggedWindow, wxTabbedWindow )
mTitleHorizGap = 10; mTitleHorizGap = 10;
mNoVertScroll = TRUE; // Horizontale Scroll abschalten mNoVertScroll = TRUE; // Horizontale Scroll abschalten
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxPaggedWindow::~wxPaggedWindow() wxPagedWindow::~wxPagedWindow()
{ {
// nothing (base class handles destruction) // nothing (base class handles destruction)
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxFont wxPaggedWindow::GetLabelingFont() wxFont wxPagedWindow::GetLabelingFont()
{ {
wxFont font; wxFont font;
@@ -707,25 +747,29 @@ wxFont wxPaggedWindow::GetLabelingFont()
return font; return font;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnTabAdded( twTabInfo* pInfo ) void wxPagedWindow::OnTabAdded( twTabInfo* pInfo )
{ {
int units = GetWholeTabRowLen() / 20; int units = GetWholeTabRowLen() / 20;
mpTabScroll->SetScrollbar( 0, 1, units, 1, FALSE ); mpTabScroll->SetScrollbar( 0, 1, units, 1, FALSE );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxScrollBar& wxPaggedWindow::GetVerticalScrollBar() wxScrollBar& wxPagedWindow::GetVerticalScrollBar()
{ {
return *mpVertScroll; return *mpVertScroll;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
wxScrollBar& wxPaggedWindow::GetHorizontalScrollBar() wxScrollBar& wxPagedWindow::GetHorizontalScrollBar()
{ {
return *mpHorizScroll; return *mpHorizScroll;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int wxPaggedWindow::GetWholeTabRowLen() int wxPagedWindow::GetWholeTabRowLen()
{ {
wxNode* pNode = mTabs.First(); wxNode* pNode = mTabs.First();
@@ -740,9 +784,10 @@ int wxPaggedWindow::GetWholeTabRowLen()
} }
return len; return len;
} } // wxPagedWindow::GetWholeTabRowLen()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::DrawPaperBar( twTabInfo& tab, int x, int y, void wxPagedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
wxBrush& brush, wxPen& pen, wxDC& dc ) wxBrush& brush, wxPen& pen, wxDC& dc )
{ {
wxPoint poly[4]; wxPoint poly[4];
@@ -795,9 +840,10 @@ void wxPaggedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 ); dc.DrawText( tab.GetText(), tx, y + ( tab.mDims.y - h ) / 2 );
} }
} } // wxPagedWindow::DrawPaperBar()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::DrawDecorations( wxDC& dc ) void wxPagedWindow::DrawDecorations( wxDC& dc )
{ {
// FIXME:: the is big body have to be split! // FIXME:: the is big body have to be split!
@@ -831,7 +877,8 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
// FOR NOW:: avoid creating bitmap with invalid dimensions // FOR NOW:: avoid creating bitmap with invalid dimensions
if ( mTitleRowLen < 1 || mTitleHeight < 1 ) return; if ( mTitleRowLen < 1 || mTitleHeight < 1 )
return;
wxMemoryDC tmpDc; wxMemoryDC tmpDc;
wxBitmap tmpBmp( mTitleRowLen, mTitleHeight ); wxBitmap tmpBmp( mTitleRowLen, mTitleHeight );
@@ -848,7 +895,6 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
twTabInfo& tab = *((twTabInfo*)(pNode->Data())); twTabInfo& tab = *((twTabInfo*)(pNode->Data()));
if ( tabNo != mActiveTab ) if ( tabNo != mActiveTab )
DrawPaperBar( tab, curX, curY, mGrayBrush, mBlackPen, tmpDc ); DrawPaperBar( tab, curX, curY, mGrayBrush, mBlackPen, tmpDc );
curX += tab.mDims.x; curX += tab.mDims.x;
@@ -902,14 +948,16 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
height - mVertGap - BORDER_SZ - mTitleHeight, height - mVertGap - BORDER_SZ - mTitleHeight,
mTitleRowLen, mTitleHeight, mTitleRowLen, mTitleHeight,
&tmpDc, 0,0, wxCOPY ); &tmpDc, 0,0, wxCOPY );
} } // wxPagedWindow::DrawDecorations()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int wxPaggedWindow::HitTest( const wxPoint& pos ) int wxPagedWindow::HitTest( const wxPoint& pos )
{ {
return wxTabbedWindow::HitTest( pos ); return wxTabbedWindow::HitTest( pos );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::RecalcLayout(bool andRepaint) void wxPagedWindow::RecalcLayout(bool andRepaint)
{ {
mTitleRowLen = mAdjustableTitleRowLen; mTitleRowLen = mAdjustableTitleRowLen;
@@ -1014,21 +1062,24 @@ void wxPaggedWindow::RecalcLayout(bool andRepaint)
mpTabScroll->Enable( mTitleRowLen < GetWholeTabRowLen() || mCurentRowOfs < 0 ); mpTabScroll->Enable( mTitleRowLen < GetWholeTabRowLen() || mCurentRowOfs < 0 );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// event handlers // event handlers
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnPaint( wxPaintEvent& event ) void wxPagedWindow::OnPaint( wxPaintEvent& event )
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
DrawDecorations( dc ); DrawDecorations( dc );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnSize ( wxSizeEvent& event ) void wxPagedWindow::OnSize ( wxSizeEvent& event )
{ {
wxTabbedWindow::OnSize(event); wxTabbedWindow::OnSize(event);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnLButtonDown( wxMouseEvent& event ) void wxPagedWindow::OnLButtonDown( wxMouseEvent& event )
{ {
if ( mCursorChanged ) if ( mCursorChanged )
{ {
@@ -1043,9 +1094,10 @@ void wxPaggedWindow::OnLButtonDown( wxMouseEvent& event )
{ {
wxTabbedWindow::OnLButtonDown( event ); wxTabbedWindow::OnLButtonDown( event );
} }
} } // wxPagedWindow::OnLButtonDown()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnLButtonUp( wxMouseEvent& event ) void wxPagedWindow::OnLButtonUp( wxMouseEvent& event )
{ {
if ( mIsDragged ) if ( mIsDragged )
{ {
@@ -1055,9 +1107,10 @@ void wxPaggedWindow::OnLButtonUp( wxMouseEvent& event )
ReleaseMouse(); ReleaseMouse();
} }
} } // wxPagedWindow::OnLButtonUp()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void wxPaggedWindow::OnMouseMove( wxMouseEvent& event ) void wxPagedWindow::OnMouseMove( wxMouseEvent& event )
{ {
int width, height; int width, height;
GetClientSize( &width, &height ); GetClientSize( &width, &height );
@@ -1088,6 +1141,7 @@ void wxPaggedWindow::OnMouseMove( wxMouseEvent& event )
} }
} }
else else
{
if ( mIsDragged ) if ( mIsDragged )
{ {
mAdjustableTitleRowLen = mOriginalTitleRowLen + ( event.m_x - mDagOrigin ); mAdjustableTitleRowLen = mOriginalTitleRowLen + ( event.m_x - mDagOrigin );
@@ -1102,13 +1156,14 @@ void wxPaggedWindow::OnMouseMove( wxMouseEvent& event )
//Refresh(); //Refresh();
} }
} }
//--------------------------------------------------------------------------- } // wxPagedWindow::OnMouseMove()
void wxPaggedWindow::OnScroll( wxScrollEvent& event )
{
//---------------------------------------------------------------------------
void wxPagedWindow::OnScroll( wxScrollEvent& event )
{
wxScrollBar* pSender = (wxScrollBar*)event.GetEventObject(); wxScrollBar* pSender = (wxScrollBar*)event.GetEventObject();
// wxMessageBox("wxPaggedWindow::OnScroll","-I->"); // wxMessageBox("wxPagedWindow::OnScroll","-I->");
if ( pSender == mpTabScroll ) if ( pSender == mpTabScroll )
{ {
@@ -1126,6 +1181,7 @@ void wxPaggedWindow::OnScroll( wxScrollEvent& event )
DrawDecorations( dc ); DrawDecorations( dc );
} }
else else
{
if ( !mScrollEventInProgress ) if ( !mScrollEventInProgress )
{ {
mScrollEventInProgress = TRUE; mScrollEventInProgress = TRUE;
@@ -1139,6 +1195,7 @@ void wxPaggedWindow::OnScroll( wxScrollEvent& event )
mScrollEventInProgress = FALSE; mScrollEventInProgress = FALSE;
} }
} }
} // wxPagedWindow::OnScroll()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@
// - to prevent Warnings under MingGW32 // - to prevent Warnings under MingGW32
// Modified by: 19990909 : mj10777@gmx.net // Modified by: 19990909 : mj10777@gmx.net
// - mNoVertScroll TRUE = no / FALSE = Original Code // - mNoVertScroll TRUE = no / FALSE = Original Code
// the Original Code Paints a Vertical Scroll in wxPaggedWindow // the Original Code Paints a Vertical Scroll in wxPagedWindow
// which is not needed in this Version. Use TRUE for this. // which is not needed in this Version. Use TRUE for this.
// Created: 07/09/98 // Created: 07/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
@@ -60,7 +60,7 @@ public:
virtual wxFont GetLabelingFont(); virtual wxFont GetLabelingFont();
// FOR NOW:: scrollbars are actually related to wxPaggedWindow // FOR NOW:: scrollbars are actually related to wxPagedWindow
wxScrollBar* mpTabScroll; wxScrollBar* mpTabScroll;
wxScrollBar* mpHorizScroll; wxScrollBar* mpHorizScroll;
@@ -154,9 +154,9 @@ public:
* of Microsoft Developer Studio 4.xx * of Microsoft Developer Studio 4.xx
*/ */
class wxPaggedWindow : public wxTabbedWindow class wxPagedWindow : public wxTabbedWindow
{ {
DECLARE_DYNAMIC_CLASS( wxPaggedWindow ) DECLARE_DYNAMIC_CLASS( wxPagedWindow )
// the protected: public: changes prevents Warnings in gcc // the protected: public: changes prevents Warnings in gcc
protected: protected:
bool mScrollEventInProgress; bool mScrollEventInProgress;
@@ -199,8 +199,8 @@ public:
public: public:
wxPaggedWindow(); wxPagedWindow();
~wxPaggedWindow(); ~wxPagedWindow();
// NOTE:: use public methods of the base class // NOTE:: use public methods of the base class
// to add "pages" to this window // to add "pages" to this window