From: Mapi B. <ma...@us...> - 2009-10-21 20:57:02
|
Update of /cvsroot/easycalc/PPCport/system - UI In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27791 Modified Files: Skin.cpp Skin.h StateManager.cpp StateManager.h Log Message: Bug fixes, dynamic language change enabled on UI. Index: StateManager.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StateManager.h 17 Oct 2009 13:53:14 -0000 1.3 --- StateManager.h 21 Oct 2009 20:56:50 -0000 1.4 *************** *** 38,42 **** ~StateManager(void); ! t_state *init(TCHAR *fn, void *hWnd_p); void save(TCHAR *fn, void *hWnd_p); }; --- 38,43 ---- ~StateManager(void); ! t_state *getState(void); ! void init(TCHAR *fn, void *hWnd_p); void save(TCHAR *fn, void *hWnd_p); }; Index: Skin.h =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Skin.h 17 Oct 2009 13:53:14 -0000 1.5 --- Skin.h 21 Oct 2009 20:56:50 -0000 1.6 *************** *** 129,132 **** --- 129,135 ---- bool display_enabled; // Enable or disable screen repaints. TCHAR dispResult[RESULTAREA_SIZE]; // Contains the result area string + int result_len; // Length of the result area string (-1 to 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 posistion right when writing *************** *** 181,184 **** --- 184,189 ---- void print_result(HDC hdc); void paint_result(HDC hdc); + void scroll_result_left(HWND hWnd); + void scroll_result_right(HWND hWnd); void print_resultpowInit(void *hdc, TCHAR *res_text); void print_resultpowNext(bool smallf, TCHAR *res_piece, int len); Index: StateManager.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/StateManager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StateManager.cpp 17 Oct 2009 13:53:14 -0000 1.2 --- StateManager.cpp 21 Oct 2009 20:56:50 -0000 1.3 *************** *** 54,58 **** } ! t_state *StateManager::init(TCHAR *fn, void *hWnd_p) { stateFilename = fn; stateFile = _tfopen(fn, _T("rb")); --- 54,62 ---- } ! t_state *StateManager::getState(void) { ! return (&state); ! } ! ! void StateManager::init(TCHAR *fn, void *hWnd_p) { stateFilename = fn; stateFile = _tfopen(fn, _T("rb")); *************** *** 89,94 **** /* Coming from prefs.c, after preferences are loaded or initialized */ fp_set_prefs(calcPrefs.dispPrefs); - - return (&state); } --- 93,96 ---- Index: Skin.cpp =================================================================== RCS file: /cvsroot/easycalc/PPCport/system - UI/Skin.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Skin.cpp 17 Oct 2009 13:53:14 -0000 1.5 --- Skin.cpp 21 Oct 2009 20:56:50 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include "core/core_display.h" #include "core/Main.h" + #include "EasyCalc.h" /*------------------------------------------------------------------------------- *************** *** 78,81 **** --- 79,84 ---- keymap_length = 0; *dispResult = 0; // Empty string + result_len = 0; + scroll_result = DT_RIGHT; hwndE = NULL; display_enabled = true; *************** *** 525,529 **** } else { if (display_scale.x == 0) ! display_w = 219; else display_w = 131 * display_scale.x; --- 528,532 ---- } else { if (display_scale.x == 0) ! display_w = 217; else display_w = 131 * display_scale.x; *************** *** 1277,1280 **** --- 1280,1284 ---- HDC hdc = GetDC((HWND) hWnd_p); print_result(hdc); + ReleaseDC((HWND) hWnd_p, hdc); } *************** *** 1291,1295 **** --- 1295,1302 ---- COLORREF old_fg = SetTextColor(hdc, display_fg); BitBlt(hdc, display_loc.x, display_loc.y, display_w, 18, memdc, 0, 0, SRCCOPY); + DeleteDC(memdc); + result_len = -1; // Recalculate result_size in paint_result() + scroll_result = DT_RIGHT; paint_result(hdc); } *************** *** 1317,1322 **** HFONT oldFont = (HFONT)SelectObject(hdc, hFontNew); ! // Display text ! DrawText(hdc, dispResult, -1, &rc, DT_RIGHT | DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX); } --- 1324,1386 ---- HFONT oldFont = (HFONT)SelectObject(hdc, hFontNew); ! // Display text - scroll result is either DT_LEFT or DT_RIGHT ! if (result_len == -1) { ! result_len = _tcslen(dispResult); ! GetTextExtentPoint32(hdc, dispResult, result_len, &result_size); ! } ! 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 ! shell_scroll_annunciators(ANNVAL_SCR_RIGHT); ! } ! } else { ! shell_scroll_annunciators(ANNVAL_SCR_NONE); ! } ! } else { ! shell_scroll_annunciators(ANNVAL_SCR_NONE); ! } ! } ! ! /******************************************************************************** ! * OS specific: scroll result left in the display area. * ! ********************************************************************************/ ! 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; ! paint_result(hdc); ! ReleaseDC(hWnd, hdc); ! } ! ! /******************************************************************************** ! * OS specific: scroll result right in the display area. * ! ********************************************************************************/ ! 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; ! paint_result(hdc); ! ReleaseDC(hWnd, hdc); } |