mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
[CLEAN_UP] (Author : Jocelyn Legault) Initialize correctly the DockingDlgInterface. Clean up the docking manager's code.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@613 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
ccbdf7c210
commit
be8d467e91
@ -149,7 +149,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
_mainMenuHandle = ::GetMenu(_hSelf);
|
_mainMenuHandle = ::GetMenu(hwnd);
|
||||||
int langPos2BeRemoved = MENUINDEX_LANGUAGE+1;
|
int langPos2BeRemoved = MENUINDEX_LANGUAGE+1;
|
||||||
if (nppGUI._isLangMenuCompact)
|
if (nppGUI._isLangMenuCompact)
|
||||||
langPos2BeRemoved = MENUINDEX_LANGUAGE;
|
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_SETCARETWIDTH, 0, 0);
|
||||||
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
|
::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0);
|
||||||
|
|
||||||
_configStyleDlg.init(_hInst, _hSelf);
|
_configStyleDlg.init(_hInst, hwnd);
|
||||||
_preference.init(_hInst, _hSelf);
|
_preference.init(_hInst, hwnd);
|
||||||
|
|
||||||
//Marker Margin config
|
//Marker Margin config
|
||||||
_mainEditView.setMakerStyle(svp1._folderStyle);
|
_mainEditView.setMakerStyle(svp1._folderStyle);
|
||||||
@ -275,7 +275,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
//--Splitter Section--//
|
//--Splitter Section--//
|
||||||
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
|
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
|
||||||
|
|
||||||
_subSplitter.init(_hInst, _hSelf);
|
_subSplitter.init(_hInst, hwnd);
|
||||||
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, DYNAMIC, 50, isVertical);
|
_subSplitter.create(&_mainDocTab, &_subDocTab, 8, DYNAMIC, 50, isVertical);
|
||||||
|
|
||||||
//--Status Bar Section--//
|
//--Status Bar Section--//
|
||||||
@ -293,13 +293,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_dockingManager.init(_hInst, hwnd, &_pMainWindow);
|
_dockingManager.init(_hInst, hwnd, &_pMainWindow);
|
||||||
|
|
||||||
if (nppGUI._isMinimizedToTray && _pTrayIco == NULL)
|
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();
|
checkSyncState();
|
||||||
|
|
||||||
// Plugin Manager
|
// Plugin Manager
|
||||||
NppData nppData;
|
NppData nppData;
|
||||||
nppData._nppHandle = _hSelf;
|
nppData._nppHandle = hwnd;
|
||||||
nppData._scintillaMainHandle = _mainEditView.getHSelf();
|
nppData._scintillaMainHandle = _mainEditView.getHSelf();
|
||||||
nppData._scintillaSecondHandle = _subEditView.getHSelf();
|
nppData._scintillaSecondHandle = _subEditView.getHSelf();
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
if (appDataNpp[0])
|
if (appDataNpp[0])
|
||||||
_pluginsManager.loadPlugins(appDataNpp);
|
_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]._cmdID = cmdID;
|
||||||
nppGUI._excludedLangList[i]._langName = itemName;
|
nppGUI._excludedLangList[i]._langName = itemName;
|
||||||
::DeleteMenu(hLangMenu, cmdID, MF_BYCOMMAND);
|
::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();
|
pNppParam->reloadPluginCmds();
|
||||||
|
|
||||||
// Shortcut Accelerator : should be the last one since it will capture all the shortcuts
|
// 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);
|
pNppParam->setAccelerator(&_accelerator);
|
||||||
|
|
||||||
// Scintilla key accelerator
|
// Scintilla key accelerator
|
||||||
vector<HWND> scints;
|
vector<HWND> scints;
|
||||||
scints.push_back(_mainEditView.getHSelf());
|
scints.push_back(_mainEditView.getHSelf());
|
||||||
scints.push_back(_subEditView.getHSelf());
|
scints.push_back(_subEditView.getHSelf());
|
||||||
_scintaccelerator.init(&scints, _mainMenuHandle, _hSelf);
|
_scintaccelerator.init(&scints, _mainMenuHandle, hwnd);
|
||||||
|
|
||||||
pNppParam->setScintillaAccelerator(&_scintaccelerator);
|
pNppParam->setScintillaAccelerator(&_scintaccelerator);
|
||||||
_scintaccelerator.updateKeys();
|
_scintaccelerator.updateKeys();
|
||||||
|
|
||||||
::DrawMenuBar(_hSelf);
|
::DrawMenuBar(hwnd);
|
||||||
|
|
||||||
|
|
||||||
//-- Tool Bar Section --//
|
//-- 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
|
// To notify plugins that toolbar icons can be registered
|
||||||
SCNotification scnN;
|
SCNotification scnN;
|
||||||
scnN.nmhdr.code = NPPN_TBMODIFICATION;
|
scnN.nmhdr.code = NPPN_TBMODIFICATION;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
scnN.nmhdr.hwndFrom = hwnd;
|
||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
|
@ -31,16 +31,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||||||
class DockingDlgInterface : public StaticDialog
|
class DockingDlgInterface : public StaticDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DockingDlgInterface(): StaticDialog() {};
|
DockingDlgInterface(): StaticDialog(), _HSource(NULL), _data(NULL),\
|
||||||
DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0) {};
|
_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);
|
StaticDialog::init(hInst, parent);
|
||||||
TCHAR temp[MAX_PATH];
|
TCHAR temp[MAX_PATH];
|
||||||
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
|
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
|
||||||
_moduleName = PathFindFileName(temp);
|
_moduleName = PathFindFileName(temp);
|
||||||
}
|
};
|
||||||
|
|
||||||
void create(tTbData * data, bool isRTL = false){
|
void create(tTbData * data, bool isRTL = false){
|
||||||
StaticDialog::create(_dlgID, isRTL);
|
StaticDialog::create(_dlgID, isRTL);
|
||||||
|
@ -231,20 +231,20 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
/* unregister window event hooking BEFORE EVERYTHING ELSE */
|
// unregister window event hooking BEFORE EVERYTHING ELSE
|
||||||
if (hWndServer == hwnd) {
|
if (hWndServer == hwnd) {
|
||||||
UnhookWindowsHookEx(gWinCallHook);
|
UnhookWindowsHookEx(gWinCallHook);
|
||||||
gWinCallHook = NULL;
|
gWinCallHook = NULL;
|
||||||
hWndServer = NULL;
|
hWndServer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy imagelist if it exists */
|
// destroy imagelist if it exists
|
||||||
if (_hImageList != NULL)
|
if (_hImageList != NULL)
|
||||||
{
|
{
|
||||||
::ImageList_Destroy(_hImageList);
|
::ImageList_Destroy(_hImageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy containers */
|
// destroy containers
|
||||||
for (int i = _vContainer.size(); i > 0; i--)
|
for (int i = _vContainer.size(); i > 0; i--)
|
||||||
{
|
{
|
||||||
_vContainer[i-1]->destroy();
|
_vContainer[i-1]->destroy();
|
||||||
@ -265,13 +265,15 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DMM_MOVE:
|
case DMM_MOVE:
|
||||||
{
|
{
|
||||||
Gripper* pGripper = new Gripper;
|
Gripper *pGripper = new Gripper;
|
||||||
pGripper->init(_hInst, _hParent);
|
pGripper->init(_hInst, _hParent);
|
||||||
pGripper->startGrip((DockingCont*)lParam, this, pGripper);
|
pGripper->startGrip((DockingCont*)lParam, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DMM_MOVE_SPLITTER:
|
case DMM_MOVE_SPLITTER:
|
||||||
{
|
{
|
||||||
INT offset = (INT)wParam;
|
INT offset = (INT)wParam;
|
||||||
|
@ -104,11 +104,10 @@ Gripper::Gripper()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes)
|
void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr)
|
||||||
{
|
{
|
||||||
_pDockMgr = pDockMgr;
|
_pDockMgr = pDockMgr;
|
||||||
_pCont = pCont;
|
_pCont = pCont;
|
||||||
_pRes = pRes;
|
|
||||||
|
|
||||||
_pDockMgr->getDockInfo(&_dockData);
|
_pDockMgr->getDockInfo(&_dockData);
|
||||||
|
|
||||||
@ -201,9 +200,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
hookMouse = NULL;
|
hookMouse = NULL;
|
||||||
hookKeyboard = NULL;
|
hookKeyboard = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
onButtonUp();
|
onButtonUp();
|
||||||
|
|
||||||
::DestroyWindow(_hSelf);
|
::DestroyWindow(_hSelf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -230,7 +227,7 @@ LRESULT Gripper::runProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
|
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
|
||||||
::SetWindowPos(_hParent, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
::SetWindowPos(_hParent, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
|
||||||
_pCont->focusClient();
|
_pCont->focusClient();
|
||||||
delete _pRes;
|
delete this;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
_hParent = hParent;
|
_hParent = hParent;
|
||||||
};
|
};
|
||||||
|
|
||||||
void startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes);
|
void startGrip(DockingCont* pCont, DockingManager* pDockMgr);
|
||||||
|
|
||||||
~Gripper() {
|
~Gripper() {
|
||||||
if (_hdc) {
|
if (_hdc) {
|
||||||
@ -128,9 +128,6 @@ private:
|
|||||||
RECT _rcItem;
|
RECT _rcItem;
|
||||||
TCITEM _tcItem;
|
TCITEM _tcItem;
|
||||||
|
|
||||||
// resource pointer of THIS class
|
|
||||||
void *_pRes;
|
|
||||||
|
|
||||||
HDC _hdc;
|
HDC _hdc;
|
||||||
HBITMAP _hbm;
|
HBITMAP _hbm;
|
||||||
HBRUSH _hbrush;
|
HBRUSH _hbrush;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user