| 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 (selector.type == QUERY_ITEM_SPECIES) { |
|---|
| 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_TYPES: it_assert(0); break; |
|---|
| 26 | } |
|---|
| 27 | it_assert(item_type_id); |
|---|
| 28 | return GBS_global_string("%s_%s", window_id, item_type_id); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | 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) { |
|---|
| 32 | const char *s_id = itemTypeSpecificWindowID(itemType, id); |
|---|
| 33 | char *s_title = GBS_global_string_copy(title_format, plural ? itemType.items_name : itemType.item_name); |
|---|
| 34 | |
|---|
| 35 | aws->init(aw_root, s_id, s_title); |
|---|
| 36 | free(s_title); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.