fixed: in command CopyBoth /WmCommand_EditCopyBoth()/

after opening the clipboard the method EmptyClipboard() ought to be called
fixed:   some compiler warnings
changed: in command: (...) and 1/(...)
         if the input string is empty then the cursor is put between the brackets


git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@249 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-11-25 02:36:51 +00:00
parent 1f455925db
commit e6b64ccdad
6 changed files with 37 additions and 19 deletions

View File

@ -40,9 +40,16 @@
#include "compileconfig.h" #include "compileconfig.h"
//#define TTMATH_RELEASE //#define TTMATH_RELEASE
#include <ttmath/ttmath.h> #include <ttmath/ttmath.h>
#ifdef _MSC_VER
//"warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)"
// (ttmath set it to default)
#pragma warning (disable : 4800)
#endif
#ifndef TTCALC_PORTABLE #ifndef TTCALC_PORTABLE

View File

@ -494,7 +494,7 @@ void Languages::InitGuiMessagesTab()
"Contact: t.sowa@ttmath.org\r\n" "Contact: t.sowa@ttmath.org\r\n"
"Licence: BSD (open source)\r\n" "Licence: BSD (open source)\r\n"
"Project page: http://ttcalc.sourceforge.net\r\n" "Project page: http://ttcalc.sourceforge.net\r\n"
"Bignum library: TTMath %d.%d.%d%s\r\n" "Bignum library: TTMath %d.%d.%d%s (%s)\r\n"
"Bignum type: binary floating point numbers\r\n" "Bignum type: binary floating point numbers\r\n"
"Programming language: C++\r\n" "Programming language: C++\r\n"
"Compiler: %s\r\n" "Compiler: %s\r\n"
@ -522,7 +522,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " portable version"); InsertGuiPair(about_text_portable_version, " portable version");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "About"); InsertGuiPair(about_box_title, "About");
InsertGuiPair(about_box_button_close, "Close"); InsertGuiPair(about_box_button_close, "Close");
InsertGuiPair(unknown_error, "An unknown error has occurred"); InsertGuiPair(unknown_error, "An unknown error has occurred");
@ -689,7 +689,7 @@ void Languages::InitGuiMessagesTab()
"Kontakt: t.sowa@ttmath.org\r\n" "Kontakt: t.sowa@ttmath.org\r\n"
"Licencja: BSD (open source)\r\n" "Licencja: BSD (open source)\r\n"
"Strona projektu: http://ttcalc.sourceforge.net\r\n" "Strona projektu: http://ttcalc.sourceforge.net\r\n"
"Biblioteka du¿ych liczb: TTMath %d.%d.%d%s\r\n" "Biblioteka du¿ych liczb: TTMath %d.%d.%d%s (%s)\r\n"
"Rodzaj du¿ych liczb: liczby binarne zmiennoprzecinkowe\r\n" "Rodzaj du¿ych liczb: liczby binarne zmiennoprzecinkowe\r\n"
"Jêzyk programowania: C++\r\n" "Jêzyk programowania: C++\r\n"
"Kompilator: %s\r\n" "Kompilator: %s\r\n"
@ -717,7 +717,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " wersja portable"); InsertGuiPair(about_text_portable_version, " wersja portable");
InsertGuiPair(about_text_exe_packer, "Paker exe: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "Paker exe: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "O programie"); InsertGuiPair(about_box_title, "O programie");
InsertGuiPair(about_box_button_close, "Zamknij"); InsertGuiPair(about_box_button_close, "Zamknij");
InsertGuiPair(unknown_error, "Nieznany kod b³êdu"); InsertGuiPair(unknown_error, "Nieznany kod b³êdu");
@ -888,7 +888,7 @@ void Languages::InitGuiMessagesTab()
"Contacto: t.sowa@ttmath.org\r\n" "Contacto: t.sowa@ttmath.org\r\n"
"Licencia: BSD (open source)\r\n" "Licencia: BSD (open source)\r\n"
"Página del proyecto: http://ttcalc.sourceforge.net\r\n" "Página del proyecto: http://ttcalc.sourceforge.net\r\n"
"Biblioteca Bignum: TTMath %d.%d.%d%s\r\n" "Biblioteca Bignum: TTMath %d.%d.%d%s (%s)\r\n"
"Bignum type: binary floating point numbers\r\n" "Bignum type: binary floating point numbers\r\n"
"Lenguaje de programación: C++\r\n" "Lenguaje de programación: C++\r\n"
"Compilador: %s\r\n" "Compilador: %s\r\n"
@ -916,7 +916,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " versión portatil"); InsertGuiPair(about_text_portable_version, " versión portatil");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "Acerca de"); InsertGuiPair(about_box_title, "Acerca de");
InsertGuiPair(about_box_button_close, "Cerrar"); InsertGuiPair(about_box_button_close, "Cerrar");
InsertGuiPair(unknown_error, "Ocurrió un error desconocido"); InsertGuiPair(unknown_error, "Ocurrió un error desconocido");
@ -1084,7 +1084,7 @@ void Languages::InitGuiMessagesTab()
"Kontakt: t.sowa@ttmath.org\r\n" "Kontakt: t.sowa@ttmath.org\r\n"
"Licens: BSD (open source)\r\n" "Licens: BSD (open source)\r\n"
"Projekt side: http://ttcalc.sourceforge.net\r\n" "Projekt side: http://ttcalc.sourceforge.net\r\n"
"Bignum biblotek: TTMath %d.%d.%d%s\r\n" "Bignum biblotek: TTMath %d.%d.%d%s (%s)\r\n"
"Bignum type: binary floating point numbers\r\n" "Bignum type: binary floating point numbers\r\n"
"Programmerings sprog: C++\r\n" "Programmerings sprog: C++\r\n"
"Kompilator: %s\r\n" "Kompilator: %s\r\n"
@ -1112,7 +1112,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " transportabel version"); InsertGuiPair(about_text_portable_version, " transportabel version");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "Om"); InsertGuiPair(about_box_title, "Om");
InsertGuiPair(about_box_button_close, "Luk"); InsertGuiPair(about_box_button_close, "Luk");
InsertGuiPair(unknown_error, "Der er sket en ukendt fejl"); InsertGuiPair(unknown_error, "Der er sket en ukendt fejl");
@ -1277,7 +1277,7 @@ void Languages::InitGuiMessagesTab()
"ÁªÏµ: t.sowa@ttmath.org\r\n" "ÁªÏµ: t.sowa@ttmath.org\r\n"
"Ðí¿É: BSD (¿ªÔ´ÏîÄ¿)\r\n" "Ðí¿É: BSD (¿ªÔ´ÏîÄ¿)\r\n"
"Ö÷Ò³: http://ttcalc.sourceforge.net\r\n" "Ö÷Ò³: http://ttcalc.sourceforge.net\r\n"
"Bignum library: TTMath %d.%d.%d%s\r\n" "Bignum library: TTMath %d.%d.%d%s (%s)\r\n"
"Bignum type: binary floating point numbers\r\n" "Bignum type: binary floating point numbers\r\n"
"Programming language: C++\r\n" "Programming language: C++\r\n"
"Compiler: %s\r\n" "Compiler: %s\r\n"
@ -1305,7 +1305,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " portable version"); InsertGuiPair(about_text_portable_version, " portable version");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "¹ØÓÚ"); InsertGuiPair(about_box_title, "¹ØÓÚ");
InsertGuiPair(about_box_button_close, "¹Ø±Õ"); InsertGuiPair(about_box_button_close, "¹Ø±Õ");
InsertGuiPair(unknown_error, "·¢Éúδ֪´íÎó"); InsertGuiPair(unknown_error, "·¢Éúδ֪´íÎó");
@ -1474,7 +1474,7 @@ void Languages::InitGuiMessagesTab()
"e-mail: t.sowa@ttmath.org\r\n" "e-mail: t.sowa@ttmath.org\r\n"
"Ëèöåíçèÿ: BSD (open source)\r\n" "Ëèöåíçèÿ: BSD (open source)\r\n"
"Ñàéò ïðîåêòà: http://ttcalc.sourceforge.net\r\n" "Ñàéò ïðîåêòà: http://ttcalc.sourceforge.net\r\n"
"Áèáëèîòåêà Bignum: TTMath %d.%d.%d%s\r\n" "Áèáëèîòåêà Bignum: TTMath %d.%d.%d%s (%s)\r\n"
"Òèï Bignum: Äâîè÷íàÿ ñèñòåìà ñ÷èñëåíèÿ, ÷èñëà ñ ïëàâàþùåé çàïÿòîé\r\n" "Òèï Bignum: Äâîè÷íàÿ ñèñòåìà ñ÷èñëåíèÿ, ÷èñëà ñ ïëàâàþùåé çàïÿòîé\r\n"
"ßçûê ïðîãðàììèðîâàíèÿ: C++\r\n" "ßçûê ïðîãðàììèðîâàíèÿ: C++\r\n"
"Êîìïèëÿòîð: %s\r\n" "Êîìïèëÿòîð: %s\r\n"
@ -1503,7 +1503,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " ïåðåíîñíàÿ âåðñèÿ"); InsertGuiPair(about_text_portable_version, " ïåðåíîñíàÿ âåðñèÿ");
InsertGuiPair(about_text_exe_packer, "óïàêîâùèê EXE: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "óïàêîâùèê EXE: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "Î ïðîãðàììå"); InsertGuiPair(about_box_title, "Î ïðîãðàììå");
InsertGuiPair(about_box_button_close, "Çàêðûòü"); InsertGuiPair(about_box_button_close, "Çàêðûòü");
InsertGuiPair(unknown_error, "Íåèçâåñòíàÿ îøèáêà"); InsertGuiPair(unknown_error, "Íåèçâåñòíàÿ îøèáêà");
@ -1671,7 +1671,7 @@ void Languages::InitGuiMessagesTab()
"Kontakt: t.sowa@ttmath.org\r\n" "Kontakt: t.sowa@ttmath.org\r\n"
"Licens: BSD (open source)\r\n" "Licens: BSD (open source)\r\n"
"Projektsida: http://ttcalc.sourceforge.net\r\n" "Projektsida: http://ttcalc.sourceforge.net\r\n"
"Bignumbiblotek: TTMath %d.%d.%d%s\r\n" "Bignumbiblotek: TTMath %d.%d.%d%s (%s)\r\n"
"Bignum type: binary floating point numbers\r\n" "Bignum type: binary floating point numbers\r\n"
"Programmeringsspråk: C++\r\n" "Programmeringsspråk: C++\r\n"
"Kompilator: %s\r\n" "Kompilator: %s\r\n"
@ -1699,7 +1699,7 @@ void Languages::InitGuiMessagesTab()
" lars.gafvert@gmail.com\r\n" " lars.gafvert@gmail.com\r\n"
); );
InsertGuiPair(about_text_portable_version, " transportabel version"); InsertGuiPair(about_text_portable_version, " transportabel version");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.04\r\n");
InsertGuiPair(about_box_title, "Om"); InsertGuiPair(about_box_title, "Om");
InsertGuiPair(about_box_button_close, "Bäver"); InsertGuiPair(about_box_button_close, "Bäver");
InsertGuiPair(unknown_error, "Det har inträffat ett okänt fel"); InsertGuiPair(unknown_error, "Det har inträffat ett okänt fel");

