~ubuntu-branches/debian/jessie/arb/jessie

« back to all changes in this revision

Viewing changes to WINDOW/aw_root.hxx

  • Committer: Package Import Robot
  • Author(s): Elmar Pruesse, Andreas Tille, Elmar Pruesse
  • Date: 2014-09-02 15:15:06 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140902151506-jihq58b3iz342wif
Tags: 6.0.2-1
[ Andreas Tille ]
* New upstream version
  Closes: #741890
* debian/upstream -> debian/upstream/metadata
* debian/control:
   - Build-Depends: added libglib2.0-dev
   - Depends: added mafft, mrbayes
* debian/rules
   - Add explicite --remove-section=.comment option to manual strip call
* cme fix dpkg-control
* arb-common.dirs: Do not create unneeded lintian dir
* Add turkish debconf translation (thanks for the patch to Mert Dirik
  <mertdirik@gmail.com>)
  Closes: #757497

[ Elmar Pruesse ]
* patches removed:
   - 10_config.makefiles.patch,
     80_no_GL.patch
       removed in favor of creating file from config.makefile.template via 
       sed in debian/control
   - 20_Makefile_main.patch
       merged upstream
   - 21_Makefiles.patch
       no longer needed
   - 30_tmpfile_CVE-2008-5378.patch: 
       merged upstream
   - 50_fix_gcc-4.8.patch:
       merged upstream
   - 40_add_libGLU.patch:
       libGLU not needed for arb_ntree)
   - 60_use_debian_packaged_raxml.patch:
       merged upstream
   - 70_hardening.patch
       merged upstream
   - 72_add_math_lib_to_linker.patch
       does not appear to be needed
* patches added:
   - 10_upstream_r12793__show_db_load_progress:
       backported patch showing progress while ARB is loading a database
       (needed as indicator/splash screen while ARB is launching)
   - 20_upstream_r12794__socket_permissions:
       backported security fix
   - 30_upstream_r12814__desktop_keywords:
       backported add keywords to desktop (fixes lintian warning)
   - 40_upstream_r12815__lintian_spelling:
       backported fix for lintian reported spelling errors
   - 50_private_nameservers
       change configuration to put nameservers into users home dirs
       (avoids need for shared writeable directory)
   - 60_use_debian_phyml
       use phyml from debian package for both interfaces in ARB
* debian/rules:
   - create config.makefile from override_dh_configure target
   - use "make tarfile" in override_dh_install
   - remove extra cleaning not needed for ARB 6
   - use "dh_install --list-missing" to avoid missing files
   - added override_dh_fixperms target
* debian/control:
   - added libarb-dev package
   - Depends: added phyml, xdg-utils
   - Suggests: removed phyml
   - fix lintian duplicate-short-description (new descriptions)
