1 | #include <stdio.h> |
---|
2 | #include <string.h> |
---|
3 | #include <arbdb.h> |
---|
4 | #include <arbdb++.hxx> |
---|
5 | #include <adtools.hxx> |
---|
6 | #include <aw_root.hxx> |
---|
7 | #include <aw_device.hxx> |
---|
8 | #include <aw_window.hxx> |
---|
9 | #include <edit.hxx> |
---|
10 | |
---|
11 | /***************************************************************************************************************************/ |
---|
12 | /***************************************************************************************************************************/ |
---|
13 | /***************************************************************************************************************************/ |
---|
14 | |
---|
15 | void aed_left_name( class AED_window *aedw, AED_area_entry *area_entry, char *text ) { |
---|
16 | AWUSE(aedw); |
---|
17 | |
---|
18 | if ( area_entry ) { |
---|
19 | if (area_entry->ad_extended) { |
---|
20 | sprintf( text, "#%10s# ",area_entry->ad_species->name()); |
---|
21 | }else{ |
---|
22 | sprintf( text, ">%10s< ",area_entry->ad_species->name()); |
---|
23 | } |
---|
24 | }else { |
---|
25 | sprintf( text, ">- noname -< "); |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | void aed_left_security( class AED_window *aedw, AED_area_entry *area_entry, char *text ) { |
---|
30 | AWUSE(aedw); |
---|
31 | |
---|
32 | if ( area_entry && area_entry->adt_sequence) { |
---|
33 | GBDATA *gbd = area_entry->adt_sequence->get_GBDATA(); |
---|
34 | if (gbd) { |
---|
35 | GBDATA *gb_root = GB_get_root(gbd); |
---|
36 | GB_push_local_transaction(gb_root); // very dangerous |
---|
37 | gbd = area_entry->adt_sequence->get_GBDATA(); |
---|
38 | if (gbd){ |
---|
39 | if (GB_read_flag(area_entry->ad_species->get_GBDATA())) { |
---|
40 | sprintf( text, "* %i ", GB_read_security_write(gbd)); |
---|
41 | }else{ |
---|
42 | sprintf( text, " %i ", GB_read_security_write(gbd)); |
---|
43 | } |
---|
44 | }else{ |
---|
45 | sprintf( text, "0 "); |
---|
46 | } |
---|
47 | GB_pop_local_transaction(gb_root); |
---|
48 | return; |
---|
49 | } |
---|
50 | } |
---|
51 | sprintf( text, "0 "); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | void aed_left_zwei( class AED_window *aedw, AED_area_entry *area_entry, char *text ) { |
---|
56 | aedw=aedw;area_entry=area_entry; |
---|
57 | |
---|
58 | strcpy( text, "GC-Verhaeltnis " ); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | void aed_left_drei( class AED_window *aedw, AED_area_entry *area_entry, char *text ) { |
---|
63 | aedw=aedw;area_entry=area_entry; |
---|
64 | |
---|
65 | strcpy( text, "Art " ); |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | void aed_left_vier( class AED_window *aedw, AED_area_entry *area_entry, char *text ) { |
---|
70 | aedw=aedw;area_entry=area_entry; |
---|
71 | |
---|
72 | strcpy( text, "unwichtig " ); |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | void show_config_window_draw_area(AW_device *device, AED_window *aedw, AW_pos slider_pos_horizontal, AW_pos slider_pos_vertical, AW_pos picture_l, int top_indent_of_vertical_scrollbar ) { |
---|
78 | char text[100]; |
---|
79 | AW_pos y; |
---|
80 | AW_pos right_offset = 200; |
---|
81 | AED_left_side *current_entry_of_dlist; |
---|
82 | AW_rectangle screen; |
---|
83 | AW_pos width, height; |
---|
84 | AW_font_information *font_information; |
---|
85 | int counter = 1; |
---|
86 | int gc1 = 0; |
---|
87 | int gc2 = 1; |
---|
88 | |
---|
89 | font_information = device->get_font_information(gc1, 'A'); |
---|
90 | device->get_area_size( &screen ); |
---|
91 | |
---|
92 | device->shift_x( 0 ); |
---|
93 | device->shift_y( 0 ); |
---|
94 | device->line( gc2, 0, 19, screen.r, 19, AED_F_INFO_SEPARATOR, 0, 0 ); // Linie horizontal |
---|
95 | device->shift_x( 0 - slider_pos_horizontal ); |
---|
96 | device->shift_y( 0 ); |
---|
97 | device->text( gc2, "Sichtbar", 75, 15, 0.0, AED_F_TEXT_2, 0, 0 ); |
---|
98 | device->text( gc2, "Unsichtbar", 75+right_offset, 15, 0.0, AED_F_TEXT_2, 0, 0 ); |
---|
99 | device->line( gc2, right_offset, 0, right_offset, screen.b, AED_F_INFO_SEPARATOR, 0, 0 ); // Linie vertikal |
---|
100 | |
---|
101 | y = top_indent_of_vertical_scrollbar; |
---|
102 | device->invisible( 1, 0, y, AED_F_TEXT_1, (AW_CL)0, (AW_CL)0 ); |
---|
103 | device->invisible( 1, 290, y, AED_F_TEXT_1, (AW_CL)0, (AW_CL)0 ); |
---|
104 | |
---|
105 | current_entry_of_dlist = aedw->show_dlist_left_side->first; |
---|
106 | while ( current_entry_of_dlist ) { |
---|
107 | sprintf( text, "%i: %s ", counter++, current_entry_of_dlist->text ); |
---|
108 | strcpy( current_entry_of_dlist->text_for_dragging, text ); |
---|
109 | |
---|
110 | device->push_clip_scale(); |
---|
111 | |
---|
112 | device->get_area_size( &screen ); |
---|
113 | |
---|
114 | device->shift_x( 0 - picture_l - slider_pos_horizontal ); |
---|
115 | device->shift_y( 0 - slider_pos_vertical ); |
---|
116 | device->set_top_clip_border( top_indent_of_vertical_scrollbar ); |
---|
117 | |
---|
118 | y += AED_LINE_SPACING + font_information->max_letter_ascent; |
---|
119 | |
---|
120 | current_entry_of_dlist->absolut_x = 4 - picture_l - slider_pos_horizontal; |
---|
121 | current_entry_of_dlist->absolut_y = y - slider_pos_vertical; |
---|
122 | |
---|
123 | if( !current_entry_of_dlist->is_selected ) { |
---|
124 | device->text( gc1, text, 4, y , 0.0, AED_F_TEXT_1, (AW_CL)current_entry_of_dlist, (AW_CL)0 ); |
---|
125 | } |
---|
126 | else { |
---|
127 | AW_pos help_y = y + font_information->max_letter_descent + 1; |
---|
128 | |
---|
129 | width = strlen( text ) * font_information->max_letter_width + 4; |
---|
130 | height = font_information->max_letter_height + 2; |
---|
131 | |
---|
132 | device->text( gc2, text, 4, y, 0.0, AED_F_TEXT_1, (AW_CL)current_entry_of_dlist, AED_F_NAME ); |
---|
133 | |
---|
134 | device->line( gc2, 2, help_y, 2+width, help_y, AED_F_FRAME, (AW_CL)"box", 0 ); // unten |
---|
135 | device->line( gc2, 2, help_y, 2, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // links |
---|
136 | device->line( gc2, 2+width, help_y, 2+width, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // rechts |
---|
137 | device->line( gc2, 2, help_y-height, 2+width, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // oben |
---|
138 | } |
---|
139 | |
---|
140 | device->pop_clip_scale(); |
---|
141 | |
---|
142 | y += 2.0 + font_information->max_letter_descent; |
---|
143 | |
---|
144 | current_entry_of_dlist = current_entry_of_dlist->next; |
---|
145 | } |
---|
146 | |
---|
147 | |
---|
148 | y = top_indent_of_vertical_scrollbar; |
---|
149 | current_entry_of_dlist = aedw->hide_dlist_left_side->first; |
---|
150 | while ( current_entry_of_dlist ) { |
---|
151 | sprintf( text, "%s ", current_entry_of_dlist->text ); |
---|
152 | strcpy( current_entry_of_dlist->text_for_dragging, text ); |
---|
153 | |
---|
154 | device->push_clip_scale(); |
---|
155 | |
---|
156 | device->get_area_size( &screen ); |
---|
157 | |
---|
158 | device->shift_x( 0 - picture_l - slider_pos_horizontal ); |
---|
159 | device->shift_y( 0 - slider_pos_vertical ); |
---|
160 | device->set_top_clip_border( top_indent_of_vertical_scrollbar ); |
---|
161 | |
---|
162 | y += AED_LINE_SPACING + font_information->max_letter_ascent; |
---|
163 | |
---|
164 | current_entry_of_dlist->absolut_x = 4+right_offset - picture_l - slider_pos_horizontal; |
---|
165 | current_entry_of_dlist->absolut_y = y - slider_pos_vertical; |
---|
166 | |
---|
167 | if( !current_entry_of_dlist->is_selected ) { |
---|
168 | device->text( gc1, text, 4+right_offset, y , 0.0, AED_F_TEXT_1, (AW_CL)current_entry_of_dlist, (AW_CL)0 ); |
---|
169 | } |
---|
170 | else { |
---|
171 | AW_pos help_y = y + font_information->max_letter_descent + 1; |
---|
172 | |
---|
173 | width = strlen( text ) * font_information->max_letter_width + 4; |
---|
174 | height = font_information->max_letter_height + 2; |
---|
175 | |
---|
176 | device->text( gc2, text, 4+right_offset, y, 0.0, AED_F_TEXT_1, (AW_CL)current_entry_of_dlist, AED_F_NAME ); |
---|
177 | |
---|
178 | device->line( gc2, 2+right_offset, help_y, 2+right_offset+width, help_y, AED_F_FRAME, (AW_CL)"box", 0 ); // unten |
---|
179 | device->line( gc2, 2+right_offset, help_y, 2+right_offset, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // links |
---|
180 | device->line( gc2, 2+right_offset+width, help_y, 2+right_offset+width, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // rechts |
---|
181 | device->line( gc2, 2+right_offset, help_y-height, 2+right_offset+width, help_y-height, AED_F_FRAME, (AW_CL)"box", 0 ); // oben |
---|
182 | } |
---|
183 | |
---|
184 | device->pop_clip_scale(); |
---|
185 | |
---|
186 | y += 2.0 + font_information->max_letter_descent; |
---|
187 | |
---|
188 | current_entry_of_dlist = current_entry_of_dlist->next; |
---|
189 | } |
---|
190 | |
---|
191 | } |
---|
192 | |
---|
193 | |
---|
194 | void aed_config_window_expose(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
195 | AWUSE(aw);AWUSE(cd2); |
---|
196 | AED_window *aedw = (AED_window *)cd1; |
---|
197 | AW_device *device; |
---|
198 | |
---|
199 | device = aedw->config_window->get_device (AW_MIDDLE_AREA ); |
---|
200 | device->set_filter(AED_F_ALL); |
---|
201 | |
---|
202 | device->clear( ); |
---|
203 | show_config_window_draw_area( device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
204 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
205 | |
---|
206 | } |
---|
207 | |
---|
208 | |
---|
209 | void aed_config_window_resize(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
210 | AWUSE(aw);AWUSE(cd2); |
---|
211 | AED_window *aedw = (AED_window *)cd1; |
---|
212 | AW_device *device; |
---|
213 | AW_device *size_device; |
---|
214 | AW_world size_information; |
---|
215 | |
---|
216 | device = aedw->config_window->get_device (AW_MIDDLE_AREA ); |
---|
217 | device->set_filter(AED_F_ALL); |
---|
218 | device->reset(); |
---|
219 | size_device = aedw->config_window->get_size_device (AW_MIDDLE_AREA ); |
---|
220 | size_device->set_filter(AED_F_ALL); |
---|
221 | size_device->reset(); |
---|
222 | |
---|
223 | size_device = aedw->config_window->get_size_device (AW_MIDDLE_AREA ); |
---|
224 | size_device->set_filter(AED_F_TEXT_1); |
---|
225 | show_config_window_draw_area( size_device, aedw, 0, 0, 0, 0 ); |
---|
226 | size_device->get_size_information( &size_information ); |
---|
227 | aedw->config_window->tell_scrolled_picture_size( size_information ); |
---|
228 | aedw->config_window->calculate_scrollbars(); |
---|
229 | } |
---|
230 | |
---|
231 | |
---|
232 | void aed_config_window_input(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
233 | AWUSE(cd2); |
---|
234 | AED_window *aedw = (AED_window *)cd1; |
---|
235 | AW_event event; |
---|
236 | AW_device *device; |
---|
237 | AW_device *click_device; |
---|
238 | AW_device *size_device; |
---|
239 | AW_clicked_text clicked_text; |
---|
240 | AW_world size_information; |
---|
241 | AED_left_side *left_side_hit; |
---|
242 | AED_left_side *left_side_destination; |
---|
243 | AW_BOOL update_other_windows = AW_FALSE; |
---|
244 | |
---|
245 | aw->get_event( &event ); |
---|
246 | |
---|
247 | device = aw->get_device (AW_MIDDLE_AREA ); |
---|
248 | device->set_filter(AED_F_ALL); |
---|
249 | click_device = aw->get_click_device (AW_MIDDLE_AREA, event.x, event.y, 0, 10, 0 ); |
---|
250 | click_device->set_filter(AED_F_TEXT_1); |
---|
251 | |
---|
252 | if ( event.type == AW_Mouse_Press ) { |
---|
253 | show_config_window_draw_area( click_device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
254 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
255 | click_device->get_clicked_text( &clicked_text ); |
---|
256 | |
---|
257 | if ( clicked_text.exists == AW_TRUE ) { |
---|
258 | left_side_hit = (AED_left_side *)clicked_text.client_data1; |
---|
259 | if ( aedw->one_entry_dlist_left_side_is_selected ) |
---|
260 | aedw->selected_entry_of_dlist_left_side->is_selected = AW_FALSE; |
---|
261 | else |
---|
262 | aedw->one_entry_dlist_left_side_is_selected = AW_TRUE; |
---|
263 | left_side_hit->is_selected = AW_TRUE; |
---|
264 | aedw->selected_entry_of_dlist_left_side = left_side_hit; |
---|
265 | |
---|
266 | device->clear( ); |
---|
267 | show_config_window_draw_area( device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
268 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
269 | } |
---|
270 | } |
---|
271 | |
---|
272 | if ( event.type == AW_Mouse_Release ) { |
---|
273 | if( aedw->drag ) { |
---|
274 | aedw->drag = AW_FALSE; |
---|
275 | drag_box( device, 2, aedw->drag_x - aedw->drag_x_correcting, aedw->drag_y - aedw->drag_y_correcting, 0, 0, aedw->selected_entry_of_dlist_left_side->text_for_dragging ); |
---|
276 | show_config_window_draw_area( click_device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
277 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
278 | |
---|
279 | click_device->get_clicked_text( &clicked_text ); |
---|
280 | if ( clicked_text.exists ) { |
---|
281 | left_side_destination = (AED_left_side *)clicked_text.client_data1; |
---|
282 | if ( left_side_destination != aedw->selected_entry_of_dlist_left_side ) { // man beendet den drag nicht auf sich selbst |
---|
283 | |
---|
284 | aedw->selected_entry_of_dlist_left_side->in_side->remove_entry( aedw->selected_entry_of_dlist_left_side ); |
---|
285 | |
---|
286 | if( clicked_text.distance > 0 ) |
---|
287 | left_side_destination->in_side->insert_after_entry( left_side_destination, aedw->selected_entry_of_dlist_left_side ); |
---|
288 | else |
---|
289 | left_side_destination->in_side->insert_before_entry( left_side_destination, aedw->selected_entry_of_dlist_left_side ); |
---|
290 | aedw->selected_entry_of_dlist_left_side->in_side = left_side_destination->in_side; |
---|
291 | update_other_windows = AW_TRUE; |
---|
292 | } |
---|
293 | } |
---|
294 | else { |
---|
295 | if ( event.x > ( 200 - aedw->config_window->slider_pos_horizontal ) ) { |
---|
296 | if ( aedw->selected_entry_of_dlist_left_side->in_side == aedw->show_dlist_left_side ) { |
---|
297 | aedw->show_dlist_left_side->remove_entry( aedw->selected_entry_of_dlist_left_side ); |
---|
298 | aedw->hide_dlist_left_side->append( aedw->selected_entry_of_dlist_left_side ); |
---|
299 | aedw->selected_entry_of_dlist_left_side->in_side = aedw->hide_dlist_left_side; |
---|
300 | update_other_windows = AW_TRUE; |
---|
301 | } |
---|
302 | else { |
---|
303 | aedw->hide_dlist_left_side->remove_entry( aedw->selected_entry_of_dlist_left_side ); |
---|
304 | aedw->hide_dlist_left_side->append( aedw->selected_entry_of_dlist_left_side ); |
---|
305 | update_other_windows = AW_TRUE; |
---|
306 | } |
---|
307 | } |
---|
308 | else { |
---|
309 | if ( aedw->selected_entry_of_dlist_left_side->in_side == aedw->hide_dlist_left_side ) { |
---|
310 | aedw->hide_dlist_left_side->remove_entry( aedw->selected_entry_of_dlist_left_side ); |
---|
311 | aedw->show_dlist_left_side->append( aedw->selected_entry_of_dlist_left_side ); |
---|
312 | aedw->selected_entry_of_dlist_left_side->in_side = aedw->show_dlist_left_side; |
---|
313 | update_other_windows = AW_TRUE; |
---|
314 | } |
---|
315 | else { |
---|
316 | aedw->show_dlist_left_side->remove_entry( aedw->selected_entry_of_dlist_left_side ); |
---|
317 | aedw->show_dlist_left_side->append( aedw->selected_entry_of_dlist_left_side ); |
---|
318 | update_other_windows = AW_TRUE; |
---|
319 | } |
---|
320 | } |
---|
321 | } |
---|
322 | if ( update_other_windows ) { |
---|
323 | |
---|
324 | size_device = aedw->config_window->get_size_device (AW_MIDDLE_AREA ); |
---|
325 | size_device->set_filter(AED_F_TEXT_1); |
---|
326 | show_config_window_draw_area( size_device, aedw, 0, 0, 0, 0 ); |
---|
327 | size_device->get_size_information( &size_information ); |
---|
328 | aedw->config_window->tell_scrolled_picture_size( size_information ); |
---|
329 | aedw->config_window->calculate_scrollbars(); |
---|
330 | |
---|
331 | device->clear( ); |
---|
332 | show_config_window_draw_area( device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
333 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
334 | aed_resize( (AW_window *)aedw->aww, (AW_CL)aedw, (AW_CL)0 ); |
---|
335 | } |
---|
336 | } |
---|
337 | } |
---|
338 | |
---|
339 | |
---|
340 | } |
---|
341 | |
---|
342 | |
---|
343 | void aed_config_window_motion(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
344 | AWUSE(cd2); |
---|
345 | AED_window *aedw = (AED_window *)cd1; |
---|
346 | AW_event event; |
---|
347 | AW_event motion_event; |
---|
348 | AW_device *device; |
---|
349 | AW_device *click_device; |
---|
350 | // AW_window *awmm = aedw->aww; |
---|
351 | AW_clicked_text clicked_text; |
---|
352 | AW_rectangle screen; |
---|
353 | |
---|
354 | device = aw->get_device (AW_MIDDLE_AREA ); |
---|
355 | device->set_filter(AED_F_ALL); |
---|
356 | device->get_area_size( &screen ); |
---|
357 | |
---|
358 | if ( aedw->drag ) { // mitten im dragging |
---|
359 | aw->get_event ( &motion_event ); |
---|
360 | device->shift_y( 0 ); |
---|
361 | device->shift_x( 0 ); |
---|
362 | drag_box( device, 2, aedw->drag_x - aedw->drag_x_correcting, aedw->drag_y - aedw->drag_y_correcting, 0, 0, aedw->selected_entry_of_dlist_left_side->text_for_dragging ); |
---|
363 | |
---|
364 | if( motion_event.y < 20 ) |
---|
365 | motion_event.y = 20; |
---|
366 | if ( motion_event.y > screen.b ) |
---|
367 | motion_event.y = screen.b; |
---|
368 | if( motion_event.x < 0 ) |
---|
369 | motion_event.x = 0; |
---|
370 | if( motion_event.x > screen.r ) |
---|
371 | motion_event.x = screen.r; |
---|
372 | aedw->drag_x = motion_event.x; |
---|
373 | aedw->drag_y = motion_event.y; |
---|
374 | |
---|
375 | drag_box( device, 2, motion_event.x - aedw->drag_x_correcting, motion_event.y - aedw->drag_y_correcting, 0, 0, aedw->selected_entry_of_dlist_left_side->text_for_dragging ); |
---|
376 | } |
---|
377 | |
---|
378 | if( !aedw->drag ) { // Beginn des draggings |
---|
379 | aw->get_event( &event ); |
---|
380 | |
---|
381 | click_device = aw->get_click_device (AW_MIDDLE_AREA, event.x, event.y, 0, 0, 0 ); |
---|
382 | click_device->set_filter(AED_F_TEXT_1); |
---|
383 | show_config_window_draw_area( click_device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
384 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
385 | click_device->get_clicked_text( &clicked_text ); |
---|
386 | |
---|
387 | if( clicked_text.exists && (AED_left_side *)clicked_text.client_data1 == aedw->selected_entry_of_dlist_left_side ) { |
---|
388 | aedw->drag = AW_TRUE; |
---|
389 | aw->get_event ( &motion_event ); |
---|
390 | aedw->drag_x_correcting = event.x - aedw->selected_entry_of_dlist_left_side->absolut_x; |
---|
391 | aedw->drag_y_correcting = event.y - aedw->selected_entry_of_dlist_left_side->absolut_y; |
---|
392 | device->shift_y( 0 ); |
---|
393 | device->shift_x( 0 ); |
---|
394 | drag_box( device, 2, motion_event.x - aedw->drag_x_correcting, motion_event.y - aedw->drag_y_correcting, 0, 0, aedw->selected_entry_of_dlist_left_side->text_for_dragging ); |
---|
395 | aedw->drag_x = motion_event.x; |
---|
396 | aedw->drag_y = motion_event.y; |
---|
397 | } |
---|
398 | } |
---|
399 | } |
---|
400 | |
---|
401 | |
---|
402 | void aed_config_window_horizontal_scroll(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
403 | AWUSE(aw);AWUSE(cd2); |
---|
404 | AED_window *aedw = (AED_window *)cd1; |
---|
405 | AW_device *device; |
---|
406 | |
---|
407 | device = aedw->config_window->get_device (AW_MIDDLE_AREA ); |
---|
408 | device->set_filter(AED_F_ALL); |
---|
409 | |
---|
410 | device->clear( ); |
---|
411 | show_config_window_draw_area( device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
412 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
413 | } |
---|
414 | |
---|
415 | |
---|
416 | void aed_config_window_vertical_scroll(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
417 | AWUSE(aw);AWUSE(cd2); |
---|
418 | AED_window *aedw = (AED_window *)cd1; |
---|
419 | AW_device *device; |
---|
420 | |
---|
421 | device = aedw->config_window->get_device (AW_MIDDLE_AREA ); |
---|
422 | device->set_filter(AED_F_ALL); |
---|
423 | |
---|
424 | device->clear( ); |
---|
425 | show_config_window_draw_area( device, aedw, aedw->config_window->slider_pos_horizontal, aedw->config_window->slider_pos_vertical, |
---|
426 | aedw->config_window->picture->l, aedw->config_window->top_indent_of_vertical_scrollbar ); |
---|
427 | } |
---|
428 | |
---|
429 | |
---|
430 | void aed_config_window_expose_info_area(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
431 | AWUSE(aw);AWUSE(cd2); |
---|
432 | AED_window *aedw = (AED_window *)cd1; |
---|
433 | AW_device *info_device; |
---|
434 | |
---|
435 | info_device = aedw->config_window->get_device (AW_INFO_AREA ); |
---|
436 | info_device->set_filter(AED_F_ALL); |
---|
437 | info_device->clear( ); |
---|
438 | info_device->shift_y( 0 ); |
---|
439 | info_device->shift_x( 0 ); |
---|
440 | info_device->text( 1, "Anleitung 1", 4, 20, 0.0, AED_F_INFO, (AW_CL)0, (AW_CL)0 ); |
---|
441 | info_device->text( 1, "Anleitung 2", 4, 36, 0.0, AED_F_INFO, (AW_CL)0, (AW_CL)0 ); |
---|
442 | } |
---|
443 | |
---|
444 | |
---|
445 | |
---|
446 | void aed_config_window_popdown(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
447 | AWUSE(aw);AWUSE(cd2); |
---|
448 | AED_window *aedw = (AED_window *)cd1; |
---|
449 | |
---|
450 | aedw->config_window->hide(); |
---|
451 | } |
---|
452 | |
---|
453 | |
---|
454 | void aed_config_1(AW_window *aw, AW_CL /*cd1*/, AW_CL /*cd2*/) { |
---|
455 | // AED_window *aedw = (AED_window *)cd1; |
---|
456 | aw->set_info_area_height(100); |
---|
457 | } |
---|
458 | |
---|
459 | |
---|
460 | void aed_popup_config_window(AW_window *aw, AW_CL cd1, AW_CL cd2) { |
---|
461 | AWUSE(aw);AWUSE(cd2); |
---|
462 | AED_window *aedw = (AED_window *)cd1; |
---|
463 | AW_device *device; |
---|
464 | AW_device *click_device; |
---|
465 | AW_device *info_device; |
---|
466 | AW_device *size_device; |
---|
467 | AW_world size_information; |
---|
468 | |
---|
469 | if ( aedw->config_window_created ) { |
---|
470 | aedw->config_window->show(); |
---|
471 | } |
---|
472 | else { |
---|
473 | aedw->config_window = new AW_window_menu(); |
---|
474 | aedw->config_window_created = AW_TRUE; |
---|
475 | |
---|
476 | aedw->config_window->init(aedw->root->aw_root,"EDIT_CONFIG", "ARB_EDIT_CONFIG",200,200,20,600); |
---|
477 | aedw->config_window->create_menu( "1", "Window", "W", "no help", AWM_ALL ); |
---|
478 | aedw->config_window->insert_menu_topic( "1.1", "hide", "h", "no help", AWM_ALL, aed_config_window_popdown, (AW_CL)aedw, (AW_CL)0 ); |
---|
479 | aedw->config_window->insert_menu_topic( "1.1", "bigger info", "h", "no help", AWM_ALL, aed_config_1, (AW_CL)aedw, (AW_CL)0 ); |
---|
480 | |
---|
481 | |
---|
482 | aedw->config_window->set_expose_callback (AW_MIDDLE_AREA, aed_config_window_expose, (AW_CL)aedw, 0 ); |
---|
483 | aedw->config_window->set_resize_callback (AW_MIDDLE_AREA, aed_config_window_resize, (AW_CL)aedw, 0 ); |
---|
484 | aedw->config_window->set_input_callback (AW_MIDDLE_AREA, aed_config_window_input, (AW_CL)aedw, 0 ); |
---|
485 | aedw->config_window->set_motion_callback (AW_MIDDLE_AREA, aed_config_window_motion, (AW_CL)aedw, 0 ); |
---|
486 | aedw->config_window->set_vertical_change_callback( aed_config_window_vertical_scroll, (AW_CL)aedw, 0 ); |
---|
487 | aedw->config_window->set_horizontal_change_callback( aed_config_window_horizontal_scroll, (AW_CL)aedw, 0 ); |
---|
488 | aedw->config_window->set_expose_callback (AW_INFO_AREA, aed_config_window_expose_info_area, (AW_CL)aedw, 0 ); |
---|
489 | |
---|
490 | |
---|
491 | device = aedw->config_window->get_device (AW_MIDDLE_AREA ); |
---|
492 | device->set_filter(AED_F_ALL); |
---|
493 | aed_initialize_device( device ); |
---|
494 | |
---|
495 | click_device = aedw->config_window->get_click_device (AW_MIDDLE_AREA,0,0,0,0,0); |
---|
496 | aed_initialize_device(click_device); |
---|
497 | |
---|
498 | info_device = aedw->config_window->get_device (AW_INFO_AREA ); |
---|
499 | aed_initialize_device( info_device ); |
---|
500 | |
---|
501 | size_device = aedw->config_window->get_size_device (AW_MIDDLE_AREA ); |
---|
502 | aed_initialize_device( size_device ); |
---|
503 | |
---|
504 | |
---|
505 | aedw->config_window->set_vertical_scrollbar_top_indent( 20 ); |
---|
506 | |
---|
507 | device->set_foreground_color( 2, AW_WINDOW_FG ); |
---|
508 | |
---|
509 | aedw->config_window->at ( 15, 15 ); |
---|
510 | aedw->config_window->callback ( aed_config_window_popdown, (AW_CL)aedw, (AW_CL)0 ); |
---|
511 | aedw->config_window->create_button( "CLOSE", "DONE", "D" ); |
---|
512 | |
---|
513 | aedw->config_window->set_info_area_height( 100 ); |
---|
514 | aedw->config_window->set_info_area_height( 0 ); |
---|
515 | aedw->config_window->set_bottom_area_height( 0 ); |
---|
516 | |
---|
517 | size_device = aedw->config_window->get_size_device (AW_MIDDLE_AREA ); |
---|
518 | size_device->set_filter(AED_F_TEXT_1); |
---|
519 | show_config_window_draw_area( size_device, aedw, 0, 0, 0, 0 ); |
---|
520 | size_device->get_size_information( &size_information ); |
---|
521 | aedw->config_window->tell_scrolled_picture_size( size_information ); |
---|
522 | aedw->config_window->calculate_scrollbars(); |
---|
523 | |
---|
524 | |
---|
525 | |
---|
526 | aedw->config_window->show(); |
---|
527 | |
---|
528 | } |
---|
529 | |
---|
530 | } |
---|
531 | |
---|
532 | |
---|
533 | AED_left_side::AED_left_side( void(*f)(class AED_window *, AED_area_entry *area_entry, char *text), const char *string ) { |
---|
534 | is_selected = AW_FALSE; |
---|
535 | previous = NULL; |
---|
536 | next = NULL; |
---|
537 | text = new char[(strlen(string)+1)]; |
---|
538 | strcpy( text, string ); |
---|
539 | make_text = f; |
---|
540 | } |
---|
541 | |
---|
542 | |
---|
543 | AED_left_side::~AED_left_side() { |
---|
544 | delete text; |
---|
545 | } |
---|
546 | |
---|
547 | |
---|
548 | void AED_dlist_left_side::remove_entry(AED_left_side *to_be_removed) { |
---|
549 | if ( first == to_be_removed ) { |
---|
550 | if(to_be_removed->next) { |
---|
551 | first = to_be_removed->next; |
---|
552 | to_be_removed->next->previous = NULL; |
---|
553 | } |
---|
554 | else |
---|
555 | first = NULL; |
---|
556 | } |
---|
557 | else { |
---|
558 | to_be_removed->previous->next = to_be_removed->next; |
---|
559 | if(to_be_removed->next) |
---|
560 | to_be_removed->next->previous = to_be_removed->previous; |
---|
561 | } |
---|
562 | if( last == to_be_removed ) { |
---|
563 | if( to_be_removed->previous ) |
---|
564 | last = to_be_removed->previous; |
---|
565 | else |
---|
566 | last = NULL; |
---|
567 | } |
---|
568 | size--; |
---|
569 | } |
---|
570 | |
---|
571 | |
---|
572 | void AED_dlist_left_side::insert_after_entry(AED_left_side *add_after_this, AED_left_side *to_be_inserted) { |
---|
573 | if( last == add_after_this ) |
---|
574 | last = to_be_inserted; |
---|
575 | to_be_inserted->next = add_after_this->next; |
---|
576 | to_be_inserted->previous = add_after_this; |
---|
577 | if ( add_after_this->next ) |
---|
578 | add_after_this->next->previous = to_be_inserted; |
---|
579 | add_after_this->next = to_be_inserted; |
---|
580 | |
---|
581 | size++; |
---|
582 | } |
---|
583 | |
---|
584 | |
---|
585 | void AED_dlist_left_side::insert_before_entry(AED_left_side *add_before_this, AED_left_side *to_be_inserted) { |
---|
586 | |
---|
587 | if( (add_before_this)->previous ) |
---|
588 | (add_before_this)->previous->next = to_be_inserted; |
---|
589 | else |
---|
590 | first = to_be_inserted; |
---|
591 | to_be_inserted->next = add_before_this; |
---|
592 | to_be_inserted->previous = add_before_this->previous; |
---|
593 | add_before_this->previous = to_be_inserted; |
---|
594 | |
---|
595 | size++; |
---|
596 | } |
---|
597 | |
---|
598 | |
---|
599 | void AED_dlist_left_side::append(AED_left_side *to_be_inserted) { |
---|
600 | |
---|
601 | if(last) { |
---|
602 | last->next = to_be_inserted; |
---|
603 | to_be_inserted->previous = last; |
---|
604 | to_be_inserted->next = NULL; |
---|
605 | } |
---|
606 | else { |
---|
607 | first = last = to_be_inserted; |
---|
608 | to_be_inserted->previous = NULL; |
---|
609 | to_be_inserted->next = NULL; |
---|
610 | } |
---|
611 | last = to_be_inserted; |
---|
612 | size++; |
---|
613 | } |
---|