[gnome-builder/wip/minimap2: 2/6] minimap: alternate minimap implementation idea



commit 3910d6dca0b18db5a1b13a0f6327ded24ef29ecf
Author: Christian Hergert <christian hergert me>
Date:   Mon Apr 20 14:38:20 2015 -0700

    minimap: alternate minimap implementation idea
    
    This uses a second GtkSourceView with very small font for the minimap.
    
    It still has a lot of the same deficiencies of the other implementation.
    Including scrolling (no scrolledwindow yet), keeping the visible range
    center-ish, and more.

 data/ui/gb-editor-frame.ui           |  205 +++++++++++----------
 libide/Makefile.am                   |    2 +
 libide/ide-source-map.c              |  331 ++++++++++++++++++++++++++++++++++
 libide/ide-source-map.h              |   46 +++++
 libide/ide.h                         |    7 +-
 src/editor/gb-editor-frame-private.h |    1 +
 src/editor/gb-editor-frame.c         |    1 +
 7 files changed, 494 insertions(+), 99 deletions(-)
---
diff --git a/data/ui/gb-editor-frame.ui b/data/ui/gb-editor-frame.ui
index b134645..e4ac402 100644
--- a/data/ui/gb-editor-frame.ui
+++ b/data/ui/gb-editor-frame.ui
@@ -3,100 +3,106 @@
   <!-- interface-requires gtk+ 3.15 -->
   <template class="GbEditorFrame" parent="GtkBin">
     <child>
-      <object class="GtkOverlay">
-        <property name="expand">true</property>
+      <object class="GtkBox">
+        <property name="orientation">horizontal</property>
         <property name="visible">true</property>
-        <child type="overlay">
-          <object class="NautilusFloatingBar" id="floating_bar">
-            <property name="halign">end</property>
-            <property name="primary_label"></property>
-            <property name="valign">end</property>
+        <child>
+          <object class="GtkOverlay">
+            <property name="expand">true</property>
             <property name="visible">true</property>
-            <child>
-              <object class="GtkLabel" id="overwrite_label">
-                <!-- translators: OVR indicates we are in overwite mode -->
-                <property name="label" translatable="yes">OVR</property>
-                <property name="margin-start">12</property>
-                <property name="visible">false</property>
-              </object>
-              <packing>
-                <property name="pack-type">start</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="mode_name_label">
-                <property name="margin-start">12</property>
-                <property name="margin-end">3</property>
+            <child type="overlay">
+              <object class="NautilusFloatingBar" id="floating_bar">
+                <property name="halign">end</property>
+                <property name="primary_label"></property>
+                <property name="valign">end</property>
                 <property name="visible">true</property>
+                <child>
+                  <object class="GtkLabel" id="overwrite_label">
+                    <!-- translators: OVR indicates we are in overwite mode -->
+                    <property name="label" translatable="yes">OVR</property>
+                    <property name="margin-start">12</property>
+                    <property name="visible">false</property>
+                  </object>
+                  <packing>
+                    <property name="pack-type">start</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="mode_name_label">
+                    <property name="margin-start">12</property>
+                    <property name="margin-end">3</property>
+                    <property name="visible">true</property>
+                  </object>
+                  <packing>
+                    <property name="pack-type">start</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
-              <packing>
-                <property name="pack-type">start</property>
-                <property name="position">2</property>
-              </packing>
             </child>
-          </object>
-        </child>
-        <child type="overlay">
-          <object class="GtkRevealer" id="search_revealer">
-            <property name="halign">end</property>
-            <property name="valign">start</property>
-            <property name="visible">true</property>
-            <property name="width-request">300</property>
-            <child>
-              <object class="GtkFrame">
+            <child type="overlay">
+              <object class="GtkRevealer" id="search_revealer">
+                <property name="halign">end</property>
+                <property name="valign">start</property>
                 <property name="visible">true</property>
-                <property name="margin-end">12</property>
-                <style>
-                  <class name="gb-search-slider"/>
-                </style>
+                <property name="width-request">300</property>
                 <child>
-                  <object class="GtkBox">
-                    <property name="orientation">horizontal</property>
+                  <object class="GtkFrame">
                     <property name="visible">true</property>
+                    <property name="margin-end">12</property>
                     <style>
-                      <class name="linked"/>
+                      <class name="gb-search-slider"/>
                     </style>
                     <child>
