26 #define AWAR_WWW_SELECT "www/url_select"
27 #define AWAR_WWW_SELECT_TEMPLATE "www/url_%i/select"
28 #define AWAR_WWW_TEMPLATE "www/url_%i/srt"
29 #define AWAR_WWW_DESC_TEMPLATE "www/url_%i/desc"
32 const char *url_start = strstr(templ,
"\"http://");
34 const char *host_start = url_start+8;
35 const char *slash = strchr(host_start,
'/');
47 matches = url1 && url2 &&
ARB_stricmp(url1, url2) == 0;
59 {
"EMBL example",
"\"http://www.ebi.ac.uk/ena/data/view/\";readdb(acc)" },
60 {
"SILVA example",
"\"http://www.arb-silva.de/browser/ssu/\";readdb(acc)" },
61 {
"Google example",
"\"http://www.google.com/search?q=\";readdb(full_name);|srt(\": =+\")" },
62 {
"Wikipedia example",
"\"http://en.wikipedia.org/wiki/Special:Search?search=\";dd" }
63 }, empty = {
"",
"" };
65 const int DEFAULT_SELECT = 1;
69 bool example_url_seen[EXAMPLE_COUNT];
70 for (
int x = 0; x<EXAMPLE_COUNT; ++x) example_url_seen[x] =
false;
77 const Example& curr = i<EXAMPLE_COUNT ? example[i] : empty;
78 const char *awar_name;
81 awar_templ[i] = aw_root->
awar_string(awar_name, curr.templ, aw_def);
84 awar_descr[i] = aw_root->
awar_string(awar_name, curr.descr, aw_def);
89 is_empty[i] = !templ[0] && !descr[0];
91 for (
int x = 0; x<EXAMPLE_COUNT; ++x) {
92 if (!example_url_seen[x]) {
99 aw_root->
awar_int(awar_name, 0, aw_def);
103 for (
int x = 0; x<EXAMPLE_COUNT; ++x) {
104 if (!example_url_seen[x]) {
124 const char *item_name =
NULp;
127 if (!gb_name) gb_name =
GB_entry(gb_item,
"full_name");
128 if (!gb_name) gb_name =
GB_entry(gb_item,
"name");
133 item_name =
"NoItemSelected";
173 delete selected_species;
195 AW_window_simple *aws =
new AW_window_simple;
196 aws->init(aw_root,
"WWW_PROPS",
"WWW");
198 aws->auto_space(10, 5);
202 aws->create_button(
"CLOSE",
"CLOSE",
"C");
206 aws->create_button(
"HELP",
"HELP",
"H");
210 aws->create_button(
"WWW",
"WWW",
"W");
212 aws->button_length(13);
215 aws->get_at_position(&dummy, &closey);
218 aws->create_button(
NULp,
"K");
222 int fieldselectx, srtx, descx;
226 aws->get_at_position(&fieldselectx, &dummy);
228 aws->auto_space(10, 2);
234 aws->create_toggle(buf);
237 aws->get_at_position(&descx, &dummy);
238 aws->create_input_field(buf, 15);
240 aws->get_at_position(&srtx, &dummy);
242 aws->create_input_field(buf, 80);
250 aws->at(fieldselectx, closey);
252 aws->at_x(fieldselectx);
253 aws->create_button(
NULp,
"SEL");
256 aws->create_button(
NULp,
"DESCRIPTION");
259 aws->create_button(
NULp,
"URL");
void add(const char *awar_name, const char *config_name)
void load_xfig(const char *file, bool resize=true)
int ARB_stricmp(const char *s1, const char *s2)
void AWT_insert_config_manager(AW_window *aww, AW_default default_file_, const char *id, const StoreConfigCallback &store_cb, const RestoreConfigCallback &load_or_reset_cb, const char *macro_id, const AWT_predefined_config *predef)
GB_ERROR awt_open_ACI_URL_with_item(AW_root *aw_root, GBDATA *gb_main, GBDATA *gb_item, const char *url_aci)
const char * GBS_global_string(const char *templat,...)
void AW_POPDOWN(AW_window *window)
char * ARB_strpartdup(const char *start, const char *end)
#define ARRAY_ELEMS(array)
static void www_setup_config(AWT_config_definition &cdef)
static void awt_www_select_change(AW_window *aww, int selected)
const char * read_char_pntr() const
GB_ERROR GB_await_error()
char * extract_url_host(const char *templ)
WindowCallback makeHelpCallback(const char *helpfile)
AW_window * AWT_create_www_window(AW_root *aw_root, GBDATA *gb_main)
void awt_create_aww_vars(AW_root *aw_root, AW_default aw_def)
#define AWAR_WWW_SELECT_TEMPLATE
static void error(const char *msg)
static void awt_openDefaultURL_on_selected_species(AW_window *aww, GBDATA *gb_main)
#define AWAR_SPECIES_NAME
GB_ERROR awt_openDefaultURL_with_item(AW_root *aw_root, GBDATA *gb_main, GBDATA *gb_item)
char * read_string() const
AW_awar * awar(const char *awar)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
bool url_host_matches(const char *templ1, const char *templ2)
#define AWAR_WWW_TEMPLATE
bool ARB_global_awars_initialized()
void aw_message(const char *msg)
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
GB_ERROR write_string(const char *aw_string)
NOT4PERL char * GB_command_interpreter_in_env(const char *str, const char *commands, const GBL_call_env &callEnv)
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
void AWT_openURL(AW_window *aww, const char *url)
void AW_openURL(AW_root *aw_root, const char *url)
#define STATIC_ASSERT(const_expression)
GB_ERROR write_int(long aw_int)
GBDATA * GB_entry(GBDATA *father, const char *key)
#define AWAR_WWW_DESC_TEMPLATE