[gbrainy] Initial Mallard documentation



commit 9ff10c0b4e850cd5099da0d8a1ca9bcaeb21dea1
Author: Jordi Mas <jmas softcatala org>
Date:   Thu Dec 24 18:51:27 2009 +0100

    Initial Mallard documentation

 Makefile.am                         |    4 ++-
 autogen.sh                          |   12 ++++++---
 configure.ac                        |    4 +++
 data/Makefile.am                    |    2 +-
 data/gbrainy.exe.config             |    4 ---
 help/C/figures/bottom.png           |  Bin 0 -> 8628 bytes
 help/C/figures/toolbar.png          |  Bin 0 -> 10488 bytes
 help/C/gametypes.page               |   18 +++++++++++++++
 help/C/index.page                   |   21 +++++++++++++++++
 help/C/introduction.page            |   14 +++++++++++
 help/C/playing.page                 |   42 +++++++++++++++++++++++++++++++++++
 help/C/preferences.page             |    9 +++++++
 help/C/scoring.page                 |    9 +++++++
 help/Makefile.am                    |   20 ++++++++++++++++
 help/gbrainy.omf.in                 |   10 ++++++++
 src/Clients/Classical/Makefile.am   |    3 +-
 src/Clients/Classical/gbrainy.cs    |   15 +++++++++---
 src/Clients/Classical/gbrainy.glade |   25 ++++++++++++++++++++
 src/Core/Makefile.am                |   23 ++++++++++++------
 src/Core/Platform/Unix.cs           |   17 ++++++++++++-
 src/Core/gbrainy.Core.dll.config.in |    5 ++++
 21 files changed, 231 insertions(+), 26 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 2e9a10f..fd280e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,8 @@
 SUBDIRS = 		\
 	src		\
 	data		\
-	po		
+	po		\
+	help
 
 desktop_in_files=	\
 	gbrainy.desktop.in	
@@ -22,6 +23,7 @@ EXTRA_DIST =			\
 	intltool-extract.in	\
 	intltool-merge.in	\
 	intltool-update.in	\
+	gnome-doc-utils.make	\
         $(desktop_in_files)     \
         $(desktop_files)
 
diff --git a/autogen.sh b/autogen.sh
index d2e431f..4b588b3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,3 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
 
 error () {
 	echo "Error: $1" 1>&2
@@ -77,6 +75,14 @@ grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null && {
   }
 }
 
+(which gnome-doc-prepare && gnome-doc-prepare )|| {
+	echo "**Error**: You must have gnome-common (sometimes packaged as gnome-doc-utils) installed to compile $PROJECT."
+	DIE=1
+}
+
+if test "$DIE" -eq 1; then
+	exit 1
+fi
 
 test $TEST_TYPE $FILE || {
 	echo "You must run this script in the top-level $PROJECT directory"
@@ -171,5 +177,3 @@ if test x$NOCONFIGURE = x; then
 else
   echo Skipping configure process.
 fi
-
-
diff --git a/configure.ac b/configure.ac
index 1a737ae..9ede20f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,9 @@ if test ! -x "$MCS"; then
 	AC_MSG_ERROR([No $CS compiler found])
 fi
 
+dnl -- Initialize docs
+
+GNOME_DOC_INIT
 
 dnl -- Check for mono pc file
 
@@ -141,6 +144,7 @@ src/Games/Makefile
 src/Clients/Classical/Makefile
 data/Makefile
 gbrainy.desktop
+help/Makefile
 ])
 
 echo "Support for older GTK:  ${enable_gtk_28}"
diff --git a/data/Makefile.am b/data/Makefile.am
index 3ec2543..55e0d26 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -68,4 +68,4 @@ uninstall-hook:
 
 noinst_DATA = 	
 
