OpenASIP  2.0
GUIOptions.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file GUIOptions.cc
26  *
27  * Implementation of class GUIOptions.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include <wx/wx.h>
34 #include "Application.hh"
35 #include "GUIOptions.hh"
36 #include "Conversion.hh"
37 #include "SequenceTools.hh"
38 #include "WxConversion.hh"
39 #include "CommandRegistry.hh"
40 #include "GUICommand.hh"
41 #include "FileSystem.hh"
42 #include "ObjectState.hh"
43 
44 using std::string;
45 
46 // initialization of static data members
47 const string GUIOptions::OSNAME_OPTIONS = "options";
48 const string GUIOptions::OSKEY_FULL_SCREEN = "fscreen";
49 const string GUIOptions::OSKEY_WINDOW_WIDTH = "wwidth";
50 const string GUIOptions::OSKEY_WINDOW_HEIGHT = "wheight";
51 const string GUIOptions::OSKEY_X_POS = "xpos";
52 const string GUIOptions::OSKEY_Y_POS = "ypos";
53 const string GUIOptions::OSKEY_TOOLBAR_VISIBILITY = "tbvisib";
54 const string GUIOptions::OSKEY_TOOLBAR_LAYOUT = "tblayout";
55 const string GUIOptions::OSVALUE_TEXT = "text";
56 const string GUIOptions::OSVALUE_ICON = "icon";
57 const string GUIOptions::OSVALUE_BOTH = "both";
58 const string GUIOptions::OSNAME_SEPARATOR = "separator";
59 const string GUIOptions::OSKEY_POSITION = "pos";
60 
61 const string GUIOptions::TOOLBAR_SEPARATOR = "-- separator --";
62 
63 #include <iostream>
64 
65 /**
66  * Constructor.
67  */
68 GUIOptions::GUIOptions(std::string name) :
69  fullScreen_(false), windowWidth_(400), windowHeight_(400), xPosition_(0),
70  yPosition_(0), toolbarVisibility_(false), toolbarLayout_(BOTH),
71  modified_(false), name_(name) {
72 }
73 
74 
75 /**
76  * Constructor.
77  *
78  * Loads the state from the given ObjectState tree.
79  *
80  * @param state The ObjectState tree.
81  * @exception ObjectStateLoadingException If the given ObjectState tree is
82  * invalid.
83  */
84 GUIOptions::GUIOptions(const ObjectState* state) : modified_(false) {
85  loadState(state);
86 }
87 
88 /**
89  * Copy constructor.
90  *
91  * This constructor creates identical options with the given options class.
92  */
94 
98  xPosition_ = old.xPosition_;
99  yPosition_ = old.yPosition_;
103  modified_ = old.modified_;
104 
105 #ifdef KB_SC_EDITING
106  // deep copy keyboard shortcuts
107  for (KSTable::const_iterator iter = old.keyboardShortcuts_.begin();
108  iter != old.keyboardShortcuts_.end(); iter++) {
109 
110  keyboardShortcuts_.push_back(new KeyboardShortcut(**iter));
111  }
112 #endif
113 
114  // deep copy toolbar buttons
115  for (TBTable::const_iterator iter = old.toolbarButtons_.begin();
116  iter != old.toolbarButtons_.end(); iter++) {
117  toolbarButtons_.push_back(new ToolbarButton(**iter));
118  }
119 }
120 
121 
122 /**
123  * Destructor.
124  */
128 }
129 
130 
131 /**
132  * Returns true, if the application window opens in full screen mode as
133  * default, otherwise false.
134  *
135  * @return True, if the application window opens in full screen mode as
136  * default, otherwise false.
137  */
138 bool
140  return fullScreen_;
141 }
142 
143 
144 /**
145  * Returns the default width of the application window.
146  *
147  * @return The default width of the application window.
148  */
149 int
151  return windowWidth_;
152 }
153 
154 
155 /**
156  * Returns the default height of the application window.
157  *
158  * @return The default height of the application window.
159  */
160 int
162  return windowHeight_;
163 }
164 
165 
166 /**
167  * Returns the default x position of left side of the application window.
168  *
169  * @return The default x position of left side of the application window.
170  */
171 int
173  return xPosition_;
174 }
175 
176 
177 /**
178  * Returns the default y position of upper side of the application window.
179  *
180  * @return The default y position of upper side of the application window.
181  */
182 int
184  return yPosition_;
185 }
186 
187 
188 /**
189  * Returns true if the toolbar is visible by default, otherwise false.
190  *
191  * @return True if the toolbar is visible by default, otherwise false.
192  */
193 bool
195  return toolbarVisibility_;
196 }
197 
198 
199 /**
200  * Returns the layout mode of the toolbar.
201  *
202  * @return Layout mode of the toolbar.
203  */
206  return toolbarLayout_;
207 }
208 
209 
210 /**
211  * Sets or unsets the default full screen mode of the application window.
212  *
213  * @param fullScreen If true, the full screen mode is set, otherwise unset.
214  */
215 void
216 GUIOptions::setFullScreen(bool fullScreen) {
218  modified_ = true;
219 }
220 
221 
222 /**
223  * Sets the default application window size.
224  *
225  * @param width Pixel width of the window.
226  * @param height Pixel height of the window.
227  */
228 void
229 GUIOptions::setWindowSize(int width, int height) {
230  windowWidth_ = width;
231  windowHeight_ = height;
232  modified_ = true;
233 }
234 
235 
236 /**
237  * Sets the default position of the window.
238  *
239  * @param x X-coordinate of left side of the application window.
240  * @param y Y-coordinate of upper side of the application window.
241  */
242 void
244  xPosition_ = x;
245  yPosition_ = y;
246  modified_ = true;
247 }
248 
249 
250 /**
251  * Sets the visibility mode of the toolbar.
252  *
253  * @param visible If true, the toolbar is visible, otherwise it is hidden.
254  */
255 void
257  toolbarVisibility_ = visible;
258  modified_ = true;
259 }
260 
261 
262 /**
263  * Sets the layout of the toolbar buttons.
264  *
265  * @param layout Layout of the toolbar buttons.
266  */
267 void
269  toolbarLayout_ = layout;
270  modified_ = true;
271 }
272 
273 
274 /**
275  * Adds a keyboard shortcut.
276  *
277  * @param shortcut Keyboard shortcut to be added.
278  */
279 void
281  keyboardShortcuts_.push_back(shortcut);
282  modified_ = true;
283 }
284 
285 
286 /**
287  * Adds the given button to the toolbar.
288  *
289  * @param button Button to be added.
290  */
291 void
293  toolbarButtons_.push_back(button);
294  modified_ = true;
295 }
296 
297 
298 /**
299  * Adds a separator to the toolbar to the given position.
300  *
301  * @param position Number of the slot left side of which the separator is
302  * drawn.
303  */
304 void
306  toolbarSeparators_.push_back(position);
307  modified_ = true;
308 }
309 
310 
311 /**
312  * Deletes the given keyboard shortcut.
313  *
314  * @param shortcut The keyboard shortcut to be deleted.
315  */
316 void
318  KSTable::iterator iter = keyboardShortcuts_.begin();
319  while (iter != keyboardShortcuts_.end()) {
320  if (*iter == shortcut) {
321  keyboardShortcuts_.erase(iter);
322  delete shortcut;
323  modified_ = true;
324  return;
325  }
326  iter++;
327  }
328 }
329 
330 
331 /**
332  * Deletes the given toolbar button.
333  *
334  * @param button The toolbar button to be deleted.
335  */
336 void
338  TBTable::iterator iter = toolbarButtons_.begin();
339  while (iter != toolbarButtons_.end()) {
340  if (*iter == button) {
341  toolbarButtons_.erase(iter);
342  delete button;
343  modified_ = true;
344  return;
345  }
346  iter++;
347  }
348 }
349 
350 
351 /**
352  * Deletes a separator from the given position.
353  *
354  * @param position The slot position left side of which the separator is
355  * deleted.
356  */
357 void
359  SeparatorTable::iterator iter = toolbarSeparators_.begin();
360  while (iter != toolbarSeparators_.end()) {
361  if (*iter == position) {
362  toolbarSeparators_.erase(iter);
363  modified_ = true;
364  return;
365  }
366  iter++;
367  }
368 }
369 
370 /**
371  * Returns keyboard shortcut for the command with given name.
372  *
373  * @param commandName Name of the command to search shortcut for.
374  * @return NULL if a shortcut doesn't exist for the command.
375  */
377 GUIOptions::keyboardShortcut(const std::string commandName) const {
378 
379  KSTable::const_iterator iter = keyboardShortcuts_.begin();
380 
381  for (; iter != keyboardShortcuts_.end(); iter++) {
382  if ((*iter)->action() == commandName) {
383  return *iter;
384  }
385  }
386 
387  return NULL;
388 }
389 
390 /**
391  * Returns the first keyboard shortcut. If there are no keyboard shortcuts,
392  * returns null pointer.
393  *
394  * @return The first keyboard shortcut.
395  */
398  ksIter_ = keyboardShortcuts_.begin();
399  if (ksIter_ != keyboardShortcuts_.end()) {
400  return *ksIter_;
401  } else {
402  return NULL;
403  }
404 }
405 
406 
407 /**
408  * Returns the always the next keyboard shortcut after firstShortcut has been
409  * called. Returns null pointer after the last keyboard shortcut.
410  *
411  * @return The next keyboard shortcut.
412  */
416  ksIter_++;
417  if (ksIter_ != keyboardShortcuts_.end()) {
418  return *ksIter_;
419  } else {
420  return NULL;
421  }
422 }
423 
424 
425 /**
426  * Returns the first toolbar button. Returns null pointer if there are no
427  * toolbar buttons.
428  *
429  * @return The first toolbar button.
430  */
433  tbIter_ = toolbarButtons_.begin();
434  if (tbIter_ != toolbarButtons_.end()) {
435  return *tbIter_;
436  } else {
437  return NULL;
438  }
439 }
440 
441 
442 /**
443  * Returns always the next toolbar button after the firstToolbarButton has
444  * been called.
445  *
446  * @return The next toolbar button.
447  */
450  assert(tbIter_ != toolbarButtons_.end());
451  tbIter_++;
452  if (tbIter_ != toolbarButtons_.end()) {
453  return *tbIter_;
454  } else {
455  return NULL;
456  }
457 }
458 
459 
460 /**
461  * Returns position of the first toolbar separator. Position is the position
462  * of the slot left side of which the separator is. If there are no
463  * separators, returns -1.
464  *
465  * @return Position of the first toolbar separator.
466  */
467 int
470  if (separatorIter_ != toolbarSeparators_.end()) {
471  return *separatorIter_;
472  } else {
473  return -1;
474  }
475 }
476 
477 
478 /**
479  * Returns always position of the next toolbar separator. If there are no
480  * more separators, returns -1.
481  *
482  * @return Position of the next toolbar separator.
483  */
484 int
487  separatorIter_++;
488  if (separatorIter_ != toolbarSeparators_.end()) {
489  return *separatorIter_;
490  } else {
491  return -1;
492  }
493 }
494 
495 
496 /**
497  * Clears the modified flag.
498  *
499  * The isModified method returns false after calling this method.
500  */
501 void
503  modified_ = false;
504 }
505 
506 
507 /**
508  * Returns true if the options are modified.
509  *
510  * @return True if the options are modified.
511  */
512 bool
514  return modified_;
515 }
516 
517 
518 /**
519  * Validates the state of the options.
520  *
521  * Checks that there is no gaps in toolbar item positions and no two items
522  * at the same position. Additionally checks that there is no same keyboard
523  * shortcuts for several actions and no two keyboard shortcuts for the same
524  * action.
525  *
526  * @exception InvalidData If the options are in invalid state.
527  */
528 void
530  const string procName = "GUIOptions::validate";
531  int buttons = toolbarButtons_.size();
532  int separators = toolbarSeparators_.size();
533 
534  // check that there is no gaps in toolbar item positions
535  for (int i = 0; i < buttons + separators; i++) {
536  bool buttonfound = false;
537  bool separatorfound = false;
538  ToolbarButton* button = firstToolbarButton();
539  while (button != NULL) {
540  if (button->slot() == i) {
541  if (buttonfound) {
542  string errorMsg = "There is at least two toolbar items ";
543  errorMsg += "at position \'" + Conversion::toString(i) +
544  "\'.";
545  throw InvalidData(__FILE__, __LINE__, procName,
546  errorMsg);
547  }
548  buttonfound = true;
549  }
550  button = nextToolbarButton();
551  }
552 
553  for (int sepIndex = 0; sepIndex < separators; sepIndex++) {
554  if (toolbarSeparators_[sepIndex] == i) {
555  if (separatorfound || buttonfound) {
556  string errorMsg = "There is at least two toolbar items ";
557  errorMsg += "at position \'" + Conversion::toString(i) +
558  "\'.";
559  throw InvalidData(__FILE__, __LINE__, procName,
560  errorMsg);
561  }
562  separatorfound = true;
563  }
564  }
565 
566  if (!buttonfound && !separatorfound) {
567  string errorMsg = "There is no separator or button at slot "
568  "position \'" + Conversion::toString(i) + "\'.";
569  throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
570  }
571 
572  }
573 
574  // check that there is no same keyboard shortcuts for several actions and
575  // no two keyboard shortcuts for same action
576  KSTable::const_iterator ksIter = keyboardShortcuts_.begin();
577  while (ksIter != keyboardShortcuts_.end()) {
578  KeyboardShortcut* observable = *ksIter;
579  string action = observable->action();
580  KSTable::const_iterator seekerIter = keyboardShortcuts_.begin();
581 
582  while (seekerIter != keyboardShortcuts_.end()) {
583  KeyboardShortcut* sc = *seekerIter;
584  if (action == sc->action() && sc != observable) {
585  string errorMsg = "Action \'" + action + "\' is assigned for"
586  + " two or more keyboard shortcuts.";
587  throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
588  }
589  if (observable->equals(*sc) && observable != sc) {
590  string errorMsg = "Same keyboard shortcut is used for \'" +
591  observable->action() + "\' and \'" + sc->action() +
592  "\' actions.";
593  throw InvalidData(__FILE__, __LINE__, procName, errorMsg);
594  }
595  seekerIter++;
596  }
597  ksIter++;
598  }
599 }
600 
601 /**
602  * Checks whether these options has file name assigned.
603  *
604  * @return True if these options has file name assigned, otherwise false.
605  */
606 bool
608  if (fileName_ == "") {
609  return false;
610  }
611  return true;
612 }
613 
614 
615 /**
616  * Returns the file name assigned to these options.
617  *
618  * @return The file name assigned to these options.
619  */
620 string
622  return fileName_;
623 }
624 
625 
626 /**
627  * Sets the file name assigned into these options.
628  *
629  * @param fileName The file name assigned into these options.
630  */
631 void
632 GUIOptions::setFileName(const std::string& fileName) {
634 }
635 
636 
637 /**
638  * Loads the state of the object from the given ObjectState object.
639  *
640  * @param state ObjectState from which the state is loaded.
641  * @exception ObjectStateLoadingException If the given ObjectState instance
642  * is invalid.
643  */
644 void
646  const string procName = "GUIOptions::loadState";
647 
648  if (state->name() != OSNAME_OPTIONS) {
649  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
650  }
651 
652  try {
659 
660  string layout = state->stringAttribute(OSKEY_TOOLBAR_LAYOUT);
661  if (layout == OSVALUE_TEXT) {
663  } else if (layout == OSVALUE_ICON) {
665  } else if (layout == OSVALUE_BOTH) {
667  } else {
668  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
669  }
670 
671  // get toolbar separators, keyboard shortcuts and toolbar buttons
672  for (int i = 0; i < state->childCount(); i++) {
673  ObjectState* child = state->child(i);
674  if (child->name() == OSNAME_SEPARATOR) {
676 
677  } else if (child->name() ==
680  } else if (child->name() == ToolbarButton::OSNAME_TOOLBAR_BUTTON) {
681  addToolbarButton(new ToolbarButton(child));
682  } else {
683  throw ObjectStateLoadingException(__FILE__, __LINE__,
684  procName);
685  }
686  }
687  } catch (...) {
690  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
691  }
692 }
693 
694 /**
695  * Creates an ObjectState object and saves the state of the object into it.
696  *
697  * @return The created ObjectState object.
698  */
701 
702  ObjectState* state = new ObjectState(OSNAME_OPTIONS);
703 
710 
711  if (toolbarLayout_ == TEXT) {
713  } else if (toolbarLayout_ == ICON) {
715  } else {
717  }
718 
719  // add toolbar separators
720  for (int i = 0; i < (int)toolbarSeparators_.size(); i++) {
721  ObjectState* separator = new ObjectState(OSNAME_SEPARATOR);
722  state->addChild(separator);
724  }
725 
726  // add keyboard shortcuts
727  for (int i = 0; i < (int)keyboardShortcuts_.size(); i++) {
729  state->addChild(sc->saveState());
730  }
731 
732  // add toolbar buttons
733  for (int i = 0; i < (int)toolbarButtons_.size(); i++) {
734  ToolbarButton* button = toolbarButtons_[i];
735  state->addChild(button->saveState());
736  }
737 
738  return state;
739 }
740 
741 /**
742  * Deletes all the keyboard shortcuts.
743  */
744 void
747 }
748 
749 
750 /**
751  * Deletes all the toolbar buttons.
752  */
753 void
756 }
757 
758 
759 /**
760  * Creates a toolbar defined in the options.
761  *
762  * @param parent Parent window of the created toolbar.
763  * @param registry Command registry containing the toolbar commands.
764  * @param iconPath Path of the toolbar icon files.
765  * @return A new toolbar corresponding to the one defined in the options.
766  */
767 wxToolBar*
769  wxWindow* parent, CommandRegistry& registry,
770  const wxString& iconsPath) {
771 
772  int layout = toolbarLayout();
773  long style = 0;
774 
775  // check toolbar layout from options
776  if (layout == GUIOptions::BOTH) {
777  style = wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT;
778  } else if (layout == GUIOptions::ICON) {
779  style = wxTB_HORIZONTAL | wxNO_BORDER;
780  } else if (layout == GUIOptions::TEXT) {
781  style = wxTB_HORIZONTAL | wxNO_BORDER | wxTB_TEXT | wxTB_NOICONS;
782  } else {
783  assert(false);
784  }
785 
786  // create a new toolbar
787  wxToolBar* toolbar = new wxToolBar(
788  parent, -1, wxDefaultPosition, wxDefaultSize, style);
789 
790  bool found = true;
791  int slot = 0;
792  wxBitmap icon;
793 
794  // Add buttons and separators for each slot, until a slot without
795  // button or separator is found.
796  while (found) {
797 
798  found = false;
799 
800  // check if a toolbar button exists for the slot
802  while (tool != NULL) {
803  if (tool->slot() == slot) {
804  // button found for the slot, add it
805  found = true;
806 
807  wxString iconPath = iconsPath;
808  iconPath.Append(WxConversion::toWxString(
810  iconPath.Append(
812  registry.commandIcon(tool->action())));
813 
814  if (!icon.LoadFile(iconPath, wxBITMAP_TYPE_PNG)) {
815  std::cerr << "Toolbar icon file "
816  << WxConversion::toString(iconPath)
817  << " not found!"
818  << std::endl;
819 
820  icon.Create(32, 32);
821  }
822 
823  toolbar->AddTool(registry.commandId(tool->action()),
825  registry.commandShortName(tool->action())),
826  icon, wxNullBitmap, wxITEM_NORMAL,
828  tool->action()),
830  tool->action()));
831  found = true;
832  // disable button if command is not executable at the moment
833  if (!registry.isEnabled(tool->action())) {
834  toolbar->EnableTool(registry.commandId(tool->action()),
835  false);
836  }
837  }
838  tool = nextToolbarButton();
839  }
840 
841 
842  // check if a separator exists for the slot
843  int separator = firstSeparator();
844  while (separator != -1) {
845  if (separator == slot) {
846  // separator found for the slot, add it
847  toolbar->AddSeparator();
848  found = true;
849  }
850  separator = nextSeparator();
851  }
852  slot++;
853  }
854 
855  toolbar->Realize();
856  return toolbar;
857 }
GUIOptions::OSNAME_SEPARATOR
static const std::string OSNAME_SEPARATOR
ObjectState name for separator.
Definition: GUIOptions.hh:151
GUIOptions::OSNAME_OPTIONS
static const std::string OSNAME_OPTIONS
ObjectState name for the options.
Definition: GUIOptions.hh:129
GUIOptions::xPosition_
int xPosition_
Default x position of left side of the application window.
Definition: GUIOptions.hh:177
GUIOptions::ksIter_
KSTable::const_iterator ksIter_
Iterator used in firstShortcut and nextShortcut functions.
Definition: GUIOptions.hh:192
GUIOptions::deleteAllKeyboardShortcuts
void deleteAllKeyboardShortcuts()
Definition: GUIOptions.cc:745
GUIOptions::modified_
bool modified_
Indicates whether the options are modified or not.
Definition: GUIOptions.hh:199
FileSystem.hh
WxConversion::toWxString
static wxString toWxString(const std::string &source)
ToolbarButton::action
std::string action() const
Definition: ToolbarButton.cc:90
CommandRegistry::isEnabled
bool isEnabled(const std::string command)
Definition: CommandRegistry.cc:210
CommandRegistry::commandShortName
std::string commandShortName(const std::string name) const
Definition: CommandRegistry.cc:191
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
KeyboardShortcut::OSNAME_KEYBOARD_SHORTCUT
static const std::string OSNAME_KEYBOARD_SHORTCUT
ObjectState name for keyboard shortcut.
Definition: KeyboardShortcut.hh:53
CommandRegistry.hh
GUIOptions::clearModified
void clearModified()
Definition: GUIOptions.cc:502
GUIOptions::setWindowSize
void setWindowSize(int width, int height)
Definition: GUIOptions.cc:229
GUIOptions::addToolbarButton
void addToolbarButton(ToolbarButton *button)
Definition: GUIOptions.cc:292
ObjectStateLoadingException
Definition: Exception.hh:551
GUIOptions::toolbarLayout_
ToolbarLayout toolbarLayout_
Layout of the toolbar.
Definition: GUIOptions.hh:183
GUIOptions::saveState
virtual ObjectState * saveState() const
Definition: GUIOptions.cc:700
GUIOptions::OSKEY_POSITION
static const std::string OSKEY_POSITION
ObjectState attribute key for separator position.
Definition: GUIOptions.hh:153
Serializable
Definition: Serializable.hh:44
GUIOptions::yPosition
int yPosition() const
Definition: GUIOptions.cc:183
SequenceTools.hh
GUIOptions::OSKEY_FULL_SCREEN
static const std::string OSKEY_FULL_SCREEN
ObjectState attribute key for full screen feature.
Definition: GUIOptions.hh:131
GUIOptions::ICON
@ ICON
Buttons contains only icon.
Definition: GUIOptions.hh:66
GUIOptions.hh
GUIOptions::deleteSeparator
void deleteSeparator(int position)
Definition: GUIOptions.cc:358
ObjectState
Definition: ObjectState.hh:59
ToolbarButton
Definition: ToolbarButton.hh:48
GUIOptions::nextSeparator
int nextSeparator() const
Definition: GUIOptions.cc:485
GUIOptions::OSKEY_TOOLBAR_VISIBILITY
static const std::string OSKEY_TOOLBAR_VISIBILITY
ObjectState attribute key for toolbar visibility.
Definition: GUIOptions.hh:141
GUIOptions::TOOLBAR_SEPARATOR
static const std::string TOOLBAR_SEPARATOR
Toolbar separator name.
Definition: GUIOptions.hh:127
GUIOptions::setToolbarVisibility
void setToolbarVisibility(bool visible)
Definition: GUIOptions.cc:256
ToolbarButton::OSNAME_TOOLBAR_BUTTON
static const std::string OSNAME_TOOLBAR_BUTTON
ObjectState name for ToolbarButton.
Definition: ToolbarButton.hh:51
Conversion::toString
static std::string toString(const T &source)
GUIOptions::deleteAllToolbarButtons
void deleteAllToolbarButtons()
Definition: GUIOptions.cc:754
GUIOptions::createToolbar
wxToolBar * createToolbar(wxWindow *parent, CommandRegistry &registry, const wxString &iconsPath)
Definition: GUIOptions.cc:768
GUICommand.hh
GUIOptions::BOTH
@ BOTH
Buttons contains text and icon.
Definition: GUIOptions.hh:67
GUIOptions::keyboardShortcut
KeyboardShortcut * keyboardShortcut(const std::string commandName) const
Definition: GUIOptions.cc:377
assert
#define assert(condition)
Definition: Application.hh:86
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
GUIOptions::ToolbarLayout
ToolbarLayout
Definition: GUIOptions.hh:64
CommandRegistry::commandIcon
std::string commandIcon(const std::string name) const
Definition: CommandRegistry.cc:155
InvalidData
Definition: Exception.hh:149
GUIOptions::OSKEY_Y_POS
static const std::string OSKEY_Y_POS
ObjectState attribute key for window y position.
Definition: GUIOptions.hh:139
GUIOptions::loadState
virtual void loadState(const ObjectState *state)
Definition: GUIOptions.cc:645
Conversion.hh
GUIOptions::toolbarLayout
ToolbarLayout toolbarLayout() const
Definition: GUIOptions.cc:205
GUIOptions::setWindowPosition
void setWindowPosition(int x, int y)
Definition: GUIOptions.cc:243
GUIOptions::fullScreen
bool fullScreen() const
Definition: GUIOptions.cc:139
GUIOptions::OSKEY_WINDOW_HEIGHT
static const std::string OSKEY_WINDOW_HEIGHT
ObjectState attribute key for window height.
Definition: GUIOptions.hh:135
GUIOptions::toolbarButtons_
TBTable toolbarButtons_
Toolbar buttons.
Definition: GUIOptions.hh:189
Application.hh
GUIOptions::firstShortcut
KeyboardShortcut * firstShortcut() const
Definition: GUIOptions.cc:397
KeyboardShortcut::equals
bool equals(const KeyboardShortcut &sc) const
Definition: KeyboardShortcut.cc:250
ObjectState.hh
CommandRegistry
Definition: CommandRegistry.hh:47
ToolbarButton::slot
int slot() const
Definition: ToolbarButton.cc:101
GUIOptions::addSeparator
void addSeparator(int position)
Definition: GUIOptions.cc:305
GUIOptions::OSVALUE_ICON
static const std::string OSVALUE_ICON
ObjectState attribute value for icon layout.
Definition: GUIOptions.hh:147
GUIOptions::OSVALUE_BOTH
static const std::string OSVALUE_BOTH
ObjectState attribute value for text & icon layout.
Definition: GUIOptions.hh:149
KeyboardShortcut::action
std::string action() const
Definition: KeyboardShortcut.cc:137
GUIOptions::isModified
bool isModified() const
Definition: GUIOptions.cc:513
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
GUIOptions::TEXT
@ TEXT
Buttons contains only text.
Definition: GUIOptions.hh:65
GUIOptions::fileName
std::string fileName() const
Definition: GUIOptions.cc:621
ObjectState::childCount
int childCount() const
GUIOptions::windowWidth
int windowWidth() const
Definition: GUIOptions.cc:150
GUIOptions::firstToolbarButton
ToolbarButton * firstToolbarButton() const
Definition: GUIOptions.cc:432
GUIOptions::tbIter_
TBTable::const_iterator tbIter_
Iterator used in firstToolbarButton and nextToolbarButton functions.
Definition: GUIOptions.hh:194
GUIOptions::setFileName
void setFileName(const std::string &fileName)
Definition: GUIOptions.cc:632
GUIOptions::OSKEY_X_POS
static const std::string OSKEY_X_POS
ObjectState attribute key for window x position.
Definition: GUIOptions.hh:137
GUIOptions::addKeyboardShortcut
void addKeyboardShortcut(KeyboardShortcut *shortcut)
Definition: GUIOptions.cc:280
GUIOptions::xPosition
int xPosition() const
Definition: GUIOptions.cc:172
ObjectState::name
std::string name() const
GUIOptions::setToolbarLayout
void setToolbarLayout(ToolbarLayout layout)
Definition: GUIOptions.cc:268
GUIOptions::~GUIOptions
virtual ~GUIOptions()
Definition: GUIOptions.cc:125
GUIOptions::validate
virtual void validate() const
Definition: GUIOptions.cc:529
CommandRegistry::commandId
int commandId(const std::string name) const
Definition: CommandRegistry.cc:137
GUIOptions::keyboardShortcuts_
KSTable keyboardShortcuts_
Keyboard shortcuts.
Definition: GUIOptions.hh:187
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
GUIOptions::windowHeight_
int windowHeight_
Default height of the window.
Definition: GUIOptions.hh:175
KeyboardShortcut
Definition: KeyboardShortcut.hh:50
GUIOptions
Definition: GUIOptions.hh:58
GUIOptions::nextToolbarButton
ToolbarButton * nextToolbarButton() const
Definition: GUIOptions.cc:449
GUIOptions::nextShortcut
KeyboardShortcut * nextShortcut() const
Definition: GUIOptions.cc:414
GUIOptions::deleteKeyboardShortcut
void deleteKeyboardShortcut(KeyboardShortcut *shortcut)
Definition: GUIOptions.cc:317
GUIOptions::OSKEY_WINDOW_WIDTH
static const std::string OSKEY_WINDOW_WIDTH
ObjectState attribute key for window width.
Definition: GUIOptions.hh:133
GUIOptions::firstSeparator
int firstSeparator() const
Definition: GUIOptions.cc:468
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
ToolbarButton::saveState
ObjectState * saveState() const
Definition: ToolbarButton.cc:135
GUIOptions::OSVALUE_TEXT
static const std::string OSVALUE_TEXT
ObjectState attribute value for text layout.
Definition: GUIOptions.hh:145
GUIOptions::hasFileName
bool hasFileName() const
Definition: GUIOptions.cc:607
GUIOptions::toolbarSeparators_
SeparatorTable toolbarSeparators_
Toolbar separators.
Definition: GUIOptions.hh:185
GUIOptions::fileName_
std::string fileName_
File name assigned to these options.
Definition: GUIOptions.hh:169
GUIOptions::fullScreen_
bool fullScreen_
If true, the application window will open in full screen mode.
Definition: GUIOptions.hh:171
GUIOptions::windowHeight
int windowHeight() const
Definition: GUIOptions.cc:161
KeyboardShortcut::saveState
ObjectState * saveState() const
Definition: KeyboardShortcut.cc:310
GUIOptions::setFullScreen
void setFullScreen(bool fullScreen)
Definition: GUIOptions.cc:216
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
WxConversion.hh
GUIOptions::separatorIter_
SeparatorTable::const_iterator separatorIter_
Iterator used in firstSeparator and nextSeparator functions.
Definition: GUIOptions.hh:196
GUIOptions::OSKEY_TOOLBAR_LAYOUT
static const std::string OSKEY_TOOLBAR_LAYOUT
ObjectState attribute key for toolbar layout.
Definition: GUIOptions.hh:143
GUIOptions::toolbarVisibility
bool toolbarVisibility() const
Definition: GUIOptions.cc:194
GUIOptions::GUIOptions
GUIOptions(std::string name)
Definition: GUIOptions.cc:68
GUIOptions::deleteToolbarButton
void deleteToolbarButton(ToolbarButton *button)
Definition: GUIOptions.cc:337
WxConversion::toString
static std::string toString(const wxString &source)
GUIOptions::yPosition_
int yPosition_
Default y position of the upper side of the application window.
Definition: GUIOptions.hh:179
GUIOptions::toolbarVisibility_
bool toolbarVisibility_
If true, the toolbar is visible.
Definition: GUIOptions.hh:181
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
GUIOptions::windowWidth_
int windowWidth_
Default width of the window.
Definition: GUIOptions.hh:173