22 #define AWAR_ADDID_SRC AWAR_MERGE_TMP_SRC "addid"
23 #define AWAR_ADDID_DST AWAR_MERGE_TMP_DST "addid"
25 #define AWAR_ADDID_MATCH AWAR_MERGE_TMP "addidmatch"
26 #define AWAR_RENAME_STATUS AWAR_MERGE_TMP "renamestat"
27 #define AWAR_ALLOW_DUPS AWAR_MERGE_TMP "allowdups"
28 #define AWAR_OVERRIDE AWAR_MERGE_TMP "override"
45 const char *
result = (strcmp(src_addid, dst_addid) == 0) ?
"Ok" :
"MISMATCH!";
59 static bool created =
false;
75 if (gb_src_addid && !gb_dst_addid) {
80 else if (!gb_src_addid && gb_dst_addid) {
90 awar_src_addid->
unmap(); awar_src_addid->
map(gb_src_addid);
91 awar_dst_addid->
unmap(); awar_dst_addid->
map(gb_dst_addid);
100 error = src_ta.
close(error);
101 error = dst_ta.
close(error);
121 if (!
was_renamed) error =
"First you have to synchronize species IDs in both databases";
129 bool isDuplicatesWarning;
134 if (isDuplicatesWarning && allowDups) {
136 aw_message(
"Duplicates error ignored. Be careful during merge!");
150 if (strcmp(match,
"Ok") == 0) {
155 error =
"Denying rename - additional fields have to match!";
170 MG_set_renamed(
override, aw_root,
override ?
"Overridden" :
"Not renamed");
174 AW_window_simple *aws =
new AW_window_simple;
176 aws->init(awr,
"MERGE_AUTORENAME_SPECIES",
"Synchronize IDs");
181 aws->create_button(
"CLOSE",
"CLOSE",
"C");
185 aws->create_button(
"HELP",
"HELP",
"H");
194 aws->label(
"Allow merging duplicates (dangerous! see HELP)");
198 aws->label(
"Override (even more dangerous! see HELP)");
203 aws->button_length(12);
207 aws->button_length(25);
208 aws->label(
"Status:");
213 aws->create_autosize_button(
"RENAME_DATABASES",
"Synchronize");
215 aws->button_length(0);
216 aws->shadow_width(1);
219 aws->create_button(
"HELP_MERGE",
"#merge/icon.xpm");
static void override_toggle_cb(AW_root *aw_root)
#define AWAR_NAMESERVER_ADDID
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
void load_xfig(const char *file, bool resize=true)
AW_window * MG_create_merge_names_window(AW_root *awr)
const char * GBS_global_string(const char *templat,...)
GB_ERROR AWTC_pars_names(GBDATA *gb_main, bool *isWarningPtr)
void AW_POPDOWN(AW_window *window)
AW_awar * add_callback(const RootCallback &cb)
static const char * addids_match_info(AW_root *aw_root)
GB_ERROR GB_await_error()
WindowCallback makeHelpCallback(const char *helpfile)
#define AWAR_RENAME_STATUS
GBDATA * GB_create(GBDATA *father, const char *key, GB_TYPES type)
static void addids_match_info_refresh_cb(AW_root *aw_root)
static void error(const char *msg)
void MG_create_rename_awars(AW_root *aw_root, AW_default aw_def)
char * read_string() const
AW_awar * awar(const char *awar)
static GB_ERROR renameDB(const char *which, GBDATA *gb_db, bool allowDups)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
GB_ERROR close(GB_ERROR error)
AW_awar * map(const char *awarn)
GB_ERROR MG_expect_renamed()
void aw_message(const char *msg)
static void rename_both_databases(AW_window *aww)
void MG_set_renamed(bool renamed, AW_root *aw_root, const char *reason)
GB_ERROR write_string(const char *aw_string)
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)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
void MG_create_db_dependent_rename_awars(AW_root *aw_root, GBDATA *gb_src, GBDATA *gb_dst)