browsedb.cpp browsedb.h dbbrowse.cpp dbbrowse.h dbbrowse.rc

dbgrid.cpp dbgrid.h dbtree.cpp dbtree.h dlguser.cpp dlguser.h
 	doc.cpp doc.h pgmctrl.cpp pgmctrl.h


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mark Johnson
2000-02-12 14:11:17 +00:00
parent ef366f3523
commit c92b0f9abd
15 changed files with 1533 additions and 1666 deletions

View File

@@ -1,43 +1,43 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: BrowserDB.h,cpp // Name: BrowserDB.h,cpp
// Purpose: a wxDB; // Purpose: a wxDB class
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
// Modified by: // Modified by:
// Created: 19991127.mj10777 // Created: 19991127.mj10777
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 1) //-- 1)
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#include <wx/dbtable.h> #include <wx/dbtable.h>
#include "std.h" #include "std.h"
#include <iostream> #include <iostream>
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// 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 ?
struct DbStuff ConnectInf; // F<>r DBase struct DbStuff ConnectInf; // F<>r DBase
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
extern DbList* WXDLLEXPORT PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */ extern DbList* WXDLLEXPORT 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)
{ {
static wxString msg; static wxString msg;
@@ -75,7 +75,7 @@ char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
return (char*) (const char*) msg; return (char*) (const char*) msg;
} // GetExtendedDBErrorMsg } // GetExtendedDBErrorMsg
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BrowserDB::BrowserDB() BrowserDB::BrowserDB()
{ {
Zeiger_auf_NULL(0); Zeiger_auf_NULL(0);
@@ -85,12 +85,12 @@ 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 Quite) bool BrowserDB::Initialize(int Quite)
{ {
if (!OnStartDB(Quite)) if (!OnStartDB(Quite))
@@ -100,7 +100,7 @@ bool BrowserDB::Initialize(int Quite)
} }
return TRUE; return TRUE;
} // BrowserDB:Initialize } // BrowserDB:Initialize
//-------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnStartDB(int Quite) bool BrowserDB::OnStartDB(int Quite)
{ {
if (!Quite) if (!Quite)
@@ -118,10 +118,11 @@ bool BrowserDB::OnStartDB(int Quite)
wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source")); wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
return FALSE; return FALSE;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Connect to datasource // Connect to datasource
//--------------------------- //---------------------------------------------------------------------------------------
DlgUser *p_Dlg = new DlgUser(pDoc->p_MainFrame, "Username and Password"); DlgUser *p_Dlg = new DlgUser(pDoc->p_MainFrame, "Username and Password");
p_Dlg->pDoc = pDoc;
p_Dlg->s_DSN = ODBCSource; p_Dlg->s_DSN = ODBCSource;
p_Dlg->s_User = UserName; p_Dlg->s_User = UserName;
p_Dlg->s_Password = Password; p_Dlg->s_Password = Password;
@@ -137,12 +138,10 @@ bool BrowserDB::OnStartDB(int Quite)
Password = p_Dlg->s_Password; Password = p_Dlg->s_Password;
OK = TRUE; OK = TRUE;
} }
//p_Dlg.Destroy();
delete p_Dlg; delete p_Dlg;
if (OK) if (OK)
{ {
//--------------------------- //--------------------------------------------------------------------------------------
strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT) 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.Uid, UserName); // database username - must already exist in the data source
strcpy(ConnectInf.AuthStr, Password); // password database username strcpy(ConnectInf.AuthStr, Password); // password database username
@@ -160,7 +159,7 @@ bool BrowserDB::OnStartDB(int Quite)
} }
return FALSE; return FALSE;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (!Quite) if (!Quite)
{ {
Temp1 = db_BrowserDB->GetDatabaseName(); Temp1 = db_BrowserDB->GetDatabaseName();
@@ -171,7 +170,7 @@ bool BrowserDB::OnStartDB(int Quite)
return TRUE; return TRUE;
} else return FALSE; } else return FALSE;
} }
//-------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnCloseDB(int Quite) bool BrowserDB::OnCloseDB(int Quite)
{ {
if (!Quite) if (!Quite)
@@ -293,7 +292,7 @@ bool BrowserDB::OnGetNext(int Cols,int Quite)
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction); t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str()); strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
} }
if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY if (((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
{ {
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year, Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
@@ -331,7 +330,7 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
{ {
wxString SQLStmt; wxString SQLStmt;
i_Records = 0; i_Records = 0;
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str()); SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData()))) if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{ {
@@ -341,12 +340,12 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
wxMessageBox("-E-> BrowserDB::OnSelect - GetData()"); wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
return FALSE; return FALSE;
} }
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
while (db_BrowserDB->GetNext()) while (db_BrowserDB->GetNext())
{ {
i_Records++; i_Records++;
} }
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData()))) if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{ {
Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str()); Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
@@ -354,9 +353,9 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
wxLogMessage(Temp0); wxLogMessage(Temp0);
return FALSE; return FALSE;
} }
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index // SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (!Quite) if (!Quite)
{ {
wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records); wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
@@ -366,7 +365,7 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite) bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
{ {
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData()))) if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{ {
Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str()); Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
@@ -470,9 +469,3 @@ void BrowserDB::OnFilldbTyp()
i_dbTyp[0] = 4; s_dbTyp[0] = ""; i_dbTyp[0] = 4; s_dbTyp[0] = "";
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,26 +1,26 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: browsedb.h // Name: browsedb.h
// Purpose: a wxDB ; // Purpose: a wxDB class
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
// Modified by: // Modified by:
// Created: 19991127.mj10777 // Created: 19991127.mj10777
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- Zu tun in browsedb.h //-- Zu tun in browsedb.h
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 1) //-- 1)
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Global structure for holding ODBC connection information // Global structure for holding ODBC connection information
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
extern struct DbStuff DbConnectInf; extern struct DbStuff DbConnectInf;
class mjDoc; class mjDoc;
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
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
// for user login names and passwords, getting workstation settings, etc. // for user login names and passwords, getting workstation settings, etc.
@@ -40,13 +40,13 @@ class BrowserDB
// the entire program to use for READ-ONLY database accesses, but for each // the entire program to use for READ-ONLY database accesses, but for each
// table object which will do a CommitTrans() or RollbackTrans() that a // table object which will do a CommitTrans() or RollbackTrans() that a
// new wxDB object be created and used for it. // new wxDB object be created and used for it.
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxDB* db_BrowserDB; wxDB* db_BrowserDB;
wxDbInf* ct_BrowserDB; wxDbInf* ct_BrowserDB;
wxColInf* cl_BrowserDB; wxColInf* cl_BrowserDB;
wxString ODBCSource, UserName, Password; wxString ODBCSource, UserName, Password;
mjDoc *pDoc; mjDoc *pDoc;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5; wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
wxString ODBCText; wxString ODBCText;
wxTextCtrl* p_LogWindow; wxTextCtrl* p_LogWindow;
@@ -57,12 +57,12 @@ class BrowserDB
int i_Which; int i_Which;
int i_Records; int i_Records;
int i_Cols; int i_Cols;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
BrowserDB(); BrowserDB();
~BrowserDB(); ~BrowserDB();
void Zeiger_auf_NULL(int Art); void Zeiger_auf_NULL(int Art);
bool Initialize(int Quite); bool Initialize(int Quite);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
bool OnStartDB(int Quite); bool OnStartDB(int Quite);
bool OnCloseDB(int Quite); bool OnCloseDB(int Quite);
bool OnSelect(wxString tb_Name,int Quite); bool OnSelect(wxString tb_Name,int Quite);
@@ -72,6 +72,6 @@ class BrowserDB
wxColInf* OnGetColumns(char *tableName, int numCols,int Quite); wxColInf* OnGetColumns(char *tableName, int numCols,int Quite);
void OnFillSqlTyp(); void OnFillSqlTyp();
void OnFilldbTyp(); void OnFilldbTyp();
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
}; // BrowserDB class definition }; // BrowserDB class definition
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
// Name: dbbrowse.cpp // Name: dbbrowse.cpp
// Purpose: Through ODBC - Databases Browsen // Purpose: Through ODBC - Databases Browsen
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
@@ -8,61 +8,50 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
//-- 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__
#endif #endif
#include "bitmaps/logo.xpm" #include "bitmaps/logo.xpm"
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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 !
#include <iostream> #include <iostream>
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- Some Global Vars for this file ---------------------------------------- //-- Some Global Vars for this file ------------------------------------------------------
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//---------------------------------------------------------------------------
MainFrame *frame = NULL; // The one and only MainFrame MainFrame *frame = NULL; // The one and only MainFrame
// wxLogNull logNo; // No Log messages //----------------------------------------------------------------------------------------
//---------------------------------------------------------------------------
// verify that the item is ok and insult the user if it is not
#define CHECK_ITEM(item) \
if (!item.IsOk()) \
{ \
wxMessageBox(_("Please select some item first!"),_("Tree sample error"), \
wxOK | wxICON_EXCLAMATION,this); \
return; \
} \
//---------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MainFrame, wxFrame) BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(QUIT, MainFrame::OnQuit) EVT_MENU(QUIT, MainFrame::OnQuit)
EVT_MENU(ABOUT, MainFrame::OnAbout) EVT_MENU(ABOUT, MainFrame::OnAbout)
EVT_MENU(HELP, MainFrame::OnHelp) EVT_MENU(HELP, MainFrame::OnHelp)
EVT_SIZE(MainFrame::OnSize) EVT_SIZE(MainFrame::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MainApp)
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// `Main program' equivalent, creating windows and returning main app frame // 'Main program' equivalent, creating windows and returning main app frame
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool MyApp::OnInit(void) bool MainApp::OnInit(void)
{ {
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// set the language to use // set the language to use
@@ -70,8 +59,10 @@ bool MyApp::OnInit(void)
const char *language = NULL; const char *language = NULL;
const char *langid = NULL; const char *langid = NULL;
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
//-- Graphic File suport - use only when needed, otherwise big .exe's
//---------------------------------------------------------------------------------------
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
wxImage::AddHandler( new wxPNGHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler( new wxPNGHandler ); // needed for help System
#endif #endif
/* /*
#if wxUSE_LIBJPEG #if wxUSE_LIBJPEG
@@ -82,11 +73,11 @@ bool MyApp::OnInit(void)
wxImage::AddHandler( new wxPNMHandler ); // use only when needed, otherwise big .exe's wxImage::AddHandler( new wxPNMHandler ); // use only when needed, otherwise big .exe's
*/ */
#ifdef __WXMSW__ #ifdef __WXMSW__
// wxBitmap::AddHandler( new wxXPMFileHandler ); // use only when needed, otherwise big .exe's // wxBitmap::AddHandler( new wxXPMFileHandler ); // Attempt to use XPS instead of ico
// wxBitmap::AddHandler( new wxXPMDataHandler ); // use only when needed, otherwise big .exe's // wxBitmap::AddHandler( new wxXPMDataHandler ); // - Attempt failed
#endif #endif
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
langid = "std"; // BJO20000125 instead of "" langid = "std"; // Standard language is "std" = english
switch ( argc ) switch ( argc )
{ {
default: default:
@@ -114,13 +105,12 @@ bool MyApp::OnInit(void)
// name is the name of the executable and the vendor name is the same) // name is the name of the executable and the vendor name is the same)
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
SetVendorName("mj10777"); SetVendorName("mj10777");
SetAppName("DBBrowser"); // not needed, it's the default value SetAppName("DBBrowser");
p_ProgramCfg = wxConfigBase::Get(); p_ProgramCfg = wxConfigBase::Get();
// p_ProgramCfg->DeleteAll(); // p_ProgramCfg->DeleteAll();
p_ProgramCfg->SetPath("/"); p_ProgramCfg->SetPath("/");
wxString Temp0, Temp1; wxString Temp0, Temp1;
Temp0.Empty(); Temp0.Empty();
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
//-- Set the Language and remember it for the next time. -------------------------------- //-- Set the Language and remember it for the next time. --------------------------------
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@@ -136,7 +126,7 @@ bool MyApp::OnInit(void)
Temp0 = langid; Temp0 = langid;
p_ProgramCfg->Write("/Local/langid",Temp0); // >const char *langid< can't be used here p_ProgramCfg->Write("/Local/langid",Temp0); // >const char *langid< can't be used here
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Support the following languages // Support the following languages (std = english)
if (Temp0 != "std") if (Temp0 != "std")
{ {
if (Temp0 == "cz") if (Temp0 == "cz")
@@ -172,37 +162,29 @@ bool MyApp::OnInit(void)
p_ProgramCfg->Write("/Local/language",Temp0); p_ProgramCfg->Write("/Local/language",Temp0);
Temp0 = "std"; // allways english if not german or french (at the moment austrian) Temp0 = "std"; // allways english if not german or french (at the moment austrian)
} }
//---------------------------------------------------------------------------------------
Temp0 = "NONE"; Temp0 = "NONE";
p_ProgramCfg->Write("/NONE",Temp0); p_ProgramCfg->Write("/NONE",Temp0);
p_ProgramCfg->Write("/Paths/NONE",Temp0); p_ProgramCfg->Write("/Paths/NONE",Temp0);
p_ProgramCfg->Write("/MainFrame/NONE",Temp0); p_ProgramCfg->Write("/MainFrame/NONE",Temp0);
//----------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_ProgramCfg->Write("/Paths/Work",wxGetCwd()); p_ProgramCfg->Write("/Paths/Work",wxGetCwd());
p_ProgramCfg->SetPath("/"); p_ProgramCfg->SetPath("/");
//----------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// or you could also write something like this: // restore frame position and size, if empty start Values (1,1) and (750,600)
// wxFileConfig *p_ProgramCfg = new wxFileConfig("conftest");
// wxConfigBase::Set(p_ProgramCfg);
// where you can also specify the file names explicitly if you wish.
// Of course, calling Set() is optional and you only must do it if
// you want to later retrieve this pointer with Get().
//----------------------------------------------------------------------------
// SetPath() understands ".."
// restore frame position and size
int x = p_ProgramCfg->Read("/MainFrame/x", 1), y = p_ProgramCfg->Read("/MainFrame/y", 1), int x = p_ProgramCfg->Read("/MainFrame/x", 1), y = p_ProgramCfg->Read("/MainFrame/y", 1),
w = p_ProgramCfg->Read("/MainFrame/w", 600), h = p_ProgramCfg->Read("/MainFrame/h", 450); w = p_ProgramCfg->Read("/MainFrame/w", 750), h = p_ProgramCfg->Read("/MainFrame/h", 600);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Create the main frame window // Create the main frame window
frame = new MainFrame((wxFrame *) NULL, (char *) _("DBBrowser - mj10777"),x,y,w,h); frame = new MainFrame((wxFrame *) NULL, (char *) _("DBBrowser - mj10777"),wxPoint(x,y),wxSize(w,h));
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// This reduces flicker effects - even better would be to define OnEraseBackground // Set the Backgroundcolour (only need if your are NOT using wxSYS_COLOUR_BACKGROUND)
// to do Temp0. When the list control's scrollbars are show or hidden, the frame->SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BACKGROUND));
// frame is sent a background erase event.
//---------------------------------------------------------------------------------------
frame->SetBackgroundColour( *wxWHITE );
// frame->SetBackgroundColour(wxColour(255, 255, 255)); // frame->SetBackgroundColour(wxColour(255, 255, 255));
// frame->SetBackgroundColour(* wxWHITE);
//---------------------------------------------------------------------------------------
// Give it an icon
frame->SetIcon(wxICON(aLogo)); // Programm Icon = lowest name in RC File
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
@@ -223,9 +205,8 @@ bool MyApp::OnInit(void)
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
int width, height; int width, height;
frame->GetClientSize(&width, &height); frame->GetClientSize(&width, &height);
//---------------------------------------------------------------------------------------
frame->p_Splitter = new DocSplitterWindow(frame, SPLITTER_WINDOW); frame->p_Splitter = new DocSplitterWindow(frame,-1);
// p_Splitter->SetCursor(wxCursor(wxCURSOR_PENCIL)); // p_Splitter->SetCursor(wxCursor(wxCURSOR_PENCIL));
frame->pDoc = new mjDoc(); frame->pDoc = new mjDoc();
frame->pDoc->p_MainFrame = frame; frame->pDoc->p_MainFrame = frame;
@@ -233,8 +214,6 @@ bool MyApp::OnInit(void)
frame->pDoc->p_Splitter->pDoc = frame->pDoc; // ControlBase: saving the Sash frame->pDoc->p_Splitter->pDoc = frame->pDoc; // ControlBase: saving the Sash
if (!frame->pDoc->OnNewDocument()) if (!frame->pDoc->OnNewDocument())
frame->Close(TRUE); frame->Close(TRUE);
// frame->Maximize();
// frame->SetSize(-1,-1); // the wxSplitter does not show correctly without this !
frame->SetClientSize(width, height); // the wxSplitter does not show correctly without this ! frame->SetClientSize(width, height); // the wxSplitter does not show correctly without this !
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
//-- Problem : GetClientSize(Width,Hight) are not the same as the values given in the --- //-- Problem : GetClientSize(Width,Hight) are not the same as the values given in the ---
@@ -246,49 +225,27 @@ bool MyApp::OnInit(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//-- Help : --- //-- Help : ---
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
frame->p_Help = new wxHtmlHelpController(); // construct the Help System
frame->help.UseConfig(p_ProgramCfg); frame->p_Help->UseConfig(p_ProgramCfg); // Don't rember what this was for
frame->help.AddBook(langhelp); frame->p_Help->AddBook(langhelp); // Use the language set
/* frame->pDoc->p_Help = frame->p_Help; // Save the information to the document
if (!frame->help.AddBook("helpfiles/dbbrowse.hhp"))
wxMessageBox("Failed adding book helpfiles/dbbrowse.hhp");
if (!frame->help.AddBook("helpfiles/testing.hhp"))
wxMessageBox("Failed adding book helpfiles/testing.hhp");
if (!frame->help.AddBook("helpfiles/another.hhp"))
wxMessageBox("Failed adding book helpfiles/another.hhp");
*/
//---------------------------------------------------------------------------------------
p_ProgramCfg->Flush(TRUE); // sicher Objekt
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Show the frame // Show the frame
frame->Show(TRUE); frame->Show(TRUE);
SetTopWindow(frame); SetTopWindow(frame);
//---------------------------------------------------------------------------------------
p_ProgramCfg->Flush(TRUE); // sicher Objekt
return TRUE; return TRUE;
} } // bool MainApp::OnInit(void)
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// My frame constructor // My frame constructor
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainFrame::MainFrame(wxFrame *frame, char *title, int x, int y, int w, int h): MainFrame::MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxSize& size):
wxFrame(frame, SPLITTER_FRAME, title, wxPoint(x, y), wxSize(w, h)) wxFrame(frame, -1, title, pos, size)
{ {
InitializeMenu(); //--- Everything is done in MainApp -----------------------------------------------------
// This reduces flicker effects - even better would be to define OnEraseBackground
// to do Temp0. When the list control's scrollbars are show or hidden, the
// frame is sent a background erase event.
SetBackgroundColour( *wxWHITE );
// frame->SetBackgroundColour(wxColour(255, 255, 255));
//---------------------------------------------------------------------------------------
// Give it an icon
SetIcon( wxICON(Logo) );
//---------------------------------------------------------------------------------------
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
MainFrame::~MainFrame(void) MainFrame::~MainFrame(void)
{ {
// save the control's values to the config // save the control's values to the config
@@ -307,36 +264,18 @@ MainFrame::~MainFrame(void)
// Get() it doesn't try to create one if there is none (definitely not what // Get() it doesn't try to create one if there is none (definitely not what
// we want here!) // we want here!)
// delete wxConfigBase::Set((wxConfigBase *) NULL); // delete wxConfigBase::Set((wxConfigBase *) NULL);
p_ProgramCfg->Flush(TRUE); // sichert Objekt p_ProgramCfg->Flush(TRUE); // saves Objekt
delete frame->pDoc; delete frame->pDoc; // Cleanup
} }
//-------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::InitializeMenu()
{
//---------------------------------------------------------------------------------------
// Make a menubar
//---------------------------------------------------------------------------------------
wxMenu *file_menu = new wxMenu;
file_menu->Append(ABOUT, _("&About"));
file_menu->AppendSeparator();
file_menu->Append(QUIT, _("E&xit"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _("&File"));
SetMenuBar(menu_bar);
}
//---------------------------------------------------------------------------
void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
// Close the help frame; this will cause the config data to // Close the help frame; this will cause the config data to get written.
// get written. if (p_Help->GetFrame()) // returns NULL if no help frame active
if (help.GetFrame()) // returns NULL if no help frame active p_Help->GetFrame()->Close(TRUE);
help.GetFrame()->Close(TRUE);
Close(TRUE); Close(TRUE);
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageDialog dialog(this, _("DBBrowser\nMark Johnson\nBerlin, Germany\nmj10777@gmx.net\n (c) 1999"), wxMessageDialog dialog(this, _("DBBrowser\nMark Johnson\nBerlin, Germany\nmj10777@gmx.net\n (c) 1999"),
@@ -344,9 +283,9 @@ void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
dialog.ShowModal(); dialog.ShowModal();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void MainFrame::OnHelp(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
{ {
help.Display("Main page"); p_Help->Display("Main page");
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
// Name: dbbrowse.h // Name: dbbrowse.h
// Purpose: Through ODBC - Databases Browsen // Purpose: Through ODBC - Databases Browsen
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
@@ -7,49 +7,46 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Define a new application type // Define a new application type
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
class MyApp: public wxApp class MainApp: public wxApp
{ {
public: public:
bool OnInit(void); bool OnInit(void); // Programmstart
wxLocale m_locale; // locale we'll be using wxLocale m_locale; // locale we'll be using and language support
}; };
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
// Define a new frame type // Define a new frame type
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
class MainFrame: public wxFrame class MainFrame: public wxFrame
{ {
public: public:
MainFrame(wxFrame *frame, char *title, int x, int y, int w, int h); MainFrame(wxFrame *frame, char *title, const wxPoint& pos, const wxSize& size);
~MainFrame(void); ~MainFrame(void);
public: public:
// menu callbacks // menu callbacks
void InitializeMenu();
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event); void OnHelp(wxCommandEvent& event);
//-------------------------------------------------------- //--------------------------------------------------------------------------------------
wxHtmlHelpController help; wxHtmlHelpController *p_Help;
//-------------------------------------------------------- //--------------------------------------------------------------------------------------
int DiffW, DiffH; int DiffW, DiffH;
mjDoc *pDoc; mjDoc *pDoc;
DocSplitterWindow *p_Splitter; DocSplitterWindow *p_Splitter;
//-------------------------------------------------------- //--------------------------------------------------------------------------------------
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
// ID for the menu quit command // ID for the menu quit command
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
#define QUIT 1 #define QUIT 777
#define ABOUT 2 #define ABOUT 778
#define HELP 3 #define HELP 779
#define SPLITTER_FRAME 100
#define SPLITTER_WINDOW 101
#define TREE_CTRL_PGM 102 #define TREE_CTRL_PGM 102
#define GRID_CTRL 103 #define GRID_CTRL 103
#define TREE_CTRL_DB 104 #define TREE_CTRL_DB 104
#define GRID_CTRL_DB 105 #define GRID_CTRL_DB 105
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
Logo ICON "bitmaps\\logo.ico" aLogo ICON "bitmaps\\logo.ico"
Col ICON "bitmaps\\col.ico" Col ICON "bitmaps\\col.ico"
DSNClosed ICON "bitmaps\\dsnclose.ico" DSNClosed ICON "bitmaps\\dsnclose.ico"
DSNOpen ICON "bitmaps\\dsnopen.ico" DSNOpen ICON "bitmaps\\dsnopen.ico"

View File

@@ -1,4 +1,4 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DBGrid.cpp // Name: DBGrid.cpp
// Purpose: wxGrid sample // Purpose: wxGrid sample
// Author: Mark Johnson // Author: Mark Johnson
@@ -7,29 +7,29 @@
// Copyright: (c) // Copyright: (c)
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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 !
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DBGrid, wxGrid) BEGIN_EVENT_TABLE(DBGrid, wxGrid)
EVT_MOTION (DBGrid::OnMouseMove) EVT_MOTION (DBGrid::OnMouseMove)
// DBGrid // DBGrid
@@ -47,43 +47,41 @@ BEGIN_EVENT_TABLE(DBGrid, wxGrid)
EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange ) EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
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 ) );
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// DBGrid // DBGrid
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// 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)
{ {
//f_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
f_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
wxPanel::SetFont(* f_Temp);
b_EditModus = TRUE; b_EditModus = TRUE;
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
popupMenu1 = new wxMenu(""); popupMenu1 = new wxMenu("");
popupMenu1->Append(GRID_EDIT, _("Edit Modus")); popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
popupMenu2 = new wxMenu(""); popupMenu2 = new wxMenu("");
popupMenu2->Append(GRID_BROWSE, _("Browse Modus")); popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBGrid::~DBGrid() DBGrid::~DBGrid()
{ {
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int DBGrid::OnTableView(wxString Table) int DBGrid::OnTableView(wxString Table)
{ {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
int i=0,x,y,z, ValidTable=0; int i=0,x,y,z, ValidTable=0;
wxString Temp0; wxString Temp0;
//SetLabelFont(* f_Temp); //SetLabelFont(* f_Temp);
wxBeginBusyCursor(); wxBeginBusyCursor();
//--------------------------------------------------------------------------- SetFont(* pDoc->ft_Doc);
//---------------------------------------------------------------------------------------
ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer
//---------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (ct_BrowserDB) // Valid pointer (!= NULL) ? if (ct_BrowserDB) // Valid pointer (!= NULL) ?
{ // Pointer is Valid, use the wxDatabase Information { // Pointer is Valid, use the wxDatabase Information
for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables
@@ -135,15 +133,15 @@ int DBGrid::OnTableView(wxString Table)
} // if (ct_BrowserDB) } // if (ct_BrowserDB)
else else
wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid DSN Pointer : Failed")); wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid DSN Pointer : Failed"));
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Weiter: Weiter:
SetEditInPlace(b_EditModus); // Activate in-place Editing (FALSE) SetEditInPlace(b_EditModus); // Activate in-place Editing (FALSE)
wxEndBusyCursor(); wxEndBusyCursor();
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxLogMessage(_("-I-> DBGrid::OnTableView() - End")); wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
return 0; return 0;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event) void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event)
{ {
b_EditModus = TRUE; // Needed by PopupMenu b_EditModus = TRUE; // Needed by PopupMenu
@@ -151,19 +149,19 @@ void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event)
SetEditInPlace(b_EditModus); // Deactivate in-place Editing SetEditInPlace(b_EditModus); // Deactivate in-place Editing
UpdateDimensions(); // Redraw the Grid UpdateDimensions(); // Redraw the Grid
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnModusBrowse(wxMenu& menu, wxCommandEvent& event) void DBGrid::OnModusBrowse(wxMenu& menu, wxCommandEvent& event)
{ {
b_EditModus = FALSE; // Needed by PopupMenu b_EditModus = FALSE; // Needed by PopupMenu
SetEditInPlace(b_EditModus); // Deactivate in-place Editing SetEditInPlace(b_EditModus); // Deactivate in-place Editing
UpdateDimensions(); // Redraw the Grid UpdateDimensions(); // Redraw the Grid
} }
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
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 )
{ {
logBuf = "DBGrid::OnLabelLeftClick : "; logBuf = "DBGrid::OnLabelLeftClick : ";
@@ -186,7 +184,7 @@ void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightClick( wxGridEvent& ev ) void DBGrid::OnLabelRightClick( wxGridEvent& ev )
{ {
//------------------- //-------------------
@@ -215,7 +213,7 @@ void DBGrid::OnLabelRightClick( wxGridEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelLeftDClick( wxGridEvent& ev ) void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnLabelLeftDClick : "; logBuf = "DBGrid::OnLabelLeftDClick : ";
@@ -238,7 +236,7 @@ void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnLabelRightDClick( wxGridEvent& ev ) void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnLabelRightDClick : "; logBuf = "DBGrid::OnLabelRightDClick : ";
@@ -261,7 +259,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 )
{ {
logBuf = "DBGrid::OnCellLeftClick : "; logBuf = "DBGrid::OnCellLeftClick : ";
@@ -276,7 +274,7 @@ void DBGrid::OnCellLeftClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellRightClick( wxGridEvent& ev ) void DBGrid::OnCellRightClick( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnCellRightClick : "; logBuf = "DBGrid::OnCellRightClick : ";
@@ -291,7 +289,7 @@ void DBGrid::OnCellRightClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellLeftDClick( wxGridEvent& ev ) void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnCellLeftDClick : "; logBuf = "DBGrid::OnCellLeftDClick : ";
@@ -306,7 +304,7 @@ void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellRightDClick( wxGridEvent& ev ) void DBGrid::OnCellRightDClick( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnCellRightDClick : "; logBuf = "DBGrid::OnCellRightDClick : ";
@@ -321,7 +319,7 @@ void DBGrid::OnCellRightDClick( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnCellChange( wxGridEvent& ev ) void DBGrid::OnCellChange( wxGridEvent& ev )
{ {
logBuf = "DBGrid::OnCellChange : "; logBuf = "DBGrid::OnCellChange : ";
@@ -336,7 +334,7 @@ void DBGrid::OnCellChange( wxGridEvent& ev )
// //
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBGrid::OnRowSize( wxGridSizeEvent& ev ) void DBGrid::OnRowSize( wxGridSizeEvent& ev )
{ {
logBuf = "DBGrid::OnRowSize : "; logBuf = "DBGrid::OnRowSize : ";
@@ -346,7 +344,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 )
{ {
logBuf = "DBGrid::OnColSize : "; logBuf = "DBGrid::OnColSize : ";
@@ -354,10 +352,9 @@ void DBGrid::OnColSize( wxGridSizeEvent& ev )
// 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::OnRangeSelected( wxGridRangeSelectEvent& ev ) void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
{ {
logBuf = "DBGrid::OnRangeSelected : "; logBuf = "DBGrid::OnRangeSelected : ";
@@ -365,11 +362,9 @@ void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
<< " col " << ev.GetLeftCol() << " col " << ev.GetLeftCol()
<< " to row " << ev.GetBottomRow() << " to row " << ev.GetBottomRow()
<< " col " << ev.GetRightCol(); << " col " << ev.GetRightCol();
logBuf += "\n"; logBuf += "\n";
// wxLogMessage( "%s", logBuf.c_str() ); // wxLogMessage( "%s", logBuf.c_str() );
wxLogMessage(logBuf.c_str()); wxLogMessage(logBuf.c_str());
ev.Skip(); ev.Skip();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,41 +1,39 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DBGrid.h // Name: DBGrid.h
// Purpose: DBGrid // Purpose: shows seleted Table in a Grid
// Author: Mark Johnson // Author: Mark Johnson
// Modified by: 20000126.mj10777 // Modified by: 20000126.mj10777
// Created: // Created:
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// 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 mjDoc; class mjDoc;
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
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();
//------------------------------------------- //---------------------------------------------------------------------------------------
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
//------------------------------------------- //---------------------------------------------------------------------------------------
wxFont* f_Temp;
mjDoc* pDoc; mjDoc* pDoc;
wxDbInf* ct_BrowserDB; wxDbInf* ct_BrowserDB;
BrowserDB* db_Br; BrowserDB* db_Br;
wxMenu *popupMenu1; // OnDBClass wxMenu *popupMenu1; // OnDBClass
wxMenu *popupMenu2; // OnDBGrid & OnTableclass wxMenu *popupMenu2; // OnDBGrid & OnTableclass
bool b_EditModus; bool b_EditModus;
//------------------------------------------- //---------------------------------------------------------------------------------------
wxString logBuf,Temp0; wxString logBuf,Temp0;
wxPoint MousePos; wxPoint MousePos;
//------------------------------------------- //---------------------------------------------------------------------------------------
void OnModusEdit(wxMenu& menu, wxCommandEvent& event); void OnModusEdit(wxMenu& menu, wxCommandEvent& event);
void OnModusBrowse(wxMenu& menu, wxCommandEvent& event); void OnModusBrowse(wxMenu& menu, wxCommandEvent& event);
void OnMouseMove(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event);
@@ -52,12 +50,12 @@ class DBGrid: public wxGrid
void OnColSize( wxGridSizeEvent& ); void OnColSize( wxGridSizeEvent& );
void OnRangeSelected( wxGridRangeSelectEvent& ); void OnRangeSelected( wxGridRangeSelectEvent& );
void OnCellChange( wxGridEvent& ); void OnCellChange( wxGridEvent& );
//------------------------------------------- //---------------------------------------------------------------------------------------
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

@@ -1,45 +1,45 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DBTree.h // Name: DBTree.cpp/.h
// Purpose: Programm Control with a Tree // Purpose: Tree with Table and Views, branches show Field information
// Author: Mark Johnson // Author: Mark Johnson
// Modified by: // Modified by:
// Created: 19991129 // Created: 19991129
// 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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__
#endif #endif
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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 --------------------------------------------------------------------
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
static inline const char *bool2String(bool b) 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)
EVT_TREE_SEL_CHANGED(TREE_CTRL_DB, DBTree::OnSelChanged) EVT_TREE_SEL_CHANGED(TREE_CTRL_DB, DBTree::OnSelChanged)
@@ -48,57 +48,48 @@ BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl)
EVT_MENU(DATA_DB,DBTree::OnDBClass) EVT_MENU(DATA_DB,DBTree::OnDBClass)
EVT_MENU(DATA_TABLE,DBTree::OnTableClass) EVT_MENU(DATA_TABLE,DBTree::OnTableClass)
EVT_MENU(DATA_TABLE_ALL,DBTree::OnTableClassAll) EVT_MENU(DATA_TABLE_ALL,DBTree::OnTableClassAll)
END_EVENT_TABLE() 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)
{ {
//wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
wxFont* ft_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
SetFont(* ft_Temp);
// 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/key.xpm" #include "bitmaps/view.xpm"
#include "bitmaps/keyf.xpm" #include "bitmaps/col.xpm"
#include "bitmaps/d_open.xpm" #include "bitmaps/key.xpm"
#include "bitmaps/d_closed.xpm" #include "bitmaps/keyf.xpm"
#include "bitmaps/col.xpm" #include "bitmaps/d_open.xpm"
#include "bitmaps/d_closed.xpm"
#endif #endif
p_imageListNormal->Add(wxICON(aLogo));
p_imageListNormal->Add(wxICON(Logo));
p_imageListNormal->Add(wxICON(DsnClosed)); p_imageListNormal->Add(wxICON(DsnClosed));
p_imageListNormal->Add(wxICON(DsnOpen)); p_imageListNormal->Add(wxICON(DsnOpen));
p_imageListNormal->Add(wxICON(TAB)); p_imageListNormal->Add(wxICON(TAB));
p_imageListNormal->Add(wxICON(VIEW));
p_imageListNormal->Add(wxICON(COL)); p_imageListNormal->Add(wxICON(COL));
p_imageListNormal->Add(wxICON(KEY)); p_imageListNormal->Add(wxICON(KEY));
p_imageListNormal->Add(wxICON(KEYF)); p_imageListNormal->Add(wxICON(KEYF));
p_imageListNormal->Add(wxICON(DocOpen)); p_imageListNormal->Add(wxICON(DocOpen));
p_imageListNormal->Add(wxICON(DocOpen)); p_imageListNormal->Add(wxICON(DocOpen));
SetImageList(p_imageListNormal); SetImageList(p_imageListNormal);
ct_BrowserDB = NULL; ct_BrowserDB = NULL;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DBTree::~DBTree() DBTree::~DBTree()
{ {
// wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()"); // wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()");
@@ -110,15 +101,16 @@ DBTree::~DBTree()
delete ct_BrowserDB; delete ct_BrowserDB;
delete p_imageListNormal; delete p_imageListNormal;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#undef TREE_EVENT_HANDLER #undef TREE_EVENT_HANDLER
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int DBTree::OnPopulate() int DBTree::OnPopulate()
{ {
wxTreeItemId Root, Folder, Docu, Funkt; wxTreeItemId Root, Folder, Docu, Funkt;
int i,x,y, TableType; int i,x,y, TableType;
wxString SQL_TYPE, DB_TYPE; wxString SQL_TYPE, DB_TYPE;
//---------------------------------------------------------------------------------------------------------------------------- SetFont(* pDoc->ft_Doc);
//---------------------------------------------------------------------------------------
if ((pDoc->db_Br+i_Which)->Initialize(FALSE)) if ((pDoc->db_Br+i_Which)->Initialize(FALSE))
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
@@ -215,9 +207,9 @@ int DBTree::OnPopulate()
wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed")); wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed"));
return 0; return 0;
} }
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Expand(Root); Expand(Root);
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
popupMenu1 = NULL; popupMenu1 = NULL;
popupMenu1 = new wxMenu(""); popupMenu1 = new wxMenu("");
popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h ")); popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h "));
@@ -228,11 +220,10 @@ int DBTree::OnPopulate()
popupMenu2->Append(DATA_SHOW, _("Show Data")); popupMenu2->Append(DATA_SHOW, _("Show Data"));
popupMenu2->AppendSeparator(); popupMenu2->AppendSeparator();
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h ")); popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return 0; return 0;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{ {
int i; int i;
@@ -245,7 +236,7 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{ {
int Treffer = 0; int Treffer = 0;
Temp1.Printf("%s",item->m_desc.c_str()); Temp1.Printf("%s",item->m_desc.c_str());
//----------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
if (Temp1.Contains("ODBC-")) if (Temp1.Contains("ODBC-"))
{ {
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
@@ -258,10 +249,10 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
} }
Treffer++; Treffer++;
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Treffer == 0) if (Treffer == 0)
{ {
//--------------------------------------------------- //-------------------------------------------------------------------------------------
/* /*
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
"%u children (%u immediately under this item)."), "%u children (%u immediately under this item)."),
@@ -274,11 +265,11 @@ void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
wxLogMessage( "%s", LogBuf.c_str() ); wxLogMessage( "%s", LogBuf.c_str() );
*/ */
//--------------------------------------------------- //-------------------------------------------------------------------------------------
} }
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event)) void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
int i; int i;
@@ -290,7 +281,7 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
int Treffer = 0; int Treffer = 0;
Temp1.Printf("%s",item->m_desc.c_str()); Temp1.Printf("%s",item->m_desc.c_str());
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (!wxStrcmp("Root",Temp1)) if (!wxStrcmp("Root",Temp1))
{ {
PopupMenu(popupMenu1,TreePos.x,TreePos.y); PopupMenu(popupMenu1,TreePos.x,TreePos.y);
@@ -305,10 +296,10 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
Treffer++; Treffer++;
} }
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Treffer == 0) if (Treffer == 0)
{ {
//--------------------------------------------------- //-------------------------------------------------------------------------------------
/* /*
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
"%u children (%u immediately under this item)."), "%u children (%u immediately under this item)."),
@@ -321,11 +312,11 @@ void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
wxLogMessage( "%s", LogBuf.c_str() ); wxLogMessage( "%s", LogBuf.c_str() );
*/ */
//--------------------------------------------------- //-------------------------------------------------------------------------------------
} }
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnDBGrid(wxMenu& , wxCommandEvent& event) void DBTree::OnDBGrid(wxMenu& , wxCommandEvent& event)
{ {
int i; int i;
@@ -347,7 +338,7 @@ void DBTree::OnDBGrid(wxMenu& , wxCommandEvent& event)
} }
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnDBClass(wxMenu& , wxCommandEvent& event) void DBTree::OnDBClass(wxMenu& , wxCommandEvent& event)
{ {
// int i; // int i;
@@ -360,7 +351,7 @@ void DBTree::OnDBClass(wxMenu& , wxCommandEvent& event)
wxMessageBox(Temp0); wxMessageBox(Temp0);
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnTableClass(wxMenu& , wxCommandEvent& event) void DBTree::OnTableClass(wxMenu& , wxCommandEvent& event)
{ {
int i; int i;
@@ -381,7 +372,7 @@ void DBTree::OnTableClass(wxMenu& , wxCommandEvent& event)
} }
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void DBTree::OnTableClassAll(wxMenu& , wxCommandEvent& event) void DBTree::OnTableClassAll(wxMenu& , wxCommandEvent& event)
{ {
// int i; // int i;
@@ -394,11 +385,9 @@ void DBTree::OnTableClassAll(wxMenu& , wxCommandEvent& event)
wxMessageBox(Temp0); wxMessageBox(Temp0);
} }
} }
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
void DBTree::OnMouseMove(wxMouseEvent &event) void DBTree::OnMouseMove(wxMouseEvent &event)
{ {
TreePos = event.GetPosition(); TreePos = event.GetPosition();
} }
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------

View File

@@ -1,25 +1,23 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DBTree.h // Name: DBTree.cpp/.h
// Purpose: Shows ODBC Catalog entries for Databases // Purpose: Tree with Table and Views, branches show Field information
// Author: Mark Johnson // Author: Mark Johnson
// Modified by: 19991129.mj10777 // Modified by: 19991129.mj10777
// Created: 19991129 // Created: 19991129
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class mjDoc; // Declared in Doc.h file class mjDoc; // Declared in Doc.h file
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DBTreeData : public wxTreeItemData class DBTreeData : public wxTreeItemData
{ {
public: public:
DBTreeData(const wxString& desc) : m_desc(desc) { } DBTreeData(const wxString& desc) : m_desc(desc) { }
void ShowInfo(wxTreeCtrl *tree); void ShowInfo(wxTreeCtrl *tree);
wxString m_desc; wxString m_desc;
}; };
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
class DBTree : public wxTreeCtrl class DBTree : public wxTreeCtrl
{ {
public: public:
@@ -39,14 +37,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();
mjDoc *pDoc; mjDoc *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
@@ -54,9 +52,9 @@ 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);
@@ -68,7 +66,7 @@ class DBTree : public wxTreeCtrl
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
@@ -76,11 +74,11 @@ 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
#define DATA_DB 1102 #define DATA_DB 1102
#define DATA_TABLE 1103 #define DATA_TABLE 1103
#define DATA_TABLE_ALL 1104 #define DATA_TABLE_ALL 1104
#define POPUP_01_END 1117 #define POPUP_01_END 1117
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DlgUser.h,cpp // Name: DlgUser.h,cpp
// Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
@@ -7,29 +7,29 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- all #includes that every .cpp needs ----19990807.mj10777 --- //-- all #includes that every .cpp needs ----19990807.mj10777 ----------------
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#include "dlguser.h" #include "std.h"
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
DlgUser::DlgUser(wxWindow *parent, const wxString& title) : DlgUser::DlgUser(wxWindow *parent, const wxString& title) :
wxDialog(parent, ID_DIALOG_DSN, title) wxDialog(parent, ID_DIALOG_DSN, title)
{ {
@@ -38,14 +38,6 @@ DlgUser::DlgUser(wxWindow *parent, const wxString& title) :
wxLayoutConstraints* layout; wxLayoutConstraints* layout;
SetAutoLayout(TRUE); SetAutoLayout(TRUE);
// m_Dsn = new wxStaticText(this, -1, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
// layout = new wxLayoutConstraints;
// layout->centreX.SameAs(this, wxCentreX);
// layout->top.SameAs(this, wxTop,10);
// layout->height.AsIs();
// layout->width.AsIs();
// m_Dsn->SetConstraints(layout);
m_Label1 = new wxStaticText(this, -1, _("User ID:")); m_Label1 = new wxStaticText(this, -1, _("User ID:"));
layout = new wxLayoutConstraints; layout = new wxLayoutConstraints;
layout->left.SameAs(this, wxLeft, 10); layout->left.SameAs(this, wxLeft, 10);
@@ -100,44 +92,27 @@ DlgUser::DlgUser(wxWindow *parent, const wxString& title) :
m_OK->SetDefault(); m_OK->SetDefault();
m_UserName->SetFocus(); m_UserName->SetFocus();
s_User = ""; s_User = "";
s_Password = ""; s_Password = "";
Layout(); Layout();
// wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(55,110), wxSize(80, 30));
// wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(210,110), wxSize(80, 30));
// (void)new wxStaticText(this, -1,_("User ID"), wxPoint(20, 40), wxSize(50, 20),wxALIGN_LEFT);
// (void)new wxStaticText(this, -1,_("Password"), wxPoint(20, 80), wxSize(50, 20),wxALIGN_LEFT);
// but1->SetFocus();
// m_OK->SetDefault();
} }
//----------------------------------------------------------------------------------------
void DlgUser::OnInit() void DlgUser::OnInit()
{ {
wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str()); wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str());
SetTitle(Temp); SetTitle(Temp);
m_UserName->SetLabel(s_User); m_UserName->SetLabel(s_User);
m_Password->SetLabel(s_Password); m_Password->SetLabel(s_Password);
m_Label1->SetFont(* pDoc->ft_Doc); m_Label2->SetFont(* pDoc->ft_Doc);
// (void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE ); m_UserName->SetFont(* pDoc->ft_Doc); m_Password->SetFont(* pDoc->ft_Doc);
// tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator); m_OK->SetFont(* pDoc->ft_Doc); m_Cancel->SetFont(* pDoc->ft_Doc);
// tc_Password = new wxTextCtrl(this, ID_PASSWORD, s_Password, wxPoint(75, 75), wxSize(200, 25),wxTE_PASSWORD, wxDefaultValidator); }
// tc_User->SetFocus(); //----------------------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
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) )
{ {
//canceled = FALSE; //canceled = FALSE;
@@ -145,11 +120,11 @@ 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) )
// { // {
// canceled = TRUE; // canceled = TRUE;
// EndModal(wxID_CANCEL); // EndModal(wxID_CANCEL);
// } // }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: DlgUser.h,cpp // Name: DlgUser.h,cpp
// Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr // Purpose: Dialog mit Variable Gestaltung durch DlgUser.wxr
// Author: Mark Johnson, mj10777@gmx.net // Author: Mark Johnson, mj10777@gmx.net
@@ -7,32 +7,30 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// DlgUser // DlgUser
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#define ID_DIALOG_DSN 100 #define ID_DIALOG_DSN 100
#define ID_DSN 101 #define ID_DSN 101
#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 mjDoc;
//----------------------------------------------------------------------------------------
class DlgUser: public wxDialog class DlgUser: public wxDialog
{ {
public: public:
// bool canceled;
wxString s_DSN, s_User, s_Password; wxString s_DSN, s_User, s_Password;
// wxTextCtrl *tc_User, *tc_Password;
wxStaticText *m_Label1, *m_Label2; wxStaticText *m_Label1, *m_Label2;
wxTextCtrl *m_UserName, *m_Password; wxTextCtrl *m_UserName, *m_Password;
wxButton *m_OK, *m_Cancel; wxButton *m_OK, *m_Cancel;
mjDoc *pDoc;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
DlgUser(wxWindow *parent, const wxString& title); DlgUser(wxWindow *parent, const wxString& title);
void OnInit(); void OnInit();
void OnOk(wxCommandEvent& event); void OnOk(wxCommandEvent& event);
// void OnCancel(wxCommandEvent& event); //---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,6 +1,6 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: Doc.cpp // Name: Doc.cpp
// Purpose: Holds information for DBBrowser // 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
// BJO : Bart A.M. JOURQUIN // BJO : Bart A.M. JOURQUIN
@@ -8,38 +8,37 @@
// Copyright: (c) Mark Johnson // Copyright: (c) Mark Johnson
// Licence: wxWindows license // Licence: wxWindows license
// RCS-ID: $Id$ // RCS-ID: $Id$
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//--------------------------------------------------------------------------- //-- 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 !
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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
struct DbStuff DbConnectInf; struct DbStuff 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
mjDoc::mjDoc() mjDoc::mjDoc()
{ {
db_Br = NULL; db_Br = NULL;
@@ -55,8 +54,10 @@ mjDoc::mjDoc()
p_PageArea = NULL; p_PageArea = NULL;
i_TabNr = 0; i_TabNr = 0;
i_PageNr = 0; i_PageNr = 0;
s_BColour = "WHEAT";
ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
mjDoc::~mjDoc() mjDoc::~mjDoc()
{ {
// ---------------------------------------------------------- // ----------------------------------------------------------
@@ -76,68 +77,67 @@ mjDoc::~mjDoc()
delete [] db_Br; delete [] db_Br;
// wxMessageBox("~mjDoc"); // wxMessageBox("~mjDoc");
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool mjDoc::OnNewDocument() bool mjDoc::OnNewDocument()
{ {
//------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (!OnInitView()) if (!OnInitView())
{ {
return FALSE; return FALSE;
} }
p_PgmCtrl->OnPopulate(); p_PgmCtrl->OnPopulate();
//------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return TRUE; return TRUE;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool mjDoc::OnInitView() bool mjDoc::OnInitView()
{ {
Sash = p_ProgramCfg->Read("/MainFrame/Sash", 200); Sash = p_ProgramCfg->Read("/MainFrame/Sash", 200);
// wxMessageBox("OnInitView() - Begin ","-I->mjDoc::OnInitView"); // wxMessageBox("OnInitView() - Begin ","-I->mjDoc::OnInitView");
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// create "workplace" window // create "workplace" window
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_TabArea = new wxTabbedWindow(); // Init the Pointer p_TabArea = new wxTabbedWindow(); // Init the Pointer
p_TabArea->Create(p_Splitter, -1); p_TabArea->Create(p_Splitter, -1);
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_PgmCtrl = new PgmCtrl(p_TabArea, TREE_CTRL_PGM,wxDefaultPosition, wxDefaultSize, p_PgmCtrl = new PgmCtrl(p_TabArea, TREE_CTRL_PGM,wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
p_PgmCtrl->i_TabArt = 0; // 0 = Tab ; 1 = Page p_PgmCtrl->i_TabArt = 0; // 0 = Tab ; 1 = Page
p_PgmCtrl->i_ViewNr = p_TabArea->GetTabCount()-1; p_PgmCtrl->i_ViewNr = p_TabArea->GetTabCount()-1;
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxBitmap *p_FolderClose = new wxBitmap("PgmCtrl"); //, wxBITMAP_TYPE_BMP_RESOURCE); // BJO20000115 wxBitmap *p_FolderClose = new wxBitmap("PgmCtrl"); //, wxBITMAP_TYPE_BMP_RESOURCE); // BJO20000115
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_TabArea->AddTab(p_PgmCtrl,"PgmCtrl",p_FolderClose); p_TabArea->AddTab(p_PgmCtrl,"PgmCtrl",p_FolderClose);
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// now create "output" window // now create "output" window
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_PageArea = new wxPaggedWindow(); // Init the Pointer p_PageArea = new wxPaggedWindow(); // 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,
wxDefaultPosition, wxDefaultSize,wxTE_MULTILINE ); wxDefaultPosition, wxDefaultSize,wxTE_MULTILINE );
//wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS"); //wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
wxFont* ft_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT)); wxFont* ft_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
p_LogWin->SetFont(* ft_Temp); p_LogWin->SetFont(* ft_Temp);
// Don't forget ! This is always : i_TabArt = 0 ; i_ViewNr = 1; // Don't forget ! This is always : i_TabArt = 0 ; i_ViewNr = 1;
//------------------------------------------------------------------ //---------------------------------------------------------------------------------------
p_LogBook = new wxLogTextCtrl(p_LogWin); // make p_LogWin the LogBook p_LogBook = new wxLogTextCtrl(p_LogWin); // make p_LogWin the LogBook
p_LogBook->SetActiveTarget(p_LogBook); p_LogBook->SetActiveTarget(p_LogBook);
p_LogBook->SetTimestamp( NULL ); p_LogBook->SetTimestamp( NULL );
//------------------------------------------------------------------ //---------------------------------------------------------------------------------------
p_PageArea->AddTab(p_LogWin,_("LogBook"), "what is this?" ); p_PageArea->AddTab(p_LogWin,_("LogBook"), "what is this?" );
i_TabNr = p_TabArea->GetTabCount()-1; // Add one when a new AddTab is done; i_TabNr = p_TabArea->GetTabCount()-1; // Add one when a new AddTab is done;
i_PageNr = p_PageArea->GetTabCount()-1; // Add one when a new AddTab is done; i_PageNr = p_PageArea->GetTabCount()-1; // Add one when a new AddTab is done;
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_PgmCtrl->pDoc = this; p_PgmCtrl->pDoc = this;
p_TabArea->SetActiveTab(i_PageNr); p_TabArea->SetActiveTab(i_PageNr);
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
p_Splitter->Initialize(p_TabArea); p_Splitter->Initialize(p_TabArea);
p_Splitter->SplitHorizontally(p_TabArea,p_PageArea,Sash); p_Splitter->SplitHorizontally(p_TabArea,p_PageArea,Sash);
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (!OnInitODBC()) if (!OnInitODBC())
return FALSE; return FALSE;
//-------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Temp0.Printf("-I-> mjDoc::OnInitView() - End - %d DSN's found",i_DSN); Temp0.Printf("-I-> mjDoc::OnInitView() - End - %d DSN's found",i_DSN);
p_MainFrame->SetStatusText(Temp0, 0); p_MainFrame->SetStatusText(Temp0, 0);
wxLogMessage(Temp0); wxLogMessage(Temp0);
@@ -151,22 +151,21 @@ bool mjDoc::OnInitODBC()
Temp0 = ""; Temp0 = "";
i_DSN = 0; // Counter i_DSN = 0; // Counter
int i = 0; int i = 0;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Initialize the ODBC Environment for Database Operations // Initialize the ODBC Environment for Database Operations
if (SQLAllocEnv(&DbConnectInf.Henv) != SQL_SUCCESS) if (SQLAllocEnv(&DbConnectInf.Henv) != SQL_SUCCESS)
{ {
return FALSE; return FALSE;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
const char sep = 3; // separator character used in string between DSN ans DsDesc const char sep = 3; // separator character used in string between DSN ans DsDesc
wxStringList s_SortDSNList, s_SortDsDescList; wxStringList s_SortDSNList, s_SortDsDescList;
// BJO-20000127 // BJO-20000127
// In order to have same sort result on both Dsn and DsDesc, create a 'keyed' string. // In order to have same sort result on both Dsn and DsDesc, create a 'keyed' string.
// The key will be removed after sorting // The key will be removed after sorting
wxString KeyString; wxString KeyString;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
while(GetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc))) while(GetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc)))
{ {
i_DSN++; // How many Dsn have we ? i_DSN++; // How many Dsn have we ?
@@ -179,7 +178,7 @@ bool mjDoc::OnInitODBC()
char ** s_SortDSN = s_SortDSNList.ListToArray(); //BJO char ** s_SortDSN = s_SortDSNList.ListToArray(); //BJO
char ** s_SortDsDesc = s_SortDsDescList.ListToArray(); //BJO char ** s_SortDsDesc = s_SortDsDescList.ListToArray(); //BJO
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Allocate n ODBC-DSN objects to hold the information // Allocate n ODBC-DSN objects to hold the information
p_DSN = new DSN[i_DSN]; //BJO p_DSN = new DSN[i_DSN]; //BJO
for (i=0;i<i_DSN;i++) for (i=0;i<i_DSN;i++)
@@ -195,7 +194,7 @@ bool mjDoc::OnInitODBC()
wxLogMessage(Temp0); wxLogMessage(Temp0);
} }
i = 0; i = 0;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// Allocate n wxDatabase objects to hold the column information // Allocate n wxDatabase objects to hold the column information
db_Br = new BrowserDB[i_DSN]; db_Br = new BrowserDB[i_DSN];
for (i=0;i<i_DSN;i++) for (i=0;i<i_DSN;i++)
@@ -207,16 +206,13 @@ bool mjDoc::OnInitODBC()
(db_Br+i)->pDoc = this; (db_Br+i)->pDoc = this;
(db_Br+i)->i_Which = i; (db_Br+i)->i_Which = i;
} }
if (SQLFreeEnv(&DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125 if (SQLFreeEnv(&DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125
{ {
// Error freeing environment handle // Error freeing environment handle
} }
delete [] s_SortDSN; delete [] s_SortDSN;
delete [] s_SortDsDesc; delete [] s_SortDsDesc;
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------
if (!i_DSN) if (!i_DSN)
{ {
wxMessageBox(_("No Dataset names found in ODBC!\n" \ wxMessageBox(_("No Dataset names found in ODBC!\n" \
@@ -224,14 +220,14 @@ bool mjDoc::OnInitODBC()
" Ciao"),"-E-> Fatal situation"); " Ciao"),"-E-> Fatal situation");
return FALSE; return FALSE;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return TRUE; return TRUE;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
bool mjDoc::OnChosenDSN(int Which) bool mjDoc::OnChosenDSN(int Which)
{ {
// wxLogMessage("OnChosenDSN(%d) - Begin",Which); // wxLogMessage("OnChosenDSN(%d) - Begin",Which);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
if (p_DBTree != NULL) if (p_DBTree != NULL)
{ {
p_TabArea->Show(FALSE); // Deactivate the Window p_TabArea->Show(FALSE); // Deactivate the Window
@@ -252,7 +248,7 @@ bool mjDoc::OnChosenDSN(int Which)
p_DBTree->pDoc = this; p_DBTree->pDoc = this;
p_DBTree->OnPopulate(); p_DBTree->OnPopulate();
p_TabArea->SetActiveTab(p_DBTree->i_ViewNr); p_TabArea->SetActiveTab(p_DBTree->i_ViewNr);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// wxLogMessage("OnChosenDSN(%d) - End",Which); // wxLogMessage("OnChosenDSN(%d) - End",Which);
return TRUE; return TRUE;
} }
@@ -309,7 +305,7 @@ bool mjDoc::OnChosenTbl(int Tab,wxString Table)
p_PageArea->SetActiveTab(p_DBGrid->i_ViewNr); p_PageArea->SetActiveTab(p_DBGrid->i_ViewNr);
} }
p_DBGrid->i_TabArt = Tab; p_DBGrid->i_TabArt = Tab;
//---*---------------------- //--------------------------
return TRUE;; return TRUE;;
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
@@ -322,10 +318,9 @@ void mjDoc::OnLeer(wxString Aufrufer)
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow) BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Define a constructor for my p_Splitter 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
{
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,15 +1,15 @@
//--------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
// Name: Doc.h // Name: Doc.h
// Purpose: First attempt to make a MDIProgram with a Tree and ListView // 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
// Created: 19990808 // Created: 19990808
// 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:
@@ -18,32 +18,36 @@ class DSN
wxString Pas; wxString Pas;
wxString Usr; wxString Usr;
}; };
//----------------------------------------------------------------------------------------
// Global structure for holding ODBC connection information // Global structure for holding ODBC connection information
extern struct DbStuff DbConnectInf; extern struct DbStuff 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 mjDoc class mjDoc
{ {
public: public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
mjDoc(); mjDoc();
virtual ~mjDoc(); virtual ~mjDoc();
int Sash; int Sash;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
//-- declare document Vars here --------------------------------------------- //-- declare document Vars here ---------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5; wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
BrowserDB *db_Br; // Pointer to wxDB BrowserDB *db_Br; // Pointer to wxDB
DSN *p_DSN; DSN *p_DSN;
int i_DSN; // Counter int i_DSN; // Counter
//--------------------------------------------------------------------------- wxString s_BColour;
wxFont *ft_Doc;
//---------------------------------------------------------------------------------------
DocSplitterWindow *p_Splitter; DocSplitterWindow *p_Splitter;
wxHtmlHelpController *p_Help;
wxFrame *p_MainFrame; // SDI Version wxFrame *p_MainFrame; // SDI Version
PgmCtrl *p_PgmCtrl; PgmCtrl *p_PgmCtrl;
DBTree *p_DBTree; DBTree *p_DBTree;
@@ -53,17 +57,17 @@ class mjDoc
wxPaggedWindow *p_PageArea; wxPaggedWindow *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
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
//-- declare document Functions here ---------------------------------------- //-- declare document Functions here ----------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
bool OnNewDocument(); bool OnNewDocument();
bool OnInitView(); bool OnInitView();
bool OnInitODBC(); bool OnInitODBC();
bool OnChosenDSN(int Which); bool OnChosenDSN(int Which);
bool OnChosenTbl(int Tab,wxString Table); bool OnChosenTbl(int Tab,wxString Table);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
void OnLeer(wxString Aufrufer); // Dummy Funktion void OnLeer(wxString Aufrufer); // Dummy Funktion
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
}; };
class DocSplitterWindow: public wxSplitterWindow class DocSplitterWindow: public wxSplitterWindow
{ {
@@ -79,4 +83,4 @@ class DocSplitterWindow: public wxSplitterWindow
} }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: pgmctrl.h // Name: pgmctrl.h
// Purpose: Programm Control with a Tree // Purpose: Programm Control with a Tree
// Author: Mark Johnson // Author: Mark Johnson
@@ -7,25 +7,25 @@
// 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
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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/d_closed.xpm" #include "bitmaps/d_closed.xpm"
#include "bitmaps/d_open.xpm" #include "bitmaps/d_open.xpm"
@@ -35,42 +35,38 @@
#include "bitmaps/dsnclose.xpm" #include "bitmaps/dsnclose.xpm"
#include "bitmaps/dsnopen.xpm" #include "bitmaps/dsnopen.xpm"
#endif #endif
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
//-- 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 --------------------------------------------------------------------
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
static inline const char *bool2String(bool b) 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)
EVT_LEFT_DCLICK(PgmCtrl::OnSelChanged) EVT_LEFT_DCLICK(PgmCtrl::OnSelChanged)
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)
{ {
//wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
wxFont* ft_Temp = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
SetFont(* ft_Temp);
// 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__) && defined(__WIN16__) #if defined(__WXMSW__) && defined(__WIN16__)
// This is required in 16-bit Windows mode only because we can't load a specific (16x16) // This is required in 16-bit Windows mode only because we can't load a specific (16x16)
@@ -78,7 +74,7 @@ PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const
p_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE)); p_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
p_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE)); p_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
#else #else
p_imageListNormal->Add(wxICON(Logo)); p_imageListNormal->Add(wxICON(aLogo));
p_imageListNormal->Add(wxICON(DsnClosed)); p_imageListNormal->Add(wxICON(DsnClosed));
p_imageListNormal->Add(wxICON(DsnOpen)); p_imageListNormal->Add(wxICON(DsnOpen));
p_imageListNormal->Add(wxICON(DocClosed)); p_imageListNormal->Add(wxICON(DocClosed));
@@ -86,59 +82,53 @@ PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const
p_imageListNormal->Add(wxICON(FolderClosed)); p_imageListNormal->Add(wxICON(FolderClosed));
p_imageListNormal->Add(wxICON(FolderOpen)); p_imageListNormal->Add(wxICON(FolderOpen));
#endif #endif
SetImageList(p_imageListNormal); SetImageList(p_imageListNormal);
// Add some items to the tree
// AddTestItemsToTree(3, 2);
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
PgmCtrl::~PgmCtrl() PgmCtrl::~PgmCtrl()
{ {
// wxMessageBox("PgmCtrl::~PgmCtrl() - vor DeleteAllItems");
// DeleteAllItems();
// wxMessageBox("nach DeleteAllItems");
delete p_imageListNormal; delete p_imageListNormal;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
#undef TREE_EVENT_HANDLER #undef TREE_EVENT_HANDLER
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
int PgmCtrl::OnPopulate() int PgmCtrl::OnPopulate()
{ {
SetFont(* pDoc->ft_Doc);
wxTreeItemId Root, Folder, Docu; wxTreeItemId Root, Folder, Docu;
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
int i; int i;
double dTmp = 1234567.89; double dTmp = 1234567.89;
Temp0.Printf(_("%s Functions"),p_ProgramCfg->GetAppName().c_str()); Temp0.Printf(_("%s Functions"),p_ProgramCfg->GetAppName().c_str());
Root = AddRoot(Temp0,TreeIc_Logo,TreeIc_Logo, new TreeData("Root")); Root = AddRoot(Temp0,TreeIc_Logo,TreeIc_Logo, new TreeData("Root"));
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Folder = AppendItem(Root, _("Program settings") ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("Settings")); Folder = AppendItem(Root, _("Program settings") ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("Settings"));
p_ProgramCfg->Read("/Local/langid",&Temp0); p_ProgramCfg->Read("/Local/language",&Temp2); p_ProgramCfg->Read("/Local/langid",&Temp0); p_ProgramCfg->Read("/Local/language",&Temp2);
Temp1.Printf(_("locale (%s) ; Language (%s) ; Number(%2.2f)"),Temp0.c_str(), Temp2.c_str(), dTmp); Temp0.Empty(); Temp2.Empty(); Temp1.Printf(_("locale (%s) ; Language (%s) ; Number(%2.2f)"),Temp0.c_str(), Temp2.c_str(), dTmp); Temp0.Empty(); Temp2.Empty();
Docu = AppendItem(Folder, Temp1 ,TreeIc_DocClosed, TreeIc_DocOpen, new TreeData("Setting Language")); Docu = AppendItem(Folder, Temp1,TreeIc_DocClosed,TreeIc_DocOpen,new TreeData("Setting Language"));
p_ProgramCfg->Read("/Paths/Work",&Temp0); Temp1.Printf(_("Work Path : %s"),Temp0.c_str()); Temp0.Empty(); p_ProgramCfg->Read("/Paths/Work",&Temp0); Temp1.Printf(_("Work Path : %s"),Temp0.c_str()); Temp0.Empty();
Docu = AppendItem(Folder, Temp1 ,TreeIc_DocClosed, TreeIc_DocOpen, new TreeData("Path Work")); Docu = AppendItem(Folder,Temp1,TreeIc_DocClosed,TreeIc_DocOpen,new TreeData("Path Work"));
Docu = AppendItem(Folder, _("Change the language to English") ,TreeIc_DocClosed, TreeIc_DocOpen, new TreeData("Language English")); Docu = AppendItem(Folder, _("Change the language to English") ,TreeIc_DocClosed,TreeIc_DocOpen,new TreeData("Language English"));
Docu = AppendItem(Folder, _("Change the language to German") ,TreeIc_DocClosed, TreeIc_DocOpen, new TreeData("Language German")); Docu = AppendItem(Folder, _("Change the language to German") ,TreeIc_DocClosed,TreeIc_DocOpen,new TreeData("Language German"));
Docu = AppendItem(Folder, _("Delete all wxConfigBase Entry's"),TreeIc_DocClosed, TreeIc_DocOpen, new TreeData("wxConfigBase Delete")); Docu = AppendItem(Folder, _("Delete all wxConfigBase Entry's"),TreeIc_DocClosed,TreeIc_DocOpen,new TreeData("wxConfigBase Delete"));
Folder = AppendItem(Root, "ODBC DSN" ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("ODBC-DSN")); Folder = AppendItem(Root, "ODBC DSN",TreeIc_FolderClosed,TreeIc_FolderOpen,new TreeData("ODBC-DSN"));
for (i=0;i<pDoc->i_DSN;i++) for (i=0;i<pDoc->i_DSN;i++)
{ {
Temp0.Printf("ODBC-%s",(pDoc->p_DSN+i)->Dsn.c_str()); Temp0.Printf("ODBC-%s",(pDoc->p_DSN+i)->Dsn.c_str());
Docu = AppendItem(Folder,(pDoc->p_DSN+i)->Dsn ,TreeIc_DsnClosed,TreeIc_DsnOpen, new TreeData(Temp0)); Docu = AppendItem(Folder,(pDoc->p_DSN+i)->Dsn ,TreeIc_DsnClosed,TreeIc_DsnOpen, new TreeData(Temp0));
} }
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
popupMenu1 = NULL; popupMenu1 = NULL;
popupMenu1 = new wxMenu(""); popupMenu1 = new wxMenu("");
popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password")); popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password"));
// popupMenu1->AppendSeparator(); // popupMenu1->AppendSeparator();
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
Expand(Root); Expand(Root);
Expand(Folder); Expand(Folder);
//---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
return 0; return 0;
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event)) void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
{ {
int i; int i;
@@ -147,11 +137,11 @@ void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
// Get the Information that we need // Get the Information that we need
wxTreeItemId itemId = GetSelection(); wxTreeItemId itemId = GetSelection();
TreeData *item = (TreeData *)GetItemData(itemId); TreeData *item = (TreeData *)GetItemData(itemId);
if ( item != NULL ) if (item != NULL )
{ {
int Treffer = 0; int Treffer = 0;
Temp1.Printf("%s",item->m_desc.c_str()); Temp1.Printf("%s",item->m_desc.c_str());
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Temp1 == "Language English") if (Temp1 == "Language English")
{ {
Temp0 = "std"; Temp0 = "std";
@@ -166,7 +156,7 @@ void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
Temp0 = _("-I-> After a programm restart, the language will be changed to German."); Temp0 = _("-I-> After a programm restart, the language will be changed to German.");
wxMessageBox(Temp0); wxMessageBox(Temp0);
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Temp1 == "wxConfigBase Delete") if (Temp1 == "wxConfigBase Delete")
{ {
if (p_ProgramCfg->DeleteAll()) // Default Diretory for wxFileSelector if (p_ProgramCfg->DeleteAll()) // Default Diretory for wxFileSelector
@@ -176,7 +166,7 @@ void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
wxBell(); // Ding_a_Ling wxBell(); // Ding_a_Ling
Treffer++; Treffer++;
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Temp1.Contains("ODBC-")) if (Temp1.Contains("ODBC-"))
{ {
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
@@ -189,10 +179,10 @@ void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
} }
Treffer++; Treffer++;
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Treffer == 0) if (Treffer == 0)
{ {
//--------------------------------------------------- //-------------------------------------------------------------------------------------
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
"%u children (%u immediately under this item)."), "%u children (%u immediately under this item)."),
item->m_desc.c_str(), item->m_desc.c_str(),
@@ -203,11 +193,11 @@ void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
GetChildrenCount(itemId)); GetChildrenCount(itemId));
LogBuf.Printf("-I-> PgmCtrl::OnSelChanged - %s",Temp0.c_str()); LogBuf.Printf("-I-> PgmCtrl::OnSelChanged - %s",Temp0.c_str());
wxLogMessage( "%s", LogBuf.c_str() ); wxLogMessage( "%s", LogBuf.c_str() );
//--------------------------------------------------- //-------------------------------------------------------------------------------------
} }
} }
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event)) void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
int i; int i;
@@ -220,7 +210,7 @@ void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
{ {
int Treffer = 0; int Treffer = 0;
Temp1.Printf("%s",item->m_desc.c_str()); Temp1.Printf("%s",item->m_desc.c_str());
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Temp1.Contains("ODBC-")) if (Temp1.Contains("ODBC-"))
{ {
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
@@ -234,10 +224,9 @@ void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
} }
Treffer++; Treffer++;
} }
//----------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (Treffer == 0) if (Treffer == 0)
{ {
//---------------------------------------------------
/* /*
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
"%u children (%u immediately under this item)."), "%u children (%u immediately under this item)."),
@@ -250,16 +239,16 @@ void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
wxLogMessage( "%s", LogBuf.c_str() ); wxLogMessage( "%s", LogBuf.c_str() );
*/ */
//---------------------------------------------------
} }
//--------------------------------------------------------------------------------------
} }
} }
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
void PgmCtrl::OnMouseMove(wxMouseEvent &event) void PgmCtrl::OnMouseMove(wxMouseEvent &event)
{ {
TreePos = event.GetPosition(); TreePos = event.GetPosition();
} }
//------------------------------------------------------------------------------ //----------------------------------------------------------------------------------------
void PgmCtrl::OnUserPassword() void PgmCtrl::OnUserPassword()
{ {
// wxMessageBox(SaveDSN); // wxMessageBox(SaveDSN);
@@ -294,8 +283,7 @@ void PgmCtrl::OnUserPassword()
break; // We have what we want, leave break; // We have what we want, leave
} }
} }
//------------------------------------------- //-------------------------------------------
SaveDSN.Empty(); SaveDSN.Empty();
} }
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Name: pgmctrl.h // Name: pgmctrl.h
// Purpose: Programm Control with a Tree // Purpose: Programm Control with a Tree
// Author: Mark Johnson // Author: Mark Johnson
@@ -7,19 +7,17 @@
// 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 mjDoc; // Declared in doc.h file class mjDoc; // 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:
@@ -34,21 +32,21 @@ 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();
mjDoc *pDoc; mjDoc *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(wxTreeEvent& event); void OnSelChanged(wxTreeEvent& event);
@@ -57,7 +55,7 @@ class PgmCtrl : public wxTreeCtrl
void OnUserPassword(); void OnUserPassword();
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
@@ -65,8 +63,8 @@ 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
#define PGMCTRL_01_END 1010 #define PGMCTRL_01_END 1010
//--------------------------------------------------------------------------- //----------------------------------------------------------------------------------------