Skip to content

Commit

Permalink
Remove "Show Folding Line" and "Show Fold Ellipsis" menus, issue #174.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Apr 6, 2020
1 parent 5064fe4 commit 4687961
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
26 changes: 4 additions & 22 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ static BOOL bMarkOccurrences;
static BOOL bMarkOccurrencesMatchCase;
static BOOL bMarkOccurrencesMatchWords;
struct EditAutoCompletionConfig autoCompletionConfig;
#define ShowCodeFolding_Default (1 | (1 << 2)) // show + ellipsis
static BOOL bShowCodeFolding;
static BOOL bShowFoldingLine;
static BOOL bFoldDisplayText;
#if NP2_ENABLE_SHOW_CALLTIPS
static BOOL bShowCallTips = TRUE;
static int iCallTipsWaitTime = 500; // 500 ms
Expand Down Expand Up @@ -1664,9 +1661,9 @@ HWND EditCreate(HWND hwndParent) {
SciCall_SetFoldFlags(SC_FOLDFLAG_LEVELNUMBERS);
#else
// Draw folding line below when collapsed
SciCall_SetFoldFlags(bShowFoldingLine ? SC_FOLDFLAG_LINEAFTER_CONTRACTED : 0);
SciCall_SetFoldFlags(0);
#endif
SciCall_FoldDisplayTextSetStyle((bFoldDisplayText ? SC_FOLDDISPLAYTEXT_BOXED : SC_FOLDDISPLAYTEXT_HIDDEN));
SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_BOXED);
const char *text = GetFoldDisplayEllipsis(SC_CP_UTF8, 0); // internal default encoding
SciCall_SetDefaultFoldDisplayText(text);
// highlight current folding block
Expand Down Expand Up @@ -2380,8 +2377,6 @@ void MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) {
//EnableCmd(hmenu, IDM_VIEW_FOLD_LEVEL9, i && bShowCodeFolding);
//EnableCmd(hmenu, IDM_VIEW_FOLD_LEVEL10, i && bShowCodeFolding);
CheckCmd(hmenu, IDM_VIEW_SHOW_FOLDING, bShowCodeFolding);
CheckCmd(hmenu, IDM_VIEW_SHOW_FOLDING_LINE, bShowFoldingLine);
CheckCmd(hmenu, IDM_VIEW_FOLD_DISPALY_TEXT, bFoldDisplayText);

CheckCmd(hmenu, IDM_VIEW_USE2NDGLOBALSTYLE, bUse2ndGlobalStyle);
CheckCmd(hmenu, IDM_VIEW_USEDEFAULT_CODESTYLE, pLexCurrent->bUseDefaultCodeStyle);
Expand Down Expand Up @@ -3886,16 +3881,6 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
}
break;

case IDM_VIEW_SHOW_FOLDING_LINE:
bShowFoldingLine = !bShowFoldingLine;
SciCall_SetFoldFlags(bShowFoldingLine ? SC_FOLDFLAG_LINEAFTER_CONTRACTED : 0);
break;

case IDM_VIEW_FOLD_DISPALY_TEXT:
bFoldDisplayText = !bFoldDisplayText;
SciCall_FoldDisplayTextSetStyle((bFoldDisplayText ? SC_FOLDDISPLAYTEXT_BOXED : SC_FOLDDISPLAYTEXT_HIDDEN));
break;

case IDM_VIEW_FOLD_DEFAULT:
if (bShowCodeFolding) {
FoldToggleDefault(FOLD_ACTION_SNIFF);
Expand Down Expand Up @@ -5179,10 +5164,7 @@ void LoadSettings(void) {

bShowSelectionMargin = IniSectionGetBool(pIniSection, L"ShowSelectionMargin", 0);
bShowLineNumbers = IniSectionGetBool(pIniSection, L"ShowLineNumbers", 1);
iValue = IniSectionGetInt(pIniSection, L"ShowCodeFolding", ShowCodeFolding_Default);
bShowCodeFolding = iValue & 1;
bShowFoldingLine = (iValue >> 1) & 1;
bFoldDisplayText = (iValue >> 2) & 1;
bShowCodeFolding = IniSectionGetBool(pIniSection, L"ShowCodeFolding", 1);

bMarkOccurrences = IniSectionGetBool(pIniSection, L"MarkOccurrences", 1);
bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection, L"MarkOccurrencesMatchCase", 0);
Expand Down Expand Up @@ -5508,7 +5490,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetIntEx(pIniSection, L"LongLineMode", iLongLineMode, EDGE_LINE);
IniSectionSetBoolEx(pIniSection, L"ShowSelectionMargin", bShowSelectionMargin, 0);
IniSectionSetBoolEx(pIniSection, L"ShowLineNumbers", bShowLineNumbers, 1);
IniSectionSetIntEx(pIniSection, L"ShowCodeFolding", bShowCodeFolding | (bShowFoldingLine << 1) | (bFoldDisplayText << 2), ShowCodeFolding_Default);
IniSectionSetBoolEx(pIniSection, L"ShowCodeFolding", bShowCodeFolding, 1);
IniSectionSetBoolEx(pIniSection, L"MarkOccurrences", bMarkOccurrences, 1);
IniSectionSetBoolEx(pIniSection, L"MarkOccurrencesMatchCase", bMarkOccurrencesMatchCase, 0);
IniSectionSetBoolEx(pIniSection, L"MarkOccurrencesMatchWholeWords", bMarkOccurrencesMatchWords, 0);
Expand Down
2 changes: 0 additions & 2 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ BEGIN
POPUP "Code &Folding"
BEGIN
MENUITEM "Show Code &Folding\tCtrl+Shift+Alt+F",IDM_VIEW_SHOW_FOLDING
MENUITEM "Show Folding &Line", IDM_VIEW_SHOW_FOLDING_LINE
MENUITEM "Show Fold &Ellipsis", IDM_VIEW_FOLD_DISPALY_TEXT
END
POPUP "&Toggle Folds"
BEGIN
Expand Down
4 changes: 2 additions & 2 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
#define IDM_VIEW_AUTOCOMPLETION_SETTINGS 40450
#define IDM_VIEW_AUTOCOMPLETION_IGNORECASE 40451
#define IDM_VIEW_SHOW_FOLDING 40452 // Ctrl+Shift+Alt+F
#define IDM_VIEW_SHOW_FOLDING_LINE 40453
// 40453
#define IDM_VIEW_FOLD_DEFAULT 40454 // Shift+Alt+D
#define IDM_VIEW_FOLD_ALL 40455 // Shift+Alt+A
#define IDM_VIEW_FOLD_LEVEL1 40456 // Alt+1
Expand Down Expand Up @@ -629,7 +629,7 @@
#define IDM_SET_BIDIRECTIONAL_L2R 40061
#define IDM_SET_BIDIRECTIONAL_R2L 40062
#define IDM_VIEW_UNICODE_CONTROL_CHAR 40063
#define IDM_VIEW_FOLD_DISPALY_TEXT 40064
// 40064
#define IDM_VIEW_FONTQUALITY_DEFAULT 40065
#define IDM_VIEW_FONTQUALITY_NONE 40066
#define IDM_VIEW_FONTQUALITY_STANDARD 40067
Expand Down

0 comments on commit 4687961

Please sign in to comment.