1 | // ============================================================== // |
---|
2 | // // |
---|
3 | // File : AliAdmin.h // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in August 2014 // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // ============================================================== // |
---|
10 | |
---|
11 | #ifndef ALIADMIN_H |
---|
12 | #define ALIADMIN_H |
---|
13 | |
---|
14 | #ifndef AW_AWAR_HXX |
---|
15 | #include <aw_awar.hxx> |
---|
16 | #endif |
---|
17 | #ifndef AW_ROOT_HXX |
---|
18 | #include <aw_root.hxx> |
---|
19 | #endif |
---|
20 | #ifndef ARB_MSG_H |
---|
21 | #include <arb_msg.h> |
---|
22 | #endif |
---|
23 | |
---|
24 | #define ali_assert(cond) arb_assert(cond) |
---|
25 | |
---|
26 | enum AdminType { |
---|
27 | MAIN_ADMIN, |
---|
28 | SOURCE_ADMIN, |
---|
29 | TARGET_ADMIN, |
---|
30 | |
---|
31 | ALI_ADMIN_TYPES |
---|
32 | }; |
---|
33 | |
---|
34 | class AliAdmin { |
---|
35 | AdminType type; |
---|
36 | GBDATA *const gb_main; |
---|
37 | AW_window *aws; |
---|
38 | const char *select_awarname; |
---|
39 | const char *tmp_awarbase; |
---|
40 | |
---|
41 | const char *tmp_awarname(const char *entryName) const { |
---|
42 | return GBS_global_string("%s%s", tmp_awarbase, entryName); |
---|
43 | } |
---|
44 | |
---|
45 | public: |
---|
46 | AliAdmin(AdminType type_, GBDATA *gb_main_, const char *select_awarname_, const char *tmp_awarbase_) : |
---|
47 | type(type_), |
---|
48 | gb_main(gb_main_), |
---|
49 | aws(NULp), |
---|
50 | select_awarname(select_awarname_), |
---|
51 | tmp_awarbase(tmp_awarbase_) |
---|
52 | { |
---|
53 | ali_assert(type>=0 && type<ALI_ADMIN_TYPES); |
---|
54 | ali_assert(strrchr(tmp_awarbase, '/')[1] == 0); // has to end with '/' |
---|
55 | } |
---|
56 | |
---|
57 | GBDATA *get_gb_main() const { return gb_main; } |
---|
58 | |
---|
59 | void store_window(AW_window *aw) { ali_assert(!aws); aws = aw; } |
---|
60 | AW_window *get_window() const { return aws; } |
---|
61 | |
---|
62 | void window_init(class AW_window_simple *aw, const char *id_templ, const char *title_templ) const; |
---|
63 | |
---|
64 | const char *select_name() const { return select_awarname; } |
---|
65 | const char *type_name() const { return tmp_awarname("alignment_type"); } |
---|
66 | const char *len_name() const { return tmp_awarname("alignment_len"); } |
---|
67 | const char *aligned_name() const { return tmp_awarname("aligned"); } |
---|
68 | const char *security_name()const { return tmp_awarname("security"); } |
---|
69 | const char *remark_name() const { return tmp_awarname("alignment_rem"); } |
---|
70 | const char *auto_name() const { return tmp_awarname("auto_format"); } |
---|
71 | |
---|
72 | AW_awar *select_awar() const { return AW_root::SINGLETON->awar(select_name()); } |
---|
73 | AW_awar *type_awar() const { return AW_root::SINGLETON->awar(type_name()); } |
---|
74 | AW_awar *len_awar() const { return AW_root::SINGLETON->awar(len_name()); } |
---|
75 | AW_awar *aligned_awar() const { return AW_root::SINGLETON->awar(aligned_name()); } |
---|
76 | AW_awar *security_awar()const { return AW_root::SINGLETON->awar(security_name()); } |
---|
77 | AW_awar *remark_awar() const { return AW_root::SINGLETON->awar(remark_name()); } |
---|
78 | AW_awar *auto_awar() const { return AW_root::SINGLETON->awar(auto_name()); } |
---|
79 | |
---|
80 | const char *get_selected_ali()const { return select_awar()->read_char_pntr(); } |
---|
81 | }; |
---|
82 | |
---|
83 | |
---|
84 | AW_window *ALI_create_admin_window(AW_root *root, AliAdmin *admin); |
---|
85 | |
---|
86 | #else |
---|
87 | #error AliAdmin.h included twice |
---|
88 | #endif // ALIADMIN_H |
---|