1 /**********************************************************
2 * Version $Id$
3 *********************************************************/
4
5 ///////////////////////////////////////////////////////////
6 // //
7 // SAGA //
8 // //
9 // System for Automated Geoscientific Analyses //
10 // //
11 // User Interface //
12 // //
13 // Program: SAGA //
14 // //
15 //-------------------------------------------------------//
16 // //
17 // WKSP_Table_Manager.cpp //
18 // //
19 // Copyright (C) 2005 by Olaf Conrad //
20 // //
21 //-------------------------------------------------------//
22 // //
23 // This file is part of 'SAGA - System for Automated //
24 // Geoscientific Analyses'. SAGA is free software; you //
25 // can redistribute it and/or modify it under the terms //
26 // of the GNU General Public License as published by the //
27 // Free Software Foundation, either version 2 of the //
28 // License, or (at your option) any later version. //
29 // //
30 // SAGA is distributed in the hope that it will be //
31 // useful, but WITHOUT ANY WARRANTY; without even the //
32 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
33 // PARTICULAR PURPOSE. See the GNU General Public //
34 // License for more details. //
35 // //
36 // You should have received a copy of the GNU General //
37 // Public License along with this program; if not, see //
38 // <http://www.gnu.org/licenses/>. //
39 // //
40 //-------------------------------------------------------//
41 // //
42 // contact: Olaf Conrad //
43 // Institute of Geography //
44 // University of Goettingen //
45 // Goldschmidtstr. 5 //
46 // 37077 Goettingen //
47 // Germany //
48 // //
49 // e-mail: oconrad@saga-gis.org //
50 // //
51 ///////////////////////////////////////////////////////////
52
53 //---------------------------------------------------------
54
55
56 ///////////////////////////////////////////////////////////
57 // //
58 // //
59 // //
60 ///////////////////////////////////////////////////////////
61
62 //---------------------------------------------------------
63 #include <saga_api/saga_api.h>
64
65 #include "res_commands.h"
66
67 #include "wksp_data_manager.h"
68
69 #include "wksp_table_manager.h"
70 #include "wksp_table.h"
71
72
73 ///////////////////////////////////////////////////////////
74 // //
75 // //
76 // //
77 ///////////////////////////////////////////////////////////
78
79 //---------------------------------------------------------
CWKSP_Table_Manager(void)80 CWKSP_Table_Manager::CWKSP_Table_Manager(void)
81 {}
82
83
84 ///////////////////////////////////////////////////////////
85 // //
86 // //
87 // //
88 ///////////////////////////////////////////////////////////
89
90 //---------------------------------------------------------
Get_Name(void)91 wxString CWKSP_Table_Manager::Get_Name(void)
92 {
93 return( _TL("Tables") );
94 }
95
96 //---------------------------------------------------------
Get_Description(void)97 wxString CWKSP_Table_Manager::Get_Description(void)
98 {
99 wxString s;
100
101 s.Printf(wxT("<b>%s</b>: %d<br>"), _TL("Tables"), Get_Count());
102
103 return( s );
104 }
105
106 //---------------------------------------------------------
Get_Menu(void)107 wxMenu * CWKSP_Table_Manager::Get_Menu(void)
108 {
109 wxMenu *pMenu = new wxMenu(_TL("Tables"));
110
111 CMD_Menu_Add_Item(pMenu, false, ID_CMD_TABLE_OPEN);
112
113 if( Get_Count() > 0 )
114 {
115 CMD_Menu_Add_Item(pMenu, false, ID_CMD_WKSP_ITEM_CLOSE);
116 }
117
118 return( pMenu );
119 }
120
121
122 ///////////////////////////////////////////////////////////
123 // //
124 // //
125 // //
126 ///////////////////////////////////////////////////////////
127
128 //---------------------------------------------------------
Get_Data(CSG_Table * pObject)129 CWKSP_Table * CWKSP_Table_Manager::Get_Data(CSG_Table *pObject)
130 {
131 for(int i=0; i<Get_Count(); i++)
132 {
133 if( pObject == Get_Data(i)->Get_Object() )
134 {
135 return( Get_Data(i) );
136 }
137 }
138
139 return( NULL );
140 }
141
142 //---------------------------------------------------------
Add_Data(CSG_Table * pObject)143 CWKSP_Table * CWKSP_Table_Manager::Add_Data(CSG_Table *pObject)
144 {
145 CWKSP_Table *pItem = Get_Data(pObject);
146
147 if( pItem == NULL && pObject != NULL )
148 {
149 Add_Item(pItem = new CWKSP_Table(pObject));
150 }
151
152 return( pItem );
153 }
154
155
156 ///////////////////////////////////////////////////////////
157 // //
158 // //
159 // //
160 ///////////////////////////////////////////////////////////
161
162 //---------------------------------------------------------
163