Last change
on this file was
18211,
checked in by westram, 5 years ago
|
- add new QUERY_ITEM_TYPE for organisms: QUERY_ITEM_ORGANISM
|
File size:
1.7 KB
|
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_SPECIES: |
---|
25 | case QUERY_ITEM_ORGANISM: |
---|
26 | case QUERY_ITEM_TYPES: it_assert(0); break; |
---|
27 | } |
---|
28 | it_assert(item_type_id); |
---|
29 | return GBS_global_string("%s_%s", window_id, item_type_id); |
---|
30 | } |
---|
31 | |
---|
32 | 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) { |
---|
33 | const char *s_id = itemTypeSpecificWindowID(itemType, id); |
---|
34 | char *s_title = GBS_global_string_copy(title_format, plural ? itemType.items_name : itemType.item_name); |
---|
35 | |
---|
36 | aws->init(aw_root, s_id, s_title); |
---|
37 | free(s_title); |
---|
38 | } |
---|
39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.