root/trunk/ARBDB/arbdb.h

Revision 8621, 5.3 KB (checked in by westram, 5 weeks ago)

merge from e4fix [8340] [8341] [8342] [8343] [8344] [8345] [8346] [8347] [8348] [8349] [8350] [8353] [8354] [8362] [8370] [8371] [8372] [8373] [8374] [8375]

  • changed refresh behavior
    • refresh_all_windows
      • call via timer (every 2 sec)
      • replaced by refresh-requests where needed
      • added ED4_trigger_instant_refresh
    • set_refresh -> request_refresh
    • removed duplicated refresh-request in ED4_consensus_definition_changed
    • replaced ED4_refresh_window by ED4_request_full_refresh
      • some callers now request fewer refreshes
      • all callers now cause refresh of ALL windows
    • ED4_cursor::ShowCursor no longer updates global AWARs when used for display only
    • refresh_window does not handle updates (it is only used to quickly draw the cursor)
      • renamed into special_window_refresh() to disencourage usage
    • removed implicit clearing of refresh flags previously done when refresh propagated down through windows, areas and hierarchy. Instead refresh_all_windows explicitely calls clear_refresh when done.
  • cleaned up resize requests
  • removed extra sync in ED4_resize_cb
  • removed special handling of 1st call to ED4_expose_cb (no idea why, but this fixes an ancient bug: "save props in hide-all-gaps mode")
    • no longer abuse ED4_expose_cb
  • trigger relayout
    • when helix/seq spacing is changed
  • ED4_WinContext
    • missing when NDS changed
    • expect one in ED4_root::special_window_refresh
    • provide from ED4_cursor::delete_cursor
  • EDIT4 scrolling
    • scrollbar code refactored
    • SLIDER_OFFSET was missing in calculation of lower/right folding lines (fixed)
    • picture size announced by ED4_window::update_scrolled_rectangle was off by 1
    • fixed scroll/resize bugs introduced in [8618]
  • added debug code
    • print backtrace on negative folding line dimension
    • print mismatch if slider postions and folding line dimensions are out of sync
  • sequence color mapping
    • fixed broken window layout
    • increased number of sets to 8
      • added symbolic ambiguity set as default
    • hide default value '=0'
  • group name generation (index-safety)
  • execute callback-guards and post-useraction-callback whenever an awar change is directly triggered by a widget
  • moved (ARB_)strNULLcmp to global header
  • doc/fix unexpectable behavior (NULL is bigger that any text) with a test
  • dont use magics for system folder
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1// ================================================================ //
2//                                                                  //
3//   File      : arbdb.h                                            //
4//   Purpose   : external ARB DB interface                          //
5//                                                                  //
6//   Institute of Microbiology (Technical University Munich)        //
7//   http://www.arb-home.de/                                        //
8//                                                                  //
9// ================================================================ //
10
11#ifndef ARBDB_H
12#define ARBDB_H
13
14#ifndef ARBTOOLS_H
15#include <arbtools.h>
16#endif
17#ifndef ARBDB_BASE_H
18#include <arbdb_base.h>
19#endif
20#ifndef ARB_ERROR_H
21#include <arb_error.h>
22#endif
23#ifndef _STDINT_H
24#include <stdint.h>
25#endif
26
27#define GB_SYSTEM_FOLDER   "__SYSTEM__"
28#define GB_SYSTEM_KEY_DATA "@key_data"
29
30// ---------------------
31//      simple types
32
33typedef int GB_COMPRESSION_MASK;
34
35// ------------------------------
36//      forward declare types
37
38struct GB_NUMHASH;
39
40struct GBS_regex;
41struct GBS_string_matcher;
42struct GBS_strstruct;
43struct GEN_position;
44struct DictData;
45struct CharPtrArray;
46struct StrArray;
47struct ConstStrArray;
48
49// --------------
50//      enums
51
52enum GB_TYPES {                                     // supported DB entry types
53    GB_NONE        = 0,
54    GB_BIT         = 1,
55    GB_BYTE        = 2,
56    GB_INT         = 3,
57    GB_FLOAT       = 4,
58    GB_POINTER     = 5,                             // not savable! only allowed in temporary entries
59    GB_BITS        = 6,
60    // 7 is unused
61    GB_BYTES       = 8,
62    GB_INTS        = 9,
63    GB_FLOATS      = 10,
64    GB_LINK        = 11,
65    GB_STRING      = 12,
66    GB_STRING_SHRT = 13,                            // used automatically during save
67    // 14 is unused
68    GB_DB          = 15,
69
70    // keep GB_TYPES consistent with AW_VARIABLE_TYPE
71    // see ../WINDOW/aw_base.hxx@sync_GB_TYPES_AW_VARIABLE_TYPE
72
73    GB_TYPE_MAX = 16,
74
75    GB_CREATE_CONTAINER = GB_DB,
76    GB_FIND             = GB_NONE,
77
78};
79
80enum GB_CASE {
81    GB_IGNORE_CASE    = 0,
82    GB_MIND_CASE      = 1,
83    GB_CASE_UNDEFINED = 2
84};
85
86enum GB_SEARCH_TYPE {
87    SEARCH_BROTHER       = 1,                       // [was: this_level]
88    SEARCH_CHILD         = 2,                       // [was: down_level]
89    SEARCH_GRANDCHILD    = 4,                       // [was: down_2_level]
90    SEARCH_NEXT_BROTHER  = SEARCH_BROTHER+8,        // [was: this_level|search_next]
91    SEARCH_CHILD_OF_NEXT = SEARCH_CHILD+8,          // [was: down_level|search_next]
92};
93
94enum GB_UNDO_TYPE {
95    GB_UNDO_NONE,                                   // no undo
96    GB_UNDO_KILL,                                   // no undo and delete all old undos
97    GB_UNDO_UNDO,                                   // normal undo -> deleted all redoes
98    GB_UNDO_REDO,                                   // moves to UNDO_REDO
99    GB_UNDO_UNDO_REDO                               // internal makes undo redoable
100};
101
102
103// -----------------------
104//      callback types
105
106typedef void (*GB_CB)(GBDATA *, int *clientdata, GB_CB_TYPE gbtype);
107
108typedef long (*gb_hash_loop_type)(const char *key, long val, void *client_data);
109typedef int (*gbs_hash_compare_function) (const char *key0, long val0, const char *key1, long val1);
110
111typedef const char* (*gb_export_sequence_cb)(GBDATA *gb_species, size_t *seq_len, GB_ERROR *error);
112
113typedef GBDATA* (*GB_Link_Follower)(GBDATA *GB_root, GBDATA *GB_elem, const char *link);
114
115typedef const char *(*gb_getenv_hook)(const char *varname);
116
117// -----------------------
118//      GB_transaction
119
120class GB_transaction : virtual Noncopyable {
121    GBDATA *ta_main;
122    bool      ta_open;          // is transaction open ?
123    GB_ERROR  ta_err;
124
125public:
126    GB_transaction(GBDATA *gb_main);
127    ~GB_transaction();
128
129    bool ok() const { return ta_open && !ta_err; }  // ready to work on DB?
130    GB_ERROR close(GB_ERROR error);                 // abort transaction if error (e.g.: 'return ta.close(error);')
131    ARB_ERROR close(ARB_ERROR& error);              // abort transaction if error (e.g.: 'return ta.close(error);')
132};
133
134class GB_shell {
135    // initialize and cleanup module ARBDB
136    // No database usage is possible when no GB_shell exists!
137public: 
138    GB_shell();
139    ~GB_shell();
140
141    static void ensure_inside();
142    static bool in_shell();
143};
144
145// --------------------------------------------
146//      include generated public prototypes
147
148#include <ad_prot.h>
149
150// to avoid arb-wide changes atm include some headers from CORE lib
151#ifndef ARB_MSG_H
152#include <arb_msg.h>
153#endif
154#ifndef ARB_STRING_H
155#include <arb_string.h>
156#endif
157
158// ----------------------------------------------------
159//      const wrappers for functions from ad_prot.h
160
161inline char *GBS_find_string(char *content, GB_CSTR key, int match_mode) {
162    return const_cast<char*>(GBS_find_string(const_cast<GB_CSTR>(content), key, match_mode));
163}
164
165// ---------------------------------
166//      error delivery functions
167
168inline void GB_end_transaction_show_error(GBDATA *gbd, ARB_ERROR& error, void (*error_handler)(GB_ERROR)) {
169    GB_end_transaction_show_error(gbd, error.deliver(), error_handler);
170}
171inline ARB_ERROR GB_end_transaction(GBDATA *gbd, ARB_ERROR& error) {
172    return GB_end_transaction(gbd, error.deliver());
173}
174
175
176#else
177#error arbdb.h included twice
178#endif // ARBDB_H
Note: See TracBrowser for help on using the browser.