ARB
AW_root.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : AW_root.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #include "aw_root.hxx"
12 #include "aw_awar.hxx"
13 #include "aw_nawar.hxx"
14 #include "aw_msg.hxx"
15 #include "aw_window.hxx"
16 #include "aw_window_Xm.hxx"
17 #include "aw_status.hxx"
18 #include "aw_xkey.hxx"
19 
20 #include <arb_handlers.h>
21 #include <arbdbt.h>
22 
23 #include <list>
24 
25 #include <X11/cursorfont.h>
26 
28 
30  awr->prvt->set_cursor(NULp, 0, awr->prvt->clock_cursor);
31 }
32 
34  awr->prvt->set_cursor(NULp, 0, 0);
35 }
36 
38  AW_root *root = aww->get_root();
39  p_global->help_active = 1;
40 }
41 
43  XtAppProcessEvent(p_r->context, XtIMAll);
44 }
46  XtInputMask pending = XtAppPending(p_r->context);
47  while (pending) {
48  XtAppProcessEvent(p_r->context, pending);
49  pending = XtAppPending(p_r->context);
50  }
51 }
52 
53 
56 
57  XEvent xevent;
58  Boolean result = XtAppPeekEvent(p_r->context, &xevent);
59 
60  if (!result) return NO_EVENT;
61  if ((xevent.type != KeyPress) && (xevent.type != KeyRelease)) return NO_EVENT;
62  return (AW_ProcessEventType)xevent.type;
63 }
64 
66 static const char *ignore_arb_prop(const char *varname) {
67  // getenv hook used to ignore (broken) property file in ARB_PROP
68  if (strcmp(varname, "ARB_PROP") == 0) {
69  static const char *ad = ARB_strdup(GB_path_in_ARBLIB("arb_default"));
70  return ad;
71  }
72 
74  const char *result = GB_getenv(varname);
76 
77  return result;
78 }
79 
80 AW_default AW_root::load_properties(const char *default_name) {
81  GBDATA *gb_default = GB_open(default_name, "rwcD");
83 
84  if (gb_default) {
85  error = GB_no_transaction(gb_default);
86  if (!error) {
87  GBDATA *gb_tmp = GB_search(gb_default, "tmp", GB_CREATE_CONTAINER);
88  error = GB_set_temporary(gb_tmp);
89  }
90 
91  if (error) GB_close(gb_default);
92  }
93  else {
94  error = GB_await_error();
95  }
96 
97  if (error) {
98  {
99  const char *shown_name = strrchr(default_name, '/');
100  if (!shown_name) shown_name = default_name;
101  error = GBS_global_string("Error loading properties '%s': %s", shown_name, error);
102  }
103 
104  // In case of error, try to fallback
105  // 1. to default-properties
106  // 2. to an empty property DB (which will at least show messages in case of status.arb)
107  //
108  // Forward all encountered errors via delayed, async call to arb_message
109  // (needed to work for status.arb as well).
110  //
111  // Motivation: If status.arb gets corrupted for whatever reason,
112  // arb will very silently not show any error messages. *sic*
113 
114  static int fallback_attempt = 0;
115  ++fallback_attempt; // avoid endless recursion
116 
117  fputs(error, stderr);
118  fputc('\n', stderr);
119 
120  char *qerror = GBK_singlequote(error);
121  const char *cmd = GBS_global_string("(sleep 2 ; arb_message %s) &", qerror);
122  free(qerror);
123 
124  const char *sys_error = GBK_system(cmd);
125  if (sys_error) fprintf(stderr, "Fatal error: %s\n", sys_error);
126 
127  switch (fallback_attempt) {
128  case 1:
130  gb_default = load_properties(default_name); // retry
132  break;
133 
134  case 2:
135  gb_default = load_properties(".FUBAR.arb"); // try "empty" properties
136  break;
137 
138  default:
139  GBK_terminate(error);
140  break;
141  }
142 
143  if (gb_default) {
144  GBDATA *bgcolor = GB_search(gb_default, "window/background", GB_STRING);
145  if (bgcolor) GB_write_string(bgcolor, "#f33");
146  }
147  }
148 
149  return (AW_default)gb_default;
150 }
151 
152 static void destroy_AW_root() {
153  delete AW_root::SINGLETON;
154  AW_root::SINGLETON = NULp;
155 }
156 
157 
158 AW_root::AW_root(const char *propertyFile, const char *program, bool no_exit, UserActionTracker *user_tracker)
159  : tracker(user_tracker),
160  changer_of_variable(NULp),
161  focus_follows_mouse(false),
162  number_of_toggle_fields(0),
163  number_of_option_menus(0),
164  disable_callbacks(false),
165  current_modal_window(NULp),
166  active_windows(0)
167 {
168  aw_assert(!AW_root::SINGLETON); // only one instance allowed
169  AW_root::SINGLETON = this;
170 
171  prvt = new AW_root_Motif;
172 
173  init_variables(load_properties(propertyFile));
174  init_root(program, no_exit);
175 
176  tracker = user_tracker;
177 
178  atexit(destroy_AW_root); // do not call this before opening properties DB!
179 }
180 
181 #if defined(UNIT_TESTS)
182 AW_root::AW_root(const char *propertyFile, UnittestMock /*mock*/)
183  : button_sens_list(NULp),
184  tracker(NULp),
185  prvt(NULp),
186  value_changed(false),
187  changer_of_variable(NULp),
188  y_correction_for_input_labels(0),
189  global_mask(0),
190  focus_follows_mouse(false),
191  number_of_toggle_fields(0),
192  number_of_option_menus(0),
193  program_name(NULp),
194  disable_callbacks(false),
195  current_modal_window(NULp),
196  active_windows(0),
197  font_width(0),
198  font_height(0),
199  font_ascent(0),
200  color_mode(AW_MONO_COLOR)
201 {
202  aw_assert(!AW_root::SINGLETON); // only one instance allowed
203  AW_root::SINGLETON = this;
204 
205  init_variables(load_properties(propertyFile));
206  atexit(destroy_AW_root); // do not call this before opening properties DB!
207 }
208 #endif
209 
211  aw_assert(user_tracker);
212  aw_assert(tracker->is_replaceable()); // there is already another tracker (program-logic-error)
213 
214  delete tracker;
215  tracker = user_tracker;
216 }
217 
219  AW_awar *awar_exists = NULp;
220  size_t off = strcspn(label, "/ ");
221 
222  if (label[off] == '/') { // contains '/' and no space before first '/'
223  awar_exists = awar_no_error(label);
224  }
225  return awar_exists;
226 }
227 
229  if (cbs->contains(AnyWinCB(AW_POPDOWN))) {
230  aw_assert(!cbs->get_cd1() && !cbs->get_cd2()); // popdown takes no parameters (please pass ", 0, 0"!)
231  }
232 
233  AW_cb *old_cbs = (AW_cb*)GBS_write_hash(prvt->action_hash, cbs->id, (long)cbs);
234  if (old_cbs) {
235  if (!old_cbs->is_equal(*cbs)) { // existing remote command replaced by different callback
236 #if defined(DEBUG)
237  fputs(GBS_global_string("Warning: reused callback id '%s' for different callback\n", old_cbs->id), stderr);
238 #if defined(DEVEL_RALF) && 1
239  aw_assert(0);
240 #endif // DEVEL_RALF
241 #endif // DEBUG
242  }
243  // do not free old_cbs, cause it's still reachable from first widget that defined this remote command
244  }
245 }
246 
247 AW_cb *AW_root::search_remote_command(const char *action) {
248  return (AW_cb *)GBS_read_hash(prvt->action_hash, action);
249 }
250 
251 static void set_focus_policy(const char *, long cl_aww, void *) {
252  AW_window *aww = (AW_window*)cl_aww;
253  aww->set_focus_policy(aww->get_root()->focus_follows_mouse);
254 }
255 void AW_root::apply_focus_policy(bool follow_mouse) {
256  focus_follows_mouse = follow_mouse;
258 }
259 
261  aw_assert(legal_mask(mask));
262  AW_buttons_struct *list;
263 
264  global_mask = mask;
265  for (list = button_sens_list; list; list = list->next) {
266  XtSetSensitive(list->button, (list->mask & mask) ? True : False);
267  }
268 }
269 
270 
271 struct fallbacks {
272  const char *fb;
273  const char *awar;
274  const char *init;
275 };
276 
277 static struct fallbacks aw_fb[] = {
278  // Name fallback awarname default value
279  { "FontList", "window/font", "8x13bold" },
280  { "background", "window/background", "grey" },
281  { "foreground", "window/foreground", "Black", },
282  { NULp, "window/color_1", "red", },
283  { NULp, "window/color_2", "green", },
284  { NULp, "window/color_3", "blue", },
285  { NULp, NULp, NULp }
286 };
287 
288 
289 void AW_root::init_variables(AW_default database) {
290  application_database = database;
293 
294  for (int i=0; aw_fb[i].awar; ++i) {
295  awar_string(aw_fb[i].awar, aw_fb[i].init, application_database);
296  }
297 }
298 
299 static void aw_message_and_dump_stderr(const char *msg) {
300  fflush(stdout);
301  fprintf(stderr, "ARB: %s\n", msg); // print to console as well
302  fflush(stderr);
303  aw_message(msg);
304 }
305 static void dump_stdout(const char *msg) {
306  fprintf(stdout, "ARB: %s\n", msg);
307 }
308 
310  AST_RANDOM,
311  aw_openstatus, // openstatus
312  aw_closestatus, // closestatus
313  aw_status_title, // set_title
314  aw_status_subtitle, // set_subtitle
315  aw_status_gauge, // set_gauge
316  aw_status_aborted, // user_abort
317 };
318 
321  aw_message,
322  dump_stdout,
324 };
325 
326 static void free_action(long action) {
327  AW_cb *cb = (AW_cb*)action;
328  delete cb;
329 }
330 
331 void AW_root::init_root(const char *programname, bool no_exit) {
332  // initialize ARB X application
333  int a = 0;
334  XFontStruct *fontstruct;
335  const int MAX_FALLBACKS = 30;
336  char *fallback_resources[MAX_FALLBACKS];
337 
338  prvt->action_hash = GBS_create_dynaval_hash(1000, GB_MIND_CASE, free_action); // actions are added via define_remote_command()
339 
340  p_r-> no_exit = no_exit;
341  program_name = strdup(programname);
342 
343  int i;
344  for (i=0; aw_fb[i].fb; i++) {
345  GBDATA *gb_awar = GB_search((GBDATA*)application_database, aw_fb[i].awar, GB_FIND);
346  fallback_resources[i] = GBS_global_string_copy("*%s: %s", aw_fb[i].fb, GB_read_char_pntr(gb_awar));
347  }
348  fallback_resources[i] = NULp;
349  aw_assert(i<MAX_FALLBACKS);
350 
351  ARB_install_handlers(aw_handlers);
352 
353  // @@@ FIXME: the next line hangs if program runs inside debugger
354  p_r->toplevel_widget = XtOpenApplication(&(p_r->context), programname,
355  NULp, 0, // XrmOptionDescRec+numOpts
356  &a, // &argc
357  NULp, // argv
358  fallback_resources,
359  applicationShellWidgetClass, // widget class
360  NULp, 0);
361 
362  for (i=0; fallback_resources[i]; i++) free(fallback_resources[i]);
363 
364  p_r->display = XtDisplay(p_r->toplevel_widget);
365 
366  if (!p_r->display) {
367  printf("cannot open display\n");
368  exit(EXIT_FAILURE);
369  }
370  {
371  GBDATA *gbd = (GBDATA*)application_database;
372  const char *font = GB_read_char_pntr(GB_search(gbd, "window/font", GB_FIND));
373  if (!(fontstruct = XLoadQueryFont(p_r->display, font))) {
374  if (!(fontstruct = XLoadQueryFont(p_r->display, "fixed"))) {
375  printf("can not load font\n");
376  exit(EXIT_FAILURE);
377  }
378  }
379  }
380 
381  if (fontstruct->max_bounds.width == fontstruct->min_bounds.width) {
382  font_width = fontstruct->max_bounds.width;
383  }
384  else {
385  font_width = (fontstruct->min_bounds.width
386  + fontstruct->max_bounds.width) / 2;
387  }
388 
389  font_height = fontstruct->max_bounds.ascent
390  + fontstruct->max_bounds.descent;
391  font_ascent = fontstruct->max_bounds.ascent;
392 
393  p_r->fontlist = XmFontListCreate(fontstruct, XmSTRING_DEFAULT_CHARSET);
394 
395  button_sens_list = NULp;
396 
397  p_r->last_option_menu = p_r->current_option_menu = p_r->option_menu_list = NULp;
398  p_r->last_toggle_field = p_r->toggle_field_list = NULp;
399  p_r->last_selection_list = p_r->selection_list = NULp;
400 
401  value_changed = false;
404 
405  p_r->screen_depth = PlanesOfScreen(XtScreen(p_r->toplevel_widget));
406  if (p_r->screen_depth == 1) {
408  }
409  else {
411  }
412  p_r->colormap = DefaultColormapOfScreen(XtScreen(p_r->toplevel_widget));
413  p_r->clock_cursor = XCreateFontCursor(XtDisplay(p_r->toplevel_widget), XC_watch);
414  p_r->question_cursor = XCreateFontCursor(XtDisplay(p_r->toplevel_widget), XC_question_arrow);
415 
416  create_colormap();
417  aw_root_init_font(XtDisplay(p_r->toplevel_widget));
418  aw_install_xkeys(XtDisplay(p_r->toplevel_widget));
419 
420 }
421 
423  delete tracker; tracker = NULp;
424  delete button_sens_list; button_sens_list = NULp;
425 
426  exit_root();
427  exit_variables();
428  aw_assert(this == AW_root::SINGLETON);
429 
430  delete prvt;
431 
432  free(program_name);
433 
434  AW_root::SINGLETON = NULp;
435 }
436 
440 static const char *aw_awar_2_color[] = {
441  "window/background",
442  "window/foreground",
443  "window/color_1",
444  "window/color_2",
445  "window/color_3",
446  NULp
447 };
448 
449 void AW_root::create_colormap() {
450 
451  XColor xcolor_returned, xcolor_exakt;
452  GBDATA *gbd = check_properties(NULp);
454 
455  // Color monitor, B&W monitor is no longer supported
456  const char **awar_2_color;
457  int color;
458  for (color = 0, awar_2_color = aw_awar_2_color;
459  *awar_2_color;
460  awar_2_color++, color++)
461  {
462  const char *name_of_color = GB_read_char_pntr(GB_search(gbd, *awar_2_color, GB_FIND));
463  if (XAllocNamedColor(prvt->display, prvt->colormap, name_of_color, &xcolor_returned, &xcolor_exakt) == 0) {
464  fprintf(stderr, "XAllocColor failed: %s\n", name_of_color);
465  }
466  else {
467  prvt->color_table[color] = xcolor_returned.pixel;
468  }
469  }
470 
471  prvt->foreground = BlackPixelOfScreen(XtScreen(prvt->toplevel_widget));
472  XtVaGetValues(prvt->toplevel_widget, XmNbackground, &prvt->background, NULp);
473  // AW_WINDOW_DRAG see init_devices
474 }
475 
476 
478  active_windows--;
479  if (active_windows<0) {
480  exit(EXIT_SUCCESS);
481  }
482  if (current_modal_window == aww) {
484  }
485 }
487  active_windows++;
488 }
489 
491 
493  AW_root *awr;
494  TimedCallback cb;
495 
496  AW_timer_cb_struct(AW_root *aw_root, const TimedCallback& tcb) : awr(aw_root), cb(tcb) {} // use install!
497 public:
498 
499  typedef XtTimerCallbackProc timer_callback;
500 
501  static void install(AW_root *aw_root, const TimedCallback& tcb, unsigned ms, timer_callback tc) {
502  AW_timer_cb_struct *tcbs = new AW_timer_cb_struct(aw_root, tcb);
503  tcbs->callAfter(ms, tc);
504  }
505 
506  unsigned call() {
507  return cb(awr);
508  }
510  return awr->disable_callbacks
511  ? 25 // delay by 25 ms
512  : cb(awr);
513  }
514  void callAfter(unsigned ms, timer_callback tc) {
515  XtAppAddTimeOut(awr->prvt->context, ms, tc, this);
516  }
517  void recallOrUninstall(unsigned restart, timer_callback tc) {
518  if (restart) callAfter(restart, tc);
519  else delete this;
520  }
521 };
522 
523 static void AW_timer_callback(XtPointer aw_timer_cb_struct, XtIntervalId*) {
524  AW_timer_cb_struct *tcbs = (AW_timer_cb_struct *)aw_timer_cb_struct;
525  if (tcbs) {
526  unsigned restart = tcbs->callOrDelayIfDisabled();
527  tcbs->recallOrUninstall(restart, AW_timer_callback);
528  }
529 }
530 static void AW_timer_callback_never_disabled(XtPointer aw_timer_cb_struct, XtIntervalId*) {
531  AW_timer_cb_struct *tcbs = (AW_timer_cb_struct *)aw_timer_cb_struct;
532  if (tcbs) {
533  unsigned restart = tcbs->call();
535  }
536 }
537 
538 void AW_root::add_timed_callback(int ms, const TimedCallback& tcb) {
540 }
541 void AW_root::add_timed_callback_never_disabled(int ms, const TimedCallback& tcb) {
543 }
544 
546 
548 
549 AW_awar *AW_root::awar_no_error(const char *var_name) {
551 }
552 
553 
554 AW_awar *AW_root::awar(const char *var_name) {
555  AW_awar *vs = awar_no_error(var_name);
556  if (!vs) GBK_terminatef("AWAR %s not defined", var_name);
557  return vs;
558 }
559 
560 AW_awar *AW_root::awar_float(const char *var_name, float default_value, AW_default default_file) {
561  AW_awar *vs = awar_no_error(var_name);
562  if (!vs) {
563  default_file = check_properties(default_file);
564  vs = new AW_awar(AW_FLOAT, var_name, "", default_value, default_file, this);
565  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
566  }
567  return vs;
568 }
569 
570 AW_awar *AW_root::awar_string(const char *var_name, const char *default_value, AW_default default_file) {
571  AW_awar *vs = awar_no_error(var_name);
572  if (!vs) {
573  default_file = check_properties(default_file);
574  vs = new AW_awar(AW_STRING, var_name, default_value, 0.0, default_file, this);
575  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
576  }
577  return vs;
578 }
579 
580 AW_awar *AW_root::awar_int(const char *var_name, long default_value, AW_default default_file) {
581  AW_awar *vs = awar_no_error(var_name);
582  if (!vs) {
583  default_file = check_properties(default_file);
584  vs = new AW_awar(AW_INT, var_name, (const char *)default_value, 0.0, default_file, this);
585  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
586  }
587  return vs;
588 }
589 
590 AW_awar *AW_root::awar_pointer(const char *var_name, GBDATA *default_value, AW_default default_file) {
591  AW_awar *vs = awar_no_error(var_name);
592  if (!vs) {
593  default_file = check_properties(default_file);
594  vs = new AW_awar(AW_POINTER, var_name, (const char *)default_value, 0.0, default_file, this);
595  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
596  }
597  return vs;
598 }
599 
600 static void awar_set_temp_if_is_default(const char *, long val, void *cl_gb_db) {
601  AW_awar *awar = (AW_awar*)val;
602  awar->set_temp_if_is_default((GBDATA*)cl_gb_db);
603 }
604 
606  // this should only be called
607  // - before saving properties
608  // - before saving any main application DB that may contain AWARs
609  //
610  // Bug: Awars created in main DB by clients (e.g. EDIT4) will stay temporary
611  // and will never be saved again.
612  //
613  // Note: uninstanciated AWARs will not be affected, so different applications with
614  // different AWAR subsets should be no problem.
615  // 'different applications' here e.g. also includes different calls to arb_ntree
616  // (e.g. merge-tool, importer, tree-window, ...)
617  //
618  // Problems arise when an awar with the same name is used for two different purposes
619  // or with different default values (regardless whether in properties or main-DB).
620  // But this has already been problematic before.
621 
623 }
624 
626  XtAppMainLoop(p_r->context);
627 }
628 
629 static void unlink_awar_from_DB(const char */*key*/, long cl_awar, void *cl_gb_main) {
630  AW_awar *awar = (AW_awar*)cl_awar;
631  GBDATA *gb_main = (GBDATA*)cl_gb_main;
632  awar->unlink_from_DB(gb_main);
633 }
634 
636  aw_assert(GB_get_root(gb_main) == gb_main);
637 
638  GB_transaction ta(gb_main); // needed in awar-callbacks during unlink
640 }
641 
642 typedef std::list<GBDATA*> DataPointers;
643 
644 static GB_ERROR set_parents_with_only_temp_childs_temp(GBDATA *gbd, DataPointers& made_temp) {
645  GB_ERROR error = NULp;
646 
647  if (GB_read_type(gbd) == GB_DB && !GB_is_temporary(gbd)) {
648  bool has_savable_child = false;
649  for (GBDATA *gb_child = GB_child(gbd); gb_child && !error; gb_child = GB_nextChild(gb_child)) {
650  bool is_tmp = GB_is_temporary(gb_child);
651  if (!is_tmp) {
652  error = set_parents_with_only_temp_childs_temp(gb_child, made_temp);
653  if (!error) is_tmp = GB_is_temporary(gb_child); // may have changed
654 
655  if (!is_tmp) has_savable_child = true;
656  }
657  }
658  if (!error && !has_savable_child) {
659  error = GB_set_temporary(gbd);
660  made_temp.push_back(gbd);
661  }
662  }
663 
664  return error;
665 }
666 
667 static GB_ERROR clear_temp_flags(DataPointers& made_temp) {
668  GB_ERROR error = NULp;
669  for (DataPointers::iterator mt = made_temp.begin(); mt != made_temp.end() && !error; ++mt) {
670  error = GB_clear_temporary(*mt);
671  }
672  return error;
673 }
674 
675 GB_ERROR AW_root::save_properties(const char *filename) {
676  GB_ERROR error = NULp;
677  GBDATA *gb_prop = application_database;
678 
679  if (!gb_prop) {
680  error = "No properties loaded - won't save";
681  }
682  else {
683  error = GB_push_transaction(gb_prop);
684  if (!error) {
686  error = GB_pop_transaction(gb_prop);
687  if (!error) {
689 
690  DataPointers made_temp;
691  error = set_parents_with_only_temp_childs_temp(gb_prop, made_temp); // avoid saving empty containers
692  if (!error) error = GB_save_in_arbprop(gb_prop, filename, "a");
693  if (!error) error = clear_temp_flags(made_temp);
694  }
695  }
696  }
697 
698  return error;
699 }
GB_ERROR GBK_system(const char *system_command)
Definition: arb_msg.cxx:571
XtTimerCallbackProc timer_callback
Definition: AW_root.cxx:499
GB_HASH * action_hash
static GB_ERROR set_parents_with_only_temp_childs_temp(GBDATA *gbd, DataPointers &made_temp)
Definition: AW_root.cxx:644
enum AW_root::@65 color_mode
const char * GB_ERROR
Definition: arb_core.h:25
AW_bitset AW_active
Definition: aw_base.hxx:45
string result
GBDATA * GB_open(const char *path, const char *opent)
Definition: ad_load.cxx:1363
AW_active global_mask
Definition: aw_root.hxx:108
void define_remote_command(class AW_cb *cbs)
Definition: AW_root.cxx:228
AW_root(const char *propertyFile, const char *program, bool no_exit, UserActionTracker *user_tracker)
Definition: AW_root.cxx:158
GBDATA * GB_child(GBDATA *father)
Definition: adquery.cxx:322
void aw_install_xkeys(Display *display)
Definition: AW_xkey.cxx:134
unsigned call()
Definition: AW_root.cxx:506
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
Definition: adhash.cxx:454
bool GB_is_temporary(GBDATA *gbd)
Definition: arbdb.cxx:2304
void aw_openstatus(const char *title)
Definition: AW_status.cxx:1084
GB_HASH * hash_for_windows
Definition: aw_root.hxx:125
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
Definition: arbdb.cxx:1387
AW_awar * label_is_awar(const char *label)
Definition: AW_root.cxx:218
static struct fallbacks aw_fb[]
Definition: AW_root.cxx:277
int active_windows
Definition: aw_root.hxx:116
GB_ERROR save_properties(const char *filename=NULp) __ATTR__USERESULT
Definition: AW_root.cxx:675
const char * awar
Definition: AW_root.cxx:273
void dont_save_awars_with_default_value(GBDATA *gb_db)
Definition: AW_root.cxx:605
AW_window * current_modal_window
Definition: aw_root.hxx:115
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
int y_correction_for_input_labels
Definition: aw_root.hxx:107
void aw_status_title(const char *new_title)
Definition: AW_status.cxx:1097
const char * GBS_global_string(const char *templat,...)
Definition: arb_msg.cxx:203
void AW_normal_cursor(AW_root *awr)
Definition: AW_root.cxx:33
virtual bool is_replaceable() const =0
static void free_action(long action)
Definition: AW_root.cxx:326
GB_HASH * GBS_create_dynaval_hash(long estimated_elements, GB_CASE case_sens, void(*freefun)(long))
Definition: adhash.cxx:271
void GBK_terminatef(const char *templat,...)
Definition: arb_msg.cxx:523
void AW_POPDOWN(AW_window *window)
Definition: AW_window.cxx:52
char * id
Definition: aw_window.hxx:135
AW_root_Motif * prvt
Definition: aw_root.hxx:104
void add_timed_callback_never_disabled(int ms, const TimedCallback &tcb)
Definition: AW_root.cxx:541
void add_timed_callback(int ms, const TimedCallback &tcb)
Definition: AW_root.cxx:538
AW_cb * search_remote_command(const char *action)
Definition: AW_root.cxx:247
#define EXIT_SUCCESS
Definition: arb_a2ps.c:154
static void dump_stdout(const char *msg)
Definition: AW_root.cxx:305
NOT4PERL gb_getenv_hook GB_install_getenv_hook(gb_getenv_hook hook)
Definition: adsocket.cxx:699
char * program_name
Definition: aw_root.hxx:113
Colormap colormap
static const char * aw_awar_2_color[]
Definition: AW_root.cxx:440
GB_ERROR GB_push_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2494
const char * fb
Definition: AW_root.cxx:272
#define cb(action)
const char * init
Definition: AW_root.cxx:274
void AW_clock_cursor(AW_root *awr)
Definition: AW_root.cxx:29
std::list< GBDATA * > DataPointers
Definition: AW_root.cxx:642
static void AW_timer_callback_never_disabled(XtPointer aw_timer_cb_struct, XtIntervalId *)
Definition: AW_root.cxx:530
void setUserActionTracker(UserActionTracker *user_tracker)
Definition: AW_root.cxx:210
void aw_closestatus()
Definition: AW_status.cxx:1093
static const char * ignore_arb_prop(const char *varname)
Definition: AW_root.cxx:66
GB_HASH * hash_table_for_variables
Definition: aw_root.hxx:110
GB_ERROR GB_clear_temporary(GBDATA *gbd)
Definition: arbdb.cxx:2295
GB_ERROR GB_await_error()
Definition: arb_msg.cxx:342
static AW_root * SINGLETON
Definition: aw_root.hxx:102
Widget toplevel_widget
Definition: arbdb.h:78
fflush(stdout)
GB_TYPES GB_read_type(GBDATA *gbd)
Definition: arbdb.cxx:1643
bool contains(AnyWinCB g)
short font_height
Definition: aw_root.hxx:123
AW_awar * awar_float(const char *var_name, float default_value=0.0, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:560
Display * display
void process_pending_events()
Definition: AW_root.cxx:45
AW_default check_properties(AW_default aw_props)
Definition: aw_root.hxx:162
void GBS_hash_do_const_loop(const GB_HASH *hs, gb_hash_const_loop_type func, void *client_data)
Definition: adhash.cxx:559
void GBK_terminate(const char *error) __ATTR__NORETURN
Definition: arb_msg.cxx:509
bool is_equal(const AW_cb &other) const
static void AW_timer_callback(XtPointer aw_timer_cb_struct, XtIntervalId *)
Definition: AW_root.cxx:523
#define aw_assert(bed)
Definition: aw_position.hxx:29
#define false
Definition: ureadseq.h:13
#define legal_mask(m)
Definition: aw_root.hxx:25
unsigned callOrDelayIfDisabled()
Definition: AW_root.cxx:509
static arb_status_implementation AW_status_impl
Definition: AW_root.cxx:309
AW_buttons_struct * next
XtAppContext context
static void error(const char *msg)
Definition: mkptypes.cxx:96
GBDATA * GB_get_root(GBDATA *gbd)
Definition: arbdb.cxx:1740
static void awar_set_temp_if_is_default(const char *, long val, void *cl_gb_db)
Definition: AW_root.cxx:600
bool unlink_from_DB(GBDATA *gb_main)
Definition: AW_awar.cxx:651
fputc('\n', stderr)
void process_events()
Definition: AW_root.cxx:42
short font_width
Definition: aw_root.hxx:122
void window_show()
Definition: AW_root.cxx:486
static arb_handlers aw_handlers
Definition: AW_root.cxx:319
bool focus_follows_mouse
Definition: aw_root.hxx:109
void aw_status_subtitle(const char *text)
Definition: AW_status.cxx:1100
const char *(* gb_getenv_hook)(const char *varname)
Definition: arbdb.h:138
void set_temp_if_is_default(GBDATA *gb_db)
Definition: AW_awar.cxx:712
GB_CSTR GB_path_in_ARBLIB(const char *relative_path)
Definition: adsocket.cxx:1156
AW_awar * awar_no_error(const char *awar)
end timer stuff
Definition: AW_root.cxx:549
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
void aw_root_init_font(Display *tool_d)
Definition: AW_xfont.cxx:300
GB_ERROR GB_pop_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2524
short font_ascent
Definition: aw_root.hxx:124
Definition: arbdb.h:86
GB_ERROR GB_save_in_arbprop(GBDATA *gb, const char *path, const char *savetype)
static GB_ERROR clear_temp_flags(DataPointers &made_temp)
Definition: AW_root.cxx:667
#define EXIT_FAILURE
Definition: arb_a2ps.c:157
AW_rgb * color_table
void unlink_awars_from_DB(GBDATA *gb_main)
Definition: AW_root.cxx:635
GB_CSTR GB_getenv(const char *env)
Definition: adsocket.cxx:709
WindowCallbackSimple AnyWinCB
Definition: aw_window.hxx:120
void aw_update_all_window_geometry_awars(AW_root *awr)
Definition: AW_window.cxx:2193
GB_ERROR GB_set_temporary(GBDATA *gbd) __ATTR__USERESULT
Definition: arbdb.cxx:2282
static void set_focus_policy(const char *, long cl_aww, void *)
Definition: AW_root.cxx:251
void main_loop()
Definition: AW_root.cxx:625
#define p_global
fputs(TRACE_PREFIX, stderr)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:580
TYPE * ARB_calloc(size_t nelem)
Definition: arb_mem.h:81
void AW_help_entry_pressed(AW_window *aww)
Definition: AW_root.cxx:37
char * GBK_singlequote(const char *arg)
Definition: arb_msg.cxx:599
bool disable_callbacks
Definition: aw_root.hxx:114
static void destroy_AW_root()
Definition: AW_root.cxx:152
bool aw_status_aborted()
Definition: AW_status.cxx:1118
void apply_focus_policy(bool follow_mouse)
Definition: AW_root.cxx:255
static void aw_message_and_dump_stderr(const char *msg)
Definition: AW_root.cxx:299
static ARB_init_perl_interface init
Definition: ARB_ext.c:101
void ARB_install_handlers(arb_handlers &handlers)
void apply_sensitivity(AW_active mask)
Definition: AW_root.cxx:260
void aw_message(const char *msg)
Definition: AW_status.cxx:1142
static void install(AW_root *aw_root, const TimedCallback &tcb, unsigned ms, timer_callback tc)
Definition: AW_root.cxx:501
void aw_status_gauge(double gauge)
Definition: AW_status.cxx:1104
AW_CL get_cd1() const
Definition: aw_window.hxx:155
AW_root * get_root()
Definition: aw_window.hxx:359
#define NULp
Definition: cxxforward.h:116
bool value_changed
Definition: aw_root.hxx:105
void set_cursor(Display *d, Window w, Cursor c)
Definition: AW_window.cxx:1377
static void unlink_awar_from_DB(const char *, long cl_awar, void *cl_gb_main)
Definition: AW_root.cxx:629
GB_ERROR GB_no_transaction(GBDATA *gbd) __ATTR__USERESULT
Definition: arbdb.cxx:2535
GBDATA * GB_nextChild(GBDATA *child)
Definition: adquery.cxx:326
AW_ProcessEventType peek_key_event(AW_window *)
Definition: AW_root.cxx:54
GB_transaction ta(gb_var)
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
Definition: arbdb.cxx:904
GBDATA * gb_main
Definition: adname.cxx:32
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:570
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
Definition: adquery.cxx:531
void callAfter(unsigned ms, timer_callback tc)
Definition: AW_root.cxx:514
AW_awar * awar_pointer(const char *var_name, GBDATA *default_value=NULp, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:590
void recallOrUninstall(unsigned restart, timer_callback tc)
Definition: AW_root.cxx:517
static int restart
Definition: arb_a2ps.c:264
#define p_r
static gb_getenv_hook orig_hook
Definition: AW_root.cxx:65
long GBS_read_hash(const GB_HASH *hs, const char *key)
Definition: adhash.cxx:392
void window_hide(AW_window *aww)
Definition: AW_root.cxx:477
begin timer stuff
Definition: AW_root.cxx:492
char * GBS_global_string_copy(const char *templat,...)
Definition: arb_msg.cxx:194
void GB_close(GBDATA *gbd)
Definition: arbdb.cxx:655
AW_CL get_cd2() const
Definition: aw_window.hxx:156
const char * label
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)
Definition: adhash.cxx:253
~AW_root()
Definition: AW_root.cxx:422
AW_ProcessEventType
Definition: aw_root.hxx:49