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

View File

@@ -16,6 +16,7 @@
//----------------------------------------------------------------------------------------
extern wxDbConnectInf DbConnectInf;
class MainDoc;
//----------------------------------------------------------------------------------------
class BrowserDB
{

View File

@@ -43,8 +43,10 @@ BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(ABOUT, MainFrame::OnAbout) // Program Discription
EVT_MENU(HELP, MainFrame::OnHelp) // Program Help
END_EVENT_TABLE()
//----------------------------------------------------------------------------------------
IMPLEMENT_APP(MainApp) // This declares wxApp::MainApp as "the" Application
//----------------------------------------------------------------------------------------
// 'Main program' equivalent, creating windows and returning main app frame
//----------------------------------------------------------------------------------------
@@ -257,6 +259,7 @@ bool MainApp::OnInit(void) // Does everything needed for a program start
p_ProgramCfg->Flush(TRUE); // save the configuration
return TRUE;
} // bool MainApp::OnInit(void)
//----------------------------------------------------------------------------------------
// My frame constructor
//----------------------------------------------------------------------------------------
@@ -266,6 +269,7 @@ MainFrame::MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxS
p_Splitter = NULL; pDoc = NULL; p_Help = NULL; // Keep the Pointers clean !
//--- Everything else is done in MainApp::OnInit() --------------------------------------
}
//----------------------------------------------------------------------------------------
MainFrame::~MainFrame(void)
{
@@ -294,11 +298,13 @@ MainFrame::~MainFrame(void)
if (pDoc) // If we have a Valid Document
delete pDoc; // Cleanup (MainDoc::~MainDoc)
} // MainFrame::~MainFrame(void)
//----------------------------------------------------------------------------------------
void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
//----------------------------------------------------------------------------------------
void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
@@ -308,6 +314,7 @@ void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
wxMessageDialog dialog(this, Temp0,Temp1,wxOK|wxCANCEL);
dialog.ShowModal();
}
//----------------------------------------------------------------------------------------
void MainFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
{

View File

@@ -27,9 +27,11 @@ class MainFrame: public wxFrame
DocSplitterWindow *p_Splitter; // for Document Views
MainDoc *pDoc; // Self made Document
wxHtmlHelpController *p_Help; // Help System
//--------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE()
};
//----------------------------------------------------------------------------------------
// Define a new application type
//----------------------------------------------------------------------------------------
@@ -40,6 +42,7 @@ class MainApp: public wxApp
bool OnInit(void); // Programmstart
wxLocale m_locale; // locale we'll be using and language support - MUST be here !
};
//----------------------------------------------------------------------------------------
// 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_BROWSE,DBGrid::OnModusBrowse)
END_EVENT_TABLE()
//----------------------------------------------------------------------------------------
// wxListCtrl(parent, id, pos, size, style)
// wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
@@ -71,12 +72,14 @@ DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wx
popupMenu2 = new wxMenu("");
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
}
//----------------------------------------------------------------------------------------
DBGrid::~DBGrid()
{
delete popupMenu1;
delete popupMenu2;
}
//----------------------------------------------------------------------------------------
int DBGrid::OnTableView(wxString Table)
{
@@ -149,6 +152,7 @@ int DBGrid::OnTableView(wxString Table)
wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
return 0;
}
//----------------------------------------------------------------------------------------
void DBGrid::OnModusEdit(wxCommandEvent& event)
{
@@ -157,6 +161,7 @@ void DBGrid::OnModusEdit(wxCommandEvent& event)
UpdateDimensions(); // Redraw the Grid
// wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
}
//----------------------------------------------------------------------------------------
void DBGrid::OnModusBrowse(wxCommandEvent& event)
{
@@ -165,18 +170,22 @@ void DBGrid::OnModusBrowse(wxCommandEvent& event)
UpdateDimensions(); // Redraw the Grid
// wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
}
//----------------------------------------------------------------------------------------
void DBGrid::OnEditorShown( wxGridEvent& ev )
{
// wxLogMessage(_("-I-> DBGrid::OnEditorShown() - End"));
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnEditorHidden( wxGridEvent& ev )
{
// wxLogMessage(_("-I-> DBGrid::OnEditorHidden() - End"));
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnSelectCell( wxGridEvent& ev )
{
logBuf = "";
@@ -187,11 +196,13 @@ void DBGrid::OnSelectCell( wxGridEvent& ev )
// to occur in wxGrid
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnMouseMove(wxMouseEvent &event)
{
MousePos = event.GetPosition();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
{
@@ -210,11 +221,13 @@ void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
}
if ( ev.ShiftDown() )
logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n";
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightClick( wxGridEvent& ev )
{
@@ -239,11 +252,13 @@ void DBGrid::OnLabelRightClick( wxGridEvent& ev )
}
if ( ev.ShiftDown() )
logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n";
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
{
@@ -262,11 +277,13 @@ void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
}
if ( ev.ShiftDown() )
logBuf << " (shift down)";
// wxLogMessage( "%s", logBuf.c_str() );
logBuf += "\n";
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
{
@@ -290,6 +307,7 @@ void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnCellLeftClick( wxGridEvent& ev )
{
@@ -305,6 +323,7 @@ void DBGrid::OnCellLeftClick( wxGridEvent& ev )
//
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnCellRightClick( wxGridEvent& ev )
{
@@ -320,6 +339,7 @@ void DBGrid::OnCellRightClick( wxGridEvent& ev )
//
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
{
@@ -335,6 +355,7 @@ void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
//
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnCellRightDClick( wxGridEvent& ev )
{
@@ -350,6 +371,7 @@ void DBGrid::OnCellRightDClick( wxGridEvent& ev )
//
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnCellChange( wxGridEvent& ev )
{
@@ -365,6 +387,7 @@ void DBGrid::OnCellChange( wxGridEvent& ev )
//
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnRowSize( wxGridSizeEvent& ev )
{
@@ -375,6 +398,7 @@ void DBGrid::OnRowSize( wxGridSizeEvent& ev )
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnColSize( wxGridSizeEvent& ev )
{
@@ -385,6 +409,7 @@ void DBGrid::OnColSize( wxGridSizeEvent& ev )
wxLogMessage(logBuf.c_str());
ev.Skip();
}
//----------------------------------------------------------------------------------------
void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
{

View File

@@ -11,8 +11,10 @@
#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID)
#error "DBGrid requires the new wxGrid class"
#endif
//----------------------------------------------------------------------------------------
class MainDoc;
//----------------------------------------------------------------------------------------
class DBGrid: public wxGrid
{
@@ -57,9 +59,11 @@ class DBGrid: public wxGrid
//---------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE()
};
//----------------------------------------------------------------------------------------
#define GRID_01_BEGIN 1200
#define GRID_BROWSE 1201
#define GRID_EDIT 1202
#define GRID_01_END 1203
//----------------------------------------------------------------------------------------

View File

@@ -32,6 +32,7 @@
//-- all #includes that every .cpp needs --- 19990807.mj10777 ----------------
//----------------------------------------------------------------------------------------
#include "std.h" // sorgsam Pflegen !
//----------------------------------------------------------------------------------------
//-- Global functions --------------------------------------------------------------------
//----------------------------------------------------------------------------------------
@@ -39,6 +40,7 @@ static inline const char *bool2String(bool b)
{
return b ? "" : "not ";
}
//----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl)
EVT_MOTION (DBTree::OnMouseMove)
@@ -53,10 +55,12 @@ END_EVENT_TABLE()
// DBTree implementation
//----------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl)
//----------------------------------------------------------------------------------------
DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent)
{
}
//----------------------------------------------------------------------------------------
DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style)
: wxTreeCtrl(parent, id, pos, size, style)
@@ -91,9 +95,12 @@ DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const w
popupMenu1 = NULL;
popupMenu2 = NULL;
}
//----------------------------------------------------------------------------------------
DBTree::~DBTree()
{
delete ct_BrowserDB;
// delete (pDoc->db_Br+i_Which);
// wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()");
(pDoc->db_Br+i_Which)->OnCloseDB(FALSE);
@@ -102,15 +109,16 @@ DBTree::~DBTree()
(pDoc->db_Br+i_Which)->ct_BrowserDB = NULL;
(pDoc->db_Br+i_Which)->cl_BrowserDB = NULL;
delete ct_BrowserDB;
delete p_imageListNormal;
if (popupMenu1) // If the DSN has no Tables, then no delete should be done !
delete popupMenu1;
if (popupMenu1) // If the DSN has no Tables, then no delete should be done !
delete popupMenu2;
}
//----------------------------------------------------------------------------------------
#undef TREE_EVENT_HANDLER
//----------------------------------------------------------------------------------------
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]);
}
} // for (i=1;i<=i_SqlTyp[0];i++)
wxYield();
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])
@@ -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]);
}
} // for (i=1;i<=i_dbTyp[0];i++)
wxYield();
SQL_TYPE += DB_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,
@@ -208,11 +218,12 @@ int DBTree::OnPopulate()
else
Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
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);
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
}
wxYield();
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW)
// else
// 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 "));
//---------------------------------------------------------------------------------------
return 0;
}
} // DBTree::OnPopulate()
//----------------------------------------------------------------------------------------
void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{
@@ -292,6 +304,7 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
}
}
}
//----------------------------------------------------------------------------------------
void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{
@@ -339,6 +352,7 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
}
}
}
//----------------------------------------------------------------------------------------
void DBTree::OnDBGrid(wxCommandEvent& event)
{
@@ -361,6 +375,7 @@ void DBTree::OnDBGrid(wxCommandEvent& event)
}
}
}
//----------------------------------------------------------------------------------------
void DBTree::OnDBClass(wxCommandEvent& event)
{
@@ -374,6 +389,7 @@ void DBTree::OnDBClass(wxCommandEvent& event)
wxMessageBox(Temp0);
}
}
//----------------------------------------------------------------------------------------
void DBTree::OnTableClass(wxCommandEvent& event)
{
@@ -395,6 +411,7 @@ void DBTree::OnTableClass(wxCommandEvent& event)
}
}
}
//----------------------------------------------------------------------------------------
void DBTree::OnTableClassAll(wxCommandEvent& event)
{
@@ -408,6 +425,7 @@ void DBTree::OnTableClassAll(wxCommandEvent& event)
wxMessageBox(Temp0);
}
}
//----------------------------------------------------------------------------------------
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
// Author: Mark Johnson
// Modified by: 19991129.mj10777
@@ -7,8 +7,10 @@
// Copyright: (c) Mark Johnson
// Licence: wxWindows license
// RCS-ID: $Id$
//----------------------------------------------------------------------------------------
class MainDoc; // Declared in Doc.h file
class MainDoc; // Declared in doc.h file
//----------------------------------------------------------------------------------------
class DBTreeData : public wxTreeItemData
{
@@ -17,6 +19,7 @@ public:
void ShowInfo(wxTreeCtrl *tree);
wxString m_desc;
};
//----------------------------------------------------------------------------------------
class DBTree : public wxTreeCtrl
{
@@ -74,6 +77,7 @@ class DBTree : public wxTreeCtrl
DECLARE_DYNAMIC_CLASS(DBTree)
DECLARE_EVENT_TABLE()
};
//----------------------------------------------------------------------------------------
#define POPUP_01_BEGIN 1100
#define DATA_SHOW 1101

