From: Mapi B. <ma...@us...> - 2009-12-24 16:40:35
|
Update of /cvsroot/easycalc/PPCport/system - UI In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17761 Modified Files: EasyCalc.cpp EasyCalc.gif EasyCalc.h EasyCalc.layout EasyCalcppc.aps EasyCalcppc.rc resourceppc.h Skin.cpp Skin.h StateManager.cpp StateManager.h Log Message: 1.25f, full skin support Index: EasyCalc.layout =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.layout,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EasyCalc.layout 16 Nov 2009 22:18:41 -0000 1.9 --- EasyCalc.layout 24 Dec 2009 16:40:25 -0000 1.10 *************** *** 76,246 **** # 37 -> Tan,"tan" # 38 -> Exp,"exp" ! # 39 -> Fact,"fact" ! # 40 -> Pi,"pi" ! # 41 -> Degrees,"°" ! # 42 -> Minutes,"'" ! # 43 -> Magnitude,"abs" ! # 44 -> Angle,"angle" ! # 45 -> complex_i,"i" ! # 46 -> e,"e" ! # 47 -> Coln,":" ! # 48 -> ClBr,")" ! # 49 -> EE,"E" ! # 50 -> asin ! # 51 -> acos ! # 52 -> atan ! # 53 -> sinh ! # 54 -> cosh ! # 55 -> tanh ! # 56 -> asinh ! # 57 -> acosh ! # 58 -> atanh ! # 59 -> log ! # 60 -> 10^ ! # 61 -> log2 ! # 62 -> 2^ ! # 63 -> fact ! # 64 -> ncr ! # 65 -> npr ! # 66 -> round ! # 67 -> trunc ! # 68 -> ceil ! # 69 -> floor ! # 70 -> gamma ! # 71 -> beta ! # 72 -> rand ! # 73 -> rNorm ! # 74 -> real ! # 75 -> imag ! # 76 -> conj ! # 77 -> exp(i* ! # 78 -> fzero ! # 79 -> fvalue ! # 80 -> fmin ! # 81 -> fmax ! # 82 -> fd_dx // d/dx ! # 83 -> fromberg // integ ! # 84 -> fd2_dx // d2/dx ! # 85 -> ()=" ! # 86 -> " ! # 87 -> x ! # 88 -> list ! # 89 -> median ! # 90 -> mean ! # 91 -> sum ! # 92 -> lmin // min ! # 93 -> lmax // max ! # 94 -> prod ! # 95 -> variance ! # 96 -> stddev ! # 97 -> dim ! # 98 -> [ ! # 99 -> matrix ! # 100 -> identity ! # 101 -> det ! # 102 -> qrs ! # 103 -> rref ! # 104 -> qrq ! # 105 -> qrr ! # 106 -> [ // x[] ! # 107 -> ] ! # 108 -> qBinomial ! # 109 -> qBeta ! # 110 -> qChiSq ! # 111 -> qF ! # 112 -> qPoisson ! # 113 -> qStudentt ! # 114 -> qWeibull ! # 115 -> qNormal ! # 116 -> range ! # 117 -> rNorm ! # 118 -> find ! # 119 -> sample ! # 120 -> filter ! # 121 -> conv ! # 122 -> fft ! # 123 -> ifft ! # 124 -> prevprime ! # 125 -> isprime ! # 126 -> nextprime ! # 127 -> gcd ! # 128 -> lcm ! # 129 -> phi ! # 130 -> gcdex ! # 131 -> chinese ! # 132 -> modinv ! # 133 -> modpow ! # 134 -> factor ! # 135 -> besseli ! # 136 -> besselj ! # 137 -> besselk ! # 138 -> bessely ! # 139 -> ellc1 ! # 140 -> ellc2 ! # 141 -> elli1 ! # 142 -> elli2 ! # 143 -> euler ! # 144 -> cn ! # 145 -> dn ! # 146 -> sn ! # 147 -> igamma ! # 148 -> ibeta ! # 149 -> erf ! # 150 -> erfc ! # 151 -> = ! # 152 -> Inf // Infinity constant # # 1st row # shift sqr x_pow_y abs z_conj CLR # shift sqrt sqrt_yth real imag bckspc ! key: -5,-5 6,70,32,22 11,75,22,12 11,74 ! key: 34,33 45,70,32,22 50,75,22,12 50,74 ! key: 32,28 84,70,32,22 89,75,22,12 89,74 ! Key: 74,43 123,70,32,22 128,75,22,12 128,74 ! Key: 75,76 162,70,32,22 167,75,22,12 167,74 ! Key: -2,-1 201,70,32,22 206,75,22,12 206,74 # 2nd row # e^(ix) 2^x e^x 10^x [ ] # EE log2 ln log ( ) ! Key: 49,77 6,97,32,22 11,102,22,12 11,101 ! Key: 61,62 45,97,32,22 50,102,22,12 50,101 ! Key: 30,38 84,97,32,22 89,102,22,12 89,101 ! Key: 29,60 123,97,32,22 128,102,22,12 128,101 ! Key: 27,98 162,97,32,22 167,102,22,12 167,101 ! Key: 48,107 201,97,32,22 206,102,22,12 206,101 # 3rd row # D E F 1/x atan # 7 8 9 / tan ! Key: 7,13 6,127,40,29 11,132,30,19 11,131 ! Key: 8,14 53,127,40,29 58,132,30,19 58,131 ! Key: 9,15 101,127,40,29 106,132,30,19 106,131 Key: 25,31 148,127,40,29 153,132,30,19 153,131 ! Key: 37,52 201,124,32,22 206,129,22,12 206,128 # 3.5 row # asin # sin ! Key: 35,50 201,149,32,22 206,154,22,12 206,153 # 4th row # A B C ° acos # 4 5 6 * cos ! Key: 4,10 6,163,40,29 11,168,30,19 11,167 ! Key: 5,11 53,163,40,29 58,168,30,19 58,167 ! Key: 6,12 101,163,40,29 106,168,30,19 106,167 ! Key: 24,41 148,163,40,29 153,168,30,19 153,167 ! Key: 36,51 201,174,32,22 201,179,22,12 201,178 # 5th row # i e pi ' # 1 2 3 - ANS ! Key: 1,45 6,199,40,29 11,204,30,19 11,203 ! Key: 2,46 53,199,40,29 58,204,30,19 58,203 ! Key: 3,40 101,199,40,29 106,204,30,19 106,203 ! Key: 22,42 148,199,40,29 153,204,30,19 153,203 ! Key: 26 196,199,40,29 201,204,30,19 201,203 # 6th row ! # +Inf x : = # 0 -/+ . + EXE ! Key: 0,152 6,236,40,29 11,241,30,19 11,240 ! Key: 23,87 53,236,40,29 58,241,30,19 58,240 ! Key: -4,47 101,236,40,29 106,241,30,19 106,240 ! Key: 21 148,236,40,29 153,241,30,19 153,240 ! Key: -3,151 196,236,40,29 201,241,30,19 201,240 --- 76,280 ---- # 37 -> Tan,"tan" # 38 -> Exp,"exp" ! # 39 -> Pi,"pi" ! # 40 -> Degrees,"°" ! # 41 -> Minutes,"'" ! # 42 -> Magnitude,"abs" ! # 43 -> Angle,"angle" ! # 44 -> complex_i,"i" ! # 45 -> e,"e" ! # 46 -> Coln,":" ! # 47 -> ClBr,")" ! # 48 -> EE,"E" ! # 49 -> asin ! # 50 -> acos ! # 51 -> atan ! # 52 -> sinh ! # 53 -> cosh ! # 54 -> tanh ! # 55 -> asinh ! # 56 -> acosh ! # 57 -> atanh ! # 58 -> 10^ ! # 59 -> log2 ! # 60 -> 2^ ! # 61 -> fact ! # 62 -> ncr ! # 63 -> npr ! # 64 -> round ! # 65 -> trunc ! # 66 -> ceil ! # 67 -> floor ! # 68 -> gamma ! # 69 -> beta ! # 70 -> rand ! # 71 -> fsimps ! # 72 -> real ! # 73 -> imag ! # 74 -> conj ! # 75 -> exp(i* ! # 76 -> fzero ! # 77 -> fvalue ! # 78 -> fmin ! # 79 -> fmax ! # 80 -> fd_dx // d/dx ! # 81 -> fromberg // integ ! # 82 -> fd2_dx // d2/dx ! # 83 -> ()=" ! # 84 -> " ! # 85 -> x ! # 86 -> list ! # 87 -> median ! # 88 -> mean ! # 89 -> sum ! # 90 -> lmin // min ! # 91 -> lmax // max ! # 92 -> prod ! # 93 -> variance ! # 94 -> stddev ! # 95 -> dim ! # 96 -> [ ! # 97 -> matrix ! # 98 -> identity ! # 99 -> det ! # 100 -> qrs ! # 101 -> rref ! # 102 -> qrq ! # 103 -> qrr ! # 104 -> fintersect ! # 105 -> ] ! # 106 -> qBinomial ! # 107 -> qBeta ! # 108 -> qChiSq ! # 109 -> qF ! # 110 -> qPoisson ! # 111 -> qStudentt ! # 112 -> qWeibull ! # 113 -> qNormal ! # 114 -> range ! # 115 -> rNorm ! # 116 -> find ! # 117 -> sample ! # 118 -> filter ! # 119 -> conv ! # 120 -> fft ! # 121 -> ifft ! # 122 -> prevprime ! # 123 -> isprime ! # 124 -> nextprime ! # 125 -> gcd ! # 126 -> lcm ! # 127 -> phi ! # 128 -> gcdex ! # 129 -> chinese ! # 130 -> modinv ! # 131 -> modpow ! # 132 -> factor ! # 133 -> besseli ! # 134 -> besselj ! # 135 -> besselk ! # 136 -> bessely ! # 137 -> ellc1 ! # 138 -> ellc2 ! # 139 -> elli1 ! # 140 -> elli2 ! # 141 -> euler ! # 142 -> cn ! # 143 -> dn ! # 144 -> sn ! # 145 -> igamma ! # 146 -> ibeta ! # 147 -> erf ! # 148 -> erfc ! # 149 -> = ! # 150 -> Inf // Infinity constant ! # 151 -> % // modulo operator ! # 152 -> complex_j,"j" ! # 153 -> // Speed of light in vacuum (m s-1) c=299792458 ! # 154 -> // Newtonian constant of gravitation (m3 kg-1 s-2) G=6.67428E-11 ! # 155 -> // Standard gravitational acc. (N kg-1) g=9.80665 ! # 156 -> // Electron mass (kg) me=9.10938215E-31 ! # 157 -> // Proton mass (kg) mp=1.672621637E-27 ! # 158 -> // Neutron mass (kg) mn=1.67492729E-27 ! # 159 -> // Unified Atomic mass unit (kg) u=1.660538782E-27 ! # 160 -> // Planck constant (J s) h=6.62606896-34 ! # 161 -> // Boltzmann constant (J K-1) k=1.380 6504-23 ! # 162 -> // Magnetic permeability - vacuum (magnetic constant) (H m-1) µ0=1.2566370614E-6 ! # 163 -> // Dielectric permittivity (electric constant) (F m-1) e0=8.854187817E-12 ! # 164 -> // Fine structure constant alpha=7.2973525376E-3 ! # 165 -> // Rydberg constant (m-1) Rinf=10973731.568527 ! # 166 -> // Classical electron radius (m) re=2.8179402894E-15 ! # 167 -> // Bohr radius (m) a0=5.2917720859E-11 ! # 168 -> // Fluxoid quantum (magnetic flux quantum) (W b) phi0=2.067833667E-15 ! # 169 -> // Bohr magneton (J T-1) µb=9.27400915E-24 ! # 170 -> // Electron magnetic moment (J T-1) µe=-9.28476377E-24 ! # 171 -> // Nuclear magneton (J T-1) µN=5.05078324E-27 ! # 172 -> // Proton magnetic moment (J T-1) µp=1.410606662E-26 ! # 173 -> // Neutron magnetic moment (J T-1) µn=-9.6623641E-27 ! # 174 -> // Compton wavelength (electron) (m) lc=2.4263102175E-12 ! # 175 -> // Compton wavelength (proton) (m) lcp=1.3214098446E-15 ! # 176 -> // Stefan-Boltzmann constant (W m-2 K-4) sigma=5.670400E-8 ! # 177 -> // Avogadro's constant (mol-1) Na=6.02214179E+23 ! # 178 -> // Ideal gas volume at STP (m3 mol-1) Vm=2.2413996E-2 ! # 179 -> // Universal molar gas constant (J mol-1 K-1) R=8.314472 ! # 180 -> // Electron charge (elementary charge) (C) e=1.602176487E-19 ! # 181 -> // Faraday constant (C mol-1) F=96485.3399 ! # 182 -> // Quantum Hall resistance = von Klitzing constant (Ohm) Rk=25812.807 ! # 183 -> >= ! # 184 -> <= ! # 185 -> == ! # 186 -> ; # # 1st row # shift sqr x_pow_y abs z_conj CLR # shift sqrt sqrt_yth real imag bckspc ! key: -5,-5 6,70,32,22 11,75,22,12 11,74 ! key: 34,33 45,70,32,22 50,75,22,12 50,74 ! key: 32,28 84,70,32,22 89,75,22,12 89,74 ! Key: 72,42 123,70,32,22 128,75,22,12 128,74 ! Key: 73,74 162,70,32,22 167,75,22,12 167,74 ! Key: -2,-1 201,70,32,22 206,75,22,12 206,74 # 2nd row # e^(ix) 2^x e^x 10^x [ ] # EE log2 ln log ( ) ! Key: 48,75 6,97,32,22 11,102,22,12 11,101 ! Key: 59,60 45,97,32,22 50,102,22,12 50,101 ! Key: 30,38 84,97,32,22 89,102,22,12 89,101 ! Key: 29,58 123,97,32,22 128,102,22,12 128,101 ! Key: 27,96 162,97,32,22 167,102,22,12 167,101 ! Key: 47,105 201,97,32,22 206,102,22,12 206,101 # 3rd row # D E F 1/x atan # 7 8 9 / tan ! Key: 7,13 6,127,40,29 11,132,30,19 11,131 ! Key: 8,14 53,127,40,29 58,132,30,19 58,131 ! Key: 9,15 101,127,40,29 106,132,30,19 106,131 Key: 25,31 148,127,40,29 153,132,30,19 153,131 ! Key: 37,51 201,124,32,22 206,129,22,12 206,128 # 3.5 row # asin # sin ! Key: 35,49 201,149,32,22 206,154,22,12 206,153 # 4th row # A B C ° acos # 4 5 6 * cos ! Key: 4,10 6,163,40,29 11,168,30,19 11,167 ! Key: 5,11 53,163,40,29 58,168,30,19 58,167 ! Key: 6,12 101,163,40,29 106,168,30,19 106,167 ! Key: 24,40 148,163,40,29 153,168,30,19 153,167 ! Key: 36,50 201,174,32,22 201,179,22,12 201,178 # 5th row # i e pi ' # 1 2 3 - ANS ! Key: 1,44 6,199,40,29 11,204,30,19 11,203 ! Key: 2,45 53,199,40,29 58,204,30,19 58,203 ! Key: 3,39 101,199,40,29 106,204,30,19 106,203 ! Key: 22,41 148,199,40,29 153,204,30,19 153,203 ! Key: 26 196,199,40,29 201,204,30,19 201,203 # 6th row ! # +Inf x : " = # 0 -/+ . + EXE ! Key: 0,150 6,236,40,29 11,241,30,19 11,240 ! Key: 23,85 53,236,40,29 58,241,30,19 58,240 ! Key: -4,46 101,236,40,29 106,241,30,19 106,240 ! Key: 21,84 147,236,40,29 153,241,30,19 153,240 ! Key: -3,149 196,236,40,29 201,241,30,19 201,240 Index: EasyCalc.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EasyCalc.h 15 Dec 2009 21:39:18 -0000 1.8 --- EasyCalc.h 24 Dec 2009 16:40:25 -0000 1.9 *************** *** 106,110 **** // Version of the state file #define STATE_VERSION_ORIG 1 ! #define STATE_VERSION 3 /* Magic number and version number for the state file. --- 106,110 ---- // Version of the state file #define STATE_VERSION_ORIG 1 ! #define STATE_VERSION 4 /* Magic number and version number for the state file. *************** *** 152,155 **** --- 152,157 ---- extern LibLang *libLang; extern int g_systUserLangId; // Detected language of the system user + extern HWND g_hwndE; // Handle to the edit control input area. + extern void *g_cedit2_obj; // Input area subclassing object. extern StateManager *stateMgr; #endif *************** *** 167,170 **** --- 169,174 ---- void ErrFatalDisplayIf(int cond, TCHAR *msg); + void shell_clBracket(void); + void LstEditSetLabel(int listNb, TCHAR *label); void LstEditSetRow(int rowNb, int value, TCHAR *cell1, TCHAR *cell2, TCHAR *cell3); Index: EasyCalcppc.aps =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalcppc.aps,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvsK4Y0Cp and /tmp/cvsPn0JCx differ Index: EasyCalc.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EasyCalc.cpp 15 Dec 2009 21:39:18 -0000 1.9 --- EasyCalc.cpp 24 Dec 2009 16:40:25 -0000 1.10 *************** *** 68,72 **** #define MAX_LOADSTRING 100 ! #define EASYCALC_APPVERSION _T("1.25e") #define WM_APP_ENDVMENU (WM_APP+1) --- 68,72 ---- #define MAX_LOADSTRING 100 ! #define EASYCALC_APPVERSION _T("1.25f") [...1966 lines suppressed...] + if (text[j] == char1) + k++; + else if (text[j] == char2) + k--; + } + + if (k) + goto exit; + else { + cur_skin->select_input_text(NULL, j, j+1); + BrH=1; + BrH_timer = SetTimer(NULL, 0, 400, matchBracket_timeout); + } + } else if (BrH == 1) { + // Restore cursor position + cur_skin->select_input_text(NULL, start, start); + exit: + BrH=0; + } + } Index: Skin.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Skin.h 15 Dec 2009 21:39:18 -0000 1.10 --- Skin.h 24 Dec 2009 16:40:25 -0000 1.11 *************** *** 89,93 **** TOGRAD }resSelection; ! #define SELECTION_COUNT 11 #define RESULTAREA_SIZE 128 --- 89,93 ---- TOGRAD }resSelection; ! #define SELECTION_COUNT 13 #define RESULTAREA_SIZE 128 *************** *** 129,146 **** BITMAPINFOHEADER *skin_header; HBITMAP skin_dib; ! unsigned char *disp_bitmap; int disp_bytesperline; bool display_enabled; // Enable or disable screen repaints. - TCHAR dispResult[RESULTAREA_SIZE]; // Contains the result area string - TCHAR work_dispResult[RESULTAREA_SIZE]; // Working area for pow results - int result_len; // Length of the result area string - bool result_pow; // Signals that we are mixing small and big fonts (exponential display) - bool result_size_recompute; // Ask for recalculation of result_size - SIZE result_size; // Result "would-be" size on display without clipping - int scroll_result; // DT_LEFT if scrolled left (left align), DT_RIGHT if scrolled right (right align) TCHAR inputText[INPUTAREA_SIZE]; // Used to get the input area string int pow_pos; // Current position when writing power text. ! void *cedit2_obj; // Input area subclassing object. ! HWND hwndE; // The handle to the edit control input area. bool landscape; --- 129,141 ---- BITMAPINFOHEADER *skin_header; HBITMAP skin_dib; ! unsigned char *disp_bitmap; // Source bitmap to clear display parts ! HBITMAP result_hbitmap; // Handle to bitmap for clearing result int disp_bytesperline; bool display_enabled; // Enable or disable screen repaints. TCHAR inputText[INPUTAREA_SIZE]; // Used to get the input area string int pow_pos; // Current position when writing power text. ! bool result_size_recompute; // Ask for recalculation of result_size ! SIZE result_size; // Result "would-be" size on display without clipping ! TCHAR work_dispResult[RESULTAREA_SIZE]; // Working area for pow results bool landscape; *************** *** 212,214 **** --- 207,211 ---- }; + void skin_init(void); + #endif \ No newline at end of file Index: StateManager.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StateManager.cpp 15 Dec 2009 21:39:18 -0000 1.6 --- StateManager.cpp 24 Dec 2009 16:40:25 -0000 1.7 *************** *** 10,16 **** // Set interface and calculator options to their defaults stateFile = NULL; ! state.skinName[0][0] = 0; ! state.skinName[1][0] = 0; ! state.skinName[2][0] = 0; state.cur_skin_nb = 0; _tcscpy(state.langName, _T("en")); // Language = english by default --- 10,16 ---- // Set interface and calculator options to their defaults stateFile = NULL; ! _tcscpy(state.skinName[0], _T("EasyCalc")); ! _tcscpy(state.skinName[1], _T("EasyCalc2")); ! _tcscpy(state.skinName[2], _T("EasyCalc3")); state.cur_skin_nb = 0; _tcscpy(state.langName, _T("en")); // Language = english by default *************** *** 25,28 **** --- 25,34 ---- StateManager::~StateManager (void) { + if (stateMgrDB != NULL) + delete stateMgrDB; + if (stateMgrHistDB != NULL) + delete stateMgrHistDB; + if (stateMgrSolvDB != NULL) + delete stateMgrSolvDB; } *************** *** 125,128 **** --- 131,138 ---- state.matrixName[0] = _T('\0'); // Fall through migration steps ... + case 1: + case 2: // Versions 2,3 to 4 + _tcscpy(state.skinName[1], _T("EasyCalc2")); + _tcscpy(state.skinName[2], _T("EasyCalc3")); } Index: EasyCalcppc.rc =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalcppc.rc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EasyCalcppc.rc 15 Dec 2009 21:39:18 -0000 1.8 --- EasyCalcppc.rc 24 Dec 2009 16:40:25 -0000 1.9 *************** *** 30,38 **** // ! IDD_RES_MENU DIALOG 65, 10, 82, 100 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_RESM,0,0,82,100,NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP END --- 30,38 ---- // ! IDD_RES_MENU DIALOG 65, 10, 82, 112 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_RESM,0,0,82,112,NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP END *************** *** 102,110 **** END ! IDD_LARGE_MENU DIALOG 30, 10, 102, 117 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_LARGE,0,0,102,117,LBS_DISABLENOSCROLL | NOT WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP END --- 102,110 ---- END ! IDD_LARGE_MENU DIALOG 30, 10, 102, 112 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_LARGE,0,0,102,112,LBS_DISABLENOSCROLL | NOT WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP END *************** *** 126,138 **** BEGIN LTEXT "Skins",IDC_TITLE,4,3,63,8 ! COMBOBOX IDC_COMBO_SKIN1,9,32,48,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! COMBOBOX IDC_COMBO_SKIN2,9,51,48,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! COMBOBOX IDC_COMBO_SKIN3,9,70,48,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! LTEXT "Skin 1",IDC_SKIN1,62,34,39,10 ! LTEXT "Skin 2",IDC_SKIN2,62,53,39,10 ! LTEXT "Skin 3",IDC_SKIN3,62,72,39,10 ! COMBOBOX IDC_SKINVAL,72,87,21,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! LTEXT "Default skin",IDC_SKIN,10,90,58,8 ! CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE,121,85,14,14 END --- 126,138 ---- BEGIN LTEXT "Skins",IDC_TITLE,4,3,63,8 ! COMBOBOX IDC_COMBO_SKIN1,9,18,70,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! COMBOBOX IDC_COMBO_SKIN2,9,37,70,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! COMBOBOX IDC_COMBO_SKIN3,9,56,70,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! LTEXT "Skin 1",IDC_SKIN1,84,20,39,10 ! LTEXT "Skin 2",IDC_SKIN2,84,39,39,10 ! LTEXT "Skin 3",IDC_SKIN3,84,58,39,10 ! COMBOBOX IDC_SKINVAL,72,73,21,40,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP ! LTEXT "Current skin",IDC_SKIN,10,76,58,8 ! CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE,121,71,14,14 END *************** *** 166,174 **** END ! IDD_SLIM_MENU DIALOG 40, 10, 72, 117 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_SLIM,0,0,72,117,LBS_DISABLENOSCROLL | NOT WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP END --- 166,174 ---- END ! IDD_SLIM_MENU DIALOG 40, 10, 72, 112 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN ! LISTBOX IDC_LIST_SLIM,0,0,72,112,LBS_DISABLENOSCROLL | NOT WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP END *************** *** 340,343 **** --- 340,348 ---- GUIDELINES DESIGNINFO BEGIN + IDD_RES_MENU, DIALOG + BEGIN + BOTTOMMARGIN, 100 + END + IDD_SOLVER_CONFIG, DIALOG BEGIN *************** *** 371,375 **** IDD_LARGE_MENU, DIALOG BEGIN ! BOTTOMMARGIN, 116 END --- 376,380 ---- IDD_LARGE_MENU, DIALOG BEGIN ! BOTTOMMARGIN, 121 END *************** *** 392,395 **** --- 397,405 ---- END + IDD_SLIM_MENU, DIALOG + BEGIN + BOTTOMMARGIN, 117 + END + IDD_ABOUTBOX, DIALOG BEGIN *************** *** 522,525 **** --- 532,536 ---- BEGIN MENUITEM "About...", IDM_HELP_ABOUT + MENUITEM "Help", IDM_HELP_HELP END END Index: StateManager.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StateManager.h 16 Nov 2009 22:18:41 -0000 1.6 --- StateManager.h 24 Dec 2009 16:40:25 -0000 1.7 *************** *** 11,16 **** #define FILENAMELEN 256 typedef struct { ! TCHAR skinName[3][FILENAMELEN]; TCHAR langName[FILENAMELEN]; int cur_skin_nb; --- 11,19 ---- #define FILENAMELEN 256 + // Number of skins that one can load and access + #define NB_SKINS 3 + typedef struct { ! TCHAR skinName[NB_SKINS][FILENAMELEN]; TCHAR langName[FILENAMELEN]; int cur_skin_nb; Index: EasyCalc.gif =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.gif,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvs9Kgkrv and /tmp/cvszX9RxD differ Index: resourceppc.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/resourceppc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** resourceppc.h 15 Dec 2009 21:39:18 -0000 1.8 --- resourceppc.h 24 Dec 2009 16:40:25 -0000 1.9 *************** *** 140,143 **** --- 140,145 ---- #define ID_Menu 32804 #define IDM_EDIT_DATAMANAGER 32805 + #define ID_HELP_HELP 32806 + #define IDM_HELP_HELP 32807 #define IDM_OK 40000 #define IDM_HELP 40001 *************** *** 154,158 **** #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 152 ! #define _APS_NEXT_COMMAND_VALUE 32806 #define _APS_NEXT_CONTROL_VALUE 1145 #define _APS_NEXT_SYMED_VALUE 112 --- 156,160 ---- #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 152 ! #define _APS_NEXT_COMMAND_VALUE 32808 #define _APS_NEXT_CONTROL_VALUE 1145 #define _APS_NEXT_SYMED_VALUE 112 Index: Skin.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Skin.cpp 15 Dec 2009 21:39:18 -0000 1.10 --- Skin.cpp 24 Dec 2009 16:40:25 -0000 1.11 *************** *** 52,55 **** --- 52,70 ---- static unsigned char *skin_bitmap_data[1]; + static TCHAR g_dispResult[RESULTAREA_SIZE]; // Contains the result area string + static int g_result_len; // Length of the result area string + static bool g_result_pow; // Signals that we are mixing small and big fonts (exponential display) + static int g_scroll_result; // DT_LEFT if scrolled left (left align), DT_RIGHT if scrolled right (right align) + + /*------------------------------------------------------------------------------- + - Initialisation of globals. - + -------------------------------------------------------------------------------*/ + void skin_init (void) { + *g_dispResult = 0; // Empty string + g_result_len = 0; + g_result_pow = false; + g_scroll_result = DT_RIGHT; + } + /*------------------------------------------------------------------------------- - Constructor and destructor. - *************** *** 65,77 **** skin_dib = NULL; disp_bitmap = NULL; keymap = NULL; keymap_length = 0; - *dispResult = 0; // Empty string - result_len = 0; result_size_recompute = true; - result_pow = false; - scroll_result = DT_RIGHT; - cedit2_obj = NULL; - hwndE = NULL; hFontBig_display = hFontSmall_display = hFont_input = NULL; display_enabled = true; --- 80,87 ---- skin_dib = NULL; disp_bitmap = NULL; + result_hbitmap = NULL; keymap = NULL; keymap_length = 0; result_size_recompute = true; hFontBig_display = hFontSmall_display = hFont_input = NULL; display_enabled = true; *************** *** 79,86 **** Skin::~Skin() { ! if (cedit2_obj != NULL) { ! unsubclassEdit(hwndE, cedit2_obj); ! cedit2_obj = NULL; } } --- 89,122 ---- Skin::~Skin() { ! if (keylist != NULL) { ! mfree(keylist); ! keylist = NULL; ! } ! if (skin_header != NULL) { ! mfree(skin_header); ! skin_header = NULL; ! } ! if (disp_bitmap != NULL) { ! mfree(disp_bitmap); ! disp_bitmap = NULL; ! } ! if (skin_dib != NULL) { ! DeleteObject(skin_dib); ! skin_dib = NULL; ! } ! if (skin_bitmap != NULL) { ! mfree(skin_bitmap); ! skin_bitmap = NULL; } + if (result_hbitmap != NULL) { + DeleteObject(result_hbitmap); + result_hbitmap = NULL; + } + if (hFontBig_display != NULL) + DeleteObject(hFontBig_display); + if (hFontSmall_display != NULL) + DeleteObject(hFontSmall_display); + if (hFont_input != NULL) + DeleteObject(hFont_input); } *************** *** 286,296 **** bool prev_landscape = landscape; - // If no skin specified, load the default one. - if (skinname[0] == 0) { - // fallback_on_1st_builtin_skin: - // _tcscpy(skinname, skin_name[0]);_T("%s\\%s.%s") - _tcscpy(skinname, _T("EasyCalc")); - } - /*************************/ /* Load skin description */ --- 322,325 ---- *************** *** 560,565 **** /* (Re)build the display bitmap */ /********************************/ ! if (disp_bitmap != NULL) mfree(disp_bitmap); int lcd_w, lcd_h; --- 589,600 ---- /* (Re)build the display bitmap */ /********************************/ ! if (disp_bitmap != NULL) { mfree(disp_bitmap); + disp_bitmap = NULL; + } + if (result_hbitmap != NULL) { + DeleteObject(result_hbitmap); + result_hbitmap = NULL; + } int lcd_w, lcd_h; *************** *** 579,582 **** --- 614,619 ---- // TODO - handle memory allocation failure memset(disp_bitmap, 255, size); + // Prepare bitmap to clear result area + result_hbitmap = CreateBitmap(display_w, 18 * magnification, 1, 1, disp_bitmap); return (0); *************** *** 628,632 **** skin_height = height; skin_y = 0; ! return skin_bitmap != NULL; } --- 665,669 ---- skin_height = height; skin_y = 0; ! return (skin_bitmap != NULL); } *************** *** 740,744 **** if (skin_type == IMGTYPE_MONO) { skin_dib = CreateBitmap(skin_width, skin_height, 1, 1, skin_bitmap); ! skin_header = NULL; return; } --- 777,782 ---- if (skin_type == IMGTYPE_MONO) { skin_dib = CreateBitmap(skin_width, skin_height, 1, 1, skin_bitmap); ! mfree(skin_bitmap); ! skin_bitmap = NULL; return; } *************** *** 863,867 **** // Not found, search within the keys *skey = -1; ! *ckey = 0; for (i=0 ; i<nkeys ; i++) { SkinKey *k = keylist + i; --- 901,905 ---- // Not found, search within the keys *skey = -1; ! *ckey = KEY_NONE; for (i=0 ; i<nkeys ; i++) { SkinKey *k = keylist + i; *************** *** 1116,1127 **** return; ! HBITMAP bitmap = CreateBitmap(display_w, display_h, 1, 1, disp_bitmap); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); ! BitBlt(hdc, display_loc.x, display_loc.y, display_w, display_h, memdc, 0, 0, SRCCOPY); ! DeleteObject(bitmap); ! if (*dispResult != 0) ! if (result_pow) paint_resultpow(hdc); else --- 1154,1163 ---- return; ! HGDIOBJ oldObject = SelectObject(memdc, result_hbitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); ! BitBlt(hdc, display_loc.x, display_loc.y, display_w, 18 * magnification, memdc, 0, 0, SRCCOPY); ! if (*g_dispResult != 0) ! if (g_result_pow) paint_resultpow(hdc); else *************** *** 1149,1166 **** void Skin::create_input_area (HWND hWnd_p, HINSTANCE hinst) { DWORD dwStyle = WS_VISIBLE | WS_CHILD | ES_MULTILINE | ES_AUTOVSCROLL | ES_LEFT; ! if (hwndE != NULL) { ! BOOL res = MoveWindow(hwndE, display_loc.x, display_loc.y + 18 * magnification, display_w, 30 * magnification, TRUE); } else { ! // hwndE = CreateWindow(_T("EDIT2"), NULL, dwStyle, ! hwndE = CreateWindow(_T("EDIT"), NULL, dwStyle, ! display_loc.x, display_loc.y + 18 * magnification, ! display_w, 30 * magnification, ! hWnd_p, NULL, hinst, NULL); ! cedit2_obj = subclassEdit(hWnd_p, hwndE); } ! Edit_SetExtendedStyle(hwndE, 0xFFFFFFFF, Edit_GetExtendedStyle(hwndE) | ES_EX_FOCUSBORDERDISABLED); if (hFont_input == NULL) { --- 1185,1202 ---- void Skin::create_input_area (HWND hWnd_p, HINSTANCE hinst) { DWORD dwStyle = WS_VISIBLE | WS_CHILD | ES_MULTILINE | ES_AUTOVSCROLL | ES_LEFT; ! if (g_hwndE != NULL) { ! BOOL res = MoveWindow(g_hwndE, display_loc.x, display_loc.y + 18 * magnification, display_w, 30 * magnification, TRUE); } else { ! // g_hwndE = CreateWindow(_T("EDIT2"), NULL, dwStyle, ! g_hwndE = CreateWindow(_T("EDIT"), NULL, dwStyle, ! display_loc.x, display_loc.y + 18 * magnification, ! display_w, 30 * magnification, ! hWnd_p, NULL, hinst, NULL); ! g_cedit2_obj = subclassEdit(hWnd_p, g_hwndE); } ! Edit_SetExtendedStyle(g_hwndE, 0xFFFFFFFF, Edit_GetExtendedStyle(g_hwndE) | ES_EX_FOCUSBORDERDISABLED); if (hFont_input == NULL) { *************** *** 1173,1184 **** hFont_input = CreateFontIndirect(&lf); } ! long res = SendMessage (hwndE, WM_SETFONT, (WPARAM) hFont_input, (LPARAM) TRUE); // No softline break character when getting the text. ! res = SendMessage (hwndE, EM_FMTLINES, FALSE, 0); //TCHAR buf[100]; ! //int nchar = GetClassName(hwndE, buf, 100); //print_result(hWnd_p, buf); ! SetFocus(hwndE); } --- 1209,1220 ---- hFont_input = CreateFontIndirect(&lf); } ! long res = SendMessage (g_hwndE, WM_SETFONT, (WPARAM) hFont_input, (LPARAM) TRUE); // No softline break character when getting the text. ! res = SendMessage (g_hwndE, EM_FMTLINES, FALSE, 0); //TCHAR buf[100]; ! //int nchar = GetClassName(g_hwndE, buf, 100); //print_result(hWnd_p, buf); ! SetFocus(g_hwndE); } *************** *** 1192,1196 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, action, (WPARAM) 0, (LPARAM) -1); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); --- 1228,1232 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, action, (WPARAM) 0, (LPARAM) -1); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); *************** *** 1204,1208 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) 0, (LPARAM) -1); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); --- 1240,1244 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) 0, (LPARAM) -1); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); *************** *** 1216,1220 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) start, (LPARAM) end); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); --- 1252,1256 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) start, (LPARAM) end); res = SendMessage (hwnd_edit, EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0); *************** *** 1229,1233 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, EM_GETSEL, (WPARAM) start, (LPARAM) end); } --- 1265,1269 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, EM_GETSEL, (WPARAM) start, (LPARAM) end); } *************** *** 1240,1244 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; unsigned long pos; --- 1276,1280 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; unsigned long pos; *************** *** 1254,1258 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) pos, (LPARAM) pos); --- 1290,1294 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, EM_SETSEL, (WPARAM) pos, (LPARAM) pos); *************** *** 1267,1271 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; unsigned long start, end; --- 1303,1307 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; unsigned long start, end; *************** *** 1287,1291 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; long res = SendMessage (hwnd_edit, EM_REPLACESEL, (WPARAM) TRUE, (LPARAM) text); } --- 1323,1327 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; long res = SendMessage (hwnd_edit, EM_REPLACESEL, (WPARAM) TRUE, (LPARAM) text); } *************** *** 1298,1302 **** HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = hwndE; BOOL res = SetWindowText(hwnd_edit, text); } --- 1334,1338 ---- HWND hwnd_edit = (HWND) hwnd; if (hwnd_edit == NULL) ! hwnd_edit = g_hwndE; BOOL res = SetWindowText(hwnd_edit, text); } *************** *** 1306,1310 **** ********************************************************************************/ TCHAR *Skin::get_input_text() { ! int res = GetWindowText(hwndE, inputText, INPUTAREA_SIZE); return (inputText); } --- 1342,1346 ---- ********************************************************************************/ TCHAR *Skin::get_input_text() { ! int res = GetWindowText(g_hwndE, inputText, INPUTAREA_SIZE); return (inputText); } *************** *** 1316,1326 **** // Save the text and call the main method //_tcscpy(dispResult, res_text); ! result_len = _tcslen(res_text); ! if (result_len >= RESULTAREA_SIZE) { ! result_len = RESULTAREA_SIZE - 1; } ! _tcsncpy(dispResult, res_text, result_len); ! dispResult[result_len] = _T('\0'); ! result_pow = false; // Just a mono font result HDC hdc = GetDC((HWND) hWnd_p); --- 1352,1362 ---- // Save the text and call the main method //_tcscpy(dispResult, res_text); ! g_result_len = _tcslen(res_text); ! if (g_result_len >= RESULTAREA_SIZE) { ! g_result_len = RESULTAREA_SIZE - 1; } ! _tcsncpy(g_dispResult, res_text, g_result_len); ! g_dispResult[g_result_len] = _T('\0'); ! g_result_pow = false; // Just a mono font result HDC hdc = GetDC((HWND) hWnd_p); *************** *** 1333,1339 **** ********************************************************************************/ void Skin::print_result (HDC hdc) { - HBITMAP bitmap = CreateBitmap(display_w, 18 * magnification, 1, 1, disp_bitmap); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); --- 1369,1374 ---- ********************************************************************************/ void Skin::print_result (HDC hdc) { HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, result_hbitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); *************** *** 1341,1348 **** SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); - DeleteObject(bitmap); result_size_recompute = true; // Recalculate result_size in paint_result() ! scroll_result = DT_RIGHT; paint_result(hdc); } --- 1376,1382 ---- SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); result_size_recompute = true; // Recalculate result_size in paint_result() ! g_scroll_result = DT_RIGHT; paint_result(hdc); } *************** *** 1370,1381 **** if (result_size_recompute) { ! GetTextExtentPoint32(hdc, dispResult, result_len, &result_size); result_size_recompute = false; } // Display text - scroll result is either DT_LEFT or DT_RIGHT ! DrawText(hdc, dispResult, -1, &rc, scroll_result | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); ! if (result_len > 0) { // Handle scroll annunciators when necessary if (result_size.cx > display_w) { ! if (scroll_result == DT_RIGHT) { // Light the scroll left annunciator shell_scroll_annunciators(ANNVAL_SCR_LEFT); } else { // Light the scroll right annunciator --- 1404,1416 ---- if (result_size_recompute) { ! GetTextExtentPoint32(hdc, g_dispResult, g_result_len, &result_size); result_size_recompute = false; } // Display text - scroll result is either DT_LEFT or DT_RIGHT ! DrawText(hdc, g_dispResult, -1, &rc, ! g_scroll_result | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); ! if (g_result_len > 0) { // Handle scroll annunciators when necessary if (result_size.cx > display_w) { ! if (g_scroll_result == DT_RIGHT) { // Light the scroll left annunciator shell_scroll_annunciators(ANNVAL_SCR_LEFT); } else { // Light the scroll right annunciator *************** *** 1403,1419 **** // Save the text and call the appropriate method //_tcscpy(dispResult, res_text); ! result_len = _tcslen(res_text); ! if (result_len >= RESULTAREA_SIZE) { ! result_len = RESULTAREA_SIZE - 1; } ! _tcsncpy(dispResult, res_text, result_len); ! dispResult[result_len] = _T('\0'); HDC hdc = GetDC((HWND) hWnd_p); if (_tcschr(res_text, _T('^')) == NULL) { ! result_pow = false; // Just a mono font result print_result(hdc); } else { ! result_pow = true; // Special routine to mix fonts print_resultpow(hdc); } --- 1438,1454 ---- // Save the text and call the appropriate method //_tcscpy(dispResult, res_text); ! g_result_len = _tcslen(res_text); ! if (g_result_len >= RESULTAREA_SIZE) { ! g_result_len = RESULTAREA_SIZE - 1; } ! _tcsncpy(g_dispResult, res_text, g_result_len); ! g_dispResult[g_result_len] = _T('\0'); HDC hdc = GetDC((HWND) hWnd_p); if (_tcschr(res_text, _T('^')) == NULL) { ! g_result_pow = false; // Just a mono font result print_result(hdc); } else { ! g_result_pow = true; // Special routine to mix fonts print_resultpow(hdc); } *************** *** 1425,1431 **** ********************************************************************************/ void Skin::print_resultpow (HDC hdc) { - HBITMAP bitmap = CreateBitmap(display_w, 18 * magnification, 1, 1, disp_bitmap); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); --- 1460,1465 ---- ********************************************************************************/ void Skin::print_resultpow (HDC hdc) { HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, result_hbitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); *************** *** 1433,1440 **** SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); - DeleteObject(bitmap); result_size_recompute = true; // Recalculate result_size in paint_resultpow() ! scroll_result = DT_RIGHT; paint_resultpow(hdc); } --- 1467,1473 ---- SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); result_size_recompute = true; // Recalculate result_size in paint_resultpow() ! g_scroll_result = DT_RIGHT; paint_resultpow(hdc); } *************** *** 1466,1470 **** // result_size.cx will get computed by the method, but // result_size.cy will be correct at least. ! GetTextExtentPoint32(hdc, dispResult, result_len, &result_size); result_size.cx = 0; --- 1499,1503 ---- // result_size.cx will get computed by the method, but // result_size.cy will be correct at least. ! GetTextExtentPoint32(hdc, g_dispResult, g_result_len, &result_size); result_size.cx = 0; *************** *** 1472,1483 **** } pow_pos = 0; ! _tcscpy(work_dispResult, dispResult); // Use a work area, since text will be altered paint_resultpow_rec(hdc, false, work_dispResult); // Start with normal text. if (result_size_recompute) // Was left at -1 to provoke recomputation of result_size.cx result_size_recompute = false; ! if (result_len > 0) { // Handle scroll annunciators when necessary if (result_size.cx > display_w) { ! if (scroll_result == DT_RIGHT) { // Light the scroll left annunciator shell_scroll_annunciators(ANNVAL_SCR_LEFT); } else { // Light the scroll right annunciator --- 1505,1516 ---- } pow_pos = 0; ! _tcscpy(work_dispResult, g_dispResult); // Use a work area, since text will be altered paint_resultpow_rec(hdc, false, work_dispResult); // Start with normal text. if (result_size_recompute) // Was left at -1 to provoke recomputation of result_size.cx result_size_recompute = false; ! if (g_result_len > 0) { // Handle scroll annunciators when necessary if (result_size.cx > display_w) { ! if (g_scroll_result == DT_RIGHT) { // Light the scroll left annunciator shell_scroll_annunciators(ANNVAL_SCR_LEFT); } else { // Light the scroll right annunciator *************** *** 1504,1508 **** if (expon) *expon = NULL; // Skip '^' ! if (scroll_result == DT_LEFT) // Display the selected part first in current font size. A NULL is in *expon or at end. paint_result_piece(hdc, smallf, text, _tcslen(text)); --- 1537,1541 ---- if (expon) *expon = NULL; // Skip '^' ! if (g_scroll_result == DT_LEFT) // Display the selected part first in current font size. A NULL is in *expon or at end. paint_result_piece(hdc, smallf, text, _tcslen(text)); *************** *** 1524,1528 **** // If aligned right, // print text on the right of expoff first, if there is one. ! if (*(expoff+1) && (scroll_result == DT_RIGHT)) paint_resultpow_rec(hdc, false, expoff+1); // Print exponent, without enclosing () --- 1557,1561 ---- // If aligned right, // print text on the right of expoff first, if there is one. ! if (*(expoff+1) && (g_scroll_result == DT_RIGHT)) paint_resultpow_rec(hdc, false, expoff+1); // Print exponent, without enclosing () *************** *** 1532,1536 **** // If aligned left, // print text on the right of expoff after, if there is one. ! if (*(expoff+1) && (scroll_result == DT_LEFT)) paint_resultpow_rec(hdc, false, expoff+1); } else { // Find * or / maybe --- 1565,1569 ---- // If aligned left, // print text on the right of expoff after, if there is one. ! if (*(expoff+1) && (g_scroll_result == DT_LEFT)) paint_resultpow_rec(hdc, false, expoff+1); } else { // Find * or / maybe *************** *** 1540,1544 **** expoff = _tcschr(expon, _T('/')); if (expoff) { ! if (scroll_result == DT_RIGHT) // If aligned right, // print text after on the right first, including * or / paint_resultpow_rec(hdc, false, expoff); --- 1573,1577 ---- expoff = _tcschr(expon, _T('/')); if (expoff) { ! if (g_scroll_result == DT_RIGHT) // If aligned right, // print text after on the right first, including * or / paint_resultpow_rec(hdc, false, expoff); *************** *** 1548,1552 **** // Print expon string in small chars. paint_result_piece(hdc, true, expon, _tcslen(expon)); ! if (expoff && (scroll_result == DT_LEFT)) { // If aligned left, // print text on the right after, including * or / --- 1581,1585 ---- // Print expon string in small chars. paint_result_piece(hdc, true, expon, _tcslen(expon)); ! if (expoff && (g_scroll_result == DT_LEFT)) { // If aligned left, // print text on the right after, including * or / *************** *** 1557,1561 **** } } ! if (scroll_result == DT_RIGHT) // Display the selected part after in current font size. A NULL is in *expon or at end. paint_result_piece(hdc, smallf, text, _tcslen(text)); --- 1590,1594 ---- } } ! if (g_scroll_result == DT_RIGHT) // Display the selected part after in current font size. A NULL is in *expon or at end. paint_result_piece(hdc, smallf, text, _tcslen(text)); *************** *** 1602,1605 **** --- 1635,1639 ---- if (!GetTextExtentPoint(hdc, res_piece, len, &sz)) { // Error ! Stop here. + SelectObject(hdc, oldFont); // Set back default object return; } *************** *** 1610,1614 **** // Print the object at its place, and calculate the place for a next piece. RECT rc; ! if (scroll_result == DT_RIGHT) { if (pow_pos + sz.cx < display_w) { // Do not go beyond display area limits. rc.left = display_loc.x + display_w - pow_pos - sz.cx; --- 1644,1648 ---- // Print the object at its place, and calculate the place for a next piece. RECT rc; ! if (g_scroll_result == DT_RIGHT) { if (pow_pos + sz.cx < display_w) { // Do not go beyond display area limits. rc.left = display_loc.x + display_w - pow_pos - sz.cx; *************** *** 1640,1646 **** } if (smallf) { // Small is aligned on top, normal is on bottom. ! DrawText(hdc, res_piece, -1, &rc, scroll_result | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); } else { ! DrawText(hdc, res_piece, -1, &rc, scroll_result | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); } --- 1674,1680 ---- } if (smallf) { // Small is aligned on top, normal is on bottom. ! DrawText(hdc, res_piece, -1, &rc, g_scroll_result | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); } else { ! DrawText(hdc, res_piece, -1, &rc, g_scroll_result | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); } *************** *** 1652,1659 **** ********************************************************************************/ void Skin::scroll_result_left (HWND hWnd) { - HBITMAP bitmap = CreateBitmap(display_w, 18 * magnification, 1, 1, disp_bitmap); HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); --- 1686,1692 ---- ********************************************************************************/ void Skin::scroll_result_left (HWND hWnd) { HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, result_hbitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); *************** *** 1663,1670 **** SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); - DeleteObject(bitmap); ! scroll_result = DT_LEFT; ! if (result_pow) paint_resultpow(hdc); else --- 1696,1702 ---- SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); ! g_scroll_result = DT_LEFT; ! if (g_result_pow) paint_resultpow(hdc); else *************** *** 1677,1684 **** ********************************************************************************/ void Skin::scroll_result_right (HWND hWnd) { - HBITMAP bitmap = CreateBitmap(display_w, 18 * magnification, 1, 1, disp_bitmap); HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); --- 1709,1715 ---- ********************************************************************************/ void Skin::scroll_result_right (HWND hWnd) { HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! HGDIOBJ oldObject = SelectObject(memdc, result_hbitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); *************** *** 1688,1695 **** SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); - DeleteObject(bitmap); ! scroll_result = DT_RIGHT; ! if (result_pow) paint_resultpow(hdc); else --- 1719,1725 ---- SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); ! g_scroll_result = DT_RIGHT; ! if (g_result_pow) paint_resultpow(hdc); else *************** *** 1702,1706 **** ********************************************************************************/ TCHAR *Skin::get_result (void) { ! return (dispResult); } --- 1732,1736 ---- ********************************************************************************/ TCHAR *Skin::get_result (void) { ! return (g_dispResult); } *************** *** 1709,1718 **** ********************************************************************************/ void Skin::clipCopy_result (void) { ! if (*dispResult != 0) { ! int len = (_tcslen(dispResult) + 1)*sizeof(TCHAR); // Number of bytes + 1 // Get the clipboard and put data in there HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, len); void *p = GlobalLock(h); ! memcpy(p, dispResult, len); GlobalUnlock(h); OpenClipboard(NULL); --- 1739,1748 ---- ********************************************************************************/ void Skin::clipCopy_result (void) { ! if (*g_dispResult != 0) { ! int len = (_tcslen(g_dispResult) + 1)*sizeof(TCHAR); // Number of bytes + 1 // Get the clipboard and put data in there HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, len); void *p = GlobalLock(h); ! memcpy(p, g_dispResult, len); GlobalUnlock(h); OpenClipboard(NULL); |