parent
2aa85006d2
commit
c72dac69c5
|
@ -63,6 +63,10 @@ struct _gridhandlestruct
|
|||
COLORREF highlightcolorProtectNoFocus;
|
||||
COLORREF gridlinecolor;
|
||||
COLORREF highlighttextcolor;
|
||||
COLORREF backgroundcolor;
|
||||
COLORREF titletextcolor;
|
||||
COLORREF titlecolor;
|
||||
COLORREF titlegridlinecolor;
|
||||
BOOL DRAWHIGHLIGHT;
|
||||
BOOL ADVANCEROW;
|
||||
BOOL CURRENTCELLPROTECTED;
|
||||
|
@ -376,7 +380,7 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||
|
||||
|
||||
holdfont = (HFONT)SelectObject(gdc,hcolumnheadingfont);
|
||||
SetTextColor(gdc,BGHS[SI].textcolor);
|
||||
SetTextColor(gdc,BGHS[SI].titletextcolor);
|
||||
//display header row
|
||||
r=0;
|
||||
|
||||
|
@ -437,7 +441,18 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||
SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast<WPARAM>(&BGcell), reinterpret_cast<LPARAM>(buffer));
|
||||
|
||||
rectsave=rect;
|
||||
DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
||||
//DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
||||
HBRUSH hbrushtitle, holdbrushtitle;
|
||||
HPEN hpentitle, holdpentitle;
|
||||
hbrushtitle = CreateSolidBrush(BGHS[SI].titlecolor);
|
||||
hpentitle = CreatePen(PS_SOLID, 1, BGHS[SI].titlegridlinecolor);
|
||||
holdbrushtitle = (HBRUSH)SelectObject(gdc, hbrushtitle);
|
||||
holdpentitle = (HPEN)SelectObject(gdc, hpentitle);
|
||||
Rectangle(gdc, rect.left, rect.top, rect.right, rect.bottom);
|
||||
SelectObject(gdc, holdbrushtitle);
|
||||
SelectObject(gdc, holdpentitle);
|
||||
DeleteObject(hbrushtitle);
|
||||
DeleteObject(hpentitle);
|
||||
DrawTextEx(gdc,buffer,-1,&rect,DT_END_ELLIPSIS|DT_CENTER|DT_WORDBREAK|DT_NOPREFIX,NULL);
|
||||
rect=rectsave;
|
||||
|
||||
|
@ -456,12 +471,12 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||
}
|
||||
else
|
||||
{
|
||||
SetTextColor(gdc,RGB(0,0,0));//set black text for nonfocus grid hilight
|
||||
SetTextColor(gdc,BGHS[SI].textcolor);//set black text for nonfocus grid hilight
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextColor(gdc,RGB(0,0,0));
|
||||
SetTextColor(gdc,BGHS[SI].textcolor);
|
||||
}
|
||||
|
||||
rect.top = rect.bottom;
|
||||
|
@ -481,8 +496,19 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||
|
||||
if(c==0)
|
||||
{
|
||||
DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
||||
|
||||
//DrawEdge(gdc,&rect,EDGE_ETCHED,BF_MIDDLE|BF_RECT|BF_ADJUST);
|
||||
SetTextColor(gdc, BGHS[SI].titletextcolor);
|
||||
HBRUSH hbrush, holdbrush;
|
||||
HPEN hpen, holdpen;
|
||||
hbrush = CreateSolidBrush(BGHS[SI].titlecolor);
|
||||
hpen = CreatePen(PS_SOLID, 1, BGHS[SI].titlegridlinecolor);
|
||||
holdbrush = (HBRUSH)SelectObject(gdc, hbrush);
|
||||
holdpen = (HPEN)SelectObject(gdc, hpen);
|
||||
Rectangle(gdc, rect.left, rect.top, rect.right, rect.bottom);
|
||||
SelectObject(gdc, holdbrush);
|
||||
SelectObject(gdc, holdpen);
|
||||
DeleteObject(hbrush);
|
||||
DeleteObject(hpen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -626,20 +652,22 @@ void DisplayColumn(HWND hWnd,int SI,int c,int offset,HFONT hfont,HFONT hcolumnhe
|
|||
{
|
||||
//repaint bottom of grid
|
||||
RECT trect;
|
||||
HBRUSH holdbrush;
|
||||
HBRUSH holdbrush, hbrush;
|
||||
HPEN holdpen;
|
||||
GetClientRect(hWnd,&trect);
|
||||
trect.top = rect.bottom;
|
||||
trect.left = rect.left;
|
||||
trect.right = rect.right;
|
||||
|
||||
holdbrush=(HBRUSH)SelectObject(gdc,GetStockObject(GRAY_BRUSH));
|
||||
hbrush = CreateSolidBrush(BGHS[SI].backgroundcolor);
|
||||
holdbrush=(HBRUSH)SelectObject(gdc, hbrush);
|
||||
holdpen=(HPEN)SelectObject(gdc,GetStockObject(NULL_PEN));
|
||||
|
||||
Rectangle(gdc,trect.left,trect.top,trect.right+1,trect.bottom+1);
|
||||
|
||||
SelectObject(gdc,holdbrush);
|
||||
SelectObject(gdc,holdpen);
|
||||
DeleteObject(hbrush);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1251,6 +1279,10 @@ ATOM RegisterGridClass(HINSTANCE hInstance)
|
|||
BGHS[j].gridlinecolor = RGB(220,220,220);
|
||||
BGHS[j].highlighttextcolor = RGB(255,255,255);
|
||||
BGHS[j].textcolor = RGB(0,0,0);
|
||||
BGHS[j].backgroundcolor = GetSysColor(COLOR_BTNFACE);
|
||||
BGHS[j].titletextcolor = RGB(0,0,0);
|
||||
BGHS[j].titlecolor = GetSysColor(COLOR_BTNFACE);
|
||||
BGHS[j].titlegridlinecolor = RGB(120,120,120);
|
||||
BGHS[j].titleheight = 0;
|
||||
BGHS[j].EXTENDLASTCOLUMN = TRUE;
|
||||
BGHS[j].SHOWINTEGRALROWS = TRUE;
|
||||
|
@ -2093,6 +2125,46 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
case BGM_SETTEXTCOLOR:
|
||||
BGHS[SelfIndex].textcolor = (COLORREF)wParam;
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hWnd,&rect);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
case BGM_SETBACKGROUNDCOLOR:
|
||||
BGHS[SelfIndex].backgroundcolor = (COLORREF)wParam;
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hWnd,&rect);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
case BGM_SETTITLETEXTCOLOR:
|
||||
BGHS[SelfIndex].titletextcolor = (COLORREF)wParam;
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hWnd,&rect);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
case BGM_SETTITLECOLOR:
|
||||
BGHS[SelfIndex].titlecolor = (COLORREF)wParam;
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hWnd,&rect);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
case BGM_SETTITLEGRIDLINECOLOR:
|
||||
BGHS[SelfIndex].titlegridlinecolor = (COLORREF)wParam;
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect(hWnd,&rect);
|
||||
InvalidateRect(hWnd,&rect,FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
case BGM_SETELLIPSIS:
|
||||
BGHS[SelfIndex].ELLIPSIS = (BOOL)wParam;
|
||||
|
|
|
@ -95,6 +95,11 @@
|
|||
#define BGM_SETHILIGHTCOLOR_NOFOCUS BABYGRID_USER + 48
|
||||
#define BGM_SETHILIGHTCOLOR_PROTECT BABYGRID_USER + 49
|
||||
#define BGM_SETHILIGHTCOLOR_PROTECT_NOFOCUS BABYGRID_USER + 50
|
||||
#define BGM_SETTEXTCOLOR BABYGRID_USER + 51
|
||||
#define BGM_SETBACKGROUNDCOLOR BABYGRID_USER + 52
|
||||
#define BGM_SETTITLETEXTCOLOR BABYGRID_USER + 53
|
||||
#define BGM_SETTITLECOLOR BABYGRID_USER + 54
|
||||
#define BGM_SETTITLEGRIDLINECOLOR BABYGRID_USER + 55
|
||||
|
||||
struct _BGCELL {
|
||||
int row = 0;
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
class BabyGridWrapper : public Window
|
||||
{
|
||||
public :
|
||||
public:
|
||||
BabyGridWrapper() = default;
|
||||
~BabyGridWrapper() = default;
|
||||
~BabyGridWrapper() = default;
|
||||
|
||||
virtual void init(HINSTANCE hInst, HWND parent, int16_t id);
|
||||
virtual void destroy() {
|
||||
|
@ -44,10 +44,10 @@ public :
|
|||
};
|
||||
|
||||
void setColsNumbered(bool isNumbered = true) {
|
||||
::SendMessage(_hSelf, BGM_SETCOLSNUMBERED, isNumbered?TRUE:FALSE, 0);
|
||||
::SendMessage(_hSelf, BGM_SETCOLSNUMBERED, isNumbered ? TRUE : FALSE, 0);
|
||||
}
|
||||
|
||||
void setText(size_t row, size_t col, const TCHAR *text) {
|
||||
void setText(size_t row, size_t col, const TCHAR* text) {
|
||||
_BGCELL cell;
|
||||
cell.row = int(row);
|
||||
cell.col = int(col);
|
||||
|
@ -55,7 +55,7 @@ public :
|
|||
};
|
||||
|
||||
void makeColAutoWidth(bool autoWidth = true) {
|
||||
::SendMessage(_hSelf, BGM_SETCOLAUTOWIDTH, autoWidth?TRUE:FALSE, 0);
|
||||
::SendMessage(_hSelf, BGM_SETCOLAUTOWIDTH, autoWidth ? TRUE : FALSE, 0);
|
||||
};
|
||||
|
||||
int getSelectedRow() {
|
||||
|
@ -93,21 +93,57 @@ public :
|
|||
::SendMessage(_hSelf, WM_PAINT, 0, 0);
|
||||
};
|
||||
|
||||
void setTextColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETTEXTCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setBackgroundColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETBACKGROUNDCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setUnprotectColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETUNPROTECTCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setTitleTextColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETTITLETEXTCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setTitleColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETTITLECOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setTitleGridlinesColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETTITLEGRIDLINECOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setHighlightTextColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETHILIGHTTEXTCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setHighlightColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETHILIGHTCOLOR, color, 0);
|
||||
}
|
||||
|
||||
void setHighlightColorNoFocus(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETHILIGHTCOLOR_NOFOCUS, color, 0);
|
||||
};
|
||||
}
|
||||
|
||||
void setProtectColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETPROTECTCOLOR, color, 0);
|
||||
};
|
||||
}
|
||||
|
||||
void setHighlightColorProtect(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETHILIGHTCOLOR_PROTECT, color, 0);
|
||||
};
|
||||
}
|
||||
|
||||
void setHighlightColorProtectNoFocus(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETHILIGHTCOLOR_PROTECT_NOFOCUS, color, 0);
|
||||
};
|
||||
}
|
||||
|
||||
void setGridlinesColor(const COLORREF color) const {
|
||||
::SendMessage(_hSelf, BGM_SETGRIDLINECOLOR, color, 0);
|
||||
}
|
||||
|
||||
bool setMarker(const bool isMarker) const {
|
||||
::SendMessage(_hSelf, BGM_SETPROTECT, isMarker, 0);
|
||||
|
@ -122,11 +158,11 @@ public :
|
|||
::SendMessage(_hSelf, BGM_SETINITIALCONTENT, isInitialContent, 0);
|
||||
};
|
||||
|
||||
void setHeaderFont(const HFONT & hFont) const {
|
||||
void setHeaderFont(const HFONT& hFont) const {
|
||||
::SendMessage(_hSelf, BGM_SETHEADINGFONT, reinterpret_cast<WPARAM>(hFont), 0);
|
||||
};
|
||||
|
||||
void setRowFont(const HFONT & hFont) const {
|
||||
void setRowFont(const HFONT& hFont) const {
|
||||
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(hFont), 0);
|
||||
};
|
||||
|
||||
|
@ -138,7 +174,7 @@ public :
|
|||
::SendMessage(_hSelf, BGM_SETROWHEIGHT, rowHeight, 0);
|
||||
};
|
||||
|
||||
private :
|
||||
private:
|
||||
static bool _isRegistered;
|
||||
};
|
||||
|
||||
|
|
|
@ -136,10 +136,46 @@ void ShortcutMapper::initBabyGrid()
|
|||
_babygrid.setHeaderHeight(NppParameters::getInstance()._dpiManager.scaleY(21));
|
||||
_babygrid.setRowHeight(NppParameters::getInstance()._dpiManager.scaleY(21));
|
||||
|
||||
_babygrid.setHighlightColorNoFocus(RGB(200,200,210));
|
||||
_babygrid.setProtectColor(RGB(255,130,120));
|
||||
_babygrid.setHighlightColorProtect(RGB(244,10,20));
|
||||
_babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190));
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
_babygrid.setTextColor(NppDarkMode::getDarkerTextColor());
|
||||
_babygrid.setHighlightTextColor(NppDarkMode::getTextColor());
|
||||
_babygrid.setTitleTextColor(NppDarkMode::getTextColor());
|
||||
|
||||
_babygrid.setUnprotectColor(NppDarkMode::getBackgroundColor());
|
||||
_babygrid.setTitleColor(NppDarkMode::getBackgroundColor());
|
||||
|
||||
_babygrid.setBackgroundColor(NppDarkMode::getDarkerBackgroundColor());
|
||||
|
||||
_babygrid.setHighlightColor(NppDarkMode::getHotBackgroundColor());
|
||||
_babygrid.setHighlightColorNoFocus(NppDarkMode::getSofterBackgroundColor());
|
||||
_babygrid.setProtectColor(NppDarkMode::getErrorBackgroundColor());
|
||||
_babygrid.setHighlightColorProtect(RGB(244, 10, 20));
|
||||
_babygrid.setHighlightColorProtectNoFocus(RGB(230, 100, 110));
|
||||
|
||||
_babygrid.setGridlinesColor(NppDarkMode::getEdgeColor());
|
||||
_babygrid.setTitleGridlinesColor(NppDarkMode::getHotEdgeColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
_babygrid.setTextColor(RGB(0, 0, 0));
|
||||
_babygrid.setHighlightTextColor(RGB(255, 255, 255));
|
||||
_babygrid.setTitleTextColor(RGB(0, 0, 0));
|
||||
|
||||
_babygrid.setUnprotectColor(RGB(255, 255, 255));
|
||||
_babygrid.setTitleColor(::GetSysColor(COLOR_BTNFACE));
|
||||
|
||||
_babygrid.setBackgroundColor(::GetSysColor(COLOR_BTNFACE));
|
||||
|
||||
_babygrid.setHighlightColor(RGB(0, 0, 128));
|
||||
_babygrid.setHighlightColorNoFocus(RGB(200, 200, 210));
|
||||
_babygrid.setProtectColor(RGB(255, 130, 120));
|
||||
_babygrid.setHighlightColorProtect(RGB(244, 10, 20));
|
||||
_babygrid.setHighlightColorProtectNoFocus(RGB(230, 194, 190));
|
||||
|
||||
_babygrid.setGridlinesColor(RGB(220, 220, 220));
|
||||
_babygrid.setTitleGridlinesColor(RGB(120, 120, 120));
|
||||
}
|
||||
|
||||
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapper");
|
||||
|
|
Loading…
Reference in New Issue