SF.net SVN: geany:[5578] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Mar 6 17:10:30 UTC 2011
Revision: 5578
http://geany.svn.sourceforge.net/geany/?rev=5578&view=rev
Author: eht16
Date: 2011-03-06 17:10:30 +0000 (Sun, 06 Mar 2011)
Log Message:
-----------
Cleanup.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/export.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-03-06 17:08:54 UTC (rev 5577)
+++ trunk/ChangeLog 2011-03-06 17:10:30 UTC (rev 5578)
@@ -10,6 +10,7 @@
the 'Regular expressions' option as well.
* plugins/export.c:
Add option to insert line numbers (closes #3197150).
+ Cleanup.
2011-03-05 Colomban Wendling <colomban(at)geany(dot)org>
Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c 2011-03-06 17:08:54 UTC (rev 5577)
+++ trunk/plugins/export.c 2011-03-06 17:10:30 UTC (rev 5578)
@@ -156,10 +156,10 @@
GeanyDocument *doc;
ExportInfo *exi;
- if (extension == NULL)
- return;
+ g_return_if_fail(extension != NULL);
doc = document_get_current();
+ g_return_if_fail(doc != NULL);
exi = g_new(ExportInfo, 1);
exi->doc = doc;
@@ -366,6 +366,7 @@
gboolean use_zoom, gboolean insert_line_numbers)
{
GeanyEditor *editor = doc->editor;
+ ScintillaObject *sci = doc->editor->sci;
gint i, doc_len, style = -1, old_style = 0, column = 0;
gint k, line_number, line_number_width, line_number_max_width = 0, pad;
gchar c, c_next, *tmp, *date;
@@ -375,15 +376,15 @@
GString *body;
GString *cmds;
GString *latex;
- gint style_max = pow(2, scintilla_send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, scintilla_send_message(sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
- styles[i][FORE] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0);
- styles[i][BACK] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0);
- styles[i][BOLD] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = scintilla_send_message(sci, SCI_STYLEGETFORE, i, 0);
+ styles[i][BACK] = scintilla_send_message(sci, SCI_STYLEGETBACK, i, 0);
+ styles[i][BOLD] = scintilla_send_message(sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = scintilla_send_message(sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
@@ -392,17 +393,17 @@
/* read the document and write the LaTeX code */
body = g_string_new("");
- doc_len = sci_get_length(doc->editor->sci);
+ doc_len = sci_get_length(sci);
for (i = 0; i < doc_len; i++)
{
- style = sci_get_style_at(doc->editor->sci, i);
- c = sci_get_char_at(doc->editor->sci, i);
- c_next = sci_get_char_at(doc->editor->sci, i + 1);
+ style = sci_get_style_at(sci, i);
+ c = sci_get_char_at(sci, i);
+ c_next = sci_get_char_at(sci, i + 1);
/* line numbers */
if (insert_line_numbers && column == 0)
{
- line_number = sci_get_line_from_position(doc->editor->sci, i) + 1;
+ line_number = sci_get_line_from_position(sci, i) + 1;
line_number_width = get_line_numbers_arity(line_number);
/* padding */
pad = line_number_max_width - line_number_width;
@@ -593,6 +594,7 @@
gboolean use_zoom, gboolean insert_line_numbers)
{
GeanyEditor *editor = doc->editor;
+ ScintillaObject *sci = doc->editor->sci;
gint i, doc_len, style = -1, old_style = 0, column = 0;
gint k, line_number, line_number_width, line_number_max_width = 0, pad;
gchar c, c_next, *date;
@@ -605,15 +607,15 @@
GString *body;
GString *css;
GString *html;
- gint style_max = pow(2, scintilla_send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, scintilla_send_message(sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
- styles[i][FORE] = ROTATE_RGB(scintilla_send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0));
- styles[i][BACK] = ROTATE_RGB(scintilla_send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0));
- styles[i][BOLD] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = scintilla_send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = ROTATE_RGB(scintilla_send_message(sci, SCI_STYLEGETFORE, i, 0));
+ styles[i][BACK] = ROTATE_RGB(scintilla_send_message(sci, SCI_STYLEGETBACK, i, 0));
+ styles[i][BOLD] = scintilla_send_message(sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = scintilla_send_message(sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
@@ -622,27 +624,27 @@
font_name = pango_font_description_get_family(font_desc);
/*font_size = pango_font_description_get_size(font_desc) / PANGO_SCALE;*/
/* take the zoom level also into account */
- font_size = scintilla_send_message(doc->editor->sci, SCI_STYLEGETSIZE, 0, 0);
+ font_size = scintilla_send_message(sci, SCI_STYLEGETSIZE, 0, 0);
if (use_zoom)
- font_size += scintilla_send_message(doc->editor->sci, SCI_GETZOOM, 0, 0);
+ font_size += scintilla_send_message(sci, SCI_GETZOOM, 0, 0);
if (insert_line_numbers)
line_number_max_width = get_line_number_width(doc);
/* read the document and write the HTML body */
body = g_string_new("");
- doc_len = sci_get_length(doc->editor->sci);
+ doc_len = sci_get_length(sci);
for (i = 0; i < doc_len; i++)
{
- style = sci_get_style_at(doc->editor->sci, i);
- c = sci_get_char_at(doc->editor->sci, i);
+ style = sci_get_style_at(sci, i);
+ c = sci_get_char_at(sci, i);
/* sci_get_char_at() takes care of index boundaries and return 0 if i is too high */
- c_next = sci_get_char_at(doc->editor->sci, i + 1);
+ c_next = sci_get_char_at(sci, i + 1);
/* line numbers */
if (insert_line_numbers && column == 0)
{
- line_number = sci_get_line_from_position(doc->editor->sci, i) + 1;
+ line_number = sci_get_line_from_position(sci, i) + 1;
line_number_width = get_line_numbers_arity(line_number);
/* padding */
pad = line_number_max_width - line_number_width;
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