From 758d881510e89d060b6c20ed493d4ee9688efe30 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Mon, 20 Aug 2007 10:44:37 +0000 Subject: [PATCH] added: a conversion tab (gui only) git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@51 e52654a7-88a9-db11-a3e9-0013d4bc506e --- src/compileconfig.h | 4 ++-- src/languages.cpp | 10 ++++++++++ src/languages.h | 5 +++++ src/mainwindow.cpp | 6 +++++- src/programresources.h | 2 +- src/resource.h | 14 ++++++++++++++ src/resource.rc | 26 ++++++++++++++++++++++++++ src/tabs.cpp | 32 +++++++++++++++++++++++++++++++- src/tabs.h | 2 ++ 9 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/compileconfig.h b/src/compileconfig.h index 9f73db1..a589c3f 100644 --- a/src/compileconfig.h +++ b/src/compileconfig.h @@ -55,8 +55,8 @@ */ #define TTCALC_MAJOR_VER 0 #define TTCALC_MINOR_VER 8 -#define TTCALC_REVISION_VER 2 -#define TTCALC_PRERELEASE_VER 0 +#define TTCALC_REVISION_VER 3 +#define TTCALC_PRERELEASE_VER 1 diff --git a/src/languages.cpp b/src/languages.cpp index 9d1c06e..89c5c49 100644 --- a/src/languages.cpp +++ b/src/languages.cpp @@ -227,6 +227,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(tab_functions,"Functions"); InsertGuiPair(tab_precision,"Precision"); InsertGuiPair(tab_display,"Display"); + InsertGuiPair(tab_convert,"Convert"); InsertGuiPair(radio_precision_1,"Small - 96 bits for the mantissa, 32 bits for the exponent"); InsertGuiPair(radio_precision_2,"Medium - 192 bits for the mantissa, 64 bits for the exponent"); @@ -249,6 +250,10 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(display_always_scientific,"Always"); InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:"); InsertGuiPair(display_group_scientific, "Print the result as the scientific value"); + InsertGuiPair(convert_type, "Conversion type"); + InsertGuiPair(convert_input, "Input"); + InsertGuiPair(convert_output, "Output"); + InsertGuiPair(convert_dynamic_output, "auto output"); InsertGuiPair(menu_view, "&View"); InsertGuiPair(menu_edit, "&Edit"); @@ -343,6 +348,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(tab_functions,"Funkcje"); InsertGuiPair(tab_precision,"Precyzja"); InsertGuiPair(tab_display,"Wyświetlanie"); + InsertGuiPair(tab_convert,"Konwersja"); InsertGuiPair(radio_precision_1,"Mała - 96 bitowa mantysa, 32 bitowy wykładnik"); InsertGuiPair(radio_precision_2,"Średnia - 192 bitowa mantysa, 64 bitowy wykładnik"); @@ -366,6 +372,10 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(display_always_scientific,"Zawsze"); InsertGuiPair(display_not_always_scientific,"Jeśli eksponent jest większy niż:"); InsertGuiPair(display_group_scientific, "Wyświetl wynik w postaci naukowej"); + InsertGuiPair(convert_type, "Rodzaj konwersji"); + InsertGuiPair(convert_input, "Wejście"); + InsertGuiPair(convert_output, "Wyjście"); + InsertGuiPair(convert_dynamic_output, "Automatycznie"); InsertGuiPair(menu_view, "&Widok"); InsertGuiPair(menu_edit, "&Edycja"); diff --git a/src/languages.h b/src/languages.h index 5ea5243..e861591 100644 --- a/src/languages.h +++ b/src/languages.h @@ -83,6 +83,7 @@ public: tab_functions, tab_precision, tab_display, + tab_convert, radio_precision_1, radio_precision_2, radio_precision_3, @@ -100,6 +101,10 @@ public: display_rounding, display_always_scientific, display_not_always_scientific, + convert_type, + convert_input, + convert_output, + convert_dynamic_output, menu_view, menu_edit, menu_help, diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0953000..a779be4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -498,12 +498,13 @@ TCITEM tab_item; #ifndef TTCALC_PORTABLE tab_precision = 3; tab_display = 4; + tab_convert = 5; #else tab_precision = -1; // this one will not be used tab_display = 3; + tab_convert = 4; #endif - // this insertion must be in the ascending order // (the second parameter of 'TabCtrl_InsertItem') TabCtrl_InsertItem(hTab, tab_standard, &tab_item); @@ -515,6 +516,7 @@ TCITEM tab_item; #endif TabCtrl_InsertItem(hTab, tab_display, &tab_item); + TabCtrl_InsertItem(hTab, tab_convert, &tab_item); WmInitDialogCreateTab(hTab, tab_standard, IDD_DIALOG_STANDARD, TabWindowProc); WmInitDialogCreateTab(hTab, tab_variables, IDD_DIALOG_VARIABLES, TabWindowProc); @@ -525,6 +527,7 @@ TCITEM tab_item; #endif WmInitDialogCreateTab(hTab, tab_display, IDD_DIALOG_DISPLAY, TabWindowProc); + WmInitDialogCreateTab(hTab, tab_convert, IDD_DIALOG_CONVERT, TabWindowProc); SetSizeOfDialogs(); @@ -536,6 +539,7 @@ TCITEM tab_item; #endif SendMessage(GetPrgRes()->GetTabWindow(tab_display), WM_INIT_TAB_DISPLAY, 0,0); + SendMessage(GetPrgRes()->GetTabWindow(tab_convert), WM_INIT_TAB_CONVERT, 0,0); TabWindowFunctions::SetLanguage(hTab); diff --git a/src/programresources.h b/src/programresources.h index 7e54fef..f89af32 100644 --- a/src/programresources.h +++ b/src/programresources.h @@ -292,7 +292,7 @@ private: HINSTANCE hInstance; HWND main_window; - HWND tab_window[5]; + HWND tab_window[6]; int precision; bool always_on_top; diff --git a/src/resource.h b/src/resource.h index bffde4e..42565a0 100644 --- a/src/resource.h +++ b/src/resource.h @@ -58,6 +58,7 @@ #define IDD_DIALOG_FUNCTIONS 112 #define IDD_DIALOG_PRECISION 113 #define IDD_DIALOG_DISPLAY 114 +#define IDD_DIALOG_CONVERT 115 #define IDR_MENU 200 #define IDC_TAB 1010 @@ -162,6 +163,19 @@ #define IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC 1166 #define IDC_LABEL_GROUP_SCIENTIFIC 1168 +// convert tab +#define IDC_LIST_UNIT_TYPE 1200 +#define IDC_LIST_UNIT_INPUT1 1201 +#define IDC_LIST_UNIT_INPUT2 1202 +#define IDC_LIST_UNIT_OUTPUT1 1203 +#define IDC_LIST_UNIT_OUTPUT2 1204 +#define IDC_STATIC_UNIT_INPUT 1205 +#define IDC_STATIC_UNIT_OUTPUT 1206 +#define IDC_COMBO_DYNAMIC_OUTPUT 1207 +#define IDC_EDIT_OUTPUT_INFO 1208 +#define IDC_STATIC_UNIT_CONVERSION 1209 + + // menu #define IDM_VIEW_INDEX 0 #define IDM_EDIT_INDEX 1 diff --git a/src/resource.rc b/src/resource.rc index 6203803..61f1970 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -6,6 +6,7 @@ LANGUAGE LANG_POLISH, 1 104 ICON "..\\res\\icon01.ico" +#include "resource.h" LANGUAGE LANG_NEUTRAL, 0 200 MENU @@ -190,6 +191,31 @@ BEGIN GROUPBOX "Print scientific value",1168,11,51,240,31 END +115 DIALOG DISCARDABLE 0, 0, 260, 90 +STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP | + WS_TABSTOP +CAPTION "tab6" +FONT 8, "Ms Shell Dlg" +BEGIN + LTEXT "Conversion type",IDC_STATIC_UNIT_CONVERSION,3,2,63,8 + LTEXT "Input",IDC_STATIC_UNIT_INPUT,80,2,73,8 + LTEXT "Output",IDC_STATIC_UNIT_OUTPUT,167,2,80,8 + CONTROL "List1",IDC_LIST_UNIT_TYPE,"SysListView32",LVS_REPORT | + LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,3,12,67,56 + CONTROL "List2",IDC_LIST_UNIT_INPUT1,"SysListView32",LVS_REPORT | + LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,80,12,26,56 + CONTROL "List3",IDC_LIST_UNIT_INPUT2,"SysListView32",LVS_REPORT | + LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,109,12,49,56 + CONTROL "List4",IDC_LIST_UNIT_OUTPUT1,"SysListView32",LVS_REPORT | + LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,167,12,26,56 + CONTROL "List5",IDC_LIST_UNIT_OUTPUT2,"SysListView32",LVS_REPORT | + LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,196,12,60,56 + EDITTEXT IDC_EDIT_OUTPUT_INFO,3,72,156,14,ES_AUTOHSCROLL | + ES_READONLY + CONTROL "dynamically output",IDC_COMBO_DYNAMIC_OUTPUT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,167,74,88,10 +END + #ifndef TTCALC_PORTABLE 200 DIALOG DISCARDABLE 0, 0, 349, 202 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | diff --git a/src/tabs.cpp b/src/tabs.cpp index 751fbab..eb6d874 100644 --- a/src/tabs.cpp +++ b/src/tabs.cpp @@ -45,6 +45,7 @@ int tab_variables; int tab_functions; int tab_precision; int tab_display; +int tab_convert; ttmath::ErrorCode last_code = ttmath::err_ok; @@ -445,6 +446,18 @@ int i; } +void SetLanguageTabConvert(HWND hWnd) +{ +Languages * plang = GetPrgRes()->GetLanguages(); + + SetDlgItemText(hWnd, IDC_STATIC_UNIT_CONVERSION, plang->GuiMessage(Languages::convert_type) ); + SetDlgItemText(hWnd, IDC_STATIC_UNIT_INPUT, plang->GuiMessage(Languages::convert_input) ); + SetDlgItemText(hWnd, IDC_STATIC_UNIT_OUTPUT, plang->GuiMessage(Languages::convert_output) ); + SetDlgItemText(hWnd, IDC_COMBO_DYNAMIC_OUTPUT, plang->GuiMessage(Languages::convert_dynamic_output) ); +} + + + void SetLanguage(HWND hTab) { TCITEM tab; @@ -470,6 +483,9 @@ TCITEM tab; tab.pszText = const_cast( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_display) ); TabCtrl_SetItem(hTab,tab_display, &tab); + tab.pszText = const_cast( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_convert) ); + TabCtrl_SetItem(hTab,tab_convert, &tab); + SetLanguageTabStandard( GetPrgRes()->GetTabWindow(tab_standard) ); SetLanguageTabVariables( GetPrgRes()->GetTabWindow(tab_variables) ); SetLanguageTabFunctions( GetPrgRes()->GetTabWindow(tab_functions) ); @@ -478,7 +494,8 @@ TCITEM tab; SetLanguageTabPrecision( GetPrgRes()->GetTabWindow(tab_precision) ); #endif - SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) ); + SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) ); + SetLanguageTabConvert( GetPrgRes()->GetTabWindow(tab_convert) ); InvalidateRect(hTab, 0, false); } @@ -997,6 +1014,17 @@ char buffer[20]; return true; } +BOOL WmInitTabConvert(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + + + + + + + +return true; +} BOOL WmNotify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -1070,6 +1098,8 @@ void CreateTabMessagesTable(Messages & messages) #endif messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay); + messages.Associate(WM_INIT_TAB_CONVERT, WmInitTabConvert); + messages.Associate(WM_NOTIFY, WmNotify); } diff --git a/src/tabs.h b/src/tabs.h index 5637fab..c77e7ec 100644 --- a/src/tabs.h +++ b/src/tabs.h @@ -54,6 +54,7 @@ #define WM_INIT_TAB_PRECISION WM_APP+2 #define WM_INIT_TAB_DISPLAY WM_APP+3 #define WM_SET_LAST_ERROR WM_APP+4 +#define WM_INIT_TAB_CONVERT WM_APP+5 namespace TabWindowFunctions { @@ -62,6 +63,7 @@ extern int tab_variables; extern int tab_functions; extern int tab_precision; extern int tab_display; +extern int tab_convert; extern ttmath::ErrorCode last_code; void PrintErrorCode();