From: Mapi B. <ma...@us...> - 2009-11-16 22:18:53
|
Update of /cvsroot/easycalc/PPCport/system - UI In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23096 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.25d, matrix editor and other bug fixes/additional functions Index: EasyCalc.layout =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.layout,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EasyCalc.layout 3 Nov 2009 10:04:52 -0000 1.8 --- EasyCalc.layout 16 Nov 2009 22:18:41 -0000 1.9 *************** *** 188,192 **** # 149 -> erf # 150 -> erfc ! # 151 -> Inf // Infinity constant # # 1st row --- 188,193 ---- # 149 -> erf # 150 -> erfc ! # 151 -> = ! # 152 -> Inf // Infinity constant # # 1st row *************** *** 237,245 **** Key: 26 196,199,40,29 201,204,30,19 201,203 # 6th row ! # +Inf x : ! # 0 -/+ . + = ! Key: 0,151 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 196,236,40,29 201,241,30,19 201,240 --- 238,246 ---- 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 Index: EasyCalc.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EasyCalc.h 2 Nov 2009 17:36:50 -0000 1.6 --- EasyCalc.h 16 Nov 2009 22:18:41 -0000 1.7 *************** *** 104,109 **** #endif ! // Version of the shell file ! #define SHELL_VERSION 1 /* Magic number and version number for the state file. --- 104,110 ---- #endif ! // Version of the state file ! #define STATE_VERSION_ORIG 1 ! #define STATE_VERSION 2 /* Magic number and version number for the state file. *************** *** 152,155 **** --- 153,158 ---- #include "core/mlib/konvert.h" + void *subclassEdit(HWND hWnd_p, HWND hWndE); + void unsubclassEdit(HWND hWndE, void *cedit2_obj); void read_state (void); void save_state (void); *************** *** 166,168 **** --- 169,174 ---- void LstEditDeselect(void); + void MtxEditSetRowLabel(int rowNb, int value); + void MtxEditSetRowValue(int rowNb, int colNb, TCHAR *cell); + #endif Index: EasyCalcppc.aps =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalcppc.aps,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Binary files /tmp/cvsJA4iOE and /tmp/cvsfgPZbZ differ Index: EasyCalc.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EasyCalc.cpp 3 Nov 2009 10:04:52 -0000 1.7 --- EasyCalc.cpp 16 Nov 2009 22:18:41 -0000 1.8 *************** *** 50,53 **** --- 50,55 ---- #include "core/mlib/funcs.h" #include "core/mlib/stack.h" + #include "core/mtxedit.h" + #include "core/mlib/matrix.h" *************** *** 58,62 **** #define MAX_LOADSTRING 100 [...4043 lines suppressed...] ! return (FALSE); } --- 4815,4830 ---- free((void *) lParam); } ! processed = TRUE; ! break; case WM_CLOSE: EndDialog(hDlg, 0); ! processed = TRUE; ! break; } ! if (processed) // Send back message specific return value ! SetWindowLong(hDlg, DWL_MSGRESULT, res); ! return (processed); } Index: Skin.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Skin.h 2 Nov 2009 17:36:50 -0000 1.8 --- Skin.h 16 Nov 2009 22:18:41 -0000 1.9 *************** *** 138,142 **** TCHAR inputText[INPUTAREA_SIZE]; // Used to get the input area string int pow_pos; // Current position when writing power text. ! HWND hwndE; // The handle to the edit control input area bool landscape; --- 138,143 ---- 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; *************** *** 152,155 **** --- 153,157 ---- public: Skin(); // Constructor + ~Skin(); // Destructor int load(TCHAR *skinname, const TCHAR *basedir, int width, int height); Index: StateManager.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StateManager.cpp 2 Nov 2009 17:36:50 -0000 1.4 --- StateManager.cpp 16 Nov 2009 22:18:41 -0000 1.5 *************** *** 7,11 **** #include "EasyCalc.h" ! StateManager::StateManager(void) { // Set interface and calculator options to their defaults stateFile = NULL; --- 7,11 ---- #include "EasyCalc.h" ! StateManager::StateManager (void) { // Set interface and calculator options to their defaults stateFile = NULL; *************** *** 19,30 **** state.listPrefs.list[1][0] = _T('\0'); state.listPrefs.list[2][0] = _T('\0'); historyDB.in_state = false; } ! StateManager::~StateManager(void) { } ! void StateManager::initCalcPrefs() { /* Coming from prefs.c */ state.calcPrefs.version = PREF_VERSION; --- 19,31 ---- state.listPrefs.list[1][0] = _T('\0'); state.listPrefs.list[2][0] = _T('\0'); + state.matrixName[0] = _T('\0'); historyDB.in_state = false; } ! StateManager::~StateManager (void) { } ! void StateManager::initCalcPrefs (void) { /* Coming from prefs.c */ state.calcPrefs.version = PREF_VERSION; *************** *** 57,82 **** } ! t_state *StateManager::getState(void) { return (&state); } ! void StateManager::init(TCHAR *fn, void *hWnd_p) { stateFilename = fn; stateFile = _tfopen(fn, _T("rb")); if (stateFile != NULL) { ! if (read_shell_state(&version)) { init_mode = 1; - if (state.calcPrefs.version != PREF_VERSION) { - // Incorrect version/contents, create the state contents - FrmPopupForm(altNoStateFile, hWnd_p); - initCalcPrefs(); - } else { - // Publish calcPrefs and dispPrefs for old core modules - calcPrefs = state.calcPrefs; - dispPrefs = state.calcPrefs.dispPrefs; - } } else { // Could not read state file FrmPopupForm(altNoStateFile, hWnd_p); ! init_shell_state(-1); init_mode = 2; } --- 58,74 ---- } ! t_state *StateManager::getState (void) { return (&state); } ! void StateManager::init (TCHAR *fn, void *hWnd_p) { stateFilename = fn; stateFile = _tfopen(fn, _T("rb")); if (stateFile != NULL) { ! if (read_shell_state(hWnd_p)) { init_mode = 1; } else { // Could not read state file FrmPopupForm(altNoStateFile, hWnd_p); ! init_shell_state(-1, NULL); init_mode = 2; } *************** *** 90,94 **** error = history_open(); ErrFatalDisplayIf(error, _T("Can't open History DB")); ! init_shell_state(-1); init_mode = 0; } --- 82,86 ---- error = history_open(); ErrFatalDisplayIf(error, _T("Can't open History DB")); ! init_shell_state(-1, NULL); init_mode = 0; } *************** *** 120,136 **** ********************************************************************************/ /* private */ ! void StateManager::init_shell_state(int4 version) { ! switch (version) { ! case -1: ! // Set interface and calculator options to their defaults ! initCalcPrefs(); ! // fall through ! case SHELL_VERSION: ! // current version, ! // so nothing to do here since everything ! // was initialized from the state file. ! ; } } --- 112,139 ---- ********************************************************************************/ /* private */ ! void StateManager::init_shell_state (int4 stVersion, void *hWnd_p) { ! if (stVersion == -1) { ! // Set interface and calculator options to their defaults ! initCalcPrefs(); ! } else { ! switch (stVersion-STATE_VERSION_ORIG) { ! case 0: // Version 1 to 2 ! state.matrixName[0] = _T('\0'); ! // Fall through migration steps ... ! } ! if (state.calcPrefs.version != PREF_VERSION) { ! // Incorrect version/contents, create the state contents ! FrmPopupForm(altNoStateFile, hWnd_p); ! initCalcPrefs(); ! } else { ! // Publish calcPrefs and dispPrefs for old core modules ! // as done by initCalcPrefs(). ! calcPrefs = state.calcPrefs; ! dispPrefs = state.calcPrefs.dispPrefs; ! } } + + state_version = STATE_VERSION; } *************** *** 141,145 **** ********************************************************************************/ /* private */ ! int4 StateManager::shell_read_saved_state(void *buf, int4 bufsize) { if (stateFile == NULL) return (-1); --- 144,148 ---- ********************************************************************************/ /* private */ ! int4 StateManager::shell_read_saved_state (void *buf, int4 bufsize) { if (stateFile == NULL) return (-1); *************** *** 160,164 **** ********************************************************************************/ /* private */ ! bool StateManager::shell_write_saved_state(const void *buf, int4 nbytes) { if (stateFile == NULL) return (false); --- 163,167 ---- ********************************************************************************/ /* private */ ! bool StateManager::shell_write_saved_state (const void *buf, int4 nbytes) { if (stateFile == NULL) return (false); *************** *** 178,190 **** /******************************************************************************** ! * FUNCTION: read_shell_state(*int4) * * Read the state module structure from file * ********************************************************************************/ /* private */ ! bool StateManager::read_shell_state(int4 *ver) { int4 magic; int4 version; int4 state_size; - int4 state_version; DataManager *dm, *dmHist; Err error; --- 181,193 ---- /******************************************************************************** ! * FUNCTION: read_shell_state() * * Read the state module structure from file * ********************************************************************************/ /* private */ ! bool StateManager::read_shell_state (void *hWnd_p) { int4 magic; int4 version; + int4 stVersion; int4 state_size; DataManager *dm, *dmHist; Err error; *************** *** 204,210 **** if (shell_read_saved_state(&state_size, sizeof(int4)) != sizeof(int4)) return (false); ! if (shell_read_saved_state(&state_version, sizeof(int4)) != sizeof(int4)) return (false); ! if ((state_version < 0) || (state_version > SHELL_VERSION)) /* Unknown shell state version */ return (false); --- 207,213 ---- if (shell_read_saved_state(&state_size, sizeof(int4)) != sizeof(int4)) return (false); ! if (shell_read_saved_state(&stVersion, sizeof(int4)) != sizeof(int4)) return (false); ! if ((stVersion < STATE_VERSION_ORIG) || (stVersion > STATE_VERSION)) /* Unknown shell state version */ return (false); *************** *** 246,255 **** // Initialize the parts of the shell state // that were NOT read from the state file ! init_shell_state(state_version); } else { // Version 0 ! init_shell_state(-1); } - *ver = version; return (true); } --- 249,257 ---- // Initialize the parts of the shell state // that were NOT read from the state file ! init_shell_state(stVersion, hWnd_p); } else { // Version 0 ! init_shell_state(-1, NULL); } return (true); } *************** *** 260,268 **** ********************************************************************************/ /* private */ ! bool StateManager::write_shell_state() { int4 magic = EASYCALC_MAGIC; int4 version = EASYCALC_VERSION; int4 state_size = sizeof(t_state); ! int4 state_version = SHELL_VERSION; if (!shell_write_saved_state(&magic, sizeof(int4))) --- 262,270 ---- ********************************************************************************/ /* private */ ! bool StateManager::write_shell_state (void) { int4 magic = EASYCALC_MAGIC; int4 version = EASYCALC_VERSION; int4 state_size = sizeof(t_state); ! int4 state_version = STATE_VERSION; if (!shell_write_saved_state(&magic, sizeof(int4))) Index: EasyCalcppc.rc =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalcppc.rc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EasyCalcppc.rc 2 Nov 2009 17:36:50 -0000 1.6 --- EasyCalcppc.rc 16 Nov 2009 22:18:41 -0000 1.7 *************** *** 45,49 **** PUSHBUTTON "Cancel",IDCANCEL,73,31,41,14 LTEXT "Name:",IDC_VARNAME,3,3,35,12 ! COMBOBOX IDC_VARCOMBO,44,1,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE | WS_TABSTOP,47,31,14,14 END --- 45,49 ---- PUSHBUTTON "Cancel",IDCANCEL,73,31,41,14 LTEXT "Name:",IDC_VARNAME,3,3,35,12 ! COMBOBOX IDC_VARCOMBO,44,1,70,40,CBS_DROPDOWN | CBS_SORT | CBS_LOWERCASE | WS_VSCROLL | WS_TABSTOP CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE | WS_TABSTOP,47,31,14,14 END *************** *** 71,75 **** BEGIN LISTBOX IDC_LIST_FV,33,132,40,27,NOT WS_VISIBLE | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_DLGMODALFRAME ! CONTROL "",IDC_DATALIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,158,147 DEFPUSHBUTTON "OK",IDOK,0,150,30,14 PUSHBUTTON "New",IDC_NEW,33,150,40,14 --- 71,75 ---- BEGIN LISTBOX IDC_LIST_FV,33,132,40,27,NOT WS_VISIBLE | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_DLGMODALFRAME ! CONTROL "",IDC_DATALIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,1,158,147 DEFPUSHBUTTON "OK",IDOK,0,150,30,14 PUSHBUTTON "New",IDC_NEW,33,150,40,14 *************** *** 90,96 **** EDITTEXT IDC_EDIT1,32,2,60,14,ES_LOWERCASE | ES_AUTOHSCROLL | WS_GROUP EDITTEXT IDC_EDIT2,0,19,159,43,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL PUSHBUTTON "Cancel",IDCANCEL,33,66,50,14 LTEXT "Param:",IDC_PARAM,97,4,30,8 - EDITTEXT IDC_EDIT3,129,2,30,14,ES_AUTOHSCROLL CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE,91,66,14,14 END --- 90,96 ---- EDITTEXT IDC_EDIT1,32,2,60,14,ES_LOWERCASE | ES_AUTOHSCROLL | WS_GROUP EDITTEXT IDC_EDIT2,0,19,159,43,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL + EDITTEXT IDC_EDIT3,129,2,30,14,ES_AUTOHSCROLL PUSHBUTTON "Cancel",IDCANCEL,33,66,50,14 LTEXT "Param:",IDC_PARAM,97,4,30,8 CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE,91,66,14,14 END *************** *** 234,237 **** --- 234,251 ---- END + IDD_MATRIXEDIT DIALOG 0, 0, 160, 165 + STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU + CAPTION "Matrix Editor" + FONT 8, "MS Shell Dlg" + BEGIN + CONTROL "",IDC_EDITMATRIX,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,15,158,133 + DEFPUSHBUTTON "OK",IDOK,0,150,30,14 + LTEXT "x",IDC_STATIC,111,3,8,8 + COMBOBOX IDC_COMBO_MATRIX,17,1,45,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBO_NBROWS,76,1,30,163,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBO_NBCOLS,120,1,30,163,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "SIP1",IDC_SIP,"SIPPREF",NOT WS_VISIBLE | WS_TABSTOP,1,1,14,14 + END + ///////////////////////////////////////////////////////////////////////////// *************** *** 323,326 **** --- 337,348 ---- TOPMARGIN, 1 END + + IDD_MATRIXEDIT, DIALOG + BEGIN + LEFTMARGIN, 1 + RIGHTMARGIN, 159 + TOPMARGIN, 1 + BOTTOMMARGIN, 164 + END END #endif // APSTUDIO_INVOKED *************** *** 357,360 **** --- 379,383 ---- MENUITEM SEPARATOR MENUITEM "List Editor", IDM_EDIT_LISTEDITOR + MENUITEM "Matrix Editor", IDM_EDIT_MATRIXEDITOR END POPUP "Help" Index: StateManager.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StateManager.h 2 Nov 2009 17:36:50 -0000 1.5 --- StateManager.h 16 Nov 2009 22:18:41 -0000 1.6 *************** *** 18,21 **** --- 18,23 ---- tPrefs calcPrefs; tlistPrefs listPrefs; + TCHAR matrixName[MAX_FUNCNAME+1]; + // Always add new fields at end, for kepping version migration simple } t_state; *************** *** 26,39 **** int init_mode; ! void init_shell_state(int4 version); int4 shell_read_saved_state(void *buf, int4 bufsize); bool shell_write_saved_state(const void *buf, int4 nbytes); ! bool read_shell_state(int4 *ver); ! bool write_shell_state(); ! void initCalcPrefs(); public: t_state state; ! int4 version; DataManager historyDB; DataManager calcDB; --- 28,41 ---- int init_mode; ! void init_shell_state(int4 stVersion, void *hWnd_p); int4 shell_read_saved_state(void *buf, int4 bufsize); bool shell_write_saved_state(const void *buf, int4 nbytes); ! bool read_shell_state(void *hWnd_p); ! bool write_shell_state(void); ! void initCalcPrefs(void); public: t_state state; ! int4 state_version; DataManager historyDB; DataManager calcDB; Index: EasyCalc.gif =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/EasyCalc.gif,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 Binary files /tmp/cvsDbEbyK and /tmp/cvsuMZW24 differ Index: resourceppc.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/resourceppc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** resourceppc.h 2 Nov 2009 17:36:50 -0000 1.6 --- resourceppc.h 16 Nov 2009 22:18:41 -0000 1.7 *************** *** 26,29 **** --- 26,31 ---- #define IDD_LISTEDIT 147 #define IDD_VARSTRINGENTRY 148 + #define IDD_LISTEDIT1 149 + #define IDD_MATRIXEDIT 149 #define IDC_STATIC_1 201 #define IDC_STATIC_2 202 *************** *** 86,89 **** --- 88,95 ---- #define IDC_EDIT1 1117 #define IDC_SIP 1120 + #define IDC_EDITMATRIX 1128 + #define IDC_COMBO_MATRIX 1129 + #define IDC_COMBO_NBROWS 1130 + #define IDC_COMBO_NBCOLS 1131 #define IDM_EXIT 32774 #define IDM_FILE_EXIT 32777 *************** *** 94,97 **** --- 100,105 ---- #define IDM_EDIT_CLIPCOPY 32787 #define IDM_EDIT_LISTEDITOR 32789 + #define ID_EDIT_MATRIXEDITOR 32790 + #define IDM_EDIT_MATRIXEDITOR 32791 #define IDM_OK 40000 #define IDM_HELP 40001 *************** *** 99,102 **** --- 107,111 ---- #define IDM_FILE 40003 #define IDM_EDIT 40004 + #define IDC_STATIC -1 // Next default values for new objects *************** *** 106,111 **** #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 149 ! #define _APS_NEXT_COMMAND_VALUE 32790 ! #define _APS_NEXT_CONTROL_VALUE 1128 #define _APS_NEXT_SYMED_VALUE 112 #endif --- 115,120 ---- #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 149 ! #define _APS_NEXT_COMMAND_VALUE 32792 ! #define _APS_NEXT_CONTROL_VALUE 1132 #define _APS_NEXT_SYMED_VALUE 112 #endif Index: Skin.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Skin.cpp 2 Nov 2009 17:36:50 -0000 1.8 --- Skin.cpp 16 Nov 2009 22:18:41 -0000 1.9 *************** *** 53,57 **** /*------------------------------------------------------------------------------- ! - Constructor. - -------------------------------------------------------------------------------*/ Skin::Skin() { --- 53,57 ---- /*------------------------------------------------------------------------------- ! - Constructor and destructor. - -------------------------------------------------------------------------------*/ Skin::Skin() { *************** *** 71,74 **** --- 71,75 ---- result_pow = false; scroll_result = DT_RIGHT; + cedit2_obj = NULL; hwndE = NULL; hFontBig_display = hFontSmall_display = hFont_input = NULL; *************** *** 76,79 **** --- 77,87 ---- } + Skin::~Skin() { + if (cedit2_obj != NULL) { + unsubclassEdit(hwndE, cedit2_obj); + cedit2_obj = NULL; + } + } + /*------------------------------------------------------------------------------- - Methods. - *************** *** 316,325 **** continue; if (_strnicmp(line, "skin:", 5) == 0) { ! int x, y, width, height; ! if (sscanf(line + 5, " %d,%d,%d,%d", &x, &y, &width, &height) == 4){ skin.x = x; skin.y = y; ! skin.width = width; ! skin.height = height; } } else if (_strnicmp(line, "display:", 8) == 0) { --- 324,333 ---- continue; if (_strnicmp(line, "skin:", 5) == 0) { ! int x, y, skin_width, skin_height; ! if (sscanf(line + 5, " %d,%d,%d,%d", &x, &y, &skin_width, &skin_height) == 4){ skin.x = x; skin.y = y; ! skin.width = skin_width; ! skin.height = skin_height; } } else if (_strnicmp(line, "display:", 8) == 0) { *************** *** 924,928 **** if (!make_dib(memdc)) return; ! SelectObject(memdc, skin_dib); if (skin_type == IMGTYPE_MONO) { old_bg = SetBkColor(hdc, 0x00ffffff); --- 932,936 ---- if (!make_dib(memdc)) return; ! HGDIOBJ oldObject = SelectObject(memdc, skin_dib); if (skin_type == IMGTYPE_MONO) { old_bg = SetBkColor(hdc, 0x00ffffff); *************** *** 934,937 **** --- 942,946 ---- SetTextColor(hdc, old_fg); } + SelectObject(memdc, oldObject); // Set back default object } *************** *** 946,950 **** if (!make_dib(memdc)) return; ! SelectObject(memdc, skin_dib); if (skin_type == IMGTYPE_MONO) { old_bg = SetBkColor(hdc, 0x00ffffff); --- 955,959 ---- if (!make_dib(memdc)) return; ! HGDIOBJ oldObject = SelectObject(memdc, skin_dib); if (skin_type == IMGTYPE_MONO) { old_bg = SetBkColor(hdc, 0x00ffffff); *************** *** 971,974 **** --- 980,984 ---- SetTextColor(hdc, old_fg); } + SelectObject(memdc, oldObject); // Set back default object } *************** *** 984,988 **** if (!make_dib(memdc)) return; ! SelectObject(memdc, skin_dib); k = keylist + key; if (skin_type == IMGTYPE_MONO) { --- 994,998 ---- if (!make_dib(memdc)) return; ! HGDIOBJ oldObject = SelectObject(memdc, skin_dib); k = keylist + key; if (skin_type == IMGTYPE_MONO) { *************** *** 1000,1003 **** --- 1010,1014 ---- SetTextColor(hdc, old_fg); } + SelectObject(memdc, oldObject); // Set back default object } *************** *** 1062,1069 **** HDC memdc = CreateCompatibleDC(hdc); HBITMAP bitmap = CreateBitmap(sx == 0 ? 219 : (disp_w * sx), disp_h * sy, 1, 1, disp_bitmap); ! SelectObject(memdc, bitmap); ! COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); int bx, bw; if (sx == 0) { --- 1073,1080 ---- HDC memdc = CreateCompatibleDC(hdc); HBITMAP bitmap = CreateBitmap(sx == 0 ? 219 : (disp_w * sx), disp_h * sy, 1, 1, disp_bitmap); ! HGDIOBJ oldObject = SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); + int bx, bw; if (sx == 0) { *************** *** 1086,1094 **** BitBlt(hdc, display_loc.x + bx, display_loc.y + y * sy, bw, height * sy, memdc, bx, y * sy, SRCCOPY); SetBkColor(hdc, old_bg); SetTextColor(hdc, old_fg); ! ! DeleteDC(memdc); DeleteObject(bitmap); } } --- 1097,1106 ---- BitBlt(hdc, display_loc.x + bx, display_loc.y + y * sy, bw, height * sy, memdc, bx, y * sy, SRCCOPY); + SetBkColor(hdc, old_bg); SetTextColor(hdc, old_fg); ! SelectObject(memdc, oldObject); // Set back default object DeleteObject(bitmap); + DeleteDC(memdc); } } *************** *** 1102,1106 **** HBITMAP bitmap = CreateBitmap(display_w, display_h, 1, 1, disp_bitmap); ! SelectObject(memdc, bitmap); COLORREF old_bg = SetBkColor(hdc, display_bg); COLORREF old_fg = SetTextColor(hdc, display_fg); --- 1114,1118 ---- 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); *************** *** 1112,1115 **** --- 1124,1128 ---- else paint_result(hdc); + SelectObject(memdc, oldObject); // Set back default object } *************** *** 1138,1144 **** TRUE); } else { ! hwndE = CreateWindow(_T("EDIT2"), NULL, dwStyle, display_loc.x, display_loc.y + 18, display_w, 30, hWnd_p, NULL, hinst, NULL); } Edit_SetExtendedStyle(hwndE, 0xFFFFFFFF, Edit_GetExtendedStyle(hwndE) | ES_EX_FOCUSBORDERDISABLED); --- 1151,1159 ---- TRUE); } else { ! // hwndE = CreateWindow(_T("EDIT2"), NULL, dwStyle, ! hwndE = CreateWindow(_T("EDIT"), NULL, dwStyle, display_loc.x, display_loc.y + 18, display_w, 30, hWnd_p, NULL, hinst, NULL); + cedit2_obj = subclassEdit(hWnd_p, hwndE); } Edit_SetExtendedStyle(hwndE, 0xFFFFFFFF, Edit_GetExtendedStyle(hwndE) | ES_EX_FOCUSBORDERDISABLED); *************** *** 1309,1316 **** HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); HDC memdc = CreateCompatibleDC(hdc); ! 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, 18, memdc, 0, 0, SRCCOPY); DeleteDC(memdc); DeleteObject(bitmap); --- 1324,1332 ---- HBITMAP bitmap = CreateBitmap(display_w, 18, 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); BitBlt(hdc, display_loc.x, display_loc.y, display_w, 18, memdc, 0, 0, SRCCOPY); + SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); DeleteObject(bitmap); *************** *** 1361,1364 **** --- 1377,1382 ---- shell_scroll_annunciators(ANNVAL_SCR_NONE); } + + SelectObject(hdc, oldFont); // Set back default object } *************** *** 1392,1399 **** HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); HDC memdc = CreateCompatibleDC(hdc); ! 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, 18, memdc, 0, 0, SRCCOPY); DeleteDC(memdc); DeleteObject(bitmap); --- 1410,1418 ---- HBITMAP bitmap = CreateBitmap(display_w, 18, 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); BitBlt(hdc, display_loc.x, display_loc.y, display_w, 18, memdc, 0, 0, SRCCOPY); + SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); DeleteObject(bitmap); *************** *** 1432,1435 **** --- 1451,1456 ---- GetTextExtentPoint32(hdc, dispResult, result_len, &result_size); result_size.cx = 0; + + SelectObject(hdc, oldFont); // Set back default object } pow_pos = 0; *************** *** 1606,1609 **** --- 1627,1632 ---- DrawText(hdc, res_piece, -1, &rc, scroll_result | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); } + + SelectObject(hdc, oldFont); // Set back default object } *************** *** 1613,1625 **** void Skin::scroll_result_left (HWND hWnd) { HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); ! HDC hdc = GetDC((HWND) hWnd); HDC memdc = CreateCompatibleDC(hdc); ! ! 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, 18, memdc, 0, 0, SRCCOPY); DeleteDC(memdc); scroll_result = DT_LEFT; --- 1636,1650 ---- void Skin::scroll_result_left (HWND hWnd) { HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); ! HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! 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, 18, memdc, 0, 0, SRCCOPY); + + SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); + DeleteObject(bitmap); scroll_result = DT_LEFT; *************** *** 1636,1648 **** void Skin::scroll_result_right (HWND hWnd) { HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); ! HDC hdc = GetDC((HWND) hWnd); HDC memdc = CreateCompatibleDC(hdc); ! ! 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, 18, memdc, 0, 0, SRCCOPY); DeleteDC(memdc); scroll_result = DT_RIGHT; --- 1661,1675 ---- void Skin::scroll_result_right (HWND hWnd) { HBITMAP bitmap = CreateBitmap(display_w, 18, 1, 1, disp_bitmap); ! HDC hdc = GetDC(hWnd); HDC memdc = CreateCompatibleDC(hdc); ! 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, 18, memdc, 0, 0, SRCCOPY); + + SelectObject(memdc, oldObject); // Set back default object DeleteDC(memdc); + DeleteObject(bitmap); scroll_result = DT_RIGHT; |