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