source: branches/help/SECEDIT/SEC_graphic.hxx

Last change on this file was 15665, checked in by westram, 8 years ago
  • reintegrates 'refactor' into 'trunk'
    • refactored AWT_graphic
      • now have explicit states with different permissions
        1. update model + request view/DB updates (AWT_auto_refresh)
          • always preceeded by DB→model up-to-date-check
          • automatically updates the view on destruction
        2. update (DB and view) from model
        3. neither
    • benefits
      • saves several view-updates
      • unproblematic nesting of functions requesting view-updates
      • will allow
        • delayed view-updates and
        • easier modification of update logic
    • fixes a bunch of update-issues (found on the way)
  • adds: log:branches/refactor@15613:15615,15627:15637,15639:15664
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : sec_graphic.hxx                                   //
4//   Purpose   : interface to structure GUI                        //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11
12#ifndef SEC_GRAPHIC_HXX
13#define SEC_GRAPHIC_HXX
14
15#ifndef _GLIBCXX_CCTYPE
16#include <cctype>
17#endif
18#ifndef AWT_CANVAS_HXX
19#include <awt_canvas.hxx>
20#endif
21
22using namespace AW;
23
24// names for database:
25#define NAME_OF_STRUCT_SEQ      "_STRUCT"
26#define NAME_OF_REF_SEQ         "_REF"
27
28class SEC_root;
29
30enum SEC_update_request {
31    SEC_UPDATE_OK              = 0, // no update needed
32    // bit '1' is unused atm
33    SEC_UPDATE_SHOWN_POSITIONS = 2, // recalculation of shown positions needed
34    SEC_UPDATE_RECOUNT         = 4, // complete relayout needed
35    SEC_UPDATE_RELOAD          = 8, // reload structure from DB
36};
37
38class SEC_base;
39
40class SEC_graphic FINAL_TYPE : public AWT_graphic, virtual Noncopyable {
41    SEC_update_request  update_requested;
42    char               *load_error; // error occurred during load()
43
44    void update_structure() OVERRIDE;
45
46protected:
47
48    AW_device *disp_device; // device for recursive functions
49
50    GB_ERROR handleKey(AW_event_type event, AW_key_mod key_modifier, AW_key_code key_code, char key_char);
51    GB_ERROR handleMouse(AW_device *device, AW_event_type event, int button, AWT_COMMAND_MODE cmd, const Position& world, SEC_base *elem, int abspos);
52
53public:
54
55    GBDATA *gb_main;
56    AW_root *aw_root;
57    SEC_root *sec_root;
58
59    GBDATA *gb_struct;          // used to save the structure
60    GBDATA *gb_struct_ref;      // used to save reference numbers
61
62    mutable long last_saved;    // the transaction serial id when we last saved everything
63
64    // *********** public section
65    SEC_graphic(AW_root *aw_root, GBDATA *gb_main);
66    ~SEC_graphic() OVERRIDE;
67
68    AW_gc_manager *init_devices(AW_window *, AW_device *, AWT_canvas *scr) OVERRIDE;
69
70    void show(AW_device *device) OVERRIDE;
71    void handle_command(AW_device *device, AWT_graphic_event& event) OVERRIDE;
72
73    GB_ERROR load_from_DB(GBDATA *gb_main, const char *name) OVERRIDE; // load structure from DB
74    GB_ERROR save_to_DB(GBDATA *gb_main, const char *name) OVERRIDE; // save structure to DB
75    void check_for_DB_update(GBDATA *gb_main) OVERRIDE;
76    void notify_synchronized(GBDATA *gb_main) OVERRIDE;
77
78    GB_ERROR write_data_to_db(const char *data, const char *x_string) const;
79    GB_ERROR read_data_from_db(char **data, char **x_string) const;
80
81    void request_update(SEC_update_request req) {
82        update_requested = static_cast<SEC_update_request>(update_requested|req);
83        exports.request_structure_update();
84    }
85};
86
87
88#endif
Note: See TracBrowser for help on using the repository browser.