More tweaking of Cmake files

This commit is contained in:
Timothy Warren 2015-10-29 13:55:01 -04:00
parent b73be045d4
commit 49a446c364
4 changed files with 37 additions and 34 deletions

View File

@ -23,5 +23,6 @@ addons:
- gcc-4.8
- g++-4.8
- clang
- libgtk2.0-dev
script: make clean run-tests

View File

@ -3,7 +3,7 @@
################################################################################
cmake_minimum_required (VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
# Hunter for dependency management
include("cmake/HunterGate.cmake")
@ -30,9 +30,15 @@ else()
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
endif()
# Silence some useless errors
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression)
endif()
# wxwidgets stuff
set(wxWidgets_CONFIG_OPTIONS --static)
unset(WXSETUP_wxUSE_WEBVIEW_WEBKIT)
hunter_add_package(wxWidgets)
find_package(wxWidgets COMPONENTS core base aui stc adv REQUIRED)
include("${wxWidgets_USE_FILE}")
@ -51,8 +57,10 @@ include_directories(${INCLUDE_DIRS})
# set some platform-specific flags
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-potentially-evaluated-expression")
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++")
add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -D__WXMAC__)
else()
add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
endif()
################################################################################

View File

@ -1,4 +1,3 @@
#ifndef TRAVIS
#include "src/widgets/PrefPane.h"
#include "src/widgets/MainFrame.h"
@ -10,19 +9,19 @@ public:
: wxPanel(parent)
{
this->frame = (MainFrame *) parent;
this->showLineNumbers = new wxCheckBox(this, myID_PREFS_LINE_NUMBERS, "Show line numbers");
this->showIndentGuides = new wxCheckBox(this, myID_PREFS_IDENT_GUIDES, "Show indent guides");
this->showCodeFolding = new wxCheckBox(this, myID_PREFS_CODE_FOLDING, "Show code folding");
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
// Check that version of OS X is less than 10.10 for wxWidgets < 3.0.3
// Otherwise the font control will segfault
if( ! HAS_FONT_BUG())
{
this->fontPicker = new wxFontPickerCtrl(
this,
this,
myID_PREFS_FONT,
wxNullFont,
wxDefaultPosition,
@ -33,13 +32,13 @@ public:
fontSizer->Add(this->fontPicker, wxSizerFlags().Border());
sizer->Add(fontSizer, wxSizerFlags().Border());
}
sizer->Add(this->showLineNumbers, wxSizerFlags().Border());
sizer->Add(this->showIndentGuides, wxSizerFlags().Border());
sizer->Add(this->showCodeFolding, wxSizerFlags().Border());
this->SetSizerAndFit(sizer);
// Change settings on selection, rather than on apply button
// On supported platforms
if (wxPreferencesEditor::ShouldApplyChangesImmediately())
@ -52,19 +51,19 @@ public:
Glob_config->Flush();
}, myID_PREFS_FONT);
}
this->showLineNumbers->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) {
Glob_config->Write("show_line_numbers", event.IsChecked());
this->frame->OnPrefsChanged(event);
Glob_config->Flush();
}, myID_PREFS_LINE_NUMBERS);
this->showIndentGuides->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) {
Glob_config->Write("show_indent_guides", event.IsChecked());
this->frame->OnPrefsChanged(event);
Glob_config->Flush();
}, myID_PREFS_IDENT_GUIDES);
this->showCodeFolding->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) {
Glob_config->Write("show_code_folding", event.IsChecked());
this->frame->OnPrefsChanged(event);
@ -72,14 +71,14 @@ public:
}, myID_PREFS_CODE_FOLDING);
}
}
~GeneralPrefPanePage()
{
}
/**
* Apply current settings to the pref window
*
*
* @return bool
*/
virtual bool TransferDataToWindow()
@ -87,43 +86,43 @@ public:
this->showLineNumbers->SetValue(Glob_config->ReadBool("show_line_numbers", true));
this->showIndentGuides->SetValue(Glob_config->ReadBool("show_indent_guides", false));
this->showCodeFolding->SetValue(Glob_config->ReadBool("show_code_folding", false));
if ( ! HAS_FONT_BUG())
{
wxFont globalFont;
Glob_config->Read("global_font", &globalFont);
this->fontPicker->SetSelectedFont(globalFont);
}
return true;
}
/**
* Called on platforms with modal preferences dialog to save
* Called on platforms with modal preferences dialog to save
* and apply the changes
*
* @return bool
*
* @return bool
*/
virtual bool TransferDataFromWindow()
{
Glob_config->Write("show_line_numbers", this->showLineNumbers->IsChecked());
Glob_config->Write("show_indent_guides", this->showIndentGuides->IsChecked());
Glob_config->Write("show_code_folding", this->showCodeFolding->IsChecked());
if ( ! HAS_FONT_BUG())
{
Glob_config->Write("global_font", this->fontPicker->GetSelectedFont());
}
wxCommandEvent evt = wxCommandEvent();
this->frame->OnPrefsChanged(evt);
Glob_config->Flush();
return true;
}
private:
MainFrame *frame;
wxFontPickerCtrl *fontPicker = nullptr;
@ -160,6 +159,3 @@ void PrefPane::Show(wxWindow *parent)
{
this->pref_window->Show(parent);
}
#endif // ifndef TRAVIS

View File

@ -16,10 +16,8 @@
#include <wx/dirctrl.h>
#include <wx/fontpicker.h>
#include <wx/treelist.h>
#ifndef TRAVIS
#include <wx/preferences.h>
#endif
#endif /* TYRO_WIDGET_H */