SF.net SVN: geany: [531] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jul 3 12:59:07 UTC 2006


Revision: 531
Author:   ntrel
Date:     2006-07-03 05:58:58 -0700 (Mon, 03 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=531&view=rev

Log Message:
-----------
Scroll to 1/4 of visible lines when going to a line number.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/sciwrappers.c
    trunk/src/sciwrappers.h
    trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-03 12:06:13 UTC (rev 530)
+++ trunk/ChangeLog	2006-07-03 12:58:58 UTC (rev 531)
@@ -2,6 +2,8 @@
 
  * src/utils.c, src/dialogs.c:
    Fix a problem with the recent files menu.
+ * src/utils.c, src/sciwrappers.c, src/sciwrappers.h:
+   Scroll to 1/4 of visible lines when going to a line number.
 
 
 2006-07-03  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c	2006-07-03 12:06:13 UTC (rev 530)
+++ trunk/src/sciwrappers.c	2006-07-03 12:58:58 UTC (rev 531)
@@ -669,6 +669,17 @@
 }
 
 
+void sci_goto_line_scroll(ScintillaObject *sci, gint line, gdouble percent_of_view)
+{
+	gint vis1, los;
+	SSM(sci, SCI_GOTOLINE, line, 0);
+
+	vis1 = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
+	los = SSM(sci, SCI_LINESONSCREEN, 0, 0);
+	sci_scroll_lines(sci, (line - los * percent_of_view) - vis1);
+}
+
+
 void sci_marker_delete_all(ScintillaObject *sci, gint marker)
 {
 	SSM(sci, SCI_MARKERDELETEALL, marker, 0);

Modified: trunk/src/sciwrappers.h
===================================================================
--- trunk/src/sciwrappers.h	2006-07-03 12:06:13 UTC (rev 530)
+++ trunk/src/sciwrappers.h	2006-07-03 12:58:58 UTC (rev 531)
@@ -121,6 +121,7 @@
 gint				sci_find_text				(ScintillaObject * sci, gint flags, struct TextToFind *ttf);
 void				sci_set_font				(ScintillaObject * sci, gint style, const gchar* font, gint size);
 void				sci_goto_line				(ScintillaObject * sci, gint line, gboolean ensure_visibility);
+void				sci_goto_line_scroll		(ScintillaObject * sci, gint line, gdouble percent_of_view);
 void				sci_marker_delete_all		(ScintillaObject * sci, gint marker);
 gint				sci_get_style_at			(ScintillaObject * sci, gint position);
 void				sci_set_symbol_margin		(ScintillaObject * sci, gboolean set);

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-07-03 12:06:13 UTC (rev 530)
+++ trunk/src/utils.c	2006-07-03 12:58:58 UTC (rev 531)
@@ -526,13 +526,12 @@
 	if (idx == -1 || ! doc_list[idx].is_valid || line < 0)
 		return FALSE;
 
-	// mark the tag and ensure that we have arround 5 lines visible around the mark
-	sci_goto_line(doc_list[idx].sci, line - 5, FALSE);
-	sci_goto_line(doc_list[idx].sci, line + 5, FALSE);
-	sci_goto_line(doc_list[idx].sci, line, TRUE);
+	// mark the tag
 	sci_marker_delete_all(doc_list[idx].sci, 0);
 	sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 0);
 
+	sci_goto_line_scroll(doc_list[idx].sci, line, 0.25);
+
 	// finally switch to the page
 	page_num = gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(doc_list[idx].sci));
 	gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page_num);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list