-EXTRA_DIST = $(pixmap_DATA) $(tango_icons) $(game_graphics) $(man_MANS) $(analogies_DATA) gbrainy.exe.config
+EXTRA_DIST = $(pixmap_DATA) $(tango_icons) $(game_graphics) $(man_MANS) $(analogies_DATA)
diff --git a/help/C/figures/bottom.png b/help/C/figures/bottom.png
new file mode 100644
index 0000000..febf31f
Binary files /dev/null and b/help/C/figures/bottom.png differ
diff --git a/help/C/figures/toolbar.png b/help/C/figures/toolbar.png
new file mode 100644
index 0000000..e70572a
Binary files /dev/null and b/help/C/figures/toolbar.png differ
diff --git a/help/C/gametypes.page b/help/C/gametypes.page
new file mode 100644
index 0000000..1b53fd4
--- /dev/null
+++ b/help/C/gametypes.page
@@ -0,0 +1,18 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="topic"
+      id="gametypes">
+<info>
+  <title type="sort">2</title>
+  <link type="guide" xref="index#introduction"/>
+</info>
+<title>Game Types</title>
+
+<p><app>gbrainy</app> is a brain teaser game and trainer to have fun and to keep your brain trained.</p>
+<p>It provides the following types of games:</p>
+<list>
+	<item><p>Logic puzzles. Games designed to challenge your reasoning and thinking skills.</p></item>
+	<item><p>Mental calculation. Games based on arithmetical operations designed to prove your mental calculation skills.</p></item>
+	<item><p>Memory trainers. Games designed to challenge your short term memory.</p></item>
+	<item><p>Verbal analogies. Games that challenge your verbal aptitude.</p></item>
+</list>
+</page>
diff --git a/help/C/index.page b/help/C/index.page
new file mode 100644
index 0000000..298b2af
--- /dev/null
+++ b/help/C/index.page
@@ -0,0 +1,21 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="guide"
+      id="index">
+	<title>gbrainy Help</title>
+
+	<info>
+		<include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"; />
+	</info>
+
+	<section id="introduction" style="1column">
+	    <title>Introduction</title>
+	</section>
+
+	<section id="playing" style="1column">
+		<title>Playing</title>
+	</section>
+
+	<section id="preferences" style="1column">
+		<title>Preferences</title>
+	</section>
+</page>
diff --git a/help/C/introduction.page b/help/C/introduction.page
new file mode 100644
index 0000000..d675541
--- /dev/null
+++ b/help/C/introduction.page
@@ -0,0 +1,14 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="topic"
+      id="introduction">
+<info>
+  <title type="sort">1</title>
+  <link type="guide" xref="index#introduction"/>
+</info>
+<title>Introduction</title>
+
+<p><app>gbrainy</app> is a brain teaser game and trainer to have fun and to keep your brain trained. </p>
+<p>It features different game types like logic puzzles, mental calculation games, memory trainers and verbal analogies designed to test different cognitive skills.</p>
+<p><app>gbrainy</app> influences are <link href="http://en.wikipedia.org/wiki/Terry_Stickels";>Terry Stickels</link> works and the <link href="http://en.wikipedia.org/wiki/Dr._Brain";>Dr. Brain</link> classical game.</p>
+<p>There have been recent discussions within the scientific community if brain training software improves cognitive performance. Most of the studies show that there is no or little improvement. However, you can have a good time playing games like gbrainy.</p>
+</page>
diff --git a/help/C/playing.page b/help/C/playing.page
new file mode 100644
index 0000000..3778ce0
--- /dev/null
+++ b/help/C/playing.page
@@ -0,0 +1,42 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="topic"
+      id="playing">
+<info>
+  <link type="guide" xref="index#playing"/>
+</info>
+<title>Playing</title>
+<section id="starting" style="1column">
+	<title>Starting a game</title>
+	<p>You can start a new game by clicking on the different buttons of the application toolbar.</p>
+	<media type="image" mime="image/png" src="figures/toolbar.png"></media>
+	<list>
+		<item><p><gui>All</gui>. Starts a new game playing all the available games.</p></item>
+		<item><p><gui>Logic</gui>. Starts a new game playing all the logic games.</p></item>
+		<item><p><gui>Calculation</gui>. Starts a new game playing all the calculation games.</p></item>
+		<item><p><gui>Memory</gui>. Starts a new game playing all the memory games.</p></item>
+		<item><p><gui>Verbal</gui>. Starts a new game playing all the verbal games.</p></item>
+	</list>
+	<p>You can also have the same functionality available under the <guiseq><gui>Game</gui> <gui>New Game</gui></guiseq> menu.</p>
+</section>
+
+<section id="during" style="1column">
+	<title>During the game</title>
+
+	<p>The game starts by showing a puzzle to the user and making a question. Read always the instructions carefully. </p>
+
+	<p>At the bottom of the application you have the main set of controls to interact with the game:</p>
+
+	<media type="image" mime="image/png" src="figures/bottom.png"></media>
+
+	<p>Once you know the answer you have to type it in the entry field next to the <gui>Answer:</gui>label</p>.
+
+	<p>Some puzzle include a tip that gives some guidance when trying to solve them. You can use the <gui>Tip</gui> button when it is enabled to get a tip.</p>
+
+	<p>Once you have answered the puzzle you will be informed if you did provide the right answer. You can use the <gui>Next</gui> button to go to the next puzzle.</p>
+
+</section>
+
+<section id="ending" style="1column">
+<title>Ending the game</title>
+</section>
+</page>
diff --git a/help/C/preferences.page b/help/C/preferences.page
new file mode 100644
index 0000000..b6bc1ee
--- /dev/null
+++ b/help/C/preferences.page
@@ -0,0 +1,9 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="topic"
+      id="preferences">
+<info>
+  <link type="guide" xref="preferences"/>
+</info>
+<title>Preferences</title>
+<b>TDB: How to use the preferences</b>
+</page>
diff --git a/help/C/scoring.page b/help/C/scoring.page
new file mode 100644
index 0000000..38a5674
--- /dev/null
+++ b/help/C/scoring.page
@@ -0,0 +1,9 @@
+<page xmlns="http://projectmallard.org/1.0/";
+      type="topic"
+      id="scoring">
+<info>
+  <link type="guide" xref="index#playing"/>
+</info>
+<title>Scoring</title>
+<b>TDB: How gbrainy scoring works</b>
+</page>
diff --git a/help/Makefile.am b/help/Makefile.am
new file mode 100644
index 0000000..429660c
--- /dev/null
+++ b/help/Makefile.am
@@ -0,0 +1,20 @@
+include $(top_srcdir)/gnome-doc-utils.make
+
+DOC_ID = gbrainy
+DOC_INCLUDES = legal.xml
+
+DOC_FIGURES = \
+	figures/toolbar.png	\
+	figures/bottom.png	
+
+DOC_PAGES = \
+	index.page \
+	introduction.page \
+	gametypes.page \
+	playing.page \
+	scoring.page \
+	preferences.page
+
+DOC_LINGUAS=
+
+dist-hook: doc-dist-hook
diff --git a/help/gbrainy.omf.in b/help/gbrainy.omf.in
new file mode 100644
index 0000000..f6a88b8
--- /dev/null
+++ b/help/gbrainy.omf.in
@@ -0,0 +1,10 @@
+<?xml version="1.0" standalone="no"?>
+<omf>
+  <resource>
+    <subject category="GNOME|Games"/>
+    <type>manual</type>
+    <relation seriesid="0b01a26b-b1f1-86eb-391c-b3f35e49013b20"/>
+    <rights type="by-sa 3.0" license.version="1.0" holder="Jordi Mas i Hernàndez"/>
+  </resource>
+</omf>
+
diff --git a/src/Clients/Classical/Makefile.am b/src/Clients/Classical/Makefile.am
index 1088c02..6589f86 100644
--- a/src/Clients/Classical/Makefile.am
+++ b/src/Clients/Classical/Makefile.am
@@ -1,4 +1,4 @@
-EXTRAFLAGS =  -nowarn:0169 $(CSC_DEFINES)
+EXTRAFLAGS =  -unsafe -nowarn:0169 $(CSC_DEFINES) 
 
 WRAPPER = gbrainy
 
