ARB
Classes | Macros | Typedefs | Enumerations | Functions | Variables
xfergui.cxx File Reference
#include "xfergui.h"
#include <xferset.h>
#include <awt_prompt.hxx>
#include <aw_window.hxx>
#include <aw_root.hxx>
#include <aw_awar.hxx>
#include <aw_file.hxx>
#include <aw_msg.hxx>
#include <aw_select.hxx>
#include <arb_file.h>
#include <arb_str.h>
#include <StrUniquifier.h>
#include <FileWatch.h>
#include <set>
#include <string>
Include dependency graph for xfergui.cxx:

Go to the source code of this file.

Classes

struct  lt_field
 

Macros

#define AWARBASE_XFERSET_TMP   "tmp/fts/"
 
#define AWARBASE_XFERRULE_TMP   AWARBASE_XFERSET_TMP "rule/"
 
#define AWAR_XFERSET_SELECTED   AWARBASE_XFERSET_TMP "focus"
 
#define AWAR_XFERSET_COMMENT   AWARBASE_XFERSET_TMP "comment"
 
#define AWAR_XFERSET_UNDEFINED   AWARBASE_XFERSET_TMP "undefined"
 
#define AWAR_XFERSET_FTSBASE   AWARBASE_XFERSET_TMP "file"
 
#define AWAR_XFERSET_FTSNAME   AWAR_XFERSET_FTSBASE "/file_name"
 
#define AWAR_XFERSET_FTSFILTER   AWAR_XFERSET_FTSBASE "/filter"
 
#define AWAR_XFERSET_FTSDIR   AWAR_XFERSET_FTSBASE "/directory"
 
#define AWAR_XFERRULE_SELECTED   AWARBASE_XFERRULE_TMP "focus"
 
#define AWAR_XFERRULE_TARGETFIELD   AWARBASE_XFERRULE_TMP "rule"
 
#define AWAR_XFERRULE_ACI   AWARBASE_XFERRULE_TMP "aci"
 
#define AWAR_XFERRULE_SEP   AWARBASE_XFERRULE_TMP "sep"
 
#define AWAR_XFERRULE_TYPE   AWARBASE_XFERRULE_TMP "type"
 
#define AWAR_XFERRULE_LOSS   AWARBASE_XFERRULE_TMP "loss"
 
#define AWAR_XFERRULE_INPUT_FIELDS   AWARBASE_XFERRULE_TMP "input/fields"
 
#define AWAR_XFERRULE_INPUT_SELECTED   AWARBASE_XFERRULE_TMP "input/focus"
 
#define AWAR_XFERRULE_AVAIL_SELECTED   AWARBASE_XFERRULE_TMP "avail"
 
#define AWAR_XFERRULE_AVAIL_CATEGORY   AWARBASE_XFERRULE_TMP "acat"
 
#define AWAR_XFERRULE_FIELD   AWARBASE_XFERRULE_TMP "field"
 
#define NO_XFERSET_SELECTED   ""
 

Typedefs

typedef set< string, lt_fieldStrSet
 
typedef StrSet::iterator StrSetIter
 

Enumerations

enum  AvailCategory {
  ALL_AVAILABLE_FIELDS, FIELDS_BY_RULESET, UNREAD_BY_RULESET, UNWRITTEN_BY_RULESET,
  INPUT_FIELDS_BY_CLIENT, OUTPUT_FIELDS_BY_CLIENT
}
 
enum  FieldMoveDest { MV_UP, MV_DOWN, MV_OFF }
 
enum  copyMoveMode { COPY_RULESET, MOVE_RULESET }
 

Functions

bool is_info (const char *field)
 
bool is_info (const string &field)
 
const charXFER_getFullFTS (const char *name)
 
AW_awarawar_selected_FTS ()
 
static const charget_selected_FTS ()
 
void set_selected_FTS (const char *name)
 
chargetNameOnly (const char *fullpath)
 
static RuleSetPtr getSelectedRuleset (const char *&failReason)
 
int getSelectedRuleIndex ()
 
const charruleSelId (int idx)
 
GB_ERROR checkValidIndex (RuleSetPtr ruleset, int idx)
 
