[nemiver] Dropped compat code with gtksourceviewmm < 2.10
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Dropped compat code with gtksourceviewmm < 2.10
- Date: Sat, 2 Apr 2011 08:26:50 +0000 (UTC)
commit 3ab68cd4711f497990651ef3f6fd2fbb2e16095a
Author: Kalev Lember <kalevlember gmail com>
Date: Wed Mar 23 18:44:20 2011 +0200
Dropped compat code with gtksourceviewmm < 2.10
* configure.ac: Removed checks for gtksourceviewmm-1.0 and
gtksourceviewmm < 2.10.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::Priv::editor_style)
(DBGPerspective::Priv::modify_source_editor_style)
(DBGPerspective::Priv::get_editor_style): Define
unconditionally. Remove ifdef WITH_SOURCEVIEWMM2.
(DBGPerspective::on_conf_key_changed_signal): Use
SourceBuffer::set_highlight_syntax from ifdef WITH_SOURCEVIEWMM2
drop use of SourceBuffer::set_highlight. Also, unconditionally
handle CONF_KEY_EDITOR_STYLE_SCHEME conf key. Drop the ifdef
WITH_SOURCEVIEWMM2.
(DBGPerspective::read_default_config): Unconditionally handle
style scheme. Drop the WITH_SOURCEVIEWMM2.
(DBGPerspective::create_source_editor): Unconditionally keep the
WITH_SOURCEVIEWMM2 version of the code. Drop the ifdef.
* src/persp/dbgperspective/nmv-preferences-dialog.cc:
Unconditionally include
gtksourceviewmm/sourcestyleschememanager.h. Remove ifdef
WITH_SOURCEVIEWMM2.
* src/uicommon/nmv-source-editor.cc
(on_line_mark_activated_signal): Unconditionally declare this.
Drop the ifdef WITH_SOURCEVIEW_2_10.
(class Sourceview): Remove ifdef WITH_SOURCEVIEW around friend
declaration of on_line_mark_activated_signal.
(SourceView::SourceView): Unconditionally connect to signal
SourceView::line-mark-activated. Remove ifdef WITH_SOURCEVIEW.
(SourceView::do_custom_button_press_event_handling):
Unconditionally remove. Remove #if (WITH_SOURCEVIEWMM2 &&
!WITH_SOURCEVIEW_2_10).
(SourceView::on_button_press_event): unconditionally Remove call
to do_custom_button_press_event_handling. Remove #if
(WITH_SOURCEVIEWMM2 && !WITH_SOURCEVIEW_2_10).
(on_line_mark_activated_signal): Unconditionally define. Remove
#if WITH_SOURCEVIEW_2_10.
(SourceEditor::setup_buffer_mime_and_lang)
(SourceEditor::load_file): Unconditionally keep the code inside
#ifdef WITH_SOURCEVIEWMM2 branch. Drop the code in the #else
branch. Drop the #ifdef completely.
configure.ac | 32 ++--------
src/persp/dbgperspective/nmv-dbg-perspective.cc | 30 +---------
src/persp/dbgperspective/nmv-preferences-dialog.cc | 2 -
src/uicommon/nmv-source-editor.cc | 64 --------------------
4 files changed, 6 insertions(+), 122 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 90e3e43..bdd0928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,10 +48,8 @@ LIBGTK_VERSION=2.22
AC_SUBST([LIBGTK_VERSION])
LIBGTKMM_VERSION=2.20
AC_SUBST([LIBGTKMM_VERSION])
-LIBGTKSOURCEVIEWMM1_VERSION=0.3.0
-AC_SUBST([LIBGTKSOURCEVIEWMM1_VERSION])
-LIBGTKSOURCEVIEWMM2_VERSION=1.9.4
-AC_SUBST([LIBGTKSOURCEVIEWMM2_VERSION])
+LIBGTKSOURCEVIEWMM_VERSION=2.10
+AC_SUBST([LIBGTKSOURCEVIEWMM_VERSION])
LIBGIOMM_VERSION=2.15.2
AC_SUBST([LIBGIOMM_VERSION])
SQLITE3_VERSION=3.0
@@ -176,25 +174,6 @@ fi
AM_CONDITIONAL(BUILD_MEMORYVIEW, test x$ENABLE_MEMORYVIEW = xyes)
-AC_ARG_ENABLE(sourceviewmm2,
- AS_HELP_STRING([--enable-sourceviewmm2=yes|no],
- [use gtksourceviewmm-2.0 (default is auto)]),
- ENABLE_SOURCEVIEWMM2=$enableval,
- [PKG_CHECK_EXISTS([gtksourceviewmm-2.0 >= $LIBGTKSOURCEVIEWMM2_VERSION], [ENABLE_SOURCEVIEWMM2=yes], [ENABLE_SOURCEVIEWMM2=no])])
-if test x$ENABLE_SOURCEVIEWMM2 = xyes ; then
- AC_DEFINE([WITH_SOURCEVIEWMM2], 1, [build with gtksourceviewmm 2.x instead of 1.x])
- LIBGTKSOURCEVIEWMM_VERSION=$LIBGTKSOURCEVIEWMM2_VERSION
- LIBGTKSOURCEVIEWMM_PKG=gtksourceviewmm-2.0
- PKG_CHECK_EXISTS([gtksourceview-2.0 >= 2.10], [ENABLE_SOURCEVIEW_2_10=yes], [ENABLE_SOURCEVIEW_2_10=no])
- if test x$ENABLE_SOURCEVIEW_2_10 = xyes; then
- AC_DEFINE(WITH_SOURCEVIEW_2_10, 1, [build with gtksourceview higher than 2.10])
- fi
-else
- ENABLE_SOURCEVIEWMM2=no
- LIBGTKSOURCEVIEWMM_VERSION=$LIBGTKSOURCEVIEWMM1_VERSION
- LIBGTKSOURCEVIEWMM_PKG=libgtksourceviewmm-1.0
-fi
-
ENABLE_DEBUG=yes
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug=yes|no],
@@ -255,7 +234,7 @@ fi
if test x$ENABLE_WORKBENCH = xyes ; then
DEP_WORKBENCH=" gtkmm-2.4 >= $LIBGTKMM_VERSION \
- $LIBGTKSOURCEVIEWMM_PKG >= $LIBGTKSOURCEVIEWMM_VERSION"
+ gtksourceviewmm-2.0 >= $LIBGTKSOURCEVIEWMM_VERSION"
fi
if test x$ENABLE_MEMORYVIEW = xyes ; then
@@ -286,7 +265,7 @@ AC_SUBST(NEMIVERCOMMON_CFLAGS)
dnl library dependencies for the nemiver common UI module
DEP_UICOMMON=" gtkmm-2.4 >= $LIBGTKMM_VERSION \
gtk+-2.0 >= $LIBGTK_VERSION \
- $LIBGTKSOURCEVIEWMM_PKG >= $LIBGTKSOURCEVIEWMM_VERSION \
+ gtksourceviewmm-2.0 >= $LIBGTKSOURCEVIEWMM_VERSION \
vte >= $LIBVTE_VERSION"
PKG_CHECK_MODULES(NEMIVERUICOMMON, $DEP_UICOMMON $DEP_COMMON $DEP_MEMORYVIEW)
@@ -309,7 +288,7 @@ AC_SUBST(NEMIVERWORKBENCH_LIBS)
AC_SUBST(NEMIVERWORKBENCH_CFLAGS)
dnl library dependencies for the nemiver debug perspective plugin
-DEP_PERSP="$LIBGTKSOURCEVIEWMM_PKG >= $LIBGTKSOURCEVIEWMM_VERSION \
+DEP_PERSP="gtksourceviewmm-2.0 >= $LIBGTKSOURCEVIEWMM_VERSION \
vte >= $LIBVTE_VERSION"
PKG_CHECK_MODULES(NEMIVERDBGPERSP, $DEP_UICOMMON $DEP_VFS $DEP_PERSP $DEP_MEMORYVIEW)
@@ -468,7 +447,6 @@ AC_MSG_NOTICE([
Enable verbose debug messages : ${ENABLE_DEBUG}
Enable workbench : ${ENABLE_WORKBENCH}
Enable memory view : ${ENABLE_MEMORYVIEW} (requires gtkhex > $GTKHEX_VERSION)
- gtksourceviewmm version : ${LIBGTKSOURCEVIEWMM_PKG}
Enable symbols visibility ctrl : ${ENABLE_GCC_SYMBOLS_VISIBILITY}
Maintainer mode : ${USER_MAINTAINER_MODE}
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 86e93a4..bcbda7e 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -39,12 +39,8 @@
#include <giomm/contenttype.h>
#include <gtksourceviewmm/init.h>
-#ifdef WITH_SOURCEVIEWMM2
#include <gtksourceviewmm/sourcelanguagemanager.h>
#include <gtksourceviewmm/sourcestyleschememanager.h>
-#else
-#include <gtksourceviewmm/sourcelanguagesmanager.h>
-#endif // WITH_SOURCEVIEWMM2
#include <pangomm/fontdescription.h>
#include <gtkmm/clipboard.h>
@@ -937,9 +933,7 @@ struct DBGPerspective::Priv {
bool use_launch_terminal;
int num_instr_to_disassemble;
bool asm_style_pure;
-#ifdef WITH_SOURCEVIEWMM2
Glib::RefPtr<gtksourceview::SourceStyleScheme> editor_style;
-#endif // WITH_SOURCEVIEWMM2
sigc::connection timeout_source_connection;
//**************************************
//<detect mouse immobility > N seconds
@@ -1013,7 +1007,6 @@ struct DBGPerspective::Priv {
}
-#ifdef WITH_SOURCEVIEWMM2
void
modify_source_editor_style (Glib::RefPtr<gtksourceview::SourceStyleScheme> a_style_scheme)
{
@@ -1030,7 +1023,6 @@ struct DBGPerspective::Priv {
}
}
}
-#endif // WITH_SOURCEVIEWMM2
void
modify_source_editor_fonts (const UString &a_font_name)
@@ -1056,13 +1048,11 @@ struct DBGPerspective::Priv {
#endif // WITH_MEMORYVIEW
}
-#ifdef WITH_SOURCEVIEWMM2
Glib::RefPtr<gtksourceview::SourceStyleScheme>
get_editor_style ()
{
return editor_style;
}
-#endif // WITH_SOURCEVIEWMM2
Glib::ustring
get_source_font_name ()
@@ -2257,12 +2247,8 @@ DBGPerspective::on_conf_key_changed_signal (const UString &a_key,
it != m_priv->pagenum_2_source_editor_map.end ();
++it) {
if (it->second && it->second->source_view ().get_buffer ()) {
-#ifdef WITH_SOURCEVIEWMM2
it->second->source_view ().get_source_buffer
()->set_highlight_syntax
-#else
- it->second->source_view ().get_source_buffer ()->set_highlight
-#endif // WITH_SOURCEVIEWMM2
(boost::get<bool> (a_value));
}
}
@@ -2292,7 +2278,6 @@ DBGPerspective::on_conf_key_changed_signal (const UString &a_key,
if (m_priv->debugger_engine_alive) {
debugger ()->set_tty_path (get_terminal_name ());
}
-#ifdef WITH_SOURCEVIEWMM2
} else if (a_key == CONF_KEY_EDITOR_STYLE_SCHEME) {
UString style_id = boost::get<UString> (a_value);
if (!style_id.empty ()) {
@@ -2301,9 +2286,7 @@ DBGPerspective::on_conf_key_changed_signal (const UString &a_key,
()->get_scheme (style_id);
m_priv->modify_source_editor_style (m_priv->editor_style);
}
- }
-#endif // WITH_SOURCEVIEWMM2
- else if (a_key == CONF_KEY_DEFAULT_NUM_ASM_INSTRS) {
+ } else if (a_key == CONF_KEY_DEFAULT_NUM_ASM_INSTRS) {
// m_priv->num_instr_to_disassemble must never be NULL!
int val = boost::get<int> (a_value);
if (val != 0)
@@ -4845,7 +4828,6 @@ DBGPerspective::read_default_config ()
m_priv->asm_style_pure);
NEMIVER_CATCH_NOX
-#ifdef WITH_SOURCEVIEWMM2
UString style_id ("classic");
NEMIVER_TRY
@@ -4854,7 +4836,6 @@ DBGPerspective::read_default_config ()
m_priv->editor_style = gtksourceview::SourceStyleSchemeManager::get_default
()->get_scheme (style_id);
-#endif // WITH_SOURCEVIEWMM2
default_config_read_signal ().emit ();
}
@@ -5349,17 +5330,10 @@ DBGPerspective::create_source_editor (Glib::RefPtr<SourceBuffer> &a_source_buf,
Gtk::TextIter cur_line_iter =
a_source_buf->get_iter_at_line (current_line);
if (cur_line_iter) {
-#ifdef WITH_SOURCEVIEWMM2
Glib::RefPtr<SourceMark> where_marker =
a_source_buf->create_source_mark (WHERE_MARK,
WHERE_CATEGORY,
cur_line_iter);
-#else
- Glib::RefPtr<SourceMarker> where_marker =
- source_buffer->create_marker (WHERE_MARK,
- WHERE_CATEGORY,
- cur_line_iter);
-#endif // WITH_SOURCEVIEWMM2
THROW_IF_FAIL (where_marker);
}
}
@@ -5378,12 +5352,10 @@ DBGPerspective::create_source_editor (Glib::RefPtr<SourceBuffer> &a_source_buf,
Pango::FontDescription font_desc (m_priv->get_source_font_name ());
source_editor->source_view ().modify_font (font_desc);
}
-#ifdef WITH_SOURCEVIEWMM2
if (m_priv->get_editor_style ()) {
source_editor->source_view ().get_source_buffer ()->set_style_scheme
(m_priv->get_editor_style ());
}
-#endif // WITH_SOURCEVIEWMM2
source_editor->set_path (a_path);
source_editor->marker_region_got_clicked_signal ().connect
(sigc::bind
diff --git a/src/persp/dbgperspective/nmv-preferences-dialog.cc b/src/persp/dbgperspective/nmv-preferences-dialog.cc
index c880804..8b70ef3 100644
--- a/src/persp/dbgperspective/nmv-preferences-dialog.cc
+++ b/src/persp/dbgperspective/nmv-preferences-dialog.cc
@@ -31,9 +31,7 @@
#include "nmv-i-conf-mgr.h"
#include "nmv-i-workbench.h"
#include "nmv-conf-keys.h"
-#ifdef WITH_SOURCEVIEWMM2
#include <gtksourceviewmm/sourcestyleschememanager.h>
-#endif
using nemiver::common::DynamicModuleManager;
static const std::string DEFAULT_GDB_BINARY = "default-gdb-binary";
diff --git a/src/uicommon/nmv-source-editor.cc b/src/uicommon/nmv-source-editor.cc
index 2931af1..e696476 100644
--- a/src/uicommon/nmv-source-editor.cc
+++ b/src/uicommon/nmv-source-editor.cc
@@ -30,12 +30,8 @@
#include <gtkmm/scrolledwindow.h>
#include <gtksourceviewmm/sourcemark.h>
#include <gtksourceviewmm/sourceiter.h>
-#ifdef WITH_SOURCEVIEWMM2
#include <gtksourceviewmm/sourcelanguagemanager.h>
#include <gtksourceviewmm/sourcestyleschememanager.h>
-#else
-#include <gtksourceviewmm/sourcelanguagesmanager.h>
-#endif // WITH_SOURCEVIEWMM2
#include <giomm/file.h>
#include <giomm/contenttype.h>
#include "common/nmv-exception.h"
@@ -62,24 +58,20 @@ const char* WHERE_CATEGORY = "line-pointer-category";
const char* WHERE_MARK = "where-marker";
-#ifdef WITH_SOURCEVIEW_2_10
void
on_line_mark_activated_signal (GtkSourceView *a_view,
GtkTextIter *a_iter,
GdkEvent *a_event,
gpointer a_pointer);
-#endif
class SourceView : public gtksourceview::SourceView
{
sigc::signal<void, int, bool> m_marker_region_got_clicked_signal;
-#ifdef WITH_SOURCEVIEW_2_10
friend void on_line_mark_activated_signal (GtkSourceView *a_view,
GtkTextIter *a_iter,
GdkEvent *a_event,
gpointer a_pointer);
-#endif
public:
SourceView (Glib::RefPtr<SourceBuffer> &a_buf) :
@@ -87,12 +79,10 @@ public:
{
init_font ();
enable_events ();
-#ifdef WITH_SOURCEVIEW_2_10
g_signal_connect (gobj (),
"line-mark-activated",
G_CALLBACK (&on_line_mark_activated_signal),
this);
-#endif
}
SourceView () :
@@ -113,42 +103,6 @@ public:
|Gdk::BUTTON_PRESS_MASK);
}
-#if (WITH_SOURCEVIEWMM2 && !WITH_SOURCEVIEW_2_10)
- void do_custom_button_press_event_handling (GdkEventButton *a_event)
- {
- THROW_IF_FAIL (a_event);
-
- if (a_event->type == GDK_BUTTON_PRESS
- && a_event->button != 1) {
- // We are only intersted in the left button press here
- return;
- }
- Glib::RefPtr<Gdk::Window> markers_window =
- get_window (Gtk::TEXT_WINDOW_LEFT);
- THROW_IF_FAIL (markers_window);
-
- if (markers_window.operator->()->gobj () != a_event->window) {
- LOG_DD ("didn't clicked in markers region");
- return;
- }
- LOG_DD ("got clicked in markers region !");
- Gtk::TextBuffer::iterator iter;
- int line_top=0, x=0, y=0;
-
- window_to_buffer_coords (Gtk::TEXT_WINDOW_LEFT,
- (int)a_event->x, (int)a_event->y, x, y);
-
- get_line_at_y (iter, (int) y, line_top);
-
- THROW_IF_FAIL (iter);
-
- LOG_DD ("got clicked on line: " << iter.get_line ());
- marker_region_got_clicked_signal ().emit (iter.get_line () + 1,
- false/*no dialog requested*/);
- }
-#endif
-
-
bool on_button_press_event (GdkEventButton *a_event)
{
if (a_event->type == GDK_BUTTON_PRESS
@@ -157,9 +111,6 @@ public:
return false;
} else {
Gtk::Widget::on_button_press_event (a_event);
-#if (WITH_SOURCEVIEWMM2 && !WITH_SOURCEVIEW_2_10)
- do_custom_button_press_event_handling (a_event);
-#endif
return false;
}
}
@@ -171,7 +122,6 @@ public:
};//end class Sourceview
-#if WITH_SOURCEVIEW_2_10
void
on_line_mark_activated_signal (GtkSourceView *a_view,
GtkTextIter *a_iter,
@@ -188,7 +138,6 @@ on_line_mark_activated_signal (GtkSourceView *a_view,
(gtk_text_iter_get_line (a_iter) + 1,
false/*No dialog requested*/);
}
-#endif
struct SourceEditor::Priv {
Sequence sequence;
@@ -1298,15 +1247,9 @@ SourceEditor::setup_buffer_mime_and_lang (Glib::RefPtr<SourceBuffer> &a_buf,
{
NEMIVER_TRY
-#ifdef WITH_SOURCEVIEWMM2
Glib::RefPtr<SourceLanguageManager> lang_manager =
SourceLanguageManager::get_default ();
-#else
- Glib::RefPtr<SourceLanguagesManager> lang_manager =
- SourceLanguagesManager::create ();
-#endif // WITH_SOURCEVIEWMM2
Glib::RefPtr<SourceLanguage> lang;
- #ifdef WITH_SOURCEVIEWMM2
std::list<Glib::ustring> lang_ids = lang_manager->get_language_ids ();
for (std::list<Glib::ustring>::const_iterator it = lang_ids.begin ();
it != lang_ids.end ();
@@ -1328,9 +1271,6 @@ SourceEditor::setup_buffer_mime_and_lang (Glib::RefPtr<SourceBuffer> &a_buf,
// we found a matching language, so stop looking for other languages
if (lang) break;
}
-#else
- lang = lang_manager->get_language_from_mime_type (mime_type);
-#endif // WITH_SOURCEVIEWMM2
if (!a_buf)
a_buf = SourceBuffer::create (lang);
@@ -1420,11 +1360,7 @@ SourceEditor::load_file (const UString &a_path,
a_source_buffer->set_text (utf8_content);
LOG_DD ("file loaded. Read " << (int)nb_bytes << " bytes");
-#ifdef WITH_SOURCEVIEWMM2
a_source_buffer->set_highlight_syntax (a_enable_syntax_highlight);
-#else
- a_source_buffer->set_highlight (a_enable_syntax_highlight);
-#endif // WITH_SOURCEVIEWMM2
NEMIVER_CATCH_AND_RETURN (false);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]