OpenASIP
2.0
|
#include <OptionsDialog.hh>
Classes | |
struct | Shortcut |
Public Member Functions | |
OptionsDialog (wxWindow *parent, GUIOptions &options, CommandRegistry &commandRegisry) | |
virtual | ~OptionsDialog () |
Protected Member Functions | |
void | addPage (wxPanel *page, const wxString &title) |
virtual void | readOptions () |
virtual void | writeOptions () |
Protected Attributes | |
wxNotebook * | notebook_ |
Notebook containing dialog pages. More... | |
Private Types | |
enum | { ID_NOTEBOOK = 10000, ID_HELP, ID_BROWSE, ID_KB_SC_LIST, ID_EDIT_KB_SC, ID_DELETE_KB_SC, ID_TOOLBAR_LIST, ID_TOOL_DOWN, ID_TOOL_UP, ID_TOOL_INSERT, ID_TOOL_REMOVE, ID_COMMAND_LIST, ID_TOOLBAR_CONTENTS, ID_TEXT, ID_LABEL_TOOLBAR_CONTENTS } |
Private Member Functions | |
virtual wxSizer * | createContents (wxWindow *parent, bool callFit, bool set_sizer) |
void | readCommands () |
void | initialize () |
void | onShortcutSelection (wxListEvent &event) |
void | onToolbarSelection (wxListEvent &event) |
void | onCommandSelection (wxListEvent &event) |
void | onDeleteShortcut (wxCommandEvent &event) |
void | onActivateShortcut (wxListEvent &event) |
void | onEditShortcut (wxCommandEvent &event) |
void | onShortcutRightClick (wxListEvent &event) |
void | onInsertTool (wxCommandEvent &event) |
void | onRemoveTool (wxCommandEvent &event) |
void | onMoveTool (wxCommandEvent &event) |
void | onOK (wxCommandEvent &event) |
void | onHelp (wxCommandEvent &event) |
void | setTexts () |
virtual bool | TransferDataToWindow () |
wxSizer * | createKBShortcutPage (wxWindow *parent, bool callFit, bool set_sizer) |
wxSizer * | createToolbarPage (wxWindow *parent, bool callFit, bool set_sizer) |
Shortcut * | selectedShortcut () |
Private Attributes | |
wxWindow * | parent_ |
parent window of the dialog More... | |
GUIOptions & | options_ |
current editor options More... | |
wxListCtrl * | shortcutList_ |
Keyboard shortcut list control. More... | |
wxListCtrl * | toolbarList_ |
Toolbar buttons list control. More... | |
wxListCtrl * | commandList_ |
List control for commands not in the toolbar. More... | |
int | choice_ |
std::vector< Shortcut * > | shortcuts_ |
Keyboard shortcuts. More... | |
std::vector< std::string > | toolbar_ |
Toolbar buttons and separators. More... | |
CommandRegistry & | commandRegistry_ |
Command registry containing available commands for shortcuts. More... | |
Static Private Attributes | |
static const wxString | COMMAND_COLUMN_TITLE = _T("Command") |
Title of the keyboard shortcut list command name column. More... | |
static const wxString | SHORTCUT_COLUMN_TITLE = _T("Shortcut") |
Title of the keyboard shortcut list shortcut column. More... | |
static const wxString | TOOLBAR_BUTTONS_COLUMN_TITLE = _T("Toolbar") |
Title of the toolbar tab toolbar button list. More... | |
static const wxString | AVAILABLE_COMMANDS_COLUMN_TITLE = _T("Commands") |
Title of the toolbar tab available commands list. More... | |
static const wxString | CONTENTS_ICONS = _T("Icons") |
Text fot the toolbar contents choicer icon-mode item. More... | |
static const wxString | CONTENTS_BOTH = _T("Both") |
Text for the toolbar contents choicer icon&text mode item. More... | |
static const wxString | CONTENTS_TEXT = _T("Text") |
Text for the toolbar contents choicer text-mode item. More... | |
static const wxString | EDIT_BUTTON_LABEL = _T("Edit...") |
Label for Edit-button. More... | |
static const wxString | DELETE_BUTTON_LABEL = _T("Delete") |
Label for delete-button. More... | |
Dialog for editing GUIOptions.
This class allows modification of options in the GUIOptions class. If an application uses custom options class derived from the GUIOptions class, this class can be used as a base class for the application specific options dialog. To customize the derived dialog, override readOptions and writeOptions. Controls for modifying the application specific options can be added by creating a wxPanel containing the controls, and adding it to the dialog as a tab using the addPage method.
Definition at line 60 of file OptionsDialog.hh.
|
private |
Definition at line 141 of file OptionsDialog.hh.
OptionsDialog::OptionsDialog | ( | wxWindow * | parent, |
GUIOptions & | options, | ||
CommandRegistry & | commandRegistry | ||
) |
The Constructor.
parent | Parent window of the dialog. |
options | Options to be modified. |
commandRegistry | Command registry containing available commands. |
Definition at line 118 of file OptionsDialog.cc.
|
virtual |
|
protected |
Adds a new tab to the options dialog.
This function can be used to add tabs for modifying application specific options.
page | Tab to add. |
title | Title of the tab. |
Definition at line 756 of file OptionsDialog.cc.
References notebook_.
|
privatevirtual |
Creates the dialog contents.
This function was initially generated by wxDesigner.
parent | The dialog window. |
call_fit | If true, fits the contents inside the dialog. |
set_sizer | If true, sets the main sizer as dialog contents. |
Definition at line 772 of file OptionsDialog.cc.
References createKBShortcutPage(), createToolbarPage(), ID_HELP, and ID_NOTEBOOK.
Referenced by initialize().
|
private |
Creates the 'Keyboard Shotcut' page for the dialog.
This function was initially generated by wxDesigner.
parent | The dialog window. |
call_fit | If true, fits the contents inside the dialog. |
set_sizer | If true, sets the main sizer as dialog contents. |
Definition at line 836 of file OptionsDialog.cc.
References ID_DELETE_KB_SC, ID_EDIT_KB_SC, and ID_KB_SC_LIST.
Referenced by createContents().
|
private |
Creates the 'Toolbar' page for the dialog.
This function was generated by wxDesigner.
parent | The dialog window. |
call_fit | If true, fits the contents inside the dialog. |
set_sizer | If true, sets the main sizer as dialog contents. |
Definition at line 877 of file OptionsDialog.cc.
References ID_COMMAND_LIST, ID_LABEL_TOOLBAR_CONTENTS, ID_TOOL_DOWN, ID_TOOL_INSERT, ID_TOOL_REMOVE, ID_TOOL_UP, ID_TOOLBAR_CONTENTS, and ID_TOOLBAR_LIST.
Referenced by createContents().
|
private |
Initializes the dialog widgets.
Definition at line 156 of file OptionsDialog.cc.
References AVAILABLE_COMMANDS_COLUMN_TITLE, COMMAND_COLUMN_TITLE, commandList_, CONTENTS_BOTH, CONTENTS_ICONS, CONTENTS_TEXT, createContents(), ID_COMMAND_LIST, ID_DELETE_KB_SC, ID_EDIT_KB_SC, ID_KB_SC_LIST, ID_TOOL_DOWN, ID_TOOL_INSERT, ID_TOOL_REMOVE, ID_TOOL_UP, ID_TOOLBAR_CONTENTS, ID_TOOLBAR_LIST, SHORTCUT_COLUMN_TITLE, shortcutList_, TOOLBAR_BUTTONS_COLUMN_TITLE, and toolbarList_.
|
private |
Handles left mouse button double click on the shortcut list.
Definition at line 474 of file OptionsDialog.cc.
References dummy, and onEditShortcut().
|
private |
Disables and enables 'Insert' button in the 'Toolbar' page
If a command is selected, button is enabled. If no command is selected the button is disabled.
event | ListEvent, which may have changed the selection. |
Definition at line 706 of file OptionsDialog.cc.
References commandList_, and ID_TOOL_INSERT.
|
private |
Removes keyboard shortcut for the selected command.
Definition at line 454 of file OptionsDialog.cc.
References assert, shortcutList_, shortcuts_, and TransferDataToWindow().
|
private |
Prompts for a new keyboard shortcut for the selected command with ShortcutDialog.
Definition at line 502 of file OptionsDialog.cc.
References OptionsDialog::Shortcut::name, selectedShortcut(), OptionsDialog::Shortcut::shortcut, shortcuts_, and TransferDataToWindow().
Referenced by onActivateShortcut().
|
private |
Opens the help for the dialog from the user manual.
Definition at line 742 of file OptionsDialog.cc.
|
private |
Adds a toolbar button for the command selected in the command list.
Definition at line 548 of file OptionsDialog.cc.
References commandList_, toolbar_, WxConversion::toString(), and TransferDataToWindow().
|
private |
Moves selected tool up or down in the toolbar button list.
Definition at line 585 of file OptionsDialog.cc.
References assert, ID_TOOL_DOWN, ID_TOOL_UP, toolbar_, toolbarList_, and TransferDataToWindow().
|
private |
Validates input in the controls, and updates the options.
Definition at line 722 of file OptionsDialog.cc.
References writeOptions().
|
private |
Removes the selected toolbar button from the toolbar button list.
Definition at line 566 of file OptionsDialog.cc.
References assert, toolbar_, toolbarList_, and TransferDataToWindow().
|
private |
Opens a pop-up menu when right mouse button was pressed.
event | Information about right mouse click event. |
Definition at line 661 of file OptionsDialog.cc.
References DELETE_BUTTON_LABEL, EDIT_BUTTON_LABEL, ID_DELETE_KB_SC, ID_EDIT_KB_SC, and shortcutList_.
|
private |
Disables and enables Edit and Delete buttons under the keyboard shortcut.
If a shortcut is selected, buttons are enabled. If no shortcut is selected the buttons are disabled.
event | ListEvent, which may have changed the selection. |
Definition at line 643 of file OptionsDialog.cc.
References ID_DELETE_KB_SC, ID_EDIT_KB_SC, and shortcutList_.
|
private |
Disables and enables Up, Down and Remove buttons in the 'Toolbar' page.
If a toolbar item is selected, buttons are enabled. If no item is selected the buttons are disabled.
event | ListEvent, which may have changed the selection. |
Definition at line 683 of file OptionsDialog.cc.
References ID_TOOL_DOWN, ID_TOOL_REMOVE, ID_TOOL_UP, and toolbarList_.
|
private |
Adds available commands to the keyboard shortcut list and toolbar tool list.
Reads commands fromt the command registry.
Definition at line 351 of file OptionsDialog.cc.
References commandRegistry_, CommandRegistry::firstCommand(), GUICommand::id(), OptionsDialog::Shortcut::id, GUICommand::name(), OptionsDialog::Shortcut::name, CommandRegistry::nextCommand(), OptionsDialog::Shortcut::shortcut, and shortcuts_.
|
protectedvirtual |
Reads the options in options_ to dialog attributes.
Definition at line 208 of file OptionsDialog.cc.
References ToolbarButton::action(), KeyboardShortcut::action(), assert, GUIOptions::BOTH, CONTENTS_BOTH, CONTENTS_ICONS, CONTENTS_TEXT, GUIOptions::firstSeparator(), GUIOptions::firstShortcut(), GUIOptions::firstToolbarButton(), GUIOptions::ICON, ID_TOOLBAR_CONTENTS, GUIOptions::nextSeparator(), GUIOptions::nextShortcut(), GUIOptions::nextToolbarButton(), options_, OptionsDialog::Shortcut::shortcut, shortcuts_, ToolbarButton::slot(), GUIOptions::TEXT, toolbar_, GUIOptions::TOOLBAR_SEPARATOR, GUIOptions::toolbarLayout(), and WxConversion::toWxString().
|
private |
Returns pointer to the shortcut selected in the shortcut list.
Definition at line 486 of file OptionsDialog.cc.
References shortcutList_, and shortcuts_.
Referenced by onEditShortcut().
|
private |
|
privatevirtual |
Transfers data from dialog attributes to controls in the dialog.
Definition at line 370 of file OptionsDialog.cc.
References commandList_, shortcutList_, shortcuts_, toolbar_, GUIOptions::TOOLBAR_SEPARATOR, toolbarList_, Conversion::toString(), and WxConversion::toWxString().
Referenced by onDeleteShortcut(), onEditShortcut(), onInsertTool(), onMoveTool(), and onRemoveTool().
|
protectedvirtual |
Writes the options from dialog attributes to the current options object.
Definition at line 286 of file OptionsDialog.cc.
References GUIOptions::addKeyboardShortcut(), GUIOptions::addSeparator(), GUIOptions::addToolbarButton(), assert, GUIOptions::BOTH, CONTENTS_BOTH, CONTENTS_ICONS, CONTENTS_TEXT, GUIOptions::deleteKeyboardShortcut(), GUIOptions::deleteSeparator(), GUIOptions::deleteToolbarButton(), GUIOptions::firstSeparator(), GUIOptions::firstShortcut(), GUIOptions::firstToolbarButton(), GUIOptions::ICON, ID_TOOLBAR_CONTENTS, options_, GUIOptions::setToolbarLayout(), shortcuts_, GUIOptions::TEXT, toolbar_, and GUIOptions::TOOLBAR_SEPARATOR.
Referenced by ProDeOptionsDialog::onOK(), and onOK().
|
staticprivate |
Title of the toolbar tab available commands list.
Definition at line 166 of file OptionsDialog.hh.
Referenced by initialize().
|
private |
Definition at line 130 of file OptionsDialog.hh.
|
staticprivate |
Title of the keyboard shortcut list command name column.
Definition at line 160 of file OptionsDialog.hh.
Referenced by initialize().
|
private |
List control for commands not in the toolbar.
Definition at line 128 of file OptionsDialog.hh.
Referenced by initialize(), onCommandSelection(), onInsertTool(), and TransferDataToWindow().
|
private |
Command registry containing available commands for shortcuts.
Definition at line 138 of file OptionsDialog.hh.
Referenced by readCommands().
|
staticprivate |
Text for the toolbar contents choicer icon&text mode item.
Definition at line 170 of file OptionsDialog.hh.
Referenced by initialize(), readOptions(), and writeOptions().
|
staticprivate |
Text fot the toolbar contents choicer icon-mode item.
Definition at line 168 of file OptionsDialog.hh.
Referenced by initialize(), readOptions(), and writeOptions().
|
staticprivate |
Text for the toolbar contents choicer text-mode item.
Definition at line 172 of file OptionsDialog.hh.
Referenced by initialize(), readOptions(), and writeOptions().
|
staticprivate |
Label for delete-button.
Definition at line 177 of file OptionsDialog.hh.
Referenced by onShortcutRightClick().
|
staticprivate |
Label for Edit-button.
Definition at line 175 of file OptionsDialog.hh.
Referenced by onShortcutRightClick().
|
protected |
Notebook containing dialog pages.
Definition at line 75 of file OptionsDialog.hh.
Referenced by addPage().
|
private |
current editor options
Definition at line 122 of file OptionsDialog.hh.
Referenced by readOptions(), and writeOptions().
|
private |
parent window of the dialog
Definition at line 120 of file OptionsDialog.hh.
|
staticprivate |
Title of the keyboard shortcut list shortcut column.
Definition at line 162 of file OptionsDialog.hh.
Referenced by initialize().
|
private |
Keyboard shortcut list control.
Definition at line 124 of file OptionsDialog.hh.
Referenced by initialize(), onDeleteShortcut(), onShortcutRightClick(), onShortcutSelection(), selectedShortcut(), and TransferDataToWindow().
|
private |
Keyboard shortcuts.
Definition at line 133 of file OptionsDialog.hh.
Referenced by onDeleteShortcut(), onEditShortcut(), readCommands(), readOptions(), selectedShortcut(), TransferDataToWindow(), writeOptions(), and ~OptionsDialog().
|
private |
Toolbar buttons and separators.
Definition at line 135 of file OptionsDialog.hh.
Referenced by onInsertTool(), onMoveTool(), onRemoveTool(), readOptions(), TransferDataToWindow(), and writeOptions().
|
staticprivate |
Title of the toolbar tab toolbar button list.
Definition at line 164 of file OptionsDialog.hh.
Referenced by initialize().
|
private |
Toolbar buttons list control.
Definition at line 126 of file OptionsDialog.hh.
Referenced by initialize(), onMoveTool(), onRemoveTool(), onToolbarSelection(), and TransferDataToWindow().