Sindbad~EG File Manager

Current Path : /usr/home/beeson/MathXpert/Engine/
Upload File :
Current File : /usr/home/beeson/MathXpert/Engine/hovertext.c

/* This file produces "hovertext", which will be used for tooltip help when 
the mouse hovers over a control. */
/* Original date 7.31.24,  after old Windows code in balloon.c.
9.14.24 modified some IDs
3.8.25  added tooltips for sliders
*/

#include <string.h>
#include <assert.h>
#include "natlang.h"
#include "english.h"
#include "probtype.h"
#include "hovertext.h"  /* typedef of tooltip */

#define MAXTOOLTIPS 100

static tooltip tooltips[MAXTOOLTIPS];
static int ntooltips;  // actual number of them

/* The Engine will wrap this text thinly in SVG and send it to the browser with
class "hovertext".  The Id of this SVG element will be "svg" + id.
Obviously it's important that the id strings used here should be the same
as the ones used in the PHP files of Web MathXpert. */

static tooltip make_tooltip(const char *id, const char *text)
{ tooltip ans;
  ans.id = id;
  ans.text = text;
  return ans;
}

static void prepare_tooltips(int problemtype)
/* Fill the tooltips array with tooltip text
in the current language
*/
{
   /* First the speedbar controls */
  tooltips[0] = make_tooltip("nextButton", english(1464)); /* Start the next problem */
  tooltips[1] = make_tooltip("prevButton", english(1465)); /* Start the previous problem */
  tooltips[2] = make_tooltip("editButton", english(1652));  /* edit this problem  */
  tooltips[3] = make_tooltip("graphButton", english(1468));  /* Make a relevant graph */
  tooltips[4] = make_tooltip("finishedButton",english(1467));  /* Confirm the problem is finished. */
  tooltips[5] = make_tooltip("autoFinishButton", english(1469)); /* MathXpert will finish the problem */
  tooltips[6] = make_tooltip("autoStepButton", english(1470));   /* MathXpert will take one step. */
  tooltips[7] = make_tooltip("showStepButton", english(1544));   /* See how Auto Step would proceed. */
  tooltips[8] = make_tooltip("hintButton", english(1466));    /* Gives mathematical advice */
  tooltips[9] = make_tooltip("undoButton",english(1471));    /* Undo the last step  */
    /* Now the Graph Toolbar controls */
  tooltips[10] = make_tooltip("drawsvg-button", english(1485));    /* Redraw, using selected rectangle */
  tooltips[11] = make_tooltip("dragButton",english(1482));    /* Grab and move the axes */
  const char *pointslopetext;
  if(problemtype == ORDINARY_GRAPH ||
     problemtype == COMPARE_GRAPHS ||
     problemtype == GRAPH_INEQUALITY
    )
      pointslopetext = english(1479);    /* Point and Slope */
  else
      pointslopetext = english(1819);   /* Coordinates of selected point */
  tooltips[12] = make_tooltip("pointSlopeButton", pointslopetext);
  tooltips[13] = make_tooltip("select2Button",english(1481));    /* Select centered drawing region */
  tooltips[14] = make_tooltip("select1Button",english(1480));    /* Select new drawing region */
  tooltips[15] = make_tooltip("verticalzoomout",english(1472));    /* Double vertical range */
  tooltips[16] = make_tooltip("verticalzoomin", english(1473));    /* Halve vertical range  */
  tooltips[17] = make_tooltip("horizontalzoomout",english(1474));    /* Double horizontal range */
  tooltips[18] = make_tooltip("horizontalzoomin",english(1475));    /* Halve horizontal range  */
  tooltips[19] = make_tooltip("doublezoomin", english(1401));       /*  zoom in */
  tooltips[20] = make_tooltip("doublezoomout",english(1400));      /* zoom  out  */
  tooltips[21] = make_tooltip("graphNextButton",english(1664));   /* Draw the next graph */
  tooltips[22] = make_tooltip("graphPrevButton", english(1665));   /* Draw the previous graph */
  tooltips[23] = make_tooltip("assumptionsButton", english(1402));  /* Display assumptions */
  tooltips[24] = make_tooltip("singularitiesButton", english(1403));  /* Display assumptions */
  tooltips[25] = make_tooltip("jumpsButton", english(1404));  /* Display jump discontinuities */
  tooltips[26] = make_tooltip("remarksButton", english(1405));  /* Show author's remarks  */
  tooltips[27] = make_tooltip("graphPaperButton", english(1406));  /* Change graph paper */
  tooltips[28] = make_tooltip("directionField", english(1504));   /* Show or hide direction field */
  tooltips[29] = make_tooltip("circularAspect", english(1503));  /* Ensure circles appear circular */
  tooltips[30] = make_tooltip("nextgraphpaper", english(1689));
       /* Change the graph paper showing in the button */
  tooltips[31] = make_tooltip("previousgraphpaper", english(1689));
  tooltips[32] = make_tooltip("toggleErase", english(1690));
  tooltips[33] = make_tooltip("shortcutButton", english(10));  /* Go to the MathXpert starting page */
  ntooltips = 34;
  assert(ntooltips < MAXTOOLTIPS);
}
#if 0  // later finish this
    
    case BUTTON_NEW:
       return english(1666);   /* Select a new function (or edit this one) */
    case BUTTON_RANGE:
       return english(1667);   /* Change the ranges of the variables    */
    case SPOT_SCROLLER:
       return english(1483);    /* Move the Spot */
    case SPOT_VALUE:
       return english(1484);    /* Parameter value corresponding to the Spot */
   
   

  if(BUTTON_PARAM <= ControlID && ControlID <= BUTTON_PARAM + 3*MAXPARAMS)
     { int j = (ControlID-BUTTON_PARAM);
       int nparameters = get_nparameters();
       int problemtype = get_problemtype();      
       if(problemtype == SOLVE_ODE)
           nparameters -= 2;   // for the independent and dependent variables' initial values
       if(problemtype == SOLVE_TWO_ODES)
           nparameters -= 3;   // independent and two dependent variables' initial values
       if(problemtype == HIGH_ORDER_ODE)
           nparameters -= 1 + get_hde_order();
               /* there are 3 parameters specifying initil values for a second-order equation,
               n+1 parameters for an n-th order equation, plus whatever
               parameters were in the original problem. */
       if(j < 3*nparameters)
           { switch(j % 3)
                { case 0:  return english(1478);    /* Set parameter value or increment */
                  case 1:  return english(1476);    /* Increase parameter value */
                  case 2:  return english(1477);    /* Decrease parameter value */
                }
           }
       j -= 3*nparameters;
       if(problemtype == SOLVE_ODE)
           { switch(j)
                 { case 0: return english(1170);  /* Initial value of independent variable */
                   case 4:  // fall through 
                   case 1: return english(1168);  /* Increase initial value */
                   case 5: // fall through 
                   case 2:  return english(1169);    /* Decrease initial value */
                   case 3:  return english(1953);  /* Initial value of function */
                   default:  return "this shouldn't happen!";
                  }
            }
        if(problemtype == SOLVE_TWO_ODES)
           { switch(j)
                 { case 0: return english(1170);  /* Initial value of independent variable */
                   case 4:  // fall through 
                   case 7:
                   case 1: return english(1168);  /* Increase initial value */
                   case 5: // fall through 
                   case 8:
                   case 2:  return english(1169);    /* Decrease initial value */
                   case 6:  // fall through 
                   case 3:  return english(1953);  /* Initial value of function */
                   default:  return "this shouldn't happen!";
                  }
            }     
       if(problemtype == HIGH_ORDER_ODE &&
          j/3 <= get_hde_order()
         )
          { if(j % 3 == 0)
              { switch(j)
                  { case 0:
                       return english(1170);  /* Initial value of independent variable */
                    case 3:
                       return english(1953);  /* Initial value of function */
                    case 6:
                       return english(1954);  /* Initial value of derivative */
                    case 9:
                       return english(1955);  /* Initial value of second derivative */
                    case 12:
                       return english(1956);  /* Initial value of third derivative */
                    case 15:
                       return english(1957);  /* Initial value of fourth derivative */
                  }
               }
             if(j % 3 == 1)
                 return english(1168);  /* Increase initial value */
             if(j % 3 == 1)
                 return english(1169);    /* Decrease initial value */
         }     
     }
	#endif

tooltip * getTooltips(int problemtype,int *n)
// fetch the entire tooltips array, putting ntooltips in *n
// This is called by sendTooltips in sendDocument.c
{ prepare_tooltips(problemtype);  // language or user might have changed so compute them again
  *n = ntooltips;
  return tooltips;
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists