[anjuta-extras] scintilla: Use common settings for indentation



commit b4cf5ef463f53e0f13ea5e2b3fb38d94f9c7ae99
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Apr 22 16:18:39 2012 +0200

    scintilla: Use common settings for indentation

 plugins/scintilla/anjuta-editor-scintilla.ui       |    6 +-
 ...g.gnome.anjuta.plugins.scintilla.gschema.xml.in |    9 -
 plugins/scintilla/print.c                          |  249 ++++++++++----------
 plugins/scintilla/properties.h                     |    3 -
 plugins/scintilla/text_editor.c                    |    2 +
 plugins/scintilla/text_editor.h                    |    3 +
 plugins/scintilla/text_editor_prefs.c              |   14 +-
 7 files changed, 141 insertions(+), 145 deletions(-)
---
diff --git a/plugins/scintilla/anjuta-editor-scintilla.ui b/plugins/scintilla/anjuta-editor-scintilla.ui
index 2152b75..97ae065 100644
--- a/plugins/scintilla/anjuta-editor-scintilla.ui
+++ b/plugins/scintilla/anjuta-editor-scintilla.ui
@@ -838,7 +838,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="preferences:use-tabs">
+                      <object class="GtkCheckButton" id="preferences:.editor.use-tabs">
                         <property name="label" translatable="yes">Use tabs for indentation</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -856,7 +856,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="preferences:indent-size">
+                      <object class="GtkSpinButton" id="preferences:.editor.indent-width">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="adjustment">adjustment6</property>
@@ -873,7 +873,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="preferences:tabsize">
+                      <object class="GtkSpinButton" id="preferences:.editor.tab-width">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="adjustment">adjustment7</property>
diff --git a/plugins/scintilla/org.gnome.anjuta.plugins.scintilla.gschema.xml.in b/plugins/scintilla/org.gnome.anjuta.plugins.scintilla.gschema.xml.in
index d1eba79..3622a74 100644
--- a/plugins/scintilla/org.gnome.anjuta.plugins.scintilla.gschema.xml.in
+++ b/plugins/scintilla/org.gnome.anjuta.plugins.scintilla.gschema.xml.in
@@ -102,15 +102,6 @@
 		<key name="indent-opening" type="b">
 			<default>false</default>
 		</key>
-		<key name="use-tabs" type="b">
-			<default>true</default>
-		</key>
-		<key name="indent-size" type="i">
-			<default>4</default>
-		</key>
-		<key name="tabsize" type="i">
-			<default>4</default>
-		</key>
 		<key name="view-eol" type="b">
 			<default>false</default>
 		</key>
diff --git a/plugins/scintilla/print.c b/plugins/scintilla/print.c
index d9ac169..5705109 100644
--- a/plugins/scintilla/print.c
+++ b/plugins/scintilla/print.c
@@ -1,20 +1,20 @@
 /*
  * print.c
- * 
+ *
  * Copyright (C) 2002 Biswapesh Chattopadhyay <biswapesh_chatterjee tcscal co in>
  * Copyright (C) 2002 Naba Kumar <kh_naba users sourceforge net>
  * Copyright (C) 2008 Sebastien Granjoux <seb sfo free fr>
- * 
+ *
  * 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 2 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, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -31,6 +31,7 @@
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/anjuta-preferences.h>
 #include <libanjuta/anjuta-debug.h>
+#include <libanjuta/interfaces/ianjuta-editor.h>
 
 #include "print.h"
 
@@ -55,16 +56,16 @@
 typedef struct _PrintJobInfoStyle
 {
 	PangoFontDescription      *font;
-	GList								*attrs;	
+	GList								*attrs;
 
 	gchar *font_name;
 	gboolean italics;
 	gboolean bold;
 	gint size;
-	
+
 	GdkColor fore_color;
-	GdkColor back_color;	
-	
+	GdkColor back_color;
+
 } PrintJobInfoStyle;
 
 typedef struct _PrintPageInfo
@@ -86,7 +87,7 @@ typedef struct _PrintJobInfo
 
 	/* Style pool */
 	PrintJobInfoStyle* styles_pool[AN_PRINT_MAX_STYLES];
-	
+
 	/* Preferences */
 	gboolean print_header;
 	gboolean print_color;
@@ -94,7 +95,7 @@ typedef struct _PrintJobInfo
 	gboolean wrapping;
 	gint     tab_width;
 	gint zoom_factor;
