re-indent sources
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,19 +12,19 @@
|
||||
//-- all #ifdefs that the whole Project needs. ------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#include <wx/dbtable.h>
|
||||
@@ -38,65 +38,65 @@ extern DbList* WXDLLEXPORT PtrBegDbList; /* from db.cpp, used in getting back
|
||||
//---------------------------------------------------------------------------
|
||||
char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
|
||||
{
|
||||
static wxString msg;
|
||||
wxString tStr;
|
||||
if (ErrFile || ErrLine)
|
||||
{
|
||||
msg += "File: ";
|
||||
msg += ErrFile;
|
||||
msg += " Line: ";
|
||||
tStr.Printf("%d",ErrLine);
|
||||
msg += tStr.GetData();
|
||||
static wxString msg;
|
||||
wxString tStr;
|
||||
if (ErrFile || ErrLine)
|
||||
{
|
||||
msg += "File: ";
|
||||
msg += ErrFile;
|
||||
msg += " Line: ";
|
||||
tStr.Printf("%d",ErrLine);
|
||||
msg += tStr.GetData();
|
||||
// msg += "\n";
|
||||
}
|
||||
msg.Append ("\nODBC errors:\n");
|
||||
// msg += "\n";
|
||||
}
|
||||
msg.Append ("\nODBC errors:\n");
|
||||
// msg += "\n";
|
||||
/* Scan through each database connection displaying
|
||||
* any ODBC errors that have occured. */
|
||||
for (DbList *pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
|
||||
{
|
||||
// Skip over any free connections
|
||||
if (pDbList->Free)
|
||||
continue;
|
||||
// Display errors for this connection
|
||||
for (int i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
||||
{
|
||||
if (pDbList->PtrDb->errorList[i])
|
||||
{
|
||||
msg.Append(pDbList->PtrDb->errorList[i]);
|
||||
if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
|
||||
msg.Append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
msg += "\n";
|
||||
return (char*) (const char*) msg;
|
||||
/* Scan through each database connection displaying
|
||||
* any ODBC errors that have occured. */
|
||||
for (DbList *pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
|
||||
{
|
||||
// Skip over any free connections
|
||||
if (pDbList->Free)
|
||||
continue;
|
||||
// Display errors for this connection
|
||||
for (int i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
||||
{
|
||||
if (pDbList->PtrDb->errorList[i])
|
||||
{
|
||||
msg.Append(pDbList->PtrDb->errorList[i]);
|
||||
if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
|
||||
msg.Append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
msg += "\n";
|
||||
return (char*) (const char*) msg;
|
||||
} // GetExtendedDBErrorMsg
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// BJO 20000115 : New stuff : dialog to ask for username and password
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
class UserDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
public:
|
||||
UserDialog(wxWindow* parent);
|
||||
virtual ~UserDialog();
|
||||
void OnOK(wxCommandEvent& event);
|
||||
wxString s_UserName, s_Password;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
wxButton *m_OK;
|
||||
wxStaticText *m_Label1, *m_Label2;
|
||||
wxTextCtrl *m_UserName, *m_Password;
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
BEGIN_EVENT_TABLE(UserDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_OK, UserDialog::OnOK)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
UserDialog::UserDialog(wxWindow *parent):
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
UserDialog::UserDialog(wxWindow *parent):
|
||||
wxDialog(parent, -1, _("ODBC user"),wxDefaultPosition, wxSize(310, 300),wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE)
|
||||
{
|
||||
wxLayoutConstraints* layout;
|
||||
@@ -109,7 +109,7 @@ UserDialog::UserDialog(wxWindow *parent):
|
||||
layout->height.AsIs();
|
||||
layout->width.Absolute(75);
|
||||
m_OK->SetConstraints(layout);
|
||||
|
||||
|
||||
m_Label1 = new wxStaticText(this, -1, _("User name:"));
|
||||
layout = new wxLayoutConstraints;
|
||||
layout->left.SameAs(m_OK, wxLeft);
|
||||
@@ -117,7 +117,7 @@ UserDialog::UserDialog(wxWindow *parent):
|
||||
layout->height.AsIs();
|
||||
layout->width.AsIs();
|
||||
m_Label1->SetConstraints(layout);
|
||||
|
||||
|
||||
m_UserName = new wxTextCtrl(this, -1, "");
|
||||
layout = new wxLayoutConstraints;
|
||||
layout->left.SameAs(m_OK, wxLeft);
|
||||
@@ -125,7 +125,7 @@ UserDialog::UserDialog(wxWindow *parent):
|
||||
layout->width.AsIs();
|
||||
layout->height.AsIs();
|
||||
m_UserName->SetConstraints(layout);
|
||||
|
||||
|
||||
m_Label2 = new wxStaticText(this, -1, _("Password:"));
|
||||
layout = new wxLayoutConstraints;
|
||||
layout->left.SameAs(m_OK, wxLeft);
|
||||
@@ -133,7 +133,7 @@ UserDialog::UserDialog(wxWindow *parent):
|
||||
layout->height.AsIs();
|
||||
layout->width.AsIs();
|
||||
m_Label2->SetConstraints(layout);
|
||||
|
||||
|
||||
m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
|
||||
layout = new wxLayoutConstraints;
|
||||
layout->left.SameAs(m_OK, wxLeft);
|
||||
@@ -141,10 +141,10 @@ UserDialog::UserDialog(wxWindow *parent):
|
||||
layout->top.SameAs(m_Label2, wxBottom, 3);
|
||||
layout->height.AsIs();
|
||||
m_Password->SetConstraints(layout);
|
||||
|
||||
|
||||
s_UserName = "";
|
||||
s_Password = "";
|
||||
|
||||
|
||||
Layout();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -154,9 +154,9 @@ UserDialog::~UserDialog()
|
||||
//---------------------------------------------------------------------------
|
||||
void UserDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
strcpy(ConnectInf.Uid, m_UserName->GetValue());
|
||||
strcpy(ConnectInf.AuthStr, m_Password->GetValue());
|
||||
EndModal(1);
|
||||
strcpy(ConnectInf.Uid, m_UserName->GetValue());
|
||||
strcpy(ConnectInf.AuthStr, m_Password->GetValue());
|
||||
EndModal(1);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// BJO 20000115 : end of new stuff
|
||||
@@ -164,12 +164,12 @@ void UserDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||
//---------------------------------------------------------------------------
|
||||
BrowserDB::BrowserDB()
|
||||
{
|
||||
Zeiger_auf_NULL(0);
|
||||
ODBCSource = ""; // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
||||
UserName = ""; // database username - must already exist in the data source
|
||||
Password = ""; // password database username
|
||||
OnFillSqlTyp();
|
||||
OnFilldbTyp();
|
||||
Zeiger_auf_NULL(0);
|
||||
ODBCSource = ""; // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
||||
UserName = ""; // database username - must already exist in the data source
|
||||
Password = ""; // password database username
|
||||
OnFillSqlTyp();
|
||||
OnFilldbTyp();
|
||||
} // BrowserDB Constructor
|
||||
//---------------------------------------------------------------------------
|
||||
BrowserDB::~BrowserDB()
|
||||
@@ -179,371 +179,377 @@ BrowserDB::~BrowserDB()
|
||||
//--------------------------------------------------------------------------------------------
|
||||
bool BrowserDB::Initialize(int Quite)
|
||||
{
|
||||
if (!OnStartDB(Quite))
|
||||
{
|
||||
wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if (!OnStartDB(Quite))
|
||||
{
|
||||
wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
} // BrowserDB:Initialize
|
||||
//--------------------------------------------------------------------------------------------
|
||||
bool BrowserDB::OnStartDB(int Quite)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
|
||||
if (db_BrowserDB != NULL)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
|
||||
if (db_BrowserDB != NULL)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
|
||||
return TRUE;
|
||||
}
|
||||
// Initialize the ODBC Environment for Database Operations
|
||||
if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Connect to datasource
|
||||
//---------------------------
|
||||
DlgUser p_Dlg(pDoc->p_MainFrame, "Username and Password", wxPoint(100, 100), wxSize(340, 170));
|
||||
p_Dlg.s_DSN = ODBCSource;
|
||||
p_Dlg.s_User = UserName;
|
||||
p_Dlg.s_Password = Password;
|
||||
p_Dlg.OnInit();
|
||||
if (p_Dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
(pDoc->p_DSN+i_Which)->Usr = p_Dlg.s_User;
|
||||
(pDoc->p_DSN+i_Which)->Pas = p_Dlg.s_Password;
|
||||
UserName = p_Dlg.s_User;
|
||||
Password = p_Dlg.s_Password;
|
||||
}
|
||||
p_Dlg.Destroy();
|
||||
//---------------------------
|
||||
strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
||||
strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
|
||||
strcpy(ConnectInf.AuthStr, Password); // password database username
|
||||
db_BrowserDB = GetDbConnection(&ConnectInf);
|
||||
// wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
|
||||
if (db_BrowserDB == NULL)
|
||||
{
|
||||
strcpy(ConnectInf.Dsn, "");
|
||||
strcpy(ConnectInf.Uid, "");
|
||||
strcpy(ConnectInf.AuthStr, "");
|
||||
if (!Quite)
|
||||
{
|
||||
wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)"));
|
||||
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
if (!Quite)
|
||||
{
|
||||
Temp1 = db_BrowserDB->GetDatabaseName();
|
||||
Temp2 = db_BrowserDB->GetDataSource();
|
||||
wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
|
||||
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
// Initialize the ODBC Environment for Database Operations
|
||||
if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
// Connect to datasource
|
||||
//---------------------------
|
||||
DlgUser p_Dlg(pDoc->p_MainFrame, "Username and Password", wxPoint(100, 100), wxSize(340, 170));
|
||||
p_Dlg.s_DSN = ODBCSource;
|
||||
p_Dlg.s_User = UserName;
|
||||
p_Dlg.s_Password = Password;
|
||||
p_Dlg.OnInit();
|
||||
if (p_Dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
(pDoc->p_DSN+i_Which)->Usr = p_Dlg.s_User;
|
||||
(pDoc->p_DSN+i_Which)->Pas = p_Dlg.s_Password;
|
||||
UserName = p_Dlg.s_User;
|
||||
Password = p_Dlg.s_Password;
|
||||
}
|
||||
p_Dlg.Destroy();
|
||||
//---------------------------
|
||||
strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
|
||||
strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
|
||||
strcpy(ConnectInf.AuthStr, Password); // password database username
|
||||
db_BrowserDB = GetDbConnection(&ConnectInf);
|
||||
// wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
|
||||
if (db_BrowserDB == NULL)
|
||||
{
|
||||
strcpy(ConnectInf.Dsn, "");
|
||||
strcpy(ConnectInf.Uid, "");
|
||||
strcpy(ConnectInf.AuthStr, "");
|
||||
if (!Quite)
|
||||
{
|
||||
wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)"));
|
||||
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
if (!Quite)
|
||||
{
|
||||
Temp1 = db_BrowserDB->GetDatabaseName();
|
||||
Temp2 = db_BrowserDB->GetDataSource();
|
||||
wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
|
||||
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
bool BrowserDB::OnCloseDB(int Quite)
|
||||
{
|
||||
if (!Quite)
|
||||
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
|
||||
if (db_BrowserDB)
|
||||
{
|
||||
db_BrowserDB->Close();
|
||||
FreeDbConnection(db_BrowserDB);
|
||||
|
||||
// Free Environment Handle that ODBC uses
|
||||
if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
// Error freeing environment handle
|
||||
}
|
||||
db_BrowserDB = NULL;
|
||||
}
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
|
||||
return TRUE;
|
||||
if (!Quite)
|
||||
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
|
||||
if (db_BrowserDB)
|
||||
{
|
||||
db_BrowserDB->Close();
|
||||
FreeDbConnection(db_BrowserDB);
|
||||
|
||||
// Free Environment Handle that ODBC uses
|
||||
if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
// Error freeing environment handle
|
||||
}
|
||||
db_BrowserDB = NULL;
|
||||
}
|
||||
if (!Quite)
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool BrowserDB::OnGetNext(int Cols,int Quite)
|
||||
{
|
||||
SDWORD cb;
|
||||
int i_dbDataType;
|
||||
int i=0;
|
||||
char s_temp[1024+1];
|
||||
long l_temp;
|
||||
double f_temp;
|
||||
int AnzError=0;
|
||||
TIMESTAMP_STRUCT t_temp;
|
||||
wxString Temp0;
|
||||
//-----------------------------
|
||||
if (!db_BrowserDB->GetNext())
|
||||
{
|
||||
return FALSE;
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0;i<Cols;i++)
|
||||
{
|
||||
strcpy((cl_BrowserDB+i)->tableName,"-E->");
|
||||
i_dbDataType = (cl_BrowserDB->pColFor+i)->i_dbDataType;
|
||||
if (i_dbDataType == 0) // Filter unsupported dbDataTypes
|
||||
{
|
||||
if (((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_VARCHAR) || ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_LONGVARCHAR))
|
||||
i_dbDataType = DB_DATA_TYPE_VARCHAR;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DATE)
|
||||
i_dbDataType = DB_DATA_TYPE_DATE;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_BIT)
|
||||
i_dbDataType = DB_DATA_TYPE_INTEGER;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_NUMERIC)
|
||||
i_dbDataType = DB_DATA_TYPE_VARCHAR;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_REAL)
|
||||
i_dbDataType = DB_DATA_TYPE_FLOAT;
|
||||
}
|
||||
if ((i_dbDataType == DB_DATA_TYPE_INTEGER) && ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DOUBLE))
|
||||
{ // DBASE Numeric
|
||||
i_dbDataType = DB_DATA_TYPE_FLOAT;
|
||||
}
|
||||
switch(i_dbDataType)
|
||||
{
|
||||
case DB_DATA_TYPE_VARCHAR:
|
||||
strcpy(s_temp,"");
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
}
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
break;
|
||||
case DB_DATA_TYPE_INTEGER:
|
||||
l_temp = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
break;
|
||||
case DB_DATA_TYPE_FLOAT:
|
||||
f_temp = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
break;
|
||||
case DB_DATA_TYPE_DATE:
|
||||
t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
// i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
|
||||
if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
|
||||
((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
|
||||
SDWORD cb;
|
||||
int i_dbDataType;
|
||||
int i=0;
|
||||
char s_temp[1024+1];
|
||||
long l_temp;
|
||||
double f_temp;
|
||||
int AnzError=0;
|
||||
TIMESTAMP_STRUCT t_temp;
|
||||
wxString Temp0;
|
||||
//-----------------------------
|
||||
if (!db_BrowserDB->GetNext())
|
||||
{
|
||||
return FALSE;
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0;i<Cols;i++)
|
||||
{
|
||||
strcpy((cl_BrowserDB+i)->tableName,"-E->");
|
||||
i_dbDataType = (cl_BrowserDB->pColFor+i)->i_dbDataType;
|
||||
if (i_dbDataType == 0) // Filter unsupported dbDataTypes
|
||||
{
|
||||
if (((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_VARCHAR) || ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_LONGVARCHAR))
|
||||
i_dbDataType = DB_DATA_TYPE_VARCHAR;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DATE)
|
||||
i_dbDataType = DB_DATA_TYPE_DATE;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_BIT)
|
||||
i_dbDataType = DB_DATA_TYPE_INTEGER;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_NUMERIC)
|
||||
i_dbDataType = DB_DATA_TYPE_VARCHAR;
|
||||
if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_REAL)
|
||||
i_dbDataType = DB_DATA_TYPE_FLOAT;
|
||||
}
|
||||
if ((i_dbDataType == DB_DATA_TYPE_INTEGER) && ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DOUBLE))
|
||||
{ // DBASE Numeric
|
||||
i_dbDataType = DB_DATA_TYPE_FLOAT;
|
||||
}
|
||||
switch(i_dbDataType)
|
||||
{
|
||||
case DB_DATA_TYPE_VARCHAR:
|
||||
strcpy(s_temp,"");
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
}
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
break;
|
||||
case DB_DATA_TYPE_INTEGER:
|
||||
l_temp = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
break;
|
||||
case DB_DATA_TYPE_FLOAT:
|
||||
f_temp = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
break;
|
||||
case DB_DATA_TYPE_DATE:
|
||||
t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
|
||||
if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
|
||||
{
|
||||
Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
|
||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
// i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
|
||||
if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
|
||||
((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
|
||||
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU 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,
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU 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,
|
||||
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
|
||||
{
|
||||
Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
|
||||
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AnzError++;
|
||||
if (AnzError <= 100)
|
||||
{
|
||||
Temp0 = (cl_BrowserDB+i)->colName;
|
||||
wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
// wxLogMessage("-E-> BrowserDB::OnGetNext - End");
|
||||
return TRUE;
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AnzError++;
|
||||
if (AnzError <= 100)
|
||||
{
|
||||
Temp0 = (cl_BrowserDB+i)->colName;
|
||||
wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
|
||||
strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
// wxLogMessage("-E-> BrowserDB::OnGetNext - End");
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
|
||||
{
|
||||
wxString SQLStmt;
|
||||
i_Records = 0;
|
||||
//--------------------------------------------------------------------------
|
||||
SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
while (db_BrowserDB->GetNext())
|
||||
{
|
||||
i_Records++;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
|
||||
//--------------------------------------------------------------------------
|
||||
if (!Quite)
|
||||
{
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
|
||||
}
|
||||
return TRUE;
|
||||
wxString SQLStmt;
|
||||
i_Records = 0;
|
||||
//--------------------------------------------------------------------------
|
||||
SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
while (db_BrowserDB->GetNext())
|
||||
{
|
||||
i_Records++;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
wxLogMessage(Temp0);
|
||||
return FALSE;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
|
||||
//--------------------------------------------------------------------------
|
||||
if (!Quite)
|
||||
{
|
||||
wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
//--------------------------------------------------------------------------
|
||||
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 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||
if (!Quite)
|
||||
wxLogMessage(Temp0);
|
||||
else
|
||||
wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
|
||||
return FALSE;
|
||||
}
|
||||
if (!Quite)
|
||||
wxLogMessage(Temp0);
|
||||
else
|
||||
wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
|
||||
return FALSE;
|
||||
}
|
||||
if (!Quite)
|
||||
{
|
||||
// wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End "),SQLStmt.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
{
|
||||
// wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End "),SQLStmt.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
wxDbInf* BrowserDB::OnGetCatalog(int Quite)
|
||||
{
|
||||
char UName[255];
|
||||
strcpy(UName,UserName);
|
||||
ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
|
||||
return ct_BrowserDB;
|
||||
char UName[255];
|
||||
strcpy(UName,UserName);
|
||||
ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
|
||||
return ct_BrowserDB;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite)
|
||||
{
|
||||
char UName[255];
|
||||
int i;
|
||||
strcpy(UName,UserName);
|
||||
cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
|
||||
cl_BrowserDB->pColFor = new wxColFor[numCols];
|
||||
for (i=0;i<numCols;i++)
|
||||
{
|
||||
(cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
|
||||
(cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
|
||||
}
|
||||
return cl_BrowserDB;
|
||||
char UName[255];
|
||||
int i;
|
||||
strcpy(UName,UserName);
|
||||
cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
|
||||
cl_BrowserDB->pColFor = new wxColFor[numCols];
|
||||
for (i=0;i<numCols;i++)
|
||||
{
|
||||
(cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
|
||||
(cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
|
||||
}
|
||||
return cl_BrowserDB;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void BrowserDB::Zeiger_auf_NULL(int Art)
|
||||
{
|
||||
if (Art == 1) // L<>schen
|
||||
{
|
||||
if (cl_BrowserDB != NULL)
|
||||
{ // Destroy the memory
|
||||
delete [] cl_BrowserDB;
|
||||
}
|
||||
if (ct_BrowserDB != NULL)
|
||||
{ // Destroy the memory
|
||||
delete [] ct_BrowserDB;
|
||||
}
|
||||
if (db_BrowserDB != NULL)
|
||||
{
|
||||
db_BrowserDB->CommitTrans();
|
||||
db_BrowserDB->Close();
|
||||
CloseDbConnections();
|
||||
delete db_BrowserDB;
|
||||
}
|
||||
}
|
||||
cl_BrowserDB = NULL;
|
||||
ct_BrowserDB = NULL;
|
||||
db_BrowserDB = NULL;
|
||||
p_LogWindow = NULL;
|
||||
if (Art == 1) // L<>schen
|
||||
{
|
||||
if (cl_BrowserDB != NULL)
|
||||
{ // Destroy the memory
|
||||
delete [] cl_BrowserDB;
|
||||
}
|
||||
if (ct_BrowserDB != NULL)
|
||||
{ // Destroy the memory
|
||||
delete [] ct_BrowserDB;
|
||||
}
|
||||
if (db_BrowserDB != NULL)
|
||||
{
|
||||
db_BrowserDB->CommitTrans();
|
||||
db_BrowserDB->Close();
|
||||
CloseDbConnections();
|
||||
delete db_BrowserDB;
|
||||
}
|
||||
}
|
||||
cl_BrowserDB = NULL;
|
||||
ct_BrowserDB = NULL;
|
||||
db_BrowserDB = NULL;
|
||||
p_LogWindow = NULL;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void BrowserDB::OnFillSqlTyp()
|
||||
{
|
||||
i_SqlTyp[1] = SQL_C_BINARY; s_SqlTyp[1] = "SQL_C_BINARY";
|
||||
i_SqlTyp[2] = SQL_C_BIT; s_SqlTyp[2] = "SQL_C_BIT";
|
||||
i_SqlTyp[3] = SQL_C_BOOKMARK; s_SqlTyp[3] = "SQL_C_BOOKMARK";
|
||||
i_SqlTyp[4] = SQL_C_CHAR; s_SqlTyp[4] = "SQL_C_CHAR";
|
||||
i_SqlTyp[5] = SQL_C_DATE; s_SqlTyp[5] = "SQL_C_DATE";
|
||||
i_SqlTyp[6] = SQL_C_DEFAULT; s_SqlTyp[6] = "SQL_C_DEFAULT";
|
||||
i_SqlTyp[7] = SQL_C_DOUBLE; s_SqlTyp[7] = "SQL_C_DOUBLE";
|
||||
i_SqlTyp[8] = SQL_C_FLOAT; s_SqlTyp[8] = "SQL_C_FLOAT";
|
||||
i_SqlTyp[9] = SQL_C_LONG; s_SqlTyp[9] = "SQL_C_LONG";
|
||||
i_SqlTyp[10] = SQL_C_SHORT; s_SqlTyp[10] = "SQL_C_SHORT";
|
||||
i_SqlTyp[11] = SQL_C_SLONG; s_SqlTyp[11] = "SQL_C_SLONG";
|
||||
i_SqlTyp[12] = SQL_C_SSHORT; s_SqlTyp[12] = "SQL_C_SSHORT";
|
||||
i_SqlTyp[13] = SQL_C_STINYINT; s_SqlTyp[13] = "SQL_C_STINYINT";
|
||||
i_SqlTyp[14] = SQL_C_TIME; s_SqlTyp[14] = "SQL_C_TIME";
|
||||
i_SqlTyp[15] = SQL_C_TIMESTAMP; s_SqlTyp[15] = "SQL_C_TIMESTAMP";
|
||||
i_SqlTyp[16] = SQL_C_TINYINT; s_SqlTyp[16] = "SQL_C_TINYINT";
|
||||
i_SqlTyp[17] = SQL_C_ULONG; s_SqlTyp[17] = "SQL_C_ULONG";
|
||||
i_SqlTyp[18] = SQL_C_USHORT; s_SqlTyp[18] = "SQL_C_USHORT";
|
||||
i_SqlTyp[19] = SQL_C_UTINYINT; s_SqlTyp[19] = "SQL_C_UTINYINT";
|
||||
i_SqlTyp[20] = SQL_VARCHAR; s_SqlTyp[20] = "SQL_VARCHAR";
|
||||
i_SqlTyp[21] = SQL_NUMERIC; s_SqlTyp[21] = "SQL_NUMERIC";
|
||||
i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = "SQL_LONGVARCHAR";
|
||||
i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL";
|
||||
i_SqlTyp[0] = 23; s_SqlTyp[0] = "";
|
||||
i_SqlTyp[1] = SQL_C_BINARY; s_SqlTyp[1] = "SQL_C_BINARY";
|
||||
i_SqlTyp[2] = SQL_C_BIT; s_SqlTyp[2] = "SQL_C_BIT";
|
||||
i_SqlTyp[3] = SQL_C_BOOKMARK; s_SqlTyp[3] = "SQL_C_BOOKMARK";
|
||||
i_SqlTyp[4] = SQL_C_CHAR; s_SqlTyp[4] = "SQL_C_CHAR";
|
||||
i_SqlTyp[5] = SQL_C_DATE; s_SqlTyp[5] = "SQL_C_DATE";
|
||||
i_SqlTyp[6] = SQL_C_DEFAULT; s_SqlTyp[6] = "SQL_C_DEFAULT";
|
||||
i_SqlTyp[7] = SQL_C_DOUBLE; s_SqlTyp[7] = "SQL_C_DOUBLE";
|
||||
i_SqlTyp[8] = SQL_C_FLOAT; s_SqlTyp[8] = "SQL_C_FLOAT";
|
||||
i_SqlTyp[9] = SQL_C_LONG; s_SqlTyp[9] = "SQL_C_LONG";
|
||||
i_SqlTyp[10] = SQL_C_SHORT; s_SqlTyp[10] = "SQL_C_SHORT";
|
||||
i_SqlTyp[11] = SQL_C_SLONG; s_SqlTyp[11] = "SQL_C_SLONG";
|
||||
i_SqlTyp[12] = SQL_C_SSHORT; s_SqlTyp[12] = "SQL_C_SSHORT";
|
||||
i_SqlTyp[13] = SQL_C_STINYINT; s_SqlTyp[13] = "SQL_C_STINYINT";
|
||||
i_SqlTyp[14] = SQL_C_TIME; s_SqlTyp[14] = "SQL_C_TIME";
|
||||
i_SqlTyp[15] = SQL_C_TIMESTAMP; s_SqlTyp[15] = "SQL_C_TIMESTAMP";
|
||||
i_SqlTyp[16] = SQL_C_TINYINT; s_SqlTyp[16] = "SQL_C_TINYINT";
|
||||
i_SqlTyp[17] = SQL_C_ULONG; s_SqlTyp[17] = "SQL_C_ULONG";
|
||||
i_SqlTyp[18] = SQL_C_USHORT; s_SqlTyp[18] = "SQL_C_USHORT";
|
||||
i_SqlTyp[19] = SQL_C_UTINYINT; s_SqlTyp[19] = "SQL_C_UTINYINT";
|
||||
i_SqlTyp[20] = SQL_VARCHAR; s_SqlTyp[20] = "SQL_VARCHAR";
|
||||
i_SqlTyp[21] = SQL_NUMERIC; s_SqlTyp[21] = "SQL_NUMERIC";
|
||||
i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = "SQL_LONGVARCHAR";
|
||||
i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL";
|
||||
i_SqlTyp[0] = 23; s_SqlTyp[0] = "";
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void BrowserDB::OnFilldbTyp()
|
||||
{
|
||||
i_dbTyp[1] = DB_DATA_TYPE_VARCHAR; s_dbTyp[1] = "DB_DATA_TYPE_VARCHAR";
|
||||
i_dbTyp[2] = DB_DATA_TYPE_INTEGER; s_dbTyp[2] = "DB_DATA_TYPE_INTEGER";
|
||||
i_dbTyp[3] = DB_DATA_TYPE_FLOAT; s_dbTyp[3] = "DB_DATA_TYPE_FLOAT";
|
||||
i_dbTyp[4] = DB_DATA_TYPE_DATE; s_dbTyp[4] = "DB_DATA_TYPE_DATE";
|
||||
i_dbTyp[0] = 4; s_dbTyp[0] = "";
|
||||
i_dbTyp[1] = DB_DATA_TYPE_VARCHAR; s_dbTyp[1] = "DB_DATA_TYPE_VARCHAR";
|
||||
i_dbTyp[2] = DB_DATA_TYPE_INTEGER; s_dbTyp[2] = "DB_DATA_TYPE_INTEGER";
|
||||
i_dbTyp[3] = DB_DATA_TYPE_FLOAT; s_dbTyp[3] = "DB_DATA_TYPE_FLOAT";
|
||||
i_dbTyp[4] = DB_DATA_TYPE_DATE; s_dbTyp[4] = "DB_DATA_TYPE_DATE";
|
||||
i_dbTyp[0] = 4; s_dbTyp[0] = "";
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -31,42 +31,42 @@
|
||||
#include "std.h" // sorgsam Pflegen !
|
||||
//---------------------------------------------------------------------------
|
||||
BEGIN_EVENT_TABLE(DBGrid, wxGrid)
|
||||
EVT_MOTION (DBGrid::OnMouseMove)
|
||||
// DBGrid
|
||||
EVT_GRID_LABEL_LEFT_CLICK( DBGrid::OnLabelLeftClick )
|
||||
EVT_GRID_LABEL_RIGHT_CLICK( DBGrid::OnLabelRightClick )
|
||||
EVT_GRID_LABEL_LEFT_DCLICK( DBGrid::OnLabelLeftDClick )
|
||||
EVT_GRID_LABEL_RIGHT_DCLICK( DBGrid::OnLabelRightDClick )
|
||||
EVT_GRID_CELL_LEFT_CLICK( DBGrid::OnCellLeftClick )
|
||||
EVT_GRID_CELL_RIGHT_CLICK( DBGrid::OnCellRightClick )
|
||||
EVT_GRID_CELL_LEFT_DCLICK( DBGrid::OnCellLeftDClick )
|
||||
EVT_GRID_CELL_RIGHT_DCLICK( DBGrid::OnCellRightDClick )
|
||||
EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
|
||||
// EVT_GRID_COL_SIZE( DBGrid::OnColSize )
|
||||
EVT_GRID_RANGE_SELECT( DBGrid::OnRangeSelected )
|
||||
EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
|
||||
EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
|
||||
EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// wxListCtrl(parent, id, pos, size, style)
|
||||
// wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
|
||||
//---------------------------------------------------------------------------
|
||||
// DBGrid
|
||||
//---------------------------------------------------------------------------
|
||||
// DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size):
|
||||
// wxGrid(parent, id, pos, size)
|
||||
DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
|
||||
wxGrid(parent, id, pos, size, style)
|
||||
EVT_MOTION (DBGrid::OnMouseMove)
|
||||
// DBGrid
|
||||
EVT_GRID_LABEL_LEFT_CLICK( DBGrid::OnLabelLeftClick )
|
||||
EVT_GRID_LABEL_RIGHT_CLICK( DBGrid::OnLabelRightClick )
|
||||
EVT_GRID_LABEL_LEFT_DCLICK( DBGrid::OnLabelLeftDClick )
|
||||
EVT_GRID_LABEL_RIGHT_DCLICK( DBGrid::OnLabelRightDClick )
|
||||
EVT_GRID_CELL_LEFT_CLICK( DBGrid::OnCellLeftClick )
|
||||
EVT_GRID_CELL_RIGHT_CLICK( DBGrid::OnCellRightClick )
|
||||
EVT_GRID_CELL_LEFT_DCLICK( DBGrid::OnCellLeftDClick )
|
||||
EVT_GRID_CELL_RIGHT_DCLICK( DBGrid::OnCellRightDClick )
|
||||
EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
|
||||
// EVT_GRID_COL_SIZE( DBGrid::OnColSize )
|
||||
EVT_GRID_RANGE_SELECT( DBGrid::OnRangeSelected )
|
||||
EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
|
||||
EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
|
||||
EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// wxListCtrl(parent, id, pos, size, style)
|
||||
// wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
|
||||
//---------------------------------------------------------------------------
|
||||
// DBGrid
|
||||
//---------------------------------------------------------------------------
|
||||
// DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size):
|
||||
// wxGrid(parent, id, pos, size)
|
||||
DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
|
||||
wxGrid(parent, id, pos, size, style)
|
||||
{
|
||||
f_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
wxPanel::SetFont(* f_Temp);
|
||||
b_EditModus = TRUE;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
|
||||
popupMenu2 = new wxMenu("");
|
||||
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
|
||||
f_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
wxPanel::SetFont(* f_Temp);
|
||||
b_EditModus = TRUE;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
|
||||
popupMenu2 = new wxMenu("");
|
||||
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
DBGrid::~DBGrid()
|
||||
@@ -75,297 +75,298 @@ DBGrid::~DBGrid()
|
||||
//---------------------------------------------------------------------------
|
||||
int DBGrid::OnTableView(wxString Table)
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
int i=0,x,y,z, ValidTable=0;
|
||||
wxString Temp0;
|
||||
SetLabelFont(* f_Temp);
|
||||
//---------------------------------------------------------------------------
|
||||
ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer
|
||||
//----------------------------------------------------------------------------
|
||||
if (ct_BrowserDB) // Valid pointer (!= NULL) ?
|
||||
{ // Pointer is Valid, use the wxDatabase Information
|
||||
for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables
|
||||
{
|
||||
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table)) // is this our Table ?
|
||||
{ // Yes, the Data of this Table shall be put into the Grid
|
||||
ValidTable = x; // Save the Tablenumber
|
||||
(db_Br+i_Which)->OnSelect(Table,FALSE); // Select * from "table"
|
||||
// Set the local Pointer to the Column Information we are going to use
|
||||
(db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
|
||||
if ((ct_BrowserDB->pTableInf+x)->pColInf) // Valid pointer (!= NULL) ?
|
||||
{ // Pointer is Valid, Column Informationen sind Vorhanden
|
||||
i = (db_Br+i_Which)->i_Records; // How many Records are there
|
||||
(db_Br+i_Which)->i_Which = ValidTable; // Still used ???? mj10777
|
||||
if (i == 0) // If the Table is empty, then show one empty row
|
||||
i++;
|
||||
CreateGrid(i,(ct_BrowserDB->pTableInf+x)->numCols); // Records , Columns
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) // Loop through the Fields
|
||||
{ // The Field / Column name is used here as Row Titel
|
||||
SetColLabelValue(y,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
|
||||
SetColSize(y,95);
|
||||
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
SetColSize(((ct_BrowserDB->pTableInf+x)->numCols-1),120); // Make the last Column Wider
|
||||
// The Grid has been created, now fill it
|
||||
for (z=0;z<(db_Br+i_Which)->i_Records;z++) // Loop through the Records
|
||||
{
|
||||
Temp0.Printf("%06d",z+1); SetRowLabelValue(z,Temp0); // Set Row Lable Value
|
||||
(db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,FALSE);
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
|
||||
{ // BrowserDB::OnGetNext Formats the field Value into tablename
|
||||
SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
|
||||
}
|
||||
if (z % 50 == 0)
|
||||
{
|
||||
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d has been read."),Table.c_str(),z);
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
||||
}
|
||||
} // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
|
||||
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read."),Table.c_str(),z);
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
||||
// The Grid has been filled, now leave
|
||||
goto Weiter;
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid Column Pointer : Failed"));
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
|
||||
} // for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
} // if (ct_BrowserDB)
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid DSN Pointer : Failed"));
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
int i=0,x,y,z, ValidTable=0;
|
||||
wxString Temp0;
|
||||
SetLabelFont(* f_Temp);
|
||||
//---------------------------------------------------------------------------
|
||||
ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer
|
||||
//----------------------------------------------------------------------------
|
||||
if (ct_BrowserDB) // Valid pointer (!= NULL) ?
|
||||
{ // Pointer is Valid, use the wxDatabase Information
|
||||
for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables
|
||||
{
|
||||
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table)) // is this our Table ?
|
||||
{ // Yes, the Data of this Table shall be put into the Grid
|
||||
ValidTable = x; // Save the Tablenumber
|
||||
(db_Br+i_Which)->OnSelect(Table,FALSE); // Select * from "table"
|
||||
// Set the local Pointer to the Column Information we are going to use
|
||||
(db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
|
||||
if ((ct_BrowserDB->pTableInf+x)->pColInf) // Valid pointer (!= NULL) ?
|
||||
{ // Pointer is Valid, Column Informationen sind Vorhanden
|
||||
i = (db_Br+i_Which)->i_Records; // How many Records are there
|
||||
(db_Br+i_Which)->i_Which = ValidTable; // Still used ???? mj10777
|
||||
if (i == 0) // If the Table is empty, then show one empty row
|
||||
i++;
|
||||
CreateGrid(i,(ct_BrowserDB->pTableInf+x)->numCols); // Records , Columns
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) // Loop through the Fields
|
||||
{ // The Field / Column name is used here as Row Titel
|
||||
SetColLabelValue(y,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
|
||||
SetColSize(y,95);
|
||||
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
SetColSize(((ct_BrowserDB->pTableInf+x)->numCols-1),120); // Make the last Column Wider
|
||||
// The Grid has been created, now fill it
|
||||
for (z=0;z<(db_Br+i_Which)->i_Records;z++) // Loop through the Records
|
||||
{
|
||||
Temp0.Printf("%06d",z+1); SetRowLabelValue(z,Temp0); // Set Row Lable Value
|
||||
(db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,FALSE);
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
|
||||
{ // BrowserDB::OnGetNext Formats the field Value into tablename
|
||||
SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
|
||||
}
|
||||
if (z % 50 == 0)
|
||||
{
|
||||
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d has been read."),Table.c_str(),z);
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
||||
}
|
||||
} // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
|
||||
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read."),Table.c_str(),z);
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
||||
// The Grid has been filled, now leave
|
||||
goto Weiter;
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid Column Pointer : Failed"));
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
|
||||
} // for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
} // if (ct_BrowserDB)
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBGrid::OnTableView():: Invalid DSN Pointer : Failed"));
|
||||
//---------------------------------------------------------------------------
|
||||
Weiter:
|
||||
SetEditInPlace(b_EditModus); // Activate in-place Editing (FALSE)
|
||||
//---------------------------------------------------------------------------
|
||||
wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
|
||||
return 0;
|
||||
SetEditInPlace(b_EditModus); // Activate in-place Editing (FALSE)
|
||||
//---------------------------------------------------------------------------
|
||||
wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event)
|
||||
{
|
||||
b_EditModus = TRUE; // Needed by PopupMenu
|
||||
SetEditable(FALSE); // Do not Edit with Text Edit Control
|
||||
SetEditInPlace(b_EditModus); // Deactivate in-place Editing
|
||||
UpdateDimensions(); // Redraw the Grid
|
||||
b_EditModus = TRUE; // Needed by PopupMenu
|
||||
SetEditable(FALSE); // Do not Edit with Text Edit Control
|
||||
SetEditInPlace(b_EditModus); // Deactivate in-place Editing
|
||||
UpdateDimensions(); // Redraw the Grid
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnModusBrowse(wxMenu& menu, wxCommandEvent& event)
|
||||
{
|
||||
b_EditModus = FALSE; // Needed by PopupMenu
|
||||
SetEditInPlace(b_EditModus); // Deactivate in-place Editing
|
||||
UpdateDimensions(); // Redraw the Grid
|
||||
b_EditModus = FALSE; // Needed by PopupMenu
|
||||
SetEditInPlace(b_EditModus); // Deactivate in-place Editing
|
||||
UpdateDimensions(); // Redraw the Grid
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void DBGrid::OnMouseMove(wxMouseEvent &event)
|
||||
{
|
||||
MousePos = event.GetPosition();
|
||||
MousePos = event.GetPosition();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnLabelLeftClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnLabelLeftClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnLabelRightClick( wxGridEvent& ev )
|
||||
{
|
||||
//-------------------
|
||||
if (b_EditModus)
|
||||
PopupMenu(popupMenu2,MousePos.x,MousePos.y);
|
||||
else
|
||||
PopupMenu(popupMenu1,MousePos.x,MousePos.y);
|
||||
//-------------------
|
||||
logBuf = "DBGrid::OnLabelRightClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
if (b_EditModus)
|
||||
PopupMenu(popupMenu2,MousePos.x,MousePos.y);
|
||||
else
|
||||
PopupMenu(popupMenu1,MousePos.x,MousePos.y);
|
||||
//-------------------
|
||||
logBuf = "DBGrid::OnLabelRightClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnLabelLeftDClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnLabelLeftDClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnLabelRightDClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnLabelRightDClick : ";
|
||||
if ( ev.GetRow() != -1 )
|
||||
{
|
||||
logBuf << "row label " << ev.GetRow();
|
||||
}
|
||||
else if ( ev.GetCol() != -1 )
|
||||
{
|
||||
logBuf << "col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << "corner label";
|
||||
}
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << " (shift down)";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnCellLeftClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnCellLeftClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnCellLeftClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnCellRightClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnCellRightClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnCellRightClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnCellLeftDClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnCellLeftDClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnCellRightDClick( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnCellRightDClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnCellRightDClick : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnCellChange( wxGridEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnCellChange : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnCellChange : ";
|
||||
logBuf << "Cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
// wxMessageBox(logBuf);
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
// you must call event skip if you want default grid processing
|
||||
// (cell highlighting etc.)
|
||||
//
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnRowSize( wxGridSizeEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnRowSize : ";
|
||||
logBuf << "Resized row " << ev.GetRowOrCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnRowSize : ";
|
||||
logBuf << "Resized row " << ev.GetRowOrCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnColSize( wxGridSizeEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnColSize : ";
|
||||
logBuf << "Resized col " << ev.GetRowOrCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnColSize : ";
|
||||
logBuf << "Resized col " << ev.GetRowOrCol();
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
logBuf += "\n";
|
||||
wxLogMessage(logBuf.c_str());
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
|
||||
{
|
||||
logBuf = "DBGrid::OnRangeSelected : ";
|
||||
logBuf << "Selected cells from row " << ev.GetTopRow()
|
||||
<< " col " << ev.GetLeftCol()
|
||||
<< " to row " << ev.GetBottomRow()
|
||||
<< " col " << ev.GetRightCol();
|
||||
|
||||
logBuf += "\n";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
wxLogMessage(logBuf.c_str());
|
||||
|
||||
ev.Skip();
|
||||
logBuf = "DBGrid::OnRangeSelected : ";
|
||||
logBuf << "Selected cells from row " << ev.GetTopRow()
|
||||
<< " col " << ev.GetLeftCol()
|
||||
<< " to row " << ev.GetBottomRow()
|
||||
<< " col " << ev.GetRightCol();
|
||||
|
||||
logBuf += "\n";
|
||||
// wxLogMessage( "%s", logBuf.c_str() );
|
||||
wxLogMessage(logBuf.c_str());
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@@ -11,19 +11,19 @@
|
||||
//-- all #ifdefs that the whole Project needs. ------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef __WXMSW__
|
||||
@@ -37,341 +37,343 @@
|
||||
//---------------------------------------------------------------------------
|
||||
static inline const char *bool2String(bool b)
|
||||
{
|
||||
return b ? "" : "not ";
|
||||
return b ? "" : "not ";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl)
|
||||
EVT_MOTION (DBTree::OnMouseMove)
|
||||
EVT_TREE_SEL_CHANGED(TREE_CTRL_DB, DBTree::OnSelChanged)
|
||||
EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_DB,DBTree::OnRightSelect)
|
||||
EVT_MENU(DATA_SHOW,DBTree::OnDBGrid)
|
||||
EVT_MENU(DATA_DB,DBTree::OnDBClass)
|
||||
EVT_MENU(DATA_TABLE,DBTree::OnTableClass)
|
||||
EVT_MENU(DATA_TABLE_ALL,DBTree::OnTableClassAll)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// DBTree implementation
|
||||
//---------------------------------------------------------------------------
|
||||
IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl)
|
||||
//---------------------------------------------------------------------------
|
||||
DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent)
|
||||
EVT_MOTION (DBTree::OnMouseMove)
|
||||
EVT_TREE_SEL_CHANGED(TREE_CTRL_DB, DBTree::OnSelChanged)
|
||||
EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_DB,DBTree::OnRightSelect)
|
||||
EVT_MENU(DATA_SHOW,DBTree::OnDBGrid)
|
||||
EVT_MENU(DATA_DB,DBTree::OnDBClass)
|
||||
EVT_MENU(DATA_TABLE,DBTree::OnTableClass)
|
||||
EVT_MENU(DATA_TABLE_ALL,DBTree::OnTableClassAll)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// DBTree implementation
|
||||
//---------------------------------------------------------------------------
|
||||
IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl)
|
||||
//---------------------------------------------------------------------------
|
||||
DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent)
|
||||
{
|
||||
}
|
||||
DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
SetFont(* ft_Temp);
|
||||
|
||||
// Make an image list containing small icons
|
||||
p_imageListNormal = new wxImageList(16, 16, TRUE);
|
||||
|
||||
// should correspond to TreeIc_xxx enum
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
SetFont(* ft_Temp);
|
||||
|
||||
// Make an image list containing small icons
|
||||
p_imageListNormal = new wxImageList(16, 16, TRUE);
|
||||
|
||||
// should correspond to TreeIc_xxx enum
|
||||
#if defined(__WXMSW__)
|
||||
p_imageListNormal->Add(wxICON(Logo));
|
||||
p_imageListNormal->Add(wxICON(DsnClosed));
|
||||
p_imageListNormal->Add(wxICON(DsnOpen));
|
||||
p_imageListNormal->Add(wxICON(TAB));
|
||||
p_imageListNormal->Add(wxICON(COL));
|
||||
p_imageListNormal->Add(wxICON(KEY));
|
||||
p_imageListNormal->Add(wxICON(KEYF));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
p_imageListNormal->Add(wxICON(Logo));
|
||||
p_imageListNormal->Add(wxICON(DsnClosed));
|
||||
p_imageListNormal->Add(wxICON(DsnOpen));
|
||||
p_imageListNormal->Add(wxICON(TAB));
|
||||
p_imageListNormal->Add(wxICON(COL));
|
||||
p_imageListNormal->Add(wxICON(KEY));
|
||||
p_imageListNormal->Add(wxICON(KEYF));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
#else
|
||||
#include "bitmaps/logo.xpm"
|
||||
#include "bitmaps/dsnclose.xpm"
|
||||
#include "bitmaps/dsnopen.xpm"
|
||||
#include "bitmaps/tab.xpm"
|
||||
#include "bitmaps/key.xpm"
|
||||
#include "bitmaps/keyf.xpm"
|
||||
#include "bitmaps/d_open.xpm"
|
||||
#include "bitmaps/d_closed.xpm"
|
||||
#include "bitmaps/logo.xpm"
|
||||
#include "bitmaps/dsnclose.xpm"
|
||||
#include "bitmaps/dsnopen.xpm"
|
||||
#include "bitmaps/tab.xpm"
|
||||
#include "bitmaps/key.xpm"
|
||||
#include "bitmaps/keyf.xpm"
|
||||
#include "bitmaps/d_open.xpm"
|
||||
#include "bitmaps/d_closed.xpm"
|
||||
#endif
|
||||
|
||||
SetImageList(p_imageListNormal);
|
||||
ct_BrowserDB = NULL;
|
||||
|
||||
SetImageList(p_imageListNormal);
|
||||
ct_BrowserDB = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
DBTree::~DBTree()
|
||||
{
|
||||
// wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()");
|
||||
(pDoc->db_Br+i_Which)->OnCloseDB(FALSE);
|
||||
// wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()");
|
||||
(pDoc->db_Br+i_Which)->db_BrowserDB = NULL;
|
||||
(pDoc->db_Br+i_Which)->ct_BrowserDB = NULL;
|
||||
(pDoc->db_Br+i_Which)->cl_BrowserDB = NULL;
|
||||
delete ct_BrowserDB;
|
||||
delete p_imageListNormal;
|
||||
// wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()");
|
||||
(pDoc->db_Br+i_Which)->OnCloseDB(FALSE);
|
||||
// wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()");
|
||||
(pDoc->db_Br+i_Which)->db_BrowserDB = NULL;
|
||||
(pDoc->db_Br+i_Which)->ct_BrowserDB = NULL;
|
||||
(pDoc->db_Br+i_Which)->cl_BrowserDB = NULL;
|
||||
delete ct_BrowserDB;
|
||||
delete p_imageListNormal;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
#undef TREE_EVENT_HANDLER
|
||||
//---------------------------------------------------------------------------
|
||||
int DBTree::OnPopulate()
|
||||
{
|
||||
wxTreeItemId Root, Folder, Docu, Funkt;
|
||||
int i,x,y;
|
||||
wxString SQL_TYPE, DB_TYPE;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
if((pDoc->db_Br+i_Which)->Initialize(FALSE))
|
||||
{
|
||||
ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(FALSE);
|
||||
if (ct_BrowserDB)
|
||||
{ // Use the wxDatabase Information
|
||||
Temp0.Printf("%s - (%s) (%s)", s_DSN.c_str(),ct_BrowserDB->catalog, ct_BrowserDB->schema);
|
||||
Root = AddRoot(Temp0,TreeIc_DsnOpen,TreeIc_DsnOpen,new DBTreeData("Root"));
|
||||
for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
{
|
||||
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,"TABLE")) // only TABLES
|
||||
wxTreeItemId Root, Folder, Docu, Funkt;
|
||||
int i,x,y;
|
||||
wxString SQL_TYPE, DB_TYPE;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
if((pDoc->db_Br+i_Which)->Initialize(FALSE))
|
||||
{
|
||||
Temp0.Printf(_("Tablename(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
|
||||
(ct_BrowserDB->pTableInf+x)->numCols,
|
||||
(ct_BrowserDB->pTableInf+x)->tableRemarks);
|
||||
Temp1.Printf("TN(%s",(ct_BrowserDB->pTableInf+x)->tableName);
|
||||
//----
|
||||
(ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,FALSE);
|
||||
//----
|
||||
if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
{
|
||||
Temp0.Printf(_("Tablename(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
|
||||
(ct_BrowserDB->pTableInf+x)->numCols,
|
||||
(ct_BrowserDB->pTableInf+x)->tableRemarks);
|
||||
Folder = AppendItem(Root,Temp0,TreeIc_TAB,TreeIc_TAB, new DBTreeData(Temp1));
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
{
|
||||
Temp1.Printf("FN(%s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
|
||||
// Here is where we find out if the Column is a Primary / Foreign Key
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol != 0) // Primary Key
|
||||
{
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1));
|
||||
Temp2.Printf(_("This Key is used in the following Tables : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName);
|
||||
Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEY"));
|
||||
}
|
||||
ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(FALSE);
|
||||
if (ct_BrowserDB)
|
||||
{ // Use the wxDatabase Information
|
||||
Temp0.Printf("%s - (%s) (%s)", s_DSN.c_str(),ct_BrowserDB->catalog, ct_BrowserDB->schema);
|
||||
Root = AddRoot(Temp0,TreeIc_DsnOpen,TreeIc_DsnOpen,new DBTreeData("Root"));
|
||||
for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
{
|
||||
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,"TABLE")) // only TABLES
|
||||
{
|
||||
Temp0.Printf(_("Tablename(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
|
||||
(ct_BrowserDB->pTableInf+x)->numCols,
|
||||
(ct_BrowserDB->pTableInf+x)->tableRemarks);
|
||||
Temp1.Printf("TN(%s",(ct_BrowserDB->pTableInf+x)->tableName);
|
||||
//----
|
||||
(ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,FALSE);
|
||||
//----
|
||||
if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
{
|
||||
Temp0.Printf(_("Tablename(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
|
||||
(ct_BrowserDB->pTableInf+x)->numCols,
|
||||
(ct_BrowserDB->pTableInf+x)->tableRemarks);
|
||||
Folder = AppendItem(Root,Temp0,TreeIc_TAB,TreeIc_TAB, new DBTreeData(Temp1));
|
||||
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
{
|
||||
Temp1.Printf("FN(%s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
|
||||
// Here is where we find out if the Column is a Primary / Foreign Key
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol != 0) // Primary Key
|
||||
{
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1));
|
||||
Temp2.Printf(_("This Key is used in the following Tables : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName);
|
||||
Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEY"));
|
||||
}
|
||||
else
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol != 0) // Foreign Key
|
||||
{
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEYF,TreeIc_KEYF,new DBTreeData(Temp1));
|
||||
Temp2.Printf(_("This Foreign Key comes from the following Table : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkTableName);
|
||||
Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEYF"));
|
||||
}
|
||||
else
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_COL,TreeIc_COL,new DBTreeData(Temp1));
|
||||
SQL_TYPE.Printf(_("SQL_C_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType);
|
||||
DB_TYPE.Printf(_("DB_DATA_TYPE_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType);
|
||||
for (i=1;i<=(pDoc->db_Br+i_Which)->i_SqlTyp[0];i++)
|
||||
{
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType == (pDoc->db_Br+i_Which)->i_SqlTyp[i])
|
||||
{
|
||||
SQL_TYPE.Printf("%s(%d) ; ",(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]);
|
||||
}
|
||||
} // for (i=1;i<=i_SqlTyp[0];i++)
|
||||
for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++)
|
||||
{
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i])
|
||||
{
|
||||
DB_TYPE.Printf("%s(%d)",(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]);
|
||||
}
|
||||
} // for (i=1;i<=i_dbTyp[0];i++)
|
||||
SQL_TYPE += DB_TYPE;
|
||||
Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
|
||||
SQL_TYPE.Printf("%10s %d,%d",((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName,
|
||||
((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnSize,
|
||||
((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits);
|
||||
Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
|
||||
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
else
|
||||
Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
|
||||
} // for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
} // if (ct_BrowserDB)
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol != 0) // Foreign Key
|
||||
{
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEYF,TreeIc_KEYF,new DBTreeData(Temp1));
|
||||
Temp2.Printf(_("This Foreign Key comes from the following Table : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkTableName);
|
||||
Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEYF"));
|
||||
}
|
||||
else
|
||||
Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_COL,TreeIc_COL,new DBTreeData(Temp1));
|
||||
SQL_TYPE.Printf(_("SQL_C_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType);
|
||||
DB_TYPE.Printf(_("DB_DATA_TYPE_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType);
|
||||
for (i=1;i<=(pDoc->db_Br+i_Which)->i_SqlTyp[0];i++)
|
||||
{
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType == (pDoc->db_Br+i_Which)->i_SqlTyp[i])
|
||||
{
|
||||
SQL_TYPE.Printf("%s(%d) ; ",(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]);
|
||||
}
|
||||
} // for (i=1;i<=i_SqlTyp[0];i++)
|
||||
for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++)
|
||||
{
|
||||
if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i])
|
||||
{
|
||||
DB_TYPE.Printf("%s(%d)",(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]);
|
||||
}
|
||||
} // for (i=1;i<=i_dbTyp[0];i++)
|
||||
SQL_TYPE += DB_TYPE;
|
||||
Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
|
||||
SQL_TYPE.Printf("%10s %d,%d",((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName,
|
||||
((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnSize,
|
||||
((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits);
|
||||
Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
|
||||
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
||||
else
|
||||
Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
|
||||
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
|
||||
} // for (x=0;x<ct_BrowserDB->numTables;x++)
|
||||
} // if (ct_BrowserDB)
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBTree::OnPopulate() : Invalid Catalog Pointer : Failed"));
|
||||
} // if((pDoc->db_Br+i_Which)->Initialize(FALSE))
|
||||
else
|
||||
wxLogMessage(_("\n-E-> DBTree::OnPopulate() : Invalid Catalog Pointer : Failed"));
|
||||
} // if((pDoc->db_Br+i_Which)->Initialize(FALSE))
|
||||
else
|
||||
{
|
||||
wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed"));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Expand(Root);
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = NULL;
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h "));
|
||||
popupMenu1->AppendSeparator();
|
||||
popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes"));
|
||||
popupMenu2 = NULL;
|
||||
popupMenu2 = new wxMenu("");
|
||||
popupMenu2->Append(DATA_SHOW, _("Show Data"));
|
||||
popupMenu2->AppendSeparator();
|
||||
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
return 0;
|
||||
{
|
||||
wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed"));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Expand(Root);
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = NULL;
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h "));
|
||||
popupMenu1->AppendSeparator();
|
||||
popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes"));
|
||||
popupMenu2 = NULL;
|
||||
popupMenu2 = new wxMenu("");
|
||||
popupMenu2->Append(DATA_SHOW, _("Show Data"));
|
||||
popupMenu2->AppendSeparator();
|
||||
popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h "));
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
|
||||
{
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0,0);
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0,0);
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
// pDoc->OnChosenDSN(i);
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
{
|
||||
// pDoc->OnChosenDSN(i);
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event))
|
||||
{
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (!wxStrcmp("Root",Temp1))
|
||||
{
|
||||
PopupMenu(popupMenu1,TreePos.x,TreePos.y);
|
||||
Treffer++;
|
||||
}
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
PopupMenu(popupMenu2,TreePos.x,TreePos.y);
|
||||
Treffer++;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (!wxStrcmp("Root",Temp1))
|
||||
{
|
||||
PopupMenu(popupMenu1,TreePos.x,TreePos.y);
|
||||
Treffer++;
|
||||
}
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
PopupMenu(popupMenu2,TreePos.x,TreePos.y);
|
||||
Treffer++;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnDBGrid(wxMenu& , wxCommandEvent& event)
|
||||
{
|
||||
int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
// Temp0.Printf("(%d) Here is where a GridCtrl for >%s< will be called! ",i,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
pDoc->OnChosenTbl(1,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
// wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
}
|
||||
int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
// Temp0.Printf("(%d) Here is where a GridCtrl for >%s< will be called! ",i,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
pDoc->OnChosenTbl(1,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
// wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnDBClass(wxMenu& , wxCommandEvent& event)
|
||||
{
|
||||
// int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp0.Printf(_("Here is where a wxDB Class for >%s< will be made! "),s_DSN.c_str());
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
// int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp0.Printf(_("Here is where a wxDB Class for >%s< will be made! "),s_DSN.c_str());
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnTableClass(wxMenu& , wxCommandEvent& event)
|
||||
{
|
||||
int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
Temp0.Printf(_("(%d) Here is where a wxTable Class for >%s< will be made! "),i,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
}
|
||||
int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
for (i=0;i<ct_BrowserDB->numTables;i++)
|
||||
{
|
||||
Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
if (!wxStrcmp(Temp2,Temp1))
|
||||
{
|
||||
Temp0.Printf(_("(%d) Here is where a wxTable Class for >%s< will be made! "),i,(ct_BrowserDB->pTableInf+i)->tableName);
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DBTree::OnTableClassAll(wxMenu& , wxCommandEvent& event)
|
||||
{
|
||||
// int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp0.Printf(_("Here is where all wxTable Classes in >%s< will be made! "),s_DSN.c_str());
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
// int i;
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
Temp0.Printf(_("Here is where all wxTable Classes in >%s< will be made! "),s_DSN.c_str());
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void DBTree::OnMouseMove(wxMouseEvent &event)
|
||||
{
|
||||
TreePos = event.GetPosition();
|
||||
TreePos = event.GetPosition();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@@ -10,19 +10,19 @@
|
||||
//-- all #ifdefs that the whole Project needs. ------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
//-- all #includes that every .cpp needs ----19990807.mj10777 ---
|
||||
@@ -30,41 +30,41 @@
|
||||
#include "dlguser.h"
|
||||
//---------------------------------------------------------------------------
|
||||
DlgUser::DlgUser(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long WXUNUSED(style) ) :
|
||||
wxDialog(parent, ID_DIALOG_DSN, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
|
||||
wxDialog(parent, ID_DIALOG_DSN, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
|
||||
{
|
||||
SetBackgroundColour("wheat");
|
||||
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();
|
||||
but1->SetDefault();
|
||||
SetBackgroundColour("wheat");
|
||||
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();
|
||||
but1->SetDefault();
|
||||
}
|
||||
void DlgUser::OnInit()
|
||||
{
|
||||
wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str());
|
||||
(void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE );
|
||||
tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator);
|
||||
tc_Password = new wxTextCtrl(this, ID_PASSWORD, s_Password, wxPoint(75, 75), wxSize(200, 25),wxTE_PASSWORD, wxDefaultValidator);
|
||||
tc_User->SetFocus();
|
||||
wxString Temp; Temp.Printf(_(">>> %s <<< "),s_DSN.c_str());
|
||||
(void)new wxStaticText(this, -1, Temp, wxPoint(10, 10), wxSize(300, 20),wxALIGN_CENTRE );
|
||||
tc_User = new wxTextCtrl(this, ID_USER, s_User, wxPoint(75, 35), wxSize(200, 25), 0, wxDefaultValidator);
|
||||
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)
|
||||
EVT_BUTTON(wxID_OK, DlgUser::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
|
||||
EVT_BUTTON(wxID_OK, DlgUser::OnOk)
|
||||
EVT_BUTTON(wxID_CANCEL, DlgUser::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
void DlgUser::OnOk(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
canceled = FALSE;
|
||||
s_User = tc_User->GetValue();
|
||||
s_Password = tc_Password->GetValue();
|
||||
EndModal(wxID_OK);
|
||||
canceled = FALSE;
|
||||
s_User = tc_User->GetValue();
|
||||
s_Password = tc_Password->GetValue();
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void DlgUser::OnCancel(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
canceled = TRUE;
|
||||
EndModal(wxID_CANCEL);
|
||||
canceled = TRUE;
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
@@ -11,19 +11,19 @@
|
||||
//-- all #ifdefs that the whole Project needs. ------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -33,7 +33,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
//-- Some Global Vars for all Files (extern in ?.h needed) -----------------
|
||||
// Global structure for holding ODBC connection information
|
||||
struct DbStuff DbConnectInf;
|
||||
struct DbStuff DbConnectInf;
|
||||
//---------------------------------------------------------------------------
|
||||
wxConfigBase *p_ProgramCfg; // All Config and Path information
|
||||
wxLogTextCtrl *p_LogBook; // All Log messages
|
||||
@@ -41,287 +41,287 @@ wxString LogBuf; // String for all Logs
|
||||
//---------------------------------------------------------------------------
|
||||
mjDoc::mjDoc()
|
||||
{
|
||||
db_Br = NULL;
|
||||
p_DSN = NULL;
|
||||
i_DSN = 0;
|
||||
p_Splitter = NULL;
|
||||
p_MainFrame = NULL;
|
||||
p_PgmCtrl = NULL; // Is not active
|
||||
p_DBTree = NULL;
|
||||
p_DBGrid = NULL;
|
||||
p_LogWin = NULL;
|
||||
p_TabArea = NULL;
|
||||
p_PageArea = NULL;
|
||||
i_TabNr = 0;
|
||||
i_PageNr = 0;
|
||||
db_Br = NULL;
|
||||
p_DSN = NULL;
|
||||
i_DSN = 0;
|
||||
p_Splitter = NULL;
|
||||
p_MainFrame = NULL;
|
||||
p_PgmCtrl = NULL; // Is not active
|
||||
p_DBTree = NULL;
|
||||
p_DBGrid = NULL;
|
||||
p_LogWin = NULL;
|
||||
p_TabArea = NULL;
|
||||
p_PageArea = NULL;
|
||||
i_TabNr = 0;
|
||||
i_PageNr = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
mjDoc::~mjDoc()
|
||||
{
|
||||
// ----------------------------------------------------------
|
||||
// -E-> The Tree Controls take to long to close : Why ??
|
||||
// ----------------------------------------------------------
|
||||
// wxMessageBox("-I-> end Doc");
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_PgmCtrl = NULL;
|
||||
delete p_PgmCtrl;
|
||||
delete [] p_DSN;
|
||||
delete p_DBTree;
|
||||
p_TabArea = NULL; delete p_TabArea;
|
||||
p_PageArea = NULL; delete p_PageArea;
|
||||
p_Splitter = NULL;
|
||||
delete p_Splitter;
|
||||
delete [] db_Br;
|
||||
// wxMessageBox("~mjDoc");
|
||||
// ----------------------------------------------------------
|
||||
// -E-> The Tree Controls take to long to close : Why ??
|
||||
// ----------------------------------------------------------
|
||||
// wxMessageBox("-I-> end Doc");
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_PgmCtrl = NULL;
|
||||
delete p_PgmCtrl;
|
||||
delete [] p_DSN;
|
||||
delete p_DBTree;
|
||||
p_TabArea = NULL; delete p_TabArea;
|
||||
p_PageArea = NULL; delete p_PageArea;
|
||||
p_Splitter = NULL;
|
||||
delete p_Splitter;
|
||||
delete [] db_Br;
|
||||
// wxMessageBox("~mjDoc");
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool mjDoc::OnNewDocument()
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
if (!OnInitView()) // LogBook is now activ
|
||||
return FALSE;
|
||||
p_PgmCtrl->OnPopulate();
|
||||
//-------------------------------------------------------------------
|
||||
return TRUE;
|
||||
//-------------------------------------------------------------------
|
||||
if (!OnInitView()) // LogBook is now activ
|
||||
return FALSE;
|
||||
p_PgmCtrl->OnPopulate();
|
||||
//-------------------------------------------------------------------
|
||||
return TRUE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool mjDoc::OnInitView()
|
||||
{
|
||||
Sash = p_ProgramCfg->Read("/MainFrame/Sash", 200);
|
||||
// wxMessageBox("OnInitView() - Begin ","-I->mjDoc::OnInitView");
|
||||
//--------------------------------------------------------------------------
|
||||
// create "workplace" window
|
||||
//--------------------------------------------------------------------------
|
||||
p_TabArea = new wxTabbedWindow(); // Init the Pointer
|
||||
p_TabArea->Create(p_Splitter, -1);
|
||||
//--------------------------------------------------------------------------
|
||||
p_PgmCtrl = new PgmCtrl(p_TabArea, TREE_CTRL_PGM,wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
|
||||
p_PgmCtrl->i_TabArt = 0; // 0 = Tab ; 1 = Page
|
||||
p_PgmCtrl->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
//--------------------------------------------------------------------------
|
||||
wxBitmap *p_FolderClose = new wxBitmap("PgmCtrl"); //, wxBITMAP_TYPE_BMP_RESOURCE); // BJO20000115
|
||||
//--------------------------------------------------------------------------
|
||||
p_TabArea->AddTab(p_PgmCtrl,"PgmCtrl",p_FolderClose);
|
||||
//--------------------------------------------------------------------------
|
||||
// now create "output" window
|
||||
//--------------------------------------------------------------------------
|
||||
p_PageArea = new wxPaggedWindow(); // Init the Pointer
|
||||
p_PageArea->Create(p_Splitter, -1);
|
||||
//--------------------------------------------------------------------------
|
||||
p_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,wxTE_MULTILINE );
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
p_LogWin->SetFont(* ft_Temp);
|
||||
// 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->SetActiveTarget(p_LogBook);
|
||||
p_LogBook->SetTimestamp( NULL );
|
||||
//------------------------------------------------------------------
|
||||
p_PageArea->AddTab(p_LogWin,_("LogBook"), "what is this?" );
|
||||
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;
|
||||
//--------------------------------------------------------------------------
|
||||
p_PgmCtrl->pDoc = this;
|
||||
p_TabArea->SetActiveTab(i_PageNr);
|
||||
//--------------------------------------------------------------------------
|
||||
p_Splitter->Initialize(p_TabArea);
|
||||
p_Splitter->SplitHorizontally(p_TabArea,p_PageArea,Sash);
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
if (!OnInitODBC())
|
||||
return FALSE;
|
||||
//--------------------------------------------------------------------------
|
||||
Temp0.Printf("-I-> mjDoc::OnInitView() - End - %d DSN's found",i_DSN);
|
||||
p_MainFrame->SetStatusText(Temp0, 0);
|
||||
wxLogMessage(Temp0);
|
||||
return TRUE;
|
||||
Sash = p_ProgramCfg->Read("/MainFrame/Sash", 200);
|
||||
// wxMessageBox("OnInitView() - Begin ","-I->mjDoc::OnInitView");
|
||||
//--------------------------------------------------------------------------
|
||||
// create "workplace" window
|
||||
//--------------------------------------------------------------------------
|
||||
p_TabArea = new wxTabbedWindow(); // Init the Pointer
|
||||
p_TabArea->Create(p_Splitter, -1);
|
||||
//--------------------------------------------------------------------------
|
||||
p_PgmCtrl = new PgmCtrl(p_TabArea, TREE_CTRL_PGM,wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
|
||||
p_PgmCtrl->i_TabArt = 0; // 0 = Tab ; 1 = Page
|
||||
p_PgmCtrl->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
//--------------------------------------------------------------------------
|
||||
wxBitmap *p_FolderClose = new wxBitmap("PgmCtrl"); //, wxBITMAP_TYPE_BMP_RESOURCE); // BJO20000115
|
||||
//--------------------------------------------------------------------------
|
||||
p_TabArea->AddTab(p_PgmCtrl,"PgmCtrl",p_FolderClose);
|
||||
//--------------------------------------------------------------------------
|
||||
// now create "output" window
|
||||
//--------------------------------------------------------------------------
|
||||
p_PageArea = new wxPaggedWindow(); // Init the Pointer
|
||||
p_PageArea->Create(p_Splitter, -1);
|
||||
//--------------------------------------------------------------------------
|
||||
p_LogWin = new wxTextCtrl(p_PageArea,-1,wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,wxTE_MULTILINE );
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
p_LogWin->SetFont(* ft_Temp);
|
||||
// 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->SetActiveTarget(p_LogBook);
|
||||
p_LogBook->SetTimestamp( NULL );
|
||||
//------------------------------------------------------------------
|
||||
p_PageArea->AddTab(p_LogWin,_("LogBook"), "what is this?" );
|
||||
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;
|
||||
//--------------------------------------------------------------------------
|
||||
p_PgmCtrl->pDoc = this;
|
||||
p_TabArea->SetActiveTab(i_PageNr);
|
||||
//--------------------------------------------------------------------------
|
||||
p_Splitter->Initialize(p_TabArea);
|
||||
p_Splitter->SplitHorizontally(p_TabArea,p_PageArea,Sash);
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
if (!OnInitODBC())
|
||||
return FALSE;
|
||||
//--------------------------------------------------------------------------
|
||||
Temp0.Printf("-I-> mjDoc::OnInitView() - End - %d DSN's found",i_DSN);
|
||||
p_MainFrame->SetStatusText(Temp0, 0);
|
||||
wxLogMessage(Temp0);
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool mjDoc::OnInitODBC()
|
||||
{
|
||||
char Dsn[SQL_MAX_DSN_LENGTH + 1];
|
||||
char DsDesc[255]; // BJO20002501 instead of 512
|
||||
Temp0 = "";
|
||||
i_DSN = 0; // Counter
|
||||
int i = 0;
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialize the ODBC Environment for Database Operations
|
||||
|
||||
if (SQLAllocEnv(&DbConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const char sep = 3; // separator character used in string between DSN ans DsDesc
|
||||
wxStringList s_SortDSNList, s_SortDsDescList;
|
||||
// BJO-20000127
|
||||
// In order to have same sort result on both Dsn and DsDesc, create a 'keyed' string.
|
||||
// The key will be removed after sorting
|
||||
wxString KeyString;
|
||||
//---------------------------------------------------------------------------
|
||||
while(GetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc)))
|
||||
{
|
||||
i_DSN++; // How many Dsn have we ?
|
||||
KeyString.Printf("%s%c%s",Dsn, sep, DsDesc);
|
||||
s_SortDSNList.Add(Dsn);
|
||||
s_SortDsDescList.Add(KeyString);
|
||||
}
|
||||
s_SortDSNList.Sort(); //BJO
|
||||
s_SortDsDescList.Sort(); //BJO
|
||||
|
||||
char ** s_SortDSN = s_SortDSNList.ListToArray(); //BJO
|
||||
char ** s_SortDsDesc = s_SortDsDescList.ListToArray(); //BJO
|
||||
//---------------------------------------------------------------------------
|
||||
// Allocate n ODBC-DSN objects to hold the information
|
||||
p_DSN = new DSN[i_DSN]; //BJO
|
||||
for (i=0;i<i_DSN;i++)
|
||||
{
|
||||
KeyString = s_SortDsDesc[i];
|
||||
KeyString = KeyString.AfterFirst(sep);
|
||||
strcpy(s_SortDsDesc[i],KeyString.c_str());
|
||||
(p_DSN+i)->Dsn = s_SortDSN[i];
|
||||
(p_DSN+i)->Drv = s_SortDsDesc[i];
|
||||
(p_DSN+i)->Usr = "";
|
||||
(p_DSN+i)->Pas = "";
|
||||
Temp0.Printf("%02d) Dsn(%s) DsDesc(%s)",i,(p_DSN+i)->Dsn,(p_DSN+i)->Drv);
|
||||
wxLogMessage(Temp0);
|
||||
}
|
||||
i = 0;
|
||||
//---------------------------------------------------------------------------
|
||||
// Allocate n wxDatabase objects to hold the column information
|
||||
db_Br = new BrowserDB[i_DSN];
|
||||
for (i=0;i<i_DSN;i++)
|
||||
{
|
||||
(db_Br+i)->p_LogWindow = p_LogWin;
|
||||
(db_Br+i)->ODBCSource = (p_DSN+i)->Dsn;
|
||||
(db_Br+i)->UserName = (p_DSN+i)->Usr;
|
||||
(db_Br+i)->Password = (p_DSN+i)->Pas;
|
||||
(db_Br+i)->pDoc = this;
|
||||
(db_Br+i)->i_Which = i;
|
||||
}
|
||||
|
||||
if (SQLFreeEnv(&DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125
|
||||
{
|
||||
// Error freeing environment handle
|
||||
}
|
||||
|
||||
delete [] s_SortDSN;
|
||||
delete [] s_SortDsDesc;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
if (!i_DSN)
|
||||
{
|
||||
wxMessageBox(_("No Dataset names found in ODBC!\n" \
|
||||
" Program will exit!\n\n" \
|
||||
" Ciao"),"-E-> Fatal situation");
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
return TRUE;
|
||||
char Dsn[SQL_MAX_DSN_LENGTH + 1];
|
||||
char DsDesc[255]; // BJO20002501 instead of 512
|
||||
Temp0 = "";
|
||||
i_DSN = 0; // Counter
|
||||
int i = 0;
|
||||
//---------------------------------------------------------------------------
|
||||
// Initialize the ODBC Environment for Database Operations
|
||||
|
||||
if (SQLAllocEnv(&DbConnectInf.Henv) != SQL_SUCCESS)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const char sep = 3; // separator character used in string between DSN ans DsDesc
|
||||
wxStringList s_SortDSNList, s_SortDsDescList;
|
||||
// BJO-20000127
|
||||
// In order to have same sort result on both Dsn and DsDesc, create a 'keyed' string.
|
||||
// The key will be removed after sorting
|
||||
wxString KeyString;
|
||||
//---------------------------------------------------------------------------
|
||||
while(GetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc)))
|
||||
{
|
||||
i_DSN++; // How many Dsn have we ?
|
||||
KeyString.Printf("%s%c%s",Dsn, sep, DsDesc);
|
||||
s_SortDSNList.Add(Dsn);
|
||||
s_SortDsDescList.Add(KeyString);
|
||||
}
|
||||
s_SortDSNList.Sort(); //BJO
|
||||
s_SortDsDescList.Sort(); //BJO
|
||||
|
||||
char ** s_SortDSN = s_SortDSNList.ListToArray(); //BJO
|
||||
char ** s_SortDsDesc = s_SortDsDescList.ListToArray(); //BJO
|
||||
//---------------------------------------------------------------------------
|
||||
// Allocate n ODBC-DSN objects to hold the information
|
||||
p_DSN = new DSN[i_DSN]; //BJO
|
||||
for (i=0;i<i_DSN;i++)
|
||||
{
|
||||
KeyString = s_SortDsDesc[i];
|
||||
KeyString = KeyString.AfterFirst(sep);
|
||||
strcpy(s_SortDsDesc[i],KeyString.c_str());
|
||||
(p_DSN+i)->Dsn = s_SortDSN[i];
|
||||
(p_DSN+i)->Drv = s_SortDsDesc[i];
|
||||
(p_DSN+i)->Usr = "";
|
||||
(p_DSN+i)->Pas = "";
|
||||
Temp0.Printf("%02d) Dsn(%s) DsDesc(%s)",i,(p_DSN+i)->Dsn,(p_DSN+i)->Drv);
|
||||
wxLogMessage(Temp0);
|
||||
}
|
||||
i = 0;
|
||||
//---------------------------------------------------------------------------
|
||||
// Allocate n wxDatabase objects to hold the column information
|
||||
db_Br = new BrowserDB[i_DSN];
|
||||
for (i=0;i<i_DSN;i++)
|
||||
{
|
||||
(db_Br+i)->p_LogWindow = p_LogWin;
|
||||
(db_Br+i)->ODBCSource = (p_DSN+i)->Dsn;
|
||||
(db_Br+i)->UserName = (p_DSN+i)->Usr;
|
||||
(db_Br+i)->Password = (p_DSN+i)->Pas;
|
||||
(db_Br+i)->pDoc = this;
|
||||
(db_Br+i)->i_Which = i;
|
||||
}
|
||||
|
||||
if (SQLFreeEnv(&DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125
|
||||
{
|
||||
// Error freeing environment handle
|
||||
}
|
||||
|
||||
delete [] s_SortDSN;
|
||||
delete [] s_SortDsDesc;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
if (!i_DSN)
|
||||
{
|
||||
wxMessageBox(_("No Dataset names found in ODBC!\n" \
|
||||
" Program will exit!\n\n" \
|
||||
" Ciao"),"-E-> Fatal situation");
|
||||
return FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool mjDoc::OnChosenDSN(int Which)
|
||||
{
|
||||
// wxLogMessage("OnChosenDSN(%d) - Begin",Which);
|
||||
//---------------------------------------------------------------------------
|
||||
if (p_DBTree != NULL)
|
||||
{
|
||||
// wxLogMessage("OnChosenDSN(%d) - Begin",Which);
|
||||
//---------------------------------------------------------------------------
|
||||
if (p_DBTree != NULL)
|
||||
{
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_TabArea->RemoveTab(p_DBTree->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
OnChosenTbl(77,"");
|
||||
}
|
||||
//-------------------------
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_TabArea->RemoveTab(p_DBTree->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
OnChosenTbl(77,"");
|
||||
}
|
||||
//-------------------------
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_DBTree = new DBTree(p_TabArea, TREE_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
|
||||
p_TabArea->AddTab(p_DBTree,(p_DSN+Which)->Dsn," ? ");
|
||||
p_DBTree->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
p_TabArea->Show(TRUE); // Deactivate the Window
|
||||
p_DBTree->i_Which = Which;
|
||||
p_DBTree->s_DSN = (p_DSN+Which)->Dsn;
|
||||
p_DBTree->i_TabArt = 0;
|
||||
p_DBTree->pDoc = this;
|
||||
p_DBTree->OnPopulate();
|
||||
p_TabArea->SetActiveTab(p_DBTree->i_ViewNr);
|
||||
//---------------------------------------------------------------------------
|
||||
// wxLogMessage("OnChosenDSN(%d) - End",Which);
|
||||
return TRUE;
|
||||
p_DBTree = new DBTree(p_TabArea, TREE_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
|
||||
p_TabArea->AddTab(p_DBTree,(p_DSN+Which)->Dsn," ? ");
|
||||
p_DBTree->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
p_TabArea->Show(TRUE); // Deactivate the Window
|
||||
p_DBTree->i_Which = Which;
|
||||
p_DBTree->s_DSN = (p_DSN+Which)->Dsn;
|
||||
p_DBTree->i_TabArt = 0;
|
||||
p_DBTree->pDoc = this;
|
||||
p_DBTree->OnPopulate();
|
||||
p_TabArea->SetActiveTab(p_DBTree->i_ViewNr);
|
||||
//---------------------------------------------------------------------------
|
||||
// wxLogMessage("OnChosenDSN(%d) - End",Which);
|
||||
return TRUE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool mjDoc::OnChosenTbl(int Tab,wxString Table)
|
||||
{
|
||||
// wxLogMessage("OnChosenTbl(%d,%s)",Tab,Table.c_str());
|
||||
//-------------------------
|
||||
if (p_DBGrid != NULL)
|
||||
{
|
||||
if (p_DBGrid->i_TabArt == 0)
|
||||
{
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_TabArea->RemoveTab(p_DBGrid->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
if (p_DBGrid->i_TabArt == 1)
|
||||
{
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_PageArea->RemoveTab(p_DBGrid->i_ViewNr);
|
||||
p_PageArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
p_DBGrid = NULL;
|
||||
delete p_DBGrid;
|
||||
}
|
||||
if (Tab == 77) // Delete only
|
||||
return TRUE;
|
||||
//-------------------------
|
||||
if (Tab == 0) // Tabview
|
||||
{
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_DBGrid = new DBGrid(p_TabArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxSUNKEN_BORDER);
|
||||
p_TabArea->AddTab(p_DBGrid, Table, "");
|
||||
p_DBGrid->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
p_DBGrid->pDoc = this;
|
||||
p_DBGrid->db_Br = db_Br;
|
||||
p_DBGrid->OnTableView(Table);
|
||||
p_TabArea->SetActiveTab(p_DBGrid->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
if (Tab == 1) // Pageview
|
||||
{
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_DBGrid = new DBGrid(p_PageArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxSUNKEN_BORDER);
|
||||
p_PageArea->AddTab(p_DBGrid, Table, "");
|
||||
p_DBGrid->i_ViewNr = p_PageArea->GetTabCount()-1;
|
||||
p_DBGrid->pDoc = this;
|
||||
p_DBGrid->db_Br = db_Br;
|
||||
p_DBGrid->i_Which = p_DBTree->i_Which;
|
||||
p_PageArea->Show(TRUE); // Activate the Window
|
||||
p_DBGrid->OnTableView(Table);
|
||||
p_PageArea->SetActiveTab(p_DBGrid->i_ViewNr);
|
||||
}
|
||||
p_DBGrid->i_TabArt = Tab;
|
||||
//---*----------------------
|
||||
return TRUE;;
|
||||
// wxLogMessage("OnChosenTbl(%d,%s)",Tab,Table.c_str());
|
||||
//-------------------------
|
||||
if (p_DBGrid != NULL)
|
||||
{
|
||||
if (p_DBGrid->i_TabArt == 0)
|
||||
{
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_TabArea->RemoveTab(p_DBGrid->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
if (p_DBGrid->i_TabArt == 1)
|
||||
{
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_PageArea->RemoveTab(p_DBGrid->i_ViewNr);
|
||||
p_PageArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
p_DBGrid = NULL;
|
||||
delete p_DBGrid;
|
||||
}
|
||||
if (Tab == 77) // Delete only
|
||||
return TRUE;
|
||||
//-------------------------
|
||||
if (Tab == 0) // Tabview
|
||||
{
|
||||
p_TabArea->Show(FALSE); // Deactivate the Window
|
||||
p_DBGrid = new DBGrid(p_TabArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxSUNKEN_BORDER);
|
||||
p_TabArea->AddTab(p_DBGrid, Table, "");
|
||||
p_DBGrid->i_ViewNr = p_TabArea->GetTabCount()-1;
|
||||
p_DBGrid->pDoc = this;
|
||||
p_DBGrid->db_Br = db_Br;
|
||||
p_DBGrid->OnTableView(Table);
|
||||
p_TabArea->SetActiveTab(p_DBGrid->i_ViewNr);
|
||||
p_TabArea->Show(TRUE); // Activate the Window
|
||||
}
|
||||
if (Tab == 1) // Pageview
|
||||
{
|
||||
p_PageArea->Show(FALSE); // Deactivate the Window
|
||||
p_DBGrid = new DBGrid(p_PageArea,GRID_CTRL_DB,wxDefaultPosition, wxDefaultSize,
|
||||
wxSUNKEN_BORDER);
|
||||
p_PageArea->AddTab(p_DBGrid, Table, "");
|
||||
p_DBGrid->i_ViewNr = p_PageArea->GetTabCount()-1;
|
||||
p_DBGrid->pDoc = this;
|
||||
p_DBGrid->db_Br = db_Br;
|
||||
p_DBGrid->i_Which = p_DBTree->i_Which;
|
||||
p_PageArea->Show(TRUE); // Activate the Window
|
||||
p_DBGrid->OnTableView(Table);
|
||||
p_PageArea->SetActiveTab(p_DBGrid->i_ViewNr);
|
||||
}
|
||||
p_DBGrid->i_TabArt = Tab;
|
||||
//---*----------------------
|
||||
return TRUE;;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void mjDoc::OnLeer(wxString Aufrufer)
|
||||
{
|
||||
// Temp0.Printf(_("\nmjDoc::OnLeer(%s) : auch diese funktion steht eines Tages zur Verf<72>gung !"),Aufrufer.c_str());
|
||||
Temp0.Printf(_("\nmjDoc::OnLeer(%s) : even this function will one day be available !"),Aufrufer.c_str());
|
||||
wxLogMessage(Temp0); Temp0.Empty();
|
||||
return;
|
||||
// Temp0.Printf(_("\nmjDoc::OnLeer(%s) : auch diese funktion steht eines Tages zur Verf<72>gung !"),Aufrufer.c_str());
|
||||
Temp0.Printf(_("\nmjDoc::OnLeer(%s) : even this function will one day be available !"),Aufrufer.c_str());
|
||||
wxLogMessage(Temp0); Temp0.Empty();
|
||||
return;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
BEGIN_EVENT_TABLE(DocSplitterWindow, wxSplitterWindow)
|
||||
END_EVENT_TABLE()
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Define a constructor for my p_Splitter
|
||||
DocSplitterWindow::DocSplitterWindow(wxWindow *parent, wxWindowID id) : wxSplitterWindow(parent, id)
|
||||
END_EVENT_TABLE()
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Define a constructor for my p_Splitter
|
||||
DocSplitterWindow::DocSplitterWindow(wxWindow *parent, wxWindowID id) : wxSplitterWindow(parent, id)
|
||||
{
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
@@ -11,29 +11,29 @@
|
||||
//-- all #ifdefs that the whole Project needs. ------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#pragma implementation
|
||||
#pragma interface
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef __WXMSW__
|
||||
#include "bitmaps/d_closed.xpm"
|
||||
#include "bitmaps/d_open.xpm"
|
||||
#include "bitmaps/f_closed.xpm"
|
||||
#include "bitmaps/f_open.xpm"
|
||||
#include "bitmaps/logo.xpm"
|
||||
#include "bitmaps/dsnclose.xpm"
|
||||
#include "bitmaps/dsnopen.xpm"
|
||||
#include "bitmaps/d_closed.xpm"
|
||||
#include "bitmaps/d_open.xpm"
|
||||
#include "bitmaps/f_closed.xpm"
|
||||
#include "bitmaps/f_open.xpm"
|
||||
#include "bitmaps/logo.xpm"
|
||||
#include "bitmaps/dsnclose.xpm"
|
||||
#include "bitmaps/dsnopen.xpm"
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
//-- all #includes that every .cpp needs --- 19990807.mj10777 ---
|
||||
@@ -44,7 +44,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
static inline const char *bool2String(bool b)
|
||||
{
|
||||
return b ? "" : "not ";
|
||||
return b ? "" : "not ";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
BEGIN_EVENT_TABLE(PgmCtrl, wxTreeCtrl)
|
||||
@@ -52,245 +52,245 @@ BEGIN_EVENT_TABLE(PgmCtrl, wxTreeCtrl)
|
||||
EVT_LEFT_DCLICK(PgmCtrl::OnSelChanged)
|
||||
EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_PGM,PgmCtrl::OnRightSelect)
|
||||
EVT_MENU(PGMCTRL_ODBC_USER,PgmCtrl::OnUserPassword)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// PgmCtrl implementation
|
||||
//---------------------------------------------------------------------------
|
||||
IMPLEMENT_DYNAMIC_CLASS(PgmCtrl, wxTreeCtrl)
|
||||
//---------------------------------------------------------------------------
|
||||
PgmCtrl::PgmCtrl(wxWindow *parent) : wxTreeCtrl(parent)
|
||||
END_EVENT_TABLE()
|
||||
//---------------------------------------------------------------------------
|
||||
// PgmCtrl implementation
|
||||
//---------------------------------------------------------------------------
|
||||
IMPLEMENT_DYNAMIC_CLASS(PgmCtrl, wxTreeCtrl)
|
||||
//---------------------------------------------------------------------------
|
||||
PgmCtrl::PgmCtrl(wxWindow *parent) : wxTreeCtrl(parent)
|
||||
{
|
||||
}
|
||||
PgmCtrl::PgmCtrl(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
: wxTreeCtrl(parent, id, pos, size, style)
|
||||
{
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
SetFont(* ft_Temp);
|
||||
|
||||
// Make an image list containing small icons
|
||||
p_imageListNormal = new wxImageList(16, 16, TRUE);
|
||||
|
||||
// should correspond to TreeIc_xxx enum
|
||||
wxFont* ft_Temp = new wxFont(10,wxSWISS,wxNORMAL,wxBOLD,FALSE,"Comic Sans MS");
|
||||
SetFont(* ft_Temp);
|
||||
|
||||
// Make an image list containing small icons
|
||||
p_imageListNormal = new wxImageList(16, 16, TRUE);
|
||||
|
||||
// should correspond to TreeIc_xxx enum
|
||||
#if defined(__WXMSW__) && defined(__WIN16__)
|
||||
// This is required in 16-bit Windows mode only because we can't load a specific (16x16)
|
||||
// icon image, so it comes out stretched
|
||||
p_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
p_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
// This is required in 16-bit Windows mode only because we can't load a specific (16x16)
|
||||
// icon image, so it comes out stretched
|
||||
p_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
p_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
|
||||
#else
|
||||
p_imageListNormal->Add(wxICON(Logo));
|
||||
p_imageListNormal->Add(wxICON(DsnClosed));
|
||||
p_imageListNormal->Add(wxICON(DsnOpen));
|
||||
p_imageListNormal->Add(wxICON(DocClosed));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
p_imageListNormal->Add(wxICON(FolderClosed));
|
||||
p_imageListNormal->Add(wxICON(FolderOpen));
|
||||
p_imageListNormal->Add(wxICON(Logo));
|
||||
p_imageListNormal->Add(wxICON(DsnClosed));
|
||||
p_imageListNormal->Add(wxICON(DsnOpen));
|
||||
p_imageListNormal->Add(wxICON(DocClosed));
|
||||
p_imageListNormal->Add(wxICON(DocOpen));
|
||||
p_imageListNormal->Add(wxICON(FolderClosed));
|
||||
p_imageListNormal->Add(wxICON(FolderOpen));
|
||||
#endif
|
||||
|
||||
SetImageList(p_imageListNormal);
|
||||
|
||||
// Add some items to the tree
|
||||
// AddTestItemsToTree(3, 2);
|
||||
|
||||
SetImageList(p_imageListNormal);
|
||||
|
||||
// Add some items to the tree
|
||||
// AddTestItemsToTree(3, 2);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
PgmCtrl::~PgmCtrl()
|
||||
{
|
||||
// wxMessageBox("PgmCtrl::~PgmCtrl() - vor DeleteAllItems");
|
||||
// DeleteAllItems();
|
||||
// wxMessageBox("nach DeleteAllItems");
|
||||
delete p_imageListNormal;
|
||||
// wxMessageBox("PgmCtrl::~PgmCtrl() - vor DeleteAllItems");
|
||||
// DeleteAllItems();
|
||||
// wxMessageBox("nach DeleteAllItems");
|
||||
delete p_imageListNormal;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
#undef TREE_EVENT_HANDLER
|
||||
//---------------------------------------------------------------------------
|
||||
int PgmCtrl::OnPopulate()
|
||||
{
|
||||
wxTreeItemId Root, Folder, Docu;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
int i;
|
||||
double dTmp = 1234567.89;
|
||||
Temp0.Printf(_("%s Functions"),p_ProgramCfg->GetAppName().c_str());
|
||||
Root = AddRoot(Temp0,TreeIc_Logo,TreeIc_Logo, new TreeData("Root"));
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Folder = AppendItem(Root, _("Program settings") ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("Settings"));
|
||||
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();
|
||||
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();
|
||||
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 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"));
|
||||
Folder = AppendItem(Root, "ODBC DSN" ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("ODBC-DSN"));
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
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));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = NULL;
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password"));
|
||||
// popupMenu1->AppendSeparator();
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Expand(Root);
|
||||
Expand(Folder);
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
return 0;
|
||||
wxTreeItemId Root, Folder, Docu;
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
int i;
|
||||
double dTmp = 1234567.89;
|
||||
Temp0.Printf(_("%s Functions"),p_ProgramCfg->GetAppName().c_str());
|
||||
Root = AddRoot(Temp0,TreeIc_Logo,TreeIc_Logo, new TreeData("Root"));
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Folder = AppendItem(Root, _("Program settings") ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("Settings"));
|
||||
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();
|
||||
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();
|
||||
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 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"));
|
||||
Folder = AppendItem(Root, "ODBC DSN" ,TreeIc_FolderClosed, TreeIc_FolderOpen, new TreeData("ODBC-DSN"));
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
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));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
popupMenu1 = NULL;
|
||||
popupMenu1 = new wxMenu("");
|
||||
popupMenu1->Append(PGMCTRL_ODBC_USER, _("Set Username and Password"));
|
||||
// popupMenu1->AppendSeparator();
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
Expand(Root);
|
||||
Expand(Folder);
|
||||
//----------------------------------------------------------------------------------------------------------------------------
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void PgmCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event))
|
||||
{
|
||||
int i;
|
||||
Temp0.Empty(); Temp1.Empty();
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0,0);
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
TreeData *item = (TreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1 == "Language English")
|
||||
{
|
||||
Temp0 = "std";
|
||||
p_ProgramCfg->Write("/Local/langid",Temp0);
|
||||
Temp0 = _("-I-> After a programm restart, the language will be changed to English.");
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
if (Temp1 == "Language German")
|
||||
{
|
||||
Temp0 = "de";
|
||||
p_ProgramCfg->Write("/Local/langid",Temp0);
|
||||
Temp0 = _("-I-> After a programm restart, the language will be changed to German.");
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1 == "wxConfigBase Delete")
|
||||
{
|
||||
if (p_ProgramCfg->DeleteAll()) // Default Diretory for wxFileSelector
|
||||
Temp0 = _("-I-> wxConfigBase.p_ProgramCfg->DeleteAll() was succesfull.");
|
||||
else
|
||||
Temp0 = _("-E-> wxConfigBase.p_ProgramCfg->DeleteAll() was not succesfull !");
|
||||
wxBell(); // Ding_a_Ling
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
int i;
|
||||
Temp0.Empty(); Temp1.Empty();
|
||||
pDoc->p_MainFrame->SetStatusText(Temp0,0);
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
TreeData *item = (TreeData *)GetItemData(itemId);
|
||||
if ( item != NULL )
|
||||
{
|
||||
pDoc->OnChosenDSN(i);
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1 == "Language English")
|
||||
{
|
||||
Temp0 = "std";
|
||||
p_ProgramCfg->Write("/Local/langid",Temp0);
|
||||
Temp0 = _("-I-> After a programm restart, the language will be changed to English.");
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
if (Temp1 == "Language German")
|
||||
{
|
||||
Temp0 = "de";
|
||||
p_ProgramCfg->Write("/Local/langid",Temp0);
|
||||
Temp0 = _("-I-> After a programm restart, the language will be changed to German.");
|
||||
wxMessageBox(Temp0);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1 == "wxConfigBase Delete")
|
||||
{
|
||||
if (p_ProgramCfg->DeleteAll()) // Default Diretory for wxFileSelector
|
||||
Temp0 = _("-I-> wxConfigBase.p_ProgramCfg->DeleteAll() was succesfull.");
|
||||
else
|
||||
Temp0 = _("-E-> wxConfigBase.p_ProgramCfg->DeleteAll() was not succesfull !");
|
||||
wxBell(); // Ding_a_Ling
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
{
|
||||
pDoc->OnChosenDSN(i);
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> PgmCtrl::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> PgmCtrl::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void PgmCtrl::OnRightSelect(wxTreeEvent& WXUNUSED(event))
|
||||
{
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
SaveDSN.Empty();
|
||||
if ( item != NULL )
|
||||
{
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
int i;
|
||||
Temp0.Empty();
|
||||
// Get the Information that we need
|
||||
wxTreeItemId itemId = GetSelection();
|
||||
DBTreeData *item = (DBTreeData *)GetItemData(itemId);
|
||||
SaveDSN.Empty();
|
||||
if ( item != NULL )
|
||||
{
|
||||
SaveDSN = Temp1;
|
||||
PopupMenu(popupMenu1,TreePos.x,TreePos.y);
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
int Treffer = 0;
|
||||
Temp1.Printf("%s",item->m_desc.c_str());
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Temp1.Contains("ODBC-"))
|
||||
{
|
||||
Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN);
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (Temp1 == (pDoc->p_DSN+i)->Dsn)
|
||||
{
|
||||
SaveDSN = Temp1;
|
||||
PopupMenu(popupMenu1,TreePos.x,TreePos.y);
|
||||
}
|
||||
}
|
||||
Treffer++;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
if (Treffer == 0)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
/*
|
||||
Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold,"
|
||||
"%u children (%u immediately under this item)."),
|
||||
item->m_desc.c_str(),
|
||||
bool2String(IsSelected(itemId)),
|
||||
bool2String(IsExpanded(itemId)),
|
||||
bool2String(IsBold(itemId)),
|
||||
GetChildrenCount(itemId),
|
||||
GetChildrenCount(itemId));
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str());
|
||||
wxLogMessage( "%s", LogBuf.c_str() );
|
||||
*/
|
||||
//---------------------------------------------------
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void PgmCtrl::OnMouseMove(wxMouseEvent &event)
|
||||
{
|
||||
TreePos = event.GetPosition();
|
||||
TreePos = event.GetPosition();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void PgmCtrl::OnUserPassword()
|
||||
{
|
||||
// wxMessageBox(SaveDSN);
|
||||
int i, rc=0;
|
||||
//-------------------------------------------
|
||||
DlgUser p_Dlg(this, "Username and Password", wxPoint(100, 100), wxSize(340, 170));
|
||||
//-------------------------------------------
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (SaveDSN == (pDoc->p_DSN+i)->Dsn)
|
||||
{
|
||||
p_Dlg.s_DSN = (pDoc->p_DSN+i)->Dsn;
|
||||
p_Dlg.s_User = (pDoc->p_DSN+i)->Usr;
|
||||
p_Dlg.s_Password = (pDoc->p_DSN+i)->Pas;
|
||||
p_Dlg.OnInit();
|
||||
//--------------------
|
||||
// Temp0.Printf("i(%d) ; s_DSN(%s) ; s_User(%s) ; s_Password(%s)",i,p_Dlg.s_DSN,p_Dlg.s_User,p_Dlg.s_Password);
|
||||
// wxMessageBox(Temp0);
|
||||
if (p_Dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
(pDoc->p_DSN+i)->Usr = p_Dlg.s_User;
|
||||
(pDoc->p_DSN+i)->Pas = p_Dlg.s_Password;
|
||||
(pDoc->db_Br+i)->UserName = (pDoc->p_DSN+i)->Usr;
|
||||
(pDoc->db_Br+i)->Password = (pDoc->p_DSN+i)->Pas;
|
||||
}
|
||||
p_Dlg.Destroy();
|
||||
//--------------------
|
||||
goto Weiter; // We have what we want, leave
|
||||
}
|
||||
}
|
||||
// wxMessageBox(SaveDSN);
|
||||
int i, rc=0;
|
||||
//-------------------------------------------
|
||||
DlgUser p_Dlg(this, "Username and Password", wxPoint(100, 100), wxSize(340, 170));
|
||||
//-------------------------------------------
|
||||
for (i=0;i<pDoc->i_DSN;i++)
|
||||
{
|
||||
if (SaveDSN == (pDoc->p_DSN+i)->Dsn)
|
||||
{
|
||||
p_Dlg.s_DSN = (pDoc->p_DSN+i)->Dsn;
|
||||
p_Dlg.s_User = (pDoc->p_DSN+i)->Usr;
|
||||
p_Dlg.s_Password = (pDoc->p_DSN+i)->Pas;
|
||||
p_Dlg.OnInit();
|
||||
//--------------------
|
||||
// Temp0.Printf("i(%d) ; s_DSN(%s) ; s_User(%s) ; s_Password(%s)",i,p_Dlg.s_DSN,p_Dlg.s_User,p_Dlg.s_Password);
|
||||
// wxMessageBox(Temp0);
|
||||
if (p_Dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
(pDoc->p_DSN+i)->Usr = p_Dlg.s_User;
|
||||
(pDoc->p_DSN+i)->Pas = p_Dlg.s_Password;
|
||||
(pDoc->db_Br+i)->UserName = (pDoc->p_DSN+i)->Usr;
|
||||
(pDoc->db_Br+i)->Password = (pDoc->p_DSN+i)->Pas;
|
||||
}
|
||||
p_Dlg.Destroy();
|
||||
//--------------------
|
||||
goto Weiter; // We have what we want, leave
|
||||
}
|
||||
}
|
||||
Weiter:
|
||||
//-------------------------------------------
|
||||
SaveDSN.Empty();
|
||||
//-------------------------------------------
|
||||
SaveDSN.Empty();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user