Changeset 3edaafe4051a0101b29a54b073c06b46e9e71e89
- Timestamp:
- 01/06/07 23:31:56 (6 years ago)
- Author:
- Philipp Kern <phil@…>
- Parents:
- 654b4976de6e507f77fdc8c3d46df0be62f72890
- Children:
- 9f3f19120242fc7ff56283a4b07f09c6216f192f
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:31:56Z+0000
- Message:
-
[project @ GtkSourceBuffer? wrapper]
Original author: Armin Burgmeier <armin@…>
Date: 2005-04-20 17:58:59+00:00
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r75296ef
|
r3edaafe
|
|
| 33 | 33 | if WITH_GTKSOURCEVIEW |
| 34 | 34 | noinst_HEADERS += inc/sourceview/sourceview.hpp |
| | 35 | noinst_HEADERS += inc/sourceview/sourcebuffer.hpp |
| 35 | 36 | noinst_HEADERS += inc/sourceview/private/sourceview_p.hpp |
| | 37 | noinst_HEADERS += inc/sourceview/private/sourcebuffer_p.hpp |
| 36 | 38 | endif |
| 37 | 39 | noinst_HEADERS += inc/icon.hpp |
| … |
… |
|
| 58 | 60 | if WITH_GTKSOURCEVIEW |
| 59 | 61 | gobby_SOURCES += src/sourceview/sourceview.cpp |
| | 62 | gobby_SOURCES += src/sourceview/sourcebuffer.cpp |
| 60 | 63 | endif |
| 61 | 64 | gobby_SOURCES += src/icon.cpp |
-
|
r75296ef
|
r3edaafe
|
|
| 25 | 25 | #include <gtkmm/textview.h> |
| 26 | 26 | #include <gtksourceview/gtksourceview.h> |
| | 27 | #include "sourceview/sourcebuffer.hpp" |
| 27 | 28 | |
| 28 | 29 | typedef struct _GtkSourceView GtkSourceView; |
| … |
… |
|
| 70 | 71 | public: |
| 71 | 72 | SourceView(); |
| 72 | | // explicit SourceView(const Glib::RefPtr<SourceBuffer>& buffer); |
| | 73 | explicit SourceView(const Glib::RefPtr<SourceBuffer>& buffer); |
| 73 | 74 | |
| 74 | | // Glib::RefPtr<SourceBuffer> get_buffer(); |
| 75 | | // Glib::RefPtr<const SourceBuffer> get_buffer() const; |
| 76 | | |
| | 75 | Glib::RefPtr<SourceBuffer> get_buffer(); |
| | 76 | Glib::RefPtr<const SourceBuffer> get_buffer() const; |
| | 77 | void set_buffer(const Glib::RefPtr<SourceBuffer> buffer); |
| | 78 | |
| | 79 | // TODO: Properties fuer das Zeug und so(?) |
| | 80 | bool get_show_line_numbers() const; |
| | 81 | void set_show_line_numbers(bool show_line_numbers); |
| 77 | 82 | }; |
| 78 | 83 | |
-
|
rbfb82f7
|
r3edaafe
|
|
| 22 | 22 | : Gtk::ScrolledWindow(), m_doc(doc), m_editing(true) |
| 23 | 23 | { |
| | 24 | #ifdef WITH_GTKSOURCEVIEW |
| | 25 | m_view.set_show_line_numbers(true); |
| | 26 | #endif |
| | 27 | |
| 24 | 28 | Glib::RefPtr<Gtk::TextBuffer> buf = m_view.get_buffer(); |
| 25 | 29 | |
-
|
r75296ef
|
r3edaafe
|
|
| 50 | 50 | : Gtk::TextView(Glib::ConstructParams(sourceview_class_.init())) |
| 51 | 51 | { |
| | 52 | // gtkmm-magic creates a GtkTextBuffer instead of a GtkSourceBuffer |
| | 53 | // I could not figure out why, but this line fixes this issue... |
| | 54 | // - armin |
| | 55 | set_buffer(SourceBuffer::create() ); |
| 52 | 56 | } |
| 53 | 57 | |
| … |
… |
|
| 62 | 66 | } |
| 63 | 67 | |
| 64 | | /*Gtk::SourceView::SourceView(const Glib::RefPtr<SourceBuffer>& buffer) |
| 65 | | Gtk::TextView(Glib::ConstructParams(sourceview_class_.init(), (char*)0)) |
| | 68 | Gtk::SourceView::SourceView(const Glib::RefPtr<SourceBuffer>& buffer) |
| | 69 | : Gtk::TextView(Glib::ConstructParams(sourceview_class_.init(), (char*)0)) |
| 66 | 70 | { |
| 67 | 71 | set_buffer(buffer); |
| 68 | | }*/ |
| | 72 | } |
| 69 | 73 | |
| 70 | 74 | Gtk::SourceView::~SourceView() |
| 71 | 75 | { |
| 72 | | // TODO: TextView-dtor calls destroy_ as well... |
| 73 | 76 | destroy_(); |
| 74 | 77 | } |
| … |
… |
|
| 84 | 87 | } |
| 85 | 88 | |
| 86 | | /*Glib::RefPtr<Gtk::SourceBuffer> Gtk::SourceView::get_buffer() |
| | 89 | Glib::RefPtr<Gtk::SourceBuffer> Gtk::SourceView::get_buffer() |
| 87 | 90 | { |
| 88 | | return Glib::RefPtr<Gtk::SourceBuffer>::cast_static(Gtk::TextView::get_buffer() ); |
| | 91 | return Glib::RefPtr<Gtk::SourceBuffer> |
| | 92 | ::cast_static(Gtk::TextView::get_buffer() ); |
| 89 | 93 | } |
| 90 | 94 | |
| 91 | 95 | Glib::RefPtr<const Gtk::SourceBuffer> Gtk::SourceView::get_buffer() const |
| 92 | 96 | { |
| 93 | | return Glib::RefPtr<Gtk::SourceBuffer>::cast_static(Gtk::TextView::get_buffer() ); |
| | 97 | return Glib::RefPtr<const Gtk::SourceBuffer> |
| | 98 | ::cast_static(Gtk::TextView::get_buffer() ); |
| 94 | 99 | } |
| 95 | | */ |
| | 100 | |
| | 101 | void Gtk::SourceView::set_buffer(const Glib::RefPtr<SourceBuffer> buffer) |
| | 102 | { |
| | 103 | Gtk::TextView::set_buffer(buffer); |
| | 104 | } |
| | 105 | |
| | 106 | bool Gtk::SourceView::get_show_line_numbers() const |
| | 107 | { |
| | 108 | return gtk_source_view_get_show_line_numbers( |
| | 109 | GTK_SOURCE_VIEW(gobject_) ) == TRUE; |
| | 110 | } |
| | 111 | |
| | 112 | void Gtk::SourceView::set_show_line_numbers(bool show_line_numbers) |
| | 113 | { |
| | 114 | gtk_source_view_set_show_line_numbers( |
| | 115 | gobj(), |
| | 116 | show_line_numbers ? TRUE : FALSE |
| | 117 | ); |
| | 118 | } |
| | 119 | |
| | 120 | Gtk::SourceView* Glib::wrap(GtkSourceView* object, bool take_copy) |
| | 121 | { |
| | 122 | return dynamic_cast<Gtk::SourceView*>(Glib::wrap_auto( |
| | 123 | reinterpret_cast<GObject*>(object), |
| | 124 | take_copy |
| | 125 | ) ); |
| | 126 | } |