* debian/*.install:
   - "unrolled" confusing globbing to select files
   - pick files from debian/tmp
   - moved all config files to /etc/arb
* debian/arb-common.templates: updated
* scripts:
   - removed arb-add-pt-server
   - launch-wrapper: 
     - only add demo.arb to newly created $ARBUSERDATA
     - pass commandline arguments through bin/arb wrapper
   - preinst: removing old PT server index files on upgrade from 5.5*
   - postinst: set setgid on shared PT dir
* rewrote arb.1 manfile
* added file icon for ARB databases
* using upstream arb_tcp.dat

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef AW_ROOT_HXX
2
2
#define AW_ROOT_HXX
3
3
 
4
 
#ifndef _STDIO_H
5
 
#include <stdio.h>
 
4
#ifndef ARBTOOLS_H
 
5
#include <arbtools.h>
 
6
#endif
 
7
#ifndef ARB_ERROR_H
 
8
#include <arb_error.h>
 
9
#endif
 
10
#ifndef CB_H
 
11
#include <cb.h>
 
12
#endif
 
13
#ifndef ATTRIBUTES_H
 
14
#include <attributes.h>
 
15
#endif
 
16
#ifndef AW_BASE_HXX
 
17
#include "aw_base.hxx" // @@@ remove later
6
18
#endif
7
19
 
8
20
#ifndef aw_assert
9
 
#ifndef ARB_ASSERT_H
10
 
#include <arb_assert.h>
11
 
#endif
12
21
#define aw_assert(bed) arb_assert(bed)
13
22
#endif
14
23
 
15
 
#ifndef ATTRIBUTES_H
16
 
#include <attributes.h>
17
 
#endif
18
 
#ifndef ARBDB_BASE_H
19
 
#include <arbdb_base.h>
20
 
#endif
21
 
 
22
 
 
23
 
#define AW_ROOT_DEFAULT (aw_main_root_default)
24
 
class        AW_root;
25
 
class        AW_window;
26
 
typedef long AW_CL;             // generic client data type (void *)
27
 
 
28
 
typedef void (*AW_RCB)(AW_root*,AW_CL,AW_CL);
29
 
typedef void (*AW_RCB0)(AW_root*);
30
 
typedef void (*AW_RCB1)(AW_root*,AW_CL);
31
 
typedef void (*AW_RCB2)(AW_root*,AW_CL,AW_CL);
32
 
typedef AW_window *(*AW_PPP)(AW_root*,AW_CL,AW_CL);
33
 
 
34
 
typedef const char *AWAR;
35
 
typedef long        AW_bitset;
36
 
typedef double      AW_pos;
37
 
typedef float       AW_grey_level;                  // <0 dont fill  0.0 white 1.0 black
38
 
typedef GBDATA     *AW_default;
39
 
typedef AW_bitset   AW_active;                      // bits to activate/inactivate buttons
40
 
typedef int         AW_font;
41
 
 
42
 
typedef const char             *GB_ERROR;
43
 
typedef struct gbs_hash_struct  GB_HASH;
44
 
 
45
 
extern AW_default aw_main_root_default;
46
 
 
47
 
typedef struct _WidgetRec *Widget;
48
 
 
49
 
// #define AWUSE(variable) variable = variable
50
 
#if defined(DEBUG) && defined(DEVEL_RALF) && 0
51
 
#define AWUSE(variable) (void)variable; int DONT_USE_AWUSE_FOR_##variable
52
 
#else
53
 
#define AWUSE(variable) (void)variable
54
 
#endif // DEBUG
55
 
// AWUSE is a obsolete way to get rid of unused-warnings. Will be removed in the future - do not use!
56
 
// If your warning is about a parameter, skip the parameters name.
57
 
// If your warning is about a variable, the variable is superfluous and should most likely be removed.
58
 
 
59
 
 
60
 
#if defined(DEBUG)
 
24
#if defined(ASSERTION_USED)
61
25
#define legal_mask(m) (((m)&AWM_ALL) == (m))
62
 
#endif // DEBUG
63
 
 
64
 
typedef enum {
65
 
    AW_NONE    = 0,
66
 
    AW_BIT     = 1,
67
 
    AW_BYTE    = 2,
68
 
    AW_INT     = 3,
69
 
    AW_FLOAT   = 4,
70
 
    AW_POINTER = 5, 
71
 
    AW_BITS    = 6,
72
 
    // 7 is unused
73
 
    AW_BYTES   = 8,
74
 
    AW_INTS    = 9,
75
 
    AW_FLOATS  = 10,
76
 
    AW_STRING  = 12,
77
 
    // 13 is reserved (GB_STRING_SHRT)
78
 
    // 14 is unused
79
 
    AW_DB      = 15,
80
 
 
81
 
    // keep AW_VARIABLE_TYPE consistent with GB_TYPES
82
 
    // see ../ARBDB/arbdb.h@sync_GB_TYPES_AW_VARIABLE_TYPE
83
 
 
84
 
    AW_TYPE_MAX = 16
85
 
} AW_VARIABLE_TYPE;
86
 
 
87
 
typedef struct {
88
 
    int t, b, l, r;
89
 
} AW_rectangle;
90
 
 
91
 
typedef struct {
92
 
    AW_pos t, b, l, r;
93
 
} AW_world;
 
26
#endif // ASSERTION_USED
94
27
 
95
28
typedef char *AW_error;
96
29
 
97
 
int  aw_question  (const char *msg, const char *buttons, bool fixedSizeButtons = true, const char *helpfile = 0);
98
 
bool aw_ask_sure  (const char *msg, bool fixedSizeButtons = true, const char *helpfile = 0);
99
 
void aw_popup_ok  (const char *msg, bool fixedSizeButtons = true, const char *helpfile = 0);
100
 
void aw_popup_exit(const char *msg, bool fixedSizeButtons = true, const char *helpfile = 0) __ATTR__NORETURN;
101
 
 
102
30
// asynchronous messages:
103
31
extern char AW_ERROR_BUFFER[1024];
104
32
 
105
 
void aw_set_local_message();                                           // no message window, AWAR_ERROR_MESSAGES instead
106
 
void aw_message(const char *msg);
107
 
void aw_message();                                                     // prints AW_ERROR_BUFFER;
108
 
void aw_macro_message(const char *temp, ...) __ATTR__FORMAT(1);        // gives control to the user
 
33
void aw_set_local_message(); // no message window, AWAR_ERROR_MESSAGES instead (used by EDIT4)
109
34
 
110
35
// Read a string from the user :
111
36
char *aw_input(const char *title, const char *prompt, const char *default_input);
112
37
char *aw_input(const char *prompt, const char *default_input);
113
38
inline char *aw_input(const char *prompt) { return aw_input(prompt, NULL); }
114
39
 
115
 
char *aw_input2awar(const char *title, const char *prompt, const char *awar_value);
116
 
char *aw_input2awar(const char *prompt, const char *awar_value);
117
 
 
118
 
char *aw_string_selection     (const char *title, const char *prompt, const char *default_value, const char *value_list, const char *buttons, char *(*check_fun)(const char*));
119
 
char *aw_string_selection2awar(const char *title, const char *prompt, const char *awar_name,     const char *value_list, const char *buttons, char *(*check_fun)(const char*));
 
40
char *aw_string_selection     (const char *title, const char *prompt, const char *default_value, const char *value_list, const char *buttons);
 
41
char *aw_string_selection2awar(const char *title, const char *prompt, const char *awar_name,     const char *value_list, const char *buttons);
120
42
 
121
43
int aw_string_selection_button();   // returns index of last selected button (destroyed by aw_string_selection and aw_input)
122
44
 
123
 
void AW_ERROR(const char *templat, ...) __ATTR__FORMAT(1);
124
 
 
125
 
void aw_initstatus( void );     // call this function only once as early as possible
126
 
void aw_openstatus( const char *title ); // show status
127
 
void aw_closestatus( void );    // hide status
128
 
 
129
 
int aw_status( const char *text );      // return 1 if exit button is pressed + set statustext
130
 
 
131
 
#ifdef __cplusplus
132
 
extern "C" {
133
 
#endif
134
 
 
135
 
    int aw_status( double gauge );  // return 1 if exit button is pressed + set statusslider
136
 
 
137
 
#ifdef __cplusplus
138
 
}
139
 
#endif
140
 
 
141
 
int aw_status( void );      // return 1 if exit button is pressed
142
 
 
143
 
void aw_error( const char *text, const char *text2 );   // internal error: asks for core
 
45
char *aw_file_selection(const char *title, const char *dir, const char *def_name, const char *suffix);
144
46
 
145
47
class  AW_root_Motif;
146
48
class  AW_awar;
147
 
struct AW_var_callback;
148
 
struct AW_xfig_vectorfont;
 
49
struct AW_buttons_struct;
 
50
class  AW_root_cblist;
 
51
struct GB_HASH;
 
52
class  AW_cb;
149
53
 
150
 
typedef enum  {
 
54
enum AW_ProcessEventType {
151
55
    NO_EVENT     = 0,
152
56
    KEY_PRESSED  = 2,
153
57
    KEY_RELEASED = 3
154
 
} AW_ProcessEventType;
155
 
 
156
 
class AW_root {
157
 
public:
158
 
    static  AW_root *THIS;
159
 
    AW_root_Motif   *prvt;                          // Do not use !!!
160
 
    bool             value_changed;
161
 
    long             changer_of_variable;
162
 
    int              y_correction_for_input_labels;
163
 
    AW_active        global_mask;
164
 
    GB_HASH         *hash_table_for_variables;
165
 
    bool             variable_set_by_toggle_field;
166
 
    int              number_of_toggle_fields;
167
 
    int              number_of_option_menues;
168
 
    char            *program_name;
169
 
 
170
 
    void            *get_aw_var_struct(char *awar);
171
 
    void            *get_aw_var_struct_no_error(char *awar);
172
 
 
173
 
    bool                    disable_callbacks;
174
 
    struct AW_var_callback *focus_callback_list;
 
58
};
 
59
 
 
60
void aw_initstatus();
 
61
 
 
62
// ---------------------------
 
63
//      UserActionTracker
 
64
 
 
65
class UserActionTracker : virtual Noncopyable {
 
66
    bool tracking;
 
67
 
 
68
protected:
 
69
    void set_tracking(bool track) { tracking = track; }
 
70
 
 
71
public:
 
72
    UserActionTracker() : tracking(false) {}
 
73
    virtual ~UserActionTracker() {}
 
74
 
 
75
    bool is_tracking() const { return tracking; }
 
76
 
 
77
    virtual void track_action(const char *action_id) = 0;
 
78
    virtual void track_awar_change(AW_awar *awar)    = 0;
 
79
    virtual bool is_replaceable() const = 0;
 
80
};
 
81
class NullTracker : public UserActionTracker {
 
82
public:
 
83
    void track_action(const char */*action_id*/) OVERRIDE {}
 
