mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
Merge pull request #230 from RaiKoHoff/Bugfixes_1214_II
Bugfixes 1214 ii
This commit is contained in:
commit
3a246a8a61
@ -998,7 +998,6 @@ DWORD WINAPI FileMRUIconThread(LPVOID lpParam) {
|
||||
shfi.dwAttributes = 0;
|
||||
SHGetFileInfo(PathFindFileName(tch),dwAttr,&shfi,sizeof(SHFILEINFO),dwFlags);
|
||||
}
|
||||
|
||||
else {
|
||||
shfi.dwAttributes = SFGAO_LINK | SFGAO_SHARE;
|
||||
SHGetFileInfo(tch,dwAttr,&shfi,sizeof(SHFILEINFO),dwFlags);
|
||||
@ -1095,8 +1094,6 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
|
||||
//if (!bSaveRecentFiles)
|
||||
// DialogEnableWindow(hwnd,IDC_PRESERVECARET, FALSE);
|
||||
|
||||
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
}
|
||||
return TRUE;
|
||||
@ -1279,6 +1276,7 @@ INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
|
||||
|
||||
SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),
|
||||
SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
|
||||
|
||||
lvi.iImage = shfi.iIcon;
|
||||
|
||||
for (i = 0; i < MRU_Enum(pFileMRU,0,NULL,0); i++) {
|
||||
|
||||
1343
src/Edit.c
1343
src/Edit.c
File diff suppressed because it is too large
Load Diff
@ -2457,13 +2457,11 @@ void TransformBackslashes(char* pszInput, BOOL bRegEx, UINT cpEdit, int* iReplac
|
||||
|
||||
if (bRegEx) {
|
||||
UnSlashLowOctal(pszInput);
|
||||
if (iReplaceMsg)
|
||||
replTarget = CheckRegExReplTarget(pszInput);
|
||||
replTarget = CheckRegExReplTarget(pszInput);
|
||||
}
|
||||
|
||||
if ((SCI_REPLACETARGET == replTarget) && !bRegEx)
|
||||
if (SCI_REPLACETARGET == replTarget) {
|
||||
UnSlash(pszInput, cpEdit);
|
||||
|
||||
}
|
||||
if (iReplaceMsg)
|
||||
*iReplaceMsg = replTarget;
|
||||
}
|
||||
@ -3716,8 +3714,7 @@ void DragAndDropInit(HANDLE hHeap)
|
||||
else if (g_hHeap == NULL)
|
||||
g_hHeap = hHeap;
|
||||
|
||||
OleInitialize(NULL); // just in case
|
||||
return;
|
||||
//OleInitialize(NULL); // just in case
|
||||
}
|
||||
|
||||
|
||||
@ -3759,7 +3756,6 @@ static BOOL IDRPTRG_QueryDataObject(PIDROPTARGET pDropTarget, IDataObject *pData
|
||||
if (pDataObject->lpVtbl->QueryGetData(pDataObject, &fmtetc) == S_OK)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3785,7 +3781,6 @@ static HRESULT STDMETHODCALLTYPE IDRPTRG_QueryInterface(PIDROPTARGET pThis, REFI
|
||||
*ppvObject = pThis;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
@ -3803,7 +3798,6 @@ static ULONG STDMETHODCALLTYPE IDRPTRG_Release(PIDROPTARGET pThis)
|
||||
HeapFree(GetDnDHeap(), 0, pThis);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return nCount;
|
||||
}
|
||||
|
||||
@ -3829,7 +3823,6 @@ static DWORD IDRPTRG_DropEffect(DWORD dwKeyState, POINTL pt, DWORD dwAllowed)
|
||||
if (dwAllowed & DROPEFFECT_MOVE)
|
||||
dwEffect = DROPEFFECT_MOVE;
|
||||
}
|
||||
|
||||
UNUSED(pt);
|
||||
return dwEffect;
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ __inline BOOL IniSectionSetBool(LPWSTR lpCachedIniSection, LPCWSTR lpName, BOOL
|
||||
|
||||
|
||||
//extern HWND hwndEdit;
|
||||
#define BeginWaitCursor() SendMessage(hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0)
|
||||
#define EndWaitCursor() { POINT pt; SendMessage(hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); }
|
||||
#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(); }
|
||||
|
||||
|
||||
//#define Is2k() (g_uWinVer >= 0x0500)
|
||||
|
||||
@ -3341,12 +3341,7 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
if (EditSortDlg(hwnd,&iSortOptions)) {
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
StatusSetText(hwndStatus,255,L"...");
|
||||
StatusSetSimple(hwndStatus,TRUE);
|
||||
InvalidateRect(hwndStatus,NULL,TRUE);
|
||||
UpdateWindow(hwndStatus);
|
||||
EditSortLines(hwndEdit,iSortOptions);
|
||||
StatusSetSimple(hwndStatus,FALSE);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
@ -3363,7 +3358,9 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
iWrapCol = max(min(iWrapCol,512),1);
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
EditWrapToColumn(hwndEdit,iWrapCol);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
}
|
||||
@ -3462,30 +3459,46 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
|
||||
|
||||
case IDM_EDIT_CONVERTTABS:
|
||||
BeginWaitCursor();
|
||||
EditTabsToSpaces(hwndEdit,iTabWidth,FALSE);
|
||||
EndWaitCursor();
|
||||
{
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
EditTabsToSpaces(hwndEdit, iTabWidth, FALSE);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IDM_EDIT_CONVERTSPACES:
|
||||
BeginWaitCursor();
|
||||
EditSpacesToTabs(hwndEdit,iTabWidth,FALSE);
|
||||
EndWaitCursor();
|
||||
{
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
EditSpacesToTabs(hwndEdit, iTabWidth, FALSE);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IDM_EDIT_CONVERTTABS2:
|
||||
BeginWaitCursor();
|
||||
EditTabsToSpaces(hwndEdit,iTabWidth,TRUE);
|
||||
EndWaitCursor();
|
||||
{
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
EditTabsToSpaces(hwndEdit, iTabWidth, TRUE);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IDM_EDIT_CONVERTSPACES2:
|
||||
BeginWaitCursor();
|
||||
EditSpacesToTabs(hwndEdit,iTabWidth,TRUE);
|
||||
EndWaitCursor();
|
||||
{
|
||||
BeginWaitCursor();
|
||||
int token = BeginSelUndoAction();
|
||||
EditSpacesToTabs(hwndEdit, iTabWidth, TRUE);
|
||||
EndSelUndoAction(token);
|
||||
EndWaitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -53,8 +53,8 @@ extern "C" int flagPrintFileAndLeave;
|
||||
|
||||
|
||||
// Stored objects...
|
||||
HGLOBAL hDevMode = NULL;
|
||||
HGLOBAL hDevNames = NULL;
|
||||
HGLOBAL hDevMode = nullptr;
|
||||
HGLOBAL hDevNames = nullptr;
|
||||
|
||||
|
||||
//=============================================================================
|
||||
@ -72,7 +72,7 @@ void StatusUpdatePrintPage(int iPageNum)
|
||||
StatusSetText(hwndStatus,255,tch);
|
||||
StatusSetSimple(hwndStatus,TRUE);
|
||||
|
||||
InvalidateRect(hwndStatus,NULL,TRUE);
|
||||
InvalidateRect(hwndStatus,nullptr,TRUE);
|
||||
UpdateWindow(hwndStatus);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
|
||||
WCHAR dateString[MIDSZ_BUFFER] = { L'\0' };
|
||||
|
||||
DOCINFO di = {sizeof(DOCINFO), 0, 0, 0, 0};
|
||||
DOCINFO di = {sizeof(DOCINFO), nullptr, nullptr, nullptr, 0};
|
||||
|
||||
int lengthDoc;
|
||||
int lengthDocMax;
|
||||
@ -125,7 +125,8 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
HPEN pen;
|
||||
HPEN penOld;
|
||||
|
||||
PRINTDLG pdlg = { sizeof(PRINTDLG), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
PRINTDLG pdlg = { sizeof(PRINTDLG), nullptr, nullptr, nullptr, nullptr,
|
||||
0, 0, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
|
||||
pdlg.hwndOwner = GetParent(hwnd);
|
||||
pdlg.hInstance = g_hInstance;
|
||||
pdlg.Flags = PD_USEDEVMODECOPIES | PD_ALLPAGES | PD_RETURNDC;
|
||||
@ -134,7 +135,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
pdlg.nMinPage = 1;
|
||||
pdlg.nMaxPage = 0xffffU;
|
||||
pdlg.nCopies = 1;
|
||||
pdlg.hDC = 0;
|
||||
pdlg.hDC = nullptr;
|
||||
pdlg.hDevMode = hDevMode;
|
||||
pdlg.hDevNames = hDevNames;
|
||||
|
||||
@ -265,8 +266,8 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
footerLineHeight = 0;
|
||||
|
||||
di.lpszDocName = pszDocTitle;
|
||||
di.lpszOutput = 0;
|
||||
di.lpszDatatype = 0;
|
||||
di.lpszOutput = nullptr;
|
||||
di.lpszDatatype = nullptr;
|
||||
di.fwType = 0;
|
||||
if (StartDoc(hdc, &di) < 0) {
|
||||
DeleteDC(hdc);
|
||||
@ -280,13 +281,13 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
// Get current date...
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,NULL,dateString,MIDSZ_BUFFER);
|
||||
GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&st,nullptr,dateString,MIDSZ_BUFFER);
|
||||
|
||||
// Get current time...
|
||||
if (iPrintHeader == 0)
|
||||
{
|
||||
WCHAR timeString[SMALL_BUFFER] = { L'\0' };
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,NULL,timeString,SMALL_BUFFER);
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT,TIME_NOSECONDS,&st,nullptr,timeString,SMALL_BUFFER);
|
||||
StringCchCat(dateString,COUNTOF(dateString),L" ");
|
||||
StringCchCat(dateString,COUNTOF(dateString),timeString);
|
||||
}
|
||||
@ -348,7 +349,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
if (printPage) {
|
||||
|
||||
// Show wait cursor...
|
||||
BeginWaitCursor();
|
||||
SendMessage(hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORWAIT, 0);
|
||||
|
||||
// Display current page number in Statusbar
|
||||
StatusUpdatePrintPage(pageNum);
|
||||
@ -367,7 +368,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
{
|
||||
ExtTextOut(hdc, frPrint.rc.left + 5, frPrint.rc.top - headerLineHeight / 2,
|
||||
/*ETO_OPAQUE*/0, &rcw, pszDocTitle,
|
||||
lstrlen(pszDocTitle), NULL);
|
||||
lstrlen(pszDocTitle), nullptr);
|
||||
}
|
||||
|
||||
// Print date in header
|
||||
@ -378,7 +379,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
GetTextExtentPoint32(hdc,dateString,StringCchLenW(dateString,COUNTOF(dateString)),&sizeInfo);
|
||||
ExtTextOut(hdc, frPrint.rc.right - 5 - sizeInfo.cx, frPrint.rc.top - headerLineHeight / 2,
|
||||
/*ETO_OPAQUE*/0, &rcw, dateString,
|
||||
StringCchLenW(dateString,COUNTOF(dateString)), NULL);
|
||||
StringCchLenW(dateString,COUNTOF(dateString)), nullptr);
|
||||
}
|
||||
|
||||
if (iPrintHeader < 3)
|
||||
@ -386,7 +387,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
SetTextAlign(hdc, ta);
|
||||
pen = CreatePen(0, 1, RGB(0,0,0));
|
||||
penOld = (HPEN)SelectObject(hdc, pen);
|
||||
MoveToEx(hdc, frPrint.rc.left, frPrint.rc.top - headerLineHeight / 4, NULL);
|
||||
MoveToEx(hdc, frPrint.rc.left, frPrint.rc.top - headerLineHeight / 4, nullptr);
|
||||
LineTo(hdc, frPrint.rc.right, frPrint.rc.top - headerLineHeight / 4);
|
||||
SelectObject(hdc, penOld);
|
||||
DeleteObject(pen);
|
||||
@ -412,13 +413,13 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
GetTextExtentPoint32(hdc,pageString,StringCchLenW(pageString,COUNTOF(pageString)),&sizeFooter);
|
||||
ExtTextOut(hdc, frPrint.rc.right - 5 - sizeFooter.cx, frPrint.rc.bottom + footerLineHeight / 2,
|
||||
/*ETO_OPAQUE*/0, &rcw, pageString,
|
||||
StringCchLenW(pageString,COUNTOF(pageString)), NULL);
|
||||
StringCchLenW(pageString,COUNTOF(pageString)), nullptr);
|
||||
|
||||
SetTextAlign(hdc, ta);
|
||||
pen = ::CreatePen(0, 1, RGB(0,0,0));
|
||||
penOld = (HPEN)SelectObject(hdc, pen);
|
||||
SetBkColor(hdc, RGB(0,0,0));
|
||||
MoveToEx(hdc, frPrint.rc.left, frPrint.rc.bottom + footerLineHeight / 4, NULL);
|
||||
MoveToEx(hdc, frPrint.rc.left, frPrint.rc.bottom + footerLineHeight / 4, nullptr);
|
||||
LineTo(hdc, frPrint.rc.right, frPrint.rc.bottom + footerLineHeight / 4);
|
||||
SelectObject(hdc, penOld);
|
||||
DeleteObject(pen);
|
||||
@ -445,7 +446,7 @@ extern "C" BOOL EditPrint(HWND hwnd,LPCWSTR pszDocTitle,LPCWSTR pszPageFormat)
|
||||
StatusSetSimple(hwndStatus,FALSE);
|
||||
|
||||
// Remove wait cursor...
|
||||
EndWaitCursor();
|
||||
{ POINT pt; SendMessage(hwndEdit, SCI_SETCURSOR, (WPARAM)SC_CURSORNORMAL, 0); GetCursorPos(&pt); SetCursorPos(pt.x, pt.y); }
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -79,20 +79,34 @@ __forceinline LRESULT SciCall_##fn(type1 var1, type2 var2) { \
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Selection and information
|
||||
// Selection, positions and information
|
||||
//
|
||||
//
|
||||
DeclareSciCallR0(GetLineCount, GETLINECOUNT, int);
|
||||
DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, int);
|
||||
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, int);
|
||||
DeclareSciCallR0(GetAnchor, GETANCHOR, int);
|
||||
DeclareSciCallR0(IsSelectionEmpty, GETSELECTIONEMPTY, BOOL);
|
||||
DeclareSciCallR0(GetSelectionMode, GETSELECTIONMODE, int);
|
||||
DeclareSciCallR0(GetSelectionStart, GETSELECTIONSTART, int);
|
||||
DeclareSciCallR0(GetSelectionEnd, GETSELECTIONEND, int);
|
||||
DeclareSciCallR1(GetLineSelStartPosition, GETLINESELSTARTPOSITION, int, Sci_Position, line);
|
||||
DeclareSciCallR1(GetLineSelEndPosition, GETLINESELENDPOSITION, int, Sci_Position, line);
|
||||
|
||||
DeclareSciCallV2(SetSel, SETSEL, int, anchorPos, int, currentPos);
|
||||
|
||||
DeclareSciCallV1(GotoPos, GOTOPOS, int, position);
|
||||
DeclareSciCallV1(GotoLine, GOTOLINE, int, line);
|
||||
DeclareSciCallR0(GetCurrentPos, GETCURRENTPOS, int);
|
||||
DeclareSciCallR1(PositionBefore, POSITIONBEFORE, int, Sci_Position, position);
|
||||
DeclareSciCallR1(PositionAfter, POSITIONAFTER, int, Sci_Position, position);
|
||||
|
||||
DeclareSciCallR0(GetLineCount, GETLINECOUNT, int);
|
||||
DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, int);
|
||||
DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, int, Sci_Position, position);
|
||||
DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, int, Sci_Position, line);
|
||||
DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, int, Sci_Position, line);
|
||||
DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int);
|
||||
DeclareSciCallR1(GetColumn, GETCOLUMN, int, Sci_Position, position);
|
||||
|
||||
DeclareSciCallR1(GetCharAt, GETCHARAT, char, Sci_Position, position);
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
|
||||
104
src/Styles.c
104
src/Styles.c
@ -86,7 +86,7 @@ EDITLEXER lexDefault = { SCLEX_NULL, 63000, L"Default Text", L"txt; text; wtx;
|
||||
/* 25 */ { SCI_SETEDGECOLOUR, 63122, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 26 */ { SCI_SETEXTRAASCENT + SCI_SETEXTRADESCENT, 63123, L"2nd Extra Line Spacing (Size)", L"", L"" },
|
||||
/* 27 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, 63125, L"2nd Book Marks (Colors)", L"back:#00FF00; alpha:20", L"" },
|
||||
/* 28 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, 63263, L"2nd Mark Occurrences (Colors)", L"fore:#0x00FF00; alpha:100; alpha2:100", L"" },
|
||||
/* 28 */ { SCI_MARKERSETBACK+SCI_MARKERSETALPHA, 63263, L"2nd Mark Occurrences (Colors)", L"fore:#0x00FF00; alpha:100; alpha2:100; indic_box", L"" },
|
||||
/* 29 */ { SCI_SETHOTSPOTACTIVEFORE, 63265, L"2nd Hyperlink Hotspots", L"bold; fore:#FF0000", L"" },
|
||||
|
||||
{ -1, 00000, L"", L"", L"" } } };
|
||||
@ -3198,6 +3198,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
|
||||
}
|
||||
|
||||
// Occurrences Marker
|
||||
|
||||
if (!Style_StrGetColor(TRUE, lexDefault.Styles[STY_MARK_OCC + iIdx].szValue, &iValue))
|
||||
{
|
||||
WCHAR* sty = L"";
|
||||
@ -3232,6 +3233,16 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
|
||||
}
|
||||
SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, INDIC_NP3_MARK_OCCURANCE, iValue);
|
||||
|
||||
iValue = -1; // need for retrieval
|
||||
if (!Style_GetIndicatorType(lexDefault.Styles[STY_MARK_OCC + iIdx].szValue, COUNTOF(lexDefault.Styles[STY_MARK_OCC + iIdx].szValue), &iValue)) {
|
||||
// got default, get string
|
||||
StringCchCatW(lexDefault.Styles[STY_MARK_OCC + iIdx].szValue, COUNTOF(lexDefault.Styles[0].szValue), L"; ");
|
||||
Style_GetIndicatorType(wchCaretStyle, COUNTOF(wchCaretStyle), &iValue);
|
||||
StringCchCatW(lexDefault.Styles[STY_MARK_OCC + iIdx].szValue, COUNTOF(lexDefault.Styles[0].szValue), wchCaretStyle);
|
||||
}
|
||||
SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MARK_OCCURANCE, iValue);
|
||||
|
||||
|
||||
// More default values...
|
||||
|
||||
if (pLexNew != &lexANSI)
|
||||
@ -4079,7 +4090,7 @@ BOOL Style_GetOpenDlgFilterStr(LPWSTR lpszFilter,int cchFilter)
|
||||
//
|
||||
BOOL Style_StrGetFont(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont)
|
||||
{
|
||||
WCHAR tch[256] = { L'\0' };
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
WCHAR *p = StrStrI(lpszStyle, L"font:");
|
||||
if (p)
|
||||
{
|
||||
@ -4113,7 +4124,7 @@ BOOL Style_StrGetFont(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont)
|
||||
//
|
||||
BOOL Style_StrGetFontQuality(LPCWSTR lpszStyle,LPWSTR lpszQuality,int cchQuality)
|
||||
{
|
||||
WCHAR tch[64] = { L'\0' };
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
WCHAR *p = StrStrI(lpszStyle, L"smoothing:");
|
||||
if (p)
|
||||
{
|
||||
@ -4139,9 +4150,9 @@ BOOL Style_StrGetFontQuality(LPCWSTR lpszStyle,LPWSTR lpszQuality,int cchQuality
|
||||
//
|
||||
// Style_StrGetCharSet()
|
||||
//
|
||||
BOOL Style_StrGetCharSet(LPCWSTR lpszStyle,int *i)
|
||||
BOOL Style_StrGetCharSet(LPCWSTR lpszStyle,int* i)
|
||||
{
|
||||
WCHAR tch[256] = { L'\0' };
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
WCHAR *p = StrStrI(lpszStyle, L"charset:");
|
||||
if (p)
|
||||
{
|
||||
@ -4166,7 +4177,7 @@ BOOL Style_StrGetCharSet(LPCWSTR lpszStyle,int *i)
|
||||
//
|
||||
// Style_StrGetSize()
|
||||
//
|
||||
BOOL Style_StrGetSize(LPCWSTR lpszStyle,int *i)
|
||||
BOOL Style_StrGetSize(LPCWSTR lpszStyle,int* i)
|
||||
{
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
int iSign = 0;
|
||||
@ -4259,7 +4270,7 @@ BOOL Style_StrGetColor(BOOL bFore,LPCWSTR lpszStyle,int *rgb)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetCase()
|
||||
// Style_StrGetAlpha()
|
||||
//
|
||||
BOOL Style_StrGetAlpha(LPCWSTR lpszStyle, int* i, BOOL bAlpha1st)
|
||||
{
|
||||
@ -4288,7 +4299,7 @@ BOOL Style_StrGetAlpha(LPCWSTR lpszStyle, int* i, BOOL bAlpha1st)
|
||||
//
|
||||
// Style_StrGetCase()
|
||||
//
|
||||
BOOL Style_StrGetCase(LPCWSTR lpszStyle,int *i)
|
||||
BOOL Style_StrGetCase(LPCWSTR lpszStyle,int* i)
|
||||
{
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
WCHAR *p = StrStrI(lpszStyle, L"case:");
|
||||
@ -4312,6 +4323,58 @@ BOOL Style_StrGetCase(LPCWSTR lpszStyle,int *i)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_GetIndicatorType()
|
||||
//
|
||||
|
||||
static WCHAR* IndicatorTypes[20] = {
|
||||
L"indic_plain",
|
||||
L"indic_squiggle",
|
||||
L"indic_tt",
|
||||
L"indic_diagonal",
|
||||
L"indic_strike",
|
||||
L"indic_hidden",
|
||||
L"indic_box",
|
||||
L"indic_roundbox",
|
||||
L"indic_straightbox",
|
||||
L"indic_dash",
|
||||
L"indic_dots",
|
||||
L"indic_squigglelow",
|
||||
L"indic_dotbox",
|
||||
L"indic_squigglepixmap",
|
||||
L"indic_compositionthick",
|
||||
L"indic_compositionthin",
|
||||
L"indic_fullbox",
|
||||
L"indic_textfore",
|
||||
L"indic_point",
|
||||
L"indic_pointcharacter"
|
||||
};
|
||||
|
||||
BOOL Style_GetIndicatorType(LPWSTR lpszStyle, int cchSize, int* idx)
|
||||
{
|
||||
if (*idx < 0) { // retrieve indicator style from string
|
||||
for (int i = 0; i < COUNTOF(IndicatorTypes); i++) {
|
||||
if (StrStrI(lpszStyle, IndicatorTypes[i])) {
|
||||
*idx = i;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
*idx = INDIC_ROUNDBOX; // default
|
||||
}
|
||||
else { // get indicator string from index
|
||||
|
||||
if (*idx < COUNTOF(IndicatorTypes))
|
||||
{
|
||||
StringCchCopy(lpszStyle, cchSize, IndicatorTypes[*idx]);
|
||||
return TRUE;
|
||||
}
|
||||
StringCchCopy(lpszStyle, cchSize, IndicatorTypes[INDIC_ROUNDBOX]); // default
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_SelectFont()
|
||||
@ -4467,6 +4530,17 @@ BOOL Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle,BOOL bDefaultStyle
|
||||
StringCchPrintf(tch,COUNTOF(tch),L"; alpha:%i",iValue);
|
||||
StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch);
|
||||
}
|
||||
if (Style_StrGetAlpha(lpszStyle, &iValue, FALSE)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; alpha2:%i", iValue);
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), tch);
|
||||
}
|
||||
|
||||
iValue = -1;
|
||||
if (Style_GetIndicatorType(lpszStyle, cchStyle, &iValue)) {
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; ");
|
||||
Style_GetIndicatorType(tch, COUNTOF(tch), &iValue);
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), tch);
|
||||
}
|
||||
|
||||
StrTrim(szNewStyle, L" ;");
|
||||
StringCchCopyN(lpszStyle,cchStyle,szNewStyle,COUNTOF(szNewStyle));
|
||||
@ -4598,7 +4672,6 @@ BOOL Style_SelectColor(HWND hwnd,BOOL bFore,LPWSTR lpszStyle,int cchStyle)
|
||||
StringCchPrintf(tch,COUNTOF(tch),L"; alpha:%i",iValue);
|
||||
StringCchCat(szNewStyle,COUNTOF(szNewStyle),tch);
|
||||
}
|
||||
|
||||
if (Style_StrGetAlpha(lpszStyle, &iValue, FALSE)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; alpha2:%i", iValue);
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), tch);
|
||||
@ -4610,6 +4683,13 @@ BOOL Style_SelectColor(HWND hwnd,BOOL bFore,LPWSTR lpszStyle,int cchStyle)
|
||||
if (StrStrI(lpszStyle,L"noblink"))
|
||||
StringCchCat(szNewStyle,COUNTOF(szNewStyle),L"; noblink");
|
||||
|
||||
iValue = -1;
|
||||
if (Style_GetIndicatorType(lpszStyle, cchStyle, &iValue)) {
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; ");
|
||||
Style_GetIndicatorType(tch, COUNTOF(tch), &iValue);
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), tch);
|
||||
}
|
||||
|
||||
StrTrim(szNewStyle, L" ;");
|
||||
StringCchCopyN(lpszStyle,cchStyle,szNewStyle,cchStyle);
|
||||
return TRUE;
|
||||
@ -5451,9 +5531,9 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
|
||||
ListView_InsertColumn(hwndLV,0,&lvc);
|
||||
|
||||
// Add lexers
|
||||
for (i = 0; i < COUNTOF(pLexArray); i++)
|
||||
Style_AddLexerToListView(hwndLV,pLexArray[i]);
|
||||
|
||||
for (i = 0; i < COUNTOF(pLexArray); i++) {
|
||||
Style_AddLexerToListView(hwndLV, pLexArray[i]);
|
||||
}
|
||||
ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE_USEHEADER);
|
||||
|
||||
// Select current lexer
|
||||
|
||||
@ -90,6 +90,7 @@ BOOL Style_StrGetSizeStr(LPCWSTR,LPWSTR,int);
|
||||
BOOL Style_StrGetColor(BOOL,LPCWSTR,int*);
|
||||
BOOL Style_StrGetCase(LPCWSTR,int*);
|
||||
BOOL Style_StrGetAlpha(LPCWSTR,int*,BOOL);
|
||||
BOOL Style_GetIndicatorType(LPWSTR,int,int*);
|
||||
BOOL Style_SelectFont(HWND,LPWSTR,int,BOOL);
|
||||
BOOL Style_SelectColor(HWND,BOOL,LPWSTR,int);
|
||||
void Style_SetStyles(HWND,int,LPCWSTR);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user