Browse Source

Cleanup: removed support for older libraries

merge-requests/365/head
eidheim 8 years ago
parent
commit
d9ee4d97ce
  1. 2
      CMakeLists.txt
  2. 14
      src/dialogs.cc
  3. 19
      src/directories.cc
  4. 14
      src/entrybox.cc
  5. 21
      src/git.cc
  6. 14
      src/info.cc
  7. 24
      src/notebook.cc
  8. 14
      src/selection_dialog.cc
  9. 18
      src/source.cc
  10. 16
      src/source_clang.cc
  11. 14
      src/source_diff.cc
  12. 14
      src/source_spellcheck.cc
  13. 14
      src/tooltips.cc
  14. 16
      src/window.cc
  15. 2
      tests/CMakeLists.txt

2
CMakeLists.txt

@ -11,7 +11,7 @@ set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A lightweight, platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake, make, g++, libclang-dev, liblldb-3.5-dev, clang-format-3.5, pkg-config, libboost-system-dev, libboost-filesystem-dev, libgtksourceviewmm-3.0-dev, aspell-en, libaspell-dev, libgit2-dev, exuberant-ctags")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake, make, g++, libclang-3.8-dev, liblldb-3.8-dev, clang-format, pkg-config, libboost-system-dev, libboost-filesystem-dev, libgtksourceviewmm-3.0-dev, aspell-en, libaspell-dev, libgit2-dev, exuberant-ctags")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/cppit/jucipp")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
include(CPack)

14
src/dialogs.cc

@ -1,20 +1,6 @@
#include "dialogs.h"
#include <cmath>
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Dialog::Message::Message(const std::string &text): Gtk::MessageDialog(text, false, Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_NONE, true) {
auto g_application=g_application_get_default();
auto gio_application=Glib::wrap(g_application, true);

19
src/directories.cc

@ -6,20 +6,6 @@
#include "filesystem.h"
#include "entrybox.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
bool Directories::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path &path, const Gtk::SelectionData &selection_data) const {
return true;
}
@ -525,12 +511,7 @@ void Directories::add_or_update_path(const boost::filesystem::path &dir_path, co
if(path_it==directories.end()) {
auto g_file=Glib::wrap(g_file_new_for_path(dir_path.string().c_str())); //TODO: report missing constructor in giomm
#if GLIBMM_MAJOR_VERSION>2 || (GLIBMM_MAJOR_VERSION==2 && GLIBMM_MINOR_VERSION>=45)
auto monitor=g_file->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_WATCH_MOVES);
#else
auto monitor=g_file->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_SEND_MOVED);
#endif
auto path_and_row=std::make_shared<std::pair<boost::filesystem::path, Gtk::TreeModel::Row> >(dir_path, row);
auto connection=std::make_shared<sigc::connection>();

14
src/entrybox.cc

