mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
[NEW_FEATURE] Add new look and feel of Docking container.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@105 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
3412c5ce5d
commit
9768d7f0a5
@ -1393,7 +1393,8 @@ string Notepad_plus::getLangDesc(LangType langType, bool shortDesc)
|
||||
"Haskell", "Haskell",
|
||||
"Inno", "Inno Setup script",
|
||||
"Internal Search", "Internal Search",
|
||||
"CMAKEFILE", "CMAKEFILE"
|
||||
"CMAKEFILE", "CMAKEFILE",
|
||||
"YAML", "YAML Ain't Markup Language"
|
||||
};
|
||||
|
||||
int index = (int(langType)) * 2 + (shortDesc?0:1);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,8 @@ using namespace std;
|
||||
#define CHILD_STYLES (WS_CHILD|WS_VISIBLE)
|
||||
#define CHILD_EXSTYLES (0x00000000L)
|
||||
|
||||
#define MIN_TABWIDTH 24
|
||||
|
||||
|
||||
enum eMousePos {
|
||||
posOutside,
|
||||
@ -43,6 +45,14 @@ enum eMousePos {
|
||||
posClose
|
||||
};
|
||||
|
||||
/* some fix modify values for GUI */
|
||||
#define HIGH_CAPTION 18
|
||||
#define HIGH_TAB 20
|
||||
#define CAPTION_GAP 2
|
||||
#define CLOSEBTN_POS_LEFT 3
|
||||
#define CLOSEBTN_POS_TOP 3
|
||||
|
||||
|
||||
|
||||
|
||||
class DockingCont : public StaticDialog
|
||||
@ -76,7 +86,7 @@ public:
|
||||
};
|
||||
|
||||
tTbData* createToolbar(tTbData data, Window **ppWin);
|
||||
tTbData destroyToolbar(tTbData data);
|
||||
void removeToolbar(tTbData data);
|
||||
tTbData* findToolbarByWnd(HWND hClient);
|
||||
tTbData* findToolbarByName(char* pszName);
|
||||
|
||||
@ -95,8 +105,8 @@ public:
|
||||
};
|
||||
|
||||
void setActiveTb(tTbData* pTbData);
|
||||
void setActiveTb(int iItem);
|
||||
int getActiveTb(void);
|
||||
void setActiveTb(INT iItem);
|
||||
INT getActiveTb(void);
|
||||
tTbData* getDataOfActiveTb(void);
|
||||
vector<tTbData *> getDataOfAllTb(void) {
|
||||
return _vTbData;
|
||||
@ -110,7 +120,7 @@ public:
|
||||
return _isFloating;
|
||||
}
|
||||
|
||||
int getElementCnt(void) {
|
||||
INT getElementCnt(void) {
|
||||
return _vTbData.size();
|
||||
}
|
||||
|
||||
@ -128,8 +138,18 @@ public:
|
||||
|
||||
void focusClient(void);
|
||||
|
||||
void SetActive(BOOL bState) {
|
||||
_isActive = bState;
|
||||
updateCaption();
|
||||
};
|
||||
|
||||
void setTabStyle(const BOOL & bDrawOgLine) {
|
||||
_bDrawOgLine = bDrawOgLine;
|
||||
RedrawWindow(_hContTab, NULL, NULL, 0);
|
||||
};
|
||||
|
||||
virtual void destroy() {
|
||||
for (int iTb = _vTbData.size(); iTb > 0; iTb--)
|
||||
for (INT iTb = _vTbData.size(); iTb > 0; iTb--)
|
||||
{
|
||||
delete _vTbData[iTb-1];
|
||||
}
|
||||
@ -158,23 +178,27 @@ protected :
|
||||
void onSize(void);
|
||||
|
||||
/* functions for caption handling and drawing */
|
||||
eMousePos isInRect(HWND hwnd, int x, int y);
|
||||
eMousePos isInRect(HWND hwnd, INT x, INT y);
|
||||
|
||||
/* handling of toolbars */
|
||||
void doClose(void);
|
||||
|
||||
/* return new item */
|
||||
int SearchPosInTab(tTbData* pTbData);
|
||||
void SelectTab(int item);
|
||||
INT SearchPosInTab(tTbData* pTbData);
|
||||
void SelectTab(INT iTab);
|
||||
|
||||
int hideToolbar(tTbData* pTbData);
|
||||
INT hideToolbar(tTbData* pTbData, BOOL hideClient = TRUE);
|
||||
void viewToolbar(tTbData *pTbData);
|
||||
INT removeTab(tTbData* pTbData) {
|
||||
return hideToolbar(pTbData, FALSE);
|
||||
};
|
||||
|
||||
void updateCaption(void);
|
||||
LPARAM NotifyParent(UINT message);
|
||||
|
||||
private:
|
||||
/* handles */
|
||||
BOOL _isActive;
|
||||
bool _isFloating;
|
||||
HWND _hCaption;
|
||||
HWND _hContTab;
|
||||
@ -189,6 +213,9 @@ private:
|
||||
BOOL _isMouseClose;
|
||||
BOOL _isMouseOver;
|
||||
RECT _rcCaption;
|
||||
|
||||
/* tab style */
|
||||
BOOL _bDrawOgLine;
|
||||
|
||||
/* Important value for DlgMoving class */
|
||||
BOOL _dragFromTab;
|
||||
@ -204,6 +231,14 @@ private:
|
||||
BOOL _beginDrag;
|
||||
HIMAGELIST _hImageList;
|
||||
|
||||
/* Is tooltip */
|
||||
BOOL _bTabTTHover;
|
||||
INT _iLastHovered;
|
||||
|
||||
BOOL _bCaptionTT;
|
||||
BOOL _bCapTTHover;
|
||||
eMousePos _hoverMPos;
|
||||
|
||||
/* data of added windows */
|
||||
vector<tTbData *> _vTbData;
|
||||
};
|
||||
|
@ -19,12 +19,32 @@
|
||||
#include "DockingCont.h"
|
||||
#include "DockingManager.h"
|
||||
#include "Gripper.h"
|
||||
#include "windows.h"
|
||||
|
||||
#include <Oleacc.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
BOOL DockingManager::_isRegistered = FALSE;
|
||||
|
||||
static HWND hWndServer = NULL;
|
||||
static HWINEVENTHOOK gWinEvtHook = NULL;
|
||||
|
||||
/* Callback function that handles events */
|
||||
void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
|
||||
LONG idObject, LONG idChild,
|
||||
DWORD dwEventThread, DWORD dwmsEventTime)
|
||||
{
|
||||
IAccessible* pAcc = NULL;
|
||||
VARIANT varChild;
|
||||
HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
|
||||
if ((hr == S_OK) && (pAcc != NULL))
|
||||
{
|
||||
if (event == EVENT_OBJECT_FOCUS)
|
||||
{
|
||||
::SendMessage(hWndServer, DMM_LBUTTONUP, 0, (LPARAM)hwnd);
|
||||
}
|
||||
pAcc->Release();
|
||||
}
|
||||
}
|
||||
|
||||
DockingManager::DockingManager()
|
||||
{
|
||||
@ -94,6 +114,19 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
|
||||
throw int(777);
|
||||
}
|
||||
|
||||
/* register window event hooking */
|
||||
hWndServer = _hSelf;
|
||||
CoInitialize(NULL);
|
||||
gWinEvtHook = SetWinEventHook(
|
||||
EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, NULL,
|
||||
HandleWinEvent, 0, 0, WINEVENT_OUTOFCONTEXT);
|
||||
|
||||
if (!gWinEvtHook)
|
||||
{
|
||||
systemMessage("System Err");
|
||||
throw int(1000);
|
||||
}
|
||||
|
||||
setClientWnd(ppWin);
|
||||
|
||||
/* create docking container */
|
||||
@ -171,8 +204,26 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||
_vContainer[i-1]->destroy();
|
||||
delete _vContainer[i-1];
|
||||
}
|
||||
|
||||
/* unregister window event hooking */
|
||||
UnhookWinEvent(gWinEvtHook);
|
||||
CoUninitialize();
|
||||
break;
|
||||
}
|
||||
case DMM_LBUTTONUP:
|
||||
{
|
||||
if (::GetActiveWindow() != _hParent)
|
||||
break;
|
||||
|
||||
/* set respective activate state */
|
||||
for (int i = 0; i < DOCKCONT_MAX; i++)
|
||||
{
|
||||
_vContainer[i]->SetActive(
|
||||
IsChild(_vContainer[i]->getHSelf(), (HWND)lParam) &&
|
||||
(::GetFocus() == (HWND)lParam));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case DMM_MOVE:
|
||||
{
|
||||
Gripper* pGripper = new Gripper;
|
||||
@ -579,9 +630,6 @@ DockingCont* DockingManager::toggleActiveTb(DockingCont* pContSrc, UINT message,
|
||||
TbData.rcFloat = *prcFloat;
|
||||
}
|
||||
|
||||
/* remove toolbar from anywhere */
|
||||
TbData = _vContainer[iContSrc]->destroyToolbar(TbData);
|
||||
|
||||
if ((isCont == FALSE) || (bNew == TRUE))
|
||||
{
|
||||
/* find an empty container */
|
||||
@ -626,6 +674,9 @@ DockingCont* DockingManager::toggleActiveTb(DockingCont* pContSrc, UINT message,
|
||||
/* notify client app */
|
||||
SendNotify(TbData.hClient, MAKELONG(message==DMM_DOCK?DMN_DOCK:DMN_FLOAT, GetContainer(pContTgt)));
|
||||
|
||||
/* remove toolbar from source */
|
||||
_vContainer[iContSrc]->removeToolbar(TbData);
|
||||
|
||||
return pContTgt;
|
||||
}
|
||||
|
||||
@ -654,9 +705,6 @@ DockingCont* DockingManager::toggleVisTb(DockingCont* pContSrc, UINT message, LP
|
||||
TbData.rcFloat = *prcFloat;
|
||||
}
|
||||
|
||||
/* remove toolbar from anywhere */
|
||||
TbData = _vContainer[iContSrc]->destroyToolbar(TbData);
|
||||
|
||||
if (isCont == FALSE)
|
||||
{
|
||||
/* create new container */
|
||||
@ -682,6 +730,9 @@ DockingCont* DockingManager::toggleVisTb(DockingCont* pContSrc, UINT message, LP
|
||||
}
|
||||
|
||||
SendNotify(TbData.hClient, MAKELONG(message==DMM_DOCK?DMN_DOCK:DMN_FLOAT, GetContainer(pContTgt)));
|
||||
|
||||
/* remove toolbar from anywhere */
|
||||
_vContainer[iContSrc]->removeToolbar(TbData);
|
||||
}
|
||||
|
||||
_vContainer[iContPrev]->setActiveTb(pTbData);
|
||||
@ -718,9 +769,6 @@ void DockingManager::toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbD
|
||||
int iContSrc = GetContainer(pContSrc);
|
||||
int iContTgt = GetContainer(pContTgt);
|
||||
|
||||
/* remove toolbar from anywhere */
|
||||
TbData = _vContainer[iContSrc]->destroyToolbar(TbData);
|
||||
|
||||
/* test if container state changes from docking to floating or vice versa */
|
||||
if (((iContSrc < DOCKCONT_MAX) && (iContTgt >= DOCKCONT_MAX)) ||
|
||||
((iContSrc >= DOCKCONT_MAX) && (iContTgt < DOCKCONT_MAX)))
|
||||
@ -735,7 +783,11 @@ void DockingManager::toggleTb(DockingCont* pContSrc, DockingCont* pContTgt, tTbD
|
||||
else
|
||||
SendNotify(TbData.hClient, MAKELONG(DMN_FLOAT, iContTgt));
|
||||
|
||||
/* create new toolbar */
|
||||
pContTgt->createToolbar(TbData, _ppMainWindow);
|
||||
|
||||
/* remove toolbar from source */
|
||||
_vContainer[iContSrc]->removeToolbar(TbData);
|
||||
}
|
||||
|
||||
BOOL DockingManager::ContExists(size_t iCont)
|
||||
|
@ -134,6 +134,11 @@ public :
|
||||
_vContainer[CONT_BOTTOM]->setCaptionTop(captionOnTop);
|
||||
};
|
||||
|
||||
void setTabStyle(BOOL orangeLine) {
|
||||
for (size_t i = 0; i < _vContainer.size(); i++)
|
||||
_vContainer[i]->setTabStyle(orangeLine);
|
||||
};
|
||||
|
||||
int getDockedContSize(int iCont)
|
||||
{
|
||||
if ((iCont == CONT_TOP) || (iCont == CONT_BOTTOM))
|
||||
|
@ -523,6 +523,7 @@ void Gripper::doTabReordering(POINT pt)
|
||||
/* insert new entry when mouse doesn't point to current hovered tab */
|
||||
if ((_hTab != hTabOld) || (_iItem != iItemOld))
|
||||
{
|
||||
_tcItem.mask = TCIF_PARAM | (_hTab == _hTabSource ? TCIF_TEXT : 0);
|
||||
::SendMessage(_hTab, TCM_INSERTITEM, _iItem, (LPARAM)&_tcItem);
|
||||
}
|
||||
|
||||
|
@ -127,9 +127,9 @@ private:
|
||||
/* resource pointer of THIS class */
|
||||
void* _pRes;
|
||||
|
||||
HDC _hdc;
|
||||
HBITMAP _hbm;
|
||||
HBRUSH _hbrush;
|
||||
HDC _hdc;
|
||||
HBITMAP _hbm;
|
||||
HBRUSH _hbrush;
|
||||
|
||||
/* is class registered */
|
||||
static BOOL _isRegistered;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define DMM_DROPDATA (DMM_MSG + 10)
|
||||
#define DMM_MOVE_SPLITTER (DMM_MSG + 11)
|
||||
#define DMM_CANCEL_MOVE (DMM_MSG + 12)
|
||||
#define DMM_LBUTTONUP (DMM_MSG + 13)
|
||||
|
||||
#define DMN_FIRST 1050
|
||||
#define DMN_CLOSE (DMN_FIRST + 1)
|
||||
|
@ -155,7 +155,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib odbc32.lib odbccp32.lib"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib odbc32.lib odbccp32.lib Oleacc.lib"
|
||||
ShowProgress="2"
|
||||
OutputFile="$(OutDir)/notepad++.exe"
|
||||
Version="1.0"
|
||||
@ -375,6 +375,10 @@
|
||||
RelativePath="..\src\WinControls\ToolBar\ToolBar.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolTip\ToolTip.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\TrayIcon\trayIconControler.cpp"
|
||||
>
|
||||
@ -660,6 +664,10 @@
|
||||
RelativePath="..\src\WinControls\ToolBar\ToolBar.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolTip\ToolTip.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\TrayIcon\trayIconControler.h"
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user