From a3e7c1b1f05da0b6aa6d8e4fe4b39870a6e5a367 Mon Sep 17 00:00:00 2001 From: Tim Warren Date: Thu, 23 Apr 2015 11:03:50 -0400 Subject: [PATCH] Makefile and formatting tweaks --- Makefile | 4 ++-- config/languages.json | 5 ++-- config/themes.json | 7 +++--- src/common.h | 2 +- src/widgets/EditPane.cpp | 50 +++++++++++++++++++++------------------- src/widgets/EditPane.h | 1 - 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index af5d206..b30cc81 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ build: @mkdir -p build sftp_o: - $(CXX) $(CXXFLAGS) $(LDLIBS) -c -o src/network/SFTP.o src/network/SFTP.cpp + $(CXX) -static $(CXXFLAGS) $(LDLIBS) -c -o src/network/SFTP.o src/network/SFTP.cpp $(TYRO_LIB): build sftp_o $(TYRO_LIB): OBJECTS += src/network/SFTP.o @@ -105,7 +105,7 @@ Tyro.app: all resources/platform/osx/Info.plist cp resources/platform/osx/tyro.icns Tyro.app/Contents/Resources/ $(TESTS): $(TYRO_LIB) - $(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(var) $(TYRO_LIB) -o $(patsubst %.cpp,%, $(var));) + $(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(var) $(TYRO_LIB) $(LDLIBS) -o $(patsubst %.cpp,%, $(var));) .PHONY: tests tests: $(TESTS) diff --git a/config/languages.json b/config/languages.json index 5732676..c20585d 100644 --- a/config/languages.json +++ b/config/languages.json @@ -45,7 +45,8 @@ "file_pattern": "*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.xpm", "keywords": [ "alignof and and_eq bitand bitor break case catch compl const_cast continue default delete do dynamic_cast else false for goto if namespace new not not_eq nullptr operator or or_eq reinterpret_cast return sizeof static_assert static_cast switch this throw true try typedef typeid using while xor xor_eq NULL", - "alignas asm auto bool char char16_t char32_t class const constexpr decltype double enum explicit export extern final float friend inline int long mutable noexcept override private protected public register short signed static struct template thread_local typename union unsigned virtual void volatile wchar_t" + "alignas asm auto bool char char16_t char32_t class const constexpr decltype double enum explicit export extern final float friend inline int long mutable noexcept override private protected public register short signed static struct template thread_local typename union unsigned virtual void volatile wchar_t", + "abstract access author copyright deprecated deprec example exception global ignore internal license link name package param return see since static staticvar subpackage throws todo version" ], "lexer_map": [ "default", "comment", "comment_line", "comment_doc", "number", "keyword1", "string", "character", "uuid", "preprocessor", "operator", "identifier", "string_eol", "default", "regex", "comment_special", "keyword2", "keyword3", "error" @@ -223,7 +224,7 @@ "" ], "lexer_map": [ - "default", "keyword1", "parameter", "keyword2", "identifier", "number", "string_eol", "string", "value", "comment", "label", "default", "default", "default", "script", "default", "default", "default", "default", "value" + "default", "keyword1", "error", "keyword2", "error", "number", "string", "string", "default", "comment", "preprocessor", "keyword1", "keyword3", "keyword3", "keyword4", "keyword5", "keyword6", "preprocessor", "keyword7" ] }, "yaml": { diff --git a/config/themes.json b/config/themes.json index 8e80638..0e33d24 100644 --- a/config/themes.json +++ b/config/themes.json @@ -48,8 +48,8 @@ "parameter": [0, 43, 54], "regex": [7, 54, 66], "uuid": [0, 43, 54], - "value": [7, 54, 66], - "preprocessor": [181, 137, 0], + "value": [0, 43, 54], + "preprocessor": [88, 110, 117], "script": [88, 110, 117], "variable": [203, 75, 22], "error": [220, 50, 47] @@ -59,7 +59,8 @@ "keyword2": true, "operator": true, "label": true, - "error": true + "error": true, + "preprocessor": true }, "italic": { "error": true diff --git a/src/common.h b/src/common.h index 580a324..0cf6142 100644 --- a/src/common.h +++ b/src/common.h @@ -2,7 +2,7 @@ * A common header for global includes */ #ifndef TYRO_COMMON_H -#define TYRO_COMMON_H +#define TYRO_COMMON_H // C++ Standard Lib includes #include diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditPane.cpp index d275f9e..41a9531 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditPane.cpp @@ -80,6 +80,7 @@ void EditPane::Highlight(wxString filePath) // Some basic properties to set this->SetProperty("technology", "2"); this->SetProperty("error.inline", "0"); + this->SetProperty("styling.within.preprocessor", "1"); this->SetProperty("font.quality", "3"); // LCD Optimized // Apply the theme @@ -96,24 +97,25 @@ void EditPane::Highlight(wxString filePath) this->SetMarginSensitive(MARGIN_FOLD, true); this->SetMarginMask(MARGIN_FOLD, wxSTC_MASK_FOLDERS); this->MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUSCONNECTED, "WHITE", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUSCONNECTED, "WHITE", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "BLACK", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED, "WHITE", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED, "WHITE", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "BLACK", "BLACK"); - this->MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "BLACK", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUSCONNECTED, "WHITE", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "BLACK", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED, "WHITE", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED, "WHITE", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "BLACK", "BLACK"); + this->MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "BLACK", "BLACK"); + + this->SetLayoutCache (wxSTC_CACHE_CARET); + //this->SetViewWhiteSpace(wxSTC_WS_VISIBLEALWAYS); - this->SetLayoutCache (wxSTC_CACHE_NONE); - this->SetUseHorizontalScrollBar(1); // set spaces and indention - this->SetTabWidth(4); + this->SetTabWidth(4); bool use_tabs = (lang != "yaml"); - this->SetUseTabs(use_tabs); - this->SetTabIndents(true); - this->SetBackSpaceUnIndents(true); + this->SetUseTabs(use_tabs); + this->SetTabIndents(true); + this->SetBackSpaceUnIndents(true); } /** @@ -151,7 +153,12 @@ void EditPane::ApplyTheme(string lang, string theme) wxLogDebug(output.str().c_str()); } - int offset_count = 0;//(lang == "php") ? 104 : 0; + if (lang == "php") + { + //this->SetLexerLanguage("php"); + } + + int offset_count = (lang == "php") ? 104 : 0; // Do the appropriate mappings to load the selected theme this->_ApplyTheme(lexer_map, offset_count); @@ -268,11 +275,6 @@ bool EditPane::SaveFile(const wxString &filename) return false; } -bool EditPane::IsModified() -{ - return this->GetModify(); -} - /** * Check that the current file can be opened * @@ -338,12 +340,12 @@ void EditPane::BindEvents() void EditPane::OnMarginClick(wxStyledTextEvent& event) { if (event.GetMargin() == MARGIN_FOLD) { - int lineClick = this->LineFromPosition (event.GetPosition()); - int levelClick = this->GetFoldLevel (lineClick); - if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) { - this->ToggleFold (lineClick); - } - } + int lineClick = this->LineFromPosition (event.GetPosition()); + int levelClick = this->GetFoldLevel (lineClick); + if ((levelClick & wxSTC_FOLDLEVELHEADERFLAG) > 0) { + this->ToggleFold (lineClick); + } + } } /** diff --git a/src/widgets/EditPane.h b/src/widgets/EditPane.h index ac55702..d5102f2 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditPane.h @@ -27,7 +27,6 @@ public: void Highlight(wxString filePath); bool SaveFile(); bool SaveFile(const wxString &filename); - bool IsModified(); void ApplyTheme(string lang, string theme="Solarized"); private: StringConstMap lexerMap;