84
    void track_awar_change(AW_awar */*awar*/) OVERRIDE {}
 
85
    bool is_replaceable() const OVERRIDE { return true; }
 
86
};
 
87
 
 
88
// -----------------
 
89
//      AW_root
 
90
 
 
91
class AW_root : virtual Noncopyable {
 
92
    AW_default         application_database;
 
93
    AW_buttons_struct *button_sens_list;
 
94
 
 
95
    UserActionTracker *tracker;
 
96
 
 
97
    void create_colormap();
 
98
 
 
99
    void init_variables(AW_default database);
 
100
    void exit_variables();
 
101
 
 
102
    void init_root(const char *programname, bool no_exit);
 
103
    void exit_root();
 
104
    AW_default load_properties(const char *default_name);
 
105
 
 
106
public:
 
107
    static AW_root *SINGLETON;
 
108
 
 
109
    AW_root_Motif *prvt;                            // Do not use !!!
 
110
    bool           value_changed;
 
111
    Widget         changer_of_variable;
 
112
    int            y_correction_for_input_labels;
 
113
    AW_active      global_mask;
 
114
    bool           focus_follows_mouse;
 
115
    GB_HASH       *hash_table_for_variables;
 
116
    bool           variable_set_by_toggle_field;
 
117
    int            number_of_toggle_fields;
 
118
    int            number_of_option_menus;
 
119
    char          *program_name;
 
120
 
 
121
    bool            disable_callbacks;
 
122
    AW_window      *current_modal_window;
 
123
    AW_root_cblist *focus_callback_list;
175
124
 
176
125
    int  active_windows;
177
126
    void window_show();         // a window is set to screen
178
 
