00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00025 #ifndef GRAPHICS_DISABLED
00026 #ifndef VARABLED_H
00027 #define VARABLED_H
00028
00029 #include "elst.h"
00030 #include "scrollview.h"
00031 #include "varable.h"
00032 #include "tesseractclass.h"
00033
00034 class SVMenuNode;
00035
00037 enum VarType {
00038 VT_INTEGER,
00039 VT_BOOLEAN,
00040 VT_STRING,
00041 VT_DOUBLE
00042 };
00043
00051 class VariableContent : public ELIST_LINK {
00052 public:
00054 static int Compare(const void* v1, const void* v2);
00055
00057 static VariableContent* GetVariableContentById(int id);
00058
00060 VariableContent() {
00061 }
00062 VariableContent(STRING_VARIABLE* it);
00063 VariableContent(INT_VARIABLE* it);
00064 VariableContent(BOOL_VARIABLE* it);
00065 VariableContent(double_VARIABLE* it);
00066
00067
00069 void SetValue(const char* val);
00070 const char* GetValue() const;
00071 const char* GetName() const;
00072 const char* GetDescription() const;
00073
00074 int GetId() { return my_id_; }
00075 bool HasChanged() { return changed_; }
00076
00077 private:
00079 int my_id_;
00081 bool changed_;
00083 VarType var_type_;
00084
00085 STRING_VARIABLE* sIt;
00086 INT_VARIABLE* iIt;
00087 BOOL_VARIABLE* bIt;
00088 double_VARIABLE* dIt;
00089 };
00090
00091 ELISTIZEH(VariableContent)
00092
00093
00098 class VariablesEditor : public SVEventHandler {
00099 public:
00105 VariablesEditor(const tesseract::Tesseract*, ScrollView* sv = NULL);
00106
00108 void Notify(const SVEvent* sve);
00109
00110 private:
00115 void GetPrefixes(const char* s, STRING* level_one,
00116 STRING* level_two, STRING* level_three);
00117
00122 void GetFirstWords(const char *s,
00123 int n,
00124 char *t);
00125
00130 SVMenuNode *BuildListOfAllLeaves();
00131
00133 void WriteVars(char* filename, bool changes_only);
00134
00135 ScrollView* sv_window_;
00136 };
00137
00138 #endif
00139 #endif