[genius] Tue Oct 08 17:28:57 2013 Jiri (George) Lebl <jirka 5z com>



commit 36621af6bdfc8c6a3c6a02eb8e6e0e5830170272
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Tue Oct 8 17:30:37 2013 -0500

    Tue Oct 08 17:28:57 2013  Jiri (George) Lebl <jirka 5z com>
    
        * src/graphing.[ch], src/eval.[ch], src/genius.c, src/gnome-genius.c:
          Improve the PlotCanvasFreeze/Thaw functions, and make sure plot
          canvas is always thawed after end of execution so that it never
          simply remains frozen.
    
        * help/C/genius.xml: Document the two functions

 ChangeLog          |   10 +
 help/C/genius.xml  |   30 +++
 help/genius.txt    |  729 ++++++++++++++++++++++++++++------------------------
 src/eval.c         |    8 +-
 src/eval.h         |    3 +-
 src/genius.c       |    1 +
 src/gnome-genius.c |    9 +
 src/graphing.c     |   45 +++-
 src/graphing.h     |    4 +-
 9 files changed, 493 insertions(+), 346 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ed111d3..df8d6a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,17 @@
+Tue Oct 08 17:28:57 2013  Jiri (George) Lebl <jirka 5z com>
+
+       * src/graphing.[ch], src/eval.[ch], src/genius.c, src/gnome-genius.c:
+         Improve the PlotCanvasFreeze/Thaw functions, and make sure plot
+         canvas is always thawed after end of execution so that it never
+         simply remains frozen.
+       
+       * help/C/genius.xml: Document the two functions
+
 Tue Oct 08 16:54:53 2013  Jiri (George) Lebl <jirka 5z com>
 
        * src/graphing.c: Very simple PlotCanvasFreeze/Thaw functions, need
          improvement and documentation
+
 Tue Oct 08 16:57:08 2013  Jiri (George) Lebl <jirka 5z com>
 
        * configure.in, pixmaps/Makefile.am: Use gtk-update-icon-cache,
diff --git a/help/C/genius.xml b/help/C/genius.xml
index acdb705..fab5f49 100644
--- a/help/C/genius.xml
+++ b/help/C/genius.xml
@@ -8405,6 +8405,36 @@ optionally the limits as <userinput>x1,x2,y1,y2</userinput>.
         </varlistentry>
 
         <varlistentry>
+         <term><anchor id="gel-function-PlotCanvasFreeze"/>PlotCanvasFreeze</term>
+         <listitem>
+          <synopsis>PlotCanvasFreeze ()</synopsis>
+          <para>
+                 Freeze drawing of the canvas plot temporarily.  Useful if you need to draw a bunch of 
elements
+                 and want to delay drawing everything to avoid flicker in an animation.  After everything
+                 has been drawn you should call <link 
linkend="gel-function-PlotCanvasThaw"><function>PlotCanvasThaw</function></link>.
+          </para>
+          <para>
+                 The canvas is always thawed after end of any execution, so it will never remain frozen.  
The moment
+                 a new command line is shown for example the plot canvas is thawed automatically.  Also note 
that
+                 calls to freeze and thaw may be safely nested.
+          </para>
+         </listitem>
+        </varlistentry>
+
+        <varlistentry>
+         <term><anchor id="gel-function-PlotCanvasThaw"/>PlotCanvasThaw</term>
+         <listitem>
+          <synopsis>PlotCanvasThaw ()</synopsis>
+          <para>
+                 Thaw the plot canvas frozen by
+                 <link linkend="gel-function-PlotCanvasFreeze"><function>PlotCanvasFreeze</function></link>
+                 and rewdraw the canvas immediately.  The canvas is also always thawed after end of execution
+                 of any program.
+          </para>
+         </listitem>
+        </varlistentry>
+
+        <varlistentry>
          <term><anchor id="gel-function-SlopefieldClearSolutions"/>SlopefieldClearSolutions</term>
          <listitem>
           <synopsis>SlopefieldClearSolutions ()</synopsis>
diff --git a/help/genius.txt b/help/genius.txt
index 25d5272..fb98db9 100644
--- a/help/genius.txt
+++ b/help/genius.txt
@@ -16,6 +16,8 @@ Kai Willadsen
 
    Copyright © 2004 Kai Willadsen
 
+   Manual for the Genius Math Tool.
+
    Permission is granted to copy, distribute and/or modify this
    document under the terms of the GNU Free Documentation License
    (GFDL), Version 1.1 or any later version published by the Free
@@ -75,134 +77,141 @@ Kai Willadsen
    To report a bug or make a suggestion regarding the Genius
    Mathematics Tool application or this manual, follow the
    directions in the GNOME Feedback Page.
-   This manual describes version 1.0.17 of Genius.
      __________________________________________________________
 
    Table of Contents
-   Introduction
-   Getting Started
-
-        To Start Genius Mathematics Tool
-        When You Start Genius
-
-   Basic Usage
-
-        Using the Work Area
-        To Create a New Program
-        To Open and Run a Program
-
-   Plotting
-
-        Line Plots
-        Parametric Plots
-        Slopefield Plots
-        Vectorfield Plots
-        Surface Plots
-
-   GEL Basics
-
-        Values
-
-              Numbers
-              Booleans
-              Strings
-              Null
-
-        Using Variables
-
-              Setting Variables
-              Built-in Variables
-              Previous Result Variable
-
-        Using Functions
-
-              Defining Functions
-              Variable Argument Lists
-              Passing Functions to Functions
-              Operations on Functions
-
-        Absolute Value / Modulus
-        Separator
-        Comments
-        Modular Evaluation
-        List of GEL Operators
-
-   Programming with GEL
-
-        Conditionals
-        Loops
-
-              While Loops
-              For Loops
-              Foreach Loops
-              Break and Continue
-
-        Sums and Products
-        Comparison Operators
-        Global Variables and Scope of Variables
-        Parameter variables
-        Returning
-        References
-        Lvalues
+   1. Introduction
+   2. Getting Started
 
-   Advanced Programming with GEL
+        2.1. To Start Genius Mathematics Tool
+        2.2. When You Start Genius
 
-        Error Handling
-        Toplevel Syntax
-        Returning Functions
-        True Local Variables
-        GEL Startup Procedure
-        Loading Programs
+   3. Basic Usage
 
-   Matrices in GEL
+        3.1. Using the Work Area
+        3.2. To Create a New Program
+        3.3. To Open and Run a Program
 
-        Entering Matrices
-        Conjugate Transpose and Transpose Operator
-        Linear Algebra
+   4. Plotting
 
-   Polynomials in GEL
+        4.1. Line Plots
+        4.2. Parametric Plots
+        4.3. Slopefield Plots
+        4.4. Vectorfield Plots
+        4.5. Surface Plots
 
-        Using Polynomials
+   5. GEL Basics
 
-   Set Theory in GEL
+        5.1. Values
 