    void window_hide();
 
127
    void window_hide(AW_window *aww);
179
128
 
180
 
    /********************* the read only  public section ***********************/
181
 
    AW_default  application_database;
 
129
    // the read only public section:
182
130
    short       font_width;
183
131
    short       font_height;
184
132
    short       font_ascent;
185
133
    GB_HASH    *hash_for_windows;
186
134
 
187
 
    /* PJ - vectorfont stuff */
188
 
    float  vectorfont_userscale; // user scaling
189
 
    char  *vectorfont_name;     // name of font
190
 
    int    vectorfont_zoomtext; // zoomtext calls: 0 = Xfont, 1 = vectorfont
191
 
    
192
 
    AW_xfig_vectorfont *vectorfont_lines; // graphic data of the font
193
 
 
194
 
    /************************* the real public section *************************/
195
 
 
196
 
    AW_root();
 
135
    // the real public section:
 
136
    AW_root(const char *propertyFile, const char *program, bool no_exit, UserActionTracker *user_tracker, int* argc, char*** argv);
 
137
#if defined(UNIT_TESTS) // UT_DIFF
 
138
    AW_root(const char *properties); // fake-root for unit-tests (allows access to awar-subsystem)
 
139
#endif
197
140
    ~AW_root();
 
141
 
 
142
    void setUserActionTracker(UserActionTracker *user_tracker);
 
143
    UserActionTracker *getTracker() { return tracker; }
 
144
 
198
145
    enum { AW_MONO_COLOR, AW_RGB_COLOR }    color_mode;
199
146
 
200
 
