SF.net SVN: geany-plugins:[1192] trunk/geanylatex/src

frlan at users.sourceforge.net frlan at xxxxx
Sat Mar 20 18:20:46 UTC 2010


Revision: 1192
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1192&view=rev
Author:   frlan
Date:     2010-03-20 18:20:45 +0000 (Sat, 20 Mar 2010)

Log Message:
-----------
GeanyLaTeX: glatex_usepackage() now also understand how to set package options on inserting

Modified Paths:
--------------
    trunk/geanylatex/src/geanylatex.c
    trunk/geanylatex/src/latexutils.c
    trunk/geanylatex/src/latexutils.h

Modified: trunk/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geanylatex/src/geanylatex.c	2010-03-20 18:02:27 UTC (rev 1191)
+++ trunk/geanylatex/src/geanylatex.c	2010-03-20 18:20:45 UTC (rev 1192)
@@ -1054,7 +1054,7 @@
 	{
 		const gchar *pkg;
 		pkg = gtk_entry_get_text(GTK_ENTRY(textbox));
-		glatex_usepackage(pkg);
+		glatex_usepackage(pkg, NULL);
 
 	}
 

Modified: trunk/geanylatex/src/latexutils.c
===================================================================
--- trunk/geanylatex/src/latexutils.c	2010-03-20 18:02:27 UTC (rev 1191)
+++ trunk/geanylatex/src/latexutils.c	2010-03-20 18:20:45 UTC (rev 1192)
@@ -41,7 +41,7 @@
 	return result;
 }
 
-void glatex_usepackage(const gchar *pkg)
+void glatex_usepackage(const gchar *pkg, const gchar *options)
 {
 	GeanyDocument *doc = NULL;
 	gint i;
@@ -65,9 +65,16 @@
 			gchar *packagestring;
 
 			pos = sci_get_position_from_line(doc->editor->sci, i);
-
 			/* Building up package string and inserting it */
-			packagestring = g_strconcat("\\usepackage{", pkg, "}\n", NULL);
+			if (NZV(options))
+			{
+				packagestring = g_strconcat("\\usepackage[", options, 
+					"]{", pkg, "}\n", NULL);
+			}
+			else
+			{
+				packagestring = g_strconcat("\\usepackage{", pkg, "}\n", NULL);
+			}
 			sci_insert_text(doc->editor->sci, pos, packagestring);
 
 			g_free(tmp_line);

Modified: trunk/geanylatex/src/latexutils.h
===================================================================
--- trunk/geanylatex/src/latexutils.h	2010-03-20 18:02:27 UTC (rev 1191)
+++ trunk/geanylatex/src/latexutils.h	2010-03-20 18:20:45 UTC (rev 1192)
@@ -25,6 +25,6 @@
 
 gchar **glatex_read_file_in_array(const gchar *filename);
 
-void glatex_usepackage(const gchar *pkg);
+void glatex_usepackage(const gchar *pkg, const gchar *options);
 
 #endif


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



More information about the Plugins-Commits mailing list