Merge remote-tracking branch 'notepad3_orig_rizone/master'

This commit is contained in:
Rainer Kottenhoff 2017-12-23 08:02:53 +01:00
commit 53155abd55
6 changed files with 726 additions and 701 deletions

View File

@ -41,8 +41,8 @@
#include "dialogs.h"
extern HWND hwndMain;
extern HWND hwndEdit;
extern HWND g_hwndMain;
extern HWND g_hwndEdit;
extern HINSTANCE g_hInstance;
extern DWORD dwLastIOError;
extern BOOL bSkipUnicodeDetection;
@ -107,7 +107,7 @@ int MsgBox(int iType,UINT uIdMsg,...)
}
HWND focus = GetFocus();
hwnd = focus ? focus : hwndMain;
hwnd = focus ? focus : g_hwndMain;
return MessageBoxEx(hwnd,
szText,szTitle,
@ -2378,7 +2378,7 @@ INT_PTR InfoBox(int iType,LPCWSTR lpstrSetting,int uidMessage,...)
idDlg = IDD_INFOBOX3;
HWND focus = GetFocus();
hwnd = focus ? focus : hwndMain;
hwnd = focus ? focus : g_hwndMain;
MessageBeep(MB_ICONEXCLAMATION);

View File

@ -53,9 +53,9 @@
// find free bits in scintilla.h SCFIND_ defines
#define SCFIND_NP3_REGEX (SCFIND_REGEXP | SCFIND_POSIX)
extern HWND hwndMain;
extern HWND hwndEdit;
extern HWND hwndStatus;
extern HWND g_hwndMain;
extern HWND g_hwndEdit;
extern HWND g_hwndStatus;
extern HINSTANCE g_hInstance;
//extern LPMALLOC g_lpMalloc;
@ -492,7 +492,7 @@ char* EditGetClipboardText(HWND hwnd,BOOL bCheckEncoding,int* pLineCount,int* pL
int iAnchor = (int)SendMessage(hwnd,SCI_GETANCHOR,0,0);
// switch encoding to universal UTF-8 codepage
SendMessage(hwndMain,WM_COMMAND,(WPARAM)MAKELONG(IDM_ENCODING_UTF8,1),0);
SendMessage(g_hwndMain,WM_COMMAND,(WPARAM)MAKELONG(IDM_ENCODING_UTF8,1),0);
// restore and adjust selection
if (iPos > iAnchor) {
@ -4133,7 +4133,7 @@ void EditGetExcerpt(HWND hwnd,LPWSTR lpszExcerpt,DWORD cchExcerpt)
//
void __fastcall EditSetSearchFlags(HWND hwnd, LPEDITFINDREPLACE lpefr)
{
UINT uCPEdit = Encoding_SciGetCodePage(hwndEdit);
UINT uCPEdit = Encoding_SciGetCodePage(g_hwndEdit);
GetDlgItemTextW2A(uCPEdit, hwnd, IDC_FINDTEXT, lpefr->szFind, COUNTOF(lpefr->szFind));
@ -4346,7 +4346,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (lpefr->bMarkOccurences) {
iSaveMarkOcc = iMarkOccurrences;
EnableCmd(GetMenu(hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
iMarkOccurrences = 0;
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
}
@ -4356,7 +4356,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
}
// Get the current code page for Unicode conversion
UINT uCPEdit = Encoding_SciGetCodePage(hwndEdit);
UINT uCPEdit = Encoding_SciGetCodePage(g_hwndEdit);
//const WORD wTabSpacing = (WORD)SendMessage(lpefr->hwnd, SCI_GETTABWIDTH, 0, 0);; // dialog box units
//SendDlgItemMessage(hwnd, IDC_FINDTEXT, EM_SETTABSTOPS, 1, (LPARAM)&wTabSpacing);
@ -4525,9 +4525,9 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
DeleteObject(hBrushBlue);
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
}
}
KillTimer(hwnd, IDT_TIMER_MRKALL);
@ -4554,7 +4554,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
SetTimer(hwnd, IDT_TIMER_MRKALL, 50, NULL);
}
else {
DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !(BOOL)SendMessage(hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0));
DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !(BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0));
}
}
return FALSE;
@ -4575,7 +4575,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
BOOL bEnableR = (GetWindowTextLengthW(GetDlgItem(hwnd, IDC_REPLACETEXT)) ||
CB_ERR != SendDlgItemMessage(hwnd, IDC_REPLACETEXT, CB_GETCURSEL, 0, 0));
BOOL bEnableIS = !(BOOL)SendMessage(hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0);
BOOL bEnableIS = !(BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0);
DialogEnableWindow(hwnd, IDOK, bEnableF);
DialogEnableWindow(hwnd, IDC_FINDPREV, bEnableF);
@ -4601,15 +4601,15 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
{
lpefr->bMarkOccurences = TRUE;
iSaveMarkOcc = iMarkOccurrences;
EnableCmd(GetMenu(hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
iMarkOccurrences = 0;
}
else { // switched OFF
lpefr->bMarkOccurences = FALSE;
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
}
}
iSaveMarkOcc = -1;
@ -4628,12 +4628,12 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) {
BeginWaitCursor();
StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), lpefr->szFind);
RegExResult_t match = EditFindHasMatch(hwndEdit, lpefr, (iSaveMarkOcc > 0), FALSE);
RegExResult_t match = EditFindHasMatch(g_hwndEdit, lpefr, (iSaveMarkOcc > 0), FALSE);
if (regexMatch != match) {
regexMatch = match;
}
// we have to set Sci's regex instance to first find (have substitution in place)
EditFindHasMatch(hwndEdit, lpefr, FALSE, TRUE);
EditFindHasMatch(g_hwndEdit, lpefr, FALSE, TRUE);
bFlagsChanged = FALSE;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
EndWaitCursor();
@ -4910,7 +4910,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
break;
case IDACC_SAVEFIND:
SendMessage(hwndMain, WM_COMMAND, MAKELONG(IDM_EDIT_SAVEFIND, 1), 0);
SendMessage(g_hwndMain, WM_COMMAND, MAKELONG(IDM_EDIT_SAVEFIND, 1), 0);
SetDlgItemTextA2W(CP_UTF8, hwnd, IDC_FINDTEXT, lpefr->szFindUTF8);
CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED);
@ -5780,8 +5780,8 @@ INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa
case WM_INITDIALOG:
{
int iCurLine = (int)SendMessage(hwndEdit,SCI_LINEFROMPOSITION,
SendMessage(hwndEdit,SCI_GETCURRENTPOS,0,0),0)+1;
int iCurLine = (int)SendMessage(g_hwndEdit,SCI_LINEFROMPOSITION,
SendMessage(g_hwndEdit,SCI_GETCURRENTPOS,0,0),0)+1;
SetDlgItemInt(hwnd,IDC_LINENUM,iCurLine,FALSE);
SendDlgItemMessage(hwnd,IDC_LINENUM,EM_LIMITTEXT,15,0);
@ -5807,7 +5807,7 @@ INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa
int iNewCol;
int iNewLine = (int)GetDlgItemInt(hwnd,IDC_LINENUM,&fTranslated,FALSE);
int iMaxLine = (int)SendMessage(hwndEdit,SCI_GETLINECOUNT,0,0);
int iMaxLine = (int)SendMessage(g_hwndEdit,SCI_GETLINECOUNT,0,0);
if (SendDlgItemMessage(hwnd,IDC_COLNUM,WM_GETTEXTLENGTH,0,0) > 0)
iNewCol = GetDlgItemInt(hwnd,IDC_COLNUM,&fTranslated2,FALSE);
@ -5824,7 +5824,7 @@ INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa
if (iNewLine > 0 && iNewLine <= iMaxLine && iNewCol > 0)
{
EditJumpTo(hwndEdit,iNewLine,iNewCol);
EditJumpTo(g_hwndEdit,iNewLine,iNewCol);
EndDialog(hwnd,IDOK);
}
@ -6394,7 +6394,7 @@ INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam
DialogEnableWindow(hwnd,107,FALSE);
bEnableLogicalSort = FALSE;
}
if (SC_SEL_RECTANGLE != SendMessage(hwndEdit,SCI_GETSELECTIONMODE,0,0)) {
if (SC_SEL_RECTANGLE != SendMessage(g_hwndEdit,SCI_GETSELECTIONMODE,0,0)) {
*piSortFlags &= ~SORT_COLUMN;
DialogEnableWindow(hwnd,108,FALSE);
}
@ -6728,16 +6728,16 @@ BOOL FileVars_Apply(HWND hwnd,LPFILEVARS lpfv) {
bTabIndents = lpfv->bTabIndents;
else
bTabIndents = bTabIndentsG;
SendMessage(hwndEdit,SCI_SETTABINDENTS,bTabIndents,0);
SendMessage(g_hwndEdit,SCI_SETTABINDENTS,bTabIndents,0);
if (lpfv->mask & FV_WORDWRAP)
bWordWrap = lpfv->fWordWrap;
else
bWordWrap = bWordWrapG;
if (!bWordWrap)
SendMessage(hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
if (lpfv->mask & FV_LONGLINESLIMIT)
iLongLinesLimit = lpfv->iLongLinesLimit;

View File

@ -70,9 +70,9 @@ __inline BOOL IniSectionSetBool(LPWSTR lpCachedIniSection, LPCWSTR lpName, BOOL
}
//extern HWND hwndEdit;
#define BeginWaitCursor() { SendMessage(hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetText(hwndStatus,255,L"..."); }
#define EndWaitCursor() { POINT pt; SendMessage(hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); UpdateStatusbar(); }
//extern HWND g_hwndEdit;
#define BeginWaitCursor() { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetText(g_hwndStatus,255,L"..."); }
#define EndWaitCursor() { POINT pt; SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); UpdateStatusbar(); }
//#define Is2k() (g_uWinVer >= 0x0500)

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ extern "C" {
extern "C" HINSTANCE g_hInstance;
extern "C" HWND hwndEdit;
extern "C" HWND g_hwndEdit;
// Global settings...
extern "C" int iPrintHeader;
@ -61,7 +61,7 @@ HGLOBAL hDevNames = nullptr;
//
// EditPrint() - Code from SciTE
//
extern "C" HWND hwndStatus;
extern "C" HWND g_hwndStatus;
void StatusUpdatePrintPage(int iPageNum)
{
@ -69,11 +69,11 @@ void StatusUpdatePrintPage(int iPageNum)
FormatString(tch,COUNTOF(tch),IDS_PRINTFILE,iPageNum);
StatusSetText(hwndStatus,255,tch);
StatusSetSimple(hwndStatus,TRUE);
StatusSetText(g_hwndStatus,255,tch);
StatusSetSimple(g_hwndStatus,TRUE);
InvalidateRect(hwndStatus,nullptr,TRUE);
UpdateWindow(hwndStatus);
InvalidateRect(g_hwndStatus,nullptr,TRUE);
UpdateWindow(g_hwndStatus);
}
@ -349,7 +349,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
if (printPage) {
// Show wait cursor...
SendMessage(hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORWAIT, 0);
SendMessage(g_hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORWAIT, 0);
// Display current page number in Statusbar
StatusUpdatePrintPage(pageNum);
@ -443,10 +443,10 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
DeleteObject(fontFooter);
// Reset Statusbar to default mode
StatusSetSimple(hwndStatus,FALSE);
StatusSetSimple(g_hwndStatus,FALSE);
// Remove wait cursor...
{ POINT pt; SendMessage(hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL, 0); GetCursorPos(&pt); SetCursorPos(pt.x, pt.y); }
{ POINT pt; SendMessage(g_hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL, 0); GetCursorPos(&pt); SetCursorPos(pt.x, pt.y); }
return TRUE;
}

View File

@ -43,6 +43,8 @@
extern HINSTANCE g_hInstance;
extern HWND g_hwndMain;
extern int iSciFontQuality;
extern const int FontQuality[4];
@ -3256,6 +3258,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
if (g_pLexCurrent != &lexStandard) {
Style_SetStyles(hwnd, STYLE_DEFAULT, g_pLexCurrent->Styles[STY_DEFAULT].szValue);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, TRUE);
}
else {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, FALSE);
}
// Broadcast STYLE_DEFAULT as base style to all other style
@ -3791,7 +3797,7 @@ void Style_SetCurrentMargin(HWND hwnd, BOOL bShowSelMargin)
else {
SendMessage(hwnd, SCI_MARKERDEFINE, MARKER_NP3_BOOKMARK, SC_MARK_BACKGROUND);
}
//SendMessage(hwndEdit, SCI_SETMARGINWIDTHN, 2, 0);
//SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, 2, 0);
SendMessage(hwnd, SCI_SETMARGINWIDTHN, MARGIN_NP3_BOOKMRK, (bShowSelMargin) ? 16 : 0);
}
@ -4109,12 +4115,14 @@ void Style_SetDefaultFont(HWND hwnd, BOOL bGlobalDefault)
{
WCHAR newStyle[BUFSIZE_STYLE_VALUE] = { L'\0' };
PEDITLEXER pLexer = bGlobalDefault ? &lexStandard : g_pLexCurrent;
const int iStyle = bGlobalDefault ? STDLEXID(STY_DEFAULT) : STY_DEFAULT;
BOOL bIsStdLexer = (bGlobalDefault || (g_pLexCurrent == &lexStandard));
const PEDITLEXER pLexer = bIsStdLexer ? &lexStandard : g_pLexCurrent;
const int iStyle = bIsStdLexer ? STDLEXID(STY_DEFAULT) : STY_DEFAULT;
StringCchCopyW(newStyle, COUNTOF(newStyle), pLexer->Styles[iStyle].szValue);
if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), bGlobalDefault, FALSE, TRUE))
if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), bIsStdLexer, FALSE, TRUE))
{
// set new styles to current lexer's default text
StringCchCopyW(pLexer->Styles[iStyle].szValue, COUNTOF(pLexer->Styles[iStyle].szValue), newStyle);
@ -4716,6 +4724,8 @@ static const WCHAR* FontSelTitle2 = L"Current Scheme's Default Font";
static const WCHAR* FontSelTitle3 = L"++ Global Default Font ++";
static const WCHAR* FontSelTitle4 = L"++ Current Scheme's Default Font ++";
static WCHAR FontSelTitle[128];
/// Callback to set the font dialog's title
static UINT CALLBACK Style_FontDialogHook(
HWND hdlg, // handle to the dialog box window
@ -4810,10 +4820,25 @@ BOOL Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle,
cf.rgbColors = color;
cf.lpLogFont = &lf;
cf.lpfnHook = (LPCFHOOKPROC)Style_FontDialogHook; // Register the callback
cf.lCustData = (LPARAM)(bDefaultStyle ? (bRelFontSize ? FontSelTitle1 : FontSelTitle1) : (bRelFontSize ? FontSelTitle4 : FontSelTitle2));
cf.lCustData = (LPARAM)FontSelTitle;
//cf.Flags = CF_INITTOLOGFONTSTRUCT /*| CF_EFFECTS | CF_NOSCRIPTSEL*/ | CF_SCREENFONTS | CF_FORCEFONTEXIST | CF_ENABLEHOOK;
cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_BOTH | CF_WYSIWYG | CF_FORCEFONTEXIST | CF_ENABLEHOOK;
if (bDefaultStyle) {
if (bRelFontSize)
StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle),
L" +++ Global (%s) %s Font +++", (Style_GetUse2ndDefault() ? L"2nd Scheme" : L"1st Scheme"), lexStandard.pszName);
else
StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle),
L" Global (%s) %s Font", (Style_GetUse2ndDefault() ? L"2nd Scheme" : L"1st Scheme"), lexStandard.pszName);
}
else {
if (bRelFontSize)
StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ Default %s Font +++", g_pLexCurrent->pszName);
else
StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" Default %s Font", g_pLexCurrent->pszName);
}
if (bWithEffects)
cf.Flags |= CF_EFFECTS;
@ -5690,7 +5715,7 @@ INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lP
case IDC_PREVIEW:
{
// Hack from outside
extern HWND hwndEdit;
extern HWND g_hwndEdit;
if (pCurrentStyle)
GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue,COUNTOF(pCurrentStyle->szValue));
@ -5698,7 +5723,7 @@ INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lP
if (!GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentLexer->szExtensions,COUNTOF(pCurrentLexer->szExtensions)))
StringCchCopy(pCurrentLexer->szExtensions,COUNTOF(pCurrentLexer->szExtensions),pCurrentLexer->pszDefExt);
}
Style_SetLexer(hwndEdit,g_pLexCurrent);
Style_SetLexer(g_hwndEdit,g_pLexCurrent);
UpdateLineNumberWidth();
}
break;