diff --git a/Makefile b/Makefile index 49201ba..984ab4d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ CXX = $(shell wx-config --cxx) -SOURCES = $(wildcard include/**/*.cpp include/*.cpp) +SOURCES = $(wildcard include/**/*.cpp src/settings/*.cpp include/*.cpp) OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES)) TARGET = build/Tyro.a @@ -8,7 +8,7 @@ PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp) PROGRAM = build/Tyro PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC)) -BASE_FLAGS = -DSCI_LEXER -std=c++11 +BASE_FLAGS = -DSCI_LEXER LDLIBS = $(TARGET) $(shell wx-config --libs base core aui stc adv) WX_CXXFLAGS = $(shell wx-config --cxxflags) $(BASE_FLAGS) diff --git a/src/common.h b/src/common.h index efc447c..75cea5e 100644 --- a/src/common.h +++ b/src/common.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/src/settings/Settings.cpp b/src/settings/Settings.cpp index 93ed570..aafa3ed 100644 --- a/src/settings/Settings.cpp +++ b/src/settings/Settings.cpp @@ -6,10 +6,16 @@ TyroSettings::TyroSettings() { - + ifstream file("../../config/scintilla.json"); + reader.parse(file, default_root); } TyroSettings::~TyroSettings() { +} + +Json::Value TyroSettings::GetRoot() +{ + return default_root; } \ No newline at end of file diff --git a/src/settings/Settings.h b/src/settings/Settings.h index 99483d5..d6fbd8a 100644 --- a/src/settings/Settings.h +++ b/src/settings/Settings.h @@ -13,9 +13,12 @@ class TyroSettings { public: - TyroSettings(); - ~TyroSettings(); + TyroSettings(); + ~TyroSettings(); + Json::Value GetRoot(); private: + Json::Value default_root; + Json::Reader reader; }; diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditPane.cpp index b9a43e6..4a93551 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditPane.cpp @@ -5,30 +5,11 @@ EditPane::EditPane( const wxSize &size, long style ) : wxStyledTextCtrl (parent, id, pos, size, style) { - StringConstMapData map_data[] = { - {"c", wxSTC_LEX_CPP}, - {"h", wxSTC_LEX_CPP}, - {"cpp", wxSTC_LEX_CPP}, - {"cxx", wxSTC_LEX_CPP}, - {"py", wxSTC_LEX_PYTHON}, - {"php", wxSTC_LEX_PHPSCRIPT}, - {"js", wxSTC_LEX_ESCRIPT}, - {"json", wxSTC_LEX_ESCRIPT} - }; - lexer_map = StringConstMap( - map_data, - map_data + sizeof map_data / sizeof map_data[0] - ); } EditPane::~EditPane() {} -/*void EditPane::OnSize(wxSizeEvent &event) -{ - -}*/ - /** * Encapsulate lexer selection when opening a file * @@ -41,8 +22,12 @@ bool EditPane::LoadAndHighlight(wxString filePath) wxFileName file(filePath); wxString ext = file.GetExt(); + this->SetLexer(wxSTC_LEX_CPP); + this->StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColor(101, 123, 131)); this->StyleSetBackground (wxSTC_STYLE_DEFAULT, wxColor(253, 246, 227)); + this->StyleSetBackground (wxSTC_STYLE_MAX, wxColor(253, 246, 227)); + this->StyleSetBackground (wxSTC_STYLE_CONTROLCHAR, wxColor(253, 246, 227)); this->StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColor(147, 161, 161)); this->SetMarginWidth (MARGIN_LINE_NUMBERS, 50); @@ -82,8 +67,5 @@ bool EditPane::LoadAndHighlight(wxString filePath) this->StyleSetBold(wxSTC_C_WORD2, true); this->StyleSetBold(wxSTC_C_COMMENTDOCKEYWORD, true); - lexer_map_it = lexer_map.find((string) ext); - this->SetLexer(lexer_map_it->second); - return this->LoadFile(filePath); } diff --git a/src/widgets/EditPane.h b/src/widgets/EditPane.h index 26bea4f..19762a6 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditPane.h @@ -22,7 +22,6 @@ public: ); ~EditPane(); wxString fileName; - void OnSize(wxSizeEvent &event); bool LoadAndHighlight(wxString filePath); private: enum @@ -30,8 +29,6 @@ private: MARGIN_LINE_NUMBERS, MARGIN_FOLD }; - StringConstMap lexer_map; - StringConstMap::iterator lexer_map_it; }; #endif // TYRODOC_FRAME_H