-        Using Sets
-
-   List of GEL functions
-
-        Commands
-        Basic
-        Parameters
-        Constants
-        Numeric
-        Trigonometry
-        Number Theory
-        Matrix Manipulation
-        Linear Algebra
-        Combinatorics
-        Calculus
-        Functions
-        Equation Solving
-        Statistics
-        Polynomials
-        Set Theory
-        Commutative Algebra
-        Miscellaneous
-        Symbolic Operations
-        Plotting
-
-   Example Programs in GEL
-   Settings
-
-        Output
-        Precision
-        Terminal
-        Memory
-
-   About Genius Mathematics Tool
+              5.1.1. Numbers
+              5.1.2. Booleans
+              5.1.3. Strings
+              5.1.4. Null
+
+        5.2. Using Variables
+
+              5.2.1. Setting Variables
+              5.2.2. Built-in Variables
+              5.2.3. Previous Result Variable
+
+        5.3. Using Functions
+
+              5.3.1. Defining Functions
+              5.3.2. Variable Argument Lists
+              5.3.3. Passing Functions to Functions
+              5.3.4. Operations on Functions
+
+        5.4. Absolute Value / Modulus
+        5.5. Separator
+        5.6. Comments
+        5.7. Modular Evaluation
+        5.8. List of GEL Operators
+
+   6. Programming with GEL
+
+        6.1. Conditionals
+        6.2. Loops
+
+              6.2.1. While Loops
+              6.2.2. For Loops
+              6.2.3. Foreach Loops
+              6.2.4. Break and Continue
+
+        6.3. Sums and Products
+        6.4. Comparison Operators
+        6.5. Global Variables and Scope of Variables
+        6.6. Parameter variables
+        6.7. Returning
+        6.8. References
+        6.9. Lvalues
+
+   7. Advanced Programming with GEL
+
+        7.1. Error Handling
+        7.2. Toplevel Syntax
+        7.3. Returning Functions
+        7.4. True Local Variables
+        7.5. GEL Startup Procedure
+        7.6. Loading Programs
+
+   8. Matrices in GEL
+
+        8.1. Entering Matrices
+        8.2. Conjugate Transpose and Transpose Operator
+        8.3. Linear Algebra
+
+   9. Polynomials in GEL
+
+        9.1. Using Polynomials
+
+   10. Set Theory in GEL
+
+        10.1. Using Sets
+
+   11. List of GEL functions
+
+        11.1. Commands
+        11.2. Basic
+        11.3. Parameters
+        11.4. Constants
+        11.5. Numeric
+        11.6. Trigonometry
+        11.7. Number Theory
+        11.8. Matrix Manipulation
+        11.9. Linear Algebra
+        11.10. Combinatorics
+        11.11. Calculus
+        11.12. Functions
+        11.13. Equation Solving
+        11.14. Statistics
+        11.15. Polynomials
+        11.16. Set Theory
+        11.17. Commutative Algebra
+        11.18. Miscellaneous
+        11.19. Symbolic Operations
+        11.20. Plotting
+
+   12. Example Programs in GEL
+   13. Settings
+
+        13.1. Output
+        13.2. Precision
+        13.3. Terminal
+        13.4. Memory
+
+   14. About Genius Mathematics Tool
+
+   List of Figures
+   2-1. Genius Mathematics Tool Window
+   4-1. Create Plot Window
+   4-2. Plot Window
+   4-3. Parametric Plot Tab
+   4-4. Parametric Plot
+   4-5. Surface Plot
      __________________________________________________________
 
-Introduction
+Chapter 1. Introduction
 
    The Genius Mathematics Tool application is a general calculator
    for use as a desktop calculator, an educational tool in
@@ -230,9 +239,9 @@ Introduction
    capabilities that require the graphical user interface.
      __________________________________________________________
 
-Getting Started
+Chapter 2. Getting Started
 
-To Start Genius Mathematics Tool
+2.1. To Start Genius Mathematics Tool
 
    You can start Genius Mathematics Tool in the following ways:
 
@@ -261,14 +270,14 @@ To Start Genius Mathematics Tool
           plotting will not be available.
      __________________________________________________________
 
-When You Start Genius
+2.2. When You Start Genius
 
    When you start the GNOME edition of Genius Mathematics Tool,
-   the window pictured in Figure 1 is displayed.
+   the window pictured in Figure 2-1 is displayed.
 
-   [genius_window.png]
+   Figure 2-1. Genius Mathematics Tool Window
 
-   Figure 1. Genius Mathematics Tool Window
+   [genius_window.png]
 
    The Genius Mathematics Tool window contains the following
    elements:
@@ -312,9 +321,9 @@ When You Start Genius
           for later retrieval.
      __________________________________________________________
 
-Basic Usage
+Chapter 3. Basic Usage
 
-Using the Work Area
+3.1. Using the Work Area
 
    Normally you interact with the calculator in the Console tab of
    the work area. If you are running the text only version then
@@ -358,7 +367,7 @@ genius> load path/to/program.gel
    directory do cd directory as in the unix command shell.
      __________________________________________________________
 
-To Create a New Program
+3.2. To Create a New Program
 
    To start writing a new program, choose File->New Program. A new
    tab will appear in the work area. You can write a GEL program
@@ -377,7 +386,7 @@ To Create a New Program
    As...
      __________________________________________________________
 
-To Open and Run a Program
+3.3. To Open and Run a Program
 
    To open a file, choose File->Open. A new tab containing the
    file will appear in the work area. You can use this to edit the
@@ -388,7 +397,7 @@ To Open and Run a Program
    This is equivalent to the load command.
      __________________________________________________________
 
-Plotting
+Chapter 4. Plotting
 
    Plotting support is only available in the graphical GNOME
    version. All plotting accessible from the graphical interface
@@ -396,11 +405,11 @@ Plotting
    window by either clicking on the Plot button on the toolbar or
    selecting Plot from the Calculator menu. You can also access
    the plotting functionality by using the plotting functions of
-   the GEL language. See the Chapter called GEL Basics to find out
-   how to enter expressions that Genius understands.
+   the GEL language. See Chapter 5 to find out how to enter
+   expressions that Genius understands.
      __________________________________________________________
 
-Line Plots
+4.1. Line Plots
 
    To graph real valued functions of one variable open the Create
    Plot window. You can also use the LinePlot function on the
@@ -409,11 +418,11 @@ Line Plots
    Once you click the Plot button, a window opens up with some
    notebooks in it. You want to be in the Function line plot
    notebook tab, and inside you want to be on the Functions /
-   Expressions notebook tab. See Figure 1.
+   Expressions notebook tab. See Figure 4-1.
 
-   [line_plot.png]
+   Figure 4-1. Create Plot Window
 
-   Figure 1. Create Plot Window
+   [line_plot.png]
 
    Type expressions with x as the independent variable into the
    textboxes. Alternatively you can give names of functions such
@@ -426,11 +435,11 @@ Line Plots
    dialog. The y (dependent) range can be set automatically by
    turning on the Fit dependent axis checkbox. The names of the
    variables can also be changed. Pressing the Plot button
-   produces the graph shown in Figure 2.
+   produces the graph shown in Figure 4-2.
 
-   [line_plot_graph.png]
+   Figure 4-2. Plot Window
 
-   Figure 2. Plot Window
+   [line_plot_graph.png]
 
    From here you can print out the plot, create encapsulated
    postscript or a PNG version of the plot or change the zoom. If
@@ -441,7 +450,7 @@ Line Plots
    the LinePlot function.
      __________________________________________________________
 
-Parametric Plots
+4.2. Parametric Plots
 
    In the create plot window, you can also choose the Parametric
    notebook tab to create two dimensional parametric plots. This
