26 #define MAX_SPECIES_FLAGS 5
28 #define AWAR_FLAGS_PREFIX "arb_edit/flags" // in main database
29 #define AWAR_FLAGS_ENABLED AWAR_FLAGS_PREFIX "/display"
30 #define AWAR_FLAG_PREFIX_TEMPLATE AWAR_FLAGS_PREFIX "/flag%i"
31 #define AWAR_FLAG_ENABLE_TEMPLATE AWAR_FLAG_PREFIX_TEMPLATE "/enable"
32 #define AWAR_FLAG_HEADER_TEMPLATE AWAR_FLAG_PREFIX_TEMPLATE "/header"
33 #define AWAR_FLAG_FIELD_TEMPLATE AWAR_FLAG_PREFIX_TEMPLATE "/field"
35 #define MAX_AWARNAME_LENGTH 40
37 inline const char *
awarname(
const char *awarname_template,
int idx) {
41 #if defined(ASSERTION_USED)
44 sprintf(buffer, awarname_template, idx);
83 const char *key =
NULp;
100 if (error) key =
NULp;
105 if (error)
GB_export_errorf(
"Failed to prepare flag-field (Reason: %s)", error);
114 void SpeciesFlags::create_instance() {
130 if (!abbr[0]) abbr =
"?";
139 void SpeciesFlags::build_header_text()
const {
144 if (!first) buf.put(
' ');
150 header = buf.release();
159 min_flag_distance = INT_MAX;
167 xpos += text_width+space_width;
178 pixel_width = xpos - space_width + 1 + 1;
181 min_flag_distance =
std::min(min_flag_distance,
int(floor(2*((pixel_width-1)-prev_flag->
center_xpos()))));
185 e4_assert(idx>=0 && idx<MAX_SPECIES_FLAGS);
188 #if defined(ASSERTION_USED)
191 sprintf(buffer,
"%s%i", name, idx);
207 {
"*curation",
"Curation of newly inserted sequences:\n - mark sequence / alignment as bad\n - mark as done (curated)",
"display='1';enable0='1';enable1='1';enable2='1';enable3='0';enable4='0';field0='bad_sequence';field1='bad_alignment';field2='curated';header0='bad';header1='align';header2='cur'" },
208 {
"*example1",
"Example from help (phase1)",
"display='1';enable0='1';enable1='1';enable2='1';enable3='0';enable4='0';field0='tocheck';field1='bad_sequence';field2='bad_alignment';field3='fixed';header0='2chk';header1='bad';header2='align';header3='fixed'" },
209 {
"*example2",
"Example from help (phase2)",
"display='1';enable0='0';enable1='0';enable2='1';enable3='1';enable4='0';field0='tocheck';field1='bad_sequence';field2='bad_alignment';field3='fixed';header0='2chk';header1='bad';header2='align';header3='fixed'" },
214 AW_window_simple *aws =
new AW_window_simple;
215 aws->init(root,
"SPECIES_FLAGS",
"Species flags");
218 aws->auto_space(5, 5);
221 aws->create_button(
"CLOSE",
"CLOSE",
"C");
224 aws->create_button(
"HELP",
"HELP");
227 aws->get_at_position(&cfg_x, &cfg_y);
231 aws->label(
"Display flags");
237 const int COLUMNS = 3;
238 const int HEADERHEIGHT = 20;
240 int header_y = aws->get_at_yposition();
241 int header_x[COLUMNS];
243 const char *headertext[COLUMNS] = {
249 aws->at_y(header_y+HEADERHEIGHT);
254 if (!i) header_x[0] = aws->get_at_xposition();
257 if (!i) header_x[1] = aws->get_at_xposition();
260 if (!i) header_x[2] = aws->get_at_xposition();
265 for (
int h = 0; h<COLUMNS; ++h) {
266 aws->at(header_x[h], header_y);
267 aws->create_autosize_button(
NULp, headertext[h]);
270 aws->at(cfg_x, cfg_y);
GB_ERROR GBT_add_new_changekey_to_keypath(GBDATA *gb_main, const char *name, GB_TYPES type, const char *keypath)
void add(const char *awar_name, const char *config_name)
void ED4_request_relayout()
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)
void set_dimension(int xpos_, int width_)
void AW_POPDOWN(AW_window *window)
AW_window * ED4_configure_species_flags(AW_root *root, GBDATA *gb_main)
#define MAX_AWARNAME_LENGTH
#define MAX_SPECIES_FLAGS
char buffer[MESSAGE_BUFFERSIZE]
GB_ERROR GB_incur_error_if(bool error_may_occur)
AW_awar * add_callback(const RootCallback &cb)
static AWT_predefined_config predefined_flag_setup[]
void create_itemfield_selection_button(AW_window *aws, const FieldSelDef &selDef, const char *at)
const char * read_char_pntr() const
static AW_root * SINGLETON
WindowCallback makeHelpCallback(const char *helpfile)
SpeciesFlagList::iterator SpeciesFlagIter
#define AWAR_FLAG_HEADER_TEMPLATE
int get_string_size(int gc, long textlen) const
const char * awarname(const char *awarname_template, int idx)
#define AWAR_FLAG_ENABLE_TEMPLATE
SpeciesFlagList::const_iterator SpeciesFlagCiter
GBDATA * get_gb_main() const
#define AWAR_FLAG_FIELD_TEMPLATE
const char * change_key_path
static void error(const char *msg)
const char * prepare_itemfield() const
static void header_changed_cb(AW_root *)
const char * prepare_and_get_selected_itemfield(AW_root *awr, const char *awar_name, GBDATA *gb_main, const ItemSelector &itemtype, FailIfField failIf)
AW_awar * awar(const char *awar)
GB_TYPES GBT_get_type_of_changekey(GBDATA *gb_main, const char *field_name, const char *change_key_path)
const std::string & get_shortname() const
const char * settingName(const char *name, int idx)
GB_ERROR GB_export_errorf(const char *templat,...)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
void calculate_header_dimensions(AW_device *device, int gc)
ItemSelector & SPECIES_get_selector()
double center_xpos() const
#define AWAR_FLAGS_ENABLED
static void setup_species_flags_config(AWT_config_definition &cfg)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
static void init_flag_awars()
CONSTEXPR long FIELD_FILTER_BYTE_WRITEABLE
const char * get_itemfield_type_awarname(const char *itemfield_awarname)