mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge branch 'Dev_Master' into Future_Dev_Master
This commit is contained in:
commit
c8e056f573
@ -4703,8 +4703,8 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode)
|
||||
Settings.AlwaysOnTop = true;
|
||||
s_bPrevFullScreenFlag = true;
|
||||
}
|
||||
SendWMSize(hwnd, NULL);
|
||||
UpdateToolbar();
|
||||
|
||||
UpdateUI(hwnd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -103,9 +103,13 @@ SETTINGS2_T Settings2;
|
||||
FOCUSEDVIEW_T FocusedView;
|
||||
FILEWATCHING_T FileWatching;
|
||||
|
||||
// set by InitScintillaHandle()
|
||||
HWND g_hwndEditWindow = NULL;
|
||||
HANDLE g_hndlScintilla = NULL;
|
||||
|
||||
// window positioning
|
||||
WININFO g_IniWinInfo = INIT_WININFO;
|
||||
WININFO g_DefWinInfo = INIT_WININFO;
|
||||
HANDLE g_hndlScintilla = NULL;
|
||||
|
||||
COLORREF g_colorCustom[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
@ -2764,7 +2768,7 @@ bool SelectExternalToolBar(HWND hwnd)
|
||||
|
||||
if (GetOpenFileNameW(&ofn)) {
|
||||
Path_Sanitize(hfile_pth);
|
||||
Path_CanonicalizeEx(hfile_pth, Paths.WorkingDirectory);
|
||||
Path_CanonicalizeEx(hfile_pth, Paths.ModuleDirectory);
|
||||
Path_Reset(g_tchToolbarBitmap, Path_Get(hfile_pth));
|
||||
Path_RelativeToApp(g_tchToolbarBitmap, true, true, true);
|
||||
if (Globals.bCanSaveIniFile) {
|
||||
@ -2833,14 +2837,8 @@ bool SelectExternalToolBar(HWND hwnd)
|
||||
//
|
||||
// LoadBitmapFile()
|
||||
//
|
||||
static HBITMAP LoadBitmapFile(LPCWSTR path)
|
||||
static HBITMAP LoadBitmapFile(const HPATHL hpath)
|
||||
{
|
||||
HPATHL hpath = Path_Allocate(path);
|
||||
if (Path_IsRelative(hpath)) {
|
||||
Path_GetAppDirectory(hpath);
|
||||
Path_Append(hpath, path);
|
||||
}
|
||||
|
||||
HBITMAP hbmp = NULL;
|
||||
|
||||
if (Path_IsExistingFile(hpath)) {
|
||||
@ -2855,7 +2853,7 @@ static HBITMAP LoadBitmapFile(LPCWSTR path)
|
||||
bDimOK = (bmp.bmWidth >= (height * NUMTOOLBITMAPS));
|
||||
}
|
||||
if (!bDimOK) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_BITMAP, path,
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_BITMAP, Path_Get(hpath),
|
||||
(height * NUMTOOLBITMAPS), height, NUMTOOLBITMAPS);
|
||||
if (hbmp) {
|
||||
DeleteObject(hbmp);
|
||||
@ -2864,10 +2862,9 @@ static HBITMAP LoadBitmapFile(LPCWSTR path)
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_LOADFILE, path);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_LOADFILE, Path_Get(hpath));
|
||||
}
|
||||
|
||||
Path_Release(hpath);
|
||||
return hbmp;
|
||||
}
|
||||
|
||||
@ -2987,7 +2984,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
if ((Settings.ToolBarTheme == 2) && Path_IsNotEmpty(g_tchToolbarBitmap)) {
|
||||
HPATHL hfile_pth = Path_Copy(g_tchToolbarBitmap);
|
||||
Path_AbsoluteFromApp(hfile_pth, true);
|
||||
hbmp = LoadBitmapFile(Path_Get(hfile_pth));
|
||||
hbmp = LoadBitmapFile(hfile_pth);
|
||||
if (!hbmp) {
|
||||
Path_Reset(g_tchToolbarBitmap, L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDefault", false);
|
||||
@ -3019,7 +3016,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
if ((Settings.ToolBarTheme == 2) && Path_IsNotEmpty(g_tchToolbarBitmapHot)) {
|
||||
HPATHL hfile_pth = Path_Copy(g_tchToolbarBitmapHot);
|
||||
Path_AbsoluteFromApp(hfile_pth, true);
|
||||
hbmp = Path_IsExistingFile(hfile_pth) ? LoadBitmapFile(Path_Get(hfile_pth)) : NULL;
|
||||
hbmp = Path_IsExistingFile(hfile_pth) ? LoadBitmapFile(hfile_pth) : NULL;
|
||||
if (!hbmp) {
|
||||
Path_Reset(g_tchToolbarBitmapHot, L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapHot", false);
|
||||
@ -3048,7 +3045,7 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
if ((Settings.ToolBarTheme == 2) && Path_IsNotEmpty(g_tchToolbarBitmapDisabled)) {
|
||||
HPATHL hfile_pth = Path_Copy(g_tchToolbarBitmapDisabled);
|
||||
Path_AbsoluteFromApp(hfile_pth, true);
|
||||
hbmp = Path_IsExistingFile(hfile_pth) ? LoadBitmapFile(Path_Get(hfile_pth)) : NULL;
|
||||
hbmp = Path_IsExistingFile(hfile_pth) ? LoadBitmapFile(hfile_pth) : NULL;
|
||||
if (!hbmp) {
|
||||
Path_Reset(g_tchToolbarBitmapDisabled, L"");
|
||||
IniSectionDelete(L"Toolbar Images", L"BitmapDisabled", false);
|
||||
@ -3341,10 +3338,7 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam,LPARAM lParam)
|
||||
|
||||
EditUpdateVisibleIndicators();
|
||||
|
||||
UpdateToolbar();
|
||||
UpdateStatusbar(true);
|
||||
UpdateMargins(true);
|
||||
UpdateUI();
|
||||
UpdateUI(hwnd);
|
||||
}
|
||||
|
||||
UpdateWindowEx(hwnd);
|
||||
@ -3402,7 +3396,7 @@ LRESULT MsgSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
DeferWindowPos(hdwp,s_hwndEditFrame,NULL,x,y,cx,cy, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
DeferWindowPos(hdwp, Globals.hwndEdit, s_hwndEditFrame,
|
||||
DeferWindowPos(hdwp, g_hwndEditWindow, s_hwndEditFrame,
|
||||
x+s_cxEditFrame,y+s_cyEditFrame, cx-2*s_cxEditFrame,cy-2*s_cyEditFrame,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
@ -3414,12 +3408,37 @@ LRESULT MsgSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
UpdateStatusbar(true);
|
||||
UpdateMargins(true);
|
||||
UpdateTitlebar(hwnd);
|
||||
//~UpdateUI();
|
||||
//~UpdateUI(); ~ recursion
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateContentArea()
|
||||
//
|
||||
void UpdateContentArea()
|
||||
{
|
||||
Sci_ForceNotifyUpdateUI(Globals.hwndMain, IDC_EDIT);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateUI()
|
||||
//
|
||||
void UpdateUI(HWND hwnd)
|
||||
{
|
||||
//if (hwnd == Globals.hwndMain) {
|
||||
// UpdateContentArea()
|
||||
//}
|
||||
SendWMSize(hwnd, NULL);
|
||||
PostMessage(hwnd, WM_NCACTIVATE, FALSE, -1); // (!)
|
||||
PostMessage(hwnd, WM_NCACTIVATE, TRUE, 0);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// MsgDrawItem() - Handles WM_DRAWITEM (needs SBT_OWNERDRAW)
|
||||
@ -5817,7 +5836,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
SetForegroundWindow(Globals.hwndDlgCustomizeSchemes);
|
||||
}
|
||||
SendWMCommand(Globals.hwndDlgCustomizeSchemes, IDC_SETCURLEXERTV);
|
||||
UpdateUI();
|
||||
UpdateUI(hwnd);
|
||||
break;
|
||||
|
||||
|
||||
@ -5827,7 +5846,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
Style_SetDefaultFont(Globals.hwndEdit, (iLoWParam == IDM_VIEW_FONT));
|
||||
}
|
||||
UpdateMargins(true);
|
||||
UpdateUI();
|
||||
UpdateUI(hwnd);
|
||||
break;
|
||||
|
||||
|
||||
@ -6255,7 +6274,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_VIEW_TOOLBAR:
|
||||
Settings.ShowToolbar = !Settings.ShowToolbar;
|
||||
ShowWindow(Globals.hwndRebar, (Settings.ShowToolbar ? SW_SHOW : SW_HIDE));
|
||||
SendWMSize(hwnd, NULL);
|
||||
UpdateUI(hwnd);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_CUSTOMIZETB:
|
||||
@ -6265,13 +6284,13 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_VIEW_TOGGLETB:
|
||||
Settings.ToolBarTheme = (Settings.ToolBarTheme + 1) % 3;
|
||||
CreateBars(hwnd, Globals.hInstance);
|
||||
UpdateUI();
|
||||
UpdateUI(hwnd);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_LOADTHEMETB:
|
||||
if (SelectExternalToolBar(hwnd)) {
|
||||
CreateBars(hwnd, Globals.hInstance);
|
||||
UpdateUI();
|
||||
UpdateUI(hwnd);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6283,8 +6302,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_VIEW_STATUSBAR:
|
||||
Settings.ShowStatusbar = !Settings.ShowStatusbar;
|
||||
ShowWindow(Globals.hwndStatus, (Settings.ShowStatusbar ? SW_SHOW : SW_HIDE));
|
||||
UpdateStatusbar(Settings.ShowStatusbar);
|
||||
SendWMSize(hwnd, NULL);
|
||||
UpdateUI(hwnd);
|
||||
break;
|
||||
|
||||
|
||||
@ -10402,23 +10420,6 @@ void UpdateSaveSettingsCmds()
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateUI()
|
||||
//
|
||||
void UpdateUI() {
|
||||
struct SCNotification scn = { 0 };
|
||||
scn.nmhdr.hwndFrom = Globals.hwndEdit;
|
||||
scn.nmhdr.idFrom = IDC_EDIT;
|
||||
scn.nmhdr.code = SCN_UPDATEUI;
|
||||
scn.updated = SC_UPDATE_CONTENT;
|
||||
SendMessage(Globals.hwndMain, WM_NOTIFY, IDC_EDIT, (LPARAM)&scn);
|
||||
SendWMSize(Globals.hwndMain, NULL);
|
||||
PostMessage(Globals.hwndMain, WM_NCACTIVATE, FALSE, -1); // (!)
|
||||
PostMessage(Globals.hwndMain, WM_NCACTIVATE, TRUE, 0);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UndoRedoRecordingStart()
|
||||
|
||||
@ -127,13 +127,16 @@ void ShowZoomCallTip();
|
||||
void ShowWrapAroundCallTip(bool forwardSearch);
|
||||
|
||||
void MarkAllOccurrences(const int delay, const bool bForceClear);
|
||||
void UpdateUI();
|
||||
|
||||
void UpdateToolbar();
|
||||
void UpdateStatusbar(const bool bForceRedraw);
|
||||
void UpdateMargins(const bool bForce);
|
||||
void UpdateSaveSettingsCmds();
|
||||
void ResetMouseDWellTime();
|
||||
void UpdateTitlebar(const HWND hwnd);
|
||||
void UpdateContentArea();
|
||||
void UpdateUI(HWND hwnd);
|
||||
|
||||
void ResetMouseDWellTime();
|
||||
|
||||
void UndoRedoReset();
|
||||
LONG BeginUndoActionSelection();
|
||||
|
||||
@ -766,9 +766,7 @@ bool PTHAPI Path_Append(HPATHL hpth_in_out, LPCWSTR more)
|
||||
StringCchCatW(wbuf, cch, more);
|
||||
StrgSanitize(hstr_io);
|
||||
|
||||
Path_Canonicalize(hpth_in_out);
|
||||
|
||||
return true;
|
||||
return Path_Canonicalize(hpth_in_out);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -1095,14 +1093,13 @@ void PTHAPI Path_GetModuleFilePath(HPATHL hpth_out)
|
||||
{
|
||||
static HPATHL mod_path = NULL;
|
||||
|
||||
HSTRINGW hstr = ToHStrgW(hpth_out);
|
||||
if (!hstr) {
|
||||
if (!hpth_out) {
|
||||
if (mod_path) {
|
||||
Path_Release(mod_path);
|
||||
mod_path = NULL;
|
||||
}
|
||||
else {
|
||||
assert(hstr != NULL);
|
||||
assert(hpth_out != NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1810,15 +1807,13 @@ bool PTHAPI Path_CanonicalizeEx(HPATHL hpth_in_out, const HPATHL hdir_rel_base)
|
||||
bool res = false;
|
||||
if (!Path_IsEmpty(hdir_rel_base) && _Path_IsRelative(hpth_in_out)) {
|
||||
HPATHL hmod_pth = Path_Copy(hdir_rel_base);
|
||||
Path_Append(hmod_pth, Path_Get(hpth_in_out));
|
||||
res = Path_Canonicalize(hmod_pth);
|
||||
res = Path_Append(hmod_pth, Path_Get(hpth_in_out));
|
||||
Path_Swap(hpth_in_out, hmod_pth);
|
||||
Path_Release(hmod_pth);
|
||||
}
|
||||
else {
|
||||
res = Path_Canonicalize(hpth_in_out);
|
||||
}
|
||||
|
||||
Path_RemoveBackslash(hpth_in_out);
|
||||
|
||||
return res;
|
||||
@ -1927,16 +1922,6 @@ static bool _Path_RelativePathTo(HPATHL hrecv, const HPATHL hfrom, DWORD attr_fr
|
||||
bool from_is_dir = (attr_from & FILE_ATTRIBUTE_DIRECTORY);
|
||||
bool to_is_dir = (attr_to & FILE_ATTRIBUTE_DIRECTORY);
|
||||
|
||||
#if 0
|
||||
// DEBUG
|
||||
{
|
||||
Path_Reset(hfrom, L"\\FolderA\\FolderB\\FolderC\\abab");
|
||||
//from_is_dir = true;
|
||||
Path_Reset(hto, L"\\FolderA\\FolderD\\FolderE\\blah");
|
||||
//to_is_dir = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ensure comparable paths (no relatives(..\)
|
||||
HPATHL hfrom_cpy = Path_Allocate(PathGet(hfrom));
|
||||
Path_Canonicalize(hfrom_cpy);
|
||||
@ -1947,11 +1932,13 @@ static bool _Path_RelativePathTo(HPATHL hrecv, const HPATHL hfrom, DWORD attr_fr
|
||||
if (from_is_dir) {
|
||||
HSTRINGW hstr_from = ToHStrgW(hfrom_cpy);
|
||||
StrgTrimRight(hstr_from, L'\\');
|
||||
StrgTrimRight(hstr_from, L'/');
|
||||
StrgCat(hstr_from, L"\\");
|
||||
}
|
||||
if (to_is_dir) {
|
||||
HSTRINGW hstr_cpy = ToHStrgW(hto_cpy);
|
||||
StrgTrimRight(hstr_cpy, L'\\');
|
||||
StrgTrimRight(hstr_cpy, L'/');
|
||||
StrgCat(hstr_cpy, L"\\");
|
||||
}
|
||||
|
||||
@ -1983,8 +1970,8 @@ static bool _Path_RelativePathTo(HPATHL hrecv, const HPATHL hfrom, DWORD attr_fr
|
||||
// back to prev sync point
|
||||
LPCWSTR p = &hfrom_buf[i];
|
||||
while (p > r) {
|
||||
if ((*p == L'\\') || (*p == L':')) {
|
||||
break;
|
||||
if ((*p == L'\\') || (*p == L'/') || (*p == L':')) {
|
||||
++p; break;
|
||||
}
|
||||
--p;
|
||||
}
|
||||
@ -1993,29 +1980,25 @@ static bool _Path_RelativePathTo(HPATHL hrecv, const HPATHL hfrom, DWORD attr_fr
|
||||
// count dirs of from-path reverse to sync point
|
||||
size_t dir_cnt = 0;
|
||||
while (*p != L'\0') {
|
||||
if ((*p == L'\\')) {
|
||||
// ignore trailing backslash
|
||||
if (*(p + 1)) {
|
||||
++dir_cnt;
|
||||
}
|
||||
if ((*p == L'\\') || (*p == L'/')) {
|
||||
++dir_cnt;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
// prepare buffer for prefix "..\" x dir_cnt
|
||||
|
||||
size_t const alloc_add = wcslen(&hto_buf[prefix]) + 1;
|
||||
size_t const len = (wcslen(PATHPARENT_PREFIX) * dir_cnt) + alloc_add;
|
||||
LPWSTR const out_buf = StrgWriteAccessBuf(hrecv_str, len);
|
||||
size_t const alloc_add = wcslen(&hto_buf[prefix]) + 1;
|
||||
size_t const len = (wcslen(PATHPARENT_PREFIX) * dir_cnt) + alloc_add;
|
||||
LPWSTR const hrecv_buf = StrgWriteAccessBuf(hrecv_str, len);
|
||||
for (size_t d = 0; d < dir_cnt; ++d) {
|
||||
StringCchCatW(out_buf, len, PATHPARENT_PREFIX);
|
||||
StringCchCatW(hrecv_buf, len, PATHPARENT_PREFIX);
|
||||
}
|
||||
//~Path_RemoveBackslash(hpath_in_out);
|
||||
if (hto_buf[prefix] == L'\\') {
|
||||
if ((hto_buf[prefix] == L'\\') || (hto_buf[prefix] == L'/')) {
|
||||
++prefix;
|
||||
}
|
||||
// copy rest of to-path (excluding first seperator)
|
||||
StringCchCatW(out_buf, len, &hto_buf[prefix]);
|
||||
StringCchCatW(hrecv_buf, len, &hto_buf[prefix]);
|
||||
}
|
||||
else {
|
||||
Path_Swap(hrecv, hto_cpy);
|
||||
@ -2230,15 +2213,14 @@ void PTHAPI Path_AbsoluteFromApp(HPATHL hpth_in_out, bool bExpandEnv)
|
||||
|
||||
if (_Path_IsRelative(htmp_pth)) {
|
||||
Path_GetAppDirectory(hpth_in_out);
|
||||
Path_Append(hpth_in_out, Path_Get(htmp_pth));
|
||||
Path_Append(hpth_in_out, Path_Get(htmp_pth)); // does Path_Canonicalize()
|
||||
}
|
||||
else {
|
||||
Path_Swap(hpth_in_out, htmp_pth);
|
||||
Path_Canonicalize(hpth_in_out);
|
||||
}
|
||||
Path_Release(htmp_pth);
|
||||
|
||||
Path_Canonicalize(hpth_in_out);
|
||||
|
||||
// TODO:
|
||||
//if (PathGetDriveNumber(wchResult) != -1) {
|
||||
// CharUpperBuff(wchResult, 1);
|
||||
|
||||
@ -62,12 +62,16 @@
|
||||
// Scintilla Window Handle
|
||||
//
|
||||
#if defined(__cplusplus)
|
||||
extern "C" HWND g_hwndEditWindow;
|
||||
extern "C" HANDLE g_hndlScintilla;
|
||||
#else
|
||||
extern HWND g_hwndEditWindow;
|
||||
extern HANDLE g_hndlScintilla;
|
||||
#endif
|
||||
|
||||
|
||||
__forceinline void InitScintillaHandle(HWND hwnd) {
|
||||
g_hwndEditWindow = hwnd;
|
||||
g_hndlScintilla = (HANDLE)SendMessage(hwnd, SCI_GETDIRECTPOINTER, 0, 0);
|
||||
}
|
||||
|
||||
@ -937,6 +941,18 @@ inline DocPos Sci_ReplaceTargetEx(const int mode, const DocPos length, const cha
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
inline LRESULT Sci_ForceNotifyUpdateUI(HWND hwnd, uptr_t idc)
|
||||
{
|
||||
struct SCNotification scn = { 0 };
|
||||
scn.nmhdr.hwndFrom = g_hwndEditWindow;
|
||||
scn.nmhdr.idFrom = idc;
|
||||
scn.nmhdr.code = SCN_UPDATEUI;
|
||||
scn.updated = SC_UPDATE_CONTENT;
|
||||
return SendMessageW(hwnd, WM_NOTIFY, idc, (LPARAM)&scn);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//=============================================================================
|
||||
|
||||
#endif //_NP3_SCICALL_H_
|
||||
|
||||
@ -569,7 +569,7 @@ bool Style_DynamicThemesMenuCmd(int cmd)
|
||||
Style_ResetCurrentLexer(Globals.hwndEdit);
|
||||
}
|
||||
UpdateMargins(true);
|
||||
UpdateUI();
|
||||
UpdateUI(Globals.hwndMain);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user