[gnome-builder] libide: nothing to see here



commit 1171faed9e1c2ca82d009afd064c46605764a9a6
Author: Christian Hergert <christian hergert me>
Date:   Wed Mar 4 23:59:05 2015 -0800

    libide: nothing to see here
    
    Animate the line copy like we do for snippets.

 data/keybindings/vim.css |    1 +
 libide/ide-source-view.c |   34 ++++++++++++++++++++++++++++++++++
 libide/ide-source-view.h |    1 +
 3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index abdf52a..4a69204 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -178,6 +178,7 @@
              "movement" (last-char, 1)
              "move-cursor" (visual-positions, 1, 1)
              "copy-clipboard" ()
+             "selection-theatric" ()
              "clear-selection" ()
              "restore-insert-mark" () };
 }
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 7476e5f..9a7a0e4 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -118,6 +118,7 @@ enum {
   POP_SNIPPET,
   RESTORE_INSERT_MARK,
   SAVE_INSERT_MARK,
+  SELECTION_THEATRIC,
   SET_MODE,
   SET_OVERWRITE,
   LAST_SIGNAL
@@ -1667,6 +1668,28 @@ ide_source_view_real_jump (IdeSourceView     *self,
 }
 
 static void
+ide_source_view_real_selection_theatric (IdeSourceView *self)
+{
+  GtkTextBuffer *buffer;
+  GtkTextIter begin;
+  GtkTextIter end;
+
+  g_assert (IDE_IS_SOURCE_VIEW (self));
+
+  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self));
+  gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
+  gtk_text_iter_order (&begin, &end);
+
+  if (gtk_text_iter_equal (&begin, &end))
+    return;
+
+  if (gtk_text_iter_starts_line (&end))
+    gtk_text_iter_backward_char (&end);
+
+  animate_in (self, &begin, &end);
+}
+
+static void
 ide_source_view_real_set_mode (IdeSourceView         *self,
                                const gchar           *mode,
                                IdeSourceViewModeType  type)
@@ -1978,6 +2001,7 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
   klass->movement = ide_source_view_real_movement;
   klass->restore_insert_mark = ide_source_view_real_restore_insert_mark;
   klass->save_insert_mark = ide_source_view_real_save_insert_mark;
+  klass->selection_theatric = ide_source_view_real_selection_theatric;
   klass->set_mode = ide_source_view_real_set_mode;
   klass->set_overwrite = ide_source_view_real_set_overwrite;
 
@@ -2178,6 +2202,16 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
                   G_TYPE_NONE,
                   0);
 
+  gSignals [SELECTION_THEATRIC] =
+    g_signal_new ("selection-theatric",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  G_STRUCT_OFFSET (IdeSourceViewClass, selection_theatric),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE,
+                  0);
+
   gSignals [SET_MODE] =
     g_signal_new ("set-mode",
                   G_TYPE_FROM_CLASS (klass),
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index 4576f6d..bcc3ae6 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -187,6 +187,7 @@ struct _IdeSourceViewClass
                                        const GtkTextIter       *location);
   void (*restore_insert_mark)         (IdeSourceView           *self);
   void (*save_insert_mark)            (IdeSourceView           *self);
+  void (*selection_theatric)          (IdeSourceView           *self);
   void (*set_mode)                    (IdeSourceView           *self,
                                        const gchar             *mode,
                                        IdeSourceViewModeType    type);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]