    void init_variables( AW_default database );
201
 
    void init_root( const char *programmname , bool no_exit);
202
 
    void main_loop(void);
203
 
    void process_events(void); // might block
204
 
    void process_pending_events(void); // non-blocking
 
147
    void main_loop();
 
148
 
 
149
    void                process_events();           // might block
 
150
    void                process_pending_events();   // non-blocking
205
151
    AW_ProcessEventType peek_key_event(AW_window *);
206
152
 
207
 
    void add_timed_callback               (int ms, AW_RCB2 f, AW_CL cd1, AW_CL cd2);
208
 
    void add_timed_callback_never_disabled(int ms, AW_RCB2 f, AW_CL cd1, AW_CL cd2);
209
 
 
210
 
    void add_timed_callback               (int ms, AW_RCB1 f, AW_CL cd1) { add_timed_callback               (ms, (AW_RCB2)f, cd1, 0); }
211
 
    void add_timed_callback_never_disabled(int ms, AW_RCB1 f, AW_CL cd1) { add_timed_callback_never_disabled(ms, (AW_RCB2)f, cd1, 0); }
212
 
 
213
 
    void add_timed_callback               (int ms, AW_RCB0 f) { add_timed_callback               (ms, (AW_RCB2)f, 0, 0); }
214
 
    void add_timed_callback_never_disabled(int ms, AW_RCB0 f) { add_timed_callback_never_disabled(ms, (AW_RCB2)f, 0, 0); }
215
 
 
216
 
    void set_focus_callback(void(*f)(class AW_root*, AW_CL, AW_CL), AW_CL cd1, AW_CL cd2); /* any focus callback in any window */
 
153
    void add_timed_callback(int ms, const TimedCallback& tcb);
 
154
    void add_timed_callback_never_disabled(int ms, const TimedCallback& tcb);
 
155
 
 
156
    bool is_focus_callback(AW_RCB fcb) const;
217
157
 
218
158
    AW_awar *awar(const char *awar);
219
159
    AW_awar *awar_no_error(const char *awar);
220
160
 
 
161
    void dont_save_awars_with_default_value(GBDATA *gb_db);
 
162
 
221
163
    AW_awar *awar_string (const char *var_name, const char *default_value = "", AW_default default_file = AW_ROOT_DEFAULT);
222
164
    AW_awar *awar_int    (const char *var_name, long default_value = 0,         AW_default default_file = AW_ROOT_DEFAULT);
223
165
    AW_awar *awar_float  (const char *var_name, float default_value = 0.0,      AW_default default_file = AW_ROOT_DEFAULT);
227
169
 
228
170
    void unlink_awars_from_DB(GBDATA *gb_main);     // use before calling GB_close for 'gb_main', if you have AWARs in DB
229
171
 
230
 
    AW_default  open_default(const char *default_name, bool create_if_missing = true);
231
 