@@ -451,24 +460,24 @@ Parametric Plots
    variable t is given explicitly, and the function is sampled
    according to the given increment. The x and y range can be set
    automatically by turning on the Fit dependent axis checkbox, or
-   it can be specified explicitly. See Figure 3.
+   it can be specified explicitly. See Figure 4-3.
 
-   [parametric.png]
+   Figure 4-3. Parametric Plot Tab
 
-   Figure 3. Parametric Plot Tab
+   [parametric.png]
 
-   An example of a parametric plot is given in Figure 4. Similar
+   An example of a parametric plot is given in Figure 4-4. Similar
    operations can be done on such graphs as can be done on the
    other line plots. For plotting using the command line see the
    documentation of the LinePlotParametric or LinePlotCParametric
    function.
 
-   [parametric_graph.png]
+   Figure 4-4. Parametric Plot
 
-   Figure 4. Parametric Plot
+   [parametric_graph.png]
      __________________________________________________________
 
-Slopefield Plots
+4.3. Slopefield Plots
 
    In the create plot window, you can also choose the Slope field
    notebook tab to create a two dimensional slope field plot.
@@ -494,7 +503,7 @@ Slopefield Plots
    from the command line or programs.
      __________________________________________________________
 
-Vectorfield Plots
+4.4. Vectorfield Plots
 
    In the create plot window, you can also choose the Vector field
    notebook tab to create a two dimensional vector field plot.
@@ -523,7 +532,7 @@ Vectorfield Plots
    command line or programs.
      __________________________________________________________
 
-Surface Plots
+4.5. Surface Plots
 
    Genius can also plot surfaces. Select the Surface plot tab in
    the main notebook of the Create Plot window. Here you can
@@ -532,18 +541,18 @@ Surface Plots
    is the real part of z and y is the imaginary part). For example
    to plot the modulus of the cosine function for complex
    parameters, you could enter |cos(z)|. This would be equivalent
-   to |cos(x+1i*y)|. See Figure 5. For plotting using the command
-   line see the documentation of the SurfacePlot function.
+   to |cos(x+1i*y)|. See Figure 4-5. For plotting using the
+   command line see the documentation of the SurfacePlot function.
 
    The z range can be set automatically by turning on the Fit
    dependent axis checkbox.
 
-   [surface_graph.png]
+   Figure 4-5. Surface Plot
 
-   Figure 5. Surface Plot
+   [surface_graph.png]
      __________________________________________________________
 
-GEL Basics
+Chapter 5. GEL Basics
 
    GEL stands for Genius Extension Language. It is the language
    you use to write programs in Genius. A program in GEL is simply
@@ -554,14 +563,14 @@ GEL Basics
    a calculator.
      __________________________________________________________
 
-Values
+5.1. Values
 
    Values in GEL can be numbers, Booleans or strings. Values can
    be used in calculations, assigned to variables and returned
    from functions, among other uses.
      __________________________________________________________
 
-Numbers
+5.1.1. Numbers
 
    Integers are the first type of number in GEL. Integers are
    written in the normal way.
@@ -614,19 +623,19 @@ Numbers
 8.01i
 77*e^(1.3i)
 
-   Important
+Important
 
-   When entering imaginary numbers, a number must be in front of
-   the i. If you use i by itself, Genius will interpret this as
-   referring to the variable i. If you need to refer to i by
-   itself, use 1i instead.
+          When entering imaginary numbers, a number must be in front of
+          the i. If you use i by itself, Genius will interpret this as
+          referring to the variable i. If you need to refer to i by
+          itself, use 1i instead.
 
-   In order to use mixed fraction notation with imaginary numbers
-   you must have the mixed fraction in parentheses. (i.e., (1
-   2/5)i)
+          In order to use mixed fraction notation with imaginary numbers
+          you must have the mixed fraction in parentheses. (i.e., (1
+          2/5)i)
      __________________________________________________________
 
-Booleans
+5.1.2. Booleans
 
    Genius also supports native Boolean values. The two Boolean
    constants are defined as true and false; these identifiers can
@@ -657,7 +666,7 @@ Booleans
    before being compared to true.
      __________________________________________________________
 
-Strings
+5.1.3. Strings
 
    Like numbers and Booleans, strings in GEL can be stored as
    values inside variables and passed to functions. You can also
@@ -692,7 +701,7 @@ string(22)
    and <=> (comparison) operators
      __________________________________________________________
 
-Null
+5.1.4. Null
 
    There is a special value called null. No operations can be
    performed on it, and nothing is printed when it is returned.
@@ -711,7 +720,7 @@ x=5;
    or an empty reference.
      __________________________________________________________
 
-Using Variables
+5.2. Using Variables
 
    Syntax:
 VariableName
@@ -724,25 +733,24 @@ genius> e
    variable. This will return the value of the variable. You can
    use a variable anywhere you would normally use a number or
    string. In addition, variables are necessary when defining
-   functions that take arguments (see the Section called Defining
-   Functions).
+   functions that take arguments (see Section 5.3.1).
 
    Tip Using Tab completion
 
 
-   You can use Tab completion to get Genius to complete variable
-   names for you. Try typing the first few letters of the name and
-   pressing Tab.
+       You can use Tab completion to get Genius to complete variable
+       names for you. Try typing the first few letters of the name and
+       pressing Tab.
 
    Important Variable names are case sensitive
 
 
-   The names of variables are case sensitive. That means that
-   variables named hello, HELLO and Hello are all different
-   variables.
+             The names of variables are case sensitive. That means that
+             variables named hello, HELLO and Hello are all different
+             variables.
      __________________________________________________________
 
-Setting Variables
+5.2.1. Setting Variables
 
    Syntax:
 <identifier> = <value>
@@ -763,22 +771,19 @@ a = b = 5
    interpreted as testing for equality when used in a context
    where a Boolean expression is expected.
 
-   For issues regarding the scope of variables, see the Section
-   called Global Variables and Scope of Variables in the Chapter
-   called Programming with GEL.
+   For issues regarding the scope of variables, see Section 6.5.
      __________________________________________________________
 
-Built-in Variables
+5.2.2. Built-in Variables
 
    GEL has a number of built-in ‘variables’, such as e, pi or
    GoldenRatio. These are widely used constants with a preset
    value, and they cannot be assigned new values. There are a
-   number of other built-in variables. See the Section called
-   Constants in the Chapter called List of GEL functions for a
-   full list.
+   number of other built-in variables. See Section 11.4 for a full
+   list.
      __________________________________________________________
 
-Previous Result Variable
+5.2.3. Previous Result Variable
 
    The Ans and ans variables can be used to get the result of the
    last expression. For example, if you had performed some
@@ -786,7 +791,7 @@ Previous Result Variable
 Ans+389
      __________________________________________________________
 
-Using Functions
+5.3. Using Functions
 
    Syntax:
 FunctionName(argument1, argument2, ...)
@@ -804,25 +809,24 @@ gcd(921,317)
 
    There are many built-in functions, such as sin, cos and tan.
    You can use the help built-in command to get a list of
-   available functions, or see the Chapter called List of GEL
-   functions for a full listing.
+   available functions, or see Chapter 11 for a full listing.
 
    Tip Using Tab completion
 
 