static void selectRule (int idx, int ruleCount)
 
static void deselectRule ()
 
static RulePtr getSelectedRule (const char *&failReason)
 
void refresh_fts_selbox ()
 
GB_ERROR saveChangedRuleset (RuleSetPtr ruleset)
 
static void lintRuleset (RuleSetPtr ruleset)
 
static void lintRulesetOnce (RuleSetPtr ruleset)
 
static void overwriteSelectedRule (RulePtr newRule)
 
GB_ERROR check_valid_existing_fts (const char *fullfts)
 
static GB_ERROR check_valid_target_fts (const char *fullfts)
 
static void selected_rule_changed_cb (AW_root *awr)
 
static RulePtr build_rule_from_awars (AW_root *awr)
 
static void rebuild_rule_from_awars_cb (AW_root *awr)
 
static void availfield_selected_cb (AW_root *awr)
 
static void refresh_availfield_selbox_cb (AW_root *awr, AW_selection_list *avail)
 
void mergeToKnownFields (const StrArray &source)
 
size_t removeFromKnownFields (const StrArray &unwanted)
 
static void mergeKnownFields (AW_root *awr)
 
static void refresh_available_fields_from_ruleset (AW_root *awr, RuleSetPtr rulesetPtr)
 
void XFER_refresh_available_fields (AW_root *awr, const AvailableFieldScanner *fieldScanner, FieldsToScan whatToScan)
 
static void refresh_inputfield_selbox_cb (AW_root *awr, AW_selection_list *input)
 
static void refresh_rule_selection_box_cb (AW_root *awr, AW_selection_list *rules)
 
static void init_rule_definition_awars (AW_root *awr)
 
static void clear_field_cb (AW_window *aww)
 
static void add_rule_cb (AW_window *aww)
 
static void del_rule_cb (AW_window *)
 
static void rule_stack_cb (AW_window *, bool toStack)
 
void updateChangedInputFields (const ConstStrArray &ifield, AW_awar *awar_input_fields)
 
static void add_field_cb (AW_window *aww, AW_selection_list *inputSel)
 
static void move_field_cb (AW_window *aww, FieldMoveDest dest, AW_selection_list *inputSel)
 
static void popup_rule_definition_window (AW_root *awr)
 
static void fts_filesel_changed_cb (AW_root *awr)
 
static void selected_fts_changed_cb (AW_root *awr)
 
static void ruleset_awar_changed_cb (AW_root *awr, const char *awarname)
 
static void editRuleset_cb (AW_window *aww)
 
static void createRuleset_cb (AW_window *aww)
 
static GB_ERROR copyMoveRuleset_cb (const char *new_name, copyMoveMode mode)
 
static void askCopyMoveRuleset_cb (AW_window *, copyMoveMode mode)
 
static void deleteRuleset_cb ()
 
static void noRuleset_cb ()
 
static void selected_fts_file_changed (const char *, ChangeReason reason)
 
static void initXferAwars (AW_root *awr)
 
static void popup_ruleset_admin_window (AW_root *awr)
 
void XFER_select_RuleSet (AW_window *aww, const char *awar_selected_fts, const AvailableFieldScanner *fieldScanner)
 

Variables

static const
AvailableFieldScanner
currentFieldScanner = NULp
 
static StrArray knownFieldsClientInput
 
static StrArray knownFieldsClientOutput
 
static StrArray knownFieldsRulesetInput
 
static StrArray knownFieldsRulesetOutput
 
static StrSet knownFields
 
static int onlyLintRuleWithIdx = -1
 
static bool warnAboutDuplicateTargets = true
 
static bool ignoreRuleDetailChange = false
 
static bool ignoreRulesetAwarChange = false
 

Macro Definition Documentation

#define AWARBASE_XFERSET_TMP   "tmp/fts/"

Definition at line 36 of file xfergui.cxx.

#define AWARBASE_XFERRULE_TMP   AWARBASE_XFERSET_TMP "rule/"

Definition at line 37 of file xfergui.cxx.

