Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kapilratnani committed Apr 23, 2011
0 parents commit 7a9802a
Show file tree
Hide file tree
Showing 27 changed files with 4,194 additions and 0 deletions.
77 changes: 77 additions & 0 deletions DockingFeature/Docking.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
this file is part of Function List Plugin for Notepad++
Copyright (C)2005 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 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.
*/

#ifndef DOCKING_H
#define DOCKING_H

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

// styles for containers
#define CAPTION_TOP TRUE
#define CAPTION_BOTTOM FALSE

// defines for docking manager
#define CONT_LEFT 0
#define CONT_RIGHT 1
#define CONT_TOP 2
#define CONT_BOTTOM 3
#define DOCKCONT_MAX 4

// mask params for plugins of internal dialogs
#define DWS_ICONTAB 0x00000001 // Icon for tabs are available
#define DWS_ICONBAR 0x00000002 // Icon for icon bar are available (currently not supported)
#define DWS_ADDINFO 0x00000004 // Additional information are in use
#define DWS_PARAMSALL (DWS_ICONTAB|DWS_ICONBAR|DWS_ADDINFO)

// default docking values for first call of plugin
#define DWS_DF_CONT_LEFT (CONT_LEFT << 28) // default docking on left
#define DWS_DF_CONT_RIGHT (CONT_RIGHT << 28) // default docking on right
#define DWS_DF_CONT_TOP (CONT_TOP << 28) // default docking on top
#define DWS_DF_CONT_BOTTOM (CONT_BOTTOM << 28) // default docking on bottom
#define DWS_DF_FLOATING 0x80000000 // default state is floating


typedef struct {
HWND hClient; // client Window Handle
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

// internal data, do not use !!!
RECT rcFloat; // floating position
int iPrevCont; // stores the privious container (toggling between float and dock)
const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin
} tTbData;


typedef struct {
HWND hWnd; // the docking manager wnd
RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs
} tDockMgr;


#define HIT_TEST_THICKNESS 20
#define SPLITTER_WIDTH 4


#endif // DOCKING_H
123 changes: 123 additions & 0 deletions DockingFeature/DockingDlgInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
this file is part of Function List Plugin for Notepad++
Copyright (C)2005 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 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.
*/

#ifndef DOCKINGDLGINTERFACE_H
#define DOCKINGDLGINTERFACE_H

#include "StaticDialog.h"
#include "dockingResource.h"
#include "Docking.h"
#include <shlwapi.h>


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

virtual void init(HINSTANCE hInst, HWND parent)
{
StaticDialog::init(hInst, parent);
::GetModuleFileName((HMODULE)hInst, _moduleName, MAX_PATH);
lstrcpy(_moduleName, PathFindFileName(_moduleName));
}

void create(tTbData * data, bool isRTL = false){
StaticDialog::create(_dlgID, isRTL);
::GetWindowText(_hSelf, _pluginName, sizeof(_pluginName));

// user information
data->hClient = _hSelf;
data->pszName = _pluginName;

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

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

};

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

virtual void destroy() {
};

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

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

protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{

case WM_NOTIFY:
{
LPNMHDR pnmh = (LPNMHDR)lParam;

if (pnmh->hwndFrom == _hParent)
{
switch (LOWORD(pnmh->code))
{
case DMN_CLOSE:
{
break;
}
case DMN_FLOAT:
{
_isFloating = true;
break;
}
case DMN_DOCK:
{
_isFloating = false;
break;
}
default:
break;
}
}
break;
}
default:
break;
}
return FALSE;
};

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

#endif // DOCKINGDLGINTERFACE_H
56 changes: 56 additions & 0 deletions DockingFeature/GoToLineDlg.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//this file is part of notepad++
//Copyright (C)2003 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 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.

#include "GoToLineDlg.h"
#include "PluginDefinition.h"

extern NppData nppData;

BOOL CALLBACK DemoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND :
{
switch (wParam)
{
case IDOK :
{
int line = getLine();
if (line != -1)
{
// Get the current scintilla
int which = -1;
::SendMessage(nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&which);
if (which == -1)
return FALSE;
HWND curScintilla = (which == 0)?nppData._scintillaMainHandle:nppData._scintillaSecondHandle;

::SendMessage(curScintilla, SCI_ENSUREVISIBLE, line-1, 0);
::SendMessage(curScintilla, SCI_GOTOLINE, line-1, 0);
}
return TRUE;
}
}
return FALSE;
}

default :
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
}
}

52 changes: 52 additions & 0 deletions DockingFeature/GoToLineDlg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//this file is part of notepad++
//Copyright (C)2003 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 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.

#ifndef GOTILINE_DLG_H
#define GOTILINE_DLG_H

#include "DockingDlgInterface.h"
#include "resource.h"

class DemoDlg : public DockingDlgInterface
{
public :
DemoDlg() : DockingDlgInterface(IDD_PLUGINGOLINE_DEMO){};

virtual void display(bool toShow = true) const {
DockingDlgInterface::display(toShow);
if (toShow)
::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
};

void setParent(HWND parent2set){
_hParent = parent2set;
};

protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);

private :

int getLine() const {
BOOL isSuccessful;
int line = ::GetDlgItemInt(_hSelf, ID_GOLINE_EDIT, &isSuccessful, FALSE);
return (isSuccessful?line:-1);
};

};

#endif //GOTILINE_DLG_H
Loading

0 comments on commit 7a9802a

Please sign in to comment.