|
From: Mapi B. <ma...@us...> - 2009-11-02 17:37:44
|
Update of /cvsroot/easycalc/PPCport/core In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26302 Modified Files: ansops.cpp core_display.cpp core_display.h core_globals.h core_main.cpp core_main.h varmgr.cpp varmgr.h Added Files: lstedit.cpp lstedit.h Log Message: 1.25b Index: core_globals.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_globals.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** core_globals.h 21 Oct 2009 20:55:03 -0000 1.4 --- core_globals.h 2 Nov 2009 17:20:08 -0000 1.5 *************** *** 20,63 **** - //#include "EasyCalc.h" - - - /**********/ - /* Errors */ - /**********/ - #define ERR_NONE 0 - #define ERR_ALPHA_DATA_IS_INVALID 1 - #define ERR_INSUFFICIENT_MEMORY 2 - #define ERR_NOT_YET_IMPLEMENTED 3 - #define ERR_OUT_OF_RANGE 4 - #define ERR_DIVIDE_BY_0 5 - #define ERR_INVALID_TYPE 6 - #define ERR_INVALID_DATA 7 - #define ERR_DIMENSION_ERROR 8 - #define ERR_SIZE_ERROR 9 - #define ERR_INTERNAL_ERROR 10 - #define ERR_NONEXISTENT 11 - #define ERR_RESTRICTED_OPERATION 12 - #define ERR_YES 13 - #define ERR_NO 14 - #define ERR_STOP 15 - #define ERR_LABEL_NOT_FOUND 16 - #define ERR_NO_REAL_VARIABLES 17 - #define ERR_NO_COMPLEX_VARIABLES 18 - #define ERR_NO_MATRIX_VARIABLES 19 - #define ERR_NO_MENU_VARIABLES 20 - #define ERR_STAT_MATH_ERROR 21 - #define ERR_INVALID_FORECAST_MODEL 22 - #define ERR_SOLVE_INTEG_RTN_LOST 23 - #define ERR_SINGULAR_MATRIX 24 - #define ERR_SOLVE_SOLVE 25 - #define ERR_INTEG_INTEG 26 - #define ERR_RUN 27 - #define ERR_INTERRUPTED 28 - #define ERR_PRINTING_IS_DISABLED 29 - #define ERR_INTERRUPTIBLE 30 - #define ERR_NO_VARIABLES 31 - - /*************/ /* Key codes */ --- 20,23 ---- *************** *** 71,76 **** #define KEY_SHIFT -5 #define KEY_NONE -6 ! //#define KEY_EXIT 33 ! //#define KEY_RUN 36 /*********************/ --- 31,35 ---- #define KEY_SHIFT -5 #define KEY_NONE -6 ! #define RESULT_AREA -99 /*********************/ *************** *** 119,200 **** - /*********/ - /* Menus */ - /*********/ - #define MENU_NONE -1 - #define MENU_SHORTCUT -2 - #define MENU_ALPHA1 0 - #define MENU_ALPHA2 1 - #define MENU_ALPHA_ABCDE1 2 - #define MENU_ALPHA_ABCDE2 3 - #define MENU_ALPHA_FGHI 4 - #define MENU_ALPHA_JKLM 5 - #define MENU_ALPHA_NOPQ1 6 - #define MENU_ALPHA_NOPQ2 7 - #define MENU_ALPHA_RSTUV1 8 - #define MENU_ALPHA_RSTUV2 9 - #define MENU_ALPHA_WXYZ 10 - #define MENU_ALPHA_PAREN 11 - #define MENU_ALPHA_ARROW 12 - #define MENU_ALPHA_COMP 13 - #define MENU_ALPHA_MATH 14 - #define MENU_ALPHA_PUNC1 15 - #define MENU_ALPHA_PUNC2 16 - #define MENU_ALPHA_MISC1 17 - #define MENU_ALPHA_MISC2 18 - #define MENU_ST 19 - #define MENU_IND_ST 20 - #define MENU_IND 21 - #define MENU_MODES1 22 - #define MENU_MODES2 23 - #define MENU_DISP 24 - #define MENU_CLEAR1 25 - #define MENU_CLEAR2 26 - #define MENU_CONVERT1 27 - #define MENU_CONVERT2 28 - #define MENU_FLAGS 29 - #define MENU_PROB 30 - #define MENU_CUSTOM1 31 - #define MENU_CUSTOM2 32 - #define MENU_CUSTOM3 33 - #define MENU_PGM_FCN1 34 - #define MENU_PGM_FCN2 35 - #define MENU_PGM_FCN3 36 - #define MENU_PGM_FCN4 37 - #define MENU_PGM_XCOMP0 38 - #define MENU_PGM_XCOMPY 39 - #define MENU_PRINT1 40 - #define MENU_PRINT2 41 - #define MENU_PRINT3 42 - #define MENU_TOP_FCN 43 - #define MENU_CATALOG 44 - #define MENU_BLANK 45 - #define MENU_PROGRAMMABLE 46 - #define MENU_VARMENU 47 - #define MENU_STAT1 48 - #define MENU_STAT2 49 - #define MENU_STAT_CFIT 50 - #define MENU_STAT_MODL 51 - #define MENU_MATRIX1 52 - #define MENU_MATRIX2 53 - #define MENU_MATRIX3 54 - #define MENU_MATRIX_SIMQ 55 - #define MENU_MATRIX_EDIT1 56 - #define MENU_MATRIX_EDIT2 57 - #define MENU_BASE 58 - #define MENU_BASE_A_THRU_F 59 - #define MENU_BASE_LOGIC 60 - #define MENU_SOLVE 61 - #define MENU_INTEG 62 - #define MENU_INTEG_PARAMS 63 - - /***********************/ /* Variable data types */ /***********************/ - - - /******************/ /* Emulator state */ --- 78,85 ---- --- NEW FILE: lstedit.h --- /* * $Id: lstedit.h,v 1.1 2009/11/02 17:20:08 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,2000,2001 Ondrej Palkovsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * You can contact me at 'on...@pe...'. */ #ifndef _LSTEDIT_H_ #define _LSTEDIT_H_ #include "core/mlib/konvert.h" #define LIST_COUNT 3 #define LIST1 1 #define LIST2 2 #define LIST3 3 typedef struct { TCHAR list[LIST_COUNT][MAX_FUNCNAME+1]; } tlistPrefs; void lstedit_init(Boolean showAns); void lstedit_load_lists(void); void lstedit_tbl_load(void); void lstedit_init_firstitem(int controlId, Complex *cplx); CError lstedit_append_item(int controlId, Complex *cplx); CError lstedit_insert_item(int controlId, Complex *cplx, int row); CError lstedit_get_item(int controlId, Complex *cplx, int row); CError lstedit_replace_item(int controlId, Complex *cplx, int row); int lstedit_item_length(int controlId, int row); int lstedit_list_length(int controlId); CError lstedit_delete_item(int controlId, int row); void lstedit_reselect(Int16 controlId); void lstedit_tbl_deselect(void); void lstedit_tbl_scroll(Int16 delta); CError lstedit_save_lists(void); void lstedit_destroy(void); //Boolean ListEditHandleEvent(EventPtr event); //void lstedit_popup_ans(void); #endif Index: ansops.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/ansops.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ansops.cpp 17 Oct 2009 13:46:30 -0000 1.2 --- ansops.cpp 2 Nov 2009 17:20:08 -0000 1.3 *************** *** 106,110 **** rpn_delete(ans); MemPtrFree(result); - return; - 1; //result_draw(); } --- 106,108 ---- Index: core_main.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** core_main.h 17 Oct 2009 13:46:30 -0000 1.2 --- core_main.h 2 Nov 2009 17:20:08 -0000 1.3 *************** *** 36,42 **** void core_keytimeout1() MAIN_SECT; void core_keytimeout2() MAIN_SECT; - void core_timeout3(int repaint) MAIN_SECT; - int core_alpha_menu() MAIN_SECT; - int core_hex_menu() MAIN_SECT; int core_keydown(int key, int *enqueued, int *repeat) MAIN_SECT; int core_keyup(Skin *skin, void *hWnd_p) MAIN_SECT; --- 36,39 ---- *************** *** 45,50 **** /* Other functions */ /*******************/ - void set_running(bool state) MAIN_SECT; - void continue_running() MAIN_SECT; #endif --- 42,45 ---- --- NEW FILE: lstedit.cpp --- /* * $Id: lstedit.cpp,v 1.1 2009/11/02 17:20:08 mapibid Exp $ * * Scientific Calculator for Palms. * Copyright (C) 1999,2000,2001 Ondrej Palkovsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * You can contact me at 'on...@pe...'. */ #include "stdafx.h" #include "compat/PalmOS.h" //#include <LstGlue.h> //#include <WinGlue.h> //#include "calcrsc.h" #include "lstedit.h" #include "konvert.h" #include "calc.h" #include "slist.h" #include "stack.h" #include "calcDB.h" #include "display.h" #include "varmgr.h" #include "defuns.h" #include "system - UI/StateManager.h" #include "system - UI/EasyCalc.h" #include "compat/Lang.h" #ifdef SUPPORT_DIA #include "DIA.h" #endif static Int16 firstLine; static Int16 maxLines = 1; static struct { Int16 col; Int16 row; Boolean offscreen; }tblSelection = {-1,-1,true}; static tlistPrefs *listPrefs; static List *loadedList[LIST_COUNT] = {NULL,NULL,NULL}; /*********************************************************************** * * FUNCTION: lstedit_tbl_contents * * DESCRIPTION: Draws a normal cell of table * * PARAMETERS: See PalmOS reference * * RETURN: Nothing * ***********************************************************************/ //static void //lstedit_tbl_contents(void *table,Int16 row,Int16 column, // RectangleType *bounds) PARSER; //static void //lstedit_tbl_contents(void *table,Int16 row,Int16 column, // RectangleType *bounds) //{ // Int16 real; // TCHAR *text; // FontID oldfont; // // real = firstLine + row; // if (loadedList[column-1] == NULL // || loadedList[column-1]->size <= real) // return; // // oldfont = FntSetFont(stdFont); // text = display_complex(loadedList[column-1]->item[real]); // WinGlueDrawTruncChars(text,StrLen(text), // bounds->topLeft.x+2,bounds->topLeft.y, // bounds->extent.x-2); // MemPtrFree(text); // FntSetFont(oldfont); //} /*********************************************************************** * * FUNCTION: lstedit_delete_lists * * DESCRIPTION: Free memory ocupied by loaded lists * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ static void lstedit_delete_lists (void) PARSER; static void lstedit_delete_lists(void) { Int16 i; for (i=0 ; i<LIST_COUNT ; i++) if (loadedList[i] != NULL) { list_delete(loadedList[i]); loadedList[i] = NULL; } } /*********************************************************************** * * FUNCTION: lstedit_save_lists * * DESCRIPTION: Saves loaded lists back to database. Should be called * after every modification * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_save_lists (void) PARSER; CError lstedit_save_lists (void) { Int16 i; Trpn item; CodeStack *stack; CError err = c_noerror; stack = stack_new(1); for (i=0 ; i<LIST_COUNT ; i++) if (StrLen(listPrefs->list[i])) { err = stack_add_val(stack, &loadedList[i], list); if (!err) { item = stack_pop(stack); err = db_write_variable(listPrefs->list[i], item); rpn_delete(item); } } stack_delete(stack); return err; } /*********************************************************************** * * FUNCTION: lstedit_upd_maxlines * * DESCRIPTION: Update the maxLines variable, containing the length * of longest loaded list * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ static void lstedit_upd_maxlines (void) PARSER; static void lstedit_upd_maxlines (void) { Int16 i; maxLines = 0; for (i=0 ; i<LIST_COUNT ; i++) if ((loadedList[i] != NULL) && (loadedList[i]->size > maxLines)) maxLines = loadedList[i]->size; } /*********************************************************************** * * FUNCTION: lstedit_load_lists * * DESCRIPTION: Reads list name from Preferences and loads them * into global loadedLists variable * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ void lstedit_load_lists (void) PARSER; void lstedit_load_lists (void) { Int16 i; Trpn item; CError err; lstedit_delete_lists(); for (i=0 ; i<LIST_COUNT ; i++) if (StrLen(listPrefs->list[i])) { item = db_read_variable(listPrefs->list[i], &err); if (!err && item.type == list) { loadedList[i] = list_dup(item.u.listval); } else StrCopy(listPrefs->list[i],_T("")); if (!err) rpn_delete(item); } LstEditSetLabel(1, listPrefs->list[0]); LstEditSetLabel(2, listPrefs->list[1]); LstEditSetLabel(3, listPrefs->list[2]); lstedit_upd_maxlines(); } /*********************************************************************** * * FUNCTION: lstedit_tbl_load * * DESCRIPTION: Load index values in the first column of ListEditor, * starting from 1, and load list contents on screen. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ void lstedit_tbl_load (void) PARSER; void lstedit_tbl_load (void) { TCHAR *text1, *text2, *text3; Int16 i; // First, clear contents LstEditSetRow(-1, 0, NULL, NULL, NULL); // Then fill table for (i=0 ; i<maxLines ; i++) { if ((loadedList[0] == NULL) || (loadedList[0]->size <= i)) text1 = NULL; else text1 = display_complex(loadedList[0]->item[i]); if ((loadedList[1] == NULL) || (loadedList[1]->size <= i)) text2 = NULL; else text2 = display_complex(loadedList[1]->item[i]); if ((loadedList[2] == NULL) || (loadedList[2]->size <= i)) text3 = NULL; else text3 = display_complex(loadedList[2]->item[i]); LstEditSetRow(i, i+1, text1, text2, text3); MemPtrFree(text1); MemPtrFree(text2); MemPtrFree(text3); } } /*********************************************************************** * * FUNCTION: lstedit_init * * DESCRIPTION: Constructor for List Editor * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ void lstedit_init (Boolean showAns) PARSER; void lstedit_init (Boolean showAns) { listPrefs = &(stateMgr->state.listPrefs); firstLine = 0; tblSelection.col = tblSelection.row = -1; if (showAns) { StrCopy(listPrefs->list[0], _T("ans")); } // Initialize column header drop downs lstedit_reselect(LIST1); lstedit_reselect(LIST2); lstedit_reselect(LIST3); // Load lists and set correct values in headers lstedit_load_lists(); } /*********************************************************************** * * FUNCTION: lstedit_tbl_scroll * * DESCRIPTION: Scroll the table specified number of rows * * PARAMETERS: tbl - pointer to table * delta - how many lines (+down, -up) to scroll * * RETURN: Nothing * ***********************************************************************/ void lstedit_tbl_scroll (Int16 delta) PARSER; void lstedit_tbl_scroll (Int16 delta) { firstLine +=delta; if (firstLine < 0) firstLine = 0; lstedit_tbl_load(); } /*********************************************************************** * * FUNCTION: lstedit_destroy * * DESCRIPTION: Destructor for List Editor * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ void lstedit_destroy (void) PARSER; void lstedit_destroy (void) { lstedit_delete_lists(); } /*********************************************************************** * * FUNCTION: lstedit_tbl_deselect * * DESCRIPTION: Deselect a variable, clear label that shows contents * of variable * * PARAMETERS: tbl - pointer to the table * * RETURN: Nothing * ***********************************************************************/ void lstedit_tbl_deselect (void) PARSER; void lstedit_tbl_deselect (void) { if (tblSelection.row != -1) { LstEditDeselect(); tblSelection.row = tblSelection.col = -1; } } /*********************************************************************** * * FUNCTION: lstedit_init_firstitem * * DESCRIPTION: (Mapi) Initialize a loaded list with an item. Was part of * lstedit_reselect() before, is now a call back from UI. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ void lstedit_init_firstitem (int controlId, Complex *cplx) PARSER; void lstedit_init_firstitem (int controlId, Complex *cplx) { int i = controlId - LIST1; if (loadedList[i]) MemPtrFree(loadedList[i]); loadedList[i] = list_new(1); loadedList[i]->item[0] = *cplx; tblSelection.offscreen = true; tblSelection.row = 0; tblSelection.col = i + 1; } /*********************************************************************** * * FUNCTION: lstedit_append_item * * DESCRIPTION: (Mapi) Add an item to a list. New. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_append_item (int controlId, Complex *cplx) PARSER; CError lstedit_append_item (int controlId, Complex *cplx) { int row = loadedList[controlId - LIST1]->size; // Insert at end. return (lstedit_insert_item(controlId, cplx, row)); } /*********************************************************************** * * FUNCTION: lstedit_insert_item * * DESCRIPTION: (Mapi) Add an item to a list at given place. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_insert_item (int controlId, Complex *cplx, int row) PARSER; CError lstedit_insert_item (int controlId, Complex *cplx, int row) { int l = controlId - LIST1; List *lst, *oldlst; CError err = c_noerror; int i; lst = list_new(loadedList[l]->size+1); if (!lst) { return (c_memory); } if (row > loadedList[l]->size) row = loadedList[l]->size; // Security .. for (i=0 ; i<row ; i++) lst->item[i] = loadedList[l]->item[i]; lst->item[row] = *cplx; for (i=row ; i<loadedList[l]->size ; i++) lst->item[i+1] = loadedList[l]->item[i]; oldlst = loadedList[l]; loadedList[l] = lst; err = lstedit_save_lists(); if (err) { loadedList[l] = oldlst; /* restore original one */ list_delete(lst); return (err); } else list_delete(oldlst); lstedit_upd_maxlines(); tblSelection.offscreen = true; return (err); } /*********************************************************************** * * FUNCTION: lstedit_get_item * * DESCRIPTION: (Mapi) Get item value from a list. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_get_item (int controlId, Complex *cplx, int row) PARSER; CError lstedit_get_item (int controlId, Complex *cplx, int row) { int l = controlId - LIST1; CError err = c_noerror; if (row > loadedList[l]->size) return (c_range); // Security .. *cplx = loadedList[l]->item[row]; return (err); } /*********************************************************************** * * FUNCTION: lstedit_replace_item * * DESCRIPTION: (Mapi) Replace an item value in a list. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_replace_item (int controlId, Complex *cplx, int row) PARSER; CError lstedit_replace_item (int controlId, Complex *cplx, int row) { int l = controlId - LIST1; CError err = c_noerror; if (row > loadedList[l]->size) return (c_range); // Security .. loadedList[l]->item[row] = *cplx; err = lstedit_save_lists(); tblSelection.offscreen = true; return (err); } /*********************************************************************** * * FUNCTION: lstedit_item_length * * DESCRIPTION: (Mapi) Retrieve display length of an item. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ int lstedit_item_length (int controlId, int row) PARSER; int lstedit_item_length (int controlId, int row) { TCHAR *text = display_complex(loadedList[controlId-LIST1]->item[row]); int len = _tcslen(text); MemPtrFree(text); return (len); } /*********************************************************************** * * FUNCTION: lstedit_list_length * * DESCRIPTION: (Mapi) Retrieve length of a list. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ int lstedit_list_length (int controlId) PARSER; int lstedit_list_length (int controlId) { return (loadedList[controlId-LIST1]->size); } /*********************************************************************** * * FUNCTION: lstedit_delete_item * * DESCRIPTION: (Mapi) Delete an item from a list at given place. * * PARAMETERS: Nothing * * RETURN: Nothing * ***********************************************************************/ CError lstedit_delete_item (int controlId, int row) PARSER; CError lstedit_delete_item (int controlId, int row) { int l = controlId - LIST1; if (loadedList[l]->size == 1) return (c_range); for (int i=row+1 ; i<loadedList[l]->size ; i++) loadedList[l]->item[i-1] = loadedList[l]->item[i]; --loadedList[l]->size; lstedit_save_lists(); /* should succeed since list gets smaller */ lstedit_upd_maxlines(); tblSelection.offscreen = true; return (c_noerror); } /*********************************************************************** * * FUNCTION: lstedit_reselect * * DESCRIPTION: Shows a popup dialog with existing list and 'New' and * 'Delete'. Creates new list, delete new list or just * selects a new list * * PARAMETERS: controlId - popuptrigger that was pressed * ***********************************************************************/ void lstedit_reselect (Int16 controlId) PARSER; void lstedit_reselect (Int16 controlId) { dbList *varlist; TCHAR **values; Int16 i; varlist = db_get_list(list); values = (TCHAR **) MemPtrNew(sizeof(*values) * (varlist->size)); for (i=0 ; i<varlist->size ; i++) values[i] = varlist->list[i]; LstEditSetListChoices(controlId, values, varlist->size); LstEditSetLabel(controlId, listPrefs->list[controlId-LIST1]); /* Set incremental search */ // No equivalent in Windows (in fact, this is done natively, but I don't know // how many chars .. (up to 5 in the Glue API). // LstGlueSetIncrementalSearch(slst, true); MemPtrFree(values); db_delete_list(varlist); } Index: varmgr.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/varmgr.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** varmgr.h 25 Oct 2009 17:52:15 -0000 1.3 --- varmgr.h 2 Nov 2009 17:20:08 -0000 1.4 *************** *** 36,40 **** TCHAR *varmgr_action(int selection); void varmgr_listVar(Skin *skin, void *hWnd); ! bool varmgr_listVar_action(TCHAR *text, void *hWnd_calc, bool saveasvar, bool fromList); void varmgr_popup_builtin(Skin *skin, void *hWnd); TCHAR *varmgr_builtinAction(int selection); --- 36,40 ---- TCHAR *varmgr_action(int selection); void varmgr_listVar(Skin *skin, void *hWnd); ! bool varmgr_listVar_action(TCHAR *text, void *hWnd_calc, bool saveasvar, bool fromList, bool valueAns); void varmgr_popup_builtin(Skin *skin, void *hWnd); TCHAR *varmgr_builtinAction(int selection); Index: varmgr.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/varmgr.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** varmgr.cpp 25 Oct 2009 17:52:15 -0000 1.3 --- varmgr.cpp 2 Nov 2009 17:20:08 -0000 1.4 *************** *** 208,213 **** * ***********************************************************************/ ! static bool varmgr_save_variable(TCHAR *varname, void *hWnd_p, bool fromList) IFACE; ! static bool varmgr_save_variable(TCHAR *varname, void *hWnd_p, bool fromList) { Trpn item; CError err; --- 208,215 ---- * ***********************************************************************/ ! static bool varmgr_save_variable(TCHAR *varname, void *hWnd_p, ! bool fromList, bool valueAns) IFACE; ! static bool varmgr_save_variable(TCHAR *varname, void *hWnd_p, ! bool fromList, bool valueAns) { Trpn item; CError err; *************** *** 224,234 **** return (false); ! item = db_read_variable(_T("ans"),&err); ! if (err) { ! FrmAlert(altAnsProblem, hWnd_p); ! return (false); } - db_write_variable(varname,item); - rpn_delete(item); return (true); --- 226,238 ---- return (false); ! if (valueAns) { ! item = db_read_variable(_T("ans"),&err); ! if (err) { ! FrmAlert(altAnsProblem, hWnd_p); ! return (false); ! } ! db_write_variable(varname,item); ! rpn_delete(item); } return (true); *************** *** 270,277 **** * ***********************************************************************/ ! bool varmgr_listVar_action(TCHAR *text, void *hWnd_calc, bool saveasvar, bool fromList) { db_delete_list(varlist); if (saveasvar) { ! return (varmgr_save_variable(text, hWnd_calc, fromList)); } return (true); --- 274,282 ---- * ***********************************************************************/ ! bool varmgr_listVar_action(TCHAR *text, void *hWnd_calc, bool saveasvar, ! bool fromList, bool valueAns) { db_delete_list(varlist); if (saveasvar) { ! return (varmgr_save_variable(text, hWnd_calc, fromList, valueAns)); } return (true); *************** *** 448,531 **** /*********************************************************************** * - * FUNCTION: varmgr_edit - * - * DESCRIPTION: Popup a variable edit dialog - * - * PARAMETERS: varname - name of the variable - * title - title of the new form - * type - function or variable - * callback - function, that should be called - * upon succesful save (usually update) - * editname - user can edit the variable name and can - * and can create a new variable/function - * - * RETURN: true - variable was changed - * false - user pressed cancel - * - ***********************************************************************/ - /*Boolean - varmgr_get_complex(Complex *value,TCHAR *title) - { - FormPtr frm; - Int16 button; - Boolean res; - TCHAR *text; - FieldPtr field; - CodeStack *stack; - CError err; - Complex result; - - frm = FrmInitForm(dinputForm); - #ifdef HANDERA_SDK - if (handera) - VgaFormModify(frm, vgaFormModify160To240); - #endif - FrmSetTitle(frm,title); - FrmSetFocus(frm,FrmGetObjectIndex(frm,dinputField)); - field = FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,dinputField)); - - text = display_complex(*value); - FldInsert(field,text,StrLen(text)); - FldSetSelection(field,0,StrLen(text)); - MemPtrFree(text); - - while (1) { - button = FrmDoDialog(frm); - if (button == dinputOK) { - text = FldGetTextPtr(field); - if (!text) - FrmAlert(altCompute); - else { - stack = text_to_stack(text,&err); - if (!err) { - err = stack_compute(stack); - if (!err) - err = stack_get_val(stack,&result, - complex); - stack_delete(stack); - } - if (err) - alertErrorMessage(err); - else { - res = true; - break; - } - } - } - else { - res = false; - break; - } - } - FrmDeleteForm(frm); - - if (res) - *value = result; - - return res; - }*/ - - /*********************************************************************** - * * FUNCTION: varmgr_get_double * --- 453,456 ---- *************** *** 596,650 **** return res; }*/ - - /*********************************************************************** - * - * FUNCTION: varmgr_get_varstring - * - * DESCRIPTION: Popup a small form asking user for entering a variable - * name and check it before returning - * - * PARAMETERS: title - title the form should have - * - * RETURN: true - user pressed OK and varname was valid - * false - user pressed Cancel - * varname - the result of expression user entered - * - ***********************************************************************/ - /*Boolean - varmgr_get_varstring(TCHAR *varname,TCHAR *title) - { - FormPtr frm; - Int16 button; - Boolean res; - TCHAR *text; - FieldPtr field; - - frm = FrmInitForm(dinputForm); - #ifdef HANDERA_SDK - if (handera) - VgaFormModify(frm, vgaFormModify160To240); - #endif - FrmSetTitle(frm,title); - FrmSetFocus(frm,FrmGetObjectIndex(frm,dinputField)); - field = FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,dinputField)); - while (1) { - button = FrmDoDialog(frm); - if (button == dinputOK) { - text = FldGetTextPtr(field); - if (!text || !varfunc_name_ok(text,variable)) - FrmAlert(altBadVariableName); - else { - StrCopy(varname,text); - res = true; - break; - } - } - else { - res = false; - break; - } - } - FrmDeleteForm(frm); - - return res; - }*/ --- 521,522 ---- Index: core_display.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_display.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** core_display.h 17 Oct 2009 13:46:30 -0000 1.2 --- core_display.h 2 Nov 2009 17:20:08 -0000 1.3 *************** *** 44,54 **** #ifndef _CORE_DISPLAY_C_ ! extern TCHAR *resMenuDesc[]; // Array of strings for the result actions menu. ! extern TCHAR *strErrCodes[]; // Error strings #endif void squeak(void); - void redisplay(void); - void set_menu(int level, int menuid); void result_copy(Skin *skin) IFACE; --- 44,54 ---- #ifndef _CORE_DISPLAY_C_ ! extern TCHAR *resMenuDesc[]; // Array of strings for the result actions menu. ! extern TCHAR *strErrCodes[]; // Error strings ! extern TresultPrefs resultPrefs; // Description of result in result screen ! #endif void squeak(void); void result_copy(Skin *skin) IFACE; Index: core_main.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** core_main.cpp 25 Oct 2009 17:52:14 -0000 1.3 --- core_main.cpp 2 Nov 2009 17:20:08 -0000 1.4 *************** *** 29,33 **** #include "core_main.h" #include "core/core_globals.h" - #include "core_tables.h" #include "core_display.h" #include "core/Main.h" --- 29,32 ---- *************** *** 64,68 **** -------------------------------------------------------------------------------*/ static void stop_interruptible() MAIN_SECT; - static int handle_error(int error) MAIN_SECT; --- 63,66 ---- *************** *** 158,214 **** /******************************************************************************** - * FUNCTION: core_timeout3() * - * A wakeup call that the core can request by calling shell_request_timeout3(). * - * Used to implement the brief linger period after MEM, SHOW, and shift- * - * VARMENU. The 'repaint' parameter says whether the callback is invoked * - * because the timeout period expired (1), or because a key event is on its * - * way (0); if a key event is on its way, the emulator core should not repaint * - * the screen, in order to avoid flashing. * - ********************************************************************************/ - void core_timeout3(int repaint) { - // Function not used by EasyCalc - // /* Remove the output of SHOW, MEM, or shift-VARMENU from the display */ - // if (pending_command == CMD_LINGER1) - // pending_command = CMD_CANCELLED; - // else if (pending_command == CMD_LINGER2) { - // flags.f.message = 0; - // flags.f.two_line_message = 0; - // pending_command = CMD_NONE; - // if (repaint) - // redisplay(); - // } - } - - /******************************************************************************** - * FUNCTION: core_alpha_menu() * - * The shell uses this function to check if the core is in "alpha" mode (i.e. * - * the ALPHA menu or any of its submenus is active). This affects how events * - * from the keyboard (the real PC keyboard, not the on-screen one emulated by * - * the calc) or PalmOS Graffiti device are handled: in alpha mode, printable * - * ASCII characters are sent straight to the core; outside alpha mode, all * - * key events are translated sequences of key events according to the keymap * - * file. * - ********************************************************************************/ - int core_alpha_menu() { - // int *menu = get_front_menu(); - // return ((menu != NULL) && (*menu >= MENU_ALPHA1) && (*menu <= MENU_ALPHA_MISC2)); - return (0); - } - - /******************************************************************************** - * FUNCTION: core_hex_menu() * - * The shell uses this function to check if the core is in "hex" mode (i.e. * - * the A..F submenu of the BASE application is active). This affects how events * - * from the keyboard (the real PC keyboard, not the on-screen one emulated by * - * the calc) are handled: in hex mode, 'A' through 'F' and 'a' through 'f' are * - * translated to keycodes 1 through 6, regardless of the keyboard map. * - ********************************************************************************/ - int core_hex_menu() { - // int *menu = get_front_menu(); - // return ((menu != NULL) && (*menu == MENU_BASE_A_THRU_F)); - return (0); - } - - /******************************************************************************** * FUNCTION: core_keydown() * * This function informs the emulator core that a key was pressed. Keys * --- 156,159 ---- *************** *** 250,380 **** #define keydown(a,b) (repeating_key = b) - /* if (mode_interruptible != NULL) { - */ /* We're in the middle of an interruptible function - * (e.g., INVRT, PRP); queue up any keystrokes and invoke - * the appropriate callback to keep the funtion moving along - */ - /* int error, keep_running; - if (key != 0) { *//* Enqueue... */ - /* *enqueued = 1; - if (key == KEY_EXIT || - (mode_stoppable && !mode_shift && (key == KEY_RUN))) { - keybuf_tail = keybuf_head; - stop_interruptible(); - return (0); - } else { - if (((keybuf_head + 1) & 15) != keybuf_tail) { - if (mode_shift) - key = -key; - keybuf[keybuf_head] = key; - keybuf_head = (keybuf_head + 1) & 15; - } - } - set_shift(false); - } - error = mode_interruptible(0); - if (error == ERR_INTERRUPTIBLE) *//* Still not done */ - /* return (1); - mode_interruptible = NULL; - keep_running = handle_error(error); - if (mode_running) { - if (!keep_running) - set_running(false); - } else { - shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); - pending_command = CMD_NONE; - } - if (mode_running || (keybuf_tail != keybuf_head)) - return (1); - else { - redisplay(); - return (0); - } - } - - if (mode_running && !mode_getkey) { - */ /* We're running; queue up any keystrokes and invoke - * continue_running() to keep the program moving along - */ - /* if (key != 0) { - if (key == KEY_EXIT) { - keybuf_tail = keybuf_head; - set_shift(false); - set_running(false); - pending_command = CMD_CANCELLED; - return (0); - } - */ /* Enqueue... */ - /* *enqueued = 1; - if (!mode_shift && (key == KEY_RUN)) { - keybuf_tail = keybuf_head; - set_running(false); - redisplay(); - return (0); - } - if (((keybuf_head + 1) & 15) != keybuf_tail) { - if (mode_shift) - key = -key; - keybuf[keybuf_head] = key; - keybuf_head = (keybuf_head + 1) & 15; - } - set_shift(false); - } - continue_running(); - if ((mode_running && !mode_getkey) || (keybuf_tail != keybuf_head)) - return (1); - else { - if (mode_getkey) - */ /* Technically, the program is still running, but we turn - * off the 'running' annunciator so that the user has some - * cue that they may now type. - */ - /* shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); - else - redisplay(); - return (0); - } - } - */ - - /* If we get here, mode_running must be false. - * or a program is running but hanging in GETKEY; - */ - /* if (keybuf_tail != keybuf_head) { - */ /* We're not running, or a program is waiting in GETKEY; - * feed queued-up keystroke to keydown() - */ - /* int oldshift = 0; - int oldkey = keybuf[keybuf_tail]; - if (oldkey < 0) { - oldkey = -oldkey; - oldshift = 1; - } - keybuf_tail = (keybuf_tail + 1) & 15; - */ /* If we're in GETKEY mode, the 'running' annunciator is off; - * see the code circa 30 lines back. - * We now turn it back on since program execution resumes. - */ - /* if (mode_getkey && mode_running) - shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, true); - */ /* Feed the dequeued key to the usual suspects */ - /* keydown(oldshift, oldkey); - core_keyup(); - */ /* We've just de-queued a key; may have to enqueue - * one as well, if the user is actually managing to - * type while we're unwinding the keyboard buffer - */ - /* if (key != 0) { - if (((keybuf_head + 1) & 15) != keybuf_tail) { - if (mode_shift) - key = -key; - keybuf[keybuf_head] = key; - keybuf_head = (keybuf_head + 1) & 15; - } - set_shift(false); - } - return (mode_running || (keybuf_head != keybuf_tail)); - } - */ /* No program is running, or it is running but waiting for a --- 195,198 ---- *************** *** 416,534 **** ********************************************************************************/ int core_keyup(Skin *skin, void *hWnd_p) { - /* int error = ERR_NONE; - - if ((pending_command == CMD_LINGER1) || (pending_command == CMD_LINGER2)) { - pending_command = CMD_LINGER2; - return (mode_running || (keybuf_head != keybuf_tail)); - } - - if (pending_command == CMD_SILENT_OFF) { - shell_powerdown(); - pending_command = CMD_NONE; - return (0); - } - - if (pending_command == CMD_NONE) - return (mode_running || (keybuf_head != keybuf_tail)); - */ - /* - if (remove_program_catalog) { - if (mode_transientmenu == MENU_CATALOG) - set_menu(MENULEVEL_TRANSIENT, MENU_NONE); - else if (mode_plainmenu == MENU_CATALOG) - set_menu(MENULEVEL_PLAIN, MENU_NONE); - remove_program_catalog = 0; - } - - if ((pending_command == CMD_CANCELLED) || (pending_command == CMD_NULL)) { - pending_command = CMD_NONE; - redisplay(); - return (mode_running || (keybuf_head != keybuf_tail)); - } - - mode_varmenu = (pending_command == CMD_VMSTO) - || (pending_command == CMD_VMSTO2) - || (pending_command == CMD_VMSOLVE) - || (pending_command == CMD_VMEXEC); - - if (input_length > 0) { - */ /* INPUT active */ - /* if ((pending_command == CMD_RUN) || (pending_command == CMD_SST)) { - int err = generic_sto(&input_arg, 0); - if ((flags.f.trace_print || flags.f.normal_print) - && flags.f.printer_exists) { - char lbuf[12], rbuf[100]; - int llen, rlen; - string_copy(lbuf, &llen, input_name, input_length); - lbuf[llen++] = '='; - rlen = vartype2string(reg_x, rbuf, 100); - print_wide(lbuf, llen, rbuf, rlen); - } - input_length = 0; - if (err != ERR_NONE) { - pending_command = CMD_NONE; - display_error(err, 1); - redisplay(); - return (mode_running || (keybuf_head != keybuf_tail)); - } - } else if ((pending_command == CMD_GTO) - || (pending_command == CMD_GTODOT) - || (pending_command == CMD_GTODOTDOT) - || (pending_command == CMD_RTN)) - */ /* NOTE: set_running(true) also ends INPUT mode, so commands that - * cause program execution to start do not have to be handled here. - */ - /* input_length = 0; - } - - if (pending_command == CMD_VMEXEC) { - string_copy(reg_alpha, ®_alpha_length, - pending_command_arg.val.text, pending_command_arg.length); - goto do_run; - } - if (pending_command == CMD_RUN) { - do_run: - if ((flags.f.trace_print || flags.f.normal_print) - && flags.f.printer_exists) - print_command(pending_command, &pending_command_arg); - pending_command = CMD_NONE; - if (pc == -1) - pc = 0; - set_running(true); - return (1); - } - - if (pending_command == CMD_SST) { - int cmd; - arg_struct arg; - oldpc = pc; - if (pc == -1) - pc = 0; - get_next_command(&pc, &cmd, &arg, 1); - if ((flags.f.trace_print || flags.f.normal_print) - && flags.f.printer_exists) - print_program_line(current_prgm, oldpc); - mode_disable_stack_lift = false; - set_running(true); - error = cmdlist(cmd)->handler(&arg); - set_running(false); - } else { - if ((flags.f.trace_print || flags.f.normal_print) - && flags.f.printer_exists) - print_command(pending_command, &pending_command_arg); - mode_disable_stack_lift = false; - error = cmdlist(pending_command)->handler(&pending_command_arg); - } - - if (error == ERR_INTERRUPTIBLE) { - shell_annunciators(-1, -1, -1, 1, -1, -1); - return (1); - } - - handle_error(error); - pending_command = CMD_NONE; - if (!mode_getkey) - redisplay(); - */ if (mode_shift && (repeating_key != KEY_SHIFT) && (repeating_key != KEY_BCKSPC)) { // Release shift when another key is pressed, --- 234,237 ---- *************** *** 555,712 **** return ((mode_running && !mode_getkey) || (keybuf_head != keybuf_tail)); } - - /******************************************************************************** - * FUNCTION: set_running * - * Go to running mode and display it. * - ********************************************************************************/ - void set_running(bool state) { - if (mode_running != state) { - mode_running = state; - shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, state); - } - if (state) { - /* Cancel any pending INPUT command */ - // input_length = 0; - // mode_goose = -2; - // prgm_highlight_row = 1; - } - } - - /******************************************************************************** - * FUNCTION: stop_interruptible() * - * Run programs. * - ********************************************************************************/ - void continue_running() { - /* int error; - while (!shell_wants_cpu()) { - int cmd; - arg_struct arg; - oldpc = pc; - if (pc == -1) - pc = 0; - else if (pc >= prgms[current_prgm].size) { - pc = -1; - set_running(false); - return; - } - get_next_command(&pc, &cmd, &arg, 1); - if (flags.f.trace_print && flags.f.printer_exists) - print_program_line(current_prgm, oldpc); - mode_disable_stack_lift = false; - error = cmdlist(cmd)->handler(&arg); - if (error == ERR_INTERRUPTIBLE) - return; - if (!handle_error(error)) - return; - if (mode_getkey) - return; - }*/ - } - - /******************************************************************************** - * FUNCTION: stop_interruptible() * - * Stops current running function. * - ********************************************************************************/ - static void stop_interruptible() { - int error = mode_interruptible(1); - handle_error(error); - mode_interruptible = NULL; - if (mode_running) - set_running(false); - else - shell_annunciators(ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, ANNVAL_UNCH, false); - pending_command = CMD_NONE; - redisplay(); - } - - /******************************************************************************** - * FUNCTION: handle_error() * - ********************************************************************************/ - static int handle_error(int error) { - /* if (mode_running) { - if (error == ERR_RUN) - error = ERR_NONE; - if (error == ERR_NONE || error == ERR_NO || error == ERR_YES - || error == ERR_STOP) - flags.f.stack_lift_disable = mode_disable_stack_lift; - if (error == ERR_NO) { - if (prgms[current_prgm].text[pc] != CMD_END) - pc += get_command_length(current_prgm, pc); - } else if (error == ERR_STOP) { - if (pc >= prgms[current_prgm].size) - pc = -1; - set_running(false); - return 0; - } else if (error != ERR_NONE && error != ERR_YES) { - if (flags.f.error_ignore) { - flags.f.error_ignore = 0; - return 1; - } - if (solve_active() && (error == ERR_OUT_OF_RANGE - || error == ERR_DIVIDE_BY_0 - || error == ERR_INVALID_DATA - || error == ERR_STAT_MATH_ERROR)) { - unwind_stack_until_solve(); - error = return_to_solve(1); - if (error == ERR_STOP) - set_running(false); - if (error == ERR_NONE || error == ERR_RUN || error == ERR_STOP) - return 0; - } - pc = oldpc; - display_error(error, 1); - set_running(false); - return 0; - } - return 1; - } else if (pending_command == CMD_SST) { - if (error == ERR_RUN) - error = ERR_NONE; - if (error == ERR_NONE || error == ERR_NO || error == ERR_YES - || error == ERR_STOP) - flags.f.stack_lift_disable = mode_disable_stack_lift; - if (error == ERR_NO) { - if (prgms[current_prgm].text[pc] != CMD_END) - pc += get_command_length(current_prgm, pc); - goto noerr; - } else if (error == ERR_NONE || error == ERR_YES || error == ERR_STOP) { - noerr: - error = ERR_NONE; - if (pc > prgms[current_prgm].size) - pc = -1; - } else { - if (flags.f.error_ignore) { - flags.f.error_ignore = 0; - goto noerr; - } - if (solve_active() && (error == ERR_OUT_OF_RANGE - || error == ERR_DIVIDE_BY_0 - || error == ERR_INVALID_DATA - || error == ERR_STAT_MATH_ERROR)) { - unwind_stack_until_solve(); - error = return_to_solve(1); - if (error == ERR_NONE || error == ERR_RUN || error == ERR_STOP) - goto noerr; - } - pc = oldpc; - display_error(error, 1); - } - return 0; - } else { - if (error == ERR_RUN) { - set_running(true); - error = ERR_NONE; - } - if (error == ERR_NONE || error == ERR_NO || error == ERR_YES - || error == ERR_STOP) - flags.f.stack_lift_disable = mode_disable_stack_lift; - else if (flags.f.error_ignore) { - flags.f.error_ignore = 0; - error = ERR_NONE; - } - if (error != ERR_NONE && error != ERR_STOP) - display_error(error, 1); - return 0; - }*/ - return (0); - } \ No newline at end of file --- 258,259 ---- Index: core_display.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/core/core_display.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** core_display.cpp 17 Oct 2009 13:46:30 -0000 1.2 --- core_display.cpp 2 Nov 2009 17:20:08 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- #include "stdafx.h" + #include "compat/PalmOS.h" #include "core/core_globals.h" *************** *** 96,100 **** - Module variables. - -------------------------------------------------------------------------------*/ ! static TresultPrefs resultPrefs; --- 97,101 ---- - Module variables. - -------------------------------------------------------------------------------*/ ! TresultPrefs resultPrefs; *************** *** 115,460 **** } - /******************************************************************************** - * FUNCTION: redisplay() * - ********************************************************************************/ - void redisplay() { - /* int menu_id; - int avail_rows = 2; - int i; - - if (mode_clall) { - clear_display(); - draw_string(0, 0, "Clear All Memory?", 17); - draw_key(0, 0, 0, "YES", 3); - draw_key(1, 0, 0, "", 0); - draw_key(2, 0, 0, "", 0); - draw_key(3, 0, 0, "", 0); - draw_key(4, 0, 0, "", 0); - draw_key(5, 0, 0, "NO", 2); - flush_display(); - return; - } - - if (flags.f.two_line_message) - return; - if (flags.f.message) - clear_row(1); - else - clear_display(); - - if (mode_commandmenu != MENU_NONE) - menu_id = mode_commandmenu; - else if (mode_alphamenu != MENU_NONE) - menu_id = mode_alphamenu; - else if (mode_transientmenu != MENU_NONE) - menu_id = mode_transientmenu; - else if (mode_plainmenu != MENU_NONE) - menu_id = mode_plainmenu; - else if (mode_appmenu != MENU_NONE) - menu_id = mode_appmenu; - else - menu_id = MENU_NONE; - if (menu_id == MENU_CATALOG) { - draw_catalog(); - avail_rows = 1; - } else if (menu_id == MENU_VARMENU) { - draw_varmenu(); - if (varmenu_length == 0) { - redisplay(); - return; - } - avail_rows = 1; - } else if (menu_id == MENU_CUSTOM1 || menu_id == MENU_CUSTOM2 - || menu_id == MENU_CUSTOM3) { - int r = menu_id - MENU_CUSTOM1; - if (flags.f.local_label - && !(mode_command_entry && incomplete_argtype == ARG_CKEY)) { - for (i = 0; i < 5; i++) { - char c = (r == 0 ? 'A' : 'F') + i; - draw_key(i, 0, 0, &c, 1); - } - draw_key(5, 0, 0, "XEQ", 3); - } else { - for (i = 0; i < 6; i++) { - draw_key(i, 0, 1, custommenu_label[r][i], - custommenu_length[r][i]); - } - } - avail_rows = 1; - } else if (menu_id == MENU_PROGRAMMABLE) { - for (i = 0; i < 6; i++) - draw_key(i, 0, 0, progmenu_label[i], progmenu_length[i]); - avail_rows = 1; - } else if (menu_id != MENU_NONE) { - const menu_spec *m = menus + menu_id; - for (i = 0; i < 6; i++) { - const menu_item_spec *mi = m->child + i; - if (mi->menuid == MENU_NONE || (mi->menuid & 0x3000) == 0) - draw_key(i, 0, 0, mi->title, mi->title_length); - else { - int cmd_id = mi->menuid & 0xfff; - const command_spec *cmd = cmdlist(cmd_id); - int is_flag = (mi->menuid & 0x2000) != 0; - if (is_flag) { - */ /* Take a closer look at the command ID and highlight - * the menu item if appropriate -- that is, clear 'is_flag' - * if highlighting is *not* appropriate - */ - /* switch (cmd_id) { - case CMD_FIX: - is_flag = flags.f.fix_or_all - && !flags.f.eng_or_all; - break; - case CMD_SCI: - is_flag = !flags.f.fix_or_all - && !flags.f.eng_or_all; - break; - case CMD_ENG: - is_flag = !flags.f.fix_or_all - && flags.f.eng_or_all; - break; - case CMD_ALL: - is_flag = flags.f.fix_or_all - && flags.f.eng_or_all; - break; - case CMD_RDXDOT: - is_flag = flags.f.decimal_point; - break; - case CMD_RDXCOMMA: - is_flag = !flags.f.decimal_point; - break; - case CMD_DEG: - is_flag = !flags.f.rad && !flags.f.grad; - break; - case CMD_RAD: - is_flag = flags.f.rad && !flags.f.grad; - break; - case CMD_GRAD: - is_flag = flags.f.grad; - break; - case CMD_POLAR: - is_flag = flags.f.polar; - break; - case CMD_RECT: - is_flag = !flags.f.polar; - break; - case CMD_QUIET: - is_flag = !flags.f.audio_enable; - break; - case CMD_CPXRES: - is_flag = !flags.f.real_result_only; - break; - case CMD_REALRES: - is_flag = flags.f.real_result_only; - break; - case CMD_KEYASN: - is_flag = !flags.f.local_label; - break; - case CMD_LCLBL: - is_flag = flags.f.local_label; - break; - case CMD_PON: - is_flag = flags.f.printer_exists; - break; - case CMD_POFF: - is_flag = !flags.f.printer_exists; - break; - case CMD_MAN: - is_flag = !flags.f.trace_print - && !flags.f.normal_print; - break; - case CMD_NORM: - is_flag = !flags.f.trace_print - && flags.f.normal_print; - break; - case CMD_TRACE: - is_flag = flags.f.trace_print; - break; - case CMD_ALLSIGMA: - is_flag = flags.f.all_sigma; - ... [truncated message content] |