ARB
EXP_main.cxx
Go to the documentation of this file.
1 // ==================================================================== //
2 // //
3 // File : EXP_main.cxx //
4 // Purpose : //
5 // //
6 // //
7 // Coded by Ralf Westram (coder@reallysoft.de) in September 2001 //
8 // Copyright Department of Microbiology (Technical University Munich) //
9 // //
10 // Visit our web site at: http://www.arb-home.de/ //
11 // //
12 // //
13 // ==================================================================== //
14 
15 #include "EXP_local.hxx"
16 
17 #include <awt.hxx>
18 #include <awt_input_mask.hxx>
19 #include <aw_awars.hxx>
20 #include <aw_window.hxx>
21 #include <aw_root.hxx>
22 #include <arbdbt.h>
23 #include <db_query.h>
24 #include <rootAsWin.h>
25 
26 using namespace std;
27 
28 static void EXP_update_combined_cb(AW_root *awr) {
29  char *organism = awr->awar(AWAR_ORGANISM_NAME)->read_string();
30  char *experiment = awr->awar(AWAR_EXPERIMENT_NAME)->read_string();
31  const char *combined = GBS_global_string("%s/%s", organism, experiment);
33  free(experiment);
34  free(organism);
35 }
36 
37 void EXP_create_awars(AW_root *aw_root, AW_default /* aw_def */, GBDATA *gb_main) {
39  aw_root->awar_string(AWAR_PROTEOM_NAME, "", gb_main);
40  aw_root->awar_string(AWAR_PROTEIN_NAME, "", gb_main);
42  aw_root->awar_string(AWAR_COMBINED_EXPERIMENT_NAME, "", gb_main);
43  aw_root->awar_string(AWAR_SPECIES_NAME, "", gb_main);
44 }
45 
46 // ---------------------------------------
47 // EXP_item_type_species_selector
48 
52 
53  const char *get_self_awar() const OVERRIDE {
55  }
57  return 12 + 1 + 40; // species-name+'/'+experiment_name
58  }
59  GBDATA *current(AW_root *root, GBDATA *gb_main) const OVERRIDE { // give the current item
60  char *species_name = root->awar(AWAR_ORGANISM_NAME)->read_string();
61  char *experiment_name = root->awar(AWAR_EXPERIMENT_NAME)->read_string();
62  GBDATA *gb_experiment = NULp;
63 
64  if (species_name[0] && experiment_name[0]) {
66  GBDATA *gb_species = GBT_find_species(gb_main, species_name);
67  if (gb_species) {
68  gb_experiment = EXP_find_experiment(gb_species, experiment_name);
69  }
70  }
71 
72  free(experiment_name);
73  free(species_name);
74 
75  return gb_experiment;
76  }
77  const char *getKeyPath() const OVERRIDE { // give the keypath for items
79  }
80 };
81 
83 
84 static void EXP_open_mask_window(AW_window *aww, int id, GBDATA *gb_main) {
85  const awt_input_mask_descriptor *descriptor = AWT_look_input_mask(id);
86  exp_assert(descriptor);
87  if (descriptor) {
88  AWT_initialize_input_mask(aww->get_root(), gb_main, &item_type_experiment, descriptor->get_internal_maskname(), descriptor->is_local_mask());
89  }
90 }
91 
94 }
95 
97  return QUERY::create_colorize_items_window(aw_root, gb_main, EXP_get_selector());
98 }
99 
101  const char *title = "Experiment";
102  const char *hotkey = "x";
103 
104  if (submenu) awm->insert_sub_menu(title, hotkey);
105  else awm->create_menu(title, hotkey, AWM_ALL);
106 
107  {
108  awm->insert_menu_topic("experiment_info", "Experiment information", "i", "experiment_info.hlp", AWM_ALL, RootAsWindowCallback::simple(EXP_popup_experiment_window, gb_main));
109  awm->insert_menu_topic(awm->local_id("experiment_search"), "Search and query", "q", "experiment_search.hlp", AWM_ALL, makeCreateWindowCallback (EXP_create_experiment_query_window, gb_main));
110 
111  EXP_create_mask_submenu(awm, gb_main);
112 
113  awm->sep______________();
114  awm->insert_menu_topic(awm->local_id("experiment_colors"), "Colors ...", "C", "colorize.hlp", AWM_ALL, makeCreateWindowCallback(create_colorize_experiments_window, gb_main));
115  }
116  if (submenu) awm->close_sub_menu();
117 }
118 
const awt_input_mask_descriptor * AWT_look_input_mask(int id)
void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback &wcb)
Definition: AW_window.cxx:592
static void EXP_open_mask_window(AW_window *aww, int id, GBDATA *gb_main)
Definition: EXP_main.cxx:84
#define AWAR_ORGANISM_NAME
GBDATA * current(AW_root *root, GBDATA *gb_main) const OVERRIDE
Definition: EXP_main.cxx:59
#define AWAR_COMBINED_EXPERIMENT_NAME
Definition: EXP_local.hxx:26
#define AWAR_PROTEOM_NAME
Definition: EXP.hxx:31
const char * GBS_global_string(const char *templat,...)
Definition: arb_msg.cxx:204
const char * title
Definition: readseq.c:22
void AWT_create_mask_submenu(AW_window_menu_modes *awm, awt_item_type wanted_item_type, AWT_OpenMaskWindowCallback open_mask_window_cb, GBDATA *gb_main)
STL namespace.
#define AWAR_PROTEIN_NAME
Definition: EXP.hxx:32
size_t get_self_awar_content_length() const OVERRIDE
Definition: EXP_main.cxx:56
AW_awar * add_callback(const RootCallback &cb)
Definition: AW_awar.cxx:234
ItemSelector & EXP_get_selector()
GBDATA * EXP_find_experiment(GBDATA *gb_species, const char *name)
const char * getKeyPath() const OVERRIDE
Definition: EXP_main.cxx:77
void create_menu(const char *name, const char *mnemonic, AW_active mask=AWM_ALL)
Definition: AW_window.cxx:469
#define AWAR_EXPERIMENT_NAME
Definition: EXP.hxx:30
#define AWAR_SPECIES_NAME
char * read_string() const
Definition: AW_awar.cxx:201
static WindowCallback simple(void(*root_cb)(AW_root *, T), T t)
Definition: rootAsWin.h:47
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
void insert_sub_menu(const char *name, const char *mnemonic, AW_active mask=AWM_ALL)
Definition: AW_window.cxx:642
#define exp_assert(bed)
Definition: EXP_local.hxx:22
void EXP_create_awars(AW_root *aw_root, AW_default, GBDATA *gb_main)
Definition: EXP_main.cxx:37
static AW_window_menu_modes_opengl * awm
void EXP_create_experiments_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu)
Definition: EXP_main.cxx:100
AW_window * create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector &sel)
Definition: db_query.cxx:1959
void EXP_popup_experiment_window(AW_root *aw_root, GBDATA *gb_main)
const char * get_self_awar() const OVERRIDE
Definition: EXP_main.cxx:53
~EXP_item_type_species_selector() OVERRIDE
Definition: EXP_main.cxx:51
#define OVERRIDE
Definition: cxxforward.h:93
static void EXP_create_mask_submenu(AW_window_menu_modes *awm, GBDATA *gb_main)
Definition: EXP_main.cxx:92
void close_sub_menu()
Definition: AW_window.cxx:483
static EXP_item_type_species_selector item_type_experiment
Definition: EXP_main.cxx:82
#define CHANGE_KEY_PATH_EXPERIMENTS
Definition: arbdbt.h:88
AW_root * get_root()
Definition: aw_window.hxx:348
#define NULp
Definition: cxxforward.h:97
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
Definition: aditem.cxx:136
static AW_window * create_colorize_experiments_window(AW_root *aw_root, GBDATA *gb_main)
Definition: EXP_main.cxx:96
GB_ERROR write_string(const char *aw_string)
void sep______________()
Definition: AW_window.cxx:750
const char * local_id(const char *id) const
Definition: AW_window.cxx:744
AW_window * EXP_create_experiment_query_window(AW_root *aw_root, GBDATA *gb_main)
GB_transaction ta(gb_var)
GBDATA * gb_main
Definition: adname.cxx:33
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:570
GB_ERROR AWT_initialize_input_mask(AW_root *root, GBDATA *gb_main, const awt_item_type_selector *sel, const char *mask_name, bool localMask)
static void EXP_update_combined_cb(AW_root *awr)
Definition: EXP_main.cxx:28