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