source: tags/ms_r16q2/EDIT4/ed4_defs.hxx

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