[genius] Fri Sep 05 20:46:23 2014 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Fri Sep 05 20:46:23 2014 Jiri (George) Lebl <jirka 5z com>
- Date: Sat, 6 Sep 2014 01:48:02 +0000 (UTC)
commit 8da2cb54835610904c0a9a0ea17102c2a6741a3a
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Fri Sep 5 20:47:48 2014 -0500
Fri Sep 05 20:46:23 2014 Jiri (George) Lebl <jirka 5z com>
* src/gnome-genius.c, src/examples.[ch]: rename tutorials to examples
I really like that wording bettter
* tutors -> examples: move all the files
* configure.in, Makefile.am: move to examples
ChangeLog | 9 +++
Makefile.am | 2 +-
NEWS | 4 +-
configure.in | 2 +-
{tutors => examples}/Makefile.am | 8 +-
{tutors => examples}/cantor.gel | 0
{tutors => examples}/dalemb-pulse.gel | 0
{tutors => examples}/eulers-method-exp-run.gel | 0
{tutors => examples}/eulers-method-graphs-exp.gel | 0
examples/fourier-series-animation.gel | 37 +++++++++++
.../fourier-series-half-sawtooth.gel | 0
{tutors => examples}/laplace-fdm.gel | 0
{tutors => examples}/linapprox.gel | 0
{tutors => examples}/lorenz.gel | 0
{tutors => examples}/newton-calc-sqrt2.gel | 0
{tutors => examples}/newton-sqrt2.gel | 0
{tutors => examples}/shocks.gel | 0
{tutors => examples}/sierpinski.gel | 0
{tutors => examples}/standing-waves.gel | 0
{tutors => examples}/strange-attractor.gel | 0
{tutors => examples}/taylor-exp.gel | 0
{tutors => examples}/taylor-sin.gel | 0
src/Makefile.am | 4 +-
src/{tutors.c => examples.c} | 62 ++++++++++----------
src/{tutors.h => examples.h} | 14 ++--
src/gnome-genius.c | 64 ++++++++++----------
tutors/fourier-series-animation.gel | 33 ----------
27 files changed, 126 insertions(+), 113 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a86561e..563760b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Sep 05 20:46:23 2014 Jiri (George) Lebl <jirka 5z com>
+
+ * src/gnome-genius.c, src/examples.[ch]: rename tutorials to examples
+ I really like that wording bettter
+
+ * tutors -> examples: move all the files
+
+ * configure.in, Makefile.am: move to examples
+
Fri Sep 05 17:47:03 2014 Jiri (George) Lebl <jirka 5z com>
* tutors/fourier*.gel: add some fourier series tutors
diff --git a/Makefile.am b/Makefile.am
index 09b28e9..7c83fa7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = ve gtkextra src pixmaps tutors lib po help
+SUBDIRS = ve gtkextra src pixmaps examples lib po help
mimeinfodir = $(datadir)/mime-info
mimeinfo_DATA = genius.keys genius.mime
diff --git a/NEWS b/NEWS
index 388e2b1..5fcffa2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
Changes to 1.0.19
-* New menu: Tutorials. These are annotated programs that show some
+* New menu: Examples. These are annotated programs that show some
mathematical concept. Generally taken from the classes I have been teaching.
- They are installed under prefix/share/genius/tutors/ and are mostly using
+ They are installed under prefix/share/genius/examples/ and are mostly using
graphics so only work in the graphical GNOME/GTK version
* New 3D graphing functions, SurfacePlotDrawLine, SurfacePlotDrawPoints,
SurfacePlotClear
diff --git a/configure.in b/configure.in
index a63f53b..9562769 100644
--- a/configure.in
+++ b/configure.in
@@ -282,7 +282,7 @@ lib/symbolic/Makefile
lib/commutative_algebra/Makefile
ve/Makefile
gtkextra/Makefile
-tutors/Makefile
+examples/Makefile
pixmaps/Makefile
pixmaps/32x32/Makefile
pixmaps/48x48/Makefile
diff --git a/tutors/Makefile.am b/examples/Makefile.am
similarity index 83%
rename from tutors/Makefile.am
rename to examples/Makefile.am
index bd5bb35..0f112ea 100644
--- a/tutors/Makefile.am
+++ b/examples/Makefile.am
@@ -1,6 +1,6 @@
-tutordir = \
- $(datadir)/genius/tutors/
-tutor_DATA = \
+exampledir = \
+ $(datadir)/genius/examples/
+example_DATA = \
cantor.gel \
dalemb-pulse.gel \
eulers-method-exp-run.gel \
@@ -20,4 +20,4 @@ tutor_DATA = \
fourier-series-half-sawtooth.gel
EXTRA_DIST = \
- $(tutor_DATA)
+ $(example_DATA)
diff --git a/tutors/cantor.gel b/examples/cantor.gel
similarity index 100%
rename from tutors/cantor.gel
rename to examples/cantor.gel
diff --git a/tutors/dalemb-pulse.gel b/examples/dalemb-pulse.gel
similarity index 100%
rename from tutors/dalemb-pulse.gel
rename to examples/dalemb-pulse.gel
diff --git a/tutors/eulers-method-exp-run.gel b/examples/eulers-method-exp-run.gel
similarity index 100%
rename from tutors/eulers-method-exp-run.gel
rename to examples/eulers-method-exp-run.gel
diff --git a/tutors/eulers-method-graphs-exp.gel b/examples/eulers-method-graphs-exp.gel
similarity index 100%
rename from tutors/eulers-method-graphs-exp.gel
rename to examples/eulers-method-graphs-exp.gel
diff --git a/examples/fourier-series-animation.gel b/examples/fourier-series-animation.gel
new file mode 100644
index 0000000..6a3e13f
--- /dev/null
+++ b/examples/fourier-series-animation.gel
@@ -0,0 +1,37 @@
+# Category: Differential Equations
+# Name: Fourier series animation (Gibbs phenomenon)
+#
+# Animation where a discontinuity appears and disappears to exhibit
+# Gibbs phenomenon
+#
+
+# The computation can be slow, so be patient when running...
+
+# The function (h is a parameter)
+function F(x) = (
+ while x < -pi do increment x by 2*pi;
+ while x > pi do increment x by -2*pi;
+
+ if x < 0 then 2*h*(x+pi/2)/pi else 2-h
+);
+
+
+LinePlotWindow=[-pi*1.1,pi*1.1,-3,3];
+LinePlotDrawLegends=false;
+
+# For faster animation, precompute,
+print("Precomputing Fourier Series...");
+hvals = [0.0:0.1:2.0,2.0:-0.1:0.0];
+for n=1 to elements(hvals) do (
+ h = hvals@(n);
+ printn (n + "/" + elements(hvals) + "...");
+ fs@(n) = NumericalFourierSeriesFunction (F, pi, 10);
+);
+print("Done... Starting animation...");
+
+for k = 1 to 3 do (
+ for n = 1 to elements(hvals) do (
+ h = hvals@(n);
+ LinePlot(F, fs@(n))
+ )
+)
diff --git a/tutors/fourier-series-half-sawtooth.gel b/examples/fourier-series-half-sawtooth.gel
similarity index 100%
rename from tutors/fourier-series-half-sawtooth.gel
rename to examples/fourier-series-half-sawtooth.gel
diff --git a/tutors/laplace-fdm.gel b/examples/laplace-fdm.gel
similarity index 100%
rename from tutors/laplace-fdm.gel
rename to examples/laplace-fdm.gel
diff --git a/tutors/linapprox.gel b/examples/linapprox.gel
similarity index 100%
rename from tutors/linapprox.gel
rename to examples/linapprox.gel
diff --git a/tutors/lorenz.gel b/examples/lorenz.gel
similarity index 100%
rename from tutors/lorenz.gel
rename to examples/lorenz.gel
diff --git a/tutors/newton-calc-sqrt2.gel b/examples/newton-calc-sqrt2.gel
similarity index 100%
rename from tutors/newton-calc-sqrt2.gel
rename to examples/newton-calc-sqrt2.gel
diff --git a/tutors/newton-sqrt2.gel b/examples/newton-sqrt2.gel
similarity index 100%
rename from tutors/newton-sqrt2.gel
rename to examples/newton-sqrt2.gel
diff --git a/tutors/shocks.gel b/examples/shocks.gel
similarity index 100%
rename from tutors/shocks.gel
rename to examples/shocks.gel
diff --git a/tutors/sierpinski.gel b/examples/sierpinski.gel
similarity index 100%
rename from tutors/sierpinski.gel
rename to examples/sierpinski.gel
diff --git a/tutors/standing-waves.gel b/examples/standing-waves.gel
similarity index 100%
rename from tutors/standing-waves.gel
rename to examples/standing-waves.gel
diff --git a/tutors/strange-attractor.gel b/examples/strange-attractor.gel
similarity index 100%
rename from tutors/strange-attractor.gel
rename to examples/strange-attractor.gel
diff --git a/tutors/taylor-exp.gel b/examples/taylor-exp.gel
similarity index 100%
rename from tutors/taylor-exp.gel
rename to examples/taylor-exp.gel
diff --git a/tutors/taylor-sin.gel b/examples/taylor-sin.gel
similarity index 100%
rename from tutors/taylor-sin.gel
rename to examples/taylor-sin.gel
diff --git a/src/Makefile.am b/src/Makefile.am
index e33026b..40e3c99 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,8 +75,8 @@ gnome_genius_SOURCES = \
parseutil.c \
inter.c \
inter.h \
- tutors.c \
- tutors.h \
+ examples.c \
+ examples.h \
plugin.c \
plugin.h \
plugread.c \
diff --git a/src/tutors.c b/src/examples.c
similarity index 73%
rename from src/tutors.c
rename to src/examples.c
index 81b233d..18f5653 100644
--- a/src/tutors.c
+++ b/src/examples.c
@@ -47,17 +47,17 @@
#include "parse.h"
-#include "tutors.h"
+#include "examples.h"
#include "binreloc.h"
-GSList *gel_tutor_list = NULL;
+GSList *gel_example_list = NULL;
static GHashTable *opened = NULL;
static GHashTable *info = NULL;
-static GelTutorial *
-gel_readtutor (const char *dir_name, const char *file_name)
+static GelExample *
+gel_readexample (const char *dir_name, const char *file_name)
{
char *f = g_build_filename (ve_sure_string (dir_name),
ve_sure_string (file_name), NULL);
@@ -66,7 +66,7 @@ gel_readtutor (const char *dir_name, const char *file_name)
char *name;
char *cat;
char *s;
- GelTutorial *tut = NULL;
+ GelExample *exam = NULL;
fp = fopen (f, "r");
@@ -109,25 +109,25 @@ gel_readtutor (const char *dir_name, const char *file_name)
fclose (fp);
- tut = g_new (GelTutorial, 1);
- tut->category = cat;
- tut->name = name;
- tut->file = f;
+ exam = g_new (GelExample, 1);
+ exam->category = cat;
+ exam->name = name;
+ exam->file = f;
- return tut;
+ return exam;
}
static void
-free_tutor(GelTutorial *tut)
+free_example(GelExample *exam)
{
- g_free (tut->category);
- g_free (tut->name);
- g_free (tut->file);
- g_free (tut);
+ g_free (exam->category);
+ g_free (exam->name);
+ g_free (exam->file);
+ g_free (exam);
}
static void
-read_tutors_from_dir (const char *dir_name)
+read_examples_from_dir (const char *dir_name)
{
DIR *dir;
struct dirent *dent;
@@ -138,7 +138,7 @@ read_tutors_from_dir (const char *dir_name)
}
while((dent = readdir (dir)) != NULL) {
char *p;
- GelTutorial *tut;
+ GelExample *exam;
if(dent->d_name[0] == '.' &&
(dent->d_name[1] == '\0' ||
(dent->d_name[1] == '.' &&
@@ -147,16 +147,16 @@ read_tutors_from_dir (const char *dir_name)
p = strrchr(dent->d_name,'.');
if(!p || strcmp(p,".gel")!=0)
continue;
- tut = gel_readtutor (dir_name, dent->d_name);
- if (tut != NULL) {
- gel_tutor_list = g_slist_prepend (gel_tutor_list, tut);
+ exam = gel_readexample (dir_name, dent->d_name);
+ if (exam != NULL) {
+ gel_example_list = g_slist_prepend (gel_example_list, exam);
}
}
closedir (dir);
}
static int
-compare_tutors (GelTutorial *a, GelTutorial *b)
+compare_examples (GelExample *a, GelExample *b)
{
int s = strcmp (a->category, b->category);
if (s != 0)
@@ -165,28 +165,28 @@ compare_tutors (GelTutorial *a, GelTutorial *b)
}
void
-gel_read_tutor_list (void)
+gel_read_example_list (void)
{
char *dir_name;
char *datadir;
/*free the previous list*/
- g_slist_foreach (gel_tutor_list, (GFunc)free_tutor, NULL);
- g_slist_free (gel_tutor_list);
- gel_tutor_list = NULL;
+ g_slist_foreach (gel_example_list, (GFunc)free_example, NULL);
+ g_slist_free (gel_example_list);
+ gel_example_list = NULL;
datadir = gbr_find_data_dir (DATADIR);
- dir_name = g_build_filename (datadir, "genius", "tutors", NULL);
+ dir_name = g_build_filename (datadir, "genius", "examples", NULL);
g_free (datadir);
- read_tutors_from_dir (dir_name);
+ read_examples_from_dir (dir_name);
g_free (dir_name);
dir_name = g_build_filename (g_get_home_dir (),
- ".genius", "tutors", NULL);
- read_tutors_from_dir (dir_name);
+ ".genius", "examples", NULL);
+ read_examples_from_dir (dir_name);
g_free (dir_name);
/* FIXME: should do more */
- gel_tutor_list = g_slist_sort (gel_tutor_list,
- compare_tutors);
+ gel_example_list = g_slist_sort (gel_example_list,
+ compare_examples);
}
diff --git a/src/tutors.h b/src/examples.h
similarity index 82%
rename from src/tutors.h
rename to src/examples.h
index f7b15ca..6d24a50 100644
--- a/src/tutors.h
+++ b/src/examples.h
@@ -19,16 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef TUTOR_H__
-#define TUTOR_H__
+#ifndef EXAMPLES_H__
+#define EXAMPLES_H__
-typedef struct _GelTutorial {
+typedef struct _GelExample {
char *category;
char *name;
char *file;
-} GelTutorial;
+} GelExample;
-void gel_read_tutor_list(void);
-extern GSList *gel_tutor_list;
+void gel_read_example_list(void);
+extern GSList *gel_example_list;
-#endif /* PLUGIN_H__ */
+#endif /* EXAMPLES_H__ */
diff --git a/src/gnome-genius.c b/src/gnome-genius.c
index 882d4d0..a4af9cc 100644
--- a/src/gnome-genius.c
+++ b/src/gnome-genius.c
@@ -47,7 +47,7 @@
#include "graphing.h"
#include "plugin.h"
-#include "tutors.h"
+#include "examples.h"
#include "inter.h"
#include "binreloc.h"
@@ -257,14 +257,14 @@ static void actually_open_help (const char *id);
static void fork_helper_setup_comm (void);
static void new_program (const char *filename,
- gboolean tutor);
+ gboolean example);
static GtkActionEntry entries[] = {
{ "FileMenu", NULL, N_("_File") }, /* name, stock id, label */
{ "EditMenu", NULL, N_("_Edit") }, /* name, stock id, label */
{ "CalculatorMenu", NULL, N_("_Calculator") }, /* name, stock id, label */
{ "PluginsMenu", NULL, N_("P_lugins") }, /* name, stock id, label */
- { "TutorialsMenu", NULL, N_("_Tutorials") }, /* name, stock id, label */
+ { "ExamplesMenu", NULL, N_("E_xamples") }, /* name, stock id, label */
{ "ProgramsMenu", NULL, N_("_Programs") }, /* name, stock id, label */
{ "SettingsMenu", NULL, N_("_Settings") }, /* name, stock id, label */
{ "HelpMenu", NULL, N_("_Help") }, /* name, stock id, label */
@@ -423,9 +423,9 @@ static GtkActionEntry entries[] = {
NULL },
/* Kind of a placeholder for empty menu,
* FIXME: probably a bad hack */
- { "NoTutorial", NULL,
- "No Tutorials", "",
- "No Tutorials",
+ { "NoExample", NULL,
+ "No Examples", "",
+ "No Examples",
NULL },
};
static guint n_entries = G_N_ELEMENTS (entries);
@@ -474,8 +474,8 @@ static const gchar *ui_info =
" <separator/>"
" <menuitem action='Plot'/>"
" </menu>"
-" <menu action='TutorialsMenu'>"
-" <menuitem action='NoTutorial'/>"
+" <menu action='ExamplesMenu'>"
+" <menuitem action='NoExample'/>"
" </menu>"
" <menu action='PluginsMenu'>"
" <menuitem action='NoPlugin'/>"
@@ -3450,9 +3450,9 @@ file_is_writable (const char *fname)
-/* if tutor, filename is a filename and not a uri */
+/* if example, filename is a filename and not a uri */
static void
-new_program (const char *filename, gboolean tutor)
+new_program (const char *filename, gboolean example)
{
char *contents;
static int cnt = 1;
@@ -3555,7 +3555,7 @@ new_program (const char *filename, gboolean tutor)
G_CALLBACK (move_cursor),
p);
- if (filename == NULL || tutor) {
+ if (filename == NULL || example) {
GFile* file;
char *d = g_get_current_dir ();
char *n = g_strdup_printf (_("Program_%d.gel"), cnt);
@@ -3585,7 +3585,7 @@ new_program (const char *filename, gboolean tutor)
p->real_file = TRUE;
}
- if (tutor && filename != NULL) {
+ if (example && filename != NULL) {
contents = NULL;
g_file_get_contents (filename, &contents, NULL, NULL);
}
@@ -3606,7 +3606,7 @@ new_program (const char *filename, gboolean tutor)
#endif
g_free (contents);
} else {
- if (filename != NULL && ! tutor) {
+ if (filename != NULL && ! example) {
char *s = g_strdup_printf (_("Cannot open %s"), filename);
genius_display_error (NULL, s);
g_free (s);
@@ -4564,9 +4564,9 @@ catch_interrupts (GtkWidget *w, GdkEvent *e)
}
static void
-open_tutor_cb (GtkWidget *w, GelTutorial * tut)
+open_example_cb (GtkWidget *w, GelExample * exam)
{
- new_program (tut->file, TRUE);
+ new_program (exam->file, TRUE);
}
static void
@@ -4992,7 +4992,7 @@ main (int argc, char *argv[])
GtkWidget *w;
char *file;
int plugin_count = 0;
- int tutor_count = 0;
+ int example_count = 0;
gboolean give_no_lib_error_after_init = FALSE;
arg0 = g_strdup (argv[0]);
@@ -5166,51 +5166,51 @@ main (int argc, char *argv[])
G_CALLBACK (update_term_geometry), NULL);
gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/TutorialsMenu"));
+ gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
/* Show the window now before going on with the
* setup */
gtk_widget_show_now (genius_window);
check_events ();
- gel_read_tutor_list ();
+ gel_read_example_list ();
- if (gel_tutor_list != NULL) {
+ if (gel_example_list != NULL) {
GSList *li;
int i;
- GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/TutorialsMenu")));
+ GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/ExamplesMenu")));
- for (i = 0, li = gel_tutor_list;
+ for (i = 0, li = gel_example_list;
li != NULL;
li = li->next, i++) {
GtkWidget *item;
- GelTutorial *tut = li->data;
+ GelExample *exam = li->data;
char *s;
- s = g_strconcat (tut->category, ": ", tut->name, NULL);
+ s = g_strconcat (exam->category, ": ", exam->name, NULL);
item = gtk_menu_item_new_with_label (s);
g_free (s);
g_signal_connect (item, "select",
G_CALLBACK (simple_menu_item_select_cb),
- tut->name);
+ exam->name);
g_signal_connect (item, "deselect",
G_CALLBACK (simple_menu_item_deselect_cb),
- tut->name);
+ exam->name);
gtk_widget_show (item);
g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (open_tutor_cb), tut);
+ G_CALLBACK (open_example_cb), exam);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- tutor_count ++;
+ example_count ++;
}
}
- /* if no tutorials, hide the menu */
- if (tutor_count == 0) {
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/TutorialsMenu"));
+ /* if no exampleials, hide the menu */
+ if (example_count == 0) {
+ gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
} else {
- gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/TutorialsMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/TutorialsMenu/NoTutorial"));
+ gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
+ gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu/NoExample"));
}
gel_read_plugin_list ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]