@ -1,19 +1,5 @@
#include "entrybox.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
std::unordered_map<std::string, std::vector<std::string> > EntryBox::entry_histories;
EntryBox::Entry::Entry(const std::string& content, std::function<void(const std::string& content)> on_activate, unsigned width_chars) : Gtk::Entry(), on_activate(on_activate) {

21
src/git.cc

@ -46,11 +46,7 @@ Git::Repository::Diff::Lines Git::Repository::Diff::get_lines(const std::string
Lines lines;
Error error;
std::lock_guard<std::mutex> lock(mutex);
#if LIBGIT2_SOVERSION>=23
error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, hunk_cb, nullptr, &lines);
#else
error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, hunk_cb, nullptr, &lines);
#endif
if(error)
throw std::runtime_error(error.message());
return lines;
@ -74,11 +70,7 @@ std::string Git::Repository::Diff::get_details(const std::string &buffer, int li
details.second=line_nr;
Error error;
std::lock_guard<std::mutex> lock(mutex);
#if LIBGIT2_SOVERSION>=23
error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, nullptr, line_cb, &details);
#else
error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, line_cb, &details);
#endif
if(error)
throw std::runtime_error(error.message());
return details.first;
@ -102,12 +94,7 @@ Git::Repository::Repository(const boost::filesystem::path &path) {
auto git_path_str=get_path().string();
auto git_directory=Glib::wrap(g_file_new_for_path(git_path_str.c_str())); //TODO: report missing constructor in giomm
#if GLIBMM_MAJOR_VERSION>2 || (GLIBMM_MAJOR_VERSION==2 && GLIBMM_MINOR_VERSION>=45)
monitor=git_directory->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_WATCH_MOVES);
#else
monitor=git_directory->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_SEND_MOVED);
#endif
monitor_changed_connection=monitor->signal_changed().connect([this](const Glib::RefPtr<Gio::File> &file,
const Glib::RefPtr<Gio::File>&,
Gio::FileMonitorEvent monitor_event) {
@ -150,16 +137,12 @@ int Git::Repository::status_callback(const char *path, unsigned int status_flags
status=STATUS::RENAMED;
else if((status_flags&(GIT_STATUS_INDEX_TYPECHANGE|GIT_STATUS_WT_TYPECHANGE))>0)
status=STATUS::TYPECHANGE;
#if LIBGIT2_SOVERSION>=23
else if((status_flags&(GIT_STATUS_WT_UNREADABLE))>0)
status=STATUS::UNREADABLE;
#endif
else if((status_flags&(GIT_STATUS_IGNORED))>0)
status=STATUS::IGNORED;
#if LIBGIT2_SOVERSION>=23
else if((status_flags&(GIT_STATUS_CONFLICTED))>0)
status=STATUS::CONFLICTED;
#endif
else
status=STATUS::CURRENT;
@ -266,11 +249,7 @@ std::string Git::Repository::get_branch() noexcept {
void Git::initialize() noexcept {
std::lock_guard<std::mutex> lock(mutex);
if(!initialized) {
#if LIBGIT2_SOVERSION>=22
git_libgit2_init();
#else
git_threads_init();
#endif
initialized=true;
}
}

14
src/info.cc

@ -1,19 +1,5 @@
#include "info.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Info::Info() {
set_hexpand(false);
set_halign(Gtk::Align::ALIGN_END);

24
src/notebook.cc

@ -6,24 +6,7 @@
#include "project.h"
#include "filesystem.h"
#include "selection_dialog.h"
#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18)
#include "gtksourceview-3.0/gtksourceview/gtksourcemap.h"
#endif
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Notebook::TabLabel::TabLabel(const boost::filesystem::path &path, std::function<void()> on_close) {
set_can_focus(false);
@ -290,10 +273,9 @@ void Notebook::open(const boost::filesystem::path &file_path_, size_t notebook_i
scrolled_windows.back()->add(*source_views.back());
hboxes.back()->pack_start(*scrolled_windows.back());
#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18)
source_maps.emplace_back(Glib::wrap(gtk_source_map_new()));
gtk_source_map_set_view(GTK_SOURCE_MAP(source_maps.back()->gobj()), source_views.back()->gobj());
#endif
configure(source_views.size()-1);
//Set up tab label
@ -436,7 +418,6 @@ void Notebook::open(const boost::filesystem::path &file_path_, size_t notebook_i
}
void Notebook::configure(size_t index) {
#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18)
auto source_font_description=Pango::FontDescription(Config::get().source.font);
auto source_map_font_desc=Pango::FontDescription(static_cast<std::string>(source_font_description.get_family())+" "+Config::get().source.map_font_size);
source_maps.at(index)->override_font(source_map_font_desc);
@ -446,7 +427,6 @@ void Notebook::configure(size_t index) {
}
else if(hboxes.at(index)->get_children().size()==2)
hboxes.at(index)->remove(*source_maps.at(index));
#endif
}
bool Notebook::save(size_t index) {
@ -520,9 +500,7 @@ bool Notebook::close(size_t index) {
auto notebook_page=get_notebook_page(index);
notebooks[notebook_page.first].remove_page(notebook_page.second);
#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18)
source_maps.erase(source_maps.begin()+index);
#endif
if(on_close_page)
on_close_page(view);

14
src/selection_dialog.cc

@ -1,20 +1,6 @@
#include "selection_dialog.h"
#include <algorithm>
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
SelectionDialogBase::ListViewText::ListViewText(bool use_markup) : Gtk::TreeView(), use_markup(use_markup) {
list_store = Gtk::ListStore::create(column_record);
set_model(list_store);

18
src/source.cc

@ -15,20 +15,6 @@
#include <numeric>
#include <set>
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Glib::RefPtr<Gsv::Language> Source::guess_language(const boost::filesystem::path &file_path) {
auto language_manager=Gsv::LanguageManager::get_default();
bool result_uncertain = false;
@ -720,12 +706,10 @@ void Source::View::configure() {
property_show_line_numbers() = Config::get().source.show_line_numbers;
if(Config::get().source.font.size()>0)
override_font(Pango::FontDescription(Config::get().source.font));
#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 16)
if(Config::get().source.show_background_pattern)
gtk_source_view_set_background_pattern(this->gobj(), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID);
else
gtk_source_view_set_background_pattern(this->gobj(), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE);
#endif
//Create tags for diagnostic warnings and errors:
auto scheme = get_source_buffer()->get_style_scheme();
@ -762,9 +746,7 @@ void Source::View::configure() {
error_property=style->property_background().get_value();
diagnostic_tag_underline->property_underline()=Pango::Underline::UNDERLINE_ERROR;
#if GTK_VERSION_GE(3, 16)
diagnostic_tag_underline->set_property("underline-rgba", Gdk::RGBA(error_property));
#endif
}
//TODO: clear tag_class and param_spec?

16
src/source_clang.cc

@ -11,20 +11,6 @@
#include "selection_dialog.h"
#include "filesystem.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
clangmm::Index Source::ClangViewParse::clang_index(0, 0);
Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language):
@ -227,7 +213,7 @@ std::vector<std::string> Source::ClangViewParse::get_compilation_commands() {
auto clang_version=sm[1].str();
arguments.emplace_back("-I/usr/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-I/usr/lib64/clang/"+clang_version+"/include"); // For Fedora
#if defined(__APPLE__) && CINDEX_VERSION_MAJOR==0 && CINDEX_VERSION_MINOR<32
#if defined(__APPLE__) && CINDEX_VERSION_MAJOR==0 && CINDEX_VERSION_MINOR<32 // TODO: remove during 2018 if llvm3.7 is no longer in homebrew (CINDEX_VERSION_MINOR=32 equals clang-3.8 I think)
arguments.emplace_back("-I/usr/local/Cellar/llvm/"+clang_version+"/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1");
arguments.emplace_back("-I/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1"); //Added for OS X 10.11

14
src/source_diff.cc

@ -5,20 +5,6 @@
#include "info.h"
#include <boost/version.hpp>
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Source::DiffView::Renderer::Renderer() : Gsv::GutterRenderer() {
set_padding(4, 0);
}

14
src/source_spellcheck.cc

@ -4,20 +4,6 @@
#include "selection_dialog.h"
#include <iostream>
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
AspellConfig* Source::SpellCheckView::spellcheck_config=nullptr;
Source::SpellCheckView::SpellCheckView() : Gsv::View() {

14
src/tooltips.cc

@ -1,20 +1,6 @@
#include "tooltips.h"
#include "selection_dialog.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Gdk::Rectangle Tooltips::drawn_tooltips_rectangle=Gdk::Rectangle();
Tooltip::Tooltip(std::function<Glib::RefPtr<Gtk::TextBuffer>()> create_tooltip_buffer, Gtk::TextView *text_view,

16
src/window.cc

@ -11,20 +11,6 @@
#include "ctags.h"
#include "selection_dialog.h"
namespace sigc {
#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
template <typename Functor>
struct functor_trait<Functor, false> {
typedef decltype (::sigc::mem_fun(std::declval<Functor&>(),
&Functor::operator())) _intermediate;
typedef typename _intermediate::result_type result_type;
typedef Functor functor_type;
};
#else
SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE
#endif
}
Window::Window() {
set_title("juCi++");
set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK|Gdk::LEAVE_NOTIFY_MASK);
@ -93,9 +79,7 @@ Window::Window() {
auto overlay=Gtk::manage(new Gtk::Overlay());
overlay->add(*vbox);
overlay->add_overlay(*overlay_hbox);
#if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=18)
overlay->set_overlay_pass_through(*overlay_hbox, true);
#endif
add(*overlay);
show_all_children();

2
tests/CMakeLists.txt

@ -54,7 +54,7 @@ add_executable(source_key_test source_key_test.cc
target_link_libraries(source_key_test ${global_libraries})
add_test(source_key_test source_key_test)
if(LIBLLDB_FOUND AND (NOT LIBCLANG_LIBRARIES STREQUAL "/usr/lib/llvm-3.5/lib/libclang.so"))
if(LIBLLDB_FOUND)
add_executable(lldb_test lldb_test.cc
$<TARGET_OBJECTS:project_shared> $<TARGET_OBJECTS:stubs>)
target_link_libraries(lldb_test ${global_libraries})

Loading…
Cancel
Save