-                      <object class="GdTaggedEntry" id="search_entry">
-                        <property name="visible">true</property>
-                        <property name="tag-close-visible">false</property>
-                        <property name="can-focus">true</property>
-                        <property name="width-request">260</property>
-                        <property name="primary-icon-activatable">true</property>
-                        <property name="primary-icon-sensitive">true</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkButton">
-                        <property name="action-name">frame.previous-search-result</property>
-                        <property name="can-focus">false</property>
+                      <object class="GtkBox">
+                        <property name="orientation">horizontal</property>
                         <property name="visible">true</property>
                         <style>
-                          <class name="image-button"/>
+                          <class name="linked"/>
                         </style>
                         <child>
-                          <object class="GtkImage">
-                            <property name="icon-name">go-up-symbolic</property>
-                            <property name="icon-size">1</property>
+                          <object class="GdTaggedEntry" id="search_entry">
                             <property name="visible">true</property>
+                            <property name="tag-close-visible">false</property>
+                            <property name="can-focus">true</property>
+                            <property name="width-request">260</property>
+                            <property name="primary-icon-activatable">true</property>
+                            <property name="primary-icon-sensitive">true</property>
                           </object>
                         </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkButton">
-                        <property name="action-name">frame.next-search-result</property>
-                        <property name="can-focus">false</property>
-                        <property name="visible">true</property>
-                        <style>
-                          <class name="image-button"/>
-                        </style>
                         <child>
-                          <object class="GtkImage">
-                            <property name="icon-name">go-down-symbolic</property>
-                            <property name="icon-size">1</property>
+                          <object class="GtkButton">
+                            <property name="action-name">frame.previous-search-result</property>
+                            <property name="can-focus">false</property>
                             <property name="visible">true</property>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="icon-name">go-up-symbolic</property>
+                                <property name="icon-size">1</property>
+                                <property name="visible">true</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkButton">
+                            <property name="action-name">frame.next-search-result</property>
+                            <property name="can-focus">false</property>
+                            <property name="visible">true</property>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="icon-name">go-down-symbolic</property>
+                                <property name="icon-size">1</property>
+                                <property name="visible">true</property>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -105,36 +111,43 @@
                 </child>
               </object>
             </child>
-          </object>
-        </child>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolled_window">
-            <property name="visible">true</property>
             <child>
-              <object class="IdeSourceView" id="source_view">
-                <property name="auto-indent">true</property>
-                <property name="enable-word-completion">true</property>
-                <property name="highlight-current-line">true</property>
-                <property name="insert-matching-brace">true</property>
-                <property name="overwrite-braces">true</property>
-                <property name="scroll-offset">0</property>
-                <property name="show-grid-lines">true</property>
-                <property name="show-line-changes">true</property>
-                <property name="show-line-numbers">true</property>
-                <property name="show-right-margin">true</property>
-                <property name="show-search-bubbles">true</property>
-                <property name="smart-backspace">true</property>
-                <property name="snippet-completion">true</property>
+              <object class="GtkScrolledWindow" id="scrolled_window">
                 <property name="visible">true</property>
-                <child internal-child="completion">
-                  <object class="GtkSourceCompletion">
-                    <property name="show-headers">false</property>
+                <child>
+                  <object class="IdeSourceView" id="source_view">
+                    <property name="auto-indent">true</property>
+                    <property name="enable-word-completion">true</property>
+                    <property name="highlight-current-line">true</property>
+                    <property name="insert-matching-brace">true</property>
+                    <property name="overwrite-braces">true</property>
+                    <property name="scroll-offset">0</property>
+                    <property name="show-grid-lines">true</property>
+                    <property name="show-line-changes">true</property>
+                    <property name="show-line-numbers">true</property>
+                    <property name="show-right-margin">true</property>
+                    <property name="show-search-bubbles">true</property>
+                    <property name="smart-backspace">true</property>
+                    <property name="snippet-completion">true</property>
+                    <property name="visible">true</property>
+                    <child internal-child="completion">
+                      <object class="GtkSourceCompletion">
+                        <property name="show-headers">false</property>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
             </child>
           </object>
         </child>
+        <child>
+          <object class="IdeSourceMap" id="source_map">
+            <property name="width-request">100</property>
+            <property name="view">source_view</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 30086ef..27faa1c 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -152,6 +152,8 @@ libide_1_0_la_public_sources = \
        libide/ide-service.h \
        libide/ide-source-location.c \
        libide/ide-source-location.h \
+        libide/ide-source-map.c \
+        libide/ide-source-map.h \
        libide/ide-source-range.c \
        libide/ide-source-range.h \
        libide/ide-source-snippet-chunk.c \
