13#pragma implementation "OptionsDialog.cpp"
23#define ELEMENT_BORDER 5
25#include "../../common/CommonHeaders.h"
26#include "../../common/Options.h"
27#include "../../kernel/core/ui/language.hpp"
29#include <wx/checklst.h>
30#include <wx/valtext.h>
35#include "../NumeReWindow.h"
37#include "../compositions/grouppanel.hpp"
90 Create(parent,
id, caption, pos, size, style);
107bool OptionsDialog::Create(wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style)
109 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
110 wxDialog::Create(parent,
id, caption, pos, size, style);
115 GetSizer()->SetSizeHints(
this);
133 wxBoxSizer* optionVSizer =
new wxBoxSizer(wxVERTICAL);
134 this->SetSizer(optionVSizer);
172 wxBoxSizer* optionButtonSizer =
new wxBoxSizer(wxHORIZONTAL);
173 optionVSizer->Add(optionButtonSizer, 0, wxALIGN_RIGHT | wxALL, 0);
175 wxButton* okButton =
new wxButton(
this,
ID_BUTTON_OK,
_guilang.
get(
"GUI_OPTIONS_OK"), wxDefaultPosition, wxDefaultSize, 0);
176 optionButtonSizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
ELEMENT_BORDER);
178 wxButton* cancelButton =
new wxButton(
this,
ID_BUTTON_CANCEL,
_guilang.
get(
"GUI_OPTIONS_CANCEL"), wxDefaultPosition, wxDefaultSize, 0);
179 optionButtonSizer->Add(cancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL,
ELEMENT_BORDER);
219 panel->SetScrollbars(0, 20, 0, 200);
287 panel->SetScrollbars(0, 20, 0, 200);
309 wxFlexGridSizer* colorGroupSizer =
new wxFlexGridSizer(2, 0, 5);
310 wxBoxSizer* colorGroupHSizer =
new wxBoxSizer(wxHORIZONTAL);
313 m_colorType =
new wxComboBox( group->GetStaticBox(),
ID_CLRSPIN, styles[0], wxDefaultPosition, wxDefaultSize, styles, wxCB_READONLY );
330 colorGroupSizer->Add(colorGroupHSizer, 1, wxALIGN_CENTER_VERTICAL | wxALL,
ELEMENT_BORDER);
336 wxBoxSizer* fontStyleSize =
new wxBoxSizer(wxHORIZONTAL);
338 fontStyleSize->Add(
m_boldCheck, 1, wxALIGN_LEFT | wxALL, 0);
342 group->Add(fontStyleSize, 0, wxALIGN_LEFT | wxALL,
ELEMENT_BORDER);
348 wxBoxSizer* fontSizer =
new wxBoxSizer(wxVERTICAL);
349 wxBoxSizer* plotFontSizer =
new wxBoxSizer(wxVERTICAL);
351 wxStaticText* editorFontStaticText =
new wxStaticText(group->GetStaticBox(), wxID_STATIC,
_guilang.
get(
"GUI_OPTIONS_EDITORFONT"), wxDefaultPosition, wxDefaultSize, 0);
352 fontSizer->Add(editorFontStaticText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 0);
354 font.SetNativeFontInfoUserDesc(
"Consolas 10");
355 m_fontPicker =
new wxFontPickerCtrl(group->GetStaticBox(), wxID_ANY, font, wxDefaultPosition, wxSize(200,-1), wxFNTP_DEFAULT_STYLE);
356 fontSizer->Add(
m_fontPicker, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT| wxBOTTOM, 0);
358 wxStaticText* terminalFontStaticText =
new wxStaticText(group->GetStaticBox(), wxID_STATIC,
_guilang.
get(
"GUI_OPTIONS_TERMINALFONT"), wxDefaultPosition, wxDefaultSize, 0);
359 fontSizer->Add(terminalFontStaticText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 0);
360 font.SetNativeFontInfoUserDesc(
"Consolas 8");
361 m_fontPickerTerminal =
new wxFontPickerCtrl(group->GetStaticBox(), wxID_ANY, font, wxDefaultPosition, wxSize(200,-1), wxFNTP_DEFAULT_STYLE);
364 wxStaticText* historyFontStaticText =
new wxStaticText(group->GetStaticBox(), wxID_STATIC,
_guilang.
get(
"GUI_OPTIONS_HISTORYFONT"), wxDefaultPosition, wxDefaultSize, 0);
365 fontSizer->Add(historyFontStaticText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 0);
366 m_fontPickerHistory =
new wxFontPickerCtrl(group->GetStaticBox(), wxID_ANY, font, wxDefaultPosition, wxSize(200,-1), wxFNTP_DEFAULT_STYLE);
370 wxStaticText* defaultFontStaticText =
new wxStaticText(group->GetStaticBox(), wxID_STATIC, _(
_guilang.
get(
"GUI_OPTIONS_DEFAULTFONT")), wxDefaultPosition, wxDefaultSize, 0);
371 plotFontSizer->Add(defaultFontStaticText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 0);
373 wxArrayString defaultFont;
374 defaultFont.Add(
"pagella");
375 defaultFont.Add(
"adventor");
376 defaultFont.Add(
"bonum");
377 defaultFont.Add(
"chorus");
378 defaultFont.Add(
"heros");
379 defaultFont.Add(
"heroscn");
380 defaultFont.Add(
"schola");
381 defaultFont.Add(
"termes");
383 m_defaultFont =
new wxComboBox(group->GetStaticBox(),
ID_PRINTSTYLE,
"pagella", wxDefaultPosition, wxSize(200,-1), defaultFont, wxCB_READONLY );
385 plotFontSizer->Add(
m_defaultFont, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 0);
388 group->Add(plotFontSizer, 0, wxALIGN_LEFT | wxALL,
ELEMENT_BORDER);
410 wxStaticText* printingStaticText =
new wxStaticText( group->GetStaticBox(), wxID_STATIC,
_guilang.
get(
"GUI_OPTIONS_PRINT"), wxDefaultPosition, wxDefaultSize, 0 );
411 group->Add(printingStaticText, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
ELEMENT_BORDER);
413 wxArrayString m_printStyleStrings;
414 m_printStyleStrings.Add(
_guilang.
get(
"GUI_OPTIONS_PRINT_BW"));
415 m_printStyleStrings.Add(
_guilang.
get(
"GUI_OPTIONS_PRINT_COLOR"));
417 m_printStyle =
new wxComboBox( group->GetStaticBox(),
ID_PRINTSTYLE,
_guilang.
get(
"GUI_OPTIONS_PRINT_BW"), wxDefaultPosition, wxDefaultSize, m_printStyleStrings, wxCB_READONLY );
445 panel->SetScrollbars(0, 20, 0, 200);
503 panel->SetScrollbars(0, 20, 0, 200);
581 EndModal(wxID_CANCEL);
655 wxString defaultpath;
657 switch (event.GetId())
702 wxDirDialog dialog(
this,
_guilang.
get(
"GUI_OPTIONS_CHOOSEPATH"), defaultpath);
703 int ret = dialog.ShowModal();
708 switch (event.GetId())
745 switch (event.GetId())
846 wxString selectedPrintStyleString =
m_printStyle->GetValue();
848 if (selectedPrintStyleString ==
_guilang.
get(
"GUI_OPTIONS_PRINT_COLOR"))
881 wxString printStyleString;
884 printStyleString =
_guilang.
get(
"GUI_OPTIONS_PRINT_COLOR");
886 printStyleString =
_guilang.
get(
"GUI_OPTIONS_PRINT_BW");
#define wxSTC_PRINT_BLACKONWHITE
#define wxSTC_PRINT_COLOURONWHITE
std::string replacePathSeparator(const std::string &)
This function replaces the Windows style path sparators to UNIX style.
#define ID_BTN_SCRIPTPATH
#define ID_DEFAULTBACKGROUND
This class simplifies the creation of simple windows and creates a common layout among all windows.
SpinBut * CreateSpinControl(wxWindow *parent, wxSizer *sizer, const wxString &description, int nMin, int nMax, int nInitial, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a spin control including the assigned text.
wxTextCtrl * CreatePathInput(wxWindow *parent, wxSizer *sizer, const wxString &description, int buttonID, int id=wxID_ANY)
This member function creates the layout for a path input dialog including the "choose" button.
wxCheckBox * CreateCheckBox(wxWindow *parent, wxSizer *sizer, const wxString &description, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a usual checkbox.
wxStaticBoxSizer * createGroup(const wxString &sGroupName, int orient=wxVERTICAL, wxWindow *parent=nullptr, wxSizer *sizer=nullptr, int expand=0)
Member function to create a group (a static box with a label) in the panel.
wxBoxSizer * getVerticalSizer()
Return the pointer to the vertical sizer.
This class handles the internal language system and returns the language strings of the selected lang...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class is the actual NumeRe main frame. The application's logic is implemented here.
This class represents the settings dialog in memory.
wxCheckBox * m_UseLogfile
wxCheckBox * m_debuggerShowGlobals
wxCheckBox * m_saveSession
wxCheckBox * m_debuggerShowModules
wxCheckBox * m_italicsCheck
wxCheckBox * m_homeEndCancels
wxComboBox * m_defaultFont
wxCheckBox * m_saveBeforeExecuting
void OnButtonClick(wxCommandEvent &event)
Button event handler for all other buttons.
wxCheckBox * m_alwaysReferenceTables
wxCheckBox * m_useMaskAsDefault
wxCheckBox * m_saveBookmarksInSession
void CreatePathPage()
This private member function creates the "paths" page.
wxCheckBox * m_smartSense
wxCheckBox * m_underlineCheck
void CreateAnalyzerPage()
This private member function creates the "Static analyzer" page.
void OnFontCheckClick(wxCommandEvent &event)
Event handler for the font style check boxes.
wxCheckBox * m_lineLengthIndicator
void CreateStylePage()
This private member function creates the "style" page.
wxNotebook * m_optionsNotebook
wxSpinCtrl * m_debuggerFocusLine
wxFontPickerCtrl * m_fontPickerTerminal
wxCheckBox * m_formatBeforeSaving
void CreateControls()
Creates the controls and sizers.
wxCheckBox * m_keepBackupFiles
wxCheckBox * m_saveSashPositions
wxSpinCtrl * m_autosaveinterval
void OnColorPickerChange(wxColourPickerEvent &event)
Event handler for changing the colours.
wxCheckBox * m_saveWindowPosition
void OnColorTypeChange(wxCommandEvent &event)
Event handler for switching the syntax elements for selecting the styling.
wxCheckBox * m_CustomLanguage
wxCheckBox * m_foldDuringLoading
wxCheckBox * m_blockAutoComp
wxColourPickerCtrl * m_foreColor
wxSpinCtrl * m_caretBlinkTime
wxFontPickerCtrl * m_fontPicker
bool Create(wxWindow *parent, wxWindowID id=-1, const wxString &caption=_("Options"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU)
Creation.
wxCheckBox * m_analyzer[Options::ANALYZER_OPTIONS_END]
wxCheckBox * m_defaultBackground
wxCheckBox * m_showGreeting
wxCheckBox * m_highlightLocalVariables
static bool ShowToolTips()
Should we show tooltips?
wxSpinCtrl * m_termHistory
wxColourPickerCtrl * m_backColor
void synchronizeColors()
Copies the selected syntax styles to the Options class.
void CreateDebuggerPage()
This private member function creates the "debugger" page.
wxCheckBox * m_compactTables
wxComboBox * m_printStyle
wxCheckBox * m_showToolbarText
wxCheckBox * m_ESCinScripts
void CreateConfigPage()
This private member function creates the "configuration" page.
wxCheckBox * m_quoteAutoComp
void CreateMiscPage()
This private member function creates the "misc" page.
wxCheckBox * m_useExecuteCommand
wxCheckBox * m_LoadCompactTables
wxCheckBox * m_debuggerDecodeArguments
void CreateEditorPage()
This private member function creates the "editor" page.
wxCheckBox * m_debuggerFlashTaskbar
wxCheckBox * m_AutoLoadDefines
wxCheckBox * m_ExtendedInfo
wxCheckBox * m_braceAutoComp
wxFontPickerCtrl * m_fontPickerHistory
wxTextCtrl * m_ScriptPath
wxCheckBox * m_debuggerShowLineNumbers
wxCheckBox * m_FilePathsInTabs
void OnButtonCancelClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CANCEL
wxCheckBox * m_IconsOnTabs
wxCheckBox * m_debuggerShowProcedureArguments
wxCheckBox * m_cbPrintLineNumbers
void OnButtonOkClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_OK
This class implements an interface of the internal Settings object adapted to be usable from the GUI.
static wxFont toFont(const std::string &sFontDescr)
void SetSyntaxStyle(size_t i, const SyntaxStyles &styles)
Update a selected syntax style by converting the passed SyntaxStyles object into a style string and s...
size_t GetIdByIdentifier(const wxString &identifier) const
This member function returns the ID of a syntax style by passing the style identifier as a string.
int GetPrintStyle() const
int GetAnalyzerOption(AnalyzerOptions opt) const
Return the value of the selected static code analyzer option.
AnalyzerOptions
An enumeration of all available static analyzer options.
SyntaxStyles GetSyntaxStyle(size_t i) const
Return the selected syntax style by constructing it from the style string.
SyntaxStyles GetDefaultSyntaxStyle(size_t i) const
Return the default syntax style as defined by the programmers.
void SetPrintStyle(int style)
wxArrayString GetStyleIdentifier() const
This member function returns an array of the style enumeration identifiers converted to a string.
void SetAnalyzerOption(AnalyzerOptions opt, int nVal)
Change a static code analyzer setting.
static std::string toString(wxFont font)
std::map< std::string, SettingsValue > & getSettings()
Returns a reference to the internal map of setting values.
#define SETTING_B_SMARTSENSE
#define SETTING_B_TOOLBARTEXT
#define SETTING_B_SAVEBOOKMARKS
#define SETTING_B_ICONSONTABS
#define SETTING_B_USEREVISIONS
#define SETTING_V_PRECISION
#define SETTING_B_GREETING
#define SETTING_B_QUOTEAUTOCOMP
#define SETTING_B_BLOCKAUTOCOMP
#define SETTING_B_MASKDEFAULT
#define SETTING_S_PLOTFONT
#define SETTING_B_FORMATBEFORESAVING
#define SETTING_S_EDITORFONT
#define SETTING_S_LATEXROOT
#define SETTING_V_AUTOSAVE
#define SETTING_B_TABLEREFS
#define SETTING_V_FOCUSEDLINE
#define SETTING_S_PROCPATH
#define SETTING_B_COMPACT
#define SETTING_B_LINELENGTH
#define SETTING_B_SAVESASHS
#define SETTING_B_LOADEMPTYCOLS
#define SETTING_B_USECUSTOMLANG
#define SETTING_S_LOADPATH
#define SETTING_B_PROCEDUREARGS
#define SETTING_B_PATHSONTABS
#define SETTING_B_HIGHLIGHTLOCALS
#define SETTING_B_USETABS
#define SETTING_S_HISTORYFONT
#define SETTING_B_EXTENDEDFILEINFO
#define SETTING_B_SAVEWINDOWSIZE
#define SETTING_B_USEESCINSCRIPTS
#define SETTING_B_LINESINSTACK
#define SETTING_B_AUTOSAVEEXECUTION
#define SETTING_V_BUFFERSIZE
#define SETTING_B_DECODEARGUMENTS
#define SETTING_S_SAVEPATH
#define SETTING_B_FLASHTASKBAR
#define SETTING_S_TERMINALFONT
#define SETTING_B_HOMEENDCANCELS
#define SETTING_B_ENABLEEXECUTE
#define SETTING_B_GLOBALVARS
#define SETTING_B_DEFCONTROL
#define SETTING_B_MODULESINSTACK
#define SETTING_B_SAVESESSION
#define SETTING_S_PLOTPATH
#define SETTING_B_FOLDLOADEDFILE
#define SETTING_B_SHOWHINTS
#define SETTING_S_SCRIPTPATH
#define SETTING_B_PRINTLINENUMBERS
#define SETTING_V_CARETBLINKTIME
#define SETTING_B_LOGFILE
#define SETTING_B_BRACEAUTOCOMP
This structure contains the necessary data to completely define a style for a distinctive syntax elem...