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