SF.net SVN: geany:[2939] branches/split-window-plugin

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Sep 11 16:26:36 UTC 2008


Revision: 2939
          http://geany.svn.sourceforge.net/geany/?rev=2939&view=rev
Author:   ntrel
Date:     2008-09-11 16:26:34 +0000 (Thu, 11 Sep 2008)

Log Message:
-----------
Set pane splitter halfway.
Copy cursor position from original editor.

Modified Paths:
--------------
    branches/split-window-plugin/ChangeLog
    branches/split-window-plugin/plugins/splitwindow.c

Modified: branches/split-window-plugin/ChangeLog
===================================================================
--- branches/split-window-plugin/ChangeLog	2008-09-11 15:30:36 UTC (rev 2938)
+++ branches/split-window-plugin/ChangeLog	2008-09-11 16:26:34 UTC (rev 2939)
@@ -8,6 +8,9 @@
    Unsplit when the source document is closed.
  * doc/plugins.dox:
    Fix wrong parameter for "project-close" signal.
+ * plugins/splitwindow.c:
+   Set pane splitter halfway.
+   Copy cursor position from original editor.
 
 
 2008-09-10  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: branches/split-window-plugin/plugins/splitwindow.c
===================================================================
--- branches/split-window-plugin/plugins/splitwindow.c	2008-09-11 15:30:36 UTC (rev 2938)
+++ branches/split-window-plugin/plugins/splitwindow.c	2008-09-11 16:26:34 UTC (rev 2939)
@@ -147,10 +147,15 @@
 }
 
 
-static void update_view(ScintillaObject *sci)
+static void sync_to_current(ScintillaObject *current, ScintillaObject *sci)
 {
-	ScintillaObject *current = p_document->get_current()->editor->sci;
+	gpointer sdoc;
 	gint lexer;
+	gint pos;
+	
+	/* set the new sci widget to view the existing Scintilla document */
+	sdoc = (gpointer) p_sci->send_message(current, SCI_GETDOCPOINTER, 0, 0);
+	p_sci->send_message(sci, SCI_SETDOCPOINTER, 0, GPOINTER_TO_INT(sdoc));
 
 	update_font(sci, geany->interface_prefs->editor_font, 0);
 
@@ -158,6 +163,9 @@
 	p_sci->send_message(sci, SCI_SETLEXER, lexer, 0);
 	set_styles(current, sci);
 
+	pos = p_sci->get_current_position(current);
+	p_sci->set_current_position(sci, pos, TRUE);
+	
 	set_line_numbers(sci, TRUE, 0);
 	p_sci->send_message(sci, SCI_SETMARGINWIDTHN, 1, 0 ); /* hide marker margin */
 }
@@ -181,7 +189,7 @@
 	GtkWidget *pane;
 	GeanyDocument *doc = p_document->get_current();
 	ScintillaObject *sci;
-	gpointer sdoc;
+	gint width = notebook->allocation.width / 2;
 
 	set_state(STATE_SPLIT_HORIZONTAL);
 	
@@ -196,13 +204,12 @@
 	gtk_paned_add1(GTK_PANED(pane), notebook);
 	g_object_unref(notebook);
 
-	sci = doc->editor->sci;
-	sdoc = (gpointer) p_sci->send_message(sci, SCI_GETDOCPOINTER, 0, 0);
 	our_editor = p_editor->create(doc);
 	sci = our_editor->sci;
-	p_sci->send_message(sci, SCI_SETDOCPOINTER, 0, GPOINTER_TO_INT(sdoc));
-	update_view(sci);
+	sync_to_current(doc->editor->sci, sci);
 	gtk_paned_add2(GTK_PANED(pane), GTK_WIDGET(sci));
+
+	gtk_paned_set_position(GTK_PANED(pane), width);
 	gtk_widget_show_all(pane);
 }
 


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