    AW_error   *save_default( const char *awar_name );
232
 
    AW_error   *save_default( const char *awar_name, const char *file_name );
233
 
    AW_error   *save_default(AW_default aw_default, const char *file_name);
234
 
    AW_default  get_default(const char *varname);
235
 
    AW_default  get_gbdata(const char *varname);
236
 
 
237
 
    // ************** Set and clear sensitivity of buttons and menus  *********
 
172
    AW_default check_properties(AW_default aw_props) {
 
173
        return aw_props ? aw_props : application_database;
 
174
    }
 
175
 
 
176
    GB_ERROR save_properties(const char *filename = NULL) __ATTR__USERESULT;
 
177
 
 
178
    // Control sensitivity of buttons etc.:
238
179
    void apply_sensitivity(AW_active mask);
 
180
    void apply_focus_policy(bool follow_mouse);
239
181
    void make_sensitive(Widget w, AW_active mask);
240
 
 
241
 
    GB_ERROR start_macro_recording(const char *file,const char *application_id, const char *stop_action_name);
242
 
    GB_ERROR stop_macro_recording();
243
 
    GB_ERROR execute_macro(const char *file);
244
 
    void     stop_execute_macro(); // Starts macro window main loop, delayed return
245
 
    GB_ERROR enable_execute_macro(FILE *mfile,const char *mname); // leave macro window main loop, returns stop_execute_macro
246
 
 
247
 
    void define_remote_command(struct AW_cb_struct *cbs);
248
 
    GB_ERROR check_for_remote_command(AW_default gb_main,const char *rm_base);
249
 
 
250
 
    /*************************************************************************
251
 
                                          Fonts
252
 
    *************************************************************************/
253
 
    const char  *font_2_ascii(AW_font font_nr); // converts fontnr to string
254
 
    // returns 0 if font is not available
255
 
    int font_2_xfig(AW_font font_nr);   // converts fontnr to xfigid
256
 
    // negative values indicate monospaced f.
 
182
    bool remove_button_from_sens_list(Widget button);
 
183
 
 
184
    void track_action(const char *action_id) { tracker->track_action(action_id); }
 
185
    void track_awar_change(AW_awar *changed_awar) { tracker->track_awar_change(changed_awar); }
 
186
 
 
187
    bool is_tracking() const { return tracker->is_tracking(); }
 
188
    UserActionTracker *get_tracker() { return tracker; }
 
189
 
 
190
    void define_remote_command(class AW_cb *cbs);
 
191
    AW_cb *search_remote_command(const char *action);
257
192
 
258
193
#if defined(DEBUG)
259
194
    size_t callallcallbacks(int mode);
260
 
#endif // DEBUG
261
 
};
262
 
 
263
 
 
264
 
/*************************************************************************
265
 
                AWARS
266
 
*************************************************************************/
267
 
struct AW_var_callback;
268
 
struct AW_var_target;
269
 
 
270
 
typedef void (*Awar_CB)(AW_root *, AW_CL, AW_CL);
271
 
typedef void (*Awar_CB2)(AW_root *, AW_CL, AW_CL);
272
 
typedef void (*Awar_CB1)(AW_root *, AW_CL);
273
 
typedef void (*Awar_CB0)(AW_root *);
274
 
 
275
 
typedef struct gb_data_base_type GBDATA;
276
 
 
277
 
class AW_awar {
278
 
    struct {
279
 
        struct {
280
 
            float min;
281
 
            float max;
282
 
        } f;
283
 
        const char *srt;
284
 
    } pp;
285
 
 
286
 
    struct AW_var_callback *callback_list;
287
 
    struct AW_var_target   *target_list;
288
 
 
289
 
#if defined(DEBUG)
290
 
    bool is_global;
291
 
#endif // DEBUG
292
 
 
293
 
    void remove_all_callbacks();
294
 
    void remove_all_target_vars();
295
 
    bool unlink_from_DB(GBDATA *gb_main);
296
 
 
297
 
