From 0bc0a42ec065f8c6f4a0d9d7c8a44e96664dce2a Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 8 Apr 2012 10:44:10 +0000 Subject: [PATCH] [BUG_FIXED] Fix selecting all the text in doc map while clicking on doc map dialog caption. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@890 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 10 +++++----- PowerEditor/src/WinControls/DockingWnd/Docking.h | 2 +- PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp | 7 ++++++- .../src/WinControls/DockingWnd/dockingResource.h | 2 ++ .../src/WinControls/DocumentMap/documentMap.cpp | 9 +-------- PowerEditor/src/WinControls/DocumentMap/documentMap.h | 9 ++++++++- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index aba5cb6b..8b289874 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2928,7 +2928,8 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) //Open the view if it was hidden int viewToOpen = (viewToGo == SUB_VIEW?WindowSubActive:WindowMainActive); - if (!(_mainWindowStatus & viewToOpen)) { + if (!(_mainWindowStatus & viewToOpen)) + { showView(viewToGo); } @@ -2943,8 +2944,6 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) //Activate the other view since thats where the document went switchEditViewTo(viewToGo); - - //_linkTriggered = true; } bool Notepad_plus::activateBuffer(BufferID id, int whichOne) @@ -4828,7 +4827,7 @@ struct Quote{ const char *_quote; }; -const int nbQuote = 47; +const int nbQuote = 49; Quote quotes[nbQuote] = { {"Notepad++", "Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size.\nBy optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment."}, {"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."}, @@ -4849,7 +4848,8 @@ Quote quotes[nbQuote] = { {"Gavin Russell Baker", "C++ : Where friends have access to your private members."}, {"Alanna", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."}, {"Linus Torvalds", "Software is like sex: It's better when it's free."}, -//{"Thomer M. Gil", "Don't get me wrong: Emacs is a great operating system --- it lacks a good editor, though."}, +{"Cult of vi", "Emacs is a great operating system, lacking only a decent editor."}, +{"Church of Emacs", "vi has two modes – \"beep repeatedly\" and \"break everything\"."}, {"Steve Jobs", "The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don't mean that in a small way, I mean that in a big way, in the sense that they don't think of original ideas, and they don't bring much culture into their products."}, {"brotips #1001", "Do everything for greatness, not money. Money follows greatness."}, {"brotips #1212", "Cheating is like eating fast food: you do it, you enjoy it, and then you feel like shit."}, diff --git a/PowerEditor/src/WinControls/DockingWnd/Docking.h b/PowerEditor/src/WinControls/DockingWnd/Docking.h index 7ca57c1b..5da8755b 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Docking.h +++ b/PowerEditor/src/WinControls/DockingWnd/Docking.h @@ -55,7 +55,7 @@ typedef struct { // user modifications UINT uMask; // mask params: look to above defines HICON hIconTab; // icon for tabs - TCHAR *pszAddInfo; // for plugin to display additional informations + const TCHAR *pszAddInfo; // for plugin to display additional informations // internal data, do not use !!! RECT rcFloat; // floating position diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 7ef62fad..734b3132 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -1428,7 +1428,12 @@ void DockingCont::focusClient() // set focus if (!tcItem.lParam) return; - ::SetFocus(((tTbData*)tcItem.lParam)->hClient); + + tTbData *tbData = (tTbData *)tcItem.lParam; + if (tbData->pszAddInfo && lstrcmp(tbData->pszAddInfo, DM_NOFOCUSWHILECLICKINGCAPTION) == 0) + return; + + ::SetFocus(tbData->hClient); } } diff --git a/PowerEditor/src/WinControls/DockingWnd/dockingResource.h b/PowerEditor/src/WinControls/DockingWnd/dockingResource.h index 1a320647..721c81ba 100644 --- a/PowerEditor/src/WinControls/DockingWnd/dockingResource.h +++ b/PowerEditor/src/WinControls/DockingWnd/dockingResource.h @@ -18,6 +18,8 @@ #ifndef DOCKING_RESOURCE_H #define DOCKING_RESOURCE_H +#define DM_NOFOCUSWHILECLICKINGCAPTION TEXT("NOFOCUSWHILECLICKINGCAPTION") + #define IDD_PLUGIN_DLG 103 #define IDC_EDIT1 1000 diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 65b616a3..c8300351 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -27,7 +27,7 @@ void DocumentMap::reloadMap() if (_pScintillaEditView && _ppEditView) { Document currentDoc = (*_ppEditView)->execute(SCI_GETDOCPOINTER); - ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc); + _pScintillaEditView->execute(SCI_SETDOCPOINTER, 0, (LPARAM)currentDoc); // // sync with the current document @@ -42,7 +42,6 @@ void DocumentMap::reloadMap() // Wrapping if ((*_ppEditView)->isWrap() && needToRecomputeWith()) { - //initWrapMap(); wrapMap(); } @@ -268,12 +267,6 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara return TRUE; } - case WM_DESTROY: - { - //::SendMessage(_hParent, NPPM_DESTROYSCINTILLAHANDLE, 0, (LPARAM)_pScintillaEditView->getHSelf()); - //printStr(TEXT("fw")); - } - return TRUE; case WM_SIZE: { diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 4ead0615..81ecc70a 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -82,9 +82,15 @@ private : class DocumentMap : public DockingDlgInterface { public: - DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP), _ppEditView(NULL), _pScintillaEditView(NULL) + DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP), _ppEditView(NULL),\ + _pScintillaEditView(NULL), id4dockingCont(DM_NOFOCUSWHILECLICKINGCAPTION) {}; + void create(tTbData * data, bool isRTL = false) { + DockingDlgInterface::create(data, isRTL); + data->pszAddInfo = id4dockingCont.c_str(); + }; + void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) { DockingDlgInterface::init(hInst, hPere); _ppEditView = ppEditView; @@ -121,6 +127,7 @@ private: // for needToRecomputeWith function int _displayZoom; int _displayWidth; + generic_string id4dockingCont; };