#define AWAR_XFERSET_SELECTED   AWARBASE_XFERSET_TMP "focus"
#define AWAR_XFERSET_COMMENT   AWARBASE_XFERSET_TMP "comment"
#define AWAR_XFERSET_UNDEFINED   AWARBASE_XFERSET_TMP "undefined"
#define AWAR_XFERSET_FTSBASE   AWARBASE_XFERSET_TMP "file"
#define AWAR_XFERSET_FTSNAME   AWAR_XFERSET_FTSBASE "/file_name"

Definition at line 45 of file xfergui.cxx.

Referenced by initXferAwars().

#define AWAR_XFERSET_FTSFILTER   AWAR_XFERSET_FTSBASE "/filter"

Definition at line 46 of file xfergui.cxx.

#define AWAR_XFERSET_FTSDIR   AWAR_XFERSET_FTSBASE "/directory"

Definition at line 47 of file xfergui.cxx.

#define AWAR_XFERRULE_SELECTED   AWARBASE_XFERRULE_TMP "focus"
#define AWAR_XFERRULE_TARGETFIELD   AWARBASE_XFERRULE_TMP "rule"
#define AWAR_XFERRULE_ACI   AWARBASE_XFERRULE_TMP "aci"
#define AWAR_XFERRULE_SEP   AWARBASE_XFERRULE_TMP "sep"
#define AWAR_XFERRULE_TYPE   AWARBASE_XFERRULE_TMP "type"
#define AWAR_XFERRULE_LOSS   AWARBASE_XFERRULE_TMP "loss"
#define AWAR_XFERRULE_INPUT_FIELDS   AWARBASE_XFERRULE_TMP "input/fields"
#define AWAR_XFERRULE_INPUT_SELECTED   AWARBASE_XFERRULE_TMP "input/focus"

Definition at line 56 of file xfergui.cxx.

Referenced by init_rule_definition_awars(), and popup_rule_definition_window().

#define AWAR_XFERRULE_AVAIL_SELECTED   AWARBASE_XFERRULE_TMP "avail"
#define AWAR_XFERRULE_AVAIL_CATEGORY   AWARBASE_XFERRULE_TMP "acat"
#define AWAR_XFERRULE_FIELD   AWARBASE_XFERRULE_TMP "field"
#define NO_XFERSET_SELECTED   ""

Typedef Documentation

typedef set<string, lt_field> StrSet

Definition at line 84 of file xfergui.cxx.

typedef StrSet::iterator StrSetIter

Definition at line 85 of file xfergui.cxx.

Enumeration Type Documentation

Enumerator
ALL_AVAILABLE_FIELDS 
FIELDS_BY_RULESET 
UNREAD_BY_RULESET 
UNWRITTEN_BY_RULESET 
INPUT_FIELDS_BY_CLIENT 
OUTPUT_FIELDS_BY_CLIENT 

Definition at line 458 of file xfergui.cxx.

Enumerator
MV_UP 
MV_DOWN 
MV_OFF 

Definition at line 757 of file xfergui.cxx.

Enumerator
COPY_RULESET 
MOVE_RULESET 

Definition at line 1024 of file xfergui.cxx.

Function Documentation

bool is_info ( const char field)
inline

Definition at line 68 of file xfergui.cxx.

Referenced by is_info(), lt_field::operator()(), and refresh_availfield_selbox_cb().

bool is_info ( const string field)
inline

Definition at line 69 of file xfergui.cxx.

References is_info().

const char* XFER_getFullFTS ( const char name)

converts name (as contained in awar passed to XFER_select_RuleSet) into full path.

Definition at line 96 of file xfergui.cxx.

References GB_concat_path(), GB_path_in_arbprop(), GBS_global_string(), and result.

Referenced by export_go_cb(), get_selected_FTS(), ArbImporter::import_data(), mg_xfer_via_fts(), and update_exportTest_result_cb().

AW_awar* awar_selected_FTS ( )
inline
static const char* get_selected_FTS ( )
static
void set_selected_FTS ( const char name)
inline
char* getNameOnly ( const char fullpath)
inline

Definition at line 117 of file xfergui.cxx.

References GB_split_full_path(), and NULp.

Referenced by check_valid_target_fts(), and fts_filesel_changed_cb().

static RuleSetPtr getSelectedRuleset ( const char *&  failReason)
static
int getSelectedRuleIndex ( )
inline