    friend long AW_unlink_awar_from_DB(const char *key, long cl_awar, void *cl_gb_main);
298
 
    friend void AW_var_gbdata_callback_delete_intern(GBDATA *gbd, int *cl);
299
 
 
300
 
public:
301
 
    // read only
302
 
    class AW_root *root;
303
 
 
304
 
    GBDATA *gb_var;                                 // if unmapped, points to same DB elem as 'gb_origin'
305
 
    GBDATA *gb_origin;                              // this is set ONCE on creation of awar
306
 
 
307
 
    // read only
308
 
 
309
 
    AW_VARIABLE_TYPE  variable_type;                // type of the awar
310
 
    char             *awar_name;                    // name of the awar
311
 
 
312
 
    void run_callbacks();
313
 
    void update_target(AW_var_target*pntr);
314
 
    void update_targets();
315
 
    
316
 
    AW_awar( AW_VARIABLE_TYPE var_type, const char *var_name, const char *var_value, double var_double_value, AW_default default_file, AW_root *root );
317
 
 
318
 
    AW_awar *add_callback(Awar_CB2 f, AW_CL cd1, AW_CL cd2);
319
 
    AW_awar *add_callback(Awar_CB1 f, AW_CL cd1);
320
 
    AW_awar *add_callback(Awar_CB0 f);
321
 
 
322
 
    AW_awar *remove_callback( Awar_CB2 f, AW_CL cd1, AW_CL cd2 ); // remove a callback
323
 
    AW_awar *remove_callback( Awar_CB1 f, AW_CL cd1 );
324
 
    AW_awar *remove_callback( Awar_CB0 f);
325
 
 
326
 
    AW_awar *add_target_var( char **ppchr);
327
 
    AW_awar *add_target_var( long *pint);
328
 
    AW_awar *add_target_var( float *pfloat);
329
 
    void    update();       // awar has changed
330
 
 
331
 
    AW_awar *set_minmax(float min, float max);
332
 
    AW_awar *set_srt(const char *srt);
333
 
 
334
 
    AW_awar *map(const char *awarn) { return this->map(root->awar(awarn)); }
335
 
    AW_awar *map(AW_default dest); /* map to new address */
336
 
    AW_awar *map(AW_awar *dest); /* map to new address */
337
 
    AW_awar *unmap();           /* map to original address */
338
 
 
339
 
    void get(char **p_string )  { freeset(*p_string, read_string()); } /* deletes existing targets !!!*/
340
 
    void get(long *p_int )      { *p_int =  (long)read_int(); }
341
 
    void get(double *p_double ) { *p_double =  read_float(); }
342
 
    void get(float *p_float )   { *p_float = read_float(); }
343
 
 
344
 
    AW_VARIABLE_TYPE get_type();
345
 
 
346
 
    char       *read_string();
347
 
    const char *read_char_pntr();
348
 
    char       *read_as_string();
349
 
    long        read_int();
350
 
    double      read_float();
351
 
    void       *read_pointer();
352
 
 
353
 
    GB_ERROR write_string(const char *aw_string);
354
 
    GB_ERROR write_as_string(const char *aw_string);
355
 
    GB_ERROR write_int(long aw_int);
356
 
    GB_ERROR write_float(double aw_double);
357
 
    GB_ERROR write_pointer(void *aw_pointer);
358
 
 
359
 
    GB_ERROR write_as(char *aw_value) { return write_as_string(aw_value);};
360
 
 
361
 
    // same as write_-versions above, but always touches the database field
362
 
    GB_ERROR rewrite_string(const char *aw_string);
363
 
    GB_ERROR rewrite_as_string(const char *aw_string);
364
 
    GB_ERROR rewrite_int(long aw_int);
365
 
    GB_ERROR rewrite_float(double aw_double);
366
 
    GB_ERROR rewrite_pointer(void *aw_pointer);
367
 
    
368
 
    GB_ERROR rewrite_as(char *aw_value) { return rewrite_as_string(aw_value);};
369
 
 
370
 
