mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ try: dark mode for toolbar trial 2
This commit is contained in:
parent
1178fc0b8b
commit
9d3b0185fd
@ -52,13 +52,13 @@ extern "C" WININFO g_DefWinInfo;
|
||||
extern "C" const WCHAR* const TBBUTTON_DEFAULT_IDS_V1;
|
||||
extern "C" const WCHAR* const TBBUTTON_DEFAULT_IDS_V2;
|
||||
|
||||
extern "C" bool s_iStatusbarVisible[STATUS_SECTOR_COUNT];
|
||||
extern "C" int s_iStatusbarWidthSpec[STATUS_SECTOR_COUNT];
|
||||
extern "C" int s_vSBSOrder[STATUS_SECTOR_COUNT];
|
||||
extern "C" bool g_iStatusbarVisible[STATUS_SECTOR_COUNT];
|
||||
extern "C" int g_iStatusbarWidthSpec[STATUS_SECTOR_COUNT];
|
||||
extern "C" int g_vSBSOrder[STATUS_SECTOR_COUNT];
|
||||
|
||||
extern "C" WCHAR s_tchToolbarBitmap[MAX_PATH];
|
||||
extern "C" WCHAR s_tchToolbarBitmapHot[MAX_PATH];
|
||||
extern "C" WCHAR s_tchToolbarBitmapDisabled[MAX_PATH];
|
||||
extern "C" WCHAR g_tchToolbarBitmap[MAX_PATH];
|
||||
extern "C" WCHAR g_tchToolbarBitmapHot[MAX_PATH];
|
||||
extern "C" WCHAR g_tchToolbarBitmapDisabled[MAX_PATH];
|
||||
|
||||
extern "C" THEMEFILES Theme_Files[];
|
||||
|
||||
@ -1513,19 +1513,19 @@ void LoadSettings()
|
||||
ReadVectorFromString(tchStatusBar, s_iStatusbarSections, STATUS_SECTOR_COUNT, 0, (STATUS_SECTOR_COUNT - 1), -1, false);
|
||||
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
for (bool& sbv : s_iStatusbarVisible) { sbv = false; }
|
||||
for (bool& sbv : g_iStatusbarVisible) { sbv = false; }
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
s_vSBSOrder[i] = -1;
|
||||
g_vSBSOrder[i] = -1;
|
||||
int const id = s_iStatusbarSections[i];
|
||||
if (id >= 0) {
|
||||
s_vSBSOrder[cnt++] = id;
|
||||
s_iStatusbarVisible[id] = true;
|
||||
g_vSBSOrder[cnt++] = id;
|
||||
g_iStatusbarVisible[id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
IniSectionGetString(StatusBar_Section, L"SectionWidthSpecs", STATUSBAR_SECTION_WIDTH_SPECS, tchStatusBar, COUNTOF(tchStatusBar));
|
||||
ReadVectorFromString(tchStatusBar, s_iStatusbarWidthSpec, STATUS_SECTOR_COUNT, -4096, 4096, 0, false);
|
||||
ReadVectorFromString(tchStatusBar, g_iStatusbarWidthSpec, STATUS_SECTOR_COUNT, -4096, 4096, 0, false);
|
||||
|
||||
Globals.bZeroBasedColumnIndex = IniSectionGetBool(StatusBar_Section, L"ZeroBasedColumnIndex", false);
|
||||
Globals.bZeroBasedCharacterCount = IniSectionGetBool(StatusBar_Section, L"ZeroBasedCharacterCount", false);
|
||||
@ -1536,11 +1536,11 @@ void LoadSettings()
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
IniSectionGetString(ToolbarImg_Section, L"BitmapDefault", L"",
|
||||
s_tchToolbarBitmap, COUNTOF(s_tchToolbarBitmap));
|
||||
g_tchToolbarBitmap, COUNTOF(g_tchToolbarBitmap));
|
||||
IniSectionGetString(ToolbarImg_Section, L"BitmapHot", L"",
|
||||
s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmap));
|
||||
g_tchToolbarBitmapHot, COUNTOF(g_tchToolbarBitmap));
|
||||
IniSectionGetString(ToolbarImg_Section, L"BitmapDisabled", L"",
|
||||
s_tchToolbarBitmapDisabled, COUNTOF(s_tchToolbarBitmap));
|
||||
g_tchToolbarBitmapDisabled, COUNTOF(g_tchToolbarBitmap));
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -1555,7 +1555,7 @@ void LoadSettings()
|
||||
|
||||
Defaults.ToolBarTheme = -1;
|
||||
Settings.ToolBarTheme = IniSectionGetInt(IniSecWindow, tchHighDpiToolBar, Defaults.ToolBarTheme);
|
||||
Settings.ToolBarTheme = clampi(Settings.ToolBarTheme, -1, StrIsEmpty(s_tchToolbarBitmap) ? 1 : 2);
|
||||
Settings.ToolBarTheme = clampi(Settings.ToolBarTheme, -1, StrIsEmpty(g_tchToolbarBitmap) ? 1 : 2);
|
||||
|
||||
StringCchPrintf(tchHighDpiToolBar, COUNTOF(tchHighDpiToolBar), L"%ix%i DpiScaleToolBar", ResX, ResY);
|
||||
Defaults.DpiScaleToolBar = false;
|
||||
|
||||
@ -5589,7 +5589,7 @@ static LRESULT CALLBACK EditBoxForPasteFixes(HWND hwnd, UINT uMsg, WPARAM wParam
|
||||
//
|
||||
// EditFindReplaceDlgProc()
|
||||
//
|
||||
extern int s_flagMatchText;
|
||||
extern int g_flagMatchText;
|
||||
|
||||
static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
@ -5613,7 +5613,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
// clear cmd line stuff
|
||||
s_flagMatchText = 0;
|
||||
g_flagMatchText = 0;
|
||||
sg_pefrData = NULL;
|
||||
|
||||
// the global static Find/Replace data structure
|
||||
|
||||
220
src/Notepad3.c
220
src/Notepad3.c
@ -52,7 +52,7 @@
|
||||
//
|
||||
// ============================================================================
|
||||
|
||||
HBRUSH s_hbrWndDarkBackground = NULL;
|
||||
HBRUSH s_hbrWndDarkBackground = NULL; // GetSysColorBrush(COLOR_WINDOW);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -101,15 +101,15 @@ COLORREF g_colorCustom[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
prefix_t g_mxSBPrefix[STATUS_SECTOR_COUNT];
|
||||
prefix_t g_mxSBPostfix[STATUS_SECTOR_COUNT];
|
||||
|
||||
bool s_iStatusbarVisible[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
int s_iStatusbarWidthSpec[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
int s_vSBSOrder[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
|
||||
bool g_iStatusbarVisible[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
int g_iStatusbarWidthSpec[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
int g_vSBSOrder[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
|
||||
|
||||
WCHAR s_tchToolbarBitmap[MAX_PATH] = { L'\0' };
|
||||
WCHAR s_tchToolbarBitmapHot[MAX_PATH] = { L'\0' };
|
||||
WCHAR s_tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' };
|
||||
WCHAR g_tchToolbarBitmap[MAX_PATH] = { L'\0' };
|
||||
WCHAR g_tchToolbarBitmapHot[MAX_PATH] = { L'\0' };
|
||||
WCHAR g_tchToolbarBitmapDisabled[MAX_PATH] = { L'\0' };
|
||||
|
||||
int s_flagMatchText = 0;
|
||||
int g_flagMatchText = 0;
|
||||
|
||||
// ------------------------------------
|
||||
static bool s_bIsProcessElevated = false;
|
||||
@ -173,6 +173,8 @@ static te_xint_t s_iExprError = -1;
|
||||
|
||||
static WIN32_FIND_DATA s_fdCurFile;
|
||||
|
||||
//~static CONST WCHAR *const s_ToolbarWndClassName = L"NP3_TOOLBAR_CLASS";
|
||||
|
||||
static int const INISECTIONBUFCNT = 32; // .ini file load buffer in KB
|
||||
|
||||
static TBBUTTON s_tbbMainWnd[] = {
|
||||
@ -768,6 +770,7 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized)
|
||||
OleUninitialize();
|
||||
|
||||
if (bIsInitialized) {
|
||||
//~UnregisterClass(s_ToolbarWndClassName, Globals.hInstance);
|
||||
UnregisterClass(s_wchWndClass, Globals.hInstance);
|
||||
}
|
||||
|
||||
@ -1235,18 +1238,18 @@ static void SetFindReplaceData()
|
||||
CopyFindPatternMB(Settings.EFR_Data.szFind, COUNTOF(Settings.EFR_Data.szFind));
|
||||
}
|
||||
|
||||
if (s_flagMatchText) // cmd line
|
||||
if (g_flagMatchText) // cmd line
|
||||
{
|
||||
if (s_flagMatchText & 4) {
|
||||
if (g_flagMatchText & 4) {
|
||||
s_FindReplaceData.fuFlags = (SCFIND_REGEXP | SCFIND_POSIX);
|
||||
}
|
||||
if (s_flagMatchText & 8) {
|
||||
if (g_flagMatchText & 8) {
|
||||
s_FindReplaceData.fuFlags |= SCFIND_MATCHCASE;
|
||||
}
|
||||
if (s_flagMatchText & 16) {
|
||||
if (g_flagMatchText & 16) {
|
||||
s_FindReplaceData.fuFlags |= SCFIND_DOT_MATCH_ALL;
|
||||
}
|
||||
if (s_flagMatchText & 32) {
|
||||
if (g_flagMatchText & 32) {
|
||||
s_FindReplaceData.bTransformBS = true;
|
||||
}
|
||||
s_FindReplaceData.bOverlappingFind = false;
|
||||
@ -1286,7 +1289,7 @@ static bool SetCurrentSelAsFindReplaceData()
|
||||
// InitApplication()
|
||||
//
|
||||
//
|
||||
bool InitApplication(HINSTANCE hInstance)
|
||||
bool InitApplication(const HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
ZeroMemory(&wc, sizeof(WNDCLASSEX));
|
||||
@ -1298,19 +1301,52 @@ bool InitApplication(HINSTANCE hInstance)
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = Globals.hDlgIcon256;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW); //(HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.hbrBackground = s_hbrWndDarkBackground; // @@@ §§§ // GetSysColorBrush(COLOR_WINDOW); //(HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MUI_MAINMENU);
|
||||
wc.lpszClassName = s_wchWndClass;
|
||||
|
||||
return RegisterClassEx(&wc);
|
||||
}
|
||||
|
||||
#if 0
|
||||
//=============================================================================
|
||||
//
|
||||
// InitToolbarWndClass()
|
||||
//
|
||||
//
|
||||
bool InitToolbarWndClass(const HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX tbc;
|
||||
static bool bIsIntialized = false;
|
||||
if (bIsIntialized) {
|
||||
UnregisterClass(s_ToolbarWndClassName, hInstance);
|
||||
}
|
||||
ZeroMemory(&tbc, sizeof(WNDCLASSEX));
|
||||
tbc.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
GetClassInfoEx(hInstance, TOOLBARCLASSNAME, &tbc); // copy members
|
||||
|
||||
tbc.style |= TBSTYLE_TRANSPARENT;
|
||||
//~tbc.lpfnWndProc = (WNDPROC)TBWndProc; ~ don't do that
|
||||
//~tbc.cbClsExtra = 0;
|
||||
//~tbc.cbWndExtra = 0;
|
||||
// tbc.hInstance = hInstance; // done already
|
||||
// tbc.hIcon = Globals.hDlgIcon; // no need
|
||||
tbc.hCursor = LoadCursor(NULL, IDC_HAND);
|
||||
tbc.hbrBackground = s_hbrWndDarkBackground; // @@@ §§§ // GetSysColorBrush(COLOR_WINDOW); //(HBRUSH)(COLOR_WINDOW + 1);
|
||||
//~tbc.lpszMenuName = MAKEINTRESOURCE(IDR_MUI_POPUPMENU);
|
||||
tbc.lpszClassName = s_ToolbarWndClassName;
|
||||
|
||||
bIsIntialized = true;
|
||||
return RegisterClassEx(&tbc);
|
||||
}
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// InitInstance()
|
||||
//
|
||||
HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
|
||||
HWND InitInstance(const HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow)
|
||||
{
|
||||
UNUSED(pszCmdLine);
|
||||
|
||||
@ -1350,10 +1386,6 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
|
||||
SetWindowTransparentMode(Globals.hwndMain, true, Settings2.OpacityLevel);
|
||||
}
|
||||
|
||||
if (g_IniWinInfo.zoom) {
|
||||
SciCall_SetZoom(g_IniWinInfo.zoom);
|
||||
}
|
||||
|
||||
SetMenu(Globals.hwndMain, Globals.hMainMenu);
|
||||
SetMenu(Globals.hwndMain, (Settings.ShowMenubar ? Globals.hMainMenu : NULL));
|
||||
DrawMenuBar(Globals.hwndMain);
|
||||
@ -1511,13 +1543,13 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
|
||||
}
|
||||
|
||||
// Match Text
|
||||
if (s_flagMatchText && !IsFindPatternEmpty())
|
||||
if (g_flagMatchText && !IsFindPatternEmpty())
|
||||
{
|
||||
if (!Sci_IsDocEmpty()) {
|
||||
|
||||
SetFindReplaceData(); // s_FindReplaceData
|
||||
|
||||
if (s_flagMatchText & 2) {
|
||||
if (g_flagMatchText & 2) {
|
||||
if (!s_flagJumpTo) { SciCall_DocumentEnd(); }
|
||||
EditFindPrev(Globals.hwndEdit,&s_FindReplaceData,false,false);
|
||||
}
|
||||
@ -2178,6 +2210,10 @@ LRESULT MsgCreate(HWND hwnd, WPARAM wParam,LPARAM lParam)
|
||||
|
||||
ObserveNotifyChangeEvent();
|
||||
|
||||
if (g_IniWinInfo.zoom) {
|
||||
SciCall_SetZoom(g_IniWinInfo.zoom);
|
||||
}
|
||||
|
||||
return 0LL;
|
||||
}
|
||||
|
||||
@ -2219,38 +2255,38 @@ bool SelectExternalToolBar(HWND hwnd)
|
||||
StringCchCat(szFile, COUNTOF(szFile), L" ");
|
||||
StringCchCat(szFile, COUNTOF(szFile), szArg2);
|
||||
}
|
||||
PathRelativeToApp(szFile, s_tchToolbarBitmap, COUNTOF(s_tchToolbarBitmap), true,true, true);
|
||||
PathRelativeToApp(szFile, g_tchToolbarBitmap, COUNTOF(g_tchToolbarBitmap), true,true, true);
|
||||
if (Globals.bCanSaveIniFile) {
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapDefault", s_tchToolbarBitmap);
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapDefault", g_tchToolbarBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrIsNotEmpty(s_tchToolbarBitmap))
|
||||
if (StrIsNotEmpty(g_tchToolbarBitmap))
|
||||
{
|
||||
StringCchCopy(szFile, COUNTOF(szFile), s_tchToolbarBitmap);
|
||||
StringCchCopy(szFile, COUNTOF(szFile), g_tchToolbarBitmap);
|
||||
PathRemoveExtension(szFile);
|
||||
StringCchCat(szFile, COUNTOF(szFile), L"Hot.bmp");
|
||||
if (Globals.bCanSaveIniFile) {
|
||||
if (PathIsExistingFile(szFile)) {
|
||||
PathRelativeToApp(szFile, s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), true, true, true);
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapHot", s_tchToolbarBitmapHot);
|
||||
PathRelativeToApp(szFile, g_tchToolbarBitmapHot, COUNTOF(g_tchToolbarBitmapHot), true, true, true);
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapHot", g_tchToolbarBitmapHot);
|
||||
}
|
||||
else {
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
StringCchCopy(g_tchToolbarBitmapHot, COUNTOF(g_tchToolbarBitmapHot), L"");
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapHot", false);
|
||||
}
|
||||
}
|
||||
|
||||
StringCchCopy(szFile, COUNTOF(szFile), s_tchToolbarBitmap);
|
||||
StringCchCopy(szFile, COUNTOF(szFile), g_tchToolbarBitmap);
|
||||
PathRemoveExtension(szFile);
|
||||
StringCchCat(szFile, COUNTOF(szFile), L"Disabled.bmp");
|
||||
if (Globals.bCanSaveIniFile) {
|
||||
if (PathIsExistingFile(szFile)) {
|
||||
PathRelativeToApp(szFile, s_tchToolbarBitmapDisabled, COUNTOF(s_tchToolbarBitmapDisabled), true, true, true);
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", s_tchToolbarBitmapDisabled);
|
||||
PathRelativeToApp(szFile, g_tchToolbarBitmapDisabled, COUNTOF(g_tchToolbarBitmapDisabled), true, true, true);
|
||||
IniFileSetString(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", g_tchToolbarBitmapDisabled);
|
||||
}
|
||||
else {
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
StringCchCopy(g_tchToolbarBitmapHot, COUNTOF(g_tchToolbarBitmapHot), L"");
|
||||
IniFileDelete(Globals.IniFile, L"Toolbar Images", L"BitmapDisabled", false);
|
||||
}
|
||||
}
|
||||
@ -2340,6 +2376,14 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
|
||||
}
|
||||
|
||||
|
||||
//==== Toolbar Style ==========================================================
|
||||
#define NP3_WS_TOOLBAR (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | \
|
||||
TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | TBSTYLE_ALTDRAG | TBSTYLE_LIST | \
|
||||
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_ADJUSTABLE)
|
||||
|
||||
//==== ReBar Style ============================================================
|
||||
#define NP3_WS_REBAR (WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | RBS_VARHEIGHT | \
|
||||
RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NOPARENTALIGN)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
@ -2348,7 +2392,8 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
|
||||
//
|
||||
void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
{
|
||||
DWORD dwToolbarStyle = NP3_WS_TOOLBAR;
|
||||
DWORD dwToolbarStyle = NP3_WS_TOOLBAR | TBSTYLE_TRANSPARENT;
|
||||
DWORD dwToolbarExStyle = TBSTYLE_EX_DOUBLEBUFFER /* | TBSTYLE_EX_HIDECLIPPEDBUTTONS */;
|
||||
|
||||
if (Settings.ToolBarTheme < 0) { // undefined: determine High DPI screen
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
@ -2370,8 +2415,19 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
OpenSettingsFile(&bOpendByMe);
|
||||
bool bDirtyFlag = false;
|
||||
|
||||
Globals.hwndToolbar = CreateWindowEx(0,TOOLBARCLASSNAME,NULL,dwToolbarStyle,
|
||||
0,0,0,0,hwnd,(HMENU)IDC_TOOLBAR,hInstance,NULL);
|
||||
//InitToolbarWndClass(hInstance);
|
||||
Globals.hwndToolbar = CreateWindowEx(dwToolbarExStyle, TOOLBARCLASSNAME, NULL, dwToolbarStyle,
|
||||
0,0,0,0,hwnd,(HMENU)IDC_TOOLBAR,hInstance,NULL);
|
||||
//Globals.hwndToolbar = CreateWindowEx(
|
||||
// dwToolbarExStyle, // no extended styles
|
||||
// s_ToolbarWndClassName, // name of status bar class
|
||||
// (PCTSTR)NULL, // no text when first created
|
||||
// dwToolbarStyle, // creates a visible child window
|
||||
// 0, 0, 0, 0, // ignores size and position
|
||||
// hwnd, // handle to parent window
|
||||
// (HMENU)IDC_TOOLBAR, // child window identifier
|
||||
// hInstance, // handle to application instance
|
||||
// NULL); // no window creation data
|
||||
|
||||
//~InitWindowCommon(Globals.hwndToolbar, true); ~ SetWindowLayoutRTL() no correct behavior
|
||||
//~SetWindowTheme(Globals.hwndToolbar, L"", L""); // you cannot change a toolbar's color when a visual style is active
|
||||
@ -2396,11 +2452,11 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
HBITMAP hbmp = NULL;
|
||||
HBITMAP hbmpCopy = NULL;
|
||||
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(s_tchToolbarBitmap))
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(g_tchToolbarBitmap))
|
||||
{
|
||||
hbmp = LoadBitmapFile(s_tchToolbarBitmap);
|
||||
hbmp = LoadBitmapFile(g_tchToolbarBitmap);
|
||||
if (!hbmp) {
|
||||
StringCchCopy(s_tchToolbarBitmap, COUNTOF(s_tchToolbarBitmap), L"");
|
||||
StringCchCopy(g_tchToolbarBitmap, COUNTOF(g_tchToolbarBitmap), L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDefault", false);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
@ -2425,11 +2481,11 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
// --------------------------
|
||||
// Add a Hot Toolbar Bitmap
|
||||
// --------------------------
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(s_tchToolbarBitmapHot))
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(g_tchToolbarBitmapHot))
|
||||
{
|
||||
hbmp = LoadBitmapFile(s_tchToolbarBitmapHot);
|
||||
hbmp = LoadBitmapFile(g_tchToolbarBitmapHot);
|
||||
if (!hbmp) {
|
||||
StringCchCopy(s_tchToolbarBitmapHot, COUNTOF(s_tchToolbarBitmapHot), L"");
|
||||
StringCchCopy(g_tchToolbarBitmapHot, COUNTOF(g_tchToolbarBitmapHot), L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapHot", false);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
@ -2455,11 +2511,11 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
// ------------------------------
|
||||
// Add a disabled Toolbar Bitmap
|
||||
// ------------------------------
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(s_tchToolbarBitmapDisabled))
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsNotEmpty(g_tchToolbarBitmapDisabled))
|
||||
{
|
||||
hbmp = LoadBitmapFile(s_tchToolbarBitmapDisabled);
|
||||
hbmp = LoadBitmapFile(g_tchToolbarBitmapDisabled);
|
||||
if (!hbmp) {
|
||||
StringCchCopy(s_tchToolbarBitmapDisabled, COUNTOF(s_tchToolbarBitmapDisabled), L"");
|
||||
StringCchCopy(g_tchToolbarBitmapDisabled, COUNTOF(g_tchToolbarBitmapDisabled), L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDisabled", false);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
@ -2479,7 +2535,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
}
|
||||
else { // create disabled Toolbar, no external bitmap is supplied
|
||||
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsEmpty(s_tchToolbarBitmapDisabled))
|
||||
if ((Settings.ToolBarTheme == 2) && StrIsEmpty(g_tchToolbarBitmapDisabled))
|
||||
{
|
||||
bool bProcessed = false;
|
||||
if (Flags.ToolbarLook == 1) {
|
||||
@ -3081,11 +3137,11 @@ LRESULT MsgCopyData(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (params->flagMatchText)
|
||||
{
|
||||
s_flagMatchText = params->flagMatchText;
|
||||
g_flagMatchText = params->flagMatchText;
|
||||
SetFindPattern(StrEnd(¶ms->wchData, 0) + 1);
|
||||
SetFindReplaceData(); // s_FindReplaceData
|
||||
|
||||
if (s_flagMatchText & 2) {
|
||||
if (g_flagMatchText & 2) {
|
||||
if (!s_flagJumpTo) { SciCall_DocumentEnd(); }
|
||||
EditFindPrev(Globals.hwndEdit, &s_FindReplaceData, false, false);
|
||||
}
|
||||
@ -7864,7 +7920,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LPNMMOUSE const pnmm = (LPNMMOUSE)lParam;
|
||||
|
||||
switch (s_vSBSOrder[pnmm->dwItemSpec])
|
||||
switch (g_vSBSOrder[pnmm->dwItemSpec])
|
||||
{
|
||||
case STATUS_EOLMODE:
|
||||
{
|
||||
@ -7900,7 +7956,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LPNMMOUSE const pnmm = (LPNMMOUSE)lParam;
|
||||
|
||||
switch (s_vSBSOrder[pnmm->dwItemSpec])
|
||||
switch (g_vSBSOrder[pnmm->dwItemSpec])
|
||||
{
|
||||
case STATUS_DOCLINE:
|
||||
case STATUS_DOCCOLUMN:
|
||||
@ -8275,21 +8331,21 @@ void ParseCommandLine()
|
||||
{
|
||||
SetFindPattern(lp1);
|
||||
|
||||
s_flagMatchText = 1;
|
||||
g_flagMatchText = 1;
|
||||
if (bFindUp) {
|
||||
s_flagMatchText |= 2;
|
||||
g_flagMatchText |= 2;
|
||||
}
|
||||
if (bRegex) {
|
||||
s_flagMatchText |= 4;
|
||||
g_flagMatchText |= 4;
|
||||
}
|
||||
if (bMatchCase) {
|
||||
s_flagMatchText |= 8;
|
||||
g_flagMatchText |= 8;
|
||||
}
|
||||
if (bDotMatchAll) {
|
||||
s_flagMatchText |= 16;
|
||||
g_flagMatchText |= 16;
|
||||
}
|
||||
if (bTransBS) {
|
||||
s_flagMatchText |= 32;
|
||||
g_flagMatchText |= 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8610,12 +8666,12 @@ static void _CalculateStatusbarSections(int vSectionWidth[], sectionTxt_t tchSt
|
||||
// count fixed and dynamic optimized pixels
|
||||
int pxCount = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
if (s_iStatusbarVisible[i]) {
|
||||
if (s_iStatusbarWidthSpec[i] == 0) { // dynamic optimized
|
||||
if (g_iStatusbarVisible[i]) {
|
||||
if (g_iStatusbarWidthSpec[i] == 0) { // dynamic optimized
|
||||
vSectionWidth[i] = _StatusCalcPaneWidth(Globals.hwndStatus, tchStatusBar[i]);
|
||||
}
|
||||
else if (s_iStatusbarWidthSpec[i] < -1) { // fixed pixel count
|
||||
vSectionWidth[i] = -(s_iStatusbarWidthSpec[i]);
|
||||
else if (g_iStatusbarWidthSpec[i] < -1) { // fixed pixel count
|
||||
vSectionWidth[i] = -(g_iStatusbarWidthSpec[i]);
|
||||
}
|
||||
//else { /* 0,-1 : relative counts */ }
|
||||
// accumulate
|
||||
@ -8628,8 +8684,8 @@ static void _CalculateStatusbarSections(int vSectionWidth[], sectionTxt_t tchSt
|
||||
// init proportional section checker
|
||||
bool bIsPropSection[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
if ((s_iStatusbarVisible[i]) && (vSectionWidth[i] < 0)) {
|
||||
assert(s_iStatusbarWidthSpec[i] > 0);
|
||||
if ((g_iStatusbarVisible[i]) && (vSectionWidth[i] < 0)) {
|
||||
assert(g_iStatusbarWidthSpec[i] > 0);
|
||||
bIsPropSection[i] = true;
|
||||
}
|
||||
}
|
||||
@ -8659,8 +8715,8 @@ static void _CalculateStatusbarSections(int vSectionWidth[], sectionTxt_t tchSt
|
||||
int totalCnt = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
if (bIsPropSection[i]) {
|
||||
vPropWidth[i] = iPropSectTotalWidth * s_iStatusbarWidthSpec[i];
|
||||
totalCnt += s_iStatusbarWidthSpec[i];
|
||||
vPropWidth[i] = iPropSectTotalWidth * g_iStatusbarWidthSpec[i];
|
||||
totalCnt += g_iStatusbarWidthSpec[i];
|
||||
}
|
||||
}
|
||||
// normalize
|
||||
@ -8800,7 +8856,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_DOCLINE] || bIsWindowFindReplace)
|
||||
if (g_iStatusbarVisible[STATUS_DOCLINE] || bIsWindowFindReplace)
|
||||
{
|
||||
static DocLn s_iLnFromPos = -1;
|
||||
static DocLn s_iLnCnt = -1;
|
||||
@ -8829,7 +8885,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
|
||||
static WCHAR tchCol[32] = { L'\0' };
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_DOCCOLUMN] || bIsWindowFindReplace)
|
||||
if (g_iStatusbarVisible[STATUS_DOCCOLUMN] || bIsWindowFindReplace)
|
||||
{
|
||||
DocPos const colOffset = Globals.bZeroBasedColumnIndex ? 0 : 1;
|
||||
|
||||
@ -8859,7 +8915,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_DOCCHAR])
|
||||
if (g_iStatusbarVisible[STATUS_DOCCHAR])
|
||||
{
|
||||
static WCHAR tchChr[32] = { L'\0' };
|
||||
static WCHAR tchChrs[32] = { L'\0' };
|
||||
@ -8893,7 +8949,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
static WCHAR tchSel[32] = { L'\0' };
|
||||
|
||||
// number of selected chars in statusbar
|
||||
if (s_iStatusbarVisible[STATUS_SELECTION] || s_iStatusbarVisible[STATUS_SELCTBYTES] || bIsWindowFindReplace)
|
||||
if (g_iStatusbarVisible[STATUS_SELECTION] || g_iStatusbarVisible[STATUS_SELCTBYTES] || bIsWindowFindReplace)
|
||||
{
|
||||
static bool s_bIsSelCountable = false;
|
||||
static bool s_bIsMultiSelection = false;
|
||||
@ -8935,7 +8991,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
// ------------------------------------------------------
|
||||
|
||||
// number of selected lines in statusbar
|
||||
if (s_iStatusbarVisible[STATUS_SELCTLINES])
|
||||
if (g_iStatusbarVisible[STATUS_SELCTLINES])
|
||||
{
|
||||
static bool s_bIsSelectionEmpty = true;
|
||||
static DocLn s_iLinesSelected = -1;
|
||||
@ -8971,7 +9027,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
// ------------------------------------------------------
|
||||
|
||||
// try calculate expression of selection
|
||||
if (s_iStatusbarVisible[STATUS_TINYEXPR])
|
||||
if (g_iStatusbarVisible[STATUS_TINYEXPR])
|
||||
{
|
||||
static WCHAR tchExpression[32] = { L'\0' };
|
||||
static te_xint_t s_iExErr = -3;
|
||||
@ -9034,7 +9090,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
static WCHAR tchOcc[32] = { L'\0' };
|
||||
|
||||
// number of occurrence marks found
|
||||
if (s_iStatusbarVisible[STATUS_OCCURRENCE] || bIsWindowFindReplace)
|
||||
if (g_iStatusbarVisible[STATUS_OCCURRENCE] || bIsWindowFindReplace)
|
||||
{
|
||||
static DocPosU s_iMarkOccurrencesCount = 0;
|
||||
static bool s_bMOVisible = false;
|
||||
@ -9063,7 +9119,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
// ------------------------------------------------------
|
||||
|
||||
// number of replaced pattern
|
||||
if (s_iStatusbarVisible[STATUS_OCCREPLACE] || bIsWindowFindReplace)
|
||||
if (g_iStatusbarVisible[STATUS_OCCREPLACE] || bIsWindowFindReplace)
|
||||
{
|
||||
static int s_iReplacedOccurrences = -1;
|
||||
|
||||
@ -9089,7 +9145,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
// ------------------------------------------------------
|
||||
|
||||
// get number of bytes in current encoding
|
||||
if (s_iStatusbarVisible[STATUS_DOCSIZE])
|
||||
if (g_iStatusbarVisible[STATUS_DOCSIZE])
|
||||
{
|
||||
static DocPos s_iTextLength = -1;
|
||||
DocPos const iTextLength = SciCall_GetTextLength();
|
||||
@ -9107,7 +9163,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_CODEPAGE])
|
||||
if (g_iStatusbarVisible[STATUS_CODEPAGE])
|
||||
{
|
||||
static cpi_enc_t s_iEncoding = CPI_NONE;
|
||||
cpi_enc_t const iEncoding = Encoding_GetCurrent();
|
||||
@ -9129,7 +9185,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
const WCHAR* const _CRLF_f = L"%sCR+LF%s";
|
||||
const WCHAR* const _CRLFi_f = L"%sCR+LF*%s";
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_EOLMODE])
|
||||
if (g_iStatusbarVisible[STATUS_EOLMODE])
|
||||
{
|
||||
static int s_iEOLMode = -1;
|
||||
int const eol_mode = SciCall_GetEOLMode();
|
||||
@ -9157,7 +9213,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_OVRMODE])
|
||||
if (g_iStatusbarVisible[STATUS_OVRMODE])
|
||||
{
|
||||
static bool s_bIsOVR = -1;
|
||||
bool const bIsOVR = (bool)SendMessage(Globals.hwndEdit, SCI_GETOVERTYPE, 0, 0);
|
||||
@ -9178,7 +9234,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_2ND_DEF])
|
||||
if (g_iStatusbarVisible[STATUS_2ND_DEF])
|
||||
{
|
||||
static bool s_bUse2ndDefault = -1;
|
||||
bool const bUse2ndDefault = Style_GetUse2ndDefault();
|
||||
@ -9197,7 +9253,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
if (s_iStatusbarVisible[STATUS_LEXER])
|
||||
if (g_iStatusbarVisible[STATUS_LEXER])
|
||||
{
|
||||
static int s_iCurLexer = -1;
|
||||
int const iCurLexer = Style_GetCurrentLexerRID();
|
||||
@ -9229,7 +9285,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
BYTE cnt = 0;
|
||||
int totalWidth = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
int const id = s_vSBSOrder[i];
|
||||
int const id = g_vSBSOrder[i];
|
||||
if ((id >= 0) && (g_vStatusbarSectionWidth[id] >= 0))
|
||||
{
|
||||
totalWidth += g_vStatusbarSectionWidth[id];
|
||||
@ -9244,7 +9300,7 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
|
||||
cnt = 0;
|
||||
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
|
||||
int const id = s_vSBSOrder[i];
|
||||
int const id = g_vSBSOrder[i];
|
||||
if ((id >= 0) && (g_vStatusbarSectionWidth[id] >= 0)) {
|
||||
StatusSetText(Globals.hwndStatus, cnt++, tchStatusBar[id]);
|
||||
}
|
||||
@ -10766,7 +10822,7 @@ bool ActivatePrevInst()
|
||||
params->flagSetEOLMode = s_flagSetEOLMode;
|
||||
params->flagTitleExcerpt = 0;
|
||||
|
||||
params->flagMatchText = s_flagMatchText;
|
||||
params->flagMatchText = g_flagMatchText;
|
||||
if (!IsFindPatternEmpty()) {
|
||||
StringCchCopy(StrEnd(¶ms->wchData, 0) + 1, (LengthOfFindPattern() + 1), GetFindPattern());
|
||||
}
|
||||
@ -10859,7 +10915,7 @@ bool ActivatePrevInst()
|
||||
params->flagTitleExcerpt = 0;
|
||||
}
|
||||
|
||||
params->flagMatchText = s_flagMatchText;
|
||||
params->flagMatchText = g_flagMatchText;
|
||||
if (!IsFindPatternEmpty()) {
|
||||
StringCchCopy(StrEnd(¶ms->wchData, 0) + 1, (LengthOfFindPattern() + 1), GetFindPattern());
|
||||
}
|
||||
|
||||
@ -75,17 +75,6 @@ typedef enum {
|
||||
} DoAction;
|
||||
|
||||
|
||||
//==== Toolbar Style ==========================================================
|
||||
#define NP3_WS_TOOLBAR (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | \
|
||||
TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | TBSTYLE_ALTDRAG | TBSTYLE_LIST | \
|
||||
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_ADJUSTABLE)
|
||||
|
||||
|
||||
//==== ReBar Style ============================================================
|
||||
#define NP3_WS_REBAR (WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | RBS_VARHEIGHT | \
|
||||
RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NOPARENTALIGN)
|
||||
|
||||
|
||||
//==== Ids ====================================================================
|
||||
#define IDC_STATUSBAR (0xFB00)
|
||||
#define IDC_TOOLBAR (0xFB01)
|
||||
@ -113,8 +102,9 @@ typedef enum {
|
||||
|
||||
|
||||
//==== Function Declarations ==================================================
|
||||
bool InitApplication(HINSTANCE hInstance);
|
||||
HWND InitInstance(HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow);
|
||||
bool InitApplication(const HINSTANCE hInstance);
|
||||
//~bool InitToolbarWndClass(const HINSTANCE hInstance);
|
||||
HWND InitInstance(const HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow);
|
||||
WININFO GetFactoryDefaultWndPos(const int flagsPos);
|
||||
WININFO GetWinInfoByFlag(const int flagsPos);
|
||||
bool ActivatePrevInst();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user