]>
Commit | Line | Data |
---|---|---|
c92b0f9a MJ |
1 | //---------------------------------------------------------------------------------------- |
2 | // Name: DBTree.cpp/.h | |
3 | // Purpose: Tree with Table and Views, branches show Field information | |
b5ffecfc GT |
4 | // Author: Mark Johnson |
5 | // Modified by: | |
6 | // Created: 19991129 | |
e8c6aabe | 7 | // RCS-ID: $Id$ |
b5ffecfc GT |
8 | // Copyright: (c) Mark Johnson, Berlin Germany, mj10777@gmx.net |
9 | // Licence: wxWindows license | |
c92b0f9a MJ |
10 | //---------------------------------------------------------------------------------------- |
11 | //-- all #ifdefs that the whole Project needs. ------------------------------------------- | |
12 | //---------------------------------------------------------------------------------------- | |
b5ffecfc | 13 | #ifdef __GNUG__ |
b5ce269b BJ |
14 | #pragma implementation |
15 | #pragma interface | |
b5ffecfc | 16 | #endif |
c92b0f9a | 17 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
18 | // For compilers that support precompilation, includes "wx/wx.h". |
19 | #include "wx/wxprec.h" | |
c92b0f9a | 20 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 21 | #ifdef __BORLANDC__ |
b5ce269b | 22 | #pragma hdrstop |
b5ffecfc | 23 | #endif |
c92b0f9a | 24 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 25 | #ifndef WX_PRECOMP |
b5ce269b | 26 | #include "wx/wx.h" |
b5ffecfc | 27 | #endif |
c92b0f9a | 28 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
29 | #ifndef __WXMSW__ |
30 | #endif | |
c92b0f9a MJ |
31 | //---------------------------------------------------------------------------------------- |
32 | //-- all #includes that every .cpp needs --- 19990807.mj10777 ---------------- | |
33 | //---------------------------------------------------------------------------------------- | |
b5ffecfc | 34 | #include "std.h" // sorgsam Pflegen ! |
c92b0f9a MJ |
35 | //---------------------------------------------------------------------------------------- |
36 | //-- Global functions -------------------------------------------------------------------- | |
37 | //---------------------------------------------------------------------------------------- | |
b5ffecfc GT |
38 | static inline const char *bool2String(bool b) |
39 | { | |
b5ce269b | 40 | return b ? "" : "not "; |
b5ffecfc | 41 | } |
c92b0f9a | 42 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 43 | BEGIN_EVENT_TABLE(DBTree, wxTreeCtrl) |
c92b0f9a MJ |
44 | EVT_MOTION (DBTree::OnMouseMove) |
45 | EVT_TREE_SEL_CHANGED(TREE_CTRL_DB, DBTree::OnSelChanged) | |
46 | EVT_TREE_ITEM_RIGHT_CLICK(TREE_CTRL_DB,DBTree::OnRightSelect) | |
47 | EVT_MENU(DATA_SHOW,DBTree::OnDBGrid) | |
48 | EVT_MENU(DATA_DB,DBTree::OnDBClass) | |
49 | EVT_MENU(DATA_TABLE,DBTree::OnTableClass) | |
50 | EVT_MENU(DATA_TABLE_ALL,DBTree::OnTableClassAll) | |
51 | END_EVENT_TABLE() | |
52 | //---------------------------------------------------------------------------------------- | |
53 | // DBTree implementation | |
54 | //---------------------------------------------------------------------------------------- | |
55 | IMPLEMENT_DYNAMIC_CLASS(DBTree, wxTreeCtrl) | |
56 | //---------------------------------------------------------------------------------------- | |
57 | DBTree::DBTree(wxWindow *parent) : wxTreeCtrl(parent) | |
b5ffecfc GT |
58 | { |
59 | } | |
c92b0f9a | 60 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 61 | DBTree::DBTree(wxWindow *parent, const wxWindowID id,const wxPoint& pos, const wxSize& size, long style) |
b5ce269b | 62 | : wxTreeCtrl(parent, id, pos, size, style) |
b5ffecfc | 63 | { |
c92b0f9a MJ |
64 | // Make an image list containing small icons |
65 | p_imageListNormal = new wxImageList(16, 16, TRUE); | |
66 | // should correspond to TreeIc_xxx enum | |
dc8174d2 | 67 | #if !defined(__WXMSW__) |
c92b0f9a MJ |
68 | #include "bitmaps/logo.xpm" |
69 | #include "bitmaps/dsnclose.xpm" | |
70 | #include "bitmaps/dsnopen.xpm" | |
71 | #include "bitmaps/tab.xpm" | |
72 | #include "bitmaps/view.xpm" | |
73 | #include "bitmaps/col.xpm" | |
74 | #include "bitmaps/key.xpm" | |
75 | #include "bitmaps/keyf.xpm" | |
76 | #include "bitmaps/d_open.xpm" | |
77 | #include "bitmaps/d_closed.xpm" | |
dc8174d2 | 78 | #endif |
c92b0f9a MJ |
79 | p_imageListNormal->Add(wxICON(aLogo)); |
80 | p_imageListNormal->Add(wxICON(DsnClosed)); | |
81 | p_imageListNormal->Add(wxICON(DsnOpen)); | |
82 | p_imageListNormal->Add(wxICON(TAB)); | |
83 | p_imageListNormal->Add(wxICON(VIEW)); | |
84 | p_imageListNormal->Add(wxICON(COL)); | |
85 | p_imageListNormal->Add(wxICON(KEY)); | |
86 | p_imageListNormal->Add(wxICON(KEYF)); | |
87 | p_imageListNormal->Add(wxICON(DocOpen)); | |
88 | p_imageListNormal->Add(wxICON(DocOpen)); | |
89 | SetImageList(p_imageListNormal); | |
90 | ct_BrowserDB = NULL; | |
ca7408bd MJ |
91 | popupMenu1 = NULL; |
92 | popupMenu2 = NULL; | |
b5ffecfc | 93 | } |
c92b0f9a | 94 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
95 | DBTree::~DBTree() |
96 | { | |
ca7408bd | 97 | // delete (pDoc->db_Br+i_Which); |
c92b0f9a MJ |
98 | // wxLogMessage("DBTree::~DBTree() - Vor OnCloseDB()"); |
99 | (pDoc->db_Br+i_Which)->OnCloseDB(FALSE); | |
100 | // wxLogMessage("DBTree::~DBTree() - Nach OnCloseDB()"); | |
101 | (pDoc->db_Br+i_Which)->db_BrowserDB = NULL; | |
102 | (pDoc->db_Br+i_Which)->ct_BrowserDB = NULL; | |
103 | (pDoc->db_Br+i_Which)->cl_BrowserDB = NULL; | |
ca7408bd | 104 | |
c92b0f9a MJ |
105 | delete ct_BrowserDB; |
106 | delete p_imageListNormal; | |
ca7408bd MJ |
107 | if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! |
108 | delete popupMenu1; | |
109 | if (popupMenu1) // If the DSN has no Tables, then no delete should be done ! | |
110 | delete popupMenu2; | |
b5ffecfc | 111 | } |
c92b0f9a | 112 | //---------------------------------------------------------------------------------------- |
b5ffecfc | 113 | #undef TREE_EVENT_HANDLER |
c92b0f9a | 114 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
115 | int DBTree::OnPopulate() |
116 | { | |
e8c6aabe | 117 | wxTreeItemId Root, Folder, Docu, Funkt; |
b54f1155 | 118 | int i,x,y,z=0, TableType; |
e8c6aabe | 119 | wxString SQL_TYPE, DB_TYPE; |
c92b0f9a MJ |
120 | SetFont(* pDoc->ft_Doc); |
121 | //--------------------------------------------------------------------------------------- | |
e8c6aabe MJ |
122 | if ((pDoc->db_Br+i_Which)->Initialize(FALSE)) |
123 | { | |
d1a643a4 | 124 | wxStopWatch sw; |
e8c6aabe MJ |
125 | wxBeginBusyCursor(); |
126 | ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(FALSE); | |
127 | if (ct_BrowserDB) | |
128 | { // Use the wxDatabase Information | |
129 | Temp0.Printf("%s - (%s) (%s)", s_DSN.c_str(),ct_BrowserDB->catalog, ct_BrowserDB->schema); | |
f75fc92e | 130 | Root = AddRoot(Temp0,TreeIc_DsnOpen,TreeIc_DsnOpen,new DBTreeData("Root")); |
e8c6aabe MJ |
131 | for (x=0;x<ct_BrowserDB->numTables;x++) |
132 | { | |
133 | wxYield(); | |
134 | TableType = 0; // TABLE = 1 ; VIEW = 2 ; 0 We are not interested in | |
135 | if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,"TABLE")) // only TABLES | |
136 | TableType = 1; | |
137 | if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,"VIEW")) // and VIEWS | |
138 | TableType = 2; | |
139 | if (TableType) // only TABLES or Views | |
b5ffecfc | 140 | { |
e8c6aabe MJ |
141 | Temp1.Printf("TN(%s",(ct_BrowserDB->pTableInf+x)->tableName); |
142 | //---- | |
143 | (ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,FALSE); | |
144 | //---- | |
145 | if ((ct_BrowserDB->pTableInf+x)->pColInf) | |
146 | { | |
147 | if (TableType == 1) // Table | |
148 | { | |
149 | Temp0.Printf(_("Table-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName, | |
150 | (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks); | |
151 | Folder = AppendItem(Root,Temp0,TreeIc_TAB,TreeIc_TAB, new DBTreeData(Temp1)); | |
152 | } | |
153 | if (TableType == 2) // View | |
154 | { | |
155 | Temp0.Printf(_("View-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName, | |
156 | (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks); | |
157 | Folder = AppendItem(Root,Temp0,TreeIc_VIEW,TreeIc_VIEW, new DBTreeData(Temp1)); | |
158 | } | |
159 | for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) | |
160 | { | |
161 | Temp1.Printf("FN(%s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName); | |
162 | // Here is where we find out if the Column is a Primary / Foreign Key | |
163 | if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol != 0) // Primary Key | |
164 | { | |
f1a31d88 MJ |
165 | Temp2.Printf("(%d) - %s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName); |
166 | Docu = AppendItem(Folder,Temp2,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1)); | |
b54f1155 MJ |
167 | Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName; |
168 | if (Temp2 == "") | |
169 | Temp2 = _("None"); | |
993f97ee | 170 | Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2.c_str()); |
e8c6aabe MJ |
171 | Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEY")); |
172 | } | |
b5ffecfc | 173 | else |
e8c6aabe MJ |
174 | { |
175 | if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol != 0) // Foreign Key | |
176 | { | |
f1a31d88 MJ |
177 | Temp2.Printf("(%d) - %s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName); |
178 | Docu = AppendItem(Folder,Temp2,TreeIc_KEYF,TreeIc_KEYF,new DBTreeData(Temp1)); | |
e8c6aabe MJ |
179 | Temp2.Printf(_("This Foreign Key comes from the following Table : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkTableName); |
180 | Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEYF")); | |
181 | } | |
182 | else | |
183 | Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_COL,TreeIc_COL,new DBTreeData(Temp1)); | |
184 | } | |
0068587b MJ |
185 | SQL_TYPE.Printf("SQL_C_???? (%d)",((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType); |
186 | DB_TYPE.Printf("DB_DATA_TYPE_???? (%d)",((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType); | |
e8c6aabe MJ |
187 | for (i=1;i<=(pDoc->db_Br+i_Which)->i_SqlTyp[0];i++) |
188 | { | |
189 | if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType == (pDoc->db_Br+i_Which)->i_SqlTyp[i]) | |
190 | { | |
191 | SQL_TYPE.Printf("%s(%d) ; ",(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]); | |
192 | } | |
193 | } // for (i=1;i<=i_SqlTyp[0];i++) | |
194 | for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++) | |
195 | { | |
196 | if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i]) | |
197 | { | |
198 | DB_TYPE.Printf("%s(%d)",(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]); | |
199 | } | |
200 | } // for (i=1;i<=i_dbTyp[0];i++) | |
201 | SQL_TYPE += DB_TYPE; | |
202 | Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE)); | |
203 | SQL_TYPE.Printf("%10s %d,%d",((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName, | |
204 | ((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnSize,((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits); | |
205 | Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE)); | |
206 | } // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) | |
207 | } // if ((ct_BrowserDB->pTableInf+x)->pColInf) | |
208 | else | |
209 | Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1)); | |
b54f1155 MJ |
210 | z++; |
211 | if (z % 10 == 0) | |
212 | { | |
ca7408bd | 213 | Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d (from %d) has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z,ct_BrowserDB->numTables); |
b54f1155 MJ |
214 | pDoc->p_MainFrame->SetStatusText(Temp0, 0); |
215 | } | |
e8c6aabe MJ |
216 | } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW) |
217 | // else | |
218 | // wxLogMessage(_("\n-I-> if ! TABLE or VIEW >%s<"),(ct_BrowserDB->pTableInf+x)->tableType); | |
219 | } // for (x=0;x<ct_BrowserDB->numTables;x++) | |
220 | } // if (ct_BrowserDB) | |
b5ffecfc | 221 | else |
e8c6aabe MJ |
222 | wxLogMessage(_("\n-E-> DBTree::OnPopulate() : Invalid Catalog Pointer : Failed")); |
223 | wxEndBusyCursor(); | |
5aeda158 | 224 | Temp0.Printf(_("-I-> DBTree::OnPopulate() - %6d Tables have been read. - Time needed : %ld ms"),z,sw.Time()); |
897d36c2 | 225 | wxLogMessage(Temp0); |
b54f1155 | 226 | pDoc->p_MainFrame->SetStatusText(Temp0, 0); |
e8c6aabe MJ |
227 | } // if((pDoc->db_Br+i_Which)->Initialize(FALSE)) |
228 | else | |
229 | { | |
230 | wxLogMessage(_("\n-E-> DBTree::OnPopulate() : A valid Pointer could not be created : Failed")); | |
b5ce269b | 231 | return 0; |
e8c6aabe | 232 | } |
c92b0f9a | 233 | //--------------------------------------------------------------------------------------- |
e8c6aabe | 234 | Expand(Root); |
c92b0f9a | 235 | //--------------------------------------------------------------------------------------- |
e8c6aabe MJ |
236 | popupMenu1 = NULL; |
237 | popupMenu1 = new wxMenu(""); | |
238 | popupMenu1->Append(DATA_DB, _("Make wxDB.cpp/h ")); | |
239 | popupMenu1->AppendSeparator(); | |
240 | popupMenu1->Append(DATA_TABLE_ALL, _("Make all wxTable.cpp/h classes")); | |
241 | popupMenu2 = NULL; | |
242 | popupMenu2 = new wxMenu(""); | |
243 | popupMenu2->Append(DATA_SHOW, _("Show Data")); | |
244 | popupMenu2->AppendSeparator(); | |
245 | popupMenu2->Append(DATA_TABLE, _("Make wxTable.cpp/h ")); | |
c92b0f9a | 246 | //--------------------------------------------------------------------------------------- |
e8c6aabe | 247 | return 0; |
b5ffecfc | 248 | } |
c92b0f9a | 249 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
250 | void DBTree::OnSelChanged(wxTreeEvent& WXUNUSED(event)) |
251 | { | |
b5ce269b BJ |
252 | int i; |
253 | Temp0.Empty(); | |
254 | pDoc->p_MainFrame->SetStatusText(Temp0,0); | |
255 | // Get the Information that we need | |
256 | wxTreeItemId itemId = GetSelection(); | |
257 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
258 | if ( item != NULL ) | |
c92b0f9a MJ |
259 | { |
260 | int Treffer = 0; | |
261 | Temp1.Printf("%s",item->m_desc.c_str()); | |
262 | //------------------------------------------------------------------------------------- | |
263 | if (Temp1.Contains("ODBC-")) | |
264 | { | |
265 | Temp1 = Temp1.Mid(5,wxSTRING_MAXLEN); | |
266 | for (i=0;i<pDoc->i_DSN;i++) | |
267 | { | |
268 | if (Temp1 == (pDoc->p_DSN+i)->Dsn) | |
b5ffecfc | 269 | { |
c92b0f9a | 270 | // pDoc->OnChosenDSN(i); |
b5ffecfc | 271 | } |
c92b0f9a MJ |
272 | } |
273 | Treffer++; | |
274 | } | |
275 | //-------------------------------------------------------------------------------------- | |
276 | if (Treffer == 0) | |
277 | { | |
278 | //------------------------------------------------------------------------------------- | |
279 | /* | |
280 | Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," | |
281 | "%u children (%u immediately under this item)."), | |
282 | item->m_desc.c_str(), | |
283 | bool2String(IsSelected(itemId)), | |
284 | bool2String(IsExpanded(itemId)), | |
285 | bool2String(IsBold(itemId)), | |
286 | GetChildrenCount(itemId), | |
287 | GetChildrenCount(itemId)); | |
288 | LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); | |
289 | wxLogMessage( "%s", LogBuf.c_str() ); | |
290 | */ | |
291 | //------------------------------------------------------------------------------------- | |
292 | } | |
293 | } | |
b5ffecfc | 294 | } |
c92b0f9a | 295 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
296 | void DBTree::OnRightSelect(wxTreeEvent& WXUNUSED(event)) |
297 | { | |
c92b0f9a MJ |
298 | int i; |
299 | Temp0.Empty(); | |
300 | // Get the Information that we need | |
301 | wxTreeItemId itemId = GetSelection(); | |
302 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
303 | if ( item != NULL ) | |
304 | { | |
305 | int Treffer = 0; | |
306 | Temp1.Printf("%s",item->m_desc.c_str()); | |
307 | //-------------------------------------------------------------------------------------- | |
308 | if (!wxStrcmp("Root",Temp1)) | |
309 | { | |
310 | PopupMenu(popupMenu1,TreePos.x,TreePos.y); | |
311 | Treffer++; | |
312 | } | |
313 | for (i=0;i<ct_BrowserDB->numTables;i++) | |
314 | { | |
315 | Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName); | |
316 | if (!wxStrcmp(Temp2,Temp1)) | |
317 | { | |
318 | PopupMenu(popupMenu2,TreePos.x,TreePos.y); | |
319 | Treffer++; | |
320 | } | |
321 | } | |
322 | //-------------------------------------------------------------------------------------- | |
323 | if (Treffer == 0) | |
324 | { | |
325 | //------------------------------------------------------------------------------------- | |
326 | /* | |
327 | Temp0.Printf(_("Item '%s': %sselected, %sexpanded, %sbold," | |
328 | "%u children (%u immediately under this item)."), | |
329 | item->m_desc.c_str(), | |
330 | bool2String(IsSelected(itemId)), | |
331 | bool2String(IsExpanded(itemId)), | |
332 | bool2String(IsBold(itemId)), | |
333 | GetChildrenCount(itemId), | |
334 | GetChildrenCount(itemId)); | |
335 | LogBuf.Printf("-I-> DBTree::OnSelChanged - %s",Temp0.c_str()); | |
336 | wxLogMessage( "%s", LogBuf.c_str() ); | |
337 | */ | |
338 | //------------------------------------------------------------------------------------- | |
339 | } | |
340 | } | |
b5ffecfc | 341 | } |
c92b0f9a | 342 | //---------------------------------------------------------------------------------------- |
669f7a11 | 343 | void DBTree::OnDBGrid(wxCommandEvent& event) |
b5ffecfc | 344 | { |
c92b0f9a MJ |
345 | int i; |
346 | // Get the Information that we need | |
347 | wxTreeItemId itemId = GetSelection(); | |
348 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
349 | if ( item != NULL ) | |
350 | { | |
351 | Temp1.Printf("%s",item->m_desc.c_str()); | |
352 | for (i=0;i<ct_BrowserDB->numTables;i++) | |
353 | { | |
354 | Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName); | |
355 | if (!wxStrcmp(Temp2,Temp1)) | |
356 | { | |
357 | // Temp0.Printf("(%d) Here is where a GridCtrl for >%s< will be called! ",i,(ct_BrowserDB->pTableInf+i)->tableName); | |
358 | pDoc->OnChosenTbl(1,(ct_BrowserDB->pTableInf+i)->tableName); | |
359 | // wxMessageBox(Temp0); | |
360 | } | |
361 | } | |
362 | } | |
b5ffecfc | 363 | } |
c92b0f9a | 364 | //---------------------------------------------------------------------------------------- |
669f7a11 | 365 | void DBTree::OnDBClass(wxCommandEvent& event) |
b5ffecfc | 366 | { |
c92b0f9a MJ |
367 | // int i; |
368 | // Get the Information that we need | |
369 | wxTreeItemId itemId = GetSelection(); | |
370 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
371 | if ( item != NULL ) | |
372 | { | |
373 | Temp0.Printf(_("Here is where a wxDB Class for >%s< will be made! "),s_DSN.c_str()); | |
374 | wxMessageBox(Temp0); | |
375 | } | |
b5ffecfc | 376 | } |
c92b0f9a | 377 | //---------------------------------------------------------------------------------------- |
669f7a11 | 378 | void DBTree::OnTableClass(wxCommandEvent& event) |
b5ffecfc | 379 | { |
c92b0f9a MJ |
380 | int i; |
381 | // Get the Information that we need | |
382 | wxTreeItemId itemId = GetSelection(); | |
383 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
384 | if ( item != NULL ) | |
385 | { | |
386 | Temp1.Printf("%s",item->m_desc.c_str()); | |
387 | for (i=0;i<ct_BrowserDB->numTables;i++) | |
388 | { | |
389 | Temp2.Printf("TN(%s",(ct_BrowserDB->pTableInf+i)->tableName); | |
390 | if (!wxStrcmp(Temp2,Temp1)) | |
391 | { | |
392 | Temp0.Printf(_("(%d) Here is where a wxTable Class for >%s< will be made! "),i,(ct_BrowserDB->pTableInf+i)->tableName); | |
393 | wxMessageBox(Temp0); | |
394 | } | |
395 | } | |
396 | } | |
b5ffecfc | 397 | } |
c92b0f9a | 398 | //---------------------------------------------------------------------------------------- |
669f7a11 | 399 | void DBTree::OnTableClassAll(wxCommandEvent& event) |
b5ffecfc | 400 | { |
c92b0f9a MJ |
401 | // int i; |
402 | // Get the Information that we need | |
403 | wxTreeItemId itemId = GetSelection(); | |
404 | DBTreeData *item = (DBTreeData *)GetItemData(itemId); | |
405 | if ( item != NULL ) | |
406 | { | |
407 | Temp0.Printf(_("Here is where all wxTable Classes in >%s< will be made! "),s_DSN.c_str()); | |
408 | wxMessageBox(Temp0); | |
409 | } | |
b5ffecfc | 410 | } |
c92b0f9a | 411 | //---------------------------------------------------------------------------------------- |
b5ffecfc GT |
412 | void DBTree::OnMouseMove(wxMouseEvent &event) |
413 | { | |
c92b0f9a | 414 | TreePos = event.GetPosition(); |
b5ffecfc | 415 | } |
c92b0f9a | 416 | //---------------------------------------------------------------------------------------- |