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))
|
||||
|
||||
PROGRAM_SRC = $(wildcard src/widgets/*.cpp src/settings/*.cpp src/*.cpp)
|
||||
PROGRAM_SRC = $(wildcard src/*.cpp)
|
||||
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_CXXFLAGS = $(shell wx-config --cxxflags)
|
||||
|
||||
@ -27,10 +35,6 @@ else
|
||||
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
|
||||
endif
|
||||
|
||||
ifeq ($(CXX),clang++)
|
||||
CXX += -std=c++11
|
||||
endif
|
||||
|
||||
# Platform compiler flags
|
||||
ifeq ($(OS),Darwin)
|
||||
CXX = $(shell wx-config --cxx) -D__WXMAC__
|
||||
@ -45,12 +49,12 @@ ifeq ($(OS),Windows_NT)
|
||||
LDLIBS += -L/lib -lwsock32
|
||||
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)
|
||||
all: CXXFLAGS = $(DEV_CXXFLAGS)
|
||||
endif
|
||||
all: build json_wrapper $(BASE_LIB) $(PROGRAM)
|
||||
all: build json_wrapper $(BASE_LIB) $(WIDGET_LIB) $(PROGRAM)
|
||||
ifeq ($(OS),Darwin)
|
||||
all: Tyro.app
|
||||
endif
|
||||
@ -72,11 +76,24 @@ $(BASE_LIB): build $(OBJECTS)
|
||||
ar rcs $@ $(OBJECTS)
|
||||
ranlib $@
|
||||
|
||||
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS)
|
||||
$(PROGRAM):
|
||||
$(CXX) $(CXXFLAGS) $(PROGRAM_SRC) $(BASE_LIB) $(WX_LDLIBS) $(LDLIBS) -o $(PROGRAM)
|
||||
|
||||
$(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)
|
||||
|
||||
lib: $(OBJECTS) $(BASE_LIB) $(CONFIG_LIB) $(WIDGET_LIB)
|
||||
|
||||
run:
|
||||
ifneq ($(OS),Darwin)
|
||||
@ -146,6 +163,6 @@ clean:
|
||||
rm -f config/*_json.h
|
||||
rm -rf *.o
|
||||
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 {} \;
|
||||
rm -rf `find . -name "*.dSYM" -print`
|
||||
|
@ -139,7 +139,6 @@ void EditPane::ApplyTheme(string lang, string theme)
|
||||
*/
|
||||
void EditPane::ReApplyTheme(string theme)
|
||||
{
|
||||
wxLogDebug("Current lang: %s", lang_config->GetLangByName(this->GetCurrentLang()));
|
||||
this->ApplyTheme(lang_config->GetLangByName(this->GetCurrentLang()), theme);
|
||||
}
|
||||
|
||||
@ -403,9 +402,8 @@ void EditPane::_ApplyTheme(JsonValue &lexer_map)
|
||||
{
|
||||
this->SetMarginWidth (MARGIN_LINE_NUMBERS, 0);
|
||||
}
|
||||
|
||||
int max = lexer_map.size();
|
||||
|
||||
int max = lexer_map.size();
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
string key = lexer_map[i].asString();
|
||||
|
@ -200,7 +200,7 @@ void MainFrame::OnOpen(wxCommandEvent &WXUNUSED(event))
|
||||
{
|
||||
wxArrayString filelist;
|
||||
|
||||
wxFileDialog dlg (this, "Open file(s)", wxEmptyString, wxEmptyString,
|
||||
wxFileDialog dlg(this, "Open file(s)", wxEmptyString, wxEmptyString,
|
||||
TYRO_FILE_OPEN_WILDCARDS, wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR | wxFD_MULTIPLE);
|
||||
|
||||
if (dlg.ShowModal() != wxID_OK) return;
|
||||
@ -223,12 +223,12 @@ void MainFrame::OpenFiles(wxArrayString filelist)
|
||||
if (listcount < 1) return;
|
||||
|
||||
// Open a new tab for each file
|
||||
//notebook->Freeze();
|
||||
notebook->Freeze();
|
||||
for (int i = 0; i < listcount; i++)
|
||||
{
|
||||
notebook->AddTab(filelist[i]);
|
||||
}
|
||||
//notebook->Thaw();
|
||||
notebook->Thaw();
|
||||
|
||||
this->EnableEditControls(true);
|
||||
}
|
||||
@ -650,14 +650,14 @@ void MainFrame::OnEditPreferences(wxCommandEvent &WXUNUSED(event))
|
||||
* @return void
|
||||
*/
|
||||
void MainFrame::OnPrefsChanged(wxCommandEvent &WXUNUSED(event))
|
||||
{
|
||||
wxLogDebug("In OnPrefsChanged method");
|
||||
|
||||
{
|
||||
EditPane *editor;
|
||||
|
||||
notebook->Freeze();
|
||||
for(size_t i = 0; i < notebook->GetPageCount(); i++)
|
||||
{
|
||||
editor = notebook->GetEditor(i);
|
||||
editor->ReApplyTheme();
|
||||
}
|
||||
notebook->Thaw();
|
||||
}
|
@ -64,10 +64,11 @@ void TyroMenu::SetupMainMenus()
|
||||
//editMenu->AppendSeparator();
|
||||
//editMenu->Append(wxID_FIND, "&Find\tCtrl+F");
|
||||
//editMenu->Append(wxID_REPLACE, "&Replace\tCtrl+R");
|
||||
editMenu->AppendSeparator();
|
||||
editMenu->Append(wxID_PREFERENCES, "&Preferences\tCtrl+P");
|
||||
|
||||
//editMenu->AppendSeparator();
|
||||
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_LINE_ENDINGS, "Show line endings", "Toggle visibility of line ending characters");
|
||||
@ -83,14 +84,11 @@ void TyroMenu::SetupMainMenus()
|
||||
*/
|
||||
void TyroMenu::SetupLangMenu()
|
||||
{
|
||||
StringMap langs = lang_config->GetLangList();
|
||||
StringMap::iterator it;
|
||||
StringMap languages = lang_config->GetLangList();
|
||||
|
||||
StringMap::iterator last = langs.end();
|
||||
|
||||
for (it = langs.begin(); it != last; ++it)
|
||||
for (auto lang: languages)
|
||||
{
|
||||
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
|
||||
wxMenuItemList list = menu->GetMenuItems();
|
||||
wxMenuItemList::iterator iter;
|
||||
|
||||
for(iter = list.begin(); iter != list.end(); ++iter)
|
||||
for(auto item: list)
|
||||
{
|
||||
wxMenuItem *current = *iter;
|
||||
current->Enable(enable);
|
||||
item->Enable(enable);
|
||||
|
||||
// Uncheck all the items
|
||||
if (current->IsCheckable())
|
||||
if (item->IsCheckable())
|
||||
{
|
||||
current->Check(false);
|
||||
item->Check(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user