From: Ton v. O. <tvo...@us...> - 2006-11-10 04:13:05
|
Update of /cvsroot/easycalc/easycalc In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv30822 Modified Files: calc.c calc.h calcrsc.h graph.c graph.h graph.rcp.in grprefs.c grprefs.h grsetup.c grtaps.c grtaps.h Log Message: Added axes labels option. Simplify grtaps_print_* routines to only use standard coordinates. Add alignment option to grtaps_print_val. Various cosmetic whitespace fixes. Index: calc.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/calc.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** calc.c 16 Oct 2006 18:58:37 -0000 1.36 --- calc.c 10 Nov 2006 04:12:56 -0000 1.37 *************** *** 88,104 **** void ! gadget_bounds(FormType *frm, Int16 gadget, RectangleType *bounds) { ! UInt16 index = FrmGetObjectIndex(frm,gadget); ! ! FrmGetObjectBounds(frm,index,bounds); // If Sony HR Lib is available, adjust coordinates for high resolution #ifdef SONY_SDK if(gHrMode == hrSony) { ! bounds->topLeft.x*=2; ! bounds->topLeft.y*=2; ! bounds->extent.x*=2; ! bounds->extent.y*=2; } #endif --- 88,106 ---- void ! gadget_bounds(FormType *frm, Int16 gadget, ! RectangleType *natbounds, RectangleType *stdbounds) { ! UInt16 index = FrmGetObjectIndex(frm, gadget); ! ! FrmGetObjectBounds(frm, index, stdbounds); ! RctCopyRectangle(stdbounds, natbounds); // If Sony HR Lib is available, adjust coordinates for high resolution #ifdef SONY_SDK if(gHrMode == hrSony) { ! natbounds->topLeft.x *= 2; ! natbounds->topLeft.y *= 2; ! natbounds->extent.x *= 2; ! natbounds->extent.y *= 2; } #endif *************** *** 107,111 **** save = WinSetCoordinateSystem(kCoordinatesNative); ! WinScaleRectangle(bounds); WinSetCoordinateSystem(save); } --- 109,113 ---- save = WinSetCoordinateSystem(kCoordinatesNative); ! WinScaleRectangle(natbounds); WinSetCoordinateSystem(save); } Index: calc.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/calc.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** calc.h 1 Oct 2006 22:40:27 -0000 1.11 --- calc.h 10 Nov 2006 04:12:56 -0000 1.12 *************** *** 35,39 **** void calc_nil_timeout(Int32 timeout); Int16 calc_input_exec(void); ! void gadget_bounds(FormType *frm, Int16 gadget, RectangleType *bounds); extern Boolean palmOS3; --- 35,40 ---- void calc_nil_timeout(Int32 timeout); Int16 calc_input_exec(void); ! void gadget_bounds(FormType *frm, Int16 gadget, ! RectangleType *natbounds, RectangleType *stdbounds); extern Boolean palmOS3; Index: calcrsc.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/calcrsc.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** calcrsc.h 19 Oct 2006 19:36:53 -0000 1.63 --- calcrsc.h 10 Nov 2006 04:12:56 -0000 1.64 *************** *** 389,392 **** --- 389,393 ---- #define grBgndLbl 4534 #define grColorElem 4535 + #define ckbGrAxesLabels 4536 Index: graph.rcp.in =================================================================== RCS file: /cvsroot/easycalc/easycalc/graph.rcp.in,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** graph.rcp.in 19 Oct 2006 19:38:36 -0000 1.36 --- graph.rcp.in 10 Nov 2006 04:12:56 -0000 1.37 *************** *** 34,38 **** END ! FORM ID grSetupForm AT (2 43 156 115) MODAL HELPID hlpGrSetup --- 34,38 ---- END ! FORM ID grSetupForm AT (2 43-11 156 115+11) MODAL HELPID hlpGrSetup *************** *** 42,76 **** BUTTON " " ID grAxes AT (5 17 6 6) RECTFRAME NONUSABLE CHECKBOX "Axes" ID ckbGrAxes AT (12 14 AUTO AUTO) ! BUTTON " " ID grGrid AT (63 17 6 6) RECTFRAME NONUSABLE ! CHECKBOX "Grid" ID ckbGrGrid AT (70 14 AUTO AUTO) ! BUTTON " " ID grBgnd AT (119 17 6 6) RECTFRAME NONUSABLE ! LABEL "Bgnd" ID grBgndLbl AT (133 14) NONUSABLE ! BUTTON " " ID grColor1 AT (5 32 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor2 AT (5 43 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor3 AT (5 54 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor4 AT (5 65 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor5 AT (5 76 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor6 AT (5 87 6 6) RECTFRAME NONUSABLE ! CHECKBOX "" ID ckbGrfun1 AT (12 29 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun2 AT (12 40 AUTO AUTO) NONUSABLE ! CHECKBOX "" ID ckbGrfun3 AT (12 51 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun4 AT (12 62 AUTO AUTO) NONUSABLE ! CHECKBOX "" ID ckbGrfun5 AT (12 73 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun6 AT (12 84 AUTO AUTO) NONUSABLE ! TABLE ID grSetupTable AT (25 29 112 67) ROWS 6 COLUMNS 2 COLUMNWIDTHS 16 94 ! BUTTON " " ID grType1 AT (139 31 13 7) NOFRAME ! BUTTON " " ID grType2 AT (139 42 13 7) NOFRAME NONUSABLE ! BUTTON " " ID grType3 AT (139 53 13 7) NOFRAME ! BUTTON " " ID grType4 AT (139 64 13 7) NOFRAME NONUSABLE ! BUTTON " " ID grType5 AT (139 75 13 7) NOFRAME ! BUTTON " " ID grType6 AT (139 86 13 7) NOFRAME NONUSABLE ! BUTTON "$$DONE" ID grSetupDone AT (5 100 40 12) ! BUTTON "\001" ID grSetupUp AT (140 98 12 8) FONT 5 NONUSABLE NOFRAME ! BUTTON "\002" ID grSetupDown AT (140 106 12 8) FONT 5 NONUSABLE NOFRAME LIST "" ID grSetupList AT (1 1 62 10) VISIBLEITEMS 10 NONUSABLE DISABLED --- 42,77 ---- BUTTON " " ID grAxes AT (5 17 6 6) RECTFRAME NONUSABLE CHECKBOX "Axes" ID ckbGrAxes AT (12 14 AUTO AUTO) ! CHECKBOX "Axes labels" ID ckbGrAxesLabels AT (12 25 AUTO AUTO) ! BUTTON " " ID grGrid AT (90 17 6 6) RECTFRAME NONUSABLE ! CHECKBOX "Grid" ID ckbGrGrid AT (97 14 AUTO AUTO) ! BUTTON " " ID grBgnd AT (90 28 6 6) RECTFRAME NONUSABLE ! LABEL "Bgnd" ID grBgndLbl AT (104 25) NONUSABLE ! BUTTON " " ID grColor1 AT (5 32+11 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor2 AT (5 43+11 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor3 AT (5 54+11 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor4 AT (5 65+11 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor5 AT (5 76+11 6 6) RECTFRAME NONUSABLE ! BUTTON " " ID grColor6 AT (5 87+11 6 6) RECTFRAME NONUSABLE ! CHECKBOX "" ID ckbGrfun1 AT (12 29+11 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun2 AT (12 40+11 AUTO AUTO) NONUSABLE ! CHECKBOX "" ID ckbGrfun3 AT (12 51+11 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun4 AT (12 62+11 AUTO AUTO) NONUSABLE ! CHECKBOX "" ID ckbGrfun5 AT (12 73+11 AUTO AUTO) ! CHECKBOX "" ID ckbGrfun6 AT (12 84+11 AUTO AUTO) NONUSABLE ! TABLE ID grSetupTable AT (25 29+11 112 67) ROWS 6 COLUMNS 2 COLUMNWIDTHS 16 94 ! BUTTON " " ID grType1 AT (139 31+11 13 7) NOFRAME ! BUTTON " " ID grType2 AT (139 42+11 13 7) NOFRAME NONUSABLE ! BUTTON " " ID grType3 AT (139 53+11 13 7) NOFRAME ! BUTTON " " ID grType4 AT (139 64+11 13 7) NOFRAME NONUSABLE ! BUTTON " " ID grType5 AT (139 75+11 13 7) NOFRAME ! BUTTON " " ID grType6 AT (139 86+11 13 7) NOFRAME NONUSABLE ! BUTTON "$$DONE" ID grSetupDone AT (5 100+11 40 12) ! BUTTON "\001" ID grSetupUp AT (140 98+11 12 8) FONT 5 NONUSABLE NOFRAME ! BUTTON "\002" ID grSetupDown AT (140 106+11 12 8) FONT 5 NONUSABLE NOFRAME LIST "" ID grSetupList AT (1 1 62 10) VISIBLEITEMS 10 NONUSABLE DISABLED Index: graph.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/graph.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** graph.h 12 Sep 2006 19:40:55 -0000 1.7 --- graph.h 10 Nov 2006 04:12:56 -0000 1.8 *************** *** 43,46 **** --- 43,47 ---- void graph_setcolor(Int16 funcnum) GRAPH; void graph_unsetcolor(void) GRAPH; + void graph_redrawform(void) GRAPH; extern Tgraph_curves graphCurves[MAX_GRFUNCS]; Index: grsetup.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/grsetup.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** grsetup.c 19 Oct 2006 19:40:48 -0000 1.31 --- grsetup.c 10 Nov 2006 04:12:56 -0000 1.32 *************** *** 299,307 **** Int16 height; - height = FntLineHeight(); - if (handera) - height = height * 3 / 2; table = GetObjectPtr(grSetupTable); rows = TblGetNumberOfRows(table); for (i=0;i<rows;i++) { --- 299,307 ---- Int16 height; table = GetObjectPtr(grSetupTable); rows = TblGetNumberOfRows(table); + height = TblGetRowHeight(table, 0); + if (handera) + height = height * 3 / 2 + 1; for (i=0;i<rows;i++) { *************** *** 323,326 **** --- 323,327 ---- CtlSetValue(GetObjectPtr(ckbGrAxes), graphPrefs.grEnable[6]); CtlSetValue(GetObjectPtr(ckbGrGrid), graphPrefs.grEnable[7]); + CtlSetValue(GetObjectPtr(ckbGrAxesLabels), graphPrefs.grEnable[8]); /* Setup the up/down pointers, grType and grColor buttons*/ *************** *** 695,701 **** graphPrefs.grEnable[6] = CtlGetValue(GetObjectPtr(ckbGrAxes)); graphPrefs.grEnable[7] = CtlGetValue(GetObjectPtr(ckbGrGrid)); grSetupOpen = false; FrmReturnToForm(0); ! FrmUpdateForm(frmGraph, frmUpdateVars); handled = true; break; --- 696,703 ---- graphPrefs.grEnable[6] = CtlGetValue(GetObjectPtr(ckbGrAxes)); graphPrefs.grEnable[7] = CtlGetValue(GetObjectPtr(ckbGrGrid)); + graphPrefs.grEnable[8] = CtlGetValue(GetObjectPtr(ckbGrAxesLabels)); grSetupOpen = false; FrmReturnToForm(0); ! FrmUpdateForm(frmGraph, frmRedrawUpdateCode); handled = true; break; *************** *** 778,781 **** --- 780,784 ---- graphPrefs.colors[row] = col; } + graph_redrawform(); FrmDrawForm(frm); draw_grType(frm); Index: grprefs.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/grprefs.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** grprefs.h 19 Oct 2006 19:40:16 -0000 1.12 --- grprefs.h 10 Nov 2006 04:12:56 -0000 1.13 *************** *** 50,54 **** Boolean logx,logy; Int16 speed; ! IndexedColorType colors[9]; Boolean grEnable[9]; Int8 grType[6]; --- 50,54 ---- Boolean logx,logy; Int16 speed; ! IndexedColorType colors[8]; Boolean grEnable[9]; Int8 grType[6]; Index: grtaps.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/grtaps.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** grtaps.h 12 Sep 2006 19:40:55 -0000 1.6 --- grtaps.h 10 Nov 2006 04:12:56 -0000 1.7 *************** *** 33,38 **** --- 33,46 ---- }TtrackAction; + typedef enum { + align_left, + align_center, + align_right + } Ttxtalign; + Boolean grtaps_tap(Int16 x,Int16 y) GRAPH; Boolean grtaps_track_but(void) GRAPH; + void grtaps_print_val(char *name, double value, + Coord x, Coord y, Ttxtalign align) GRAPH; void grtaps_track_manual(double value,TtrackAction action) GRAPH; void grtaps_track_pause(void) GRAPH; Index: graph.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/graph.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** graph.c 19 Oct 2006 19:37:32 -0000 1.53 --- graph.c 10 Nov 2006 04:12:56 -0000 1.54 *************** *** 193,197 **** double res; res =graphPrefs.xmin+(double)(x-ScrPrefs.xmin)/ScrPrefs.xtrans; ! if (graphPrefs.logx) { res -= graphPrefs.xmin; --- 193,197 ---- double res; res =graphPrefs.xmin+(double)(x-ScrPrefs.xmin)/ScrPrefs.xtrans; ! if (graphPrefs.logx) { res -= graphPrefs.xmin; *************** *** 208,212 **** double res; res = graphPrefs.ymin+(double)(ScrPrefs.ymin-y)/ScrPrefs.ytrans; ! if (graphPrefs.logy) { res -= graphPrefs.ymin; --- 208,212 ---- double res; res = graphPrefs.ymin+(double)(ScrPrefs.ymin-y)/ScrPrefs.ytrans; ! if (graphPrefs.logy) { res -= graphPrefs.ymin; *************** *** 238,246 **** { double sidea,sideb,parta; ! sidea = y2-y1; sideb = x2-x1; parta = x2 - x3; ! return y2-(sidea*parta)/sideb; } --- 238,246 ---- { double sidea,sideb,parta; ! sidea = y2-y1; sideb = x2-x1; parta = x2 - x3; ! return y2-(sidea*parta)/sideb; } *************** *** 282,286 **** return; } ! tmp = graph_isec_y(onx,ony,offx,offy,graphPrefs.xmin); if (offx<graphPrefs.xmin && tmp>=graphPrefs.ymin && tmp<=graphPrefs.ymax) { --- 282,286 ---- return; } ! tmp = graph_isec_y(onx,ony,offx,offy,graphPrefs.xmin); if (offx<graphPrefs.xmin && tmp>=graphPrefs.ymin && tmp<=graphPrefs.ymax) { *************** *** 432,436 **** graph_setcolor(-2); ! tmpy = graph_yscr2gr(bounds->topLeft.y + bounds->extent.y); ystart = ceil(tmpy/yscale)*yscale; --- 432,436 ---- graph_setcolor(-2); ! tmpy = graph_yscr2gr(bounds->topLeft.y + bounds->extent.y); ystart = ceil(tmpy/yscale)*yscale; *************** *** 444,448 **** } } ! graph_unsetcolor(); } --- 444,448 ---- } } ! graph_unsetcolor(); } *************** *** 462,466 **** /* Check, if the bounds are correct */ ! gadget_bounds(frm, graphId, &natbounds); #ifdef SUPPORT_DIA /* Adjust in case of window resize */ --- 462,466 ---- /* Check, if the bounds are correct */ ! gadget_bounds(frm, graphId, &natbounds, &stdbounds); #ifdef SUPPORT_DIA /* Adjust in case of window resize */ *************** *** 487,512 **** graph_setcolor(-1); clie_eraserectangle(&natbounds,0); ! if (graphPrefs.grEnable[6]){ ! ! /* Now draw the y axis */ ! x = graph_xgr2scr(0.0); ! if (x>ScrPrefs.xmin && x<ScrPrefs.xmax) ! clie_drawline(x,ScrPrefs.ymax,x,ScrPrefs.ymin); ! /* Now draw the x axis */ ! y = graph_ygr2scr(0.0); ! if (y>ScrPrefs.ymax && y<ScrPrefs.ymin) ! clie_drawline(ScrPrefs.xmin,y,ScrPrefs.xmax,y); ! } - graph_unsetcolor(); - /* Only (re)draw grid when whole graph gadget is inside the clip rectangle */ WinGetClip(&clip); ! FrmGetObjectBounds(frm, FrmGetObjectIndex(frm, graphId), &stdbounds); ! if (graphPrefs.grEnable[7] && clip.topLeft.y <= stdbounds.topLeft.y && clip.topLeft.y + clip.extent.y >= stdbounds.topLeft.y + stdbounds.extent.y) --- 487,530 ---- graph_setcolor(-1); clie_eraserectangle(&natbounds,0); + graph_unsetcolor(); ! if (graphPrefs.grEnable[6]) { /* axes drawing enabled */ ! /* y axis */ ! x = graph_xgr2scr(0.0); ! if (x>ScrPrefs.xmin && x<ScrPrefs.xmax) ! clie_drawline(x,ScrPrefs.ymax,x,ScrPrefs.ymin); ! /* x axis */ ! y = graph_ygr2scr(0.0); ! if (y>ScrPrefs.ymax && y<ScrPrefs.ymin) ! clie_drawline(ScrPrefs.xmin,y,ScrPrefs.xmax,y); ! /* draw axes labels */ ! if (graphPrefs.grEnable[8]) { /* axes labels enabled */ ! Coord dy1 = HanderaCoord(-11); ! Coord dy2 = HanderaCoord(-1); ! Coord dy3 = HanderaCoord(-10); ! Coord dy4 = HanderaCoord(-1); ! grtaps_print_val("ymin:",graphPrefs.ymin, ! stdbounds.topLeft.x + stdbounds.extent.x/2, ! stdbounds.topLeft.y + stdbounds.extent.y + dy1, ! align_center); ! grtaps_print_val("ymax:",graphPrefs.ymax, ! stdbounds.topLeft.x + stdbounds.extent.x/2, ! stdbounds.topLeft.y + dy2, align_center); ! grtaps_print_val("xmin:",graphPrefs.xmin, ! stdbounds.topLeft.x, ! stdbounds.topLeft.y + stdbounds.extent.y/2 + dy3, ! align_left); ! grtaps_print_val("xmax:",graphPrefs.xmax, ! stdbounds.topLeft.x + stdbounds.extent.x, ! stdbounds.topLeft.y + stdbounds.extent.y/2 + dy4, ! align_right); ! } } /* Only (re)draw grid when whole graph gadget is inside the clip rectangle */ WinGetClip(&clip); ! if (graphPrefs.grEnable[7] /* grid drawing enabled */ && clip.topLeft.y <= stdbounds.topLeft.y && clip.topLeft.y + clip.extent.y >= stdbounds.topLeft.y + stdbounds.extent.y) *************** *** 1100,1101 **** --- 1118,1127 ---- return handled; } + + void graph_redrawform(void) + { + FormType *frm = FrmGetFormPtr(frmGraph); + + FrmDrawForm(frm); + graph_init_screen(frm, graphGadget); + } Index: grtaps.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/grtaps.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** grtaps.c 11 Oct 2006 17:09:11 -0000 1.29 --- grtaps.c 10 Nov 2006 04:12:56 -0000 1.30 *************** *** 46,54 **** #include "funcs.h" ! static Int16 trackSelected=0; ! static double lastParam=0.0; ! static Coord crossX=-1,crossY=-1; ! static const TdispPrefs grNumPrefs = { 5,true,disp_normal,disp_decimal,false,false}; /*********************************************************************** --- 46,85 ---- #include "funcs.h" ! static Int16 trackSelected = 0; ! static double lastParam = 0.0; ! static Coord crossX = -1, crossY = -1; ! static double oldr = NaN; ! static double oldangle = NaN; ! static double oldparam = NaN; ! static double oldrealx = NaN; ! static double oldrealy = NaN; ! static const TdispPrefs grNumPrefs = { 5, true, disp_normal, disp_decimal, false, false}; ! /*********************************************************************** ! * ! * FUNCTION: EvtGetPenNat ! * ! * DESCRIPTION: As EvtGetPen, but returns native screen coordinates. ! * ! * PARAMETERS: Same as EvtGetPen(). ! * ! * RETURN: Nothing. ! * ! ***********************************************************************/ ! static void ! EvtGetPenNat(Coord *x, Coord *y, Boolean *penDown) ! { ! EvtGetPen(x, y, penDown); ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! *x = WinScaleCoord(*x, true); ! *y = WinScaleCoord(*y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! *x *= gSonyFactor; ! *y *= gSonyFactor; ! } ! } /*********************************************************************** *************** *** 147,151 **** RectangleType orgbounds,rs; double xmin,ymin; - UInt16 save = 0; orgwindow = clie_createoffscreenwindow(bounds->extent.x,bounds->extent.y, --- 178,181 ---- *************** *** 162,177 **** graph_setcolor(-1); - if (gHrMode == hrPalm) - save = WinSetCoordinateSystem(kCoordinatesNative); do { ! EvtGetPen(&x,&y,&penDown); ! if (gHrMode == hrPalm) { ! x = WinScaleCoord(x, true); ! y = WinScaleCoord(y, true); ! } ! else { ! x *= gSonyFactor; ! y *= gSonyFactor; ! } if ((oldx!=x || oldy!=y) && RctPtInRectangle(x,y,bounds)) { dx = (orgwindow ? x-begx : x-oldx); --- 192,197 ---- graph_setcolor(-1); do { ! EvtGetPenNat(&x, &y, &penDown); if ((oldx!=x || oldy!=y) && RctPtInRectangle(x,y,bounds)) { dx = (orgwindow ? x-begx : x-oldx); *************** *** 184,189 **** } } while(penDown); - if (gHrMode == hrPalm) - WinSetCoordinateSystem(save); graph_unsetcolor(); --- 204,207 ---- *************** *** 245,259 **** do { ! EvtGetPen(&x, &y, &penDown); ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! x = WinScaleCoord(x, true); ! y = WinScaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! x *= gSonyFactor; ! y *= gSonyFactor; ! } if ((oldx != x || oldy != y) && RctPtInRectangle(x, y, bounds)) { grtaps_rectangle(begx, begy, x, y); --- 263,267 ---- do { ! EvtGetPenNat(&x, &y, &penDown); if ((oldx != x || oldy != y) && RctPtInRectangle(x, y, bounds)) { grtaps_rectangle(begx, begy, x, y); *************** *** 262,278 **** } } while(penDown); ! grtaps_rectangle(begx, begy, oldx, oldy); /* Remove the rectangle from screen */ ! if (!RctPtInRectangle(x,y,bounds)) /* User wanted to cancel the zoom */ ! return false; if (oldx==begx || oldy==begy) ! return false; ! if (begx>oldx) { ! tmp=begx;begx=oldx;oldx=tmp; } /* The Y axis is inversed on the screen */ ! if (begy<oldy) { ! tmp=begy;begy=oldy;oldy=tmp; } /* begx - Left corner of the box, oldx - right */ --- 270,290 ---- } } while(penDown); ! /* Remove the rectangle from screen */ ! grtaps_rectangle(begx, begy, oldx, oldy); ! if (!RctPtInRectangle(x,y,bounds)) { ! /* User wanted to cancel the zoom */ ! return false; ! } if (oldx==begx || oldy==begy) ! return false; ! if (begx > oldx) { ! tmp = begx; begx = oldx; oldx = tmp; } + /* The Y axis is inversed on the screen */ ! if (begy < oldy) { ! tmp = begy; begy = oldy; oldy = tmp; } /* begx - Left corner of the box, oldx - right */ *************** *** 281,285 **** graphPrefs.xmax=graph_xscr2gr(oldx); graphPrefs.xmin=graph_xscr2gr(begx); - graphPrefs.ymax=graph_yscr2gr(oldy); graphPrefs.ymin=graph_yscr2gr(begy); --- 293,296 ---- *************** *** 348,358 **** grtaps_cross(Int16 x,Int16 y,RectangleType *bounds) { ! if (x!=-1) ! clie_invertline(x,bounds->topLeft.y,x, ! bounds->topLeft.y+bounds->extent.y-1); ! if (y!=-1) ! clie_invertline(bounds->topLeft.x,y, ! bounds->topLeft.x+bounds->extent.x-1, ! y); } --- 359,368 ---- grtaps_cross(Int16 x,Int16 y,RectangleType *bounds) { ! if (x != -1) ! clie_invertline(x, bounds->topLeft.y, ! x, bounds->topLeft.y + bounds->extent.y - 1); ! if (y != -1) ! clie_invertline(bounds->topLeft.x, y, ! bounds->topLeft.x + bounds->extent.x - 1, y); } *************** *** 367,410 **** * value - number to be drawn * x,y - coordinates * * RETURN: Nothing * ***********************************************************************/ ! static void ! grtaps_print_val(char *name, double value, Coord x, Coord y) GRAPH; ! static void ! grtaps_print_val(char *name, double value, Coord x, Coord y) { char text[MAX_FP_NUMBER+10]; - RectangleType bounds; TdispPrefs oldprefs; ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! x = WinUnscaleCoord(x, true); ! y = WinUnscaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! x /= gSonyFactor; ! y /= gSonyFactor; ! } oldprefs = fp_set_prefs(grNumPrefs); StrCopy(text,name); ! fp_print_double(text+StrLen(text),value); fp_set_prefs(oldprefs); - - bounds.topLeft.x = x; - bounds.topLeft.y = y; - bounds.extent.x = HanderaCoord(68); - bounds.extent.y = HanderaCoord(12); - WinEraseRectangle(&bounds, 0); - #ifdef SUPPORT_DIA - FntSetFont(HanderaAdjustFont(FntGetFont())); - #endif - WinDrawChars(text, StrLen(text), x, y); } --- 377,412 ---- * value - number to be drawn * x,y - coordinates + * align - alignment w.r.t. coordinates * * RETURN: Nothing * ***********************************************************************/ ! void ! grtaps_print_val(char *name, double value, Coord x, Coord y, Ttxtalign align) { char text[MAX_FP_NUMBER+10]; TdispPrefs oldprefs; + Char *numtxt; ! #ifdef SUPPORT_DIA ! FntSetFont(HanderaAdjustFont(FntGetFont())); ! #endif oldprefs = fp_set_prefs(grNumPrefs); StrCopy(text,name); ! numtxt = text + StrLen(text); ! if (finite(value)) { ! fp_print_double(numtxt, value); ! if (align == align_center) { ! x -= FntCharsWidth(text, StrLen(text)) / 2; ! } ! else if (align == align_right) { ! x -= FntCharsWidth(text, StrLen(text)); ! } ! WinInvertChars(text, StrLen(text), x, y); ! } fp_set_prefs(oldprefs); } *************** *** 427,451 **** grtaps_print_pol(double r, double angle,RectangleType *bounds) { ! UInt16 save; ! Coord dx1 = HanderaCoord(1), dx2 = HanderaCoord(2); ! Coord dy = HanderaCoord(12); ! if (gHrMode == hrPalm) { ! save = WinSetCoordinateSystem(kCoordinatesNative); ! dx1 = WinScaleCoord(dx1, true); ! dx2 = WinScaleCoord(dx2, true); ! dy = WinScaleCoord(dy, true); ! WinSetCoordinateSystem(save); ! } ! else { ! dx1 *= gSonyFactor; ! dx2 *= gSonyFactor; ! dy *= gSonyFactor; ! } ! grtaps_print_val("r:",r,bounds->topLeft.x+dx1, ! bounds->topLeft.y+bounds->extent.y-dy); ! grtaps_print_val("fi:",angle,bounds->topLeft.x+bounds->extent.x/2+dx2, ! bounds->topLeft.y+bounds->extent.y-dy); } --- 429,442 ---- grtaps_print_pol(double r, double angle,RectangleType *bounds) { ! Coord dx1 = HanderaCoord(1); ! Coord dy = HanderaCoord(11); ! if (graphPrefs.grEnable[8]) ! dy += HanderaCoord(7); ! grtaps_print_val("r:", r, bounds->topLeft.x + dx1, ! bounds->topLeft.y + bounds->extent.y - dy, align_left); ! grtaps_print_val("fi:", angle, bounds->topLeft.x + bounds->extent.x, ! bounds->topLeft.y + bounds->extent.y - dy, align_right); } *************** *** 455,473 **** grtaps_print_param(double t,RectangleType *bounds) { ! UInt16 save; ! Coord dx1 = HanderaCoord(1), dy = HanderaCoord(12); ! if (gHrMode == hrPalm) { ! save = WinSetCoordinateSystem(kCoordinatesNative); ! dx1 = WinScaleCoord(dx1, true); ! dy = WinScaleCoord(dy, true); ! WinSetCoordinateSystem(save); ! } ! else { ! dx1 *= gSonyFactor; ! dy *= gSonyFactor; ! } ! grtaps_print_val("T:",t,bounds->topLeft.x+dx1, ! bounds->topLeft.y+bounds->extent.y-dy); } --- 446,455 ---- grtaps_print_param(double t,RectangleType *bounds) { ! Coord dx1 = HanderaCoord(1), dy = HanderaCoord(11); ! if (graphPrefs.grEnable[8]) ! dy += HanderaCoord(7); ! grtaps_print_val("T:", t, bounds->topLeft.x + dx1, ! bounds->topLeft.y + bounds->extent.y - dy, align_left); } *************** *** 477,497 **** grtaps_print_coords(double realx, double realy,RectangleType *bounds) { ! UInt16 save; ! Coord dx1 = HanderaCoord(1), dx2 = HanderaCoord(2); ! if (gHrMode == hrPalm) { ! save = WinSetCoordinateSystem(kCoordinatesNative); ! dx1 = WinScaleCoord(dx1, true); ! dx2 = WinScaleCoord(dx2, true); ! WinSetCoordinateSystem(save); ! } ! else { ! dx1 *= gSonyFactor; ! dx2 *= gSonyFactor; ! } ! grtaps_print_val("x:",realx,bounds->topLeft.x+dx1,bounds->topLeft.y); ! grtaps_print_val("y:",realy,bounds->topLeft.x+bounds->extent.x/2+dx2, ! bounds->topLeft.y); } --- 459,473 ---- grtaps_print_coords(double realx, double realy,RectangleType *bounds) { ! Coord dx1 = HanderaCoord(1); ! Coord dy7 = HanderaCoord(7); ! Coord y; ! y = bounds->topLeft.y; ! if (graphPrefs.grEnable[8]) ! y += dy7; ! grtaps_print_val("x:", realx, bounds->topLeft.x + dx1, y, align_left); ! grtaps_print_val("y:", realy, bounds->topLeft.x + bounds->extent.x, ! y, align_right); } *************** *** 517,524 **** ***********************************************************************/ void ! grtaps_track_manual(double value,TtrackAction action) { double realx, realy, r; ! RectangleType bounds; if (graphPrefs.functype == graph_polar) { --- 493,501 ---- ***********************************************************************/ void ! grtaps_track_manual(double value, TtrackAction action) { double realx, realy, r; ! RectangleType natbounds; ! RectangleType stdbounds; if (graphPrefs.functype == graph_polar) { *************** *** 526,536 **** } ! if (action==track_reset) { lastParam = value; crossX = crossY = -1; return; } else { ! gadget_bounds(FrmGetActiveForm(), graphGadget, &bounds); if (action == track_set) --- 503,514 ---- } ! if (action == track_reset) { lastParam = value; crossX = crossY = -1; + oldr = oldangle = oldparam = oldrealx = oldrealy = NaN; return; } else { ! gadget_bounds(FrmGetActiveForm(), graphGadget, &natbounds, &stdbounds); if (action == track_set) *************** *** 539,563 **** lastParam += value; ! if (action != track_redraw) ! grtaps_cross(crossX, crossY, &bounds); graph_get_vals(trackSelected, lastParam, &realx, &realy); crossX = finite(realx) ? graph_xgr2scr(realx) : -1; crossY = finite(realy) ? graph_ygr2scr(realy) : -1; ! if (crossX < bounds.topLeft.x ! || crossX > bounds.topLeft.x + bounds.extent.x) crossX = -1; ! if (crossY < bounds.topLeft.y ! || crossY > bounds.topLeft.y + bounds.extent.y) crossY = -1; ! grtaps_cross(crossX, crossY, &bounds); ! grtaps_print_coords(realx, realy, &bounds); ! if (graphPrefs.functype == graph_param) ! grtaps_print_param(lastParam, &bounds); else if (graphPrefs.functype == graph_polar) { // func_get_value(graphCurves[trackSelected].stack1, // lastParam,&r,NULL); r = sqrt(realx * realx + realy * realy); ! grtaps_print_pol(r, math_rad_to_user(lastParam), &bounds); } } --- 517,553 ---- lastParam += value; ! if (action != track_redraw) { ! /* Erase previously drawn cross + text */ ! grtaps_cross(crossX, crossY, &natbounds); ! grtaps_print_coords(oldrealx, oldrealy, &stdbounds); ! if (graphPrefs.functype == graph_param) ! grtaps_print_param(oldparam, &stdbounds); ! else if (graphPrefs.functype == graph_polar) ! grtaps_print_pol(oldr, oldangle, &stdbounds); ! } graph_get_vals(trackSelected, lastParam, &realx, &realy); crossX = finite(realx) ? graph_xgr2scr(realx) : -1; crossY = finite(realy) ? graph_ygr2scr(realy) : -1; ! if (crossX < natbounds.topLeft.x ! || crossX > natbounds.topLeft.x + natbounds.extent.x) crossX = -1; ! if (crossY < natbounds.topLeft.y ! || crossY > natbounds.topLeft.y + natbounds.extent.y) crossY = -1; ! grtaps_cross(crossX, crossY, &natbounds); ! grtaps_print_coords(realx, realy, &stdbounds); ! oldrealx = realx; oldrealy = realy; ! if (graphPrefs.functype == graph_param) { ! grtaps_print_param(lastParam, &stdbounds); ! oldparam = lastParam; ! } else if (graphPrefs.functype == graph_polar) { // func_get_value(graphCurves[trackSelected].stack1, // lastParam,&r,NULL); r = sqrt(realx * realx + realy * realy); ! grtaps_print_pol(r, math_rad_to_user(lastParam), &stdbounds); ! oldr = r; ! oldangle = math_rad_to_user(lastParam); } } *************** *** 578,590 **** ***********************************************************************/ static Boolean ! grtaps_track_pol(Coord x,Coord y,RectangleType *bounds) GRAPH; static Boolean ! grtaps_track_pol(Coord x,Coord y,RectangleType *bounds) { ! double realx,realy; double r; double angle_rad; /* angle in radians */ double angle_usr; /* angle in user units: rad/deg/grad */ ! Coord oldx,oldy,dx,dy; CodeStack *stack; Boolean penDown; --- 568,582 ---- ***********************************************************************/ static Boolean ! grtaps_track_pol(Coord x, Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) GRAPH; static Boolean ! grtaps_track_pol(Coord x, Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) { ! double realx, realy; double r; double angle_rad; /* angle in radians */ double angle_usr; /* angle in user units: rad/deg/grad */ ! Coord oldx, oldy, dx, dy; CodeStack *stack; Boolean penDown; *************** *** 597,632 **** realx = realy = r = angle_rad = angle_usr = NaN; do { ! EvtGetPen(&x,&y,&penDown); ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! x = WinScaleCoord(x, true); ! y = WinScaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! x *= gSonyFactor; ! y *= gSonyFactor; ! } ! if ((oldx!=x || oldy!=y) && RctPtInRectangle(x,y,bounds)) { realx = graph_xscr2gr(x); realy = graph_yscr2gr(y); angle_rad = angle_usr = NaN; ! r = hypot(realx,realy); ! if (r!=0.0) { ! if (realx>=0.0 && realy>=0.0) ! angle_rad = asin(realy/r); ! else if (realx<=0.0) ! angle_rad = M_PIl - asin(realy/r); else ! angle_rad = 2*M_PIl + asin(realy/r); angle_usr = math_rad_to_user(angle_rad); ! func_get_value(stack,angle_usr,&r,NULL); ! ! realx = r*cos(angle_rad); ! realy = r*sin(angle_rad); dx = graph_xgr2scr(realx); dy = graph_ygr2scr(realy); ! if (!finite(angle_rad) || !RctPtInRectangle(dx,dy,bounds)) { dy = -1; dx = -1; --- 589,614 ---- realx = realy = r = angle_rad = angle_usr = NaN; do { ! EvtGetPenNat(&x, &y, &penDown); ! if ((oldx != x || oldy != y) && RctPtInRectangle(x, y, natbounds)) { realx = graph_xscr2gr(x); realy = graph_yscr2gr(y); angle_rad = angle_usr = NaN; ! r = hypot(realx, realy); ! if (r != 0.0) { ! if (realx >= 0.0 && realy >= 0.0) ! angle_rad = asin(realy / r); ! else if (realx <= 0.0) ! angle_rad = M_PIl - asin(realy / r); else ! angle_rad = 2 * M_PIl + asin(realy / r); angle_usr = math_rad_to_user(angle_rad); ! func_get_value(stack, angle_usr, &r, NULL); ! ! realx = r * cos(angle_rad); ! realy = r * sin(angle_rad); dx = graph_xgr2scr(realx); dy = graph_ygr2scr(realy); ! if (!finite(angle_rad) || !RctPtInRectangle(dx, dy, natbounds)) { dy = -1; dx = -1; *************** *** 637,650 **** realx = realy = NaN; } ! grtaps_cross(dx,dy,bounds); ! grtaps_cross(crossX,crossY,bounds); ! grtaps_print_coords(realx,realy,bounds); ! grtaps_print_pol(r,angle_usr,bounds); ! oldx = x;oldy = y; ! crossX = dx;crossY=dy; } } while(penDown); ! if (RctPtInRectangle(x, y, bounds)) { lastParam = angle_rad; return true; --- 619,636 ---- realx = realy = NaN; } ! grtaps_cross(dx, dy, natbounds); ! grtaps_cross(crossX, crossY, natbounds); ! grtaps_print_coords(oldrealx, oldrealy, stdbounds); ! grtaps_print_coords(realx, realy, stdbounds); ! grtaps_print_pol(oldr, oldangle, stdbounds); ! grtaps_print_pol(r, angle_usr, stdbounds); ! oldx = x; oldy = y; ! crossX = dx; crossY = dy; ! oldrealx = realx; oldrealy = realy; ! oldr = r; oldangle = angle_usr; } } while(penDown); ! if (RctPtInRectangle(x, y, natbounds)) { lastParam = angle_rad; return true; *************** *** 668,678 **** ***********************************************************************/ static Boolean ! grtaps_track_param(Coord x,Coord y,RectangleType *bounds) GRAPH; static Boolean ! grtaps_track_param(Coord x,Coord y,RectangleType *bounds) { ! double realx,realy; double param; ! Coord oldx,oldy,dx,dy; CodeStack *stack1, *stack2; double x2param; --- 654,666 ---- ***********************************************************************/ static Boolean ! grtaps_track_param(Coord x, Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) GRAPH; static Boolean ! grtaps_track_param(Coord x, Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) { ! double realx, realy; double param; ! Coord oldx, oldy, dx, dy; CodeStack *stack1, *stack2; double x2param; *************** *** 686,704 **** oldx = oldy = -1; realx = realy = param = NaN; ! x2param = (graphPrefs.tmax - graphPrefs.tmin) / (double)bounds->extent.x; do { ! EvtGetPen(&x, &y, &penDown); ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! x = WinScaleCoord(x, true); ! y = WinScaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! x *= gSonyFactor; ! y *= gSonyFactor; ! } ! if (oldx != x && RctPtInRectangle(x, y, bounds)) { ! param = (double)(x - bounds->topLeft.x) * x2param; param = graphPrefs.tmin + round(param / graphPrefs.tstep) * graphPrefs.tstep; --- 674,682 ---- oldx = oldy = -1; realx = realy = param = NaN; ! x2param = (graphPrefs.tmax - graphPrefs.tmin) / (double)natbounds->extent.x; do { ! EvtGetPenNat(&x, &y, &penDown); ! if (oldx != x && RctPtInRectangle(x, y, natbounds)) { ! param = (double)(x - natbounds->topLeft.x) * x2param; param = graphPrefs.tmin + round(param / graphPrefs.tstep) * graphPrefs.tstep; *************** *** 708,716 **** dx = graph_xgr2scr(realx); dy = graph_ygr2scr(realy); ! if (dx < bounds->topLeft.x || ! dx > bounds->topLeft.x + bounds->extent.x) dx = -1; ! if (dy < bounds->topLeft.y || ! dy > bounds->topLeft.y + bounds->extent.y) dy = -1; } --- 686,694 ---- dx = graph_xgr2scr(realx); dy = graph_ygr2scr(realy); ! if (dx < natbounds->topLeft.x || ! dx > natbounds->topLeft.x + natbounds->extent.x) dx = -1; ! if (dy < natbounds->topLeft.y || ! dy > natbounds->topLeft.y + natbounds->extent.y) dy = -1; } *************** *** 719,732 **** realx = realy = NaN; } ! grtaps_cross(dx, dy, bounds); ! grtaps_cross(crossX, crossY, bounds); ! grtaps_print_coords(realx, realy, bounds); ! grtaps_print_param(param, bounds); oldx = x; oldy = y; crossX = dx; crossY = dy; } } while (penDown); ! if (RctPtInRectangle(x, y, bounds)) { lastParam = param; return true; --- 697,714 ---- realx = realy = NaN; } ! grtaps_cross(dx, dy, natbounds); ! grtaps_cross(crossX, crossY, natbounds); ! grtaps_print_coords(oldrealx, oldrealy, stdbounds); ! grtaps_print_coords(realx, realy, stdbounds); ! grtaps_print_param(oldparam, stdbounds); ! grtaps_print_param(param, stdbounds); oldx = x; oldy = y; crossX = dx; crossY = dy; + oldrealx = realx; oldrealy = realy; + oldparam = param; } } while (penDown); ! if (RctPtInRectangle(x, y, natbounds)) { lastParam = param; return true; *************** *** 749,757 **** ***********************************************************************/ static Boolean ! grtaps_track_func(Coord x,Coord y,RectangleType *bounds) GRAPH; static Boolean ! grtaps_track_func(Coord x,Coord y,RectangleType *bounds) { ! double realx,realy; CodeStack *stack; Boolean penDown; --- 731,741 ---- ***********************************************************************/ static Boolean ! grtaps_track_func(Coord x, Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) GRAPH; static Boolean ! grtaps_track_func(Coord x,Coord y, ! RectangleType *natbounds, RectangleType *stdbounds) { ! double realx, realy; CodeStack *stack; Boolean penDown; *************** *** 763,791 **** realx = realy = NaN; do { ! EvtGetPen(&x, &y, &penDown); ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! x = WinScaleCoord(x, true); ! y = WinScaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! x *= gSonyFactor; ! y *= gSonyFactor; ! } ! if (crossX!=x && RctPtInRectangle(x,y,bounds)) { realx = graph_xscr2gr(x); ! func_get_value(stack,realx, &realy,NULL); y = graph_ygr2scr(realy); ! if (!finite(realy) || !RctPtInRectangle(x,y,bounds)) ! y = -1; ! grtaps_cross(x,y,bounds); ! grtaps_cross(crossX,crossY,bounds); ! grtaps_print_coords(realx,realy,bounds); ! crossX = x;crossY = y; } ! }while(penDown); ! if (RctPtInRectangle(x, y, bounds)) { lastParam = realx; return true; --- 747,767 ---- realx = realy = NaN; do { ! EvtGetPenNat(&x, &y, &penDown); ! if (crossX != x && RctPtInRectangle(x, y, natbounds)) { realx = graph_xscr2gr(x); ! func_get_value(stack, realx, &realy, NULL); y = graph_ygr2scr(realy); ! if (!finite(realy) || !RctPtInRectangle(x, y, natbounds)) ! y = -1; ! grtaps_cross(x, y, natbounds); ! grtaps_cross(crossX, crossY, natbounds); ! grtaps_print_coords(oldrealx, oldrealy, stdbounds); ! grtaps_print_coords(realx, realy, stdbounds); ! crossX = x; crossY = y; ! oldrealx = realx; oldrealy = realy; } ! } while(penDown); ! if (RctPtInRectangle(x, y, natbounds)) { lastParam = realx; return true; *************** *** 811,815 **** grtaps_tap(Int16 x,Int16 y) { ! RectangleType bounds; if (gHrMode == hrPalm) { --- 787,792 ---- grtaps_tap(Int16 x,Int16 y) { ! RectangleType natbounds; ! RectangleType stdbounds; if (gHrMode == hrPalm) { *************** *** 823,850 **** } ! gadget_bounds(FrmGetActiveForm(), graphGadget, &bounds); ! if (RctPtInRectangle(x,y,&bounds)) { /* Is zoom-in checked? */ if (CtlGetValue(GetObjectPtr(btnGraphZoomIn))) { ! if (grtaps_zoom_in(x,y,&bounds)) { ! CtlSetValue(GetObjectPtr(btnGraphZoomIn),0); ! FrmUpdateForm(frmGraph,frmUpdateVars); } } /* Is tracking checked? */ else if (CtlGetValue(GetObjectPtr(btnGraphTrack))) { ! if (graphPrefs.functype==graph_func) ! grtaps_track_func(x,y,&bounds); else if (graphPrefs.functype == graph_polar) ! grtaps_track_pol(x,y,&bounds); else if (graphPrefs.functype == graph_param) ! grtaps_track_param(x, y, &bounds); } else /* Move the graph */ ! if (grtaps_move(x,y,&bounds)) ! FrmUpdateForm(frmGraph,frmUpdateVars); return true; ! } return false; } --- 800,827 ---- } ! gadget_bounds(FrmGetActiveForm(), graphGadget, &natbounds, &stdbounds); ! if (RctPtInRectangle(x, y, &natbounds)) { /* Is zoom-in checked? */ if (CtlGetValue(GetObjectPtr(btnGraphZoomIn))) { ! if (grtaps_zoom_in(x, y, &natbounds)) { ! CtlSetValue(GetObjectPtr(btnGraphZoomIn), 0); ! FrmUpdateForm(frmGraph, frmUpdateVars); } } /* Is tracking checked? */ else if (CtlGetValue(GetObjectPtr(btnGraphTrack))) { ! if (graphPrefs.functype == graph_func) ! grtaps_track_func(x, y, &natbounds, &stdbounds); else if (graphPrefs.functype == graph_polar) ! grtaps_track_pol(x, y, &natbounds, &stdbounds); else if (graphPrefs.functype == graph_param) ! grtaps_track_param(x, y, &natbounds, &stdbounds); } else /* Move the graph */ ! if (grtaps_move(x, y, &natbounds)) ! FrmUpdateForm(frmGraph, frmUpdateVars); return true; ! } return false; } *************** *** 866,871 **** FormPtr frm = FrmGetActiveForm(); ! grtaps_track_manual(0,track_add); ! FrmShowObject(frm,FrmGetObjectIndex(frm,btnGraphTrackGoto)); } --- 843,848 ---- FormPtr frm = FrmGetActiveForm(); ! grtaps_track_manual(0, track_add); ! FrmShowObject(frm, FrmGetObjectIndex(frm, btnGraphTrackGoto)); } *************** *** 886,891 **** FormPtr frm = FrmGetActiveForm(); ! CtlSetValue(GetObjectPtr(btnGraphTrack),false); ! FrmHideObject(frm,FrmGetObjectIndex(frm,btnGraphTrackGoto)); } --- 863,868 ---- FormPtr frm = FrmGetActiveForm(); ! CtlSetValue(GetObjectPtr(btnGraphTrack), false); ! FrmHideObject(frm, FrmGetObjectIndex(frm, btnGraphTrackGoto)); } *************** *** 908,915 **** { FormPtr frm = FrmGetActiveForm(); ! ! grtaps_track_manual(start,track_reset); ! CtlSetValue(GetObjectPtr(btnGraphTrack),false); ! FrmHideObject(frm,FrmGetObjectIndex(frm,btnGraphTrackGoto)); } --- 885,892 ---- { FormPtr frm = FrmGetActiveForm(); ! ! grtaps_track_manual(start, track_reset); ! CtlSetValue(GetObjectPtr(btnGraphTrack), false); ! FrmHideObject(frm, FrmGetObjectIndex(frm, btnGraphTrackGoto)); } *************** *** 929,933 **** { trackSelected = track; ! CtlSetValue(GetObjectPtr(btnGraphTrack),true); grtaps_track_start(); } --- 906,910 ---- { trackSelected = track; ! CtlSetValue(GetObjectPtr(btnGraphTrack), true); grtaps_track_start(); } Index: grprefs.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/grprefs.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** grprefs.c 19 Oct 2006 19:39:50 -0000 1.25 --- grprefs.c 10 Nov 2006 04:12:56 -0000 1.26 *************** *** 85,89 **** #ifdef SUPPORT_DIA FormType *frm; ! RectangleType bounds; #endif --- 85,90 ---- #ifdef SUPPORT_DIA FormType *frm; ! RectangleType natbounds; ! RectangleType stdbounds; #endif *************** *** 115,119 **** graphPrefs.logy = false; graphPrefs.speed = 1; ! for (i=0; i<9; i++){ graphPrefs.grEnable[i] = true; if (colorDisplay) --- 116,120 ---- graphPrefs.logy = false; graphPrefs.speed = 1; ! for (i=0; i<8; i++){ graphPrefs.grEnable[i] = true; if (colorDisplay) *************** *** 122,125 **** --- 123,127 ---- graphPrefs.colors[i] = funcolors[i]; } + graphPrefs.grEnable[8] = true; for (i=0; i<6; i++) graphPrefs.grType[i] = 1; *************** *** 134,143 **** VgaFormModify(frm, vgaFormModify160To240); #endif ! gadget_bounds(frm, graphGadget, &bounds); FrmDeleteForm(frm); ! ScrPrefs.xmin = bounds.topLeft.x; ! ScrPrefs.ymax = bounds.topLeft.y; ! ScrPrefs.xmax = bounds.topLeft.x + bounds.extent.x - 1; ! ScrPrefs.ymin = bounds.topLeft.y + bounds.extent.y - 1; ScrPrefs.xtrans = (double)(ScrPrefs.xmax - ScrPrefs.xmin) / (graphPrefs.xmax - graphPrefs.xmin); --- 136,145 ---- VgaFormModify(frm, vgaFormModify160To240); #endif ! gadget_bounds(frm, graphGadget, &natbounds, &stdbounds); FrmDeleteForm(frm); ! ScrPrefs.xmin = natbounds.topLeft.x; ! ScrPrefs.ymax = natbounds.topLeft.y; ! ScrPrefs.xmax = natbounds.topLeft.x + natbounds.extent.x - 1; ! ScrPrefs.ymin = natbounds.topLeft.y + natbounds.extent.y - 1; ScrPrefs.xtrans = (double)(ScrPrefs.xmax - ScrPrefs.xmin) / (graphPrefs.xmax - graphPrefs.xmin); *************** *** 163,167 **** #ifdef SUPPORT_DIA FormType *frm; ! RectangleType bounds; Coord dx, dy; --- 165,170 ---- #ifdef SUPPORT_DIA FormType *frm; ! RectangleType natbounds; ! RectangleType stdbounds; Coord dx, dy; *************** *** 175,182 **** VgaFormModify(frm, vgaFormModify160To240); #endif ! gadget_bounds(frm, graphGadget, &bounds); FrmDeleteForm(frm); ! dx = bounds.topLeft.x + bounds.extent.x - 1 - ScrPrefs.xmax; ! dy = bounds.topLeft.y + bounds.extent.y - 1 - ScrPrefs.ymin; if (dx) graphPrefs.xmax += dx / ScrPrefs.xtrans; --- 178,185 ---- VgaFormModify(frm, vgaFormModify160To240); #endif ! gadget_bounds(frm, graphGadget, &natbounds, &stdbounds); FrmDeleteForm(frm); ! dx = natbounds.topLeft.x + natbounds.extent.x - 1 - ScrPrefs.xmax; ! dy = natbounds.topLeft.y + natbounds.extent.y - 1 - ScrPrefs.ymin; if (dx) graphPrefs.xmax += dx / ScrPrefs.xtrans; |