-	
+
 	/* Margin in points */
 	gdouble page_width;
 	gdouble page_height;
@@ -105,22 +106,22 @@ typedef struct _PrintJobInfo
 	gdouble header_height;
 	gdouble numbers_width;
 	gdouble numbers_height;
-	
+
 	/* GC state */
 	guint  current_style;
 	guint current_page;
 	guint current_pos;
 	guint current_line;
 	gdouble current_height;
-	
+
 	/* layout objects */
 	PangoLayout *layout;
 	PangoLayout *line_numbers_layout;
 	PangoLayout *header_layout;
-	
+
 	/* Progress */
 	AnjutaStatus* status;
-	
+
 } PrintJobInfo;
 
 /* Helper functions
@@ -141,7 +142,7 @@ set_layout_tab_width (PangoLayout *layout, gint width)
 	if (tab_width > 0)
 	{
 		PangoTabArray *tab_array;
-	
+
 		tab_array = pango_tab_array_new (1, FALSE);
 
 		pango_tab_array_set_tab (tab_array,
@@ -183,9 +184,9 @@ anjuta_print_job_info_style_load_font (PrintJobInfoStyle *pis)
 {
 	gchar *font_desc, *tmp;
 	gint size = 12;
-	
+
 	g_return_if_fail (pis->font_name);
-	
+
 	/* Setup font */
 	font_desc = g_strdup (pis->font_name);
 	if (pis->size > 0)
@@ -197,7 +198,7 @@ anjuta_print_job_info_style_load_font (PrintJobInfoStyle *pis)
 	}
 	if (pis->font)
 		pango_font_description_free (pis->font);
-	
+
 	DEBUG_PRINT ("Print font loading: %s", font_desc);
 	pis->font = pango_font_description_from_string (font_desc);
 	g_free (font_desc);