View File

@ -40,7 +40,7 @@
#include "winmain.h" #include "winmain.h"
#include "update.h" #include "update.h"
#include "pad.h" #include "pad.h"
#include "bigtypes.h"
namespace MainWindowFunctions namespace MainWindowFunctions
@ -1146,6 +1146,7 @@ BOOL WmCommand_EditCopyBoth(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
if( !OpenClipboard(hWnd) ) if( !OpenClipboard(hWnd) )
return true; return true;
EmptyClipboard();
HGLOBAL global = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, in_len+out_len + 20); HGLOBAL global = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, in_len+out_len + 20);
if( global ) if( global )
@ -1165,7 +1166,7 @@ BOOL WmCommand_EditCopyBoth(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
std::strcat(text, buf); std::strcat(text, buf);
GlobalUnlock(global); GlobalUnlock(global);
set_correct = SetClipboardData(CF_TEXT, global); set_correct = (bool)SetClipboardData(CF_TEXT, global);
} }
} }
@ -1533,9 +1534,10 @@ char compiler[50];
#else #else
GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_portable_version), GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_portable_version),
#endif #endif
(TTCALC_PRERELEASE_VER!=0)? " (prerelease)" : "", (TTCALC_PRERELEASE_VER!=0)? " prerelease" : "",
TTMATH_MAJOR_VER, TTMATH_MINOR_VER, TTMATH_REVISION_VER, TTMATH_MAJOR_VER, TTMATH_MINOR_VER, TTMATH_REVISION_VER,
(TTMATH_PRERELEASE_VER!=0)? " (prerelease)" : "", (TTMATH_PRERELEASE_VER!=0)? " prerelease" : "",
TTMathBigMax::LibTypeStr(),
compiler, compiler,
#ifndef TTCALC_PORTABLE #ifndef TTCALC_PORTABLE
"" ""