View File

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

View File

@@ -15,8 +15,10 @@
#define ID_USER 102
#define ID_PASSWORD 103
#define ID_TEXT 104
//----------------------------------------------------------------------------------------
class MainDoc;
//----------------------------------------------------------------------------------------
class DlgUser: public wxDialog
{
@@ -31,6 +33,7 @@ class DlgUser: public wxDialog
void OnInit();
void OnOk(wxCommandEvent& event);
//---------------------------------------------------------------------------------------
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)
// Author: Mark Johnson, mj10777@gmx.net
// Modified by: 19990808.mj10777
@@ -34,10 +34,12 @@
//-- Some Global Vars for all Files (extern in ?.h needed) -------------------------------
// Global structure for holding ODBC connection information
wxDbConnectInf DbConnectInf;
//----------------------------------------------------------------------------------------
wxConfigBase *p_ProgramCfg; // All Config and Path information
wxLogTextCtrl *p_LogBook; // All Log messages
wxString LogBuf; // String for all Logs
//----------------------------------------------------------------------------------------
MainDoc::MainDoc()
{
@@ -57,27 +59,27 @@ MainDoc::MainDoc()
s_BColour = "WHEAT";
ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
}
//----------------------------------------------------------------------------------------
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 ??
// ----------------------------------------------------------
delete ft_Doc;
ft_Doc = NULL;
p_TabArea->Show(FALSE); // Deactivate the Window
p_PageArea->Show(FALSE); // Deactivate the Window
p_PgmCtrl = NULL;
delete p_PgmCtrl;
delete ft_Doc; ft_Doc = NULL;
delete p_PgmCtrl; p_PgmCtrl = NULL;
delete [] p_DSN;
delete p_DBTree;
p_TabArea = NULL; delete p_TabArea;
p_PageArea = NULL; delete p_PageArea;
p_Splitter = NULL;
delete p_Splitter;
delete [] db_Br;
delete p_TabArea; p_TabArea = NULL;
delete p_PageArea; p_PageArea = NULL;
delete p_Splitter; p_Splitter = NULL;
delete [] db_Br; db_Br = NULL;
// wxMessageBox("~MainDoc");
}
//----------------------------------------------------------------------------------------
bool MainDoc::OnNewDocument()
{
@@ -90,6 +92,7 @@ bool MainDoc::OnNewDocument()
wxLogMessage(_("-I-> MainDoc::OnNewDocument() - End - Time needed : %ld ms"),sw.Time());
return TRUE;
}
//----------------------------------------------------------------------------------------
bool MainDoc::OnInitView()
{
@@ -114,7 +117,7 @@ bool MainDoc::OnInitView()
//---------------------------------------------------------------------------------------
// 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_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString,
@@ -145,6 +148,7 @@ bool MainDoc::OnInitView()
wxLogMessage(Temp0);
return TRUE;
}
//----------------------------------------------------------------------------------------
bool MainDoc::OnInitODBC()
{
@@ -225,6 +229,7 @@ bool MainDoc::OnInitODBC()
//---------------------------------------------------------------------------------------
return TRUE;
}
//----------------------------------------------------------------------------------------
bool MainDoc::OnChosenDSN(int Which)
{
@@ -254,6 +259,7 @@ bool MainDoc::OnChosenDSN(int Which)
// wxLogMessage("OnChosenDSN(%d) - End",Which);
return TRUE;
}
//----------------------------------------------------------------------------------------
bool MainDoc::OnChosenTbl(int Tab,wxString Table)
{
@@ -310,6 +316,7 @@ bool MainDoc::OnChosenTbl(int Tab,wxString Table)
//--------------------------
return TRUE;;
}
//----------------------------------------------------------------------------------------
void MainDoc::OnLeer(wxString Aufrufer)
{
@@ -318,9 +325,11 @@ void MainDoc::OnLeer(wxString Aufrufer)
wxLogMessage(Temp0); Temp0.Empty();
return;
}
//----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow)
END_EVENT_TABLE()
//----------------------------------------------------------------------------------------
DocSplitterWindow::DocSplitterWindow(wxWindow *parent, wxWindowID id) : wxSplitterWindow(parent, id)
{ // 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)
// Author: Mark Johnson, mj10777@gmx.net
// Modified by: 19990808.mj10777
@@ -7,6 +7,7 @@
// Copyright: (c) Mark Johnson
// Licence: wxWindows license
// RCS-ID: $Id$
//----------------------------------------------------------------------------------------
//-- Some Global Vars --------------------------------------------------------------------
//----------------------------------------------------------------------------------------
@@ -18,16 +19,20 @@ class DSN
wxString Pas;
wxString Usr;
};
//----------------------------------------------------------------------------------------
// Global structure for holding ODBC connection information
extern wxDbConnectInf DbConnectInf;
//----------------------------------------------------------------------------------------
extern wxConfigBase *p_ProgramCfg; // All Config and Path information
extern wxLogTextCtrl *p_LogBook; // All Log messages
extern wxString LogBuf; // String for all Logs
//----------------------------------------------------------------------------------------
class PgmCtrl; // Declared in PgmCtrl.h file
class DocSplitterWindow; // Declared at the end of the file
//----------------------------------------------------------------------------------------
class MainDoc
{
@@ -54,7 +59,7 @@ class MainDoc
DBGrid *p_DBGrid;
wxTextCtrl *p_LogWin;
wxTabbedWindow *p_TabArea;
wxPaggedWindow *p_PageArea;
wxPagedWindow *p_PageArea;
int i_TabNr; // Amount of active Views in Tab
int i_PageNr; // Amount of active Views in Page
//---------------------------------------------------------------------------------------
@@ -69,6 +74,8 @@ class MainDoc
void OnLeer(wxString Aufrufer); // Dummy Funktion
//---------------------------------------------------------------------------------------
};
//----------------------------------------------------------------------------------------
class DocSplitterWindow: public wxSplitterWindow
{
public:

View File

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

View File

@@ -7,8 +7,10 @@
// RCS-ID: $Id$
// Copyright: (c) Mark Johnson, Berlin Germany, mj10777@gmx.net
// Licence: wxWindows license
//----------------------------------------------------------------------------------------
class MainDoc; // Declared in doc.h file
//----------------------------------------------------------------------------------------
class TreeData : public wxTreeItemData
{
@@ -17,6 +19,7 @@ class TreeData : public wxTreeItemData
void ShowInfo(wxTreeCtrl *tree);
wxString m_desc;
};
//----------------------------------------------------------------------------------------
class PgmCtrl : public wxTreeCtrl
{
@@ -63,6 +66,7 @@ class PgmCtrl : public wxTreeCtrl
DECLARE_DYNAMIC_CLASS(PgmCtrl)
DECLARE_EVENT_TABLE()
};
//----------------------------------------------------------------------------------------
#define PGMCTRL_01_BEGIN 1000
#define PGMCTRL_ODBC_USER 1001

View File

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

View File

@@ -9,7 +9,7 @@
// - to prevent Warnings under MingGW32
// Modified by: 19990909 : mj10777@gmx.net
// - 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.
// Created: 07/09/98
// RCS-ID: $Id$
@@ -60,7 +60,7 @@ public:
virtual wxFont GetLabelingFont();
// FOR NOW:: scrollbars are actually related to wxPaggedWindow
// FOR NOW:: scrollbars are actually related to wxPagedWindow
wxScrollBar* mpTabScroll;
wxScrollBar* mpHorizScroll;
@@ -154,9 +154,9 @@ public:
* 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
protected:
bool mScrollEventInProgress;
@@ -199,8 +199,8 @@ public:
public:
wxPaggedWindow();
~wxPaggedWindow();
wxPagedWindow();
~wxPagedWindow();
// NOTE:: use public methods of the base class
// to add "pages" to this window