mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
commit
973ca7d2fa
50
src/Edit.c
50
src/Edit.c
@ -2553,6 +2553,41 @@ void EditModifyLines(HWND hwnd,LPCWSTR pwszPrefix,LPCWSTR pwszAppend)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditIndentBlock()
|
||||
//
|
||||
void EditIndentBlock(HWND hwnd, BOOL bIndent, BOOL bTabIndents, BOOL bBackspaceUnindents)
|
||||
{
|
||||
const int iCurPos = SciCall_GetCurrentPos();
|
||||
const int iAnchorPos = SciCall_GetAnchor();
|
||||
const int iCurLine = SciCall_LineFromPosition(iCurPos);
|
||||
const BOOL bSingleLine = (iCurLine == SciCall_LineFromPosition(iAnchorPos));
|
||||
int iDiff = 0;
|
||||
if (bSingleLine) {
|
||||
SendMessage(hwnd, SCI_VCHOME, 0, 0);
|
||||
if (SciCall_PositionFromLine(iCurLine) == SciCall_GetCurrentPos()) {
|
||||
SendMessage(hwnd, SCI_VCHOME, 0, 0);
|
||||
}
|
||||
iDiff = (iCurPos - SciCall_GetCurrentPos());
|
||||
}
|
||||
if (bIndent) {
|
||||
SendMessage(hwnd, SCI_SETTABINDENTS, TRUE, 0);
|
||||
SendMessage(hwnd, SCI_TAB, 0, 0);
|
||||
SendMessage(hwnd, SCI_SETTABINDENTS, bTabIndents, 0);
|
||||
}
|
||||
else if (SciCall_PositionFromLine(iCurLine) != SciCall_GetSelectionStart()) {
|
||||
SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, TRUE, 0);
|
||||
SendMessage(hwnd, SCI_DELETEBACK, 0, 0);
|
||||
SendMessage(hwnd, SCI_SETBACKSPACEUNINDENTS, bBackspaceUnindents, 0);
|
||||
}
|
||||
if (bSingleLine) {
|
||||
EditSelectEx(hwnd, SciCall_GetCurrentPos() + iDiff + (iAnchorPos - iCurPos), SciCall_GetCurrentPos() + iDiff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditAlignText()
|
||||
@ -2783,8 +2818,8 @@ void EditAlignText(HWND hwnd,int nMode)
|
||||
SendMessage(hwnd, SCI_SETTARGETRANGE, iPos, SciCall_GetLineEndPosition(iLine));
|
||||
SendMessage(hwnd, SCI_REPLACETARGET, (WPARAM)cch, (LPARAM)tchLineBuf);
|
||||
|
||||
if (nMode == ALIGN_LEFT)
|
||||
SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent);
|
||||
if (nMode == ALIGN_LEFT)
|
||||
SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2814,6 +2849,7 @@ SendMessage(hwnd, SCI_SETLINEINDENTATION, (WPARAM)iLine, (LPARAM)iMinIndent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditEncloseSelection()
|
||||
@ -2909,10 +2945,7 @@ void EditToggleLineComments(HWND hwnd, LPCWSTR pwszComment, BOOL bInsertAtStart)
|
||||
if (iLineIndentPos != iLineEndPos) {
|
||||
const int iIndentColumn = SciCall_GetColumn(iLineIndentPos);
|
||||
iCommentCol = min(iCommentCol, iIndentColumn);
|
||||
if ((iLine == iLineStart) && (iIndentColumn > iSelBegCol)) { iSelStartOffset = 0; }
|
||||
}
|
||||
else
|
||||
if (iLine == iLineStart) { iSelStartOffset = 0; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2942,7 +2975,9 @@ void EditToggleLineComments(HWND hwnd, LPCWSTR pwszComment, BOOL bInsertAtStart)
|
||||
SendMessage(hwnd, SCI_SETTARGETRANGE, iIndentPos, iIndentPos + cchComment);
|
||||
SendMessage(hwnd, SCI_REPLACETARGET, 0, (LPARAM)"");
|
||||
iSelEndOffset -= cchComment;
|
||||
if (iLine == iLineStart) { iSelStartOffset = (0 - iSelStartOffset); }
|
||||
if (iLine == iLineStart) {
|
||||
iSelStartOffset = (iSelStart == SciCall_PositionFromLine(iLine)) ? 0 : (0 - cchComment);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
@ -2957,6 +2992,9 @@ void EditToggleLineComments(HWND hwnd, LPCWSTR pwszComment, BOOL bInsertAtStart)
|
||||
const int iCommentPos = (int)SendMessage(hwnd, SCI_FINDCOLUMN, (WPARAM)iLine, (LPARAM)iCommentCol);
|
||||
SendMessage(hwnd, SCI_INSERTTEXT, (WPARAM)iCommentPos, (LPARAM)mszComment);
|
||||
iSelEndOffset += cchComment;
|
||||
if (iLine == iLineStart) {
|
||||
iSelStartOffset = (iCommentCol >= iSelBegCol) ? 0 : cchComment;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@ -88,6 +88,7 @@ void EditSpacesToTabs(HWND,int,BOOL);
|
||||
void EditMoveUp(HWND);
|
||||
void EditMoveDown(HWND);
|
||||
void EditModifyLines(HWND,LPCWSTR,LPCWSTR);
|
||||
void EditIndentBlock(HWND,BOOL,BOOL,BOOL);
|
||||
void EditAlignText(HWND,int);
|
||||
void EditEncloseSelection(HWND,LPCWSTR,LPCWSTR);
|
||||
void EditToggleLineComments(HWND,LPCWSTR,BOOL);
|
||||
|
||||
@ -2169,8 +2169,8 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
//EnableCmd(hmenu,IDM_EDIT_COPYLINE,!bReadOnly);
|
||||
//EnableCmd(hmenu,IDM_EDIT_DELETELINE,!bReadOnly);
|
||||
|
||||
//EnableCmd(hmenu,IDM_EDIT_INDENT,!bReadOnly);
|
||||
//EnableCmd(hmenu,IDM_EDIT_UNINDENT,!bReadOnly);
|
||||
//EnableCmd(hmenu,IDM_EDIT_INDENT,i /*&& !bReadOnly*/);
|
||||
//EnableCmd(hmenu,IDM_EDIT_UNINDENT,i /*&& !bReadOnly*/);
|
||||
|
||||
//EnableCmd(hmenu,IDM_EDIT_PADWITHSPACES,!bReadOnly);
|
||||
//EnableCmd(hmenu,IDM_EDIT_STRIP1STCHAR,!bReadOnly);
|
||||
@ -2179,9 +2179,9 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
|
||||
//EnableCmd(hmenu,IDM_EDIT_MERGEBLANKLINES,!bReadOnly);
|
||||
//EnableCmd(hmenu,IDM_EDIT_REMOVEBLANKLINES,!bReadOnly);
|
||||
|
||||
EnableCmd(hmenu,IDM_EDIT_SORTLINES,
|
||||
SendMessage(g_hwndEdit,SCI_LINEFROMPOSITION,(WPARAM)SendMessage(g_hwndEdit,SCI_GETSELECTIONEND,0,0),0) -
|
||||
SendMessage(g_hwndEdit,SCI_LINEFROMPOSITION,(WPARAM)SendMessage(g_hwndEdit,SCI_GETSELECTIONSTART,0,0),0) >= 1);
|
||||
EnableCmd(hmenu, IDM_EDIT_SORTLINES,
|
||||
(SciCall_LineFromPosition(SciCall_GetSelectionEnd()) -
|
||||
SciCall_LineFromPosition(SciCall_GetSelectionStart())) >= 1);
|
||||
|
||||
EnableCmd(hmenu,IDM_EDIT_COLUMNWRAP,i /*&& IsWindowsNT()*/);
|
||||
EnableCmd(hmenu,IDM_EDIT_SPLITLINES,i /*&& !bReadOnly*/);
|
||||
@ -3128,7 +3128,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_EDIT_INDENT:
|
||||
{
|
||||
int token = SciCall_IsSelectionEmpty() ? -1 : BeginUndoAction();
|
||||
SendMessage(g_hwndEdit, SCI_TAB, 0, 0);
|
||||
EditIndentBlock(g_hwndEdit, TRUE, bTabIndents, bBackspaceUnindents);
|
||||
if (token >= 0) { EndUndoAction(token); }
|
||||
}
|
||||
break;
|
||||
@ -3137,22 +3137,36 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_EDIT_UNINDENT:
|
||||
{
|
||||
int token = SciCall_IsSelectionEmpty() ? -1 : BeginUndoAction();
|
||||
SendMessage(g_hwndEdit, SCI_BACKTAB, 0, 0);
|
||||
EditIndentBlock(g_hwndEdit, FALSE, bTabIndents, bBackspaceUnindents);
|
||||
if (token >= 0) { EndUndoAction(token); }
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case CMD_TAB:
|
||||
{
|
||||
int token = SciCall_IsSelectionEmpty() ? -1 : BeginUndoAction();
|
||||
SendMessage(g_hwndEdit, SCI_TAB, 0, 0);
|
||||
if (token >= 0) { EndUndoAction(token); }
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_BACKTAB:
|
||||
{
|
||||
int token = SciCall_IsSelectionEmpty() ? -1 : BeginUndoAction();
|
||||
SendMessage(g_hwndEdit, SCI_BACKTAB, 0, 0);
|
||||
if (token >= 0) { EndUndoAction(token); }
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_CTRLTAB:
|
||||
{
|
||||
int token = SciCall_IsSelectionEmpty() ? -1 : BeginUndoAction();
|
||||
|
||||
SendMessage(g_hwndEdit, SCI_SETTABINDENTS, FALSE, 0);
|
||||
SendMessage(g_hwndEdit, SCI_SETUSETABS, TRUE, 0);
|
||||
SendMessage(g_hwndEdit, SCI_SETTABINDENTS, FALSE, 0);
|
||||
SendMessage(g_hwndEdit, SCI_TAB, 0, 0);
|
||||
SendMessage(g_hwndEdit, SCI_SETUSETABS, !bTabsAsSpaces, 0);
|
||||
SendMessage(g_hwndEdit, SCI_SETTABINDENTS, bTabIndents, 0);
|
||||
|
||||
SendMessage(g_hwndEdit, SCI_SETUSETABS, !bTabsAsSpaces, 0);
|
||||
if (token >= 0) { EndUndoAction(token); }
|
||||
}
|
||||
break;
|
||||
|
||||
@ -181,8 +181,8 @@ BEGIN
|
||||
END
|
||||
POPUP "&Block"
|
||||
BEGIN
|
||||
MENUITEM "&Indent\tTab", IDM_EDIT_INDENT
|
||||
MENUITEM "&Unindent\tShift+Tab", IDM_EDIT_UNINDENT
|
||||
MENUITEM "&Indent\t(Tab)", IDM_EDIT_INDENT
|
||||
MENUITEM "&Unindent\t(Shift+Tab)", IDM_EDIT_UNINDENT
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "&Enclose Selection"
|
||||
BEGIN
|
||||
@ -597,8 +597,8 @@ BEGIN
|
||||
VK_SUBTRACT, IDM_VIEW_ZOOMOUT, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_SUBTRACT, CMD_DECLINELIMIT, VIRTKEY, ALT, NOINVERT
|
||||
VK_SUBTRACT, CMD_DECREASENUM, VIRTKEY, CONTROL, ALT, NOINVERT
|
||||
VK_TAB, IDM_EDIT_INDENT, VIRTKEY, NOINVERT
|
||||
VK_TAB, IDM_EDIT_UNINDENT, VIRTKEY, SHIFT, NOINVERT
|
||||
VK_TAB, CMD_TAB, VIRTKEY, NOINVERT
|
||||
VK_TAB, CMD_BACKTAB, VIRTKEY, SHIFT, NOINVERT
|
||||
VK_TAB, CMD_CTRLTAB, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_UP, CMD_ALTUP, VIRTKEY, ALT, NOINVERT
|
||||
VK_UP, IDM_EDIT_MOVELINEUP, VIRTKEY, SHIFT, CONTROL, NOINVERT
|
||||
|
||||
145
src/Styles.c
145
src/Styles.c
@ -4711,7 +4711,7 @@ BOOL Style_GetIndicatorType(LPWSTR lpszStyle, int cchSize, int* idx)
|
||||
//
|
||||
// Style_CopyStyles_IfNotDefined()
|
||||
//
|
||||
void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, int cchSizeDest)
|
||||
void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, int cchSizeDest, BOOL bCopyFont, BOOL bWithEffects)
|
||||
{
|
||||
WCHAR szTmpStyle[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
|
||||
@ -4719,52 +4719,86 @@ void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, in
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
|
||||
// --------- Font settings ---------
|
||||
if (!StrStrI(lpszStyleDest, L"font:")) {
|
||||
if (Style_StrGetFont(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
if (bCopyFont)
|
||||
{
|
||||
if (!StrStrI(lpszStyleDest, L"font:")) {
|
||||
if (Style_StrGetFont(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
// --------- Size ---------
|
||||
if (!StrStrI(lpszStyleDest, L"size:")) {
|
||||
if (Style_StrGetSizeStr(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; size:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"thin") && !StrStrI(lpszStyleDest, L"thin"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; thin");
|
||||
else if (StrStrI(lpszStyleSrc, L"extralight") && !StrStrI(lpszStyleDest, L"extralight"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extralight");
|
||||
else if (StrStrI(lpszStyleSrc, L"light") && !StrStrI(lpszStyleDest, L"light"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; light");
|
||||
else if (StrStrI(lpszStyleSrc, L"normal") && !StrStrI(lpszStyleDest, L"normal"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal");
|
||||
else if (StrStrI(lpszStyleSrc, L"medium") && !StrStrI(lpszStyleDest, L"medium"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; medium");
|
||||
else if (StrStrI(lpszStyleSrc, L"semibold") && !StrStrI(lpszStyleDest, L"semibold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; semibold");
|
||||
else if (StrStrI(lpszStyleSrc, L"extrabold") && !StrStrI(lpszStyleDest, L"extrabold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extrabold");
|
||||
else if (StrStrI(lpszStyleSrc, L"bold") && !StrStrI(lpszStyleDest, L"bold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; bold");
|
||||
else if (StrStrI(lpszStyleSrc, L"heavy") && !StrStrI(lpszStyleDest, L"heavy"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; heavy");
|
||||
//else
|
||||
// StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal");
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"italic") && !StrStrI(lpszStyleDest, L"italic")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; italic");
|
||||
}
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"charset:")) {
|
||||
if (Style_StrGetCharSet(lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; charset:%i", iValue);
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"thin") && !StrStrI(lpszStyleDest, L"thin"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; thin");
|
||||
else if (StrStrI(lpszStyleSrc, L"extralight") && !StrStrI(lpszStyleDest, L"extralight"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extralight");
|
||||
else if (StrStrI(lpszStyleSrc, L"light") && !StrStrI(lpszStyleDest, L"light"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; light");
|
||||
else if (StrStrI(lpszStyleSrc, L"normal") && !StrStrI(lpszStyleDest, L"normal"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal");
|
||||
else if (StrStrI(lpszStyleSrc, L"medium") && !StrStrI(lpszStyleDest, L"medium"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; medium");
|
||||
else if (StrStrI(lpszStyleSrc, L"semibold") && !StrStrI(lpszStyleDest, L"semibold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; semibold");
|
||||
else if (StrStrI(lpszStyleSrc, L"extrabold") && !StrStrI(lpszStyleDest, L"extrabold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; extrabold");
|
||||
else if (StrStrI(lpszStyleSrc, L"bold") && !StrStrI(lpszStyleDest, L"bold"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; bold");
|
||||
else if (StrStrI(lpszStyleSrc, L"heavy") && !StrStrI(lpszStyleDest, L"heavy"))
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; heavy");
|
||||
//else
|
||||
// StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; normal");
|
||||
// --------- Effects ---------
|
||||
if (bWithEffects)
|
||||
{
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"charset:")) {
|
||||
if (Style_StrGetCharSet(lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; charset:%i", iValue);
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
if (StrStrI(lpszStyleSrc, L"strikeout") && !StrStrI(lpszStyleDest, L"strikeout")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; strikeout");
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"underline") && !StrStrI(lpszStyleDest, L"underline")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; underline");
|
||||
}
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"fore:")) { // foreground
|
||||
if (Style_StrGetColor(TRUE, lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X",
|
||||
(int)GetRValue(iValue), (int)GetGValue(iValue), (int)GetBValue(iValue));
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"back:")) { // background
|
||||
if (Style_StrGetColor(FALSE, lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X",
|
||||
(int)GetRValue(iValue), (int)GetGValue(iValue), (int)GetBValue(iValue));
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"italic") && !StrStrI(lpszStyleDest, L"italic")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; italic");
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"underline") && !StrStrI(lpszStyleDest, L"underline")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; underline");
|
||||
}
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"strikeout") && !StrStrI(lpszStyleDest, L"strikeout")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; strikeout");
|
||||
}
|
||||
// --------- Special Styles ---------
|
||||
|
||||
if (StrStrI(lpszStyleSrc, L"eolfilled") && !StrStrI(lpszStyleDest, L"eolfilled")) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; eolfilled");
|
||||
@ -4782,32 +4816,6 @@ void Style_CopyStyles_IfNotDefined(LPWSTR lpszStyleSrc, LPWSTR lpszStyleDest, in
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), (iValue == SC_CASE_UPPER) ? L"u" : L"");
|
||||
}
|
||||
|
||||
|
||||
// --------- Size ---------
|
||||
if (!StrStrI(lpszStyleDest, L"size:")) {
|
||||
if (Style_StrGetSizeStr(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; size:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
// --------- Colors ---------
|
||||
if (!StrStrI(lpszStyleDest, L"fore:")) { // foreground
|
||||
if (Style_StrGetColor(TRUE, lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; fore:#%02X%02X%02X",
|
||||
(int)GetRValue(iValue), (int)GetGValue(iValue), (int)GetBValue(iValue));
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"back:")) { // background
|
||||
if (Style_StrGetColor(FALSE, lpszStyleSrc, &iValue)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; back:#%02X%02X%02X",
|
||||
(int)GetRValue(iValue), (int)GetGValue(iValue), (int)GetBValue(iValue));
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
}
|
||||
|
||||
if (!StrStrI(lpszStyleDest, L"alpha:")) {
|
||||
if (Style_StrGetAlpha(lpszStyleSrc, &iValue, TRUE)) {
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"; alpha:%i", iValue);
|
||||
@ -5056,6 +5064,7 @@ BOOL Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bWithEffects) {
|
||||
|
||||
if (lf.lfUnderline) {
|
||||
@ -5111,7 +5120,7 @@ BOOL Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
|
||||
if (bPreserveStyles) {
|
||||
// copy all other styles
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; ");
|
||||
Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle));
|
||||
Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), FALSE, !bWithEffects);
|
||||
}
|
||||
|
||||
StrTrim(szNewStyle, L" ;");
|
||||
@ -5189,7 +5198,7 @@ BOOL Style_SelectColor(HWND hwnd,BOOL bForeGround,LPWSTR lpszStyle,int cchStyle,
|
||||
if (bPreserveStyles) {
|
||||
// copy all other styles
|
||||
StringCchCat(szNewStyle, COUNTOF(szNewStyle), L"; ");
|
||||
Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle));
|
||||
Style_CopyStyles_IfNotDefined(lpszStyle, szNewStyle, COUNTOF(szNewStyle), TRUE, FALSE);
|
||||
}
|
||||
|
||||
StrTrim(szNewStyle, L" ;");
|
||||
|
||||
@ -98,7 +98,7 @@ BOOL Style_StrGetColor(BOOL,LPCWSTR,int*);
|
||||
BOOL Style_StrGetCase(LPCWSTR,int*);
|
||||
BOOL Style_StrGetAlpha(LPCWSTR,int*,BOOL);
|
||||
BOOL Style_GetIndicatorType(LPWSTR,int,int*);
|
||||
void Style_CopyStyles_IfNotDefined(LPWSTR, LPWSTR, int);
|
||||
void Style_CopyStyles_IfNotDefined(LPWSTR,LPWSTR,int,BOOL,BOOL);
|
||||
BOOL Style_SelectFont(HWND,LPWSTR,int,LPCWSTR,LPCWSTR,BOOL,BOOL,BOOL,BOOL);
|
||||
BOOL Style_SelectColor(HWND,BOOL,LPWSTR,int,BOOL);
|
||||
void Style_SetStyles(HWND,int,LPCWSTR);
|
||||
|
||||
@ -227,6 +227,8 @@
|
||||
#define CMD_ALTDOWN 20043
|
||||
#define CMD_ALTLEFT 20044
|
||||
#define CMD_ALTRIGHT 20045
|
||||
#define CMD_TAB 20046
|
||||
#define CMD_BACKTAB 20047
|
||||
#define IDM_FILE_NEW 40000
|
||||
#define IDM_FILE_OPEN 40001
|
||||
#define IDM_FILE_REVERT 40002
|
||||
|
||||
Loading…
Reference in New Issue
Block a user