Use C++11 standard
This commit is contained in:
parent
33cf766340
commit
73e1b1d634
41
Makefile
41
Makefile
@ -4,9 +4,17 @@ BASE_LIB = build/base.a
|
|||||||
|
|
||||||
JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
|
JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
|
||||||
|
|
||||||
PROGRAM_SRC = $(wildcard src/widgets/*.cpp src/settings/*.cpp src/*.cpp)
|
PROGRAM_SRC = $(wildcard src/*.cpp)
|
||||||
PROGRAM = build/Tyro
|
PROGRAM = build/Tyro
|
||||||
|
|
||||||
|
CONFIG_SRC = $(wildcard src/settings/*.cpp)
|
||||||
|
CONFIG_OBJ = $(patsubst %.cpp,%.o, $(CONFIG_SRC))
|
||||||
|
CONFIG_LIB = build/config.a
|
||||||
|
|
||||||
|
WIDGET_SRC = $(wildcard src/settings/*.cpp src/widgets/*.cpp)
|
||||||
|
WIDGET_OBJ = $(patsubst %.cpp,%.o, $(WIDGET_SRC))
|
||||||
|
WIDGET_LIB = build/widget.a
|
||||||
|
|
||||||
WX_RES = $(shell wx-config --rescomp)
|
WX_RES = $(shell wx-config --rescomp)
|
||||||
WX_CXXFLAGS = $(shell wx-config --cxxflags)
|
WX_CXXFLAGS = $(shell wx-config --cxxflags)
|
||||||
|
|
||||||
@ -27,10 +35,6 @@ else
|
|||||||
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
|
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CXX),clang++)
|
|
||||||
CXX += -std=c++11
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Platform compiler flags
|
# Platform compiler flags
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
CXX = $(shell wx-config --cxx) -D__WXMAC__
|
CXX = $(shell wx-config --cxx) -D__WXMAC__
|
||||||
@ -45,12 +49,12 @@ ifeq ($(OS),Windows_NT)
|
|||||||
LDLIBS += -L/lib -lwsock32
|
LDLIBS += -L/lib -lwsock32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXX += -Wno-unknown-pragmas -Wno-unknown-warning-option -Wno-potentially-evaluated-expression -Wno-missing-field-initializers -Iinclude -I. -I/usr/local/include
|
CXX += -std=c++11 -Wno-unknown-pragmas -Wno-unknown-warning-option -Wno-potentially-evaluated-expression -Wno-missing-field-initializers -Iinclude -I. -I/usr/local/include
|
||||||
|
|
||||||
ifdef $(DEV)
|
ifdef $(DEV)
|
||||||
all: CXXFLAGS = $(DEV_CXXFLAGS)
|
all: CXXFLAGS = $(DEV_CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
all: build json_wrapper $(BASE_LIB) $(PROGRAM)
|
all: build json_wrapper $(BASE_LIB) $(WIDGET_LIB) $(PROGRAM)
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
all: Tyro.app
|
all: Tyro.app
|
||||||
endif
|
endif
|
||||||
@ -72,11 +76,24 @@ $(BASE_LIB): build $(OBJECTS)
|
|||||||
ar rcs $@ $(OBJECTS)
|
ar rcs $@ $(OBJECTS)
|
||||||
ranlib $@
|
ranlib $@
|
||||||
|
|
||||||
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS)
|
|
||||||
$(PROGRAM):
|
|
||||||
$(CXX) $(CXXFLAGS) $(PROGRAM_SRC) $(BASE_LIB) $(WX_LDLIBS) $(LDLIBS) -o $(PROGRAM)
|
|
||||||
|
|
||||||
lib: $(OBJECTS) $(BASE_LIB)
|
$(CONFIG_LIB): build
|
||||||
|
$(foreach var, $(CONFIG_SRC), $(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) -c -o $(patsubst %.cpp,%.o,$(var)) $(var);)
|
||||||
|
ar rcs $@ $(CONFIG_OBJ)
|
||||||
|
ranlib $@
|
||||||
|
|
||||||
|
|
||||||
|
$(WIDGET_LIB): build $(CONFIG_LIB)
|
||||||
|
$(foreach var, $(WIDGET_SRC), $(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) -c -o $(patsubst %.cpp,%.o,$(var)) $(var);)
|
||||||
|
ar rcs $@ $(WIDGET_OBJ)
|
||||||
|
ranlib $@
|
||||||
|
|
||||||
|
|
||||||
|
$(PROGRAM): $(WIDGET_LIB)
|
||||||
|
$(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(WIDGET_LIB) $(CONFIG_LIB) $(BASE_LIB) $(WX_LDLIBS) $(LDLIBS) -o $(PROGRAM)
|
||||||
|
|
||||||
|
|
||||||
|
lib: $(OBJECTS) $(BASE_LIB) $(CONFIG_LIB) $(WIDGET_LIB)
|
||||||
|
|
||||||
run:
|
run:
|
||||||
ifneq ($(OS),Darwin)
|
ifneq ($(OS),Darwin)
|
||||||
@ -146,6 +163,6 @@ clean:
|
|||||||
rm -f config/*_json.h
|
rm -f config/*_json.h
|
||||||
rm -rf *.o
|
rm -rf *.o
|
||||||
rm -rf build
|
rm -rf build
|
||||||
rm -rf build $(OBJECTS) $(PROGRAM) $(BASE_LIB) $(TESTS)
|
rm -rf build $(OBJECTS) $(PROGRAM) $(BASE_LIB) $(CONFIG_LIB) $(WIDGET_LIB) $(TESTS)
|
||||||
find . -name "*.gc*" -exec rm {} \;
|
find . -name "*.gc*" -exec rm {} \;
|
||||||
rm -rf `find . -name "*.dSYM" -print`
|
rm -rf `find . -name "*.dSYM" -print`
|
||||||
|
@ -139,7 +139,6 @@ void EditPane::ApplyTheme(string lang, string theme)
|
|||||||
*/
|
*/
|
||||||
void EditPane::ReApplyTheme(string theme)
|
void EditPane::ReApplyTheme(string theme)
|
||||||
{
|
{
|
||||||
wxLogDebug("Current lang: %s", lang_config->GetLangByName(this->GetCurrentLang()));
|
|
||||||
this->ApplyTheme(lang_config->GetLangByName(this->GetCurrentLang()), theme);
|
this->ApplyTheme(lang_config->GetLangByName(this->GetCurrentLang()), theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +404,6 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int max = lexer_map.size();
|
int max = lexer_map.size();
|
||||||
|
|
||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
string key = lexer_map[i].asString();
|
string key = lexer_map[i].asString();
|
||||||
|
@ -223,12 +223,12 @@ void MainFrame::OpenFiles(wxArrayString filelist)
|
|||||||
if (listcount < 1) return;
|
if (listcount < 1) return;
|
||||||
|
|
||||||
// Open a new tab for each file
|
// Open a new tab for each file
|
||||||
//notebook->Freeze();
|
notebook->Freeze();
|
||||||
for (int i = 0; i < listcount; i++)
|
for (int i = 0; i < listcount; i++)
|
||||||
{
|
{
|
||||||
notebook->AddTab(filelist[i]);
|
notebook->AddTab(filelist[i]);
|
||||||
}
|
}
|
||||||
//notebook->Thaw();
|
notebook->Thaw();
|
||||||
|
|
||||||
this->EnableEditControls(true);
|
this->EnableEditControls(true);
|
||||||
}
|
}
|
||||||
@ -651,13 +651,13 @@ void MainFrame::OnEditPreferences(wxCommandEvent &WXUNUSED(event))
|
|||||||
*/
|
*/
|
||||||
void MainFrame::OnPrefsChanged(wxCommandEvent &WXUNUSED(event))
|
void MainFrame::OnPrefsChanged(wxCommandEvent &WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxLogDebug("In OnPrefsChanged method");
|
|
||||||
|
|
||||||
EditPane *editor;
|
EditPane *editor;
|
||||||
|
|
||||||
|
notebook->Freeze();
|
||||||
for(size_t i = 0; i < notebook->GetPageCount(); i++)
|
for(size_t i = 0; i < notebook->GetPageCount(); i++)
|
||||||
{
|
{
|
||||||
editor = notebook->GetEditor(i);
|
editor = notebook->GetEditor(i);
|
||||||
editor->ReApplyTheme();
|
editor->ReApplyTheme();
|
||||||
}
|
}
|
||||||
|
notebook->Thaw();
|
||||||
}
|
}
|
@ -64,10 +64,11 @@ void TyroMenu::SetupMainMenus()
|
|||||||
//editMenu->AppendSeparator();
|
//editMenu->AppendSeparator();
|
||||||
//editMenu->Append(wxID_FIND, "&Find\tCtrl+F");
|
//editMenu->Append(wxID_FIND, "&Find\tCtrl+F");
|
||||||
//editMenu->Append(wxID_REPLACE, "&Replace\tCtrl+R");
|
//editMenu->Append(wxID_REPLACE, "&Replace\tCtrl+R");
|
||||||
editMenu->AppendSeparator();
|
|
||||||
editMenu->Append(wxID_PREFERENCES, "&Preferences\tCtrl+P");
|
|
||||||
//editMenu->AppendSeparator();
|
//editMenu->AppendSeparator();
|
||||||
editMenu->Append(wxID_SELECTALL, "Select All\tCtrl+A", "Select all the text in the current document");
|
editMenu->Append(wxID_SELECTALL, "Select All\tCtrl+A", "Select all the text in the current document");
|
||||||
|
editMenu->AppendSeparator();
|
||||||
|
editMenu->Append(wxID_PREFERENCES, "&Preferences\tCtrl+P");
|
||||||
|
|
||||||
viewMenu->AppendCheckItem(myID_VIEW_WHITESPACE, "Show Invisible Characters\tCtrl+Shift+I", "Toggle visibility of white space characters");
|
viewMenu->AppendCheckItem(myID_VIEW_WHITESPACE, "Show Invisible Characters\tCtrl+Shift+I", "Toggle visibility of white space characters");
|
||||||
viewMenu->AppendCheckItem(myID_VIEW_LINE_ENDINGS, "Show line endings", "Toggle visibility of line ending characters");
|
viewMenu->AppendCheckItem(myID_VIEW_LINE_ENDINGS, "Show line endings", "Toggle visibility of line ending characters");
|
||||||
@ -83,14 +84,11 @@ void TyroMenu::SetupMainMenus()
|
|||||||
*/
|
*/
|
||||||
void TyroMenu::SetupLangMenu()
|
void TyroMenu::SetupLangMenu()
|
||||||
{
|
{
|
||||||
StringMap langs = lang_config->GetLangList();
|
StringMap languages = lang_config->GetLangList();
|
||||||
StringMap::iterator it;
|
|
||||||
|
|
||||||
StringMap::iterator last = langs.end();
|
for (auto lang: languages)
|
||||||
|
|
||||||
for (it = langs.begin(); it != last; ++it)
|
|
||||||
{
|
{
|
||||||
langMenu->Append(wxID_ANY, it->second, "Highlight file as " + it->second, wxITEM_RADIO);
|
langMenu->Append(wxID_ANY, lang.second, "Highlight file as " + lang.second, wxITEM_RADIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,17 +145,15 @@ void TyroMenu::EnableEntireMenu(size_t menuId, wxMenu *menu, bool enable)
|
|||||||
|
|
||||||
// Toggle the rest of the items in the menu
|
// Toggle the rest of the items in the menu
|
||||||
wxMenuItemList list = menu->GetMenuItems();
|
wxMenuItemList list = menu->GetMenuItems();
|
||||||
wxMenuItemList::iterator iter;
|
|
||||||
|
|
||||||
for(iter = list.begin(); iter != list.end(); ++iter)
|
for(auto item: list)
|
||||||
{
|
{
|
||||||
wxMenuItem *current = *iter;
|
item->Enable(enable);
|
||||||
current->Enable(enable);
|
|
||||||
|
|
||||||
// Uncheck all the items
|
// Uncheck all the items
|
||||||
if (current->IsCheckable())
|
if (item->IsCheckable())
|
||||||
{
|
{
|
||||||
current->Check(false);
|
item->Check(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user