rasdaman complete source
rviewPrefs.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
23 
42 #ifndef _RVIEW_PREFS_H_
43 #define _RVIEW_PREFS_H_
44 
45 // #include "wx_scrol.h"
46 #include "wx/xrc/xh_scrol.h"
47 
48 #include "raslib/mddtypes.hh"
49 
50 #include "rviewUtils.hh"
51 #include "rviewDModes.hh"
52 
53 
54 
55 // Needed by rviewPrefsWindow. Full definition below.
56 class rviewPrefs;
57 
58 
59 
60 
61 /*
62  * The window for editing the preferences
63  */
65 {
66 public:
67 
68  rviewPrefsWindow(void);
70  ~rviewPrefsWindow(void);
71 
72  void setPrefs(rviewPrefs *Prefs);
73 
74  void unlinkParent(void);
75 
76  void OnSize(int w, int h);
77 
78  void label(void);
79  int process(wxObject &obj, wxEvent &evt);
80  int userEvent(const user_event &ue);
81 
82  virtual const char *getFrameName(void) const;
83  virtual rviewFrameType getFrameType(void) const;
84 
85 
86 protected:
87 
88  void setupVariables(void);
89  void updatePrefs(void);
90  void updateAndDie(void);
91  int findInChoices(int value, const char **choices, int number);
92 
93  static rviewChoice *buildFormatMenu(wxPanel *parent, int fmtNum, const char *label);
94  static void textWindowToString(DynamicString &str, wxTextWindow *twin);
95 
98 
99  wxPanel *panel, *butPanel;
101  // wxGroupBox *miscGroup, *imgGroup, *renderGroup, *thumbGroup, *heightGroup;
102  // wxGroupBox *chartGroup, *tableGroup, *soundGroup, *commGroup, *orthoGroup;
131  wxTextWindow *transferParm, *storageParm;
132  wxMessage *transferMsg, *storageMsg;
133  wxScrollBar *scroll;
136 
137  // constants
138  static const char *soundLatencyChoices[];
139  static const char *soundFrequencyChoices[];
140 
141  // Width and height of preferences window
142  static const int prefs_width;
143  static const int prefs_height;
144  // Borders used in prefs window
145  static const int prefs_border;
146  // Space at the bottom for button bar
147  static const int prefs_bottom;
148  // Button dimensions
149  static const int prefs_bwidth;
150  static const int prefs_bheight;
151  // Height of a text widget
152  static const int prefs_theight;
153  // Height of a checkbox
154  static const int prefs_chkheight;
155  // Height of a text widget's writable field
156  static const int prefs_eheight;
157  // ScrollBar width
158  static const int prefs_scrwidth;
159  // TextWindow height
160  static const int prefs_twheight;
161  // Message height
162  static const int prefs_mheight;
163  // Group boxes
164  static const int prefs_grpmsc_height;
165  static const int prefs_grpimg_height;
166  static const int prefs_grpren_height;
167  static const int prefs_grphgt_height;
168  static const int prefs_grport_height;
169  static const int prefs_grpthb_height;
170  static const int prefs_grpcht_height;
171  static const int prefs_grptab_height;
172  static const int prefs_grpsnd_height;
173  static const int prefs_grpcom_height;
174  // Height of panel
175  static const int prefs_pheight;
176 };
177 
178 
179 /*
180  * Object holding the preferences and the current setup.
181  */
183 {
184 public:
185 
186  rviewPrefs(void);
187  rviewPrefs(const char *file);
188  rviewPrefs(const rviewPrefs &srcPrefs);
189  ~rviewPrefs(void);
190 
191  int load(const char *file);
192  int save(const char *file);
193  int edit(void);
194  void editorClosed(void);
195  void closeEditor(rviewPrefs *newPrefs);
196  void updatePrefs(rviewPrefs *newPrefs);
197  void markModified(void);
198 
199  static void copyPrefs(const rviewPrefs &src, rviewPrefs &dest);
200 
201  r_Data_Format getTransferFormat( void ) const;
202  r_Data_Format getStorageFormat( void ) const;
203 
222  bool imgBBox;
223  unsigned long imgZpro, imgClipz, imgWgtQuant;
225  double imgScale;
227  bool imgLight;
231  double imgVoxColour;
240  double chartMarky;
248 
249 
250 protected:
251 
252  void setupVariables(void);
253  // used for getting the value of an argument when reading the prefs file.
254  char *getValue(char *b);
255  // convert long strings (including newlines) from/to external representation
256  static char *toExternal(const DynamicString &str);
257  static void fromExternal(const char *ext, DynamicString &str);
258  // read a line into the internal buffer; return a pointer to the start if successful
259  char *readLine(FILE *fp);
260 
263 
264  char *inbuff;
265  unsigned long buffSize;
266 
267  static const unsigned long buffExtendGranularity;
269 };
270 
271 
272 
273 /*
274  * Global variables
275  */
276 
277 extern rviewPrefs *prefs;
278 
279 #endif
static const int prefs_grphgt_height
Definition: rviewPrefs.hh:167
rviewButton * butApply
Definition: rviewPrefs.hh:100
rviewImageMode imgMode
Definition: rviewPrefs.hh:218
rviewText * imgLightAngle
Definition: rviewPrefs.hh:115
Definition: rviewPrefs.hh:182
bool imgLight
Definition: rviewPrefs.hh:227
static const int prefs_grpimg_height
Definition: rviewPrefs.hh:165
wxWindowBase * commGroup
Definition: rviewPrefs.hh:104
DynamicString storageParm
Definition: rviewPrefs.hh:246
char * getValue(char *b)
void updatePrefs(void)
static const int prefs_mheight
Definition: rviewPrefs.hh:162
rviewText * thumbProjstep
Definition: rviewPrefs.hh:126
rviewText * maxDHeight
Definition: rviewPrefs.hh:107
double imgLightGain
Definition: rviewPrefs.hh:228
rviewCheckBox * imgBBox
Definition: rviewPrefs.hh:110
int movieMode
Definition: rviewPrefs.hh:220
rviewCheckBox * imgLight
Definition: rviewPrefs.hh:114
rviewText * imgVoxColour
Definition: rviewPrefs.hh:118
wxWindowBase * thumbGroup
Definition: rviewPrefs.hh:103
unsigned long imgClipz
Definition: rviewPrefs.hh:223
double imgScale
Definition: rviewPrefs.hh:225
static const int prefs_grpren_height
Definition: rviewPrefs.hh:166
static const int prefs_bwidth
Definition: rviewPrefs.hh:149
void editorClosed(void)
wxScrollBar * scroll
Definition: rviewPrefs.hh:133
static const int prefs_grptab_height
Definition: rviewPrefs.hh:171
DynamicString databaseName
Definition: rviewPrefs.hh:206
int imgLightDist
Definition: rviewPrefs.hh:233
rviewChoice * soundLatency
Definition: rviewPrefs.hh:127
rviewCheckBox * imgUseVCol
Definition: rviewPrefs.hh:117
rviewText * imgHeightScale
Definition: rviewPrefs.hh:129
static const int prefs_bottom
Definition: rviewPrefs.hh:147
rviewText * queryPath
Definition: rviewPrefs.hh:105
static void fromExternal(const char *ext, DynamicString &str)
rviewCheckBox * imgDither
Definition: rviewPrefs.hh:108
colourspaceMapper * csmap
Definition: rviewPrefs.hh:135
static const int prefs_bheight
Definition: rviewPrefs.hh:150
rviewText * imgLightGain
Definition: rviewPrefs.hh:115
rviewText * chartMarky
Definition: rviewPrefs.hh:123
int userEvent(const user_event &ue)
double imgPixThreshHigh
Definition: rviewPrefs.hh:224
static const int prefs_grpmsc_height
Definition: rviewPrefs.hh:164
static const char * soundFrequencyChoices[]
Definition: rviewPrefs.hh:139
int chartStep
Definition: rviewPrefs.hh:239
static const int prefs_width
Definition: rviewPrefs.hh:142
rviewText * imgLightScintAngle
Definition: rviewPrefs.hh:115
rviewText * tableStepy
Definition: rviewPrefs.hh:125
int save(const char *file)
int maxDHeight
Definition: rviewPrefs.hh:216
wxPanel * butPanel
Definition: rviewPrefs.hh:99
rviewCheckBox * imgVoxForType
Definition: rviewPrefs.hh:113
rviewText * chartStep
Definition: rviewPrefs.hh:123
int imgHeightGrid
Definition: rviewPrefs.hh:234
virtual const char * getFrameName(void) const
bool tableCosys
Definition: rviewPrefs.hh:241
unsigned long imgWgtQuant
Definition: rviewPrefs.hh:223
rviewCheckBox * imgOrthoBBox
Definition: rviewPrefs.hh:120
Definition: rviewUtils.hh:482
DynamicString queryFont
Definition: rviewPrefs.hh:213
int imgKernSize
Definition: rviewPrefs.hh:229
wxWindowBase * imgGroup
Definition: rviewPrefs.hh:103
static rviewChoice * buildFormatMenu(wxPanel *parent, int fmtNum, const char *label)
void markModified(void)
rviewText * imgZpro
Definition: rviewPrefs.hh:111
rviewText * thumbWidth
Definition: rviewPrefs.hh:126
rviewCheckBox * imgOrthoDragRel
Definition: rviewPrefs.hh:120
rviewChoice * chartMode
Definition: rviewPrefs.hh:109
rviewText * vffParams
Definition: rviewPrefs.hh:106
rviewChoice * rgbSpace
Definition: rviewPrefs.hh:109
int maxDWidth
Definition: rviewPrefs.hh:216
rviewChoice * imgKernSize
Definition: rviewPrefs.hh:116
DynamicString queryPath
Definition: rviewPrefs.hh:212
rviewText * maxDWidth
Definition: rviewPrefs.hh:107
wxWindowBase * heightGroup
Definition: rviewPrefs.hh:103
static void copyPrefs(const rviewPrefs &src, rviewPrefs &dest)
Definition: rviewUtils.hh:636
int thumbWidth
Definition: rviewPrefs.hh:243
DynamicString vffParams
Definition: rviewPrefs.hh:214
static const int prefs_twheight
Definition: rviewPrefs.hh:160
int findInChoices(int value, const char **choices, int number)
rviewText * imgClipz
Definition: rviewPrefs.hh:111
Definition: rviewUtils.hh:671
static void textWindowToString(DynamicString &str, wxTextWindow *twin)
double imgWgtThresh
Definition: rviewPrefs.hh:224
rviewImageMode
Definition: rviewDModes.hh:78
static const int prefs_chkheight
Definition: rviewPrefs.hh:154
Definition: rviewColMap.hh:193
rviewCheckBox * soundLoop
Definition: rviewPrefs.hh:128
int thumbProjdim
Definition: rviewPrefs.hh:243
bool chartCosys
Definition: rviewPrefs.hh:238
int rgbSpace
Definition: rviewPrefs.hh:220
DynamicString lastScColl
Definition: rviewPrefs.hh:209
rviewText * imgHeightGrid
Definition: rviewPrefs.hh:129
double imgLightScintAngle
Definition: rviewPrefs.hh:228
static const char * soundLatencyChoices[]
Definition: rviewPrefs.hh:138
int chartMarkx
Definition: rviewPrefs.hh:239
DynamicString imgLightDir
Definition: rviewPrefs.hh:232
rviewText * imgWgtQuant
Definition: rviewPrefs.hh:111
void setupVariables(void)
r_Data_Format
Definition: mddtypes.hh:133
rviewCheckBox * chartCosys
Definition: rviewPrefs.hh:122
bool imgVoxForType
Definition: rviewPrefs.hh:226
rviewChoice * imgMode
Definition: rviewPrefs.hh:109
int imgKernType
Definition: rviewPrefs.hh:229
int soundFreq
Definition: rviewPrefs.hh:244
double imgLightAngle
Definition: rviewPrefs.hh:228
rviewPrefs * myParent
Definition: rviewPrefs.hh:97
rviewChoice * imgKernType
Definition: rviewPrefs.hh:116
static const int prefs_pheight
Definition: rviewPrefs.hh:175
static const int prefs_grport_height
Definition: rviewPrefs.hh:168
rviewText * imgLightDist
Definition: rviewPrefs.hh:119
double imgVoxColour
Definition: rviewPrefs.hh:231
void OnSize(int w, int h)
char * readLine(FILE *fp)
rviewFrameType
Definition: rviewUtils.hh:443
int tableStepy
Definition: rviewPrefs.hh:242
rviewChoice * transferFmt
Definition: rviewPrefs.hh:130
int process(wxObject &obj, wxEvent &evt)
int tableMode
Definition: rviewPrefs.hh:221
static const int prefs_eheight
Definition: rviewPrefs.hh:156
bool ditherBest
Definition: rviewPrefs.hh:217
static const int prefs_scrwidth
Definition: rviewPrefs.hh:158
bool imgUseVCol
Definition: rviewPrefs.hh:230
bool imgRgbBrightness
Definition: rviewPrefs.hh:226
rviewText * queryFont
Definition: rviewPrefs.hh:105
rviewChoice * soundFreq
Definition: rviewPrefs.hh:127
static const int prefs_grpsnd_height
Definition: rviewPrefs.hh:172
int transferFmt
Definition: rviewPrefs.hh:245
bool imgOrthoBBox
Definition: rviewPrefs.hh:236
int soundLatency
Definition: rviewPrefs.hh:244
rviewText * thumbCols
Definition: rviewPrefs.hh:126
int load(const char *file)
wxWindowBase * chartGroup
Definition: rviewPrefs.hh:104
rviewText * imgPixThreshHigh
Definition: rviewPrefs.hh:111
int serverPort
Definition: rviewPrefs.hh:205
static const int prefs_height
Definition: rviewPrefs.hh:143
int lastDisplay
Definition: rviewPrefs.hh:215
wxWindowBase * orthoGroup
Definition: rviewPrefs.hh:104
wxMessage * storageMsg
Definition: rviewPrefs.hh:132
Definition: rviewUtils.hh:317
rviewCheckBox * imgRgbBrightness
Definition: rviewPrefs.hh:113
rviewButton * butOK
Definition: rviewPrefs.hh:100
int tableStepx
Definition: rviewPrefs.hh:242
Definition: rviewUtils.hh:386
wxWindowBase * miscGroup
Definition: rviewPrefs.hh:103
wxTextWindow * storageParm
Definition: rviewPrefs.hh:131
wxPanel * panel
Definition: rviewPrefs.hh:99
int thumbCols
Definition: rviewPrefs.hh:243
rviewChartMode
Definition: rviewDModes.hh:828
rviewPrefs(void)
bool imgDither
Definition: rviewPrefs.hh:217
wxTextWindow * transferParm
Definition: rviewPrefs.hh:131
rviewButton * butCancel
Definition: rviewPrefs.hh:100
r_Data_Format getStorageFormat(void) const
bool imgOrthoDragRel
Definition: rviewPrefs.hh:236
DynamicString transferParm
Definition: rviewPrefs.hh:246
rviewText * imgLightAmbient
Definition: rviewPrefs.hh:115
unsigned long imgZpro
Definition: rviewPrefs.hh:223
DynamicString userName
Definition: rviewPrefs.hh:207
static const keyword_to_ident_c prefsVarDesc[]
Definition: rviewPrefs.hh:268
int edit(void)
static const int prefs_grpcht_height
Definition: rviewPrefs.hh:170
static const int prefs_grpthb_height
Definition: rviewPrefs.hh:169
int storageFmt
Definition: rviewPrefs.hh:245
int thumbProjstep
Definition: rviewPrefs.hh:243
int imgOrthoThick
Definition: rviewPrefs.hh:237
Definition: rviewUtils.hh:331
rviewText * filePath
Definition: rviewPrefs.hh:105
void unlinkParent(void)
static const int prefs_border
Definition: rviewPrefs.hh:145
rviewText * tableStepx
Definition: rviewPrefs.hh:125
rviewPrefs * prefs
Definition: rviewColMap.hh:54
bool prefsModified
Definition: rviewPrefs.hh:262
double imgHeightScale
Definition: rviewPrefs.hh:235
bool imgBBox
Definition: rviewPrefs.hh:222
rviewPrefs * editPrefs
Definition: rviewPrefs.hh:96
rviewButton * cstrap
Definition: rviewPrefs.hh:134
void setupVariables(void)
DynamicString serverName
Definition: rviewPrefs.hh:204
unsigned long buffSize
Definition: rviewPrefs.hh:265
char * inbuff
Definition: rviewPrefs.hh:264
r_Data_Format getTransferFormat(void) const
wxWindowBase * renderGroup
Definition: rviewPrefs.hh:103
static const int prefs_grpcom_height
Definition: rviewPrefs.hh:173
rviewChartMode chartMode
Definition: rviewPrefs.hh:219
~rviewPrefs(void)
rviewChoice * tableMode
Definition: rviewPrefs.hh:109
rviewText * imgScale
Definition: rviewPrefs.hh:112
rviewChoice * storageFmt
Definition: rviewPrefs.hh:130
colourspace_params csp
Definition: rviewPrefs.hh:247
rviewText * chartMarkx
Definition: rviewPrefs.hh:123
DynamicString filePath
Definition: rviewPrefs.hh:211
rviewChoice * movieMode
Definition: rviewPrefs.hh:109
wxMessage * transferMsg
Definition: rviewPrefs.hh:132
Definition: rviewUtils.hh:663
rviewCheckBox * tableCosys
Definition: rviewPrefs.hh:124
rviewCheckBox * ditherBest
Definition: rviewPrefs.hh:108
static const unsigned long buffExtendGranularity
Definition: rviewPrefs.hh:267
Definition: rviewUtils.hh:680
void setPrefs(rviewPrefs *Prefs)
DynamicString lastColl
Definition: rviewPrefs.hh:208
virtual rviewFrameType getFrameType(void) const
static const int prefs_theight
Definition: rviewPrefs.hh:152
void label(void)
rviewPrefsWindow * pwin
Definition: rviewPrefs.hh:261
rviewText * imgWgtThresh
Definition: rviewPrefs.hh:111
wxWindowBase * tableGroup
Definition: rviewPrefs.hh:104
Definition: rviewPrefs.hh:64
double imgLightAmbient
Definition: rviewPrefs.hh:228
rviewText * imgOrthoThick
Definition: rviewPrefs.hh:121
rviewText * imgLightDir
Definition: rviewPrefs.hh:119
wxWindowBase * soundGroup
Definition: rviewPrefs.hh:104
double imgPixThreshLow
Definition: rviewPrefs.hh:224
rviewText * thumbProjdim
Definition: rviewPrefs.hh:126
void updatePrefs(rviewPrefs *newPrefs)
int soundLoop
Definition: rviewPrefs.hh:244
void closeEditor(rviewPrefs *newPrefs)
void updateAndDie(void)
rviewText * imgPixThreshLow
Definition: rviewPrefs.hh:111
static char * toExternal(const DynamicString &str)
double chartMarky
Definition: rviewPrefs.hh:240
DynamicString lastOrthoColl
Definition: rviewPrefs.hh:210