@@ -54,7 +54,6 @@ EXTRA_DIST =					\
 
 
 CLEANFILES =					\
-	gbrainy.exe.config			\
 	gbrainy.exe.mdb				\
 	../../gbrainy.exe			\
 	gbrainy
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index e2ef3f5..4229fe7 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -106,10 +106,6 @@ namespace gbrainy.Clients.Classical
 			item.Activated += delegate (object sender, EventArgs ar) { Mono.Addins.Gui.AddinManagerWindow.Run (app_window);};
 		#endif
 
-			item = new Gtk.MenuItem (Catalog.GetString ("How to Extend gbrainy's Functionality"));
-			help_menu.Prepend (item);
-			item.Activated += delegate (object sender, EventArgs ar) { Process.Start ("http://live.gnome.org/gbrainy/Extending";);};
-
 			drawing_vbox.Add (drawing_area);
 			app_window.IconName = "gbrainy";
 			app_window.ShowAll ();
@@ -330,6 +326,12 @@ namespace gbrainy.Clients.Classical
 		{
 			AboutDialog about = new AboutDialog ();
 			about.Run ();
+		}
+
+		void OnMenuHelp (object sender, EventArgs args)
+		{
+			Unix.ShowUri (null, "ghelp:gbrainy", 
+				Gdk.EventHelper.GetTime (new Gdk.Event(IntPtr.Zero)));
 		}	
 
 		void OnAnswerButtonClicked (object sender, EventArgs args)
@@ -553,6 +555,11 @@ namespace gbrainy.Clients.Classical
 			full_screen = !full_screen;
 		}
 
