From: Jorge G. <cl...@us...> - 2007-05-26 14:52:15
|
Update of /cvsroot/easycalc/easycalc In directory sc8-pr-cvs17:/tmp/cvs-serv17561 Modified Files: graph.c grsetup.c Log Message: - points graphing replaced for crosses for a better visibility - functions can be arranged on the GraphSetup form by dragging Index: grsetup.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/grsetup.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** grsetup.c 10 Nov 2006 04:12:56 -0000 1.32 --- grsetup.c 26 May 2007 14:52:10 -0000 1.33 *************** *** 36,39 **** --- 36,40 ---- #include "calcrsc.h" #include "calc.h" + #include "stack.h" #ifdef SUPPORT_DIA *************** *** 54,57 **** --- 55,60 ---- }; + static void draw_grType(FormType *frm) IFACE; + static const char * grsetup_param_name(void) IFACE; *************** *** 356,380 **** * ***********************************************************************/ ! Boolean ! grsetup_handle_pendown(RectangleType *bounds) { Boolean penDown; ! Boolean inrect = true; Coord x,y; ! ! WinInvertRectangle(bounds,0); do { EvtGetPen(&x,&y,&penDown); ! if (RctPtInRectangle(x,y,bounds) && !inrect) { ! inrect = true; ! WinInvertRectangle(bounds,0); ! } else if (!RctPtInRectangle(x,y,bounds) && inrect) { ! inrect = false; ! WinInvertRectangle(bounds,0); ! } }while(penDown); ! if (inrect) ! WinInvertRectangle(bounds,0); ! return inrect; } --- 359,442 ---- * ***********************************************************************/ ! Int16 ! grsetup_handle_pendown(Int16 row,Int16 col) { Boolean penDown; ! Boolean inrect; ! Int16 redraw=0; Coord x,y; ! Int16 row2,row1=row; ! RectangleType bounds,oldbounds; ! TablePtr tbl = GetObjectPtr(grSetupTable); ! ! TblGetItemBounds(tbl,row,col,&oldbounds); ! #ifdef SUPPORT_DIA ! /* Height for customTableItem is fixed at 11, so we have to adjust it for Handera */ ! oldbounds.extent.y = HanderaCoord(oldbounds.extent.y); ! #endif ! WinInvertRectangle(&oldbounds,0); ! do { EvtGetPen(&x,&y,&penDown); ! inrect=false; ! if(redraw) redraw++; ! ! for(row2=TblGetNumberOfRows(tbl)-1;(row2>=0 && !inrect);row2--){ ! TblGetItemBounds(GetObjectPtr(grSetupTable),row2,col,&bounds); ! #ifdef SUPPORT_DIA ! bounds.extent.y = HanderaCoord(bounds.extent.y); ! #endif ! if(RctPtInRectangle(x,y,&bounds)) ! inrect=true; ! } ! ! if(inrect){ ! row2++; ! if(row2!=row1){ ! if(row1!=row)WinInvertRectangle(&oldbounds,0); ! if(row2!=row)WinInvertRectangle(&bounds,0); ! row1=row2; ! oldbounds=bounds; ! } ! }else{ ! if(graphPrefs.functype==graph_param){ ! if(firstVisible && y<bounds.topLeft.y){ ! firstVisible=0; ! redraw=1; ! }else if(!firstVisible){ ! TblGetBounds(tbl,&bounds); ! #ifdef SUPPORT_DIA ! bounds.extent.y = HanderaCoord(bounds.extent.y); ! #endif ! if(y>bounds.topLeft.y+bounds.extent.y){ ! firstVisible=TblGetNumberOfRows(tbl); ! redraw=1; ! } ! } ! if(redraw==1){ ! row1=row=-1; ! FrmDrawForm(FrmGetActiveForm()); ! draw_grType(FrmGetActiveForm()); ! } ! } ! if(row1!=row){ ! WinInvertRectangle(&oldbounds,0); ! row1=row; ! } ! } }while(penDown); ! ! if (inrect && row2!=row) ! WinInvertRectangle(&bounds,0); ! ! if(!redraw){ ! TblGetItemBounds(tbl,row,col,&oldbounds); ! #ifdef SUPPORT_DIA ! bounds.extent.y = HanderaCoord(bounds.extent.y); ! #endif*/ ! WinInvertRectangle(&oldbounds,0); ! } ! ! return row2; } *************** *** 557,561 **** #endif - static void draw_grType(FormType *frm) IFACE; static void draw_grType(FormType *frm) --- 619,622 ---- *************** *** 592,598 **** switch (graphPrefs.grType[k]) { case 0: ! WinDrawLine(x1, y2, x1, y2); ! WinDrawLine(x2 ,y2, x2, y2); ! WinDrawLine(x3, y2, x3, y2); break; case 2: --- 653,661 ---- switch (graphPrefs.grType[k]) { case 0: ! x1++; x3--; ! WinDrawLine(x1-1, y2, x1+1, y2); ! WinDrawLine(x1 ,y2-1, x1, y2+1); ! WinDrawLine(x3-1, y2, x3+1, y2); ! WinDrawLine(x3,y2-1, x3, y2+1); break; case 2: *************** *** 645,650 **** FormPtr frm=FrmGetActiveForm(); Int16 controlId; ! RectangleType bounds; ! Int16 row=0, col; #ifdef SUPPORT_DIA --- 708,712 ---- FormPtr frm=FrmGetActiveForm(); Int16 controlId; ! Int16 row=0; #ifdef SUPPORT_DIA *************** *** 656,670 **** switch (event->eType) { case tblEnterEvent: row = event->data.tblSelect.row; col = event->data.tblSelect.column; ! TblGetItemBounds(GetObjectPtr(grSetupTable), ! row,col,&bounds); ! #ifdef SUPPORT_DIA ! /* Height for customTableItem is fixed at 11, so we ! have to adjust it for Handera */ ! bounds.extent.y = HanderaCoord(bounds.extent.y); ! #endif ! if (grsetup_handle_pendown(&bounds)) { ! selectedRow = row + firstVisible; switch (col) { case COL_FLIST: --- 718,736 ---- switch (event->eType) { case tblEnterEvent: + { + Int16 col,row2; + TablePtr tbl = GetObjectPtr(grSetupTable); row = event->data.tblSelect.row; col = event->data.tblSelect.column; ! ! row+=firstVisible; ! row2=grsetup_handle_pendown(row-firstVisible,col); ! if(row-firstVisible<TblGetNumberOfRows(tbl)) ! TblMarkRowInvalid(tbl,row-firstVisible); ! TblMarkRowInvalid(tbl,row2); ! row2+=firstVisible; ! ! if (row2==row) { ! selectedRow = row; switch (col) { case COL_FLIST: *************** *** 675,681 **** break; } ! } handled = true; break; case keyDownEvent: switch (event->data.keyDown.chr) { --- 741,790 ---- break; } ! }else if(row2>=firstVisible){ ! CError err; ! CodeStack *stack; ! char param[MAX_FUNCNAME+1]; ! char *value=grsetup_get_fname(row); ! char *value2=grsetup_get_fname(row2); ! ! StrCopy(param,value2); ! if(StrCompare(value,grsetup_def_name(row))) ! StrCopy(value2,value); ! else StrCopy(value2,grsetup_def_name(row2)); ! if(StrCompare(param,grsetup_def_name(row2))) ! StrCopy(value,param); ! else StrCopy(value,grsetup_def_name(row)); ! ! err =db_func_description(grsetup_def_name(row),&value,param); ! if(!err){ ! stack = text_to_stack(value,&err); ! if(!err){ ! StrCopy(parameter_name,param); ! err =db_func_description(grsetup_def_name(row2),&value2,param); ! db_write_function(grsetup_def_name(row2),stack,value); ! stack_delete(stack); ! } ! MemPtrFree(value); ! }else{ ! err =db_func_description(grsetup_def_name(row2),&value2,param); ! db_delete_record(grsetup_def_name(row2)); ! } ! ! if(!err){ ! stack = text_to_stack(value2,&err); ! if(!err){ ! StrCopy(parameter_name,param); ! db_write_function(grsetup_def_name(row),stack,value2); ! stack_delete(stack); ! } ! MemPtrFree(value2); ! }else ! db_delete_record(grsetup_def_name(row)); ! ! TblRedrawTable(tbl); ! } handled = true; break; + } case keyDownEvent: switch (event->data.keyDown.chr) { Index: graph.c =================================================================== RCS file: /cvsroot/easycalc/easycalc/graph.c,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** graph.c 24 May 2007 20:28:55 -0000 1.57 --- graph.c 26 May 2007 14:52:10 -0000 1.58 *************** *** 347,352 **** case 0: ! if(ison) ! clie_drawpixel(graph_xgr2scr(x),graph_ygr2scr(y)); break; --- 347,356 ---- case 0: ! if(ison){ ! Coord xx=graph_xgr2scr(x); ! Coord yy=graph_ygr2scr(y); ! clie_drawline(xx,yy-1,xx,yy+1); ! clie_drawline(xx-1,yy,xx+1,yy); ! } break; *************** *** 361,372 **** if(y>graphPrefs.ymax){ ! if(y0<=ScrPrefs.ymax) break; ! if(y0>=ScrPrefs.ymin) y0=ScrPrefs.ymin; else y0--; yy=ScrPrefs.ymax; } else if(y<graphPrefs.ymin){ ! if(y0>=ScrPrefs.ymin) break; ! if(y0<=ScrPrefs.ymax) y0=ScrPrefs.ymax; else y0++; yy=ScrPrefs.ymin; --- 365,376 ---- if(y>graphPrefs.ymax){ ! if(graphPrefs.ymax<0) break; ! if(graphPrefs.ymin>0) y0=ScrPrefs.ymin; else y0--; yy=ScrPrefs.ymax; } else if(y<graphPrefs.ymin){ ! if(graphPrefs.ymin>0) break; ! if(graphPrefs.ymax<0) y0=ScrPrefs.ymax; else y0++; yy=ScrPrefs.ymin; *************** *** 374,379 **** else{ yy=graph_ygr2scr(y); ! if(y0<=ScrPrefs.ymax) y0=ScrPrefs.ymax; ! else if(y0>=ScrPrefs.ymin) y0=ScrPrefs.ymin; else y0-=sgn(y); } --- 378,383 ---- else{ yy=graph_ygr2scr(y); ! if(graphPrefs.ymax<0) y0=ScrPrefs.ymax; ! else if(graphPrefs.ymin>0) y0=ScrPrefs.ymin; else y0-=sgn(y); } |