<p><b>dwj07@fsu.edu</b> 2012-11-06 15:00:31 -0700 (Tue, 06 Nov 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding capability to have macros defined in an external file.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/mpas_draw/README
===================================================================
--- branches/tools/mpas_draw/README        2012-11-06 17:45:59 UTC (rev 2300)
+++ branches/tools/mpas_draw/README        2012-11-06 22:00:31 UTC (rev 2301)
@@ -19,7 +19,7 @@
        Usage:
                Once inside the program, you can use the following keys to control the plot.
-                Up/Down/Left/Right Arrow Keys:
+                Up/Down/Left/Right Arrow Keys, or S D F E:
                        These keys are used to rotate the sphere, to allow for viewing at different angles.
                s d f e , .: (Translation)
@@ -76,12 +76,17 @@
                        0: 100% of Color range
                q:
-                        The lowercase q key saves the current buffer as a screenshot to ss.tga. You can afterwards convert the .tga file to any format.
+                        The lowercase q key saves the current buffer as a screenshot to ss.0000.tga. You can afterwards convert the .tga file to any format.
+                        The counter (0000) is auto incremented from 0001 upwards each time a screenshot is taken.
-                S: (sphere)
-                        The uppercase S key turns on and off the background sphere (only if the file is defined on a sphere).
+                O: (sphere)
+                        The uppercase O key turns on and off the background sphere (only if the file is defined on a sphere).
                        This is useful for looking at where land is in a spherical mesh.
+                Q:
+                        The uppercase Q key reads a file named ControlFile which is a single line file containing a string of characters.
+                        This string of characters represents a macro which will be executed. It can contain any of the non-arror characters listed in this file, aside from ESC.
+
                ESC:
                        The escape key closes the program.
Modified: branches/tools/mpas_draw/mpas_draw.cpp
===================================================================
--- branches/tools/mpas_draw/mpas_draw.cpp        2012-11-06 17:45:59 UTC (rev 2300)
+++ branches/tools/mpas_draw/mpas_draw.cpp        2012-11-06 22:00:31 UTC (rev 2301)
@@ -67,6 +67,7 @@
void drawSphere(double r, int lats, int longs);
void screenshot (char filename[160],int x, int y) ;
+void control_sequence();
//
// Global data.
@@ -1979,6 +1980,18 @@
                case KEY_e:
                        projUpDown += 0.1;
                        break;
+                case KEY_S:
+                        projAzimuth = (double) ( ( (int)projAzimuth - 3 ) % 360 );
+                        break;
+                case KEY_F:
+                        projAzimuth = (double) ( ( (int)projAzimuth + 3 ) % 360 );
+                        break;
+                case KEY_D:
+                        projElevation = (double) ( ( (int)projElevation - 3 ) % 360 );
+                        break;
+                case KEY_E:
+                        projElevation = (double)( ( (int)projElevation + 3 ) % 360 );
+                        break;
                case KEY_B:
                        if(color_bar != 2){
                                color_bar = 2;
@@ -2170,7 +2183,7 @@
                        range_factor = 0.9;
                        color_mesh();
                        break;
-                case KEY_S:
+                case KEY_O:
                        draw_sphere = !draw_sphere;
                        break;
                case KEY_q:
@@ -2179,6 +2192,9 @@
                        screenshot(filename, 800, 800);
                        cur_screenshot++;
                        break;
+                case KEY_Q:
+                        control_sequence();
+                        break;
                default:
                        break;
        }
@@ -2373,3 +2389,27 @@
        cout << "Screenshot written to: " << filename << endl;
}/*}}}*/
+void control_sequence(){/*{{{*/
+        ifstream ctrl_seq("ControlFile");
+        string seq;
+        string junk;
+        
+        cout << "Trying to read file: ControlFile" << endl;
+
+        if(!ctrl_seq){
+                cout << " -- FAILED -- Error reading file" << endl;
+                return;
+        }
+
+        getline(ctrl_seq, seq);
+        const char *p = seq.c_str();
+
+        while(*p != '\0'){
+                keyPressed(*p++, 0, 0);
+                display();
+//                cout << *p++ << endl;
+        }
+
+//        keyPressed(KEY_s, 0, 0);
+//        keyPressed(KEY_q, 0, 0);
+}/*}}}*/
</font>
</pre>