+		void OnExtending (object sender, EventArgs args)
+		{
+			Process.Start ("http://live.gnome.org/gbrainy/Extending";);
+		}
+
 		public static void Main (string [] args) 
 		{
 			try {
diff --git a/src/Clients/Classical/gbrainy.glade b/src/Clients/Classical/gbrainy.glade
index 57cadd6..6c1484c 100644
--- a/src/Clients/Classical/gbrainy.glade
+++ b/src/Clients/Classical/gbrainy.glade
@@ -192,6 +192,31 @@
                 <child>
                   <widget class="GtkMenu" id="help_menu">
                     <child>
+                      <widget class="GtkImageMenuItem" id="contentsmenuitem">
+                        <property name="label" translatable="yes">_Contents</property>
+                        <property name="visible">True</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_stock">False</property>
+                        <signal name="activate" handler="OnMenuHelp"/>
+                        <accelerator key="F1" signal="activate"/>
+                        <child internal-child="image">
+                          <widget class="GtkImage" id="image1">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-help</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkImageMenuItem" id="extendmenuitem">
+                        <property name="label" translatable="yes">How to Extend gbrainy's Functionality</property>
+                        <property name="visible">True</property>
+                        <property name="use_underline">True</property>
+                        <property name="use_stock">False</property>
+                        <signal name="activate" handler="OnExtending"/>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkImageMenuItem" id="imagemenuitem3">
                         <property name="label">gtk-about</property>
                         <property name="visible">True</property>
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index ee546f0..ff89bec 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -1,6 +1,7 @@
-CSFLAGS = -target:library $(CSC_DEFINES)
+CSFLAGS = -unsafe -target:library $(CSC_DEFINES)
 
 TARGET = ../gbrainy.Core.dll
+TARGET_CFG = ../gbrainy.Core.dll.config
 
 CSFILES =  \
 		AssemblyInfo.cs			\
@@ -56,19 +57,25 @@ $(TARGET): $(SRCDIR_CSFILES) $(RES)
 	echo $(RES_FILES)
 	$(CSC) -out:$@ $(CSFLAGS) $(REFS) $(RES_CSFLAGS) $(SRCDIR_CSFILES)
 
-all: $(TARGET)
+$(TARGET_CFG): $(srcdir)/gbrainy.Core.dll.config.in
+	sed -e "s|\ pkglibdir\@|$(pkglibdir)|" \
+	    < $< > $@
 
-install-data-local: $(TARGET)
+all: $(TARGET) $(TARGET_CFG)
+
+install-data-local: $(TARGET) $(TARGET_CFG)
 	$(mkinstalldirs) $(DESTDIR)$(pkglibdir)
 	$(INSTALL_DATA) $(TARGET) $(DESTDIR)$(pkglibdir)
+	$(INSTALL_DATA) $(TARGET_CFG) $(DESTDIR)$(pkglibdir)
 
 uninstall-local:
 	cd $(DESTDIR)$(pkglibdir) && rm -f gbrainy.Core.dll
+	cd $(DESTDIR)$(pkglibdir) && rm -f gbrainy.Core.dll.config
 
 EXTRA_DIST = 			\
-	$(CSFILES) $(RES)
-
-CLEANFILES =			\
-	$(TARGET)		\
-	$(TARGET).mdb
+	$(CSFILES) $(RES) gbrainy.Core.dll.config.in
 
+CLEANFILES =				\
+	$(TARGET)			\
+	$(TARGET).mdb			\
+	$(TARGET_CFG)
diff --git a/src/Core/Platform/Unix.cs b/src/Core/Platform/Unix.cs
index fc26723..a1a5e30 100644
--- a/src/Core/Platform/Unix.cs
+++ b/src/Core/Platform/Unix.cs
@@ -38,8 +38,10 @@ namespace gbrainy.Core.Platform
 
 		[DllImport ("libc")] // BSD
 		static extern void setproctitle (byte [] fmt, byte [] str_arg);
-	 
-	
+
+		[DllImport("libgtk-win32-2.0-0.dll")]
+		static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
+
 		/* Taken from locale.h  */
 		[StructLayout (LayoutKind.Sequential)]
 		struct lconv
@@ -118,5 +120,16 @@ namespace gbrainy.Core.Platform
 					Encoding.ASCII.GetBytes (name + "\0"));
 			}
 		}
+
+		public static unsafe bool ShowUri (Gdk.Screen screen, string uri, uint timestamp) 
+		{
+			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+			IntPtr error = IntPtr.Zero;
+			bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
+			bool ret = raw_ret;
+			GLib.Marshaller.Free (native_uri);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			return ret;
+		}
 	}
 }
diff --git a/src/Core/gbrainy.Core.dll.config.in b/src/Core/gbrainy.Core.dll.config.in
new file mode 100644
index 0000000..3d17999
--- /dev/null
+++ b/src/Core/gbrainy.Core.dll.config.in
@@ -0,0 +1,5 @@
+<configuration>
+	<dllmap dll="rsvg-2" target="librsvg-2.so.2"/>
+	<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so.0"/>
+</configuration>
+



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