@@ -216,7 +217,7 @@ static void
 anjuta_print_job_info_style_set_attributes (PrintJobInfoStyle *pis)
 {
 	PangoAttribute *attr;
-	
+
 	/* Use attribute for font shape */
 	if (pis->bold)
 	{
@@ -234,9 +235,9 @@ static void
 anjuta_print_job_info_style_set_color_attributes (PrintJobInfoStyle *pis)
 {
 	PangoAttribute *attr;
-	
+
 	/* Use attribute for color */
-	
+
 	/* Remove background colors */
 	/*attr = pango_attr_background_new (pis->back_color.red, pis->back_color.green, pis->back_color.blue);
 	pis->attrs = g_list_prepend (pis->attrs, attr);*/
@@ -249,18 +250,18 @@ anjuta_print_job_info_style_init (PrintJobInfoStyle *pis, PropsID prop,
 						gchar* lang, guint style)
 {
 	gchar *style_key, *style_string, *val, *opt;
-	
+
 	style_key = g_strdup_printf ("style.%s.%0d", lang, style);
 	style_string = sci_prop_get_expanded (prop, style_key);
 	g_free (style_key);
 	if (!style_string) return;
-	
+
 	val = g_strdup(style_string);
 	opt = val;
-	
+
 	while (opt) {
 		char *cpComma, *colon;
-		
+
 		cpComma = strchr(opt, ',');
 		if (cpComma)
 			*cpComma = '\0';
@@ -314,10 +315,10 @@ anjuta_print_job_info_style_new (PropsID prop, gchar* lang,
 			guint style, gint font_zoom_factor, gboolean color)
 {
 	PrintJobInfoStyle* pis;
-	
+
 	g_return_val_if_fail (prop > 0, NULL);
 	g_return_val_if_fail (style < 256, NULL);
-	
+
 	pis = g_new0 (PrintJobInfoStyle, 1);
 
 	pis->font = NULL;
@@ -325,17 +326,17 @@ anjuta_print_job_info_style_new (PropsID prop, gchar* lang,
 	pis->bold = FALSE;
 	pis->italics = FALSE;
 	pis->size = AN_PRINT_FONT_SIZE_BODY_DEFAULT;
-	
+
 	/* Black */
 	pis->fore_color.red = 0;
 	pis->fore_color.green = 0;
 	pis->fore_color.blue = 0;
-	
+
 	/* White */
 	pis->back_color.red = (gushort)(-1);
 	pis->back_color.green = (gushort)(-1);
 	pis->back_color.blue = (gushort)(-1);
-	
+
 	/* Set default style first */
 	anjuta_print_job_info_style_init (pis, prop, "*", 32);
 	if (lang && strlen(lang) > 0) {
@@ -346,12 +347,12 @@ anjuta_print_job_info_style_new (PropsID prop, gchar* lang,
 	if (lang && strlen(lang) > 0) {
 		anjuta_print_job_info_style_init (pis, prop, lang, style);
 	}
-	
+
 	pis->size += font_zoom_factor;
 
 	anjuta_print_job_info_style_clear_attributes	(pis);
 	anjuta_print_job_info_style_load_font (pis);
-	
+
 	if (!pis->font) {
 		g_warning ("Cannot load document font: %s. Trying Default font: %s.",
 			pis->font_name, AN_PRINT_FONT_BODY_DEFAULT);
@@ -378,37 +379,37 @@ anjuta_print_job_info_style_new (PropsID prop, gchar* lang,
 	}
 
 	anjuta_print_job_info_style_set_attributes (pis);
-	
+
 	if (color)
 	{
 		anjuta_print_job_info_style_set_color_attributes (pis);
 	}
-	
+
 	return pis;
 }
 
-static void 
+static void
 anjuta_print_job_info_destroy(PrintJobInfo *pji)
 {
 	int i;
-	
+
 	g_return_if_fail (pji);
 
 	if (pji->pages != NULL)
 		g_array_free (pji->pages, TRUE);
 
 	if (pji->layout != NULL)
-		g_object_unref (pji->layout);	
+		g_object_unref (pji->layout);
 
 	if (pji->line_numbers_layout != NULL)
-		g_object_unref (pji->line_numbers_layout);	
-	
+		g_object_unref (pji->line_numbers_layout);
+
 	if (pji->header_layout != NULL)
-		g_object_unref (pji->header_layout);	
+		g_object_unref (pji->header_layout);
 
 	if (pji->buffer != NULL)
 		g_free(pji->buffer);
-	
+
 	for (i = 0; i < AN_PRINT_MAX_STYLES; i++)
 	{
 		if (pji->styles_pool[i])
@@ -426,7 +427,7 @@ anjuta_print_job_info_new (TextEditor *te)
 
 	pji->te = te;
 	pji->pages = g_array_new (FALSE, FALSE, sizeof (PrintPageInfo));
-	
+
 	return pji;
 }
 
@@ -434,9 +435,9 @@ static PrintJobInfoStyle*
 anjuta_print_get_style (PrintJobInfo *pji, gint style)
 {
 	PrintJobInfoStyle* pis;
-	
+
 	pis = pji->styles_pool[style];
-	
+
 	if (!pis) {
 		gchar* language;
 		language = (gchar*) aneditor_command(pji->te->editor_id, ANE_GETLANGUAGE,0, 0);
@@ -444,11 +445,11 @@ anjuta_print_get_style (PrintJobInfo *pji, gint style)
 						language, style, pji->zoom_factor, pji->print_color);
 		pji->styles_pool[style] = pis;
 	}
-	
+
 	if (!pis && style != AN_PRINT_DEFAULT_TEXT_STYLE) {
 		pis = anjuta_print_get_style (pji, AN_PRINT_DEFAULT_TEXT_STYLE);
 	}
-	
+
 	return pis;
 }
 
@@ -457,10 +458,10 @@ static void
 anjuta_print_apply_style (PrintJobInfo *pji, gint style, guint start, guint end)
 {
 	PrintJobInfoStyle* pis;
-	
+
 	pis = anjuta_print_get_style (pji, style);
 	g_return_if_fail (pis != NULL);
-	
+
 	pango_layout_set_font_description (pji->layout, pis->font);
 
 	if (pis->attrs)
@@ -475,14 +476,14 @@ anjuta_print_apply_style (PrintJobInfo *pji, gint style, guint start, guint end)
 			attr_list = pango_attr_list_new ();
 			new_list = attr_list;
 		}
-		
+
 		for (node = g_list_first (pis->attrs); node != NULL; node = g_list_next (node))
 		{
 			PangoAttribute *a = pango_attribute_copy ((PangoAttribute *)node->data);
-			
+
 			a->start_index = start;
 			a->end_index = end;
-			
+
 			pango_attr_list_insert (attr_list, a);
 		}
 		pango_layout_set_attributes (pji->layout, attr_list);
@@ -501,26 +502,26 @@ anjuta_setup_layout (PrintJobInfo *pji, GtkPrintContext *context)
 		pji->layout = gtk_print_context_create_pango_layout (context);
 		anjuta_print_apply_style (pji, AN_PRINT_DEFAULT_TEXT_STYLE, 0, G_MAXUINT);
 
-		g_return_if_fail (pji->header_layout == NULL);						
+		g_return_if_fail (pji->header_layout == NULL);
 		pji->header_layout = pji->layout;
 	}
-	
+
 	/* Layout for line numbers */
 	if (pji->print_line_numbers)
 	{
 		pji->layout = gtk_print_context_create_pango_layout (context);
 		anjuta_print_apply_style (pji, AN_PRINT_LINENUMBER_STYLE, 0, G_MAXUINT);
-		
-		g_return_if_fail (pji->line_numbers_layout == NULL);						
+
+		g_return_if_fail (pji->line_numbers_layout == NULL);
 		pji->line_numbers_layout = pji->layout;
-								
+
 		pango_layout_set_alignment (pji->line_numbers_layout, PANGO_ALIGN_RIGHT);
 	}
-	
+
 	/* Layout for the text */
 	pji->layout = gtk_print_context_create_pango_layout (context);
 	anjuta_print_apply_style (pji, AN_PRINT_DEFAULT_TEXT_STYLE, 0, G_MAXUINT);
-	
+
 	if (pji->wrapping)
 	{
 		pango_layout_set_wrap (pji->layout, PANGO_WRAP_WORD_CHAR);
@@ -534,7 +535,7 @@ anjuta_print_update_page_size_and_margins (PrintJobInfo *pji, GtkPrintContext *c
 	GtkPageSetup *page_setup;
 
 	page_setup = gtk_print_context_get_page_setup (context);
-	
+
 	pji->margin_left = gtk_page_setup_get_left_margin (page_setup, GTK_UNIT_POINTS);
 	pji->margin_right = gtk_page_setup_get_right_margin (page_setup, GTK_UNIT_POINTS);
 	pji->margin_top = gtk_page_setup_get_top_margin (page_setup, GTK_UNIT_POINTS);
@@ -548,14 +549,14 @@ anjuta_print_update_page_size_and_margins (PrintJobInfo *pji, GtkPrintContext *c
 		gint line_count;
 		gchar *str;
 		gint padding;
-		PangoRectangle rect;		
-		
+		PangoRectangle rect;
+
 		line_count = text_editor_get_total_lines (pji->te) + 1;
 		for (padding = 1; line_count >= 10; padding++) line_count /= 10;
-		str = g_strnfill (padding, '9'); 
+		str = g_strnfill (padding, '9');
 		pango_layout_set_text (pji->line_numbers_layout, str, -1);
 		g_free (str);
-		
+
 		pango_layout_get_extents (pji->line_numbers_layout, NULL, &rect);
 
 		pji->numbers_width = ((gdouble) rect.width + (gdouble)AN_PRINT_LINE_NUMBER_SEPARATION) / (gdouble) PANGO_SCALE;
@@ -566,7 +567,7 @@ anjuta_print_update_page_size_and_margins (PrintJobInfo *pji, GtkPrintContext *c
 		pji->numbers_width = 0.0;
 		pji->numbers_height = 0.0;
 	}
-	
+
 	if (pji->print_header)
 	{
 		PangoContext *pango_context;
@@ -593,7 +594,7 @@ anjuta_print_update_page_size_and_margins (PrintJobInfo *pji, GtkPrintContext *c
 	{
 		pji->header_height = 0.0;
 	}
-	
+
 	pango_layout_set_width (pji->layout, (pji->page_width - pji->margin_left - pji->numbers_width - pji->margin_right) * PANGO_SCALE);
 }
 
@@ -606,16 +607,16 @@ anjuta_print_layout_line (PrintJobInfo *pji)
 	GString *line_buffer;
 	guint last_change;
 	gint current_style;
-		
+
 	/* Read a complete line */
 	line_buffer = g_string_new (NULL);
 	last_change = 0;
 	current_style = pji->buffer[pji->current_pos *2 + 1];
-	
+
 	for (text = &pji->buffer[pji->current_pos * 2]; (*text != '\n') && (pji->current_pos < pji->buffer_size); text = &pji->buffer[pji->current_pos * 2])
 	{
 		gint len;
-		
+
 		/* Buffer contains data bytes merged with style bytes */
 		utf8_char[0] = text[0];
 		utf8_char[1] = text[2];
@@ -630,15 +631,15 @@ anjuta_print_layout_line (PrintJobInfo *pji)
 			last_change = line_buffer->len;
 			current_style= style;
 		}
-		
+
 		/* Append character */
 		len = g_utf8_next_char (utf8_char) - utf8_char;
 		g_string_append_len (line_buffer, utf8_char, len);
-		
+
 		pji->current_pos += len;
 	}
 	pji->current_pos++;
-	
+
 	anjuta_print_apply_style (pji, current_style, last_change, G_MAXUINT);
 	if (line_buffer->len == 0)
 	{
@@ -649,9 +650,9 @@ anjuta_print_layout_line (PrintJobInfo *pji)
 	{
 		pango_layout_set_text (pji->layout,line_buffer->str, line_buffer->len);
 	}
-	
+
 	g_string_free (line_buffer, TRUE);
-}			
+}
 
 static void
 anjuta_draw_header (PrintJobInfo * pji, cairo_t *cr)
@@ -667,26 +668,26 @@ anjuta_draw_header (PrintJobInfo * pji, cairo_t *cr)
 	gdouble x;
 
 	pango_cairo_update_layout (cr, pji->header_layout);
-	
+
 	header_width = pji->page_width - pji->margin_left - pji->margin_right;
 
-	/* Print filename on left */	
+	/* Print filename on left */
 	pango_layout_set_text (pji->header_layout, text1, -1);
 	iter = pango_layout_get_iter (pji->header_layout);
-	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;	
-	
+	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;
+
 	x =pji->margin_left;
-	
+
 	line = pango_layout_iter_get_line_readonly (iter);
 	pango_layout_iter_free (iter);
  	cairo_move_to (cr, x, pji->margin_top + baseline);
 	pango_cairo_show_layout_line (cr, line);
-	
+
 	/* Print page number on right */
 	pango_layout_set_text (pji->header_layout, text2, -1);
 	iter = pango_layout_get_iter (pji->header_layout);
-	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;	
-	
+	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;
+
 	pango_layout_get_extents (pji->header_layout, NULL, &rect);
 	layout_width = (double) rect.width / (double) PANGO_SCALE;
 	x = pji->margin_left + header_width - layout_width;
@@ -709,27 +710,27 @@ anjuta_draw_linenum (PrintJobInfo * pji, cairo_t *cr)
 	PangoLayoutIter *iter;
 	PangoRectangle rect;
 	gdouble x;
-	
+
 	pango_cairo_update_layout (cr, pji->line_numbers_layout);
 
 	/* Print line number on right */
 	pango_layout_set_text (pji->line_numbers_layout, text, -1);
 	iter = pango_layout_get_iter (pji->line_numbers_layout);
-	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;	
+	baseline = (gdouble) pango_layout_iter_get_baseline (iter) / (gdouble) PANGO_SCALE;
 	pango_layout_iter_free (iter);
-	
+
 	pango_layout_get_extents (pji->line_numbers_layout, NULL, &rect);
 	layout_width = (double) rect.width / (double) PANGO_SCALE;
 	x = pji->margin_left + pji->numbers_width - layout_width - AN_PRINT_LINE_NUMBER_SEPARATION;
-		
+
  	cairo_move_to (cr, x, pji->current_height);
-	pango_cairo_show_layout (cr, pji->line_numbers_layout);		
+	pango_cairo_show_layout (cr, pji->line_numbers_layout);
 
 	g_free (text);
 }
 
 static void
-anjuta_end_print (GtkPrintOperation        *operation, 
+anjuta_end_print (GtkPrintOperation        *operation,
 		   GtkPrintContext          *context,
 		   PrintJobInfo *pji)
 {
@@ -755,8 +756,8 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 	cairo_set_source_rgb (cr, 0, 0, 0);
 	cairo_translate (cr,
 					 -1 * pji->margin_left,
-					 -1 * pji->margin_top);	
-	
+					 -1 * pji->margin_top);
+
 	if (pji->print_header)
 	{
 		anjuta_draw_header (pji, cr);
@@ -774,10 +775,10 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 	}
 
 	pango_cairo_update_layout (cr, pji->layout);
-	
+
 	x = pji->margin_left + pji->numbers_width;
 	pji->current_height = pji->margin_top + pji->header_height;
-	
+
 	done = pji->current_pos >= page_end;
 	while (!done)
 	{
@@ -790,14 +791,14 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 		{
 			anjuta_draw_linenum (pji, cr);
 		}
-		
+
 		/* Layout one line */
 		start = pji->current_pos;
 		anjuta_print_layout_line (pji);
-		
+
 		/* Draw line */
 		cairo_move_to (cr, x, pji->current_height);
-		pango_cairo_show_layout (cr, pji->layout);		
+		pango_cairo_show_layout (cr, pji->layout);
 
 		/* Print next line */
 		pango_layout_get_extents (pji->layout, NULL, &rect);
@@ -808,31 +809,31 @@ anjuta_draw_page (GtkPrintOperation        *operation,
 		}
 		pji->current_height += height;
 		pji->current_line ++;
-		
+
 		done = pji->current_pos >= page_end;
 	}
 }
 
 static gboolean
-anjuta_paginate (GtkPrintOperation        *operation, 
+anjuta_paginate (GtkPrintOperation        *operation,
 		  GtkPrintContext          *context,
 		  PrintJobInfo *pji)
 {
 	gdouble text_height;
 	guint page_count;
 	gboolean done;
-	
+
 	text_height = pji->page_height - pji->margin_top - pji->header_height - pji->header_height;
 	page_count = 0;
 	done = pji->current_pos >= pji->buffer_size;
-	
+
 	/* Mark beginning of a page */
 	if (pji->pages->len == pji->current_page)
 	{
 		PrintPageInfo info = {pji->current_pos, pji->current_line};
 		g_array_append_val (pji->pages, info);
 	}
-	
+
 	while (!done && (page_count < AN_PRINT_PAGINATION_CHUNK_SIZE))
 	{
 		PangoRectangle rect;
@@ -844,42 +845,42 @@ anjuta_paginate (GtkPrintOperation        *operation,
 		anjuta_print_layout_line (pji);
 		pango_layout_get_extents (pji->layout, NULL, &rect);
 		height = rect.height / PANGO_SCALE;
-		
+
 		if (height < pji->numbers_height)
 		{
 			height = pji->numbers_height;
 		}
-		
+
 		pji->current_height += height;
 		if (pji->current_height > text_height)
 		{
 			PrintPageInfo info = {start, pji->current_line};
-			
+
 			/* New page */
 			pji->current_page++;
-			pji->current_height = height; 
+			pji->current_height = height;
 			g_array_append_val (pji->pages, info);
 			page_count++;
 		}
 		pji->current_line++;
-		
+
 		done = pji->current_pos >= pji->buffer_size;
 	}
-	
+
 	gtk_print_operation_set_n_pages (operation, pji->pages->len);
-	
+
 	return done;
 }
 
 /* Second function called after displaying print dialog but before start
  * printing */
 static void
-anjuta_print_begin (GtkPrintOperation        *operation, 
+anjuta_print_begin (GtkPrintOperation        *operation,
 					GtkPrintContext          *context,
 					PrintJobInfo *pji)
 {
 	gint i;
-	
+
 	/* Load Buffer to be printed. The buffer loaded is the text/style combination.*/
 	pji->buffer_size = scintilla_send_message(SCINTILLA(pji->te->scintilla), SCI_GETLENGTH, 0, 0);
 	pji->buffer = (gchar *) aneditor_command(pji->te->editor_id, ANE_GETSTYLEDTEXT, 0, pji->buffer_size);
@@ -889,7 +890,7 @@ anjuta_print_begin (GtkPrintOperation        *operation,
 		gtk_print_operation_cancel (operation);
 		anjuta_print_job_info_destroy(pji);
 	}
-	
+
 	/* State variables initializations */
 	g_array_set_size (pji->pages, 0);
 	for (i = 0; i < AN_PRINT_MAX_STYLES; i++) pji->styles_pool[i] = NULL;
@@ -901,7 +902,7 @@ anjuta_print_begin (GtkPrintOperation        *operation,
 
 	/* setup layout */
 	anjuta_setup_layout (pji, context);
-	
+
 	/* Margin settings */
 	anjuta_print_update_page_size_and_margins (pji, context);
 }
@@ -914,10 +915,10 @@ anjuta_print_setup (GSettings *settings, TextEditor *te)
 	GtkPrintOperation* operation;
 
 	scintilla_send_message (SCINTILLA (te->scintilla), SCI_COLOURISE, 0, -1);
-	
+
 	/* Anjuta print layout object */
 	pji = anjuta_print_job_info_new(te);
-	
+
 	/* Set preferences */
 	pji->print_line_numbers =
 		g_settings_get_boolean (settings, PRINT_LINENUM_COUNT);
@@ -928,10 +929,10 @@ anjuta_print_setup (GSettings *settings, TextEditor *te)
 	pji->wrapping =
 		g_settings_get_boolean (settings, PRINT_WRAP);
 	pji->tab_width =
-		g_settings_get_int (settings, TAB_SIZE);
+		g_settings_get_int (te->editor_settings, IANJUTA_EDITOR_TAB_WIDTH_KEY);
 	pji->zoom_factor = g_settings_get_int (settings, TEXT_ZOOM_FACTOR);
-	
-	
+
+
 	/* Set progress bar */
 	pji->status = anjuta_shell_get_status (te->shell, NULL);
 	anjuta_status_progress_reset (pji->status);
@@ -942,16 +943,16 @@ anjuta_print_setup (GSettings *settings, TextEditor *te)
 
 	gtk_print_operation_set_job_name (operation, te->filename);
 	gtk_print_operation_set_show_progress (operation, TRUE);
-	
-	g_signal_connect (G_OBJECT (operation), "begin-print", 
+
+	g_signal_connect (G_OBJECT (operation), "begin-print",
 					  G_CALLBACK (anjuta_print_begin), pji);
-	g_signal_connect (G_OBJECT (operation), "paginate", 
+	g_signal_connect (G_OBJECT (operation), "paginate",
 					  G_CALLBACK (anjuta_paginate), pji);
-	g_signal_connect (G_OBJECT (operation), "draw-page", 
+	g_signal_connect (G_OBJECT (operation), "draw-page",
 					  G_CALLBACK (anjuta_draw_page), pji);
-	g_signal_connect (G_OBJECT (operation), "end-print", 
+	g_signal_connect (G_OBJECT (operation), "end-print",
 					  G_CALLBACK (anjuta_end_print), pji);
-	
+
 	return operation;
 }
 
@@ -966,11 +967,11 @@ anjuta_print (gboolean preview, GSettings *settings, TextEditor *te)
 								  _("No file to print!"));
 		return;
 	}
-	
+
 	operation = anjuta_print_setup (settings, te);
-	gtk_print_operation_run (operation, 
+	gtk_print_operation_run (operation,
 							 preview ? GTK_PRINT_OPERATION_ACTION_PREVIEW :
 								 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
 								 NULL, NULL);
-	g_object_unref (operation);	
+	g_object_unref (operation);
 }
diff --git a/plugins/scintilla/properties.h b/plugins/scintilla/properties.h
index ecfe9e4..3e2ceab 100644
--- a/plugins/scintilla/properties.h
+++ b/plugins/scintilla/properties.h
@@ -32,12 +32,9 @@ extern "C" {
 /*
 #define INDENT_AUTOMATIC           "indent-automatic"
 */
-#define USE_TABS                   "use-tabs"
 #define BRACES_CHECK               "braces-check"
 #define DOS_EOL_CHECK              "editor-doseol"
 #define WRAP_BOOKMARKS             "editor-wrapbookmarks"
-#define TAB_SIZE                   "tabsize"
-#define INDENT_SIZE                "indent-size"
 /*
 #define INDENT_OPENING             "indent-opening"
 #define INDENT_CLOSING             "indent-closing"
diff --git a/plugins/scintilla/text_editor.c b/plugins/scintilla/text_editor.c
index 2d55377..0e05ec4 100644
--- a/plugins/scintilla/text_editor.c
+++ b/plugins/scintilla/text_editor.c
@@ -150,6 +150,7 @@ text_editor_instance_init (TextEditor *te)
 	te->settings = g_settings_new (PREF_SCHEMA);
 	te->docman_settings = g_settings_new (DOCMAN_PREF_SCHEMA);
 	te->msgman_settings = g_settings_new (MSGMAN_PREF_SCHEMA);
+	te->editor_settings = g_settings_new (ANJUTA_PREF_SCHEMA_PREFIX IANJUTA_EDITOR_PREF_SCHEMA);
 }
 
 static GtkWidget *
@@ -756,6 +757,7 @@ text_editor_dispose (GObject *obj)
 	g_object_unref (te->settings);
 	g_object_unref (te->docman_settings);
 	g_object_unref (te->msgman_settings);
+	g_object_unref (te->editor_settings);
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
 
diff --git a/plugins/scintilla/text_editor.h b/plugins/scintilla/text_editor.h
index 71fda41..06b56f2 100644
--- a/plugins/scintilla/text_editor.h
+++ b/plugins/scintilla/text_editor.h
@@ -87,6 +87,7 @@ struct _TextEditor
 	GSettings *settings;
 	GSettings *docman_settings;
 	GSettings *msgman_settings;
+	GSettings *editor_settings;
 
 	/* Editor ID and widget for AnEditor */
 	AnEditorID editor_id;
@@ -296,6 +297,8 @@ void text_editor_scintilla_command (TextEditor *te, gint command,
 
 #define PREF_SCHEMA		"org.gnome.anjuta.plugins.scintilla"
 
+#define ANJUTA_PREF_SCHEMA_PREFIX "org.gnome.anjuta."
+
 G_END_DECLS
 
 #endif
diff --git a/plugins/scintilla/text_editor_prefs.c b/plugins/scintilla/text_editor_prefs.c
index 2f32853..51bb57f 100644
--- a/plugins/scintilla/text_editor_prefs.c
+++ b/plugins/scintilla/text_editor_prefs.c
@@ -17,6 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
+#include <libanjuta/interfaces/ianjuta-editor.h>
 #include <libanjuta/anjuta-preferences.h>
 #include <libanjuta/anjuta-debug.h>
 
@@ -374,12 +375,13 @@ text_editor_prefs_init (TextEditor *te)
 	gint val;
 	GSettings *settings = te->settings;
 	GSettings *docman_settings = te->docman_settings;
+	GSettings *editor_settings = te->editor_settings;
 	
 	/* Sync prefs from gconf to props */
-	set_n_get_prop_int (settings, TAB_SIZE);
+	set_n_get_prop_int (editor_settings, IANJUTA_EDITOR_TAB_WIDTH_KEY);
 	set_n_get_prop_int (docman_settings, TEXT_ZOOM_FACTOR);
-	set_n_get_prop_int (settings, INDENT_SIZE);
-	set_n_get_prop_bool (settings, USE_TABS);
+	set_n_get_prop_int (editor_settings, IANJUTA_EDITOR_INDENT_WIDTH_KEY);
+	set_n_get_prop_bool (editor_settings, IANJUTA_EDITOR_USE_TABS_KEY);
 	set_n_get_prop_bool (settings, DISABLE_SYNTAX_HILIGHTING);
 	set_n_get_prop_bool (settings, WRAP_BOOKMARKS);
 	set_n_get_prop_bool (settings, BRACES_CHECK);
@@ -404,10 +406,10 @@ text_editor_prefs_init (TextEditor *te)
 	set_n_get_prop_int (settings, EDGE_COLUMN);
 	
 	/* Register gconf notifications */
-	REGISTER_NOTIFY (settings, TAB_SIZE, on_notify_tab_size);
+	REGISTER_NOTIFY (editor_settings, IANJUTA_EDITOR_TAB_WIDTH_KEY, on_notify_tab_size);
 	REGISTER_NOTIFY (docman_settings, TEXT_ZOOM_FACTOR, on_notify_zoom_factor);
-	REGISTER_NOTIFY (settings, INDENT_SIZE, on_notify_indent_size);
-	REGISTER_NOTIFY (settings, USE_TABS, on_notify_use_tab_for_indentation);
+	REGISTER_NOTIFY (editor_settings, IANJUTA_EDITOR_INDENT_WIDTH_KEY, on_notify_indent_size);
+	REGISTER_NOTIFY (editor_settings, IANJUTA_EDITOR_USE_TABS_KEY, on_notify_use_tab_for_indentation);
 	REGISTER_NOTIFY (settings, DISABLE_SYNTAX_HILIGHTING, on_notify_disable_hilite);
 	/* REGISTER_NOTIFY (settings, INDENT_AUTOMATIC, on_notify_automatic_indentation); */
 	REGISTER_NOTIFY (settings, WRAP_BOOKMARKS, on_notify_wrap_bookmarks);



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