returns index of selected Rule [0..N-1] or -1 if none selected.

Definition at line 144 of file xfergui.cxx.

References ARB_strBeginsWith(), AW_root::awar(), AWAR_XFERRULE_SELECTED, AW_awar::read_char_pntr(), AW_root::SINGLETON, and xf_assert.

Referenced by add_rule_cb(), del_rule_cb(), getSelectedRule(), overwriteSelectedRule(), and rule_stack_cb().

const char* ruleSelId ( int  idx)
inline

Definition at line 156 of file xfergui.cxx.

References GBS_global_string().

Referenced by refresh_rule_selection_box_cb(), and selectRule().

GB_ERROR checkValidIndex ( RuleSetPtr  ruleset,
int  idx 
)
inline

return error if 'idx' invalid

Definition at line 159 of file xfergui.cxx.

References NULp.

Referenced by del_rule_cb(), getSelectedRule(), overwriteSelectedRule(), and rule_stack_cb().

static void selectRule ( int  idx,
int  ruleCount 
)
static

select rule in rule selection list

Parameters
idxrule number inside RuleSet. allowed range: [0..N-1]. if idx is outside range -> deselect rule.
ruleCountamount of defined rules (N).

Definition at line 164 of file xfergui.cxx.

References AW_root::awar(), AWAR_XFERRULE_SELECTED, ruleSelId(), AW_root::SINGLETON, and AW_awar::write_string().

Referenced by del_rule_cb(), deselectRule(), and rule_stack_cb().

static void deselectRule ( )
static

Definition at line 172 of file xfergui.cxx.

References selectRule().

Referenced by add_rule_cb().

static RulePtr getSelectedRule ( const char *&  failReason)
static
void refresh_fts_selbox ( )
inline
GB_ERROR saveChangedRuleset ( RuleSetPtr  ruleset)
inline
static void lintRuleset ( RuleSetPtr  ruleset)
static
static void lintRulesetOnce ( RuleSetPtr  ruleset)
static
static void overwriteSelectedRule ( RulePtr  newRule)
static
GB_ERROR check_valid_existing_fts ( const char fullfts)
inline
static GB_ERROR check_valid_target_fts ( const char fullfts)
static

Definition at line 318 of file xfergui.cxx.

References error(), GB_is_readablefile(), GBS_global_string(), getNameOnly(), and NULp.

Referenced by copyMoveRuleset_cb(), and createRuleset_cb().

static void selected_rule_changed_cb ( AW_root awr)
static
static RulePtr build_rule_from_awars ( AW_root awr)
static
static void rebuild_rule_from_awars_cb ( AW_root awr)
static
static void availfield_selected_cb ( AW_root awr)
static
static void refresh_availfield_selbox_cb ( AW_root awr,
AW_selection_list avail 
)
static
void mergeToKnownFields ( const StrArray &  source)
inline

Definition at line 467 of file xfergui.cxx.

References knownFields.

Referenced by mergeKnownFields().

size_t removeFromKnownFields ( const StrArray &  unwanted)
inline

Definition at line 472 of file xfergui.cxx.

References knownFields.

Referenced by mergeKnownFields().

static void mergeKnownFields ( AW_root awr)
static
static void refresh_available_fields_from_ruleset ( AW_root awr,
RuleSetPtr  rulesetPtr 
)
static
void XFER_refresh_available_fields ( AW_root awr,
const AvailableFieldScanner fieldScanner,
FieldsToScan  whatToScan 
)

refreshes the available fields (defined by client) shown in fts gui, if 'fieldScanner' is the currently active scanner. Otherwise do nothing (because GUI "belongs" to different client).

Definition at line 531 of file xfergui.cxx.

References knownFieldsClientInput, knownFieldsClientOutput, mergeKnownFields(), SCAN_INPUT_FIELDS, SCAN_OUTPUT_FIELDS, and AvailableFieldScanner::scanFields().

Referenced by AWTI_open_import_window(), create_AWTC_export_window(), and XFER_select_RuleSet().

