source: tags/arb-6.0/EDIT4/ed4_defs.hxx

Last change on this file was 9539, checked in by westram, 11 years ago
  • remove local versions of min, max and abs
  • 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_EDITMODI {
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_EDITMODI 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#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    11
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
89#define AWAR_EDIT_MODE                  "tmp/edit4/edit_mode"
90#define AWAR_INSERT_MODE                "tmp/edit4/insert_mode"
91#define AWAR_EDIT_SECURITY_LEVEL        "tmp/edit4/security_level"
92#define AWAR_EDIT_SECURITY_LEVEL_ALIGN  "tmp/edit4/security_level_align"
93#define AWAR_EDIT_SECURITY_LEVEL_CHANGE "tmp/edit4/security_level_change"
94#define AWAR_EDIT_CONFIGURATION         "tmp/edit4/configuration"
95
96#define AWAR_EDIT_SEQ_POSITION   "tmp/edit4/jump_to_position%d" // used to create ED4_window.awar_path_for_cursor[]
97#define AWAR_EDIT_ECOLI_POSITION "tmp/edit4/cursor_ref_ecoli%d" // used to create ED4_window.awar_path_for_Ecoli[]
98#define AWAR_EDIT_BASE_POSITION  "tmp/edit4/cursor_to_basepos%d" // used to create ED4_window.awar_path_for_basePos[]
99#define AWAR_EDIT_IUPAC          "tmp/edit4/iupac%d" // used to create ED4_window.awar_path_for_IUPAC[]
100#define AWAR_EDIT_HELIXNR        "tmp/edit4/helixnr%d" // used to create ED4_window.awar_path_for_helixNr[]
101
102#define AWAR_FIELD_CHOSEN "tmp/edit4/field_chosen" // used for field selection box
103
104#define AWAR_EDIT_TITLE_MODE       "edit4/title_mode"
105#define AWAR_EDIT_HELIX_SPACING    "edit4/helix_add_spacing"
106#define AWAR_EDIT_TERMINAL_SPACING "edit4/terminal_add_spacing"
107
108#define CHARACTEROFFSET 5       // spacer-width left of text-terminal
109#define CONSENSUS       "Consensusfunktion"
110
111typedef long ED4_index;
112
113#define ED4_SCROLL_OVERLAP 20   // 15 Pixels overlap
114
115
116enum ED4_level { // has to contain bit values
117    ED4_L_INVALID         = -1U,
118    ED4_L_NO_LEVEL        = 0,
119    ED4_L_ROOT            = 0x1,
120    ED4_L_DEVICE          = 0x2,
121    ED4_L_AREA            = 0x4,
122    ED4_L_MULTI_SPECIES   = 0x8,
123    ED4_L_SPECIES         = 0x10,
124    ED4_L_MULTI_SEQUENCE  = 0x20,
125    ED4_L_SEQUENCE        = 0x40,
126    ED4_L_TREE            = 0x80,
127    ED4_L_SPECIES_NAME    = 0x100,
128    ED4_L_SEQUENCE_INFO   = 0x200,
129    ED4_L_SEQUENCE_STRING = 0x400,
130    ED4_L_ORF             = 0x800,
131    ED4_L_SPACER          = 0x1000,
132    ED4_L_LINE            = 0x2000,
133    ED4_L_MULTI_NAME      = 0x4000,
134    ED4_L_NAME_MANAGER    = 0x8000,
135    ED4_L_GROUP           = 0x10000,
136    ED4_L_ROOTGROUP       = 0x20000,
137    ED4_L_BRACKET         = 0x40000,
138    ED4_L_PURE_TEXT       = 0x80000,
139    ED4_L_COL_STAT        = 0x100000,
140};
141
142enum ED4_datamode {
143    ED4_D_SPECIES,
144    ED4_D_EXTENDED
145};
146
147
148enum ED4_movemode {
149    ED4_M_NO_MOVE    = 0,
150    ED4_M_HORIZONTAL = 1,
151    ED4_M_VERTICAL   = 2,
152    ED4_M_FREE       = 4
153};
154
155enum ED4_returncode {
156    ED4_R_OK         = 0,
157    ED4_R_WARNING    = 1,
158    ED4_R_IMPOSSIBLE = 2,
159    ED4_R_ERROR      = 4,
160    ED4_R_BREAK      = 8,
161    ED4_R_DESASTER   = 16,
162    ED4_R_ALL        = 0x7fffffff
163};
164
165enum ED4_AREA_LEVEL {
166    ED4_A_TOP_AREA,
167    ED4_A_MIDDLE_AREA,
168    ED4_A_BOTTOM_AREA,
169    ED4_A_ERROR
170};
171
172enum ED4_properties {
173    ED4_P_NO_PROP            = 0,
174    ED4_P_IS_MANAGER         = 1,
175    ED4_P_IS_TERMINAL        = 2,
176    ED4_P_HORIZONTAL         = 4,
177    ED4_P_VERTICAL           = 8,
178    ED4_P_TMP                = 16,
179    ED4_P_SELECTABLE         = 32,
180    ED4_P_DRAGABLE           = 64,
181    ED4_P_MOVABLE            = 128,
182    ED4_P_IS_HANDLE          = 256,
183    ED4_P_CURSOR_ALLOWED     = 512,
184    //  ED4_P_               = 1024,
185    //  ED4_P_               = 2048,
186    ED4_P_IS_FOLDED          = 4096,            // Flag whether group is folded or not
187    ED4_P_CONSENSUS_RELEVANT = 8192,            // contains information relevant for consensus
188    ED4_P_ALIGNMENT_DATA     = 16384,           // contains aligned data (also SAIs)
189    ED4_P_ALL                = 0x7fffffff
190};
191
192enum ED4_cursor_move {
193    ED4_C_UP,
194    ED4_C_DOWN,
195    ED4_C_LEFT,
196    ED4_C_RIGHT,
197    ED4_C_NONE
198};
199
200enum ED4_update_flag {
201    ED4_U_UP = 0,
202    ED4_U_UP_DOWN
203};
204
205enum ED4_border_flag {
206    ED4_B_BORDER,
207    ED4_B_INDENT,
208    ED4_B_BOTTOM_AREA
209};
210
211enum ED4_consensus {
212    ED4_K_ADD,
213    ED4_K_SUB
214};
215
216enum ED4_alignment {
217    ED4_A_DEFAULT,
218    ED4_A_CONTAINER
219};
220
221enum ED4_aa_seq_flag {
222    ED4_AA_FRWD_1,
223    ED4_AA_FRWD_2,
224    ED4_AA_FRWD_3,
225    ED4_AA_RVRS_1,
226    ED4_AA_RVRS_2,
227    ED4_AA_RVRS_3,
228    ED4_AA_DB_FIELD
229};
230
231enum ED4_direction {
232    ED4_D_VERTICAL,
233    ED4_D_HORIZONTAL,
234    ED4_D_ALL_DIRECTION,
235};
236
237
238class ED4_base;
239class ED4_terminal;
240class ED4_species_name_terminal;
241
242struct ED4_move_info
243{
244    ED4_base     *object;                // object to be moved
245    AW_pos        end_x, end_y;          // position to move to
246    ED4_movemode  mode;                  // move mode
247    ED4_level     preferred_parent;      // level to move to
248};
249
250struct ED4_selection_entry {
251    AW_pos drag_off_x, drag_off_y;
252    AW_pos drag_old_x, drag_old_y;
253    AW_pos actual_width, actual_height;
254    int    old_event_y;
255
256    ED4_species_name_terminal *object;
257};
258
259
260
261struct ED4_extension // contains info about graphical properties
262{
263    AW_pos  position[2];        // upper left corner (pos_x, pos_y) in relation to parent
264    // !!! WARNING: This is a hack!!! Every time you change 'position' you HAVE TO call ED4_base::touch_world_cache() !!!
265
266    AW_pos    size[2];          // width and height
267    ED4_index y_folded;         // remember old position of consensus when folding group
268
269    AW::Vector get_size() const { return AW::Vector(size[WIDTH], size[HEIGHT]); }
270    AW::Vector get_parent_offset() const { return AW::Vector(position[X_POS], position[Y_POS]); }
271
272#if defined(IMPLEMENT_DUMP)
273    void dump(size_t indent) const;
274#endif // IMPLEMENT_DUMP
275};
276
277struct ED4_scroll_picture {
278    bool scroll;
279    long old_x;
280    long old_y;
281
282    ED4_scroll_picture() : scroll(false), old_x(0), old_y(0) {}
283};
284
285enum ED4_CursorJumpType {
286    ED4_JUMP_CENTERED,          // centers the cursor
287    ED4_JUMP_KEEP_VISIBLE,      // keeps the cursor visible (keeps a fixed margin)
288    ED4_JUMP_KEEP_POSITION,     // paint cursor at previous position
289};
290
291struct ED4_work_info
292{
293    AW_event  event;
294    GBDATA   *gb_data;
295    char     *string;           // pointer to consensus; only if editing the consensus
296    long      char_position;    // screen position after cursor
297
298    bool rightward; // contains direction of editing (0 = leftward, 1 = rightward)
299
300    ED4_EDITMODI mode;
301
302    bool    is_sequence;        // ==1 -> special handling for sequences
303    bool    cannot_handle;      // if TRUE then cannot edit
304
305    ED4_CursorJumpType cursor_jump;
306    bool    refresh_needed;
307
308    long    out_seq_position;   // sequence position (after editing)
309
310    char     *out_string;                           // nur falls new malloc
311
312    int     repeat_count;       // only for keystrokes: contains # of times key should be repeated
313
314    ED4_terminal *working_terminal; // this contains the terminal
315};
316
317
318struct ED4_update_info // if you add new elements, please ensure to initialize them in ED4_base::ED4_base()
319{
320    unsigned int resize : 1;
321    unsigned int refresh : 1;
322    unsigned int clear_at_refresh : 1;
323    unsigned int linked_to_folding_line : 1;
324    unsigned int linked_to_scrolled_rectangle : 1;
325    unsigned int refresh_horizontal_scrolling : 1;
326    unsigned int refresh_vertical_scrolling : 1;
327    unsigned int delete_requested : 1;
328    unsigned int update_requested : 1;
329
330    void set_clear_at_refresh(int value) {
331        clear_at_refresh = value;
332    }
333    void set_refresh(int value) {
334        refresh = value;
335    }
336    void set_resize(int value) {
337        resize = value;
338    }
339
340#if defined(IMPLEMENT_DUMP)
341    void dump(size_t indent) const;
342#endif // IMPLEMENT_DUMP
343};
344
345struct ED4_coords
346{
347    long top_area_x,
348        top_area_y,
349        top_area_height,
350
351        middle_area_x,
352        middle_area_y,
353
354        window_width,               // of whole window (top and middle area and ... )
355        window_height,              // of whole window (top and middle area and ... )
356
357        window_upper_clip_point,        // absolute coordinate of upper visible clipping point in middle area
358        window_lower_clip_point,        // absolute coordinate of lower visible clipping point in middle area
359        window_left_clip_point,         // absolute coordinate of left  visible clipping point in top and middle area
360        window_right_clip_point;        // absolute coordinate of right visible clipping point in top and middle area
361
362    void clear() {
363        top_area_x = 0;
364        top_area_y = 0;
365        top_area_height = 0;
366
367        middle_area_x = 0;
368        middle_area_y = 0;
369
370        window_width = 0;
371        window_height = 0;
372
373        window_upper_clip_point = 0;
374        window_lower_clip_point = 0;
375        window_left_clip_point = 0;
376        window_right_clip_point = 0;
377    }
378};
379
380#else
381#error ed4_defs.hxx included twice
382#endif
Note: See TracBrowser for help on using the repository browser.