-   You can use Tab completion to get Genius to complete function
-   names for you. Try typing the first few letters of the name and
-   pressing Tab.
+       You can use Tab completion to get Genius to complete function
+       names for you. Try typing the first few letters of the name and
+       pressing Tab.
 
-   Important Function names are case sensitive
+  Important Function names are case sensitive
 
 
-   The names of functions are case sensitive. That means that
-   functions named dosomething, DOSOMETHING and DoSomething are
-   all different functions.
+            The names of functions are case sensitive. That means that
+            functions named dosomething, DOSOMETHING and DoSomething are
+            all different functions.
      __________________________________________________________
 
-Defining Functions
+5.3.1. Defining Functions
 
    Syntax:
 function <identifier>(<comma separated arguments>) = <function body>
@@ -842,7 +846,7 @@ function addup(a,b,c) = a+b+c
    then addup(1,4,9) yields 14
      __________________________________________________________
 
-Variable Argument Lists
+5.3.2. Variable Argument Lists
 
    If you include ... after the last argument name in the function
    declaration, then Genius will allow any number of arguments to
@@ -855,7 +859,7 @@ function f(a,b...) = b
    Then f(1,2,3) yields [2,3], while f(1) yields a null.
      __________________________________________________________
 
-Passing Functions to Functions
+5.3.3. Passing Functions to Functions
 
    In Genius, it is possible to pass a function as an argument to
    another function. This can be done using either ‘function
@@ -870,9 +874,8 @@ function b(x) = x*x;
 f(b,2)
 
    To pass functions which are not defined, you can use an
-   anonymous function (see the Section called Defining Functions).
-   That is, you want to pass a function without giving it a name.
-   Syntax:
+   anonymous function (see Section 5.3.1). That is, you want to
+   pass a function without giving it a name. Syntax:
 function(<comma separated arguments>) = <function body>
 `(<comma separated arguments>) = <function body>
 
@@ -883,7 +886,7 @@ f(`(x) = x*x,2)
    This will return 5.
      __________________________________________________________
 
-Operations on Functions
+5.3.4. Operations on Functions
 
    Some functions allow arithmetic operations, and some single
    argument functions such as exp or ln, to operate on the
@@ -905,23 +908,23 @@ LinePlot(sin^2)
 
    Warning
 
-   Not all functions can be used in this way. For example, when
-   you use a binary operation the functions must take the same
-   number of arguments.
+           Not all functions can be used in this way. For example, when
+           you use a binary operation the functions must take the same
+           number of arguments.
      __________________________________________________________
 
-Absolute Value / Modulus
+5.4. Absolute Value / Modulus
 
    You can make an absolute value of something by putting the |'s
    around it. For example:
-   |a-b|
+|a-b|
 
    In case the expression is a complex number the result will be
    the modulus (distance from the origin). For example: |3 *
    e^(1i*pi)| returns 3.
      __________________________________________________________
 
-Separator
+5.5. Separator
 
    In GEL if you want to type more than one command you have to
    use the ; operator, which is a way to separate expressions,
@@ -946,7 +949,7 @@ Separator
    there is one more operator involved.
      __________________________________________________________
 
-Comments
+5.6. Comments
 
    GEL is similar to other scripting languages in that # denotes a
    comments, that is text that is not meant to be evaluated.
@@ -958,11 +961,11 @@ Comments
 x=123;
      __________________________________________________________
 
-Modular Evaluation
+5.7. Modular Evaluation
 
    Genius implements modular arithmetic. To use it you just add
    "mod <integer>" after the expression. Example:
-   2^(5!) * 3^(6!) mod 5
+2^(5!) * 3^(6!) mod 5
 
    It could be possible to do modular arithmetic by computing with
    integers and then modding in the end with the % operator, which
@@ -1013,7 +1016,7 @@ genius> 2*2 mod 7
    mod.
      __________________________________________________________
 
-List of GEL Operators
+5.8. List of GEL Operators
 
    Everything in gel is really just an expression. Expressions are
    stringed together with different operators. As we have seen,
@@ -1112,9 +1115,8 @@ a.%b
 a mod b
 
           Modular evaluation operator. The expression a is
-          evaluated modulo b. See the Section called Modular
-          Evaluation. Some functions and operators behave
-          differently modulo an integer.
+          evaluated modulo b. See Section 5.7. Some functions and
+          operators behave differently modulo an integer.
 
 a!
 
@@ -1204,14 +1206,12 @@ not a
 &a
 
           Variable referencing (to pass a reference to a
-          variable). See the Section called References in the
-          Chapter called Programming with GEL.
+          variable). See Section 6.8.
 
 *a
 
           Variable dereferencing (to access a referenced
-          variable). See the Section called References in the
-          Chapter called Programming with GEL.
+          variable). See Section 6.8.
 
 a'
 
@@ -1306,34 +1306,34 @@ increment a by b
 
    Note
 
-   The @() operator makes the : operator most useful. With this
-   you can specify regions of a matrix. So that a@(2:4,6) is the
-   rows 2,3,4 of the column 6. Or a@(,1:2) will get you the first
-   two columns of a matrix. You can also assign to the @()
-   operator, as long as the right value is a matrix that matches
-   the region in size, or if it is any other type of value.
+        The @() operator makes the : operator most useful. With this
+        you can specify regions of a matrix. So that a@(2:4,6) is the
+        rows 2,3,4 of the column 6. Or a@(,1:2) will get you the first
+        two columns of a matrix. You can also assign to the @()
+        operator, as long as the right value is a matrix that matches
+        the region in size, or if it is any other type of value.
 
    Note
 
-   The comparison operators (except for the <=> operator which
-   behaves normally), are not strictly binary operators, they can
-   in fact be grouped in the normal mathematical way, e.g.:
-   (1<x<=y<5) is a legal boolean expression and means just what it
-   should, that is (1<x and x≤y and y<5)
+        The comparison operators (except for the <=> operator which
+        behaves normally), are not strictly binary operators, they can
+        in fact be grouped in the normal mathematical way, e.g.:
+        (1<x<=y<5) is a legal boolean expression and means just what it
+        should, that is (1<x and x≤y and y<5)
 
    Note
 
-   The unitary minus operates in a different fashion depending on
-   where it appears. If it appears before a number it binds very
-   closely, if it appears in front of an expression it binds less
-   than the power and factorial operators. So for example -1^k is
-   really (-1)^k, but -foo(1)^k is really -(foo(1)^k). So be
-   careful how you use it and if in doubt, add parentheses.
+        The unitary minus operates in a different fashion depending on
+        where it appears. If it appears before a number it binds very
+        closely, if it appears in front of an expression it binds less
+        than the power and factorial operators. So for example -1^k is
+        really (-1)^k, but -foo(1)^k is really -(foo(1)^k). So be
+        careful how you use it and if in doubt, add parentheses.
      __________________________________________________________
 
-Programming with GEL
+Chapter 6. Programming with GEL
 
-Conditionals
+6.1. Conditionals
 
    Syntax:
 if <expression1> then <expression2> [else <expression3>]
@@ -1355,9 +1355,9 @@ if a=5 then a=a-1
 if a==5 then a:=a-1
      __________________________________________________________
 
-Loops
+6.2. Loops
 
-While Loops
+6.2.1. While Loops
 
    Syntax:
 while <expression1> do <expression2>
@@ -1372,7 +1372,7 @@ do <expression2> until <expression1>
    is translated into == just as for the if statement.
      __________________________________________________________
 