static void refresh_inputfield_selbox_cb ( AW_root awr,
AW_selection_list input 
)
static
static void refresh_rule_selection_box_cb ( AW_root awr,
AW_selection_list rules 
)
static
static void init_rule_definition_awars ( AW_root awr)
static
static void clear_field_cb ( AW_window aww)
static
static void add_rule_cb ( AW_window aww)
static
static void del_rule_cb ( AW_window )
static
static void rule_stack_cb ( AW_window ,
bool  toStack 
)
static
void updateChangedInputFields ( const ConstStrArray ifield,
AW_awar awar_input_fields 
)
inline

Definition at line 714 of file xfergui.cxx.

References GBT_join_strings(), and AW_awar::write_string().

Referenced by add_field_cb(), and move_field_cb().

static void add_field_cb ( AW_window aww,
AW_selection_list inputSel 
)
static
static void move_field_cb ( AW_window aww,
FieldMoveDest  dest,
AW_selection_list inputSel 
)
static
static void popup_rule_definition_window ( AW_root awr)
static
static void fts_filesel_changed_cb ( AW_root awr)
static
static void selected_fts_changed_cb ( AW_root awr)
static
static void ruleset_awar_changed_cb ( AW_root awr,
const char awarname 
)
static
static void editRuleset_cb ( AW_window aww)
static
static void createRuleset_cb ( AW_window aww)
static
static GB_ERROR copyMoveRuleset_cb ( const char new_name,
copyMoveMode  mode 
)
static
static void askCopyMoveRuleset_cb ( AW_window ,
copyMoveMode  mode 
)
static
static void deleteRuleset_cb ( )
static
static void noRuleset_cb ( )
static
static void selected_fts_file_changed ( const char ,
ChangeReason  reason 
)
static

Definition at line 1113 of file xfergui.cxx.

References awar_selected_FTS(), CR_CREATED, CR_DELETED, CR_MODIFIED, noRuleset_cb(), and AW_awar::touch().

Referenced by initXferAwars().

static void initXferAwars ( AW_root awr)
static
static void popup_ruleset_admin_window ( AW_root awr)
static
void XFER_select_RuleSet ( AW_window aww,
const char awar_selected_fts,
const AvailableFieldScanner fieldScanner 
)

initializes ruleset GUI to choose/edit 'awar_selected_fts'. May be bound via multiple callbacks; will always edit the awar of the last triggered callback.

Definition at line 1204 of file xfergui.cxx.

References AW_root::awar(), AWAR_XFERSET_SELECTED, fieldScanner, AW_window::get_root(), initXferAwars(), AW_awar::map(), popup_ruleset_admin_window(), SCAN_ALL_FIELDS, and XFER_refresh_available_fields().

Referenced by AWTI_open_import_window(), create_AWTC_export_window(), and MG_create_merge_species_window().

Variable Documentation

const AvailableFieldScanner* currentFieldScanner = NULp
static

Definition at line 82 of file xfergui.cxx.

StrArray knownFieldsClientInput
static

Definition at line 87 of file xfergui.cxx.

Referenced by mergeKnownFields(), and XFER_refresh_available_fields().

StrArray knownFieldsClientOutput
static

Definition at line 88 of file xfergui.cxx.

Referenced by mergeKnownFields(), and XFER_refresh_available_fields().

StrArray knownFieldsRulesetInput
static

Definition at line 89 of file xfergui.cxx.

Referenced by mergeKnownFields(), and refresh_available_fields_from_ruleset().

StrArray knownFieldsRulesetOutput
static

Definition at line 90 of file xfergui.cxx.

Referenced by mergeKnownFields(), and refresh_available_fields_from_ruleset().

StrSet knownFields
static
int onlyLintRuleWithIdx = -1
static

Definition at line 212 of file xfergui.cxx.

bool warnAboutDuplicateTargets = true
static

Definition at line 213 of file xfergui.cxx.

Referenced by lintRuleset(), and rule_stack_cb().

bool ignoreRuleDetailChange = false
static

Definition at line 335 of file xfergui.cxx.

Referenced by rebuild_rule_from_awars_cb(), and selected_rule_changed_cb().

bool ignoreRulesetAwarChange = false
static

Definition at line 927 of file xfergui.cxx.

Referenced by ruleset_awar_changed_cb(), and selected_fts_changed_cb().