source: tags/arb_5.5/EDIT4/ed4_defs.hxx

Last change on this file was 6358, checked in by westram, 14 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.2 KB
Line 
1#ifndef ED4_DEFS_HXX
2#define ED4_DEFS_HXX
3
4#ifndef AW_COLOR_GROUPS_HXX
5#include <aw_color_groups.hxx>
6#endif
7#ifndef AW_WINDOW_HXX
8#include <aw_window.hxx>
9#endif
10#ifndef ARBDB_H
11#include <arbdb.h>
12#endif
13
14
15//needed prototype classes
16class ED4_root;
17class ED4_database;
18
19typedef const char  ED4_ERROR;
20typedef int     ED4_COORDINATE;
21
22typedef enum ad_edit_modus {
23    AD_ALIGN,   // add & remove of . possible (default)
24    AD_NOWRITE, // no edits allowed
25    AD_NOWRITE_IF_COMPRESSED,
26    AD_REPLACE, // all edits (overwrite)
27    AD_INSERT   // all edits (insert)
28} ED4_EDITMODI;
29
30
31//global variables
32extern GBDATA       *GLOBAL_gb_main;
33extern ED4_root     *ED4_ROOT;
34extern ED4_database *main_db;
35
36extern int TERMINALHEIGHT;      // this variable replaces the define
37extern int INFO_TERM_TEXT_YOFFSET;
38extern int SEQ_TERM_TEXT_YOFFSET;
39
40extern int  MAXSEQUENCECHARACTERLENGTH;             // greatest # of characters in a sequence string terminal
41extern int  MAXSPECIESWIDTH;
42extern int  MAXINFOWIDTH;
43extern long ED4_counter;
44
45// use ED4_init_notFoundMessage and ED4_finish_and_show_notFoundMessage to
46// modify the following elements
47#define MAX_SHOWN_MISSING_SPECIES 200U              // limit no of missing species/data printed into not_found_message
48extern size_t         not_found_counter;            // nr of species which haven't been found
49extern GBS_strstruct *not_found_message;            // error message containing (some) missing/unloadable species
50
51extern long         max_seq_terminal_length;        // global maximum of sequence terminal length
52extern ED4_EDITMODI awar_edit_modus;
53extern long         awar_edit_direction;
54extern bool         move_cursor;                    //only needed for editing in consensus
55extern bool         DRAW;
56extern bool         last_window_reached;            //only needed for refreshing all windows
57
58extern size_t status_count_total; // used for consensus progress bar
59extern size_t status_count_curr;
60
61extern bool loading;
62
63// globally used defines and flags
64
65#define INFINITE    -1
66#define SLIDER_OFFSET   5
67
68// these are recommended for accessing ED4_extension:
69#define X_POS       0
70#define Y_POS       1
71#define WIDTH       0
72#define HEIGHT      1
73
74// size of some display elements:
75#define BRACKETWIDTH    10
76#define SPACERHEIGHT    5
77#define SPACERNOCONSENSUSHEIGHT 15 // height of spacer at top of group (used if consensus is hidden and group is folded)
78#define SEQUENCEINFOSIZE 50
79#define TREETERMINALSIZE 100
80
81#define COLUMN_STAT_ROW_HEIGHT(font_height)     (2.2*(font_height)) // each row contains 2 sub-rows (plus some xtra space)
82#define COLUMN_STAT_ROWS            4
83
84#define MAX_POSSIBLE_SEQ_LENGTH     100000000
85
86#define MAXCHARTABLE    256                     // Maximum of Consensustable
87#define MAXWINDOWS  5
88#define MINSPECFORSTATWIN   200
89
90#define AWAR_EDIT_MODE                  "tmp/edit4/edit_mode"
91#define AWAR_INSERT_MODE                "tmp/edit4/insert_mode"
92#define AWAR_EDIT_SECURITY_LEVEL        "tmp/edit4/security_level"
93#define AWAR_EDIT_SECURITY_LEVEL_ALIGN  "tmp/edit4/security_level_align"
94#define AWAR_EDIT_SECURITY_LEVEL_CHANGE "tmp/edit4/security_level_change"
95#define AWAR_EDIT_CONFIGURATION         "tmp/edit4/configuration"
96
97#define AWAR_EDIT_SEQ_POSITION   "tmp/edit4/jump_to_position%d" // used to create ED4_window.awar_path_for_cursor[]
98#define AWAR_EDIT_ECOLI_POSITION "tmp/edit4/cursor_ref_ecoli%d" // used to create ED4_window.awar_path_for_Ecoli[]
99#define AWAR_EDIT_BASE_POSITION  "tmp/edit4/cursor_to_basepos%d" // used to create ED4_window.awar_path_for_basePos[]
100#define AWAR_EDIT_IUPAC          "tmp/edit4/iupac%d" // used to create ED4_window.awar_path_for_IUPAC[]
101#define AWAR_EDIT_HELIXNR        "tmp/edit4/helixnr%d" // used to create ED4_window.awar_path_for_helixNr[]
102
103#define AWAR_FIELD_CHOSEN "tmp/edit4/field_chosen" // used for field selection box
104
105#define AWAR_EDIT_TITLE_MODE       "edit4/title_mode"
106#define AWAR_EDIT_HELIX_SPACING    "edit4/helix_add_spacing"
107#define AWAR_EDIT_TERMINAL_SPACING "edit4/terminal_add_spacing"
108
109#define CHARACTEROFFSET 5       // spacer-width left of text-terminal
110#define CONSENSUS       "Consensusfunktion"
111
112#define ED4_index   long
113
114inline int max(int x, int y)    { return x>y ? x : y; }
115inline int min(int x, int y)    { return x<y ? x : y; }
116inline int ABS(int x)       { return x<0 ? -x : x; }
117
118#define ED4_SCROLL_OVERLAP 20   // 15 Pixels overlap
119
120
121typedef enum
122{
123    ED4_L_NO_LEVEL      = 0x0,
124    ED4_L_ROOT          = 0x1,
125    ED4_L_DEVICE        = 0x2,
126    ED4_L_AREA          = 0x4,
127    ED4_L_MULTI_SPECIES     = 0x8,
128    ED4_L_SPECIES       = 0x10,
129    ED4_L_MULTI_SEQUENCE    = 0x20,
130    ED4_L_SEQUENCE      = 0x40,
131    ED4_L_TREE          = 0x80,
132    ED4_L_SPECIES_NAME      = 0x100,
133    ED4_L_SEQUENCE_INFO     = 0x200,                //evtl. aendern fuer Name-Manager und group-manager
134    ED4_L_SEQUENCE_STRING   = 0x400,
135    ED4_L_AA_SEQUENCE_STRING   = 0x600, //ykadi
136    ED4_L_SPACER        = 0x800,
137    ED4_L_LINE          = 0x1000,
138    ED4_L_MULTI_NAME        = 0x2000,
139    ED4_L_NAME_MANAGER      = 0x4000,
140    ED4_L_GROUP         = 0x8000,
141    ED4_L_BRACKET       = 0x10000,
142    ED4_L_PURE_TEXT     = 0x20000,
143    ED4_L_COL_STAT      = 0x40000
144}   ED4_level;
145
146
147
148typedef enum
149{
150    ED4_D_SPECIES,
151    ED4_D_EXTENDED
152}   ED4_datamode;
153
154
155typedef enum
156{
157    ED4_M_NO_MOVE   = 0,
158    ED4_M_HORIZONTAL    = 1,
159    ED4_M_VERTICAL  = 2,
160    ED4_M_FREE      = 4
161}   ED4_movemode;
162
163typedef enum
164{
165    ED4_R_OK        = 0,
166    ED4_R_WARNING   = 1,
167    ED4_R_IMPOSSIBLE    = 2,
168    ED4_R_ERROR     = 4,
169    ED4_R_BREAK     = 8,
170    ED4_R_DESASTER  = 16,
171    ED4_R_ALL       = 0x7fffffff
172}   ED4_returncode;
173
174typedef enum
175{
176    ED4_A_TOP_AREA,
177    ED4_A_MIDDLE_AREA,
178    ED4_A_BOTTOM_AREA,
179    ED4_A_ERROR
180}   ED4_AREA_LEVEL;
181
182typedef enum
183{
184        ED4_B_LEFT_BUTTON   = 1,
185        ED4_B_MIDDLE_BUTTON     = 2,
186        ED4_B_RIGHT_BUTTON  = 3
187}          ED4_mouse_buttons;
188
189typedef enum
190{
191    ED4_P_NO_PROP       = 0,
192    ED4_P_IS_MANAGER    = 1,
193    ED4_P_IS_TERMINAL   = 2,
194    ED4_P_HORIZONTAL    = 4,
195    ED4_P_VERTICAL      = 8,
196    ED4_P_TMP       = 16,
197    ED4_P_SELECTABLE    = 32,
198    ED4_P_DRAGABLE      = 64,
199    ED4_P_MOVABLE       = 128,
200    ED4_P_IS_HANDLE     = 256,
201    ED4_P_CURSOR_ALLOWED    = 512,
202//  ED4_P_ = 1024,
203//  ED4_P_   = 2048,
204    ED4_P_IS_FOLDED     = 4096,                 // Flag whether group is folded or not
205    ED4_P_CONSENSUS_RELEVANT= 8192, // contains information relevant for consensus
206    ED4_P_ALIGNMENT_DATA= 16384, // contains aligned data (also SAIs)
207    ED4_P_ALL       = 0x7fffffff
208}   ED4_properties;
209
210typedef enum
211{
212    ED4_C_UP,
213    ED4_C_DOWN,
214    ED4_C_LEFT,
215    ED4_C_RIGHT,
216    ED4_C_NONE
217}   ED4_cursor_move;
218
219typedef enum
220{
221    ED4_U_UP    = 0,
222    ED4_U_UP_DOWN
223}   ED4_update_flag;
224
225typedef enum
226{
227    ED4_B_BORDER,
228    ED4_B_INDENT,
229    ED4_B_BOTTOM_AREA
230}   ED4_border_flag;
231
232typedef enum
233{
234    ED4_K_ADD,
235    ED4_K_SUB
236}   ED4_consensus;
237
238typedef enum
239{
240    ED4_A_DEFAULT,
241    ED4_A_CONTAINER
242}   ED4_alignment;
243
244typedef enum
245{
246    ED4_AA_FRWD_1,
247    ED4_AA_FRWD_2,
248    ED4_AA_FRWD_3,
249    ED4_AA_RVRS_1,
250    ED4_AA_RVRS_2,
251    ED4_AA_RVRS_3,
252    ED4_AA_DB_FIELD
253}  ED4_aa_seq_flag;
254
255typedef enum
256{
257    ED4_D_VERTICAL,
258    ED4_D_HORIZONTAL,
259    ED4_D_ALL_DIRECTION,
260    ED4_D_VERTICAL_ALL
261}   ED4_direction;
262
263
264class ED4_base;
265class ED4_terminal;
266
267struct ED4_move_info
268{
269    ED4_base         *object;            // object to be moved
270    AW_pos      end_x, end_y;      // position to move to
271    ED4_movemode    mode;              // move mode
272    ED4_level           preferred_parent;  // level to move to
273};
274
275struct ED4_selection_entry
276{
277    AW_pos               drag_off_x, drag_off_y;
278    AW_pos               drag_old_x, drag_old_y;
279    AW_pos               actual_width, actual_height;
280    int          old_event_y;
281    ED4_terminal     *object;
282};
283
284
285
286struct ED4_extension // contains info about graphical properties
287{
288    AW_pos  position[2];        // upper left corner (pos_x, pos_y) in relation to parent
289    // !!! WARNING: This is a hack!!! Every time you change 'position' you HAVE TO call ED4_base::touch_world_cache() !!!
290
291    AW_pos    size[2];          // width and height
292    ED4_index y_folded;         // remember old position of consensus when folding group
293
294#if defined(IMPLEMENT_DUMP)
295    void dump(size_t indent) const;
296#endif // IMPLEMENT_DUMP
297};
298
299struct ED4_scroll_picture
300{
301    bool    scroll;
302    long    old_x;
303    long    old_y;
304};
305
306enum ED4_CursorJumpType {
307    ED4_JUMP_CENTERED,          // centers the cursor
308    ED4_JUMP_KEEP_VISIBLE,      // keeps the cursor visible (keeps a fixed margin)
309    ED4_JUMP_KEEP_POSITION,     // paint cursor at previous position
310};
311
312struct ED4_work_info
313{
314    AW_event  event;
315    GBDATA   *gb_data;
316    char     *string;           // pointer to consensus; only if editing the consensus
317    long      char_position;    // screen position after cursor
318
319    int     direction;      // contains direction of editing (-1 left, +1 right )
320    ED4_EDITMODI mode;
321
322    bool    is_sequence;        // ==1 -> special handling for sequences
323    bool    cannot_handle;      // if TRUE than cannot edit
324
325    ED4_CursorJumpType cursor_jump;
326    bool    refresh_needed;
327
328    long    out_seq_position;   // sequence position (after editing)
329
330    char    *out_string;        // nur falls new malloc
331    char    *error;
332
333    int     repeat_count;       // only for keystrokes: contains # of times key should be repeated
334
335    ED4_terminal *working_terminal; // this contains the terminal
336};
337
338
339struct ED4_update_info // if you add new elements, please ensure to initialize them in ED4_base::ED4_base()
340{
341    unsigned int        resize:1;
342    unsigned int        refresh:1;
343    unsigned int    clear_at_refresh:1;
344    unsigned int        linked_to_folding_line:1;
345    unsigned int        linked_to_scrolled_rectangle:1;
346    unsigned int        refresh_horizontal_scrolling:1;
347    unsigned int        refresh_vertical_scrolling:1;
348    unsigned int    delete_requested:1;
349
350    void set_clear_at_refresh(int value) {
351        clear_at_refresh = value;
352    }
353    void set_refresh(int value) {
354        refresh = value;
355    }
356    void set_resize(int value) {
357        resize = value;
358    }
359
360#if defined(IMPLEMENT_DUMP)
361    void dump(size_t indent) const;
362#endif // IMPLEMENT_DUMP
363};
364
365struct ED4_coords
366{
367    long top_area_x,
368    top_area_y,
369    top_area_height,
370
371    middle_area_x,
372    middle_area_y,
373
374    window_width,               //of whole window (top and middle area and ... )
375    window_height,              //of whole window (top and middle area and ... )
376
377    window_upper_clip_point,        //absolute coordinate of upper visible clipping point in middle area
378    window_lower_clip_point,        //absolute coordinate of lower visible clipping point in middle area
379    window_left_clip_point,         //absolute coordinate of left  visible clipping point in top and middle area
380    window_right_clip_point;        //absolute coordinate of right visible clipping point in top and middle area
381
382    void clear() {
383    top_area_x = 0;
384    top_area_y = 0;
385    top_area_height = 0;
386
387    middle_area_x = 0;
388    middle_area_y = 0;
389
390    window_width = 0;
391    window_height = 0;
392
393    window_upper_clip_point = 0;
394    window_lower_clip_point = 0;
395    window_left_clip_point = 0;
396    window_right_clip_point = 0;
397    }
398};
399
400#else
401#error ed4_defs.hxx included twice
402#endif
Note: See TracBrowser for help on using the repository browser.