#include <varblmen.h>
Inheritance diagram for DBL_VAR_MENU_LEAF:
Definition at line 67 of file varblmen.h.
DBL_VAR_MENU_LEAF::DBL_VAR_MENU_LEAF | ( | double_VARIABLE * | this_var | ) | [inline] |
Definition at line 88 of file varblmen.h.
References changed, FALSE, and var.
00090 : LEAF_MENU_NODE ("") { 00091 var = this_var; 00092 changed = FALSE; 00093 }
const char* DBL_VAR_MENU_LEAF::cmp_str | ( | ) | [inline, private, virtual] |
Reimplemented from MENU_NODE.
Definition at line 79 of file varblmen.h.
References double_VARIABLE::name_str(), and var.
void DBL_VAR_MENU_LEAF::event | ( | COMMAND_WINDOW * | cmd_win, | |
FCOORD | pt, | |||
INT32 * | cmd_event_id, | |||
char * | new_value | |||
) | [private, virtual] |
Event selection, toggle value
Implements MENU_NODE.
Definition at line 96 of file varblmen.cpp.
References MENU_NODE::box, changed, BOX::contains(), COMMAND_WINDOW::internal_prompt(), MAX_CHARS, COMMAND_WINDOW::msg(), TRUE, and var.
00101 { 00102 char ascii_new_value[MAX_CHARS + 1]; 00103 const char *prompt_msg; 00104 double new_value; 00105 00106 if (box.contains (pt)) { 00107 sprintf (ascii_new_value, "%g", (double) *var); 00108 prompt_msg = var->info_str (); 00109 while (cmd_win->internal_prompt (prompt_msg, ascii_new_value)) { 00110 if (sscanf (ascii_new_value, "%lf", &new_value) == 1) { 00111 if (new_value != (double) *var) { 00112 var->set_value (new_value); 00113 cmd_win->msg ("Value changed"); 00114 changed = TRUE; 00115 return; 00116 } 00117 else { 00118 cmd_win->msg ("Value unchanged"); 00119 return; 00120 } 00121 } 00122 else 00123 prompt_msg = "Invalid value for double - try again or click"; 00124 } 00125 } 00126 }
INT8 LEAF_MENU_NODE::max_num_chars | ( | ) | [inline, protected, virtual, inherited] |
Implements MENU_NODE.
Definition at line 138 of file sbdmenu.h.
References STRING::length(), and MENU_NODE::name.
void MENU_NODE::new_label | ( | const char * | label | ) | [inline, inherited] |
Definition at line 115 of file sbdmenu.h.
References MENU_NODE::name.
Referenced by COMMAND_WINDOW::replace_menu_text().
00116 { 00117 name = label; 00118 }
void MENU_NODE::plot | ( | WINDOW | window | ) | [inherited] |
Initialise, then call plotx to do the real work.
This means that we can initialise plotting once only REGARDLESS of what menu subclass we start plotting.
e.g., we don't always start with a MENU_ROOT.
Definition at line 79 of file sbdmenu.cpp.
References character_height, fill_color_index, GREY, INT_SOLID, interior_style, LIGHT_GREY, perimeter_color_index, MENU_NODE::plotx(), text_color_index, TRUE, and WHITE.
Referenced by COMMAND_WINDOW::plot(), COMMAND_WINDOW::replace_menu_text(), and COMMAND_WINDOW::set_toggle().
00081 { 00082 character_height(window, menu_char_height); 00083 interior_style(window, INT_SOLID, TRUE); 00084 perimeter_color_index(window, LIGHT_GREY); 00085 text_color_index(window, WHITE); 00086 fill_color_index(window, GREY); 00087 plotx(window); 00088 }
void LEAF_MENU_NODE::plotx | ( | WINDOW | window | ) | [protected, virtual, inherited] |
The real plot; positions assumed already calculated.
Implements MENU_NODE.
Reimplemented in TOGGLE_MENU_LEAF, and BOOL_VAR_MENU_LEAF.
Definition at line 52 of file sbdmenu.cpp.
References MENU_NODE::box, FALSE, BOX::left(), MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, MENU_NODE::name, BOX::plot(), STRING::string(), text2d, and BOX::top().
Referenced by BOOL_VAR_MENU_LEAF::plotx(), and TOGGLE_MENU_LEAF::plotx().
00054 { 00055 box.plot (window); 00056 00057 text2d (window, 00058 box.left () + MENU_TEXT_X_OFFSET, 00059 box.top () - MENU_TEXT_Y_OFFSET, name.string (), 0, FALSE); 00060 }
SHOULD NEVER BE CALLED.
Compiler needs it as this can't be a pure virtual function as not all classes provide it and the compiler will not let you do "new" on a class which inherits a pure virtual function which it cannot resolve into a real function.
Reimplemented in NON_LEAF_MENU_NODE, and MENU_ROOT.
Definition at line 99 of file sbdmenu.cpp.
References ABORT, MENU_NODE::box, ERRCODE::error(), NULL, and SHOULDNT_BE_CALLED.
00102 { 00103 SHOULDNT_BE_CALLED.error ("MENU_ROOT::recalc_bounding_box", ABORT, NULL); 00104 return box; 00105 }
void DBL_VAR_MENU_LEAF::write_vars | ( | FILE * | fp, | |
BOOL8 | changes_only | |||
) | [private, virtual] |
Save DOUBLE config vars to file, option on only changed vars
Reimplemented from MENU_NODE.
Definition at line 132 of file varblmen.cpp.
References changed, double_VARIABLE::info_str(), double_VARIABLE::name_str(), and var.
00135 { 00136 if (!changes_only || changed) { 00137 fprintf (fp, "%-25s %-12e # %s\n", 00138 var->name_str (), (double) *var, var->info_str ()); 00139 } 00140 }
BOX MENU_NODE::box [protected, inherited] |
Definition at line 77 of file sbdmenu.h.
Referenced by block_space_stat(), VAR_SUB_MENU::event(), STR_VAR_MENU_LEAF::event(), INT_VAR_MENU_LEAF::event(), event(), BOOL_VAR_MENU_LEAF::event(), VARIABLE_MENU_LEAF::event(), TOGGLE_MENU_LEAF::event(), SIMPLE_MENU_LEAF::event(), RADIO_MENU::event(), NON_LEAF_MENU_NODE::event(), NON_LEAF_MENU_NODE::plotx(), LEAF_MENU_NODE::plotx(), re_scale_and_move_bln_word(), NON_LEAF_MENU_NODE::recalc_bounding_box(), MENU_ROOT::recalc_bounding_box(), MENU_NODE::recalc_bounding_box(), MENU_NODE::recalc_fixed_width_bb(), row_space_stat(), and show_point().
BOOL8 DBL_VAR_MENU_LEAF::changed [private] |
Definition at line 71 of file varblmen.h.
Referenced by DBL_VAR_MENU_LEAF(), event(), and write_vars().
STRING MENU_NODE::name [protected, inherited] |
Definition at line 76 of file sbdmenu.h.
Referenced by MENU_NODE::cmp_str(), VAR_SUB_MENU::event(), VARIABLE_MENU_LEAF::event(), LEAF_MENU_NODE::max_num_chars(), NON_LEAF_MENU_NODE::max_num_chars(), MENU_NODE::MENU_NODE(), MENU_NODE::new_label(), pgeditor_read_file(), NON_LEAF_MENU_NODE::plotx(), and LEAF_MENU_NODE::plotx().
double_VARIABLE* DBL_VAR_MENU_LEAF::var [private] |
Definition at line 70 of file varblmen.h.
Referenced by cmp_str(), DBL_VAR_MENU_LEAF(), event(), and write_vars().