[latexila/wip/gtef] DocumentView: subclass GtefView
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/wip/gtef] DocumentView: subclass GtefView
- Date: Sat, 22 Oct 2016 08:24:31 +0000 (UTC)
commit 5fdcb30a2356b795dac50e35b885516d9b271a02
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Oct 22 10:17:14 2016 +0200
DocumentView: subclass GtefView
src/document_view.vala | 51 +--------------------------------------------
src/main_window_edit.vala | 8 +++---
2 files changed, 5 insertions(+), 54 deletions(-)
---
diff --git a/src/document_view.vala b/src/document_view.vala
index d2ddbab..d396ae0 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -19,10 +19,8 @@
using Gtk;
-public class DocumentView : Gtk.SourceView
+public class DocumentView : Gtef.View
{
- public const double SCROLL_MARGIN = 0.02;
-
private const string METADATA_ATTRIBUTE_SPELL_LANGUAGE =
"metadata::latexila-spell-language";
private const string METADATA_ATTRIBUTE_INLINE_SPELL =
@@ -93,53 +91,6 @@ public class DocumentView : Gtk.SourceView
button_release_event.connect (on_button_release_event);
}
- public void scroll_to_cursor (double margin = 0.25)
- {
- scroll_to_mark (this.buffer.get_insert (), margin, false, 0, 0);
- }
-
- public void cut_selection ()
- {
- return_if_fail (this.buffer != null);
- Clipboard clipboard = get_clipboard (Gdk.SELECTION_CLIPBOARD);
- this.buffer.cut_clipboard (clipboard, ! ((Document) this.buffer).readonly);
- scroll_to_cursor (SCROLL_MARGIN);
- grab_focus ();
- }
-
- public void copy_selection ()
- {
- return_if_fail (this.buffer != null);
- Clipboard clipboard = get_clipboard (Gdk.SELECTION_CLIPBOARD);
- this.buffer.copy_clipboard (clipboard);
- grab_focus ();
- }
-
- public void my_paste_clipboard ()
- {
- return_if_fail (this.buffer != null);
- Clipboard clipboard = get_clipboard (Gdk.SELECTION_CLIPBOARD);
- this.buffer.paste_clipboard (clipboard, null,
- ! ((Document) this.buffer).readonly);
- scroll_to_cursor (SCROLL_MARGIN);
- grab_focus ();
- }
-
- public void delete_selection ()
- {
- return_if_fail (this.buffer != null);
- this.buffer.delete_selection (true, ! ((Document) this.buffer).readonly);
- scroll_to_cursor (SCROLL_MARGIN);
- }
-
- public void my_select_all ()
- {
- return_if_fail (this.buffer != null);
- TextIter start, end;
- this.buffer.get_bounds (out start, out end);
- this.buffer.select_range (start, end);
- }
-
public void set_font_from_settings ()
{
string font;
diff --git a/src/main_window_edit.vala b/src/main_window_edit.vala
index efb82a8..97bb89f 100644
--- a/src/main_window_edit.vala
+++ b/src/main_window_edit.vala
@@ -203,19 +203,19 @@ public class MainWindowEdit
public void on_cut ()
{
return_if_fail (_main_window.active_tab != null);
- _main_window.active_view.cut_selection ();
+ _main_window.active_view.cut_clipboard ();
}
public void on_copy ()
{
return_if_fail (_main_window.active_tab != null);
- _main_window.active_view.copy_selection ();
+ _main_window.active_view.copy_clipboard ();
}
public void on_paste ()
{
return_if_fail (_main_window.active_tab != null);
- _main_window.active_view.my_paste_clipboard ();
+ _main_window.active_view.paste_clipboard ();
}
public void on_delete ()
@@ -227,7 +227,7 @@ public class MainWindowEdit
public void on_select_all ()
{
return_if_fail (_main_window.active_tab != null);
- _main_window.active_view.my_select_all ();
+ _main_window.active_view.select_all ();
}
public void on_indent ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]