View File

@ -508,7 +508,7 @@ private:
int pad_y_pos; int pad_y_pos;
int pad_x_size; int pad_x_size;
int pad_y_size; int pad_y_size;
int pad_maximized; bool pad_maximized;
int base_input; int base_input;
int base_output; int base_output;

View File

@ -46,6 +46,7 @@
#include "compileconfig.h" #include "compileconfig.h"
#include <ttmath/ttmathtypes.h> #include <ttmath/ttmathtypes.h>
#include <windows.h> #include <windows.h>
#include <cstdio>
/*! /*!

View File

@ -1119,6 +1119,10 @@ BOOL WmTabCommand_Press_bracketsall(HWND hWnd, UINT message, WPARAM wParam, LPAR
SendMessage(input, EM_SETSEL, end+1, end+1); SendMessage(input, EM_SETSEL, end+1, end+1);
SendMessage(input, EM_REPLACESEL, 1, LPARAM(")")); SendMessage(input, EM_REPLACESEL, 1, LPARAM(")"));
if( start == end )
// was empty string - we're setting the cursor inside the brackets
SendMessage(input, EM_SETSEL, end+1, end+1);
SetFocus(input); SetFocus(input);
return true; return true;
@ -1139,6 +1143,10 @@ BOOL WmTabCommand_Press_1div_bracketsall(HWND hWnd, UINT message, WPARAM wParam,
SendMessage(input, EM_SETSEL, end+3, end+3); SendMessage(input, EM_SETSEL, end+3, end+3);
SendMessage(input, EM_REPLACESEL, 1, LPARAM(")")); SendMessage(input, EM_REPLACESEL, 1, LPARAM(")"));
if( start == end )
// was empty string - we're setting the cursor inside the brackets
SendMessage(input, EM_SETSEL, end+3, end+3);
SetFocus(input); SetFocus(input);
return true; return true;