diff --git a/libide/ide-source-map.c b/libide/ide-source-map.c
new file mode 100644
index 0000000..4811ecc
--- /dev/null
+++ b/libide/ide-source-map.c
@@ -0,0 +1,331 @@
+/* ide-source-map.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-source-map"
+
+#include <glib/gi18n.h>
+
+#include "ide-macros.h"
+#include "ide-pango.h"
+#include "ide-source-map.h"
+
+#define DEFAULT_WIDTH 100
+
+struct _IdeSourceMap
+{
+  GtkSourceView         parent_instance;
+
+  PangoFontDescription *font_desc;
+  GtkSourceView        *view;
+  GtkCssProvider       *css_provider;
+};
+
+struct _IdeSourceMapClass
+{
+  GtkSourceViewClass parent_instance;
+};
+
+G_DEFINE_TYPE (IdeSourceMap, ide_source_map, GTK_SOURCE_TYPE_VIEW)
+
+enum {
+  PROP_0,
+  PROP_VIEW,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+/**
+ * ide_source_map_get_view:
+ *
+ * Gets the #IdeSourceMap:view property, which is the view this widget is mapping.
+ *
+ * Returns: (transfer none) (nullable): A #GtkSourceView or %NULL.
+ */
+GtkSourceView *
+ide_source_map_get_view (IdeSourceMap *self)
+{
+  g_return_val_if_fail (IDE_IS_SOURCE_MAP (self), NULL);
+
+  return self->view;
+}
+
+static void
+ide_source_map__view_vadj_value_changed (IdeSourceMap  *self,
+                                         GtkAdjustment *vadj)
+{
+  g_assert (IDE_IS_SOURCE_MAP (self));
+  g_assert (GTK_IS_ADJUSTMENT (vadj));
+
+  gtk_widget_queue_draw (GTK_WIDGET (self));
+}
+
+void
+ide_source_map_set_view (IdeSourceMap  *self,
+                         GtkSourceView *view)
+{
+  g_return_if_fail (IDE_IS_SOURCE_MAP (self));
+  g_return_if_fail (!view || GTK_SOURCE_IS_VIEW (view));
+
+  if (ide_set_weak_pointer (&self->view, view))
+    {
+      if (view != NULL)
+        {
+          GtkAdjustment *vadj;
+
+          g_object_bind_property (view, "buffer",
+                                  self, "buffer",
+                                  G_BINDING_SYNC_CREATE);
+          g_object_bind_property (view, "indent-width",
+                                  self, "indent-width",
+                                  G_BINDING_SYNC_CREATE);
+          g_object_bind_property (view, "tab-width",
+                                  self, "tab-width",
+                                  G_BINDING_SYNC_CREATE);
+
+          vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (view));
+          g_signal_connect_object (vadj,
+                                   "value-changed",
+                                   G_CALLBACK (ide_source_map__view_vadj_value_changed),
+                                   self,
+                                   G_CONNECT_SWAPPED);
+        }
+      g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_VIEW]);
+    }
+}
+
+static void
+ide_source_map_set_font_desc (IdeSourceMap               *self,
+                              const PangoFontDescription *font_desc)
+{
+  g_assert (IDE_IS_SOURCE_MAP (self));
+  g_assert (font_desc != NULL);
+
+  g_clear_pointer (&self->font_desc, pango_font_description_free);
+
+  if (!self->css_provider)
+    {
+      GtkStyleContext *style_context;
+
+      self->css_provider = gtk_css_provider_new ();
+      style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
+      gtk_style_context_add_provider (style_context,
+                                      GTK_STYLE_PROVIDER (self->css_provider),
+                                      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+    }
+
+  if (font_desc)
+    {
+      g_autofree gchar *str = NULL;
+      g_autofree gchar *css = NULL;
+
+      self->font_desc = pango_font_description_copy (font_desc);
+      str = ide_pango_font_description_to_css (font_desc);
+      css = g_strdup_printf ("IdeSourceMap { %s }", str ?: "");
+      gtk_css_provider_load_from_data (self->css_provider, css, -1, NULL);
+    }
+}
+
+static void
+ide_source_map_set_font_name (IdeSourceMap *self,
+                              const gchar  *font_name)
+{
+  PangoFontDescription *font_desc;
+
+  g_assert (IDE_IS_SOURCE_MAP (self));
+
+  if (font_name == NULL)
+    font_name = "Monospace";
+
+  font_desc = pango_font_description_from_string (font_name);
+  ide_source_map_set_font_desc (self, font_desc);
+  pango_font_description_free (font_desc);
+}
+
+static void
+ide_source_map_get_preferred_width (GtkWidget *widget,
+                                    gint      *mininum_width,
+                                    gint      *natural_width)
+{
+  IdeSourceMap *self = (IdeSourceMap *)widget;
+  PangoLayout *layout;
+  guint right_margin_position;
+  gint height;
+  gint width;
+
+  g_assert (IDE_IS_SOURCE_MAP (self));
+  g_assert (mininum_width != NULL);
+  g_assert (natural_width != NULL);
+
+  if (self->font_desc == NULL)
+    {
+      *mininum_width = *natural_width = DEFAULT_WIDTH;
+      return;
+    }
+
+  layout = gtk_widget_create_pango_layout (widget, "X");
+  pango_layout_get_pixel_size (layout, &width, &height);
+  g_clear_object (&layout);
+
+  right_margin_position = gtk_source_view_get_right_margin_position (self->view);
+
+  width *= right_margin_position;
+
+  *mininum_width = *natural_width = width;
+}
+
+static void
+ide_source_map_draw_layer (GtkTextView      *text_view,
+                           GtkTextViewLayer  layer,
+                           cairo_t          *cr)
+{
+  IdeSourceMap *self = (IdeSourceMap *)text_view;
+
+  g_assert (GTK_IS_TEXT_VIEW (text_view));
+  g_assert (IDE_IS_SOURCE_MAP (self));
+  g_assert (cr != NULL);
+
+  if (self->view == NULL)
+    return;
+
+  GTK_TEXT_VIEW_CLASS (ide_source_map_parent_class)->draw_layer (text_view, layer, cr);
+
+  if (layer == GTK_TEXT_VIEW_LAYER_ABOVE)
+    {
+      GdkRectangle visible_rect;
+      GdkRectangle my_visible_rect;
+      GdkRectangle area;
+      GdkRectangle clip;
+      GtkTextIter iter;
+
+      cairo_save (cr);
+
+      gtk_text_view_get_visible_rect (GTK_TEXT_VIEW (self->view), &visible_rect);
+
+      gtk_text_view_get_visible_rect (GTK_TEXT_VIEW (self), &my_visible_rect);
+      gdk_cairo_get_clip_rectangle (cr, &clip);
+
+      gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (self->view), &iter, visible_rect.x, visible_rect.y);
+      gtk_text_view_get_iter_location (GTK_TEXT_VIEW (self), &iter, &area);
+      cairo_move_to (cr, clip.x, area.y - my_visible_rect.y + 0.5);
+      cairo_line_to (cr, clip.x + clip.width, area.y - my_visible_rect.y + 0.5);
+
+      gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (self->view), &iter, visible_rect.x, visible_rect.y 
+ visible_rect.height);
+      gtk_text_view_get_iter_location (GTK_TEXT_VIEW (self), &iter, &area);
+      cairo_move_to (cr, clip.x, area.y + area.height - my_visible_rect.y + 0.5);
+      cairo_line_to (cr, clip.x + clip.width, area.y + area.height - my_visible_rect.y + 0.5);
+
+      cairo_set_source_rgb (cr, .63, .63, .63);
+      cairo_set_line_width (cr, 1);
+      cairo_stroke (cr);
+
+      cairo_restore (cr);
+    }
+}
+
+static void
+ide_source_map_finalize (GObject *object)
+{
+  IdeSourceMap *self = (IdeSourceMap *)object;
+
+  g_clear_object (&self->css_provider);
+  g_clear_pointer (&self->font_desc, pango_font_description_free);
+  ide_clear_weak_pointer (&self->view);
+
+  G_OBJECT_CLASS (ide_source_map_parent_class)->finalize (object);
+}
+
+static void
+ide_source_map_get_property (GObject    *object,
+                             guint       prop_id,
+                             GValue     *value,
+                             GParamSpec *pspec)
+{
+  IdeSourceMap *self = IDE_SOURCE_MAP (object);
+
+  switch (prop_id)
+    {
+    case PROP_VIEW:
+      g_value_set_object (value, ide_source_map_get_view (self));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_source_map_set_property (GObject      *object,
+                             guint         prop_id,
+                             const GValue *value,
+                             GParamSpec   *pspec)
+{
+  IdeSourceMap *self = IDE_SOURCE_MAP (object);
+
+  switch (prop_id)
+    {
+    case PROP_VIEW:
+      ide_source_map_set_view (self, g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_source_map_class_init (IdeSourceMapClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
+
+  object_class->finalize = ide_source_map_finalize;
+  object_class->get_property = ide_source_map_get_property;
+  object_class->set_property = ide_source_map_set_property;
+
+  widget_class->get_preferred_width = ide_source_map_get_preferred_width;
+
+  text_view_class->draw_layer = ide_source_map_draw_layer;
+
+  gParamSpecs [PROP_VIEW] =
+    g_param_spec_object ("view",
+                         _("View"),
+                         _("The view this widget is mapping."),
+                         GTK_SOURCE_TYPE_VIEW,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (object_class, PROP_VIEW, gParamSpecs [PROP_VIEW]);
+}
+
+static void
+ide_source_map_init (IdeSourceMap *self)
+{
+  GtkSourceCompletion *completion;
+
+  gtk_widget_set_can_focus (GTK_WIDGET (self), FALSE);
+  gtk_text_view_set_editable (GTK_TEXT_VIEW (self), FALSE);
+  gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (self), FALSE);
+  gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (self), FALSE);
+  gtk_source_view_set_show_line_marks (GTK_SOURCE_VIEW (self), FALSE);
+  gtk_source_view_set_show_right_margin (GTK_SOURCE_VIEW (self), FALSE);
+
+  completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (self));
+  gtk_source_completion_block_interactive (completion);
+
+  ide_source_map_set_font_name (self, "Monospace 1");
+}
diff --git a/libide/ide-source-map.h b/libide/ide-source-map.h
new file mode 100644
index 0000000..6454452
--- /dev/null
+++ b/libide/ide-source-map.h
@@ -0,0 +1,46 @@
+/* ide-source-map.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_SOURCE_MAP_H
+#define IDE_SOURCE_MAP_H
+
+#include <gtksourceview/gtksource.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_SOURCE_MAP            (ide_source_map_get_type())
+#define IDE_SOURCE_MAP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_SOURCE_MAP, 
IdeSourceMap))
+#define IDE_SOURCE_MAP_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_SOURCE_MAP, IdeSourceMap 
const))
+#define IDE_SOURCE_MAP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  IDE_TYPE_SOURCE_MAP, 
IdeSourceMapClass))
+#define IDE_IS_SOURCE_MAP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_SOURCE_MAP))
+#define IDE_IS_SOURCE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  IDE_TYPE_SOURCE_MAP))
+#define IDE_SOURCE_MAP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  IDE_TYPE_SOURCE_MAP, 
IdeSourceMapClass))
+
+typedef struct _IdeSourceMap      IdeSourceMap;
+typedef struct _IdeSourceMapClass IdeSourceMapClass;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeSourceMap, g_object_unref)
+
+GType          ide_source_map_get_type (void);
+GtkSourceView *ide_source_map_get_view (IdeSourceMap  *self);
+void           ide_source_map_set_view (IdeSourceMap  *self,
+                                        GtkSourceView *view);
+
+G_END_DECLS
+
+#endif /* IDE_SOURCE_MAP_H */
diff --git a/libide/ide.h b/libide/ide.h
index e7bb7da..000ef76 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -71,13 +71,14 @@ G_BEGIN_DECLS
 #include "ide-search-provider.h"
 #include "ide-search-result.h"
 #include "ide-service.h"
+#include "ide-source-location.h"
+#include "ide-source-map.h"
+#include "ide-source-range.h"
 #include "ide-source-snippet-chunk.h"
 #include "ide-source-snippet-context.h"
 #include "ide-source-snippet.h"
-#include "ide-source-snippets.h"
 #include "ide-source-snippets-manager.h"
-#include "ide-source-location.h"
-#include "ide-source-range.h"
+#include "ide-source-snippets.h"
 #include "ide-source-view.h"
 #include "ide-symbol-resolver.h"
 #include "ide-symbol.h"
diff --git a/src/editor/gb-editor-frame-private.h b/src/editor/gb-editor-frame-private.h
index df318ba..dfcc5c8 100644
--- a/src/editor/gb-editor-frame-private.h
+++ b/src/editor/gb-editor-frame-private.h
@@ -39,6 +39,7 @@ struct _GbEditorFrame
   GdTaggedEntry       *search_entry;
   GdTaggedEntryTag    *search_entry_tag;
   IdeSourceView       *source_view;
+  IdeSourceMap        *source_map;
 
   gulong               cursor_moved_handler;
 };
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index f55572b..f19246d 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -591,6 +591,7 @@ gb_editor_frame_class_init (GbEditorFrameClass *klass)
   GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, scrolled_window);
   GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_entry);
   GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_revealer);
+  GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, source_map);
   GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, source_view);
 
   g_type_ensure (NAUTILUS_TYPE_FLOATING_BAR);


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