-For Loops
+6.2.2. For Loops
 
    Syntax:
 for <identifier> = <from> to <to> do <body>
@@ -1409,10 +1409,10 @@ for x = 0 to 1 by 1/10 do print(x)
    execution of your code may differ on older versions.
      __________________________________________________________
 
-Foreach Loops
+6.2.3. Foreach Loops
 
    Syntax:
-   for <identifier> in <matrix> do <body>
+for <identifier> in <matrix> do <body>
 
    For each element in the matrix, going row by row from left to
    right we execute the body with the identifier set to the
@@ -1428,7 +1428,7 @@ for n in RowsOf ([1,2:3,4]) do print(n)
    will print out [1,2] and then [3,4].
      __________________________________________________________
 
-Break and Continue
+6.2.4. Break and Continue
 
    You can also use the break and continue commands in loops. The
    continue continue command will restart the current loop at its
@@ -1440,7 +1440,7 @@ while(<expression1>) do (
 )
      __________________________________________________________
 
-Sums and Products
+6.3. Sums and Products
 
    Syntax:
 sum <identifier> = <from> to <to> do <body>
@@ -1459,10 +1459,10 @@ prod <identifier> in <matrix> do <body>
    sum returns 0 and prod returns 1 as is the standard convention.
 
    For floating point numbers the same roundoff error protection
-   is done as in the for loop. See the Section called For Loops.
+   is done as in the for loop. See Section 6.2.2.
      __________________________________________________________
 
-Comparison Operators
+6.4. Comparison Operators
 
    The following standard comparison operators are supported in
    GEL and have the obvious meaning: ==, >=, <=, !=, <>, <, >.
@@ -1494,7 +1494,7 @@ if a==b then c
    a=1 will not set a=1 since the first argument was true.
      __________________________________________________________
 
-Global Variables and Scope of Variables
+6.5. Global Variables and Scope of Variables
 
    GEL is a dynamically scoped language. We will explain what this
    means below. That is, normal variables and functions are
@@ -1585,7 +1585,7 @@ set("a",3)
    Variables and Returning Functions.
      __________________________________________________________
 
-Parameter variables
+6.6. Parameter variables
 
    As we said before, there exist special variables called
    parameters that exist in all scopes. To declare a parameter
@@ -1603,7 +1603,7 @@ parameter foo = 1
    genius.
      __________________________________________________________
 
-Returning
+6.7. Returning
 
    Normally a function is one or several expressions separated by
    a semicolon, and the value of the last expression is returned.
@@ -1624,7 +1624,7 @@ function f(x) = (
 )
      __________________________________________________________
 
-References
+6.8. References
 
    It may be necessary for some functions to return more than one
    value. This may be accomplished by returning a vector of
@@ -1659,7 +1659,7 @@ t=&f;
    gives us 4.
      __________________________________________________________
 
-Lvalues
+6.9. Lvalues
 
    An lvalue is the left hand side of an assignment. In other
    words, an lvalue is what you assign something to. Valid lvalues
@@ -1690,9 +1690,9 @@ a@(4:8,3) := [1,2,3,4,5]'
    comparison.
      __________________________________________________________
 
-Advanced Programming with GEL
+Chapter 7. Advanced Programming with GEL
 
-Error Handling
+7.1. Error Handling
 
    If you detect an error in your function, you can bail out of
    it. For normal errors, such as wrong types of arguments, you
@@ -1711,7 +1711,7 @@ function f(M) = (
 )
      __________________________________________________________
 
-Toplevel Syntax
+7.2. Toplevel Syntax
 
    The synatax is slightly different if you enter statements on
    the top level versus when they are inside parentheses or inside
@@ -1744,7 +1744,7 @@ if Something() then (
 )
      __________________________________________________________
 
-Returning Functions
+7.3. Returning Functions
 
    It is possible to return functions as value. This way you can
    build functions that construct special purpose functions
@@ -1838,7 +1838,7 @@ g(10)
    of 5 was added to the private dictionary.
      __________________________________________________________
 
-True Local Variables
+7.4. True Local Variables
 
    When passing functions into other functions, the normal scoping
    of variables might be undesired. For example:
@@ -1890,7 +1890,7 @@ function f(g,x) = (
    function does not see implementation details and get confused.
      __________________________________________________________
 
-GEL Startup Procedure
+7.5. GEL Startup Procedure
 
    First the program looks for the installed library file (the
    compiled version lib.cgel) in the installed directory, then it
@@ -1902,7 +1902,7 @@ GEL Startup Procedure
    lib.cgel
      __________________________________________________________
 
-Loading Programs
+7.6. Loading Programs
 
    Sometimes you have a larger program that you wrote into a file
    and want to read in that file. In these situations, you have
@@ -1928,13 +1928,13 @@ cd directory_with_gel_programs
 ls *.gel
      __________________________________________________________
 
-Matrices in GEL
+Chapter 8. Matrices in GEL
 
    Genius has support for vectors and matrices and a sizable
    library of matrix manipulation and linear algebra functions.
      __________________________________________________________
 
-Entering Matrices
+8.1. Entering Matrices
 
    To enter matrixes, you can use one of the following two
    syntaxes. You can either enter the matrix on one line,
@@ -1985,12 +1985,12 @@ b = [ a,  10
 
    Note
 
-   Be careful about using returns for expressions inside the [ ]
-   brackets, as they have a slightly different meaning there. You
-   will start a new row.
+        Be careful about using returns for expressions inside the [ ]
+        brackets, as they have a slightly different meaning there. You
+        will start a new row.
      __________________________________________________________
 
-Conjugate Transpose and Transpose Operator
+8.2. Conjugate Transpose and Transpose Operator
 
    You can conjugate transpose a matrix by using the ' operator.
    That is the entry in the ith column and the jth row will be the
@@ -2010,7 +2010,7 @@ Conjugate Transpose and Transpose Operator
    with real matrices and vectors.
      __________________________________________________________
 
-Linear Algebra
+8.3. Linear Algebra
 
    Genius implements many useful linear algebra and matrix
    manipulation routines. See the Linear Algebra and Matrix
@@ -2046,14 +2046,14 @@ Linear Algebra
    will be very fast.
      __________________________________________________________
 
-Polynomials in GEL
+Chapter 9. Polynomials in GEL
 
    Currently Genius can handle polynomials of one variable written
    out as vectors, and do some basic operations with these. It is
    planned to expand this support further.
      __________________________________________________________
 
-Using Polynomials
+9.1. Using Polynomials
 
    Currently polynomials in one variable are just horizontal
    vectors with value only nodes. The power of the term is the
@@ -2085,19 +2085,18 @@ f(2)
    function such as FindRootBisection, FindRootFalsePosition,
    FindRootMullersMethod, or FindRootSecant.
 
-   See the Section called Polynomials in the Chapter called List
-   of GEL functions in the function list for the rest of functions
-   acting on polynomials.
+   See Section 11.15 in the function list for the rest of
+   functions acting on polynomials.
      __________________________________________________________
 
-Set Theory in GEL
+Chapter 10. Set Theory in GEL
 
    Genius has some basic set theoretic functionality built in.
    Currently a set is just a vector (or a matrix). Every distinct
    object is treated as a different element.
      __________________________________________________________
 
-Using Sets
+10.1. Using Sets
 
    Just like vectors, objects in sets can include numbers,
    strings, null, matrices and vectors. It is planned in the
@@ -2131,13 +2130,13 @@ genius> IsIn (1, [0,1,2])
    IsSubset(null,X) is always true.
      __________________________________________________________
 
-List of GEL functions
+Chapter 11. List of GEL functions
 
    To get help on a specific function from the console type:
 help FunctionName
      __________________________________________________________
 
-Commands
+11.1. Commands
 
    help
 
@@ -2180,7 +2179,7 @@ plugin plugin_name
           the system in the proper directory.
      __________________________________________________________
 
-Basic
+11.2. Basic
 
    AskButtons
 
@@ -2526,7 +2525,7 @@ warranty
           Gives the warranty information.
      __________________________________________________________
 
-Parameters
+11.3. Parameters
 
    ChopTolerance
 
@@ -2786,7 +2785,7 @@ VectorfieldTicks = [vertical,horizontal]
           vectorfield plot. (See VectorfieldPlot).
      __________________________________________________________
 
-Constants
+11.4. Constants
 
    CatalanConstant
 
@@ -2850,7 +2849,7 @@ pi
           information.
      __________________________________________________________
 
-Numeric
+11.5. Numeric
 
    AbsoluteValue
 
@@ -3168,7 +3167,7 @@ trunc (x)
           Truncate number to an integer (return the integer part).
      __________________________________________________________
 
-Trigonometry
+11.6. Trigonometry
 
    acos
 
@@ -3378,7 +3377,7 @@ tanh (x)
           See Planetmath for more information.
      __________________________________________________________
 
-Number Theory
+11.7. Number Theory
 
    AreRelativelyPrime
 
@@ -3883,7 +3882,7 @@ lcm (a,args...)
           See Planetmath or Mathworld for more information.
      __________________________________________________________
 
-Matrix Manipulation
+11.8. Matrix Manipulation
 
    ApplyOverMatrix
 
@@ -4286,7 +4285,7 @@ zeros (rows,columns...)
           columns are zero.
      __________________________________________________________
 
-Linear Algebra
+11.9. Linear Algebra
 
    AuxiliaryUnitMatrix
 
@@ -4610,14 +4609,28 @@ Kernel (T)
 
           (See NullSpace)
 
+   KroneckerProduct
+
+KroneckerProduct (M, N)
+
+          Aliases: TensorProduct
+
+          Compute the Kronecker product (tensor product in
+          standard basis) of two matrices.
+
+          See Wikipedia, Planetmath or Mathworld for more
+          information.
+
    LUDecomposition
 
 LUDecomposition (A, L, U)
 
-          Get the LU decomposition of A and store the result in
-          the L and U which should be references. It returns true
-          if successful. For example suppose that A is a square
-          matrix, then after running:
+          Get the LU decomposition of A, that is find a lower
+          triangular matrix and upper triangular matrix whose
+          product is A Store the result in the L and U which
+          should be references. It returns true if successful. For
+          example suppose that A is a square matrix, then after
+          running:
 
 genius> LUDecomposition(A,&L,&U)
 
@@ -4635,7 +4648,8 @@ genius> LUDecomposition(A,&L,&U)
           [0,1;1,0] does not and this function returns false in
           this case and sets L and U to null.
 
-          See Planetmath or Mathworld for more information.
+          See Wikipedia, Planetmath or Mathworld for more
+          information.
 
    Minor
 
@@ -4723,7 +4737,8 @@ genius> R = QRDecomposition(A,&Q)
           variable called R and the orthogonal (unitary) matrix
           stored in Q.
 
-          See Planetmath or Mathworld for more information.
+          See Wikipedia or Planetmath or Mathworld for more
+          information.
 
    RayleighQuotient
 
@@ -4823,15 +4838,19 @@ SesquilinearFormFunction (A)
 
 SmithNormalFormField (A)
 
-          Smith Normal Form for fields (will end up with 1's on
-          the diagonal).
+          Returns the Smith normal form of a matrix over fields
+          (will end up with 1's on the diagonal).
+
+          See Wikipedia for more information.
 
    SmithNormalFormInteger
 
 SmithNormalFormInteger (M)
 
-          Smith Normal Form for square integer matrices (not its
-          characteristic).
+          Return the Smith normal form for square integer matrices
+          over integers (not its characteristic).
+
+          See Wikipedia for more information.
 
    SolveLinearSystem
 
@@ -4853,7 +4872,7 @@ ToeplitzMatrix (c, r...)
           a Hermitian matrix (if the first element is real of
           course).
 
-          See Planetmath for more information.
+          See Wikipedia or Planetmath for more information.
 
    Trace
 
@@ -4864,7 +4883,7 @@ Trace (M)
           Calculate the trace of a matrix. That is the sum of the
           diagonal elements.
 
-          See Planetmath for more information.
+          See Wikipedia or Planetmath for more information.
 
    Transpose
 
@@ -4873,7 +4892,7 @@ Transpose (M)
           Transpose of a matrix. This is the same as the .'
           operator.
 
-          See Planetmath for more information.
+          See Wikipedia or Planetmath for more information.
 
    VandermondeMatrix
 
@@ -4883,6 +4902,8 @@ VandermondeMatrix (v)
 
           Return the Vandermonde matrix.
 
+          See Wikipedia for more information.
+
    VectorAngle
 
 VectorAngle (v,w,B...)
@@ -4963,7 +4984,7 @@ rref (M)
           See Wikipedia or Planetmath for more information.
      __________________________________________________________
 
-Combinatorics
+11.10. Combinatorics
 
    Catalan
 
@@ -5202,7 +5223,7 @@ nPr (n,r)
           See Mathworld or Wikipedia for more information.
      __________________________________________________________
 
-Calculus
+11.11. Calculus
 
    CompositeSimpsonsRule
 
@@ -5490,7 +5511,7 @@ TwoSidedThreePointFormula (f,x0,h)
           Compute two-sided derivative using three-point formula.
      __________________________________________________________
 
-Functions
+11.12. Functions
 
    Argument
 
@@ -5714,7 +5735,7 @@ sinc (x)
           See Wikipedia for more information.
      __________________________________________________________
 
-Equation Solving
+11.13. Equation Solving
 
    CubicFormula
 
@@ -5888,7 +5909,7 @@ RungeKuttaFull (f,x0,y0,x1,n)
           See Mathworld, or Wikipedia for more information.
      __________________________________________________________
 
-Statistics
+11.14. Statistics
 
    Average
 
@@ -5983,7 +6004,7 @@ StandardDeviation (m)
           Calculate the standard deviation of a whole matrix.
      __________________________________________________________
 
-Polynomials
+11.15. Polynomials
 
    AddPoly
 
@@ -6059,7 +6080,7 @@ TrimPoly (p)
           Trim zeros from a polynomial (as vector).
      __________________________________________________________
 
-Set Theory
+11.16. Set Theory
 
    Intersection
 
@@ -6104,7 +6125,7 @@ Union (X,Y)
           vectors pretending to be sets).
      __________________________________________________________
 
-Commutative Algebra
+11.17. Commutative Algebra
 
    MacaulayBound
 
@@ -6129,7 +6150,7 @@ MacaulayRep (c,d)
           integer c.
      __________________________________________________________
 
-Miscellaneous
+11.18. Miscellaneous
 
    ASCIIToString
 
@@ -6159,7 +6180,7 @@ StringToAlphabet (str,alphabet)
           letters.
      __________________________________________________________
 
-Symbolic Operations
+11.19. Symbolic Operations
 
    SymbolicDerivative
 
@@ -6206,7 +6227,7 @@ SymbolicTaylorApproximationFunction (f,x0,n)
           around x0 to the nth degree. (See SymbolicDerivative)
      __________________________________________________________
 
-Plotting
+11.20. Plotting
 
    ExportPlot
 
@@ -6276,16 +6297,34 @@ LinePlotDrawLine (v,...)
           replaced by an n by 2 matrix for a longer polyline.
 
           Extra parameters can be added to specify line color,
-          thickness, arrows, and the plotting window. You can do
-          this by adding a string "color", "thickness", "window",
-          or "arrow", and after it either the color string, the
-          thicknes as an integer, the window as 4-vector, and for
-          arrow either "origin", "end", "both", or "none". For
-          "window" we can specify "fit" rather than a vector in
-          which case, the x range will be set precisely and the y
-          range will be set with five percent borders around the
-          line. Finally, the legend can be specified by adding
-          "legend" and the string with the legend.
+          thickness, arrows, the plotting window, or legend. You
+          can do this by adding an argument string "color",
+          "thickness", "window", "arrow", or "legend", and after
+          it specify the color, the thicknes, the window as
+          4-vector, type of arrow, or the legend.
+
+          The color should be either a string indicating the
+          common english word for the color that GTK will
+          recognize such as "red", "blue", "yellow", etc...
+          Alternatively the color can be specified in RGB format
+          as "#rgb", "#rrggbb", or "#rrrrggggbbbb", where the r,
+          g, or b are hex digits of the red, green, and blue
+          components of the color. Finally the color can also be
+          specified as a real vector specifying the red green and
+          blue components where the components are between 0 and
+          1.
+
+          The window should be given as usual as [x1,x2,y1,y2], or
+          alternatively can be given as a string "fit" in which
+          case, the x range will be set precisely and the y range
+          will be set with five percent borders around the line.
+
+          Arrow specification should be "origin", "end", "both",
+          or "none".
+
+          Finally, legend should be a string that can be used as
+          the legend in the graph. That is, if legends are being
+          printed.
 
           Examples:
 
@@ -6294,6 +6333,8 @@ genius> LinePlotDrawLine([0,0;1,-1;-1,-1])
 genius> LinePlotDrawLine([0,0;1,1],"arrow","end")
 genius> LinePlotDrawLine(EulersMethodFull(`(x,y)=y,0,3,100),"color","blu
 e","legend","The Solution")
+genius> for r=0.0 to 1.0 by 0.1 do LinePlotDrawLine([0,0;1,r],"color",[r
+,(1-r),0.5],"window",[0,1,0,1])
 
    LinePlotParametric
 
@@ -6340,6 +6381,30 @@ LinePlotCParametric (func,t1,t2,tinc,x1,x2,y1,y2)
           The parameter LinePlotDrawLegends controls the drawing
           of the legend.
 
+   PlotCanvasFreeze
+
+PlotCanvasFreeze ()
+
+          Freeze drawing of the canvas plot temporarily. Useful if
+          you need to draw a bunch of elements and want to delay
+          drawing everything to avoid flicker in an animation.
+          After everything has been drawn you should call
+          PlotCanvasThaw.
+
+          The canvas is always thawed after end of any execution,
+          so it will never remain frozen. The moment a new command
+          line is shown for example the plot canvas is thawed
+          automatically. Also note that calls to freeze and thaw
+          may be safely nested.
+
+   PlotCanvasThaw
+
+PlotCanvasThaw ()
+
+          Thaw the plot canvas frozen by PlotCanvasFreeze and
+          rewdraw the canvas immediately. The canvas is also
+          always thawed after end of execution of any program.
+
    SlopefieldClearSolutions
 
 SlopefieldClearSolutions ()
@@ -6527,7 +6592,7 @@ VectorfieldPlot (funcx, funcy, x1, x2, y1, y2)
 genius> VectorfieldPlot(`(x,y)=x^2-y, `(x,y)=y^2-x, -1, 1, -1, 1)
      __________________________________________________________
 
-Example Programs in GEL
+Chapter 12. Example Programs in GEL
 
    Here is a function that calculates factorials:
 function f(x) = if x <= 1 then 1 else (f(x-1)*x)
@@ -6602,30 +6667,28 @@ function MyOwnREF(m) = (
 )
      __________________________________________________________
 
-Settings
+Chapter 13. Settings
 
    To configure Genius Mathematics Tool, choose
    Settings->Preferences. There are several basic parameters
    provided by the calculator in addition to the ones provided by
    the standard library. These control how the calculator behaves.
 
-   Note Changing Settings with GEL
+ Note Changing Settings with GEL
 
 
-   Many of the settings in Genius are simply global variables, and
-   can be evaluated and assigned to in the same way as normal
-   variables. See the Section called Using Variables in the
-   Chapter called GEL Basics about evaluating and assigning to
-   variables, and the Section called Parameters in the Chapter
-   called List of GEL functions for a list of settings that can be
-   modified in this way.
+         Many of the settings in Genius are simply global variables, and
+         can be evaluated and assigned to in the same way as normal
+         variables. See Section 5.2 about evaluating and assigning to
+         variables, and Section 11.3 for a list of settings that can be
+         modified in this way.
 
-   As an example, you can set the maximum number of digits in a
-   result to 12 by typing:
-MaxDigits = 12
+         As an example, you can set the maximum number of digits in a
+         result to 12 by typing:
+      MaxDigits = 12
      __________________________________________________________
 
-Output
+13.1. Output
 
    Maximum digits to output
           The maximum digits in a result (MaxDigits)
@@ -6688,8 +6751,8 @@ Output
 
    In addition to these preferences, there are some preferences
    that can only be changed by setting them in the workspace
-   console. For others that may affect the output see the Section
-   called Parameters in the Chapter called List of GEL functions.
+   console. For others that may affect the output see Section
+   11.3.
 
    IntegerOutputBase
           The base that will be used to output integers
@@ -6703,7 +6766,7 @@ Output
           for typsetting in LaTeX, MathML (XML), or in Troff.
      __________________________________________________________
 
-Precision
+13.2. Precision
 
    Floating point precision
           The floating point precision in bits (FloatPrecision).
@@ -6722,7 +6785,7 @@ Precision
           box, restart genius and then uncheck it again.
      __________________________________________________________
 
-Terminal
+13.3. Terminal
 
    Terminal refers to the console in the work area.
 
@@ -6742,7 +6805,7 @@ Terminal
           remotely.
      __________________________________________________________
 
-Memory
+13.4. Memory
 
    Maximum number of nodes to allocate
           Internally all data is put onto small nodes in memory.
@@ -6765,7 +6828,7 @@ Memory
           amount of memory that genius uses.
      __________________________________________________________
 
-About Genius Mathematics Tool
+Chapter 14. About Genius Mathematics Tool
 
    Genius Mathematics Tool was written by Jiří (George) Lebl
    (<jirka 5z com>). The history of Genius Mathematics Tool goes
diff --git a/src/eval.c b/src/eval.c
index d9e2ef3..41c7a0c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 1997-2012 Jiri (George) Lebl
+ * Copyright (C) 1997-2013 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -7767,8 +7767,12 @@ gel_eval_etree (GelCtx *ctx, GelETree *etree)
                        ev_free_special_data(ctx,data,flag);
                } while(flag != GE_EMPTY_STACK);
        }
-       if G_UNLIKELY (--level == 0)
+       if G_UNLIKELY (--level == 0) {
                purge_free_lists();
+               if (_gel_finished_toplevel_exec_hook != NULL)
+                       (*_gel_finished_toplevel_exec_hook) ();
+
+       }
        
        GE_POP_STACK(ctx,ctx->current,flag);
        g_assert ((flag & GE_MASK) == GE_POST || (flag & GE_MASK) == GE_PRE);
diff --git a/src/eval.h b/src/eval.h
index 17506bc..69f6ec3 100644
--- a/src/eval.h
+++ b/src/eval.h
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 1997-2012 Jiri (George) Lebl
+ * Copyright (C) 1997-2013 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -214,6 +214,7 @@ void _gel_make_free_trees (void);
 #endif
 
 const extern GelHookFunc _gel_tree_limit_hook;
+const extern GelHookFunc _gel_finished_toplevel_exec_hook;
 void gel_test_max_nodes_again (void);
 
 extern GelEFunc *_gel_internal_ln_function;
diff --git a/src/genius.c b/src/genius.c
index 7d534fa..66c366d 100644
--- a/src/genius.c
+++ b/src/genius.c
@@ -88,6 +88,7 @@ GelCalcState curstate={
 
 const GelHookFunc gel_evalnode_hook = NULL;
 const GelHookFunc _gel_tree_limit_hook = NULL;
+const GelHookFunc _gel_finished_toplevel_exec_hook = NULL;
        
 extern int parenth_depth;
 
diff --git a/src/gnome-genius.c b/src/gnome-genius.c
index 401d593..e67aa99 100644
--- a/src/gnome-genius.c
+++ b/src/gnome-genius.c
@@ -97,6 +97,9 @@ GelCalcState curstate={
 static void check_events (void);
 const GelHookFunc gel_evalnode_hook = check_events;
 
+static void finished_toplevel_exec (void);
+const GelHookFunc _gel_finished_toplevel_exec_hook = finished_toplevel_exec;
+
 static void tree_limit_hit (void);
 const GelHookFunc _gel_tree_limit_hook = tree_limit_hit;
 
@@ -4495,6 +4498,12 @@ check_events (void)
 }
 
 static void
+finished_toplevel_exec (void)
+{
+       gel_plot_canvas_thaw_completely ();
+}
+
+static void
 tree_limit_hit (void)
 {
        if (genius_ask_question (NULL,
diff --git a/src/graphing.c b/src/graphing.c
index b33dc75..22b6ff3 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -7997,11 +7997,17 @@ LinePlotClear_op (GelCtx *ctx, GelETree * * a, int *exception)
                return gel_makenum_null ();
 }
 
+static int plot_canvas_freeze_count = 0;
+
 static GelETree *
 PlotCanvasFreeze_op (GelCtx *ctx, GelETree * * a, int *exception)
 {
-       if (plot_canvas != NULL /* sanity */)
-               gtk_plot_canvas_freeze (GTK_PLOT_CANVAS (plot_canvas));
+       if (plot_canvas_freeze_count == 0) {
+               if (plot_canvas != NULL /* sanity */)
+                       gtk_plot_canvas_freeze (GTK_PLOT_CANVAS (plot_canvas));
+       }
+
+       plot_canvas_freeze_count ++;
 
        return gel_makenum_null ();
 }
@@ -8009,18 +8015,39 @@ PlotCanvasFreeze_op (GelCtx *ctx, GelETree * * a, int *exception)
 static GelETree *
 PlotCanvasThaw_op (GelCtx *ctx, GelETree * * a, int *exception)
 {
-       if (plot_canvas != NULL /* sanity */) {
-               gtk_plot_canvas_thaw (GTK_PLOT_CANVAS (plot_canvas));
-               gtk_plot_canvas_paint (GTK_PLOT_CANVAS (plot_canvas));
-               gtk_widget_queue_draw (GTK_WIDGET (plot_canvas));
+       if (plot_canvas_freeze_count > 0) {
+               plot_canvas_freeze_count --;
+               if (plot_canvas_freeze_count == 0) {
+                       if (plot_canvas != NULL /* sanity */) {
+                               gtk_plot_canvas_thaw (GTK_PLOT_CANVAS (plot_canvas));
+                               gtk_plot_canvas_paint (GTK_PLOT_CANVAS (plot_canvas));
+                               gtk_widget_queue_draw (GTK_WIDGET (plot_canvas));
 
-               if (gel_evalnode_hook != NULL)
-                       (*gel_evalnode_hook)();
+                               if (gel_evalnode_hook != NULL)
+                                       (*gel_evalnode_hook)();
+                       }
+               }
        }
 
        return gel_makenum_null ();
 }
 
+void
+gel_plot_canvas_thaw_completely (void)
+{
+       if (plot_canvas_freeze_count > 0) {
+               plot_canvas_freeze_count = 0;
+               if (plot_canvas != NULL /* sanity */) {
+                       gtk_plot_canvas_thaw (GTK_PLOT_CANVAS (plot_canvas));
+                       gtk_plot_canvas_paint (GTK_PLOT_CANVAS (plot_canvas));
+                       gtk_widget_queue_draw (GTK_WIDGET (plot_canvas));
+                       /* a hook will get called eventually, no need to call it now,
+                        * this only gets called once we're about to be idle and get out of
+                        * computation */
+               }
+       }
+}
+
 static gboolean
 update_lineplot_window (double x1, double x2, double y1, double y2)
 {
@@ -9545,7 +9572,7 @@ gel_add_graph_functions (void)
        VFUNC (LinePlotDrawLine, 2, "x1,y1,x2,y2,args", "plotting", N_("Draw a line from x1,y1 to x2,y2.  
x1,y1,x2,y2 can be replaced by a n by 2 matrix for a longer line"));
 
        FUNC (PlotCanvasFreeze, 0, "", "plotting", N_("Freeze the plot canvas, that is, inhibit drawing"));
-       FUNC (PlotCanvasThaw, 0, "", "plotting", N_("Thaw the plot canvas and redraw the plot"));
+       FUNC (PlotCanvasThaw, 0, "", "plotting", N_("Thaw the plot canvas and redraw the plot immediately"));
 
 
        VFUNC (ExportPlot, 2, "filename,type", "plotting", N_("Export the current contents of the plot canvas 
to a file.  The file type is given by the string type, which can be \"png\", \"eps\", or \"ps\"."));
diff --git a/src/graphing.h b/src/graphing.h
index 9ee4f83..ae392c5 100644
--- a/src/graphing.h
+++ b/src/graphing.h
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 2003-2004 Jiri (George) Lebl
+ * Copyright (C) 2003-2013 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -27,4 +27,6 @@ void gel_add_graph_functions (void);
 
 void genius_plot_dialog (void);
 
+void gel_plot_canvas_thaw_completely (void);
+
 #endif /* GRAPHING_H_ */


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