Line | |
---|
1 | // ============================================================ // |
---|
2 | // // |
---|
3 | // File : itemtools.cxx // |
---|
4 | // Purpose : item-specific toolkit // |
---|
5 | // // |
---|
6 | // Coded by Ralf Westram (coder@reallysoft.de) in July 2015 // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // ============================================================ // |
---|
10 | |
---|
11 | #include "items.h" |
---|
12 | #include <arb_msg.h> |
---|
13 | #include <aw_window.hxx> |
---|
14 | |
---|
15 | inline const char *itemTypeSpecificWindowID(const ItemSelector& selector, const char *window_id) { |
---|
16 | if (speciesOrOrganism(selector.type)) { |
---|
17 | return window_id; // for species return given window id |
---|
18 | } |
---|
19 | const char *item_type_id = NULp; |
---|
20 | switch (selector.type) { |
---|
21 | case QUERY_ITEM_GENES: item_type_id = "GENE"; break; |
---|
22 | case QUERY_ITEM_EXPERIMENTS: item_type_id = "EXPERIMENT"; break; |
---|
23 | |
---|
24 | case QUERY_ITEM_SAI: |
---|
25 | case QUERY_ITEM_SPECIES: |
---|
26 | case QUERY_ITEM_ORGANISM: |
---|
27 | case QUERY_ITEM_TYPES: it_assert(0); break; |
---|
28 | } |
---|
29 | it_assert(item_type_id); |
---|
30 | return GBS_global_string("%s_%s", window_id, item_type_id); |
---|
31 | } |
---|
32 | |
---|
33 | void init_itemType_specific_window(AW_root *aw_root, AW_window_simple *aws, const ItemSelector& itemType, const char *id, const char *title_format, bool plural) { |
---|
34 | const char *s_id = itemTypeSpecificWindowID(itemType, id); |
---|
35 | char *s_title = GBS_global_string_copy(title_format, plural ? itemType.items_name : itemType.item_name); |
---|
36 | |
---|
37 | aws->init(aw_root, s_id, s_title); |
---|
38 | free(s_title); |
---|
39 | } |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.