From b127612e166395e1e78aa4e7ae6d3cf1691ac2f7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 24 Mar 2010 21:08:50 +0000 Subject: [PATCH] [BUG_FIXED] Fix language switching to English not working bug. [MODIFY] Reduce PostIt/FullScreen restore button size. [BUG_FIXED] Fix PostIt wrong restore button position after toggling off fullScreen mode. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@627 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 20 +++++++++++++++++--- PowerEditor/src/Notepad_plus.rc | 4 ++-- PowerEditor/src/localization.cpp | 4 ++-- PowerEditor/src/localization.h | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index be182e742..b6563cc87 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3227,6 +3227,20 @@ void Notepad_plus::fullScreenToggle() //::SetForegroundWindow(_hSelf); _beforeSpecialView.isFullScreen = !_beforeSpecialView.isFullScreen; ::SendMessage(_hSelf, WM_SIZE, 0, 0); + if (_beforeSpecialView.isPostIt) + { + // show restore button on the right position + RECT rect; + GetWindowRect(_restoreButton.getHSelf(), &rect); + int w = rect.right - rect.left; + int h = rect.bottom - rect.top; + + RECT nppRect; + GetWindowRect(_hSelf, &nppRect); + int x = nppRect.right - w - w; + int y = nppRect.top + 1; + ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); + } } void Notepad_plus::postItToggle() @@ -3292,8 +3306,8 @@ void Notepad_plus::postItToggle() RECT nppRect; GetWindowRect(_hSelf, &nppRect); - int x = nppRect.right - w; - int y = nppRect.top; + int x = nppRect.right - w - w; + int y = nppRect.top + 1; ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); _pEditView->getFocus(); @@ -4010,7 +4024,7 @@ bool Notepad_plus::reloadLang() return false; } - _nativeLangSpeaker.init(nativeLangDocRootA); + _nativeLangSpeaker.init(nativeLangDocRootA, true); pNppParam->reloadContextMenuFromXmlTree(_mainMenuHandle); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 2bd1f4a04..21776f7b2 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -790,11 +790,11 @@ BEGIN EDITTEXT IDC_VALUE_EDIT,49,2,18,14,ES_NUMBER,WS_EX_DLGMODALFRAME END -IDD_BUTTON_DLG DIALOGEX 0, 0, 51, 17 +IDD_BUTTON_DLG DIALOGEX 0, 0, 12, 10 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,0,0,51,17 + PUSHBUTTON "+",IDC_RESTORE_BUTTON,0,0,12,10 END // xp style diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 93a07ef33..533c8645b 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -23,7 +23,7 @@ #include "localization.h" -void NativeLangSpeaker::init(TiXmlDocumentA *nativeLangDocRootA) +void NativeLangSpeaker::init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEnglish) { if (nativeLangDocRootA) { @@ -43,7 +43,7 @@ void NativeLangSpeaker::init(TiXmlDocumentA *nativeLangDocRootA) // get original file name (defined by Notpad++) from the attribute _fileName = element->Attribute("filename"); - if (_fileName && stricmp("english.xml", _fileName) == 0) + if (!loadIfEnglish && _fileName && stricmp("english.xml", _fileName) == 0) { _nativeLangA = NULL; return; diff --git a/PowerEditor/src/localization.h b/PowerEditor/src/localization.h index 4f1d0c004..98c79c7bc 100644 --- a/PowerEditor/src/localization.h +++ b/PowerEditor/src/localization.h @@ -25,7 +25,7 @@ class NativeLangSpeaker { public: NativeLangSpeaker():_nativeLangA(NULL), _nativeLangEncoding(CP_ACP), _isRTL(false), _fileName(NULL){}; - void init(TiXmlDocumentA *nativeLangDocRootA); + void init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEnglish = false); /* void set(TiXmlNodeA *nativeLangA, int nativeLangEncoding) { _nativeLangA = nativeLangA;