Changeset 6675
- Timestamp:
- 02/06/10 09:01:31 (2 years ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 9 modified
-
NTREE/ad_spec.cxx (modified) (1 diff)
-
WINDOW/AW_button.cxx (modified) (17 diffs)
-
WINDOW/AW_nawar.cxx (modified) (3 diffs)
-
WINDOW/AW_window.cxx (modified) (9 diffs)
-
WINDOW/Makefile (modified) (3 diffs)
-
WINDOW/aw_awar.hxx (deleted)
-
WINDOW/aw_nawar.hxx (modified) (1 diff)
-
WINDOW/aw_root.hxx (modified) (8 diffs)
-
WINDOW/aw_window.hxx (modified) (1 diff)
-
WINDOW/aw_window_Xm.hxx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/NTREE/ad_spec.cxx
r6656 r6675 1175 1175 1176 1176 cb_info->remap(new_awar); // remap the callback from old awar to new unique awar 1177 aww->update_label( (int*)di->get_detach_button(), "GET");1177 aww->update_label(di->get_detach_button(), "GET"); 1178 1178 1179 1179 *aww_pointer = 0; // caller window will be recreated on next open after clearing this pointer -
trunk/WINDOW/AW_button.cxx
r6584 r6675 15 15 #include "aw_size.hxx" 16 16 #include "aw_select.hxx" 17 #include "aw_ awar.hxx"17 #include "aw_nawar.hxx" 18 18 #include "aw_window_Xm.hxx" 19 19 … … 39 39 #endif // DEBUG 40 40 41 static void aw_cp_awar_2_widget_cb(AW_root *root, AW_widget_list_for_variable *widgetlist) { 42 if (widgetlist->widget == (int *)root->changer_of_variable) { 41 struct AW_widget_refresh_cb { 42 AW_widget_refresh_cb(AW_widget_refresh_cb *previous, AW_awar *vs, AW_CL cd1, Widget w, AW_widget_type type, AW_window *awi); 43 ~AW_widget_refresh_cb(); 44 45 AW_CL cd; 46 AW_awar *awar; 47 Widget widget; 48 AW_widget_type widget_type; 49 AW_window *aw; 50 51 AW_widget_refresh_cb *next; 52 }; 53 54 static void aw_cp_awar_2_widget_cb(AW_root *root, AW_CL cl_widget_refresh_cb) { 55 AW_widget_refresh_cb *widgetlist = (AW_widget_refresh_cb*)cl_widget_refresh_cb; 56 if (widgetlist->widget == root->changer_of_variable) { 43 57 root->changer_of_variable = 0; 44 58 root->value_changed = false; … … 81 95 } 82 96 83 84 AW_widget_list_for_variable::AW_widget_list_for_variable(AW_awar *vs, AW_CL cd1, int *widgeti, AW_widget_type type, AW_window *awi) { 97 AW_widget_refresh_cb::AW_widget_refresh_cb(AW_widget_refresh_cb *previous, AW_awar *vs, AW_CL cd1, Widget w, AW_widget_type type, AW_window *awi) { 85 98 cd = cd1; 86 widget = w idgeti;99 widget = w; 87 100 widget_type = type; 88 101 awar = vs; 89 102 aw = awi; 90 next = 0; 91 awar->add_callback((AW_RCB1)aw_cp_awar_2_widget_cb, (AW_CL)this); 92 } 103 next = previous; 104 105 awar->add_callback(aw_cp_awar_2_widget_cb, (AW_CL)this); 106 } 107 108 AW_widget_refresh_cb::~AW_widget_refresh_cb() { 109 if (next) delete next; 110 awar->remove_callback(aw_cp_awar_2_widget_cb, (AW_CL)this); 111 } 112 113 void AW_awar::tie_widget(AW_CL cd1, Widget widget, AW_widget_type type, AW_window *aww) { 114 refresh_list = new AW_widget_refresh_cb(refresh_list, this, cd1, widget, type, aww); 115 } 116 void AW_awar::untie_all_widgets() { 117 delete refresh_list; refresh_list = NULL; 118 } 119 93 120 94 121 struct AW_variable_update_struct { // used to refresh single items on change … … 139 166 140 167 if (root->value_changed) { 141 root->changer_of_variable = (long)vus->widget;168 root->changer_of_variable = vus->widget; 142 169 } 143 170 … … 847 874 } 848 875 849 void AW_window::update_label(int *widget, const char *var_value) { 850 Widget w = (Widget) widget; 851 852 if (get_root()->changer_of_variable != (long)widget) { 853 XtVaSetValues(w, RES_CONVERT(XmNlabelString, var_value), NULL); 876 void AW_window::update_label(Widget widget, const char *var_value) { 877 if (get_root()->changer_of_variable != widget) { 878 XtVaSetValues(widget, RES_CONVERT(XmNlabelString, var_value), NULL); 854 879 } 855 880 else { … … 867 892 }; 868 893 869 void AW_window::update_toggle(int *wgt, const char *var, AW_CL cd_toggle_data) 870 { 894 void AW_window::update_toggle(Widget widget, const char *var, AW_CL cd_toggle_data) { 871 895 aw_toggle_data *tdata = (aw_toggle_data*)cd_toggle_data; 872 896 const char *text = tdata->bitmapOrText[(var[0] == '0' || var[0] == 'n') ? 0 : 1]; 873 897 874 898 if (tdata->isTextToggle) { 875 XtVaSetValues( (Widget)wgt, RES_CONVERT(XmNlabelString, text), NULL);899 XtVaSetValues(widget, RES_CONVERT(XmNlabelString, text), NULL); 876 900 } 877 901 else { 878 902 char *path = pixmapPath(text+1); 879 XtVaSetValues( (Widget)wgt, RES_CONVERT(XmNlabelPixmap, path), NULL);903 XtVaSetValues(widget, RES_CONVERT(XmNlabelPixmap, path), NULL); 880 904 free(path); 881 905 } … … 913 937 char *var_value = vs->read_as_string(); 914 938 915 this->update_toggle( (int*)p_w->toggle_field, var_value, (AW_CL)tdata);939 this->update_toggle(p_w->toggle_field, var_value, (AW_CL)tdata); 916 940 free(var_value); 917 941 } … … 924 948 (XtPointer) vus); 925 949 926 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)tdata, p_w->toggle_field, AW_WIDGET_TOGGLE, this);950 vs->tie_widget((AW_CL)tdata, p_w->toggle_field, AW_WIDGET_TOGGLE, this); 927 951 } 928 952 … … 1060 1084 (XtPointer) root); 1061 1085 1062 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,0, textField, AW_WIDGET_INPUT_FIELD, this);1086 vs->tie_widget(0, textField, AW_WIDGET_INPUT_FIELD, this); 1063 1087 root->make_sensitive(textField, _at->widget_mask); 1064 1088 … … 1088 1112 } 1089 1113 1090 1091 void AW_window::update_input_field(int *widget, const char *var_value) { 1092 Widget w = (Widget) widget; 1093 1094 XtVaSetValues(w, XmNvalue, var_value, NULL); 1095 } 1096 1097 1098 1114 void AW_window::update_input_field(Widget widget, const char *var_value) { 1115 XtVaSetValues(widget, XmNvalue, var_value, NULL); 1116 } 1099 1117 1100 1118 void AW_window::create_text_field(const char *var_name, int columns, int rows) { … … 1224 1242 XtAddCallback(scrolledText, XmNvalueChangedCallback, (XtCallbackProc) AW_value_changed_callback, (XtPointer) root); 1225 1243 1226 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,0, scrolledText, AW_WIDGET_TEXT_FIELD, this);1244 vs->tie_widget(0, scrolledText, AW_WIDGET_TEXT_FIELD, this); 1227 1245 root->make_sensitive(scrolledText, _at->widget_mask); 1228 1246 … … 1232 1250 1233 1251 1234 void AW_window::update_text_field(int *widget, const char *var_value) { 1235 Widget w = (Widget) widget; 1236 1237 XtVaSetValues(w, XmNvalue, var_value, NULL); 1252 void AW_window::update_text_field(Widget widget, const char *var_value) { 1253 XtVaSetValues(widget, XmNvalue, var_value, NULL); 1238 1254 } 1239 1255 … … 1399 1415 (XtPointer) _d_callback); 1400 1416 } 1401 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)p_global->last_selection_list, scrolledList, AW_WIDGET_SELECTION_LIST, this);1417 vs->tie_widget((AW_CL)p_global->last_selection_list, scrolledList, AW_WIDGET_SELECTION_LIST, this); 1402 1418 root->make_sensitive(scrolledList, _at->widget_mask); 1403 1419 } … … 2209 2225 p_global->current_option_menu = p_global->last_option_menu; 2210 2226 2211 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)p_global->current_option_menu, optionMenu, AW_WIDGET_CHOICE_MENU, this);2227 vs->tie_widget((AW_CL)p_global->current_option_menu, optionMenu, AW_WIDGET_CHOICE_MENU, this); 2212 2228 root->make_sensitive(optionMenu1, _at->widget_mask); 2213 2229 … … 2216 2232 2217 2233 static void remove_option_from_option_menu(AW_root *aw_root, AW_option_struct *os) { 2218 AW_remove_button_from_sens_list(aw_root,os->choice_widget);2234 aw_root->remove_button_from_sens_list(os->choice_widget); 2219 2235 XtDestroyWidget(os->choice_widget); 2220 2236 } … … 2352 2368 2353 2369 void AW_window::update_option_menu(AW_option_menu_struct *oms) { 2354 if (get_root()->changer_of_variable != (long)oms->label_widget) {2370 if (get_root()->changer_of_variable != oms->label_widget) { 2355 2371 AW_option_struct *active_choice = oms->first_choice; 2356 2372 { … … 2518 2534 } 2519 2535 2520 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,get_root()->number_of_toggle_fields, toggle_field, AW_WIDGET_TOGGLE_FIELD, this);2536 vs->tie_widget(get_root()->number_of_toggle_fields, toggle_field, AW_WIDGET_TOGGLE_FIELD, this); 2521 2537 root->make_sensitive(toggle_field, _at->widget_mask); 2522 2538 } -
trunk/WINDOW/AW_nawar.cxx
r6666 r6675 30 30 value_changed_cb_cd2 = cd2; 31 31 next = nexti; 32 } 33 AW_var_callback::~AW_var_callback() { 34 delete next; 32 35 } 33 36 … … 244 247 245 248 void AW_awar::remove_all_callbacks() { 246 while (callback_list) { 247 AW_var_callback *del = callback_list; 248 callback_list = del->next; 249 delete del; 250 } 249 delete callback_list; callback_list = NULL; 251 250 } 252 251 … … 629 628 630 629 AW_awar::~AW_awar() { 631 remove_all_target_vars();632 630 unlink(); 631 untie_all_widgets(); 633 632 free(awar_name); 634 633 } -
trunk/WINDOW/AW_window.cxx
r6674 r6675 11 11 #include "aw_commn.hxx" 12 12 #include "aw_at.hxx" 13 #include "aw_ awar.hxx"13 #include "aw_nawar.hxx" 14 14 #include "aw_xfig.hxx" 15 15 #include "aw_Xm.hxx" … … 84 84 85 85 if (mask != AWM_ALL) { // no need to make widget sensitive, if its shown unconditionally 86 prvt->button_list = new AW_buttons_struct(mask, w, prvt->button_list);86 button_sens_list = new AW_buttons_struct(mask, w, button_sens_list); 87 87 if (!(mask & global_mask)) XtSetSensitive(w, False); // disable widget if mask doesn't match 88 88 } … … 99 99 100 100 AW_buttons_struct::~AW_buttons_struct() { 101 aw_assert(next == 0); // has to be removed from global list before calling dtor102 } 103 104 bool AW_r emove_button_from_sens_list(AW_root *root, Widget w) {101 delete next; 102 } 103 104 bool AW_root::remove_button_from_sens_list(Widget button) { 105 105 bool removed = false; 106 if ( p_global->button_list) {106 if (button_sens_list) { 107 107 AW_buttons_struct *prev = 0; 108 AW_buttons_struct *bl = p_global->button_list;108 AW_buttons_struct *bl = button_sens_list; 109 109 110 110 while (bl) { 111 if (bl->button == w) break; // found wanted widget111 if (bl->button == button) break; // found wanted widget 112 112 prev = bl; 113 113 bl = bl->next; … … 116 116 if (bl) { 117 117 // remove from list 118 if (prev) prev->next = bl->next;119 else p_global->button_list = bl->next;118 if (prev) prev->next = bl->next; 119 else button_sens_list = bl->next; 120 120 121 121 bl->next = 0; … … 129 129 130 130 AW_option_struct::AW_option_struct(const char *variable_valuei, 131 Widget choice_widgeti) :131 Widget choice_widgeti) : 132 132 variable_value(strdup(variable_valuei)), choice_widget(choice_widgeti), 133 133 next(0) { … … 273 273 274 274 AW_root::~AW_root() { 275 delete focus_callback_list; focus_callback_list = NULL; 276 delete button_sens_list; button_sens_list = NULL; 277 275 278 exit_root(); 276 279 exit_variables(); 277 280 aw_assert(this == AW_root::SINGLETON); 278 281 279 280 282 delete prvt; 281 283 … … 1464 1466 p_r->fontlist = XmFontListCreate(fontstruct, XmSTRING_DEFAULT_CHARSET); 1465 1467 1466 p_r->button_list = 0;1468 button_sens_list = 0; 1467 1469 1468 1470 p_r->last_option_menu = p_r->current_option_menu = p_r->option_menu_list = NULL; … … 1773 1775 char *var_value = is_awar->read_as_string(); 1774 1776 if (var_value) { 1775 aww->update_label( (int*)widget, var_value);1777 aww->update_label(widget, var_value); 1776 1778 } 1777 1779 else { 1778 1780 AW_ERROR("AW_label_in_awar_list:: AWAR %s not found\n", str); 1779 aww->update_label( (int*)widget, str);1781 aww->update_label(widget, str); 1780 1782 } 1781 1783 free(var_value); 1782 AW_INSERT_BUTTON_IN_AWAR_LIST(is_awar,0, widget, AW_WIDGET_LABEL_FIELD, aww);1784 is_awar->tie_widget(0, widget, AW_WIDGET_LABEL_FIELD, aww); 1783 1785 } 1784 1786 } … … 2654 2656 2655 2657 global_mask = mask; 2656 for (list = p_r->button_list; list; list = list->next) {2658 for (list = button_sens_list; list; list = list->next) { 2657 2659 XtSetSensitive(list->button, (list->mask & mask) ? True : False); 2658 2660 } -
trunk/WINDOW/Makefile
r6582 r6675 95 95 96 96 AW_button.o: aw_at.hxx 97 AW_button.o: aw_awar.hxx98 97 AW_button.o: aw_click.hxx 99 98 AW_button.o: aw_device.hxx 100 99 AW_button.o: aw_keysym.hxx 100 AW_button.o: aw_nawar.hxx 101 101 AW_button.o: aw_position.hxx 102 102 AW_button.o: aw_print.hxx … … 407 407 408 408 AW_window.o: aw_at.hxx 409 AW_window.o: aw_awar.hxx410 409 AW_window.o: aw_click.hxx 411 410 AW_window.o: aw_commn.hxx … … 413 412 AW_window.o: aw_global.hxx 414 413 AW_window.o: aw_keysym.hxx 414 AW_window.o: aw_nawar.hxx 415 415 AW_window.o: aw_position.hxx 416 416 AW_window.o: aw_print.hxx -
trunk/WINDOW/aw_nawar.hxx
r6381 r6675 18 18 struct AW_var_callback { 19 19 AW_var_callback(void (*vc_cb)(AW_root*, AW_CL, AW_CL), AW_CL cd1, AW_CL cd2, AW_var_callback *next); 20 ~AW_var_callback(); 20 21 21 22 void (*value_changed_cb)(AW_root*, AW_CL, AW_CL); -
trunk/WINDOW/aw_root.hxx
r6674 r6675 75 75 } AW_VARIABLE_TYPE; 76 76 77 78 typedef enum { 79 AW_WIDGET_INPUT_FIELD, 80 AW_WIDGET_TEXT_FIELD, 81 AW_WIDGET_LABEL_FIELD, 82 AW_WIDGET_CHOICE_MENU, 83 AW_WIDGET_TOGGLE_FIELD, 84 AW_WIDGET_SELECTION_LIST, 85 AW_WIDGET_TOGGLE 86 } AW_widget_type; 87 88 77 89 typedef struct { 78 90 int t, b, l, r; … … 168 180 class AW_root_Motif; 169 181 class AW_awar; 182 struct AW_buttons_struct; 170 183 struct AW_var_callback; 171 184 … … 177 190 178 191 class AW_root { 179 AW_default application_database; 180 192 AW_default application_database; 193 AW_buttons_struct *button_sens_list; 194 181 195 void init_variables(AW_default database); 182 196 void exit_variables(); … … 191 205 AW_root_Motif *prvt; // Do not use !!! 192 206 bool value_changed; 193 longchanger_of_variable;207 Widget changer_of_variable; 194 208 int y_correction_for_input_labels; 195 209 AW_active global_mask; … … 266 280 void apply_sensitivity(AW_active mask); 267 281 void make_sensitive(Widget w, AW_active mask); 282 bool remove_button_from_sens_list(Widget button); 268 283 269 284 GB_ERROR start_macro_recording(const char *file, const char *application_id, const char *stop_action_name); … … 293 308 struct AW_var_callback; 294 309 struct AW_var_target; 310 struct AW_widget_refresh_cb; 295 311 296 312 typedef void (*Awar_CB)(AW_root *, AW_CL, AW_CL); … … 308 324 } pp; 309 325 310 struct AW_var_callback *callback_list; 311 struct AW_var_target *target_list; 326 struct AW_var_callback *callback_list; 327 struct AW_var_target *target_list; 328 struct AW_widget_refresh_cb *refresh_list; 312 329 313 330 #if defined(DEBUG) … … 342 359 AW_awar(AW_VARIABLE_TYPE var_type, const char *var_name, const char *var_value, double var_double_value, AW_default default_file, AW_root *root); 343 360 ~AW_awar(); 361 362 void tie_widget(AW_CL cd1, Widget widget, AW_widget_type type, AW_window *aww); 363 void untie_all_widgets(); 344 364 345 365 AW_awar *add_callback(Awar_CB2 f, AW_CL cd1, AW_CL cd2); -
trunk/WINDOW/aw_window.hxx
r6584 r6675 242 242 char *align_string(const char *string, int columns); 243 243 244 void update_label( int *widget, const char *var_value);245 void update_toggle( int *widget, const char *var_value, AW_CL cd);246 void update_input_field( int *widget, const char *var_value);247 void update_text_field( int *widget, const char *var_value);244 void update_label(Widget widget, const char *var_value); 245 void update_toggle(Widget widget, const char *var_value, AW_CL cd); 246 void update_input_field(Widget widget, const char *var_value); 247 void update_text_field(Widget widget, const char *var_value); 248 248 249 249 void create_invisible(int columns); -
trunk/WINDOW/aw_window_Xm.hxx
r6666 r6675 16 16 #define p_global (root->prvt) 17 17 #define p_aww(aww) (aww->p_w) 18 19 bool AW_remove_button_from_sens_list(AW_root *aw_root, Widget w);20 18 21 19 #define MAP_ARAM(ar) p_w->areas[ar] … … 234 232 XmFontList fontlist; 235 233 236 AW_buttons_struct *button_list;237 238 234 AW_option_menu_struct *option_menu_list; 239 235 AW_option_menu_struct *last_option_menu;
