diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 1aa6b2a0f..442bbe2c9 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -149,7 +149,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); // Menu - _mainMenuHandle = ::GetMenu(_hSelf); + _mainMenuHandle = ::GetMenu(hwnd); int langPos2BeRemoved = MENUINDEX_LANGUAGE+1; if (nppGUI._isLangMenuCompact) langPos2BeRemoved = MENUINDEX_LANGUAGE; @@ -202,8 +202,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); - _configStyleDlg.init(_hInst, _hSelf); - _preference.init(_hInst, _hSelf); + _configStyleDlg.init(_hInst, hwnd); + _preference.init(_hInst, hwnd); //Marker Margin config _mainEditView.setMakerStyle(svp1._folderStyle); @@ -275,7 +275,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa //--Splitter Section--// bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); - _subSplitter.init(_hInst, _hSelf); + _subSplitter.init(_hInst, hwnd); _subSplitter.create(&_mainDocTab, &_subDocTab, 8, DYNAMIC, 50, isVertical); //--Status Bar Section--// @@ -293,13 +293,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _dockingManager.init(_hInst, hwnd, &_pMainWindow); if (nppGUI._isMinimizedToTray && _pTrayIco == NULL) - _pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT("")); + _pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT("")); checkSyncState(); // Plugin Manager NppData nppData; - nppData._nppHandle = _hSelf; + nppData._nppHandle = hwnd; nppData._scintillaMainHandle = _mainEditView.getHSelf(); nppData._scintillaSecondHandle = _subEditView.getHSelf(); @@ -310,7 +310,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa if (appDataNpp[0]) _pluginsManager.loadPlugins(appDataNpp); - _restoreButton.init(_hInst, _hSelf); + _restoreButton.init(_hInst, hwnd); // ------------ // @@ -379,7 +379,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa nppGUI._excludedLangList[i]._cmdID = cmdID; nppGUI._excludedLangList[i]._langName = itemName; ::DeleteMenu(hLangMenu, cmdID, MF_BYCOMMAND); - DrawMenuBar(_hSelf); + DrawMenuBar(hwnd); } } @@ -464,19 +464,19 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa pNppParam->reloadPluginCmds(); // Shortcut Accelerator : should be the last one since it will capture all the shortcuts - _accelerator.init(_mainMenuHandle, _hSelf); + _accelerator.init(_mainMenuHandle, hwnd); pNppParam->setAccelerator(&_accelerator); // Scintilla key accelerator vector scints; scints.push_back(_mainEditView.getHSelf()); scints.push_back(_subEditView.getHSelf()); - _scintaccelerator.init(&scints, _mainMenuHandle, _hSelf); + _scintaccelerator.init(&scints, _mainMenuHandle, hwnd); pNppParam->setScintillaAccelerator(&_scintaccelerator); _scintaccelerator.updateKeys(); - ::DrawMenuBar(_hSelf); + ::DrawMenuBar(hwnd); //-- Tool Bar Section --// @@ -486,7 +486,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa // To notify plugins that toolbar icons can be registered SCNotification scnN; scnN.nmhdr.code = NPPN_TBMODIFICATION; - scnN.nmhdr.hwndFrom = _hSelf; + scnN.nmhdr.hwndFrom = hwnd; scnN.nmhdr.idFrom = 0; _pluginsManager.notify(&scnN); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h index f035bef59..9cac03198 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h @@ -31,16 +31,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. class DockingDlgInterface : public StaticDialog { public: - DockingDlgInterface(): StaticDialog() {}; - DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {}; + DockingDlgInterface(): StaticDialog(), _HSource(NULL), _data(NULL),\ + _dlgID(-1), _isFloating(TRUE), _iDockedPos(0), _pluginName(TEXT("")) {}; + + DockingDlgInterface(int dlgID): StaticDialog(), _HSource(NULL), _data(NULL),\ + _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0), _pluginName(TEXT("")) {}; - virtual void init(HINSTANCE hInst, HWND parent) - { + virtual void init(HINSTANCE hInst, HWND parent) { StaticDialog::init(hInst, parent); TCHAR temp[MAX_PATH]; ::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH); _moduleName = PathFindFileName(temp); - } + }; void create(tTbData * data, bool isRTL = false){ StaticDialog::create(_dlgID, isRTL); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index f2f5d6b40..7f7079c5f 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -231,20 +231,20 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l } case WM_DESTROY: { - /* unregister window event hooking BEFORE EVERYTHING ELSE */ + // unregister window event hooking BEFORE EVERYTHING ELSE if (hWndServer == hwnd) { UnhookWindowsHookEx(gWinCallHook); gWinCallHook = NULL; hWndServer = NULL; } - /* destroy imagelist if it exists */ + // destroy imagelist if it exists if (_hImageList != NULL) { ::ImageList_Destroy(_hImageList); } - /* destroy containers */ + // destroy containers for (int i = _vContainer.size(); i > 0; i--) { _vContainer[i-1]->destroy(); @@ -265,13 +265,15 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l } return TRUE; } + case DMM_MOVE: { - Gripper* pGripper = new Gripper; + Gripper *pGripper = new Gripper; pGripper->init(_hInst, _hParent); - pGripper->startGrip((DockingCont*)lParam, this, pGripper); + pGripper->startGrip((DockingCont*)lParam, this); break; } + case DMM_MOVE_SPLITTER: { INT offset = (INT)wParam; diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index eef2952fc..0643983d3 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -104,11 +104,10 @@ Gripper::Gripper() } -void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes) +void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr) { _pDockMgr = pDockMgr; _pCont = pCont; - _pRes = pRes; _pDockMgr->getDockInfo(&_dockData); @@ -201,9 +200,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam) hookMouse = NULL; hookKeyboard = NULL; } - onButtonUp(); - ::DestroyWindow(_hSelf); return TRUE; } @@ -230,7 +227,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam) mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); ::SetWindowPos(_hParent, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); _pCont->focusClient(); - delete _pRes; + delete this; break; } default: diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.h b/PowerEditor/src/WinControls/DockingWnd/Gripper.h index e09ae961f..fd32eba9d 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.h +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.h @@ -50,7 +50,7 @@ public: _hParent = hParent; }; - void startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes); + void startGrip(DockingCont* pCont, DockingManager* pDockMgr); ~Gripper() { if (_hdc) { @@ -128,9 +128,6 @@ private: RECT _rcItem; TCITEM _tcItem; - // resource pointer of THIS class - void *_pRes; - HDC _hdc; HBITMAP _hbm; HBRUSH _hbrush;