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 call_registered_via_alias(AW_window *aww, AW_cb *target_cb) {
266  aw_assert(aww == target_cb->aw);
267  target_cb->run_callbacks();
268 }
269 
270 void AW_root::alias_remote_command(const char *action_alias, const char *registered_action) {
274  AW_cb *registered_cb = search_remote_command(registered_action);
275  if (!registered_cb) {
276  fprintf(stderr, "Error: cannot create alias '%s' for unknown remote command '%s'\n", action_alias, registered_action);
277 #if defined(DEVEL_RALF) && 1
278  aw_assert(0);
279 #endif
280  }
281  else {
282  AW_cb *aliased_cb = search_remote_command(action_alias);
283  if (aliased_cb) {
284  fprintf(stderr, "Error: cannot create alias for '%s' (callback id '%s' already in use)\n", registered_action, action_alias);
285 #if defined(DEVEL_RALF) && 1
286  aw_assert(0);
287 #endif
288  }
289  else {
290  // create a callback that calls the callback registered for 'registered_action':
291  const WindowCallback& wcb = makeWindowCallback(call_registered_via_alias, registered_cb);
292  AW_window *aww = registered_cb->aw;
293 
294  AW_cb *cbs = new AW_cb(aww, wcb);
295  cbs->id = ARB_strdup(action_alias);
296 
298  }
299  }
300 }
301 
302 
303 static void set_focus_policy(const char *, long cl_aww, void *) {
304  AW_window *aww = (AW_window*)cl_aww;
305  aww->set_focus_policy(aww->get_root()->focus_follows_mouse);
306 }
307 void AW_root::apply_focus_policy(bool follow_mouse) {
308  focus_follows_mouse = follow_mouse;
310 }
311 
313  aw_assert(legal_mask(mask));
314  AW_buttons_struct *list;
315 
316  global_mask = mask;
317  for (list = button_sens_list; list; list = list->next) {
318  XtSetSensitive(list->button, (list->mask & mask) ? True : False);
319  }
320 }
321 
322 
323 struct fallbacks {
324  const char *fb;
325  const char *awar;
326  const char *init;
327 };
328 
329 static struct fallbacks aw_fb[] = {
330  // Name fallback awarname default value
331  { "FontList", "window/font", "8x13bold" },
332  { "background", "window/background", "grey" },
333  { "foreground", "window/foreground", "Black", },
334  { NULp, "window/color_1", "red", },
335  { NULp, "window/color_2", "green", },
336  { NULp, "window/color_3", "blue", },
337  { NULp, NULp, NULp }
338 };
339 
340 
341 void AW_root::init_variables(AW_default database) {
342  application_database = database;
345 
346  for (int i=0; aw_fb[i].awar; ++i) {
347  awar_string(aw_fb[i].awar, aw_fb[i].init, application_database);
348  }
349 }
350 
351 static void aw_message_and_dump_stderr(const char *msg) {
352  fflush(stdout);
353  fprintf(stderr, "ARB: %s\n", msg); // print to console as well
354  fflush(stderr);
355  aw_message(msg);
356 }
357 static void dump_stdout(const char *msg) {
358  fprintf(stdout, "ARB: %s\n", msg);
359 }
360 
362  AST_RANDOM,
363  aw_openstatus, // openstatus
364  aw_closestatus, // closestatus
365  aw_status_title, // set_title
366  aw_status_subtitle, // set_subtitle
367  aw_status_gauge, // set_gauge
368  aw_status_aborted, // user_abort
369 };
370 
373  aw_message,
374  dump_stdout,
376 };
377 
378 static void free_action(long action) {
379  AW_cb *cb = (AW_cb*)action;
380  delete cb;
381 }
382 
383 void AW_root::init_root(const char *programname, bool no_exit) {
384  // initialize ARB X application
385  int a = 0;
386  XFontStruct *fontstruct;
387  const int MAX_FALLBACKS = 30;
388  char *fallback_resources[MAX_FALLBACKS];
389 
390  prvt->action_hash = GBS_create_dynaval_hash(1000, GB_MIND_CASE, free_action); // actions are added via define_remote_command()
391 
392  p_r-> no_exit = no_exit;
393  program_name = strdup(programname);
394 
395  int i;
396  for (i=0; aw_fb[i].fb; i++) {
397  GBDATA *gb_awar = GB_search((GBDATA*)application_database, aw_fb[i].awar, GB_FIND);
398  fallback_resources[i] = GBS_global_string_copy("*%s: %s", aw_fb[i].fb, GB_read_char_pntr(gb_awar));
399  }
400  fallback_resources[i] = NULp;
401  aw_assert(i<MAX_FALLBACKS);
402 
403  ARB_install_handlers(aw_handlers);
404 
405  // @@@ FIXME: the next line hangs if program runs inside debugger
406  p_r->toplevel_widget = XtOpenApplication(&(p_r->context), programname,
407  NULp, 0, // XrmOptionDescRec+numOpts
408  &a, // &argc
409  NULp, // argv
410  fallback_resources,
411  applicationShellWidgetClass, // widget class
412  NULp, 0);
413 
414  for (i=0; fallback_resources[i]; i++) free(fallback_resources[i]);
415 
416  p_r->display = XtDisplay(p_r->toplevel_widget);
417 
418  if (!p_r->display) {
419  printf("cannot open display\n");
420  exit(EXIT_FAILURE);
421  }
422  {
423  GBDATA *gbd = (GBDATA*)application_database;
424  const char *font = GB_read_char_pntr(GB_search(gbd, "window/font", GB_FIND));
425  if (!(fontstruct = XLoadQueryFont(p_r->display, font))) {
426  if (!(fontstruct = XLoadQueryFont(p_r->display, "fixed"))) {
427  printf("can not load font\n");
428  exit(EXIT_FAILURE);
429  }
430  }
431  }
432 
433  if (fontstruct->max_bounds.width == fontstruct->min_bounds.width) {
434  font_width = fontstruct->max_bounds.width;
435  }
436  else {
437  font_width = (fontstruct->min_bounds.width
438  + fontstruct->max_bounds.width) / 2;
439  }
440 
441  font_height = fontstruct->max_bounds.ascent
442  + fontstruct->max_bounds.descent;
443  font_ascent = fontstruct->max_bounds.ascent;
444 
445  p_r->fontlist = XmFontListCreate(fontstruct, XmSTRING_DEFAULT_CHARSET);
446 
447  button_sens_list = NULp;
448 
449  p_r->last_option_menu = p_r->current_option_menu = p_r->option_menu_list = NULp;
450  p_r->last_toggle_field = p_r->toggle_field_list = NULp;
451  p_r->last_selection_list = p_r->selection_list = NULp;
452 
453  value_changed = false;
456 
457  p_r->screen_depth = PlanesOfScreen(XtScreen(p_r->toplevel_widget));
458  if (p_r->screen_depth == 1) {
460  }
461  else {
463  }
464  p_r->colormap = DefaultColormapOfScreen(XtScreen(p_r->toplevel_widget));
465  p_r->clock_cursor = XCreateFontCursor(XtDisplay(p_r->toplevel_widget), XC_watch);
466  p_r->question_cursor = XCreateFontCursor(XtDisplay(p_r->toplevel_widget), XC_question_arrow);
467 
468  create_colormap();
469  aw_root_init_font(XtDisplay(p_r->toplevel_widget));
470  aw_install_xkeys(XtDisplay(p_r->toplevel_widget));
471 
472 }
473 
475  delete tracker; tracker = NULp;
476  delete button_sens_list; button_sens_list = NULp;
477 
478  exit_root();
479  exit_variables();
480  aw_assert(this == AW_root::SINGLETON);
481 
482  delete prvt;
483 
484  free(program_name);
485 
486  AW_root::SINGLETON = NULp;
487 }
488 
492 static const char *aw_awar_2_color[] = {
493  "window/background",
494  "window/foreground",
495  "window/color_1",
496  "window/color_2",
497  "window/color_3",
498  NULp
499 };
500 
501 void AW_root::create_colormap() {
502 
503  XColor xcolor_returned, xcolor_exakt;
504  GBDATA *gbd = check_properties(NULp);
506 
507  // Color monitor, B&W monitor is no longer supported
508  const char **awar_2_color;
509  int color;
510  for (color = 0, awar_2_color = aw_awar_2_color;
511  *awar_2_color;
512  awar_2_color++, color++)
513  {
514  const char *name_of_color = GB_read_char_pntr(GB_search(gbd, *awar_2_color, GB_FIND));
515  if (XAllocNamedColor(prvt->display, prvt->colormap, name_of_color, &xcolor_returned, &xcolor_exakt) == 0) {
516  fprintf(stderr, "XAllocColor failed: %s\n", name_of_color);
517  }
518  else {
519  prvt->color_table[color] = xcolor_returned.pixel;
520  }
521  }
522 
523  prvt->foreground = BlackPixelOfScreen(XtScreen(prvt->toplevel_widget));
524  XtVaGetValues(prvt->toplevel_widget, XmNbackground, &prvt->background, NULp);
525  // AW_WINDOW_DRAG see init_devices
526 }
527 
528 
530  active_windows--;
531  if (active_windows<0) {
532  exit(EXIT_SUCCESS);
533  }
534  if (current_modal_window == aww) {
536  }
537 }
539  active_windows++;
540 }
541 
543 
545  AW_root *awr;
546  TimedCallback cb;
547 
548  AW_timer_cb_struct(AW_root *aw_root, const TimedCallback& tcb) : awr(aw_root), cb(tcb) {} // use install!
549 public:
550 
551  typedef XtTimerCallbackProc timer_callback;
552 
553  static void install(AW_root *aw_root, const TimedCallback& tcb, unsigned ms, timer_callback tc) {
554  AW_timer_cb_struct *tcbs = new AW_timer_cb_struct(aw_root, tcb);
555  tcbs->callAfter(ms, tc);
556  }
557 
558  unsigned call() {
559  return cb(awr);
560  }
562  return awr->disable_callbacks
563  ? 25 // delay by 25 ms
564  : cb(awr);
565  }
566  void callAfter(unsigned ms, timer_callback tc) {
567  XtAppAddTimeOut(awr->prvt->context, ms, tc, this);
568  }
569  void recallOrUninstall(unsigned restart, timer_callback tc) {
570  if (restart) callAfter(restart, tc);
571  else delete this;
572  }
573 };
574 
575 static void AW_timer_callback(XtPointer aw_timer_cb_struct, XtIntervalId*) {
576  AW_timer_cb_struct *tcbs = (AW_timer_cb_struct *)aw_timer_cb_struct;
577  if (tcbs) {
578  unsigned restart = tcbs->callOrDelayIfDisabled();
579  tcbs->recallOrUninstall(restart, AW_timer_callback);
580  }
581 }
582 static void AW_timer_callback_never_disabled(XtPointer aw_timer_cb_struct, XtIntervalId*) {
583  AW_timer_cb_struct *tcbs = (AW_timer_cb_struct *)aw_timer_cb_struct;
584  if (tcbs) {
585  unsigned restart = tcbs->call();
587  }
588 }
589 
590 void AW_root::add_timed_callback(int ms, const TimedCallback& tcb) {
592 }
593 void AW_root::add_timed_callback_never_disabled(int ms, const TimedCallback& tcb) {
595 }
596 
598 
600 
601 AW_awar *AW_root::awar_no_error(const char *var_name) {
603 }
604 
605 
606 AW_awar *AW_root::awar(const char *var_name) {
607  AW_awar *vs = awar_no_error(var_name);
608  if (!vs) GBK_terminatef("AWAR %s not defined", var_name);
609  return vs;
610 }
611 
612 AW_awar *AW_root::awar_float(const char *var_name, float default_value, AW_default default_file) {
613  AW_awar *vs = awar_no_error(var_name);
614  if (!vs) {
615  default_file = check_properties(default_file);
616  vs = new AW_awar(AW_FLOAT, var_name, "", default_value, default_file, this);
617  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
618  }
619  return vs;
620 }
621 
622 AW_awar *AW_root::awar_string(const char *var_name, const char *default_value, AW_default default_file) {
623  AW_awar *vs = awar_no_error(var_name);
624  if (!vs) {
625  default_file = check_properties(default_file);
626  vs = new AW_awar(AW_STRING, var_name, default_value, 0.0, default_file, this);
627  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
628  }
629  return vs;
630 }
631 
632 AW_awar *AW_root::awar_int(const char *var_name, long default_value, AW_default default_file) {
633  AW_awar *vs = awar_no_error(var_name);
634  if (!vs) {
635  default_file = check_properties(default_file);
636  vs = new AW_awar(AW_INT, var_name, (const char *)default_value, 0.0, default_file, this);
637  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
638  }
639  return vs;
640 }
641 
642 AW_awar *AW_root::awar_pointer(const char *var_name, GBDATA *default_value, AW_default default_file) {
643  AW_awar *vs = awar_no_error(var_name);
644  if (!vs) {
645  default_file = check_properties(default_file);
646  vs = new AW_awar(AW_POINTER, var_name, (const char *)default_value, 0.0, default_file, this);
647  GBS_write_hash(hash_table_for_variables, var_name, (long)vs);
648  }
649  return vs;
650 }
651 
652 static void awar_set_temp_if_is_default(const char *, long val, void *cl_gb_db) {
653  AW_awar *awar = (AW_awar*)val;
654  awar->set_temp_if_is_default((GBDATA*)cl_gb_db);
655 }
656 
658  // this should only be called
659  // - before saving properties
660  // - before saving any main application DB that may contain AWARs
661  //
662  // Bug: Awars created in main DB by clients (e.g. EDIT4) will stay temporary
663  // and will never be saved again.
664  //
665  // Note: uninstanciated AWARs will not be affected, so different applications with
666  // different AWAR subsets should be no problem.
667  // 'different applications' here e.g. also includes different calls to arb_ntree
668  // (e.g. merge-tool, importer, tree-window, ...)
669  //
670  // Problems arise when an awar with the same name is used for two different purposes
671  // or with different default values (regardless whether in properties or main-DB).
672  // But this has already been problematic before.
673 
675 }
676 
678  XtAppMainLoop(p_r->context);
679  arb_assert(0); // unexpected return from main loop
680 }
681 
682 static void unlink_awar_from_DB(const char */*key*/, long cl_awar, void *cl_gb_main) {
683  AW_awar *awar = (AW_awar*)cl_awar;
684  GBDATA *gb_main = (GBDATA*)cl_gb_main;
685  awar->unlink_from_DB(gb_main);
686 }
687 
689  aw_assert(GB_get_root(gb_main) == gb_main);
690 
691  GB_transaction ta(gb_main); // needed in awar-callbacks during unlink
693 }
694 
695 typedef std::list<GBDATA*> DataPointers;
696 
697 static GB_ERROR set_parents_with_only_temp_childs_temp(GBDATA *gbd, DataPointers& made_temp) {
698  GB_ERROR error = NULp;
699 
700  if (GB_read_type(gbd) == GB_DB && !GB_is_temporary(gbd)) {
701  bool has_savable_child = false;
702  for (GBDATA *gb_child = GB_child(gbd); gb_child && !error; gb_child = GB_nextChild(gb_child)) {
703  bool is_tmp = GB_is_temporary(gb_child);
704  if (!is_tmp) {
705  error = set_parents_with_only_temp_childs_temp(gb_child, made_temp);
706  if (!error) is_tmp = GB_is_temporary(gb_child); // may have changed
707 
708  if (!is_tmp) has_savable_child = true;
709  }
710  }
711  if (!error && !has_savable_child) {
712  error = GB_set_temporary(gbd);
713  made_temp.push_back(gbd);
714  }
715  }
716 
717  return error;
718 }
719 
720 static GB_ERROR clear_temp_flags(DataPointers& made_temp) {
721  GB_ERROR error = NULp;
722  for (DataPointers::iterator mt = made_temp.begin(); mt != made_temp.end() && !error; ++mt) {
723  error = GB_clear_temporary(*mt);
724  }
725  return error;
726 }
727 
728 GB_ERROR AW_root::save_properties(const char *filename) {
729  GB_ERROR error = NULp;
730  GBDATA *gb_prop = application_database;
731 
732  if (!gb_prop) {
733  error = "No properties loaded - won't save";
734  }
735  else {
736  error = GB_push_transaction(gb_prop);
737  if (!error) {
739  error = GB_pop_transaction(gb_prop);
740  if (!error) {
742 
743  DataPointers made_temp;
744  error = set_parents_with_only_temp_childs_temp(gb_prop, made_temp); // avoid saving empty containers
745  if (!error) error = GB_save_in_arbprop(gb_prop, filename, "a");
746  if (!error) error = clear_temp_flags(made_temp);
747  }
748  }
749  }
750 
751  return error;
752 }
753 
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:551
GB_HASH * action_hash
static GB_ERROR set_parents_with_only_temp_childs_temp(GBDATA *gbd, DataPointers &made_temp)
Definition: AW_root.cxx:697
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:558
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:329
int active_windows
Definition: aw_root.hxx:116
GB_ERROR save_properties(const char *filename=NULp) __ATTR__USERESULT
Definition: AW_root.cxx:728
const char * awar
Definition: AW_root.cxx:325
void dont_save_awars_with_default_value(GBDATA *gb_db)
Definition: AW_root.cxx:657
AW_window * current_modal_window
Definition: aw_root.hxx:115
AW_window * aw
Definition: aw_window.hxx:133
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:378
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:593
void add_timed_callback(int ms, const TimedCallback &tcb)
Definition: AW_root.cxx:590
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:357
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:492
GB_ERROR GB_push_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2494
const char * fb
Definition: AW_root.cxx:324
int ARB_strNULLcmp(const char *s1, const char *s2)
Definition: arb_str.h:52
#define cb(action)
const char * init
Definition: AW_root.cxx:326
void AW_clock_cursor(AW_root *awr)
Definition: AW_root.cxx:30
std::list< GBDATA * > DataPointers
Definition: AW_root.cxx:695
static void AW_timer_callback_never_disabled(XtPointer aw_timer_cb_struct, XtIntervalId *)
Definition: AW_root.cxx:582
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:612
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:575
#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:561
static arb_status_implementation AW_status_impl
Definition: AW_root.cxx:361
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:652
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:538
static arb_handlers aw_handlers
Definition: AW_root.cxx:371
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:601
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:606
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:720
#define EXIT_FAILURE
Definition: arb_a2ps.c:157
AW_rgb * color_table
void unlink_awars_from_DB(GBDATA *gb_main)
Definition: AW_root.cxx:688
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:2186
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:303
void main_loop()
Definition: AW_root.cxx:677
#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:632
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:307
static void aw_message_and_dump_stderr(const char *msg)
Definition: AW_root.cxx:351
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:312
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:553
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:362
#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:1358
static void unlink_awar_from_DB(const char *, long cl_awar, void *cl_gb_main)
Definition: AW_root.cxx:682
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
static void call_registered_via_alias(AW_window *aww, AW_cb *target_cb)
Definition: AW_root.cxx:265
GB_transaction ta(gb_var)
void run_callbacks()
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:622
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
Definition: adquery.cxx:531
void alias_remote_command(const char *action_alias, const char *registered_action)
Definition: AW_root.cxx:270
void callAfter(unsigned ms, timer_callback tc)
Definition: AW_root.cxx:566
AW_awar * awar_pointer(const char *var_name, GBDATA *default_value=NULp, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:642
void recallOrUninstall(unsigned restart, timer_callback tc)
Definition: AW_root.cxx:569
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:529
begin timer stuff
Definition: AW_root.cxx:544
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:474
AW_ProcessEventType
Definition: aw_root.hxx:49