    GB_ERROR toggle_toggle();   /* switches between 1/0 */
371
 
    void     touch(void);
372
 
 
373
 
    GB_ERROR make_global() __ATTR__USERESULT;       // should be used by ARB_init_global_awars only
374
 
};
 
195
    class ConstStrArray *get_action_ids();
 
196
#endif // DEBUG
 
197
};
 
198
 
 
199
const char *AW_font_2_ascii(AW_font font_nr);
 
200
int         AW_font_2_xfig(AW_font font_nr);
375
201
 
376
202
bool ARB_global_awars_initialized();
377
 
GB_ERROR ARB_init_global_awars(AW_root *aw_root, AW_default aw_def, GBDATA *gb_main) __ATTR__USERESULT;
378
 
 
379
 
// ----------------------------------
380
 
//      class Awar_Callback_Info
381
 
// ----------------------------------
382
 
 
383
 
class Awar_Callback_Info {
384
 
    // this structure is used to store all information on an awar callback
385
 
    // and can be used to remove or remap awar callback w/o knowing anything else
386
 
 
387
 
    AW_root *awr;
388
 
    Awar_CB  callback;
389
 
    AW_CL    cd1, cd2;
390
 
    char    *awar_name;
391
 
    char    *org_awar_name;
392
 
 
393
 
    void init (AW_root *awr_, const char *awar_name_, Awar_CB2 callback_, AW_CL cd1_, AW_CL cd2_);
394
 
 
395
 
public:
396
 
    Awar_Callback_Info(AW_root *awr_, const char *awar_name_, Awar_CB2 callback_, AW_CL cd1_, AW_CL cd2_)   { init(awr_, awar_name_, callback_, cd1_, cd2_); }
397
 
    Awar_Callback_Info(AW_root *awr_, const char *awar_name_, Awar_CB1 callback_, AW_CL cd1_)               { init(awr_, awar_name_, (Awar_CB2)callback_, cd1_, 0); }
398
 
    Awar_Callback_Info(AW_root *awr_, const char *awar_name_, Awar_CB0 callback_)                           { init(awr_, awar_name_, (Awar_CB2)callback_, 0, 0); }
399
 
 
400
 
    ~Awar_Callback_Info() {
401
 
        delete awar_name;
402
 
        delete org_awar_name;
403
 
    }
404
 
 
405
 
    void add_callback() { awr->awar(awar_name)->add_callback(callback, cd1, cd2); }
406
 
    void remove_callback() { awr->awar(awar_name)->remove_callback(callback, cd1, cd2); }
407
 
 
408
 
    void remap(const char *new_awar);
409
 
 
410
 
    const char *get_awar_name() const { return awar_name; }
411
 
    const char *get_org_awar_name() const { return org_awar_name; }
412
 
    AW_root *get_root() { return awr; }
413
 
};
 
203
bool ARB_in_expert_mode(AW_root *awr);
 
204
inline bool ARB_in_novice_mode(AW_root *awr) { return !ARB_in_expert_mode(awr); }
 
205
 
 
206
void ARB_declare_global_awars(AW_root *aw_root, AW_default aw_def);
 
207
GB_ERROR ARB_bind_global_awars(GBDATA *gb_main) __ATTR__USERESULT;
 
208
 
 
209
__ATTR__USERESULT_TODO inline GB_ERROR ARB_init_global_awars(AW_root *aw_root, AW_default aw_def, GBDATA *gb_main) {
 
210
    ARB_declare_global_awars(aw_root, aw_def);
 
211
    return ARB_bind_global_awars(gb_main);
 
212
}
 
213
 
 
214
inline AW_default get_AW_ROOT_DEFAULT() { return AW_root::SINGLETON->check_properties(NULL); }
 
215
 
 
216
void AW_system(AW_window *aww, const char *command, const char *auto_help_file);
414
217
 
415
218
#else
416
219
#error aw_root.hxx included twice
417
220
#endif
 
221
 
 
222