-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tab width; view whitespaces, line numbers, end of line
- Loading branch information
Showing
8 changed files
with
226 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "globalsettings.h" | ||
|
||
GlobalSettingsDialog::GlobalSettingsDialog(wxWindow* parent, FloEditor* editor):wxDialog(parent, wxID_ANY, wxT("Global settings")),mEditor(editor) | ||
{ | ||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); | ||
mNotebook = new wxNotebook(this, wxID_ANY); | ||
sizer->Add(mNotebook, 1, wxEXPAND); | ||
addGeneralPage(); | ||
wxBoxSizer* subsizer = new wxBoxSizer(wxHORIZONTAL); | ||
sizer->Add(subsizer, 0, wxALL | wxALIGN_CENTER_HORIZONTAL); | ||
subsizer->Add(new wxButton(this, wxID_OK, wxT("OK"))); | ||
subsizer->Add(new wxButton(this, wxID_CANCEL, wxT("Cancel"))); | ||
subsizer->Add(new wxButton(this, wxID_APPLY, wxT("Apply"))); | ||
this->SetSizerAndFit(sizer); | ||
SetSize(500, 400); | ||
Connect(wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&GlobalSettingsDialog::onButtonClick); | ||
} | ||
|
||
GlobalSettingsDialog::~GlobalSettingsDialog() | ||
{ | ||
} | ||
|
||
void GlobalSettingsDialog::addGeneralPage() { | ||
wxPanel* panel = new wxPanel(mNotebook); | ||
wxFlexGridSizer* sizer = new wxFlexGridSizer(2); | ||
|
||
sizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Tab width:")), 1, wxALIGN_CENTER_VERTICAL | wxALL); | ||
mTabWidthCtrl = new wxTextCtrl(panel, wxID_ANY); | ||
mTabWidthCtrl->SetValue(mEditor->getDb()->getSettingString(wxT("scintilla.tabwidth"))); | ||
sizer->Add(mTabWidthCtrl); | ||
|
||
|
||
sizer->AddGrowableCol(0); | ||
sizer->AddGrowableCol(1); | ||
panel->SetSizerAndFit(sizer); | ||
mNotebook->AddPage(panel, wxT("General")); | ||
} | ||
|
||
void GlobalSettingsDialog::apply() { | ||
wxString pageLabel = mNotebook->GetPageText(mNotebook->GetSelection()); | ||
SharedPtr<DbConnector> db = mEditor->getDb(); | ||
if(pageLabel == wxT("General")) { | ||
db->updateSettings(wxT("scintilla.tabwidth"), mTabWidthCtrl->GetValue()); | ||
long l; | ||
mTabWidthCtrl->GetValue().ToLong(&l); | ||
mEditor->setTabWidth(l); | ||
} | ||
} | ||
|
||
void GlobalSettingsDialog::onButtonClick(wxCommandEvent& event) | ||
{ | ||
if(event.GetId() == wxID_APPLY) { | ||
apply(); | ||
} | ||
else if(event.GetId() == wxID_OK) { | ||
apply(); | ||
Destroy(); | ||
} | ||
else if(event.GetId() == wxID_CANCEL) { | ||
Destroy(); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef GLOBALSETTINGS_H | ||
#define GLOBALSETTINGS_H | ||
|
||
#include <wx/wx.h> | ||
#include <wx/notebook.h> | ||
#include "editor.h" | ||
|
||
class FloEditor; | ||
|
||
class GlobalSettingsDialog : public wxDialog { | ||
wxNotebook* mNotebook; | ||
wxTextCtrl* mTabWidthCtrl; | ||
FloEditor* mEditor; | ||
void addGeneralPage(); | ||
void onButtonClick(wxCommandEvent& event); | ||
void apply(); | ||
public: | ||
GlobalSettingsDialog(wxWindow* parent, FloEditor* editor); | ||
~GlobalSettingsDialog(); | ||
}; | ||
|
||
#endif // GLOBALSETTINGS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters