[anjuta] project-wizard: bgo #563986 - wizard generates modeline inconsistent with indentation prefs



commit 8c7f33e7577d9751ea55ca3210df76f0e7e18485
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Apr 22 15:53:10 2012 +0200

    project-wizard: bgo #563986 - wizard generates modeline inconsistent with indentation prefs

 plugins/project-wizard/druid.c                     |   35 ++++++++++-
 plugins/project-wizard/templates/Makefile.am       |    3 +-
 .../templates/anjuta-plugin/src/plugin.c           |    5 +-
 .../templates/anjuta-plugin/src/plugin.h           |    5 +-
 plugins/project-wizard/templates/cpp/src/main.cc   |    5 +-
 .../gnome-shell-extension/src/extension.js         |   62 ++++++++++----------
 plugins/project-wizard/templates/gtk/src/main.c    |    5 +-
 .../templates/gtkapplication/src/application.c     |   16 +++--
 .../templates/gtkapplication/src/application.h     |    5 +-
 .../templates/gtkapplication/src/main.c            |   25 ++++----
 plugins/project-wizard/templates/gtkmm/src/main.cc |    5 +-
 plugins/project-wizard/templates/indent.tpl        |   48 +++++++++++++++
 .../project-wizard/templates/java/src/main.java    |   11 ++-
 plugins/project-wizard/templates/library/src/lib.c |    5 +-
 plugins/project-wizard/templates/library/src/lib.h |    5 +-
 plugins/project-wizard/templates/mkfile/src/main.c |   10 +++-
 plugins/project-wizard/templates/pygtk/src/main.py |    6 ++-
 .../project-wizard/templates/python/src/main.py    |    4 +
 plugins/project-wizard/templates/sdl/src/main.c    |    4 +
 .../project-wizard/templates/terminal/src/main.c   |    5 +-
 .../templates/vala-gtk/src/main.vala               |    5 +-
 plugins/project-wizard/templates/wxwin/src/main.cc |   18 ++++--
 .../project-wizard/templates/xlib-dock/src/main.c  |    4 +
 .../templates/xlib-dock/src/wmgeneral.c            |    4 +
 .../templates/xlib-dock/src/wmgeneral.h            |    4 +
 plugins/project-wizard/templates/xlib/src/main.c   |    4 +
 26 files changed, 232 insertions(+), 76 deletions(-)
---
diff --git a/plugins/project-wizard/druid.c b/plugins/project-wizard/druid.c
index 7f17cc9..57ebe7f 100644
--- a/plugins/project-wizard/druid.c
+++ b/plugins/project-wizard/druid.c
@@ -37,6 +37,7 @@
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/interfaces/ianjuta-wizard.h>
+#include <libanjuta/interfaces/ianjuta-editor.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
 #include <glib.h>
@@ -56,6 +57,13 @@
 #define ANJUTA_PROJECT_DIRECTORY_PROPERTY "AnjutaProjectDirectory"
 #define USER_NAME_PROPERTY "UserName"
 #define EMAIL_ADDRESS_PROPERTY "EmailAddress"
+#define INDENT_WIDTH_PROPERTY "IndentWidth"
+#define TAB_WIDTH_PROPERTY "TabWidth"
+#define USE_TABS_PROPERTY "UseTabs"
+
+/* Common editor preferences */
+#define ANJUTA_PREF_SCHEMA_PREFIX "org.gnome.anjuta."
+
 
 /* Widget and signal name found in glade file
  *---------------------------------------------------------------------------*/
@@ -1204,8 +1212,10 @@ npw_druid_add_default_property (NPWDruid* druid)
 {
 	NPWValue* value;
 	gchar* s;
-	/* gchar* email; */
 	AnjutaPreferences* pref;
+	GSettings *settings;
+	gboolean flag;
+	gint i;
 
 	pref = anjuta_shell_get_preferences (ANJUTA_PLUGIN (druid->plugin)->shell, NULL);
 
@@ -1217,13 +1227,34 @@ npw_druid_add_default_property (NPWDruid* druid)
 	value = npw_value_heap_find_value (druid->values, USER_NAME_PROPERTY);
 	s = (gchar *)g_get_real_name();
 	npw_value_set_value (value, s, NPW_VALID_VALUE);
+
 	/* Add Email address */
 	value = npw_value_heap_find_value (druid->values, EMAIL_ADDRESS_PROPERTY);
-
 	/* FIXME: We need a default way for the mail */
 	s = anjuta_util_get_user_mail();
 	npw_value_set_value (value, s, NPW_VALID_VALUE);
 	g_free (s);
+
+	/* Add use-tabs property */
+	settings = g_settings_new (ANJUTA_PREF_SCHEMA_PREFIX IANJUTA_EDITOR_PREF_SCHEMA);
+	flag = g_settings_get_boolean (settings, IANJUTA_EDITOR_USE_TABS_KEY);
+	value = npw_value_heap_find_value (druid->values, USE_TABS_PROPERTY);
+	npw_value_set_value (value, flag ? "1" : "0", NPW_VALID_VALUE);
+
+	/* Add tab-width property */
+	i = g_settings_get_int (settings, IANJUTA_EDITOR_TAB_WIDTH_KEY);
+	value = npw_value_heap_find_value (druid->values, TAB_WIDTH_PROPERTY);
+	s = g_strdup_printf("%d", i);
+	npw_value_set_value (value, s, NPW_VALID_VALUE);
+	g_free (s);
+
+	/* Add indent-width property */
+	i = g_settings_get_int (settings, IANJUTA_EDITOR_INDENT_WIDTH_KEY);
+	value = npw_value_heap_find_value (druid->values, INDENT_WIDTH_PROPERTY);
+	s = g_strdup_printf("%d", i);
+	npw_value_set_value (value, s, NPW_VALID_VALUE);
+	g_free (s);
+	g_object_unref (settings);
 }
 
 /* Druid public functions
diff --git a/plugins/project-wizard/templates/Makefile.am b/plugins/project-wizard/templates/Makefile.am
index 3d6d7f7..8e95555 100644
--- a/plugins/project-wizard/templates/Makefile.am
+++ b/plugins/project-wizard/templates/Makefile.am
@@ -46,7 +46,8 @@ wizard_files_DATA = \
 	appwiz_sdl.png \
 	gnome.png \
 	gnome.svg \
-	$(template_in_files:.in=)
+	$(template_in_files:.in=) \
+	indent.tpl
 
 # Translate wiz file
 %.wiz: %.wiz.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -x -u -c $(top_builddir)/po/.intltool-merge-cache
diff --git a/plugins/project-wizard/templates/anjuta-plugin/src/plugin.c b/plugins/project-wizard/templates/anjuta-plugin/src/plugin.c
index 69cf734..c2cd829 100644
--- a/plugins/project-wizard/templates/anjuta-plugin/src/plugin.c
+++ b/plugins/project-wizard/templates/anjuta-plugin/src/plugin.c
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * plugin.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -174,3 +176,4 @@ static void
 
 ANJUTA_PLUGIN_BOILERPLATE ([+PluginClass+], [+NameCLower+]);
 ANJUTA_SIMPLE_PLUGIN ([+PluginClass+], [+NameCLower+]);
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/anjuta-plugin/src/plugin.h b/plugins/project-wizard/templates/anjuta-plugin/src/plugin.h
index 454042e..d9299ec 100644
--- a/plugins/project-wizard/templates/anjuta-plugin/src/plugin.h
+++ b/plugins/project-wizard/templates/anjuta-plugin/src/plugin.h
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * plugin.h
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -28,3 +30,4 @@ struct _[+PluginClass+]Class{
 };
 
 #endif
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/cpp/src/main.cc b/plugins/project-wizard/templates/cpp/src/main.cc
index 0f1638d..3faa857 100644
--- a/plugins/project-wizard/templates/cpp/src/main.cc
+++ b/plugins/project-wizard/templates/cpp/src/main.cc
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.cc
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -15,3 +17,4 @@ int main()
 	std::cout << "Hello world!" << std::endl;
 	return 0;
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js b/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js
index 45b179f..785c811 100755
--- a/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js
+++ b/plugins/project-wizard/templates/gnome-shell-extension/src/extension.js
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="js2" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * extension.js
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -18,50 +20,50 @@ const Extension = imports.ui.extensionSystem.extensions['[+UUID+]'];
 let text, button;
 
 function _hideHello() {
-    Main.uiGroup.remove_actor(text);
-    text = null;
+	Main.uiGroup.remove_actor(text);
+	text = null;
 }
 
 function _showHello() {
-    if (!text) {
-        text = new St.Label({ style_class: '[+NameHLower+]-label', text: "Hello, world!" });
-        Main.uiGroup.add_actor(text);
-    }
+	if (!text) {
+		text = new St.Label({ style_class: '[+NameHLower+]-label', text: "Hello, world!" });
+		Main.uiGroup.add_actor(text);
+	}
 
-    text.opacity = 255;
+	text.opacity = 255;
 
-    let monitor = Main.layoutManager.primaryMonitor;
+	let monitor = Main.layoutManager.primaryMonitor;
 
-    text.set_position(Math.floor(monitor.width / 2 - text.width / 2),
-                      Math.floor(monitor.height / 2 - text.height / 2));
+	text.set_position(Math.floor(monitor.width / 2 - text.width / 2),
+		Math.floor(monitor.height / 2 - text.height / 2));
 
-    Tweener.addTween(text,
-                     { opacity: 0,
-                       time: 2,
-                       transition: 'easeOutQuad',
-                       onComplete: _hideHello });
+	Tweener.addTween(text,
+		{ opacity: 0,
+		time: 2,
+		transition: 'easeOutQuad',
+		onComplete: _hideHello });
 }
 
 function init() {
-    button = new St.Bin({ style_class: 'panel-button',
-                          reactive: true,
-                          can_focus: true,
-                          x_fill: true,
-                          y_fill: false,
-                          track_hover: true });
-    let icon = new St.Icon({ icon_name: 'system-run',
-                             icon_type: St.IconType.SYMBOLIC,
-                             style_class: 'system-status-icon' });
+	button = new St.Bin({ style_class: 'panel-button',
+	                      reactive: true,
+	                      can_focus: true,
+	                      x_fill: true,
+	                      y_fill: false,
+	                      track_hover: true });
+	let icon = new St.Icon({ icon_name: 'system-run',
+	                         icon_type: St.IconType.SYMBOLIC,
+	                         style_class: 'system-status-icon' });
 
-    button.set_child(icon);
-    button.connect('button-press-event', _showHello);
+	button.set_child(icon);
+	button.connect('button-press-event', _showHello);
 }
 
 function enable() {
-    Main.panel._rightBox.insert_actor(button, 0);
+	Main.panel._rightBox.insert_actor(button, 0);
 }
 
 function disable() {
-    Main.panel._rightBox.remove_actor(button);
+	Main.panel._rightBox.remove_actor(button);
 }
-
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtk/src/main.c b/plugins/project-wizard/templates/gtk/src/main.c
index 07a34b5..97d8024 100644
--- a/plugins/project-wizard/templates/gtk/src/main.c
+++ b/plugins/project-wizard/templates/gtk/src/main.c
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -115,3 +117,4 @@ main (int argc, char *argv[])
 [+ENDIF+]
 	return 0;
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtkapplication/src/application.c b/plugins/project-wizard/templates/gtkapplication/src/application.c
index 298e3b6..7f73f80 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/application.c
+++ b/plugins/project-wizard/templates/gtkapplication/src/application.c
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * [+NameLower+].c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -58,7 +60,7 @@ static void
 	window = GTK_WIDGET (gtk_builder_get_object (builder, TOP_WINDOW));
         if (!window)
         {
-                g_critical ("Widget \"%s\" is missing in file %s.",
+		g_critical ("Widget \"%s\" is missing in file %s.",
 				TOP_WINDOW,
 				UI_FILE);
         }
@@ -85,7 +87,7 @@ static void
 static void
 [+NameCLower+]_activate (GApplication *application)
 {
-  [+NameCLower+]_new_window (application, NULL);
+	[+NameCLower+]_new_window (application, NULL);
 }
 
 static void
@@ -94,10 +96,10 @@ static void
                      gint           n_files,
                      const gchar   *hint)
 {
-  gint i;
+	gint i;
 
-  for (i = 0; i < n_files; i++)
-    [+NameCLower+]_new_window (application, files[i]);
+	for (i = 0; i < n_files; i++)
+		[+NameCLower+]_new_window (application, files[i]);
 }
 
 static void
@@ -109,7 +111,6 @@ static void
 static void
 [+NameCLower+]_finalize (GObject *object)
 {
-
 	G_OBJECT_CLASS ([+NameCLower+]_parent_class)->finalize (object);
 }
 
@@ -134,3 +135,4 @@ static void
 	                     "flags", G_APPLICATION_HANDLES_OPEN,
 	                     NULL);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtkapplication/src/application.h b/plugins/project-wizard/templates/gtkapplication/src/application.h
index 4327f5e..44f3061 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/application.h
+++ b/plugins/project-wizard/templates/gtkapplication/src/application.h
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * [+NameLower+].h
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -47,3 +49,4 @@ GType [+NameCLower+]_get_type (void) G_GNUC_CONST;
 G_END_DECLS
 
 #endif /* _APPLICATION_H_ */
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtkapplication/src/main.c b/plugins/project-wizard/templates/gtkapplication/src/main.c
index de4d96a..db04dce 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/main.c
+++ b/plugins/project-wizard/templates/gtkapplication/src/main.c
@@ -1,14 +1,14 @@
 [+ autogen5 template +]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
- * Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
- * 
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "Name") (get "Author") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "Name")                " * ")+]
-[+ESAC+] */
+ * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
+ *
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "Name") OWNER=(get "Author") \+] 
+ */
 
 #include <config.h>
 #include <gtk/gtk.h>
@@ -32,9 +32,10 @@ main (int argc, char *argv[])
 #endif
 [+ENDIF+]
 	
-  app = [+NameCLower+]_new ();
-  status = g_application_run (G_APPLICATION (app), argc, argv);
-  g_object_unref (app);
+	app = [+NameCLower+]_new ();
+	status = g_application_run (G_APPLICATION (app), argc, argv);
+	g_object_unref (app);
 
-  return status;
+	return status;
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/gtkmm/src/main.cc b/plugins/project-wizard/templates/gtkmm/src/main.cc
index 0273cf7..681958e 100644
--- a/plugins/project-wizard/templates/gtkmm/src/main.cc
+++ b/plugins/project-wizard/templates/gtkmm/src/main.cc
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.cc
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -55,3 +57,4 @@ main (int argc, char *argv[])
 	}
 	return 0;
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/indent.tpl b/plugins/project-wizard/templates/indent.tpl
new file mode 100644
index 0000000..b186b39
--- /dev/null
+++ b/plugins/project-wizard/templates/indent.tpl
@@ -0,0 +1,48 @@
+[+ autogen5 template +]
+[+DEFINE START-INDENT \+]
+[+(out-push-new)\+]
+[+ENDDEF \+]
+[+DEFINE END-INDENT \+]
+[+(for-each
+	indent
+	(string-split (out-pop #t) #\nl);
+)\+]
+[+ENDDEF \+]
+[+(define
+	indentation
+	(lambda
+		(tab)
+		(let*
+			(
+				(use-tabs (not (zero? (or (string->number (get "UseTabs")) 8))))
+				(tab-width (or (string->number (get "TabWidth")) 8))
+				(indent-width (or (string->number (get "IndentWidth")) 1))
+				(spaces (* tab indent-width))
+				(tab-indent (if use-tabs (quotient spaces tab-width) 0))
+				(space-indent (- spaces (* tab-indent tab-width)))
+			)
+			(string-append
+				(make-string tab-indent #\ht)
+				(make-string space-indent #\sp)
+			)
+		)
+	)
+)
+(define
+	indent
+	(lambda
+		(line)
+		(let
+			((tab (or (string-skip line #\ht) 0)))
+			(emit 
+				(string-append
+					(indentation tab)
+					(string-drop line tab)
+					"\n"
+				)
+			)
+		)	
+	)
+) \+]
+[+DEFINE EMACS-MODELINE \+]
+-*- Mode: [+MODE+]; indent-tabs-mode: [+(if (== (get "UseTabs") "1") "t" "nil")+]; c-basic-offset: [+IndentWidth+]; tab-width: [+TabWidth+] -*- [+ENDDEF \+]
diff --git a/plugins/project-wizard/templates/java/src/main.java b/plugins/project-wizard/templates/java/src/main.java
index cb50e69..e0ce48f 100644
--- a/plugins/project-wizard/templates/java/src/main.java
+++ b/plugins/project-wizard/templates/java/src/main.java
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * [+MainClass+].java
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -9,7 +11,8 @@
  */
 
 class [+MainClass+] {
-    public static void main(String[] args) {
-        System.out.println("Hello World!");
-    }
+	public static void main(String[] args) {
+		System.out.println("Hello World!");
+	}
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/library/src/lib.c b/plugins/project-wizard/templates/library/src/lib.c
index acdb6b1..0407e8a 100644
--- a/plugins/project-wizard/templates/library/src/lib.c
+++ b/plugins/project-wizard/templates/library/src/lib.c
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * lib.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -15,3 +17,4 @@ int [+NameCLower+]_func(void)
 	printf("Hello world\n");
 	return (0);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/library/src/lib.h b/plugins/project-wizard/templates/library/src/lib.h
index b01060a..4b380a3 100644
--- a/plugins/project-wizard/templates/library/src/lib.h
+++ b/plugins/project-wizard/templates/library/src/lib.h
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * lib.h
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -9,3 +11,4 @@
  */
 
 int [+NameCLower+]_func (void);
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/mkfile/src/main.c b/plugins/project-wizard/templates/mkfile/src/main.c
index 2fb9faf..60b3ee1 100644
--- a/plugins/project-wizard/templates/mkfile/src/main.c
+++ b/plugins/project-wizard/templates/mkfile/src/main.c
@@ -1,8 +1,13 @@
 [+ autogen5 template +]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
- * main.c - Auto-generated by Anjuta's Makefile project wizard
+ * main.c
+ * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
  * 
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "Name") OWNER=(get "Author") \+]
  */
 
 #include <stdio.h>
@@ -11,3 +16,4 @@ int main()
 	printf("Hello world\n");
 	return (0);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/pygtk/src/main.py b/plugins/project-wizard/templates/pygtk/src/main.py
index 89e6d19..55746d1 100644
--- a/plugins/project-wizard/templates/pygtk/src/main.py
+++ b/plugins/project-wizard/templates/pygtk/src/main.py
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+# [+INVOKE EMACS-MODELINE MODE="Python" \+]
+[+INVOKE START-INDENT\+]
 #!/usr/bin/python
 #
 # main.py
@@ -41,4 +44,5 @@ def main():
 	Gtk.main()
 		
 if __name__ == "__main__":
-    sys.exit(main())
+	sys.exit(main())
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/python/src/main.py b/plugins/project-wizard/templates/python/src/main.py
index 2c05af1..e7d2c08 100644
--- a/plugins/project-wizard/templates/python/src/main.py
+++ b/plugins/project-wizard/templates/python/src/main.py
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+# [+INVOKE EMACS-MODELINE MODE="Python" \+]
+[+INVOKE START-INDENT\+]
 #!/usr/bin/python
 #
 # main.py
@@ -8,3 +11,4 @@
 [+INVOKE LICENSE-DESCRIPTION PFX="# " PROGRAM=(get "Name") OWNER=(get "Author") \+]
 
 print "Hello World!"
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/sdl/src/main.c b/plugins/project-wizard/templates/sdl/src/main.c
index 0af7962..740049f 100644
--- a/plugins/project-wizard/templates/sdl/src/main.c
+++ b/plugins/project-wizard/templates/sdl/src/main.c
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -65,3 +68,4 @@ int main (int argc, char *argv[])
 	
 	return(0);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/terminal/src/main.c b/plugins/project-wizard/templates/terminal/src/main.c
index 8283a5b..60b3ee1 100644
--- a/plugins/project-wizard/templates/terminal/src/main.c
+++ b/plugins/project-wizard/templates/terminal/src/main.c
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -14,3 +16,4 @@ int main()
 	printf("Hello world\n");
 	return (0);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/vala-gtk/src/main.vala b/plugins/project-wizard/templates/vala-gtk/src/main.vala
index 6b92fc5..44881ce 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/main.vala
+++ b/plugins/project-wizard/templates/vala-gtk/src/main.vala
@@ -1,6 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -65,3 +67,4 @@ public class Main : Object
 		return 0;
 	}
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/wxwin/src/main.cc b/plugins/project-wizard/templates/wxwin/src/main.cc
index e96115f..f0a9738 100644
--- a/plugins/project-wizard/templates/wxwin/src/main.cc
+++ b/plugins/project-wizard/templates/wxwin/src/main.cc
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.cc
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -8,23 +11,24 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#  include <config.h>
+#include <config.h>
 #endif
 #include <wx/wx.h>
 
 class MyApp : public wxApp
 {
-  public:
-    virtual bool OnInit();
+public:
+	virtual bool OnInit();
 };
 
 IMPLEMENT_APP(MyApp)
 
 bool MyApp::OnInit()
 {
-  wxFrame *frame = new wxFrame((wxFrame *)NULL, -1, "Hello World",
-                               wxPoint(50, 50), wxSize(450, 340));
+	wxFrame *frame = new wxFrame((wxFrame *)NULL, -1, "Hello World",
+		wxPoint(50, 50), wxSize(450, 340));
 
-  frame->Show(TRUE);
-  return TRUE;
+	frame->Show(TRUE);
+	return TRUE;
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/xlib-dock/src/main.c b/plugins/project-wizard/templates/xlib-dock/src/main.c
index 4459526..9119e0d 100644
--- a/plugins/project-wizard/templates/xlib-dock/src/main.c
+++ b/plugins/project-wizard/templates/xlib-dock/src/main.c
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -73,3 +76,4 @@ int main(int argc, char *argv[])
 	/* we should never get here */
 	return (0);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.c b/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.c
index a05bda5..5303d8f 100644
--- a/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.c
+++ b/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.c
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * wmgeneral.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -291,3 +294,4 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	XSetCommand(display, win, argv, argc);
 	XMapWindow(display, win);
 }
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.h b/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.h
index 7c86a64..483024a 100644
--- a/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.h
+++ b/plugins/project-wizard/templates/xlib-dock/src/wmgeneral.h
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * wmgeneral.h
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -44,3 +47,4 @@ void setMaskXY(int, int);
 void parse_rcfile(const char *, rckeys *);
 
 #endif
+[+INVOKE END-INDENT\+]
diff --git a/plugins/project-wizard/templates/xlib/src/main.c b/plugins/project-wizard/templates/xlib/src/main.c
index 8d3c2a7..852a493 100644
--- a/plugins/project-wizard/templates/xlib/src/main.c
+++ b/plugins/project-wizard/templates/xlib/src/main.c
@@ -1,5 +1,8 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
+[+INCLUDE (string-append "indent.tpl") \+]
+/* [+INVOKE EMACS-MODELINE MODE="C" \+] */
+[+INVOKE START-INDENT\+]
 /*
  * main.c
  * Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
@@ -74,3 +77,4 @@ int main (int argc, char *argv[])
 	}
 	return(0);
 }
+[+INVOKE END-INDENT\+]



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