From: Ton v. O. <tvo...@us...> - 2007-09-30 00:35:50
|
Update of /cvsroot/easycalc/easycalc In directory sc8-pr-cvs17:/tmp/cvs-serv32155 Modified Files: graph.c grtaps.c grtaps.h Log Message: Redraw axes labels after all graphs are plotted. The graphs may have covered the labels. Choose apropriate drawing mode in grtaps_print_val to achieve this. Index: graph.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/graph.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** graph.c 29 Jul 2007 01:31:18 -0000 1.59 --- graph.c 30 Sep 2007 00:35:42 -0000 1.60 *************** *** 73,76 **** --- 73,78 ---- Tgraph_curves graphCurves[MAX_GRFUNCS]; + static RectangleType stdbounds; // bounds in standard coordinates + /*********************************************************************** * *************** *** 486,489 **** --- 488,548 ---- } + static void graph_draw_axes_labels(RectangleType *stdbounds) GRAPH; + static void + graph_draw_axes_labels(RectangleType *stdbounds) + { + Coord x, y, xstd, ystd; + + x = graph_xgr2scr(0.0); + y = graph_ygr2scr(0.0); + + if (gHrMode == hrPalm) { + UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); + xstd = WinUnscaleCoord(x, true); + ystd = WinUnscaleCoord(y, true); + WinSetCoordinateSystem(save); + } + else { + xstd = x / gSonyFactor; + ystd = y / gSonyFactor; + } + if (graphPrefs.grEnable[6] && graphPrefs.grEnable[8]) { /* axes and labels enabled */ + Coord dy1 = HanderaCoord(1); + Coord dy10 = HanderaCoord(10); + Coord dy15 = HanderaCoord(15); + Coord dy26 = HanderaCoord(26); + + grtaps_print_val("y>",graphPrefs.ymin, + xstd + 1, + stdbounds->topLeft.y + stdbounds->extent.y - dy10, + stdbounds->topLeft.x, + stdbounds->topLeft.x + stdbounds->extent.x, + align_left, winOverlay); + grtaps_print_val("y<",graphPrefs.ymax, + xstd + 1, + stdbounds->topLeft.y - dy1, + stdbounds->topLeft.x, + stdbounds->topLeft.x + stdbounds->extent.x, + align_left, winOverlay); + ystd -= dy1; + if (ystd < stdbounds->topLeft.y + dy15) + ystd = stdbounds->topLeft.y + dy15; + if (ystd > stdbounds->topLeft.y + stdbounds->extent.y - dy26) + ystd = stdbounds->topLeft.y + stdbounds->extent.y - dy26; + grtaps_print_val("x>",graphPrefs.xmin, + stdbounds->topLeft.x + dy1, + ystd, + stdbounds->topLeft.x, + stdbounds->topLeft.x + stdbounds->extent.x, + align_left, winOverlay); + grtaps_print_val("x<",graphPrefs.xmax, + stdbounds->topLeft.x + stdbounds->extent.x, + ystd, + stdbounds->topLeft.x, + stdbounds->topLeft.x + stdbounds->extent.x, + align_right, winOverlay); + } + } + /* Initializes Graph gadget and shows the basic grid */ static void graph_init_screen(FormPtr frm,UInt16 graphId) GRAPH; *************** *** 491,498 **** graph_init_screen(FormPtr frm,UInt16 graphId) { - RectangleType stdbounds; // bounds in standard coordinates RectangleType natbounds; // bounds in native coordinates RectangleType clip; // clip rectangle in standard coordinates ! Coord x, y, xstd, ystd; #ifdef SUPPORT_DIA Coord dx, dy; --- 550,556 ---- graph_init_screen(FormPtr frm,UInt16 graphId) { RectangleType natbounds; // bounds in native coordinates RectangleType clip; // clip rectangle in standard coordinates ! Coord x, y; #ifdef SUPPORT_DIA Coord dx, dy; *************** *** 549,598 **** /* Draw axes labels */ ! if (gHrMode == hrPalm) { ! UInt16 save = WinSetCoordinateSystem(kCoordinatesNative); ! xstd = WinUnscaleCoord(x, true); ! ystd = WinUnscaleCoord(y, true); ! WinSetCoordinateSystem(save); ! } ! else { ! xstd = x / gSonyFactor; ! ystd = y / gSonyFactor; ! } ! if (graphPrefs.grEnable[6] && graphPrefs.grEnable[8]) { /* axes and labels enabled */ ! Coord dy1 = HanderaCoord(1); ! Coord dy10 = HanderaCoord(10); ! Coord dy15 = HanderaCoord(15); ! Coord dy26 = HanderaCoord(26); ! ! grtaps_print_val("y>",graphPrefs.ymin, ! xstd + 1, ! stdbounds.topLeft.y + stdbounds.extent.y - dy10, ! stdbounds.topLeft.x, ! stdbounds.topLeft.x + stdbounds.extent.x, ! align_left); ! grtaps_print_val("y<",graphPrefs.ymax, ! xstd + 1, ! stdbounds.topLeft.y - dy1, ! stdbounds.topLeft.x, ! stdbounds.topLeft.x + stdbounds.extent.x, ! align_left); ! ystd -= dy1; ! if (ystd < stdbounds.topLeft.y + dy15) ! ystd = stdbounds.topLeft.y + dy15; ! if (ystd > stdbounds.topLeft.y + stdbounds.extent.y - dy26) ! ystd = stdbounds.topLeft.y + stdbounds.extent.y - dy26; ! grtaps_print_val("x>",graphPrefs.xmin, ! stdbounds.topLeft.x + dy1, ! ystd, ! stdbounds.topLeft.x, ! stdbounds.topLeft.x + stdbounds.extent.x, ! align_left); ! grtaps_print_val("x<",graphPrefs.xmax, ! stdbounds.topLeft.x + stdbounds.extent.x, ! ystd, ! stdbounds.topLeft.x, ! stdbounds.topLeft.x + stdbounds.extent.x, ! align_right); ! } } --- 607,611 ---- /* Draw axes labels */ ! graph_draw_axes_labels(&stdbounds); } *************** *** 882,885 **** --- 895,899 ---- return; if (graphState.funcnum>=MAX_GRFUNCS) { + graph_draw_axes_labels(&stdbounds); graph_draw_stop(); return; Index: grtaps.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/grtaps.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** grtaps.c 10 Aug 2007 18:54:06 -0000 1.32 --- grtaps.c 30 Sep 2007 00:35:42 -0000 1.33 *************** *** 379,382 **** --- 379,383 ---- * xmin,xmax - keep text between xmin and xmax * align - alignment w.r.t. coordinates + * mode - drawing mode * * RETURN: Nothing *************** *** 385,400 **** void grtaps_print_val(char *name, double value, Coord x, Coord y, Coord xmin, Coord xmax, ! Ttxtalign align) { char text[MAX_FP_NUMBER+10]; - // TdispPrefs oldprefs; Char *numtxt; Coord txtwidth; #ifdef SUPPORT_DIA FntSetFont(HanderaAdjustFont(FntGetFont())); #endif - - // oldprefs = fp_set_prefs(grNumPrefs); StrCopy(text,name); --- 386,399 ---- void grtaps_print_val(char *name, double value, Coord x, Coord y, Coord xmin, Coord xmax, ! Ttxtalign align, WinDrawOperation mode) { char text[MAX_FP_NUMBER+10]; Char *numtxt; Coord txtwidth; + WinDrawOperation oldmode; #ifdef SUPPORT_DIA FntSetFont(HanderaAdjustFont(FntGetFont())); #endif StrCopy(text,name); *************** *** 413,420 **** if ((x + txtwidth) > xmax) x = xmax - txtwidth; ! WinInvertChars(text, StrLen(text), x, y); } - - // fp_set_prefs(oldprefs); } --- 412,419 ---- if ((x + txtwidth) > xmax) x = xmax - txtwidth; ! oldmode = WinSetDrawMode(mode); ! WinPaintChars(text, StrLen(text), x, y); ! WinSetDrawMode(oldmode); } } *************** *** 446,450 **** bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left); grtaps_print_val("fi:", angle, bounds->topLeft.x + bounds->extent.x, --- 445,449 ---- bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left, winInvert); grtaps_print_val("fi:", angle, bounds->topLeft.x + bounds->extent.x, *************** *** 452,456 **** bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_right); } --- 451,455 ---- bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_right, winInvert); } *************** *** 468,472 **** bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left); } --- 467,471 ---- bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left, winInvert); } *************** *** 486,495 **** bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left); grtaps_print_val("y:", realy, bounds->topLeft.x + bounds->extent.x, y, bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_right); } --- 485,494 ---- bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_left, winInvert); grtaps_print_val("y:", realy, bounds->topLeft.x + bounds->extent.x, y, bounds->topLeft.x, bounds->topLeft.x + bounds->extent.x, ! align_right, winInvert); } Index: grtaps.h =================================================================== RCS file: /cvsroot/easycalc/easycalc/grtaps.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** grtaps.h 29 Jul 2007 01:31:18 -0000 1.8 --- grtaps.h 30 Sep 2007 00:35:42 -0000 1.9 *************** *** 42,46 **** Boolean grtaps_track_but(void) GRAPH; void grtaps_print_val(char *name, double value, ! Coord x, Coord y, Coord xmin, Coord xmax, Ttxtalign align) GRAPH; void grtaps_track_manual(double value,TtrackAction action) GRAPH; void grtaps_track_pause(void) GRAPH; --- 42,47 ---- Boolean grtaps_track_but(void) GRAPH; void grtaps_print_val(char *name, double value, ! Coord x, Coord y, Coord xmin, Coord xmax, ! Ttxtalign align, WinDrawOperation mode) GRAPH; void grtaps_track_manual(double value,TtrackAction action) GRAPH; void grtaps_track_pause(void) GRAPH; |