Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions DockingFeature/Docking.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
/*
this file is part of Function List Plugin for Notepad++
Copyright (C)2005 Jens Lorenz <[email protected]>
// This file is part of Notepad++ project
// Copyright (C)2021 Don HO <[email protected]>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#pragma once

#ifndef DOCKING_H
#define DOCKING_H
#include <windows.h>

// ATTENTION : It's a part of interface header, so don't include the others header here

Expand Down Expand Up @@ -49,13 +48,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

typedef struct {
HWND hClient; // client Window Handle
TCHAR *pszName; // name of plugin (shown in window)
const TCHAR *pszName; // name of plugin (shown in window)
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID

// 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
Expand All @@ -73,5 +72,3 @@ typedef struct {
#define HIT_TEST_THICKNESS 20
#define SPLITTER_WIDTH 4


#endif // DOCKING_H
124 changes: 66 additions & 58 deletions DockingFeature/DockingDlgInterface.h
Original file line number Diff line number Diff line change
@@ -1,85 +1,102 @@
/*
this file is part of Function List Plugin for Notepad++
Copyright (C)2005 Jens Lorenz <[email protected]>
// This file is part of Notepad++ project
// Copyright (C)2006 Jens Lorenz <[email protected]>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#pragma once

#ifndef DOCKINGDLGINTERFACE_H
#define DOCKINGDLGINTERFACE_H

#include "StaticDialog.h"
#include "dockingResource.h"
#include "Docking.h"

#include <assert.h>
#include <shlwapi.h>
#include <string>
#include "StaticDialog.h"



class DockingDlgInterface : public StaticDialog
{
public:
DockingDlgInterface(): StaticDialog() {};
DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID) {};

virtual void init(HINSTANCE hInst, HWND parent)
{
DockingDlgInterface() = default;
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}

virtual void init(HINSTANCE hInst, HWND parent) {
StaticDialog::init(hInst, parent);
::GetModuleFileName((HMODULE)hInst, _moduleName, MAX_PATH);
lstrcpy(_moduleName, PathFindFileName(_moduleName));
TCHAR temp[MAX_PATH];
::GetModuleFileName(reinterpret_cast<HMODULE>(hInst), temp, MAX_PATH);
_moduleName = ::PathFindFileName(temp);
}

void create(tTbData * data, bool isRTL = false){
void create(tTbData* data, bool isRTL = false) {
assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL);
::GetWindowText(_hSelf, _pluginName, sizeof(_pluginName));
TCHAR temp[MAX_PATH];
::GetWindowText(_hSelf, temp, MAX_PATH);
_pluginName = temp;

// user information
data->hClient = _hSelf;
data->pszName = _pluginName;
data->hClient = _hSelf;
data->pszName = _pluginName.c_str();

// supported features by plugin
data->uMask = 0;
data->uMask = 0;

// additional info
data->pszAddInfo = NULL;
_data = data;

};
data->pszAddInfo = NULL;
}

virtual void updateDockingDlg(void) {
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf);
virtual void updateDockingDlg() {
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
}

virtual void destroy() {
};
virtual void destroy() {}

virtual void setBackgroundColor(COLORREF) {}
virtual void setForegroundColor(COLORREF) {}

virtual void display(bool toShow = true) const {
::SendMessage(_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0, (LPARAM)_hSelf);
};
::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
}

bool isClosed() const {
return _isClosed;
}

void setClosed(bool toClose) {
_isClosed = toClose;
}

const TCHAR * getPluginFileName() const {
return _moduleName;
};
return _moduleName.c_str();
}

protected :
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM /*wParam*/, LPARAM lParam)
{
switch (message)
int _dlgID = -1;
bool _isFloating = true;
int _iDockedPos = 0;
std::wstring _moduleName;
std::wstring _pluginName;
bool _isClosed = false;

virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam) {
switch (message)
{

case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;
LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);

if (pnmh->hwndFrom == _hParent)
{
Expand All @@ -96,6 +113,7 @@ protected :
}
case DMN_DOCK:
{
_iDockedPos = HIWORD(pnmh->code);
_isFloating = false;
break;
}
Expand All @@ -110,14 +128,4 @@ protected :
}
return FALSE;
};

// Handles
HWND _HSource;
tTbData* _data;
int _dlgID;
bool _isFloating;
TCHAR _moduleName[MAX_PATH];
TCHAR _pluginName[MAX_PATH];
};

#endif // DOCKINGDLGINTERFACE_H
Loading