forked from eranif/codelite
-
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.
Editor config plugin: added UI + the possibility to enable/disable it
- Loading branch information
Showing
12 changed files
with
707 additions
and
4 deletions.
There are no files selected for viewing
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,21 @@ | ||
#include "EditorConfigSettings.h" | ||
#include "cl_config.h" | ||
|
||
EditorConfigSettings::EditorConfigSettings() | ||
: m_flags(kEnabled) | ||
{ | ||
} | ||
|
||
EditorConfigSettings::~EditorConfigSettings() {} | ||
|
||
EditorConfigSettings& EditorConfigSettings::Load() | ||
{ | ||
m_flags = clConfig::Get().Read("EditorConfig/Flags", m_flags); | ||
return *this; | ||
} | ||
|
||
EditorConfigSettings& EditorConfigSettings::Save() | ||
{ | ||
clConfig::Get().Write("EditorConfig/Flags", m_flags); | ||
return *this; | ||
} |
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,36 @@ | ||
#ifndef EDITORCONFIGSETTINGS_H | ||
#define EDITORCONFIGSETTINGS_H | ||
|
||
#include <wx/string.h> | ||
|
||
class EditorConfigSettings | ||
{ | ||
int m_flags; | ||
|
||
enum eFlags { | ||
kEnabled = (1 << 0), | ||
}; | ||
|
||
private: | ||
void SetFlag(EditorConfigSettings::eFlags flag, bool b) | ||
{ | ||
if(b) { | ||
m_flags |= flag; | ||
|
||
} else { | ||
m_flags &= flag; | ||
} | ||
} | ||
|
||
public: | ||
EditorConfigSettings(); | ||
virtual ~EditorConfigSettings(); | ||
|
||
bool IsEnabled() const { return m_flags & kEnabled; } | ||
void SetEnabled(bool b) { SetFlag(kEnabled, b); } | ||
|
||
EditorConfigSettings& Load(); | ||
EditorConfigSettings& Save(); | ||
}; | ||
|
||
#endif // EDITORCONFIGSETTINGS_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "EditorConfigSettingsDlg.h" | ||
#include "cl_config.h" | ||
#include "EditorConfigSettings.h" | ||
|
||
EditorConfigSettingsDlg::EditorConfigSettingsDlg(wxWindow* parent) | ||
: EditorConfigSettingsDlgBase(parent) | ||
{ | ||
EditorConfigSettings settings; | ||
settings.Load(); | ||
m_checkBoxEnable->SetValue(settings.IsEnabled()); | ||
} | ||
|
||
EditorConfigSettingsDlg::~EditorConfigSettingsDlg() {} |
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,13 @@ | ||
#ifndef EDITORCONFIGSETTINGSDLG_H | ||
#define EDITORCONFIGSETTINGSDLG_H | ||
#include "EditorConfigUI.h" | ||
|
||
class EditorConfigSettingsDlg : public EditorConfigSettingsDlgBase | ||
{ | ||
public: | ||
EditorConfigSettingsDlg(wxWindow* parent); | ||
virtual ~EditorConfigSettingsDlg(); | ||
|
||
bool IsPluginEnabled() const { return m_checkBoxEnable->IsChecked(); } | ||
}; | ||
#endif // EDITORCONFIGSETTINGSDLG_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
////////////////////////////////////////////////////////////////////// | ||
// This file was auto-generated by codelite's wxCrafter Plugin | ||
// wxCrafter project file: EditorConfigUI.wxcp | ||
// Do not modify this file by hand! | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
#include "EditorConfigUI.h" | ||
|
||
|
||
// Declare the bitmap loading function | ||
extern void wxCE9B9InitBitmapResources(); | ||
|
||
static bool bBitmapLoaded = false; | ||
|
||
|
||
EditorConfigSettingsDlgBase::EditorConfigSettingsDlgBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) | ||
: wxDialog(parent, id, title, pos, size, style) | ||
{ | ||
if ( !bBitmapLoaded ) { | ||
// We need to initialise the default bitmap handler | ||
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); | ||
wxCE9B9InitBitmapResources(); | ||
bBitmapLoaded = true; | ||
} | ||
|
||
wxBoxSizer* boxSizer2 = new wxBoxSizer(wxVERTICAL); | ||
this->SetSizer(boxSizer2); | ||
|
||
wxFlexGridSizer* flexGridSizer10 = new wxFlexGridSizer(0, 2, 0, 0); | ||
flexGridSizer10->SetFlexibleDirection( wxBOTH ); | ||
flexGridSizer10->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | ||
|
||
boxSizer2->Add(flexGridSizer10, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5)); | ||
|
||
m_checkBoxEnable = new wxCheckBox(this, wxID_ANY, _("Enable .editorconfig support"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0); | ||
m_checkBoxEnable->SetValue(false); | ||
|
||
flexGridSizer10->Add(m_checkBoxEnable, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); | ||
|
||
m_stdBtnSizer4 = new wxStdDialogButtonSizer(); | ||
|
||
boxSizer2->Add(m_stdBtnSizer4, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5)); | ||
|
||
m_button6 = new wxButton(this, wxID_OK, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0); | ||
m_button6->SetDefault(); | ||
m_stdBtnSizer4->AddButton(m_button6); | ||
|
||
m_button8 = new wxButton(this, wxID_CANCEL, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0); | ||
m_stdBtnSizer4->AddButton(m_button8); | ||
m_stdBtnSizer4->Realize(); | ||
|
||
SetName(wxT("EditorConfigSettingsDlgBase")); | ||
SetSize(-1,-1); | ||
if (GetSizer()) { | ||
GetSizer()->Fit(this); | ||
} | ||
if(GetParent()) { | ||
CentreOnParent(wxBOTH); | ||
} else { | ||
CentreOnScreen(wxBOTH); | ||
} | ||
#if wxVERSION_NUMBER >= 2900 | ||
if(!wxPersistenceManager::Get().Find(this)) { | ||
wxPersistenceManager::Get().RegisterAndRestore(this); | ||
} else { | ||
wxPersistenceManager::Get().Restore(this); | ||
} | ||
#endif | ||
} | ||
|
||
EditorConfigSettingsDlgBase::~EditorConfigSettingsDlgBase() | ||
{ | ||
} |
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,52 @@ | ||
////////////////////////////////////////////////////////////////////// | ||
// This file was auto-generated by codelite's wxCrafter Plugin | ||
// wxCrafter project file: EditorConfigUI.wxcp | ||
// Do not modify this file by hand! | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef _CODELITE_EDITORCONFIGPLUGIN_EDITORCONFIGUI_BASE_CLASSES_H | ||
#define _CODELITE_EDITORCONFIGPLUGIN_EDITORCONFIGUI_BASE_CLASSES_H | ||
|
||
#include <wx/settings.h> | ||
#include <wx/xrc/xmlres.h> | ||
#include <wx/xrc/xh_bmp.h> | ||
#include <wx/dialog.h> | ||
#include <wx/iconbndl.h> | ||
#include <wx/artprov.h> | ||
#include <wx/sizer.h> | ||
#include <wx/checkbox.h> | ||
#include <wx/button.h> | ||
#if wxVERSION_NUMBER >= 2900 | ||
#include <wx/persist.h> | ||
#include <wx/persist/toplevel.h> | ||
#include <wx/persist/bookctrl.h> | ||
#include <wx/persist/treebook.h> | ||
#endif | ||
|
||
#ifdef WXC_FROM_DIP | ||
#undef WXC_FROM_DIP | ||
#endif | ||
#if wxVERSION_NUMBER >= 3100 | ||
#define WXC_FROM_DIP(x) wxWindow::FromDIP(x, NULL) | ||
#else | ||
#define WXC_FROM_DIP(x) x | ||
#endif | ||
|
||
|
||
class EditorConfigSettingsDlgBase : public wxDialog | ||
{ | ||
protected: | ||
wxCheckBox* m_checkBoxEnable; | ||
wxStdDialogButtonSizer* m_stdBtnSizer4; | ||
wxButton* m_button6; | ||
wxButton* m_button8; | ||
|
||
protected: | ||
|
||
public: | ||
wxCheckBox* GetCheckBoxEnable() { return m_checkBoxEnable; } | ||
EditorConfigSettingsDlgBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EditorConfig Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); | ||
virtual ~EditorConfigSettingsDlgBase(); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.