diff --git a/locales/en.catkeys b/locales/en.catkeys index 1c949d3..99d1050 100644 --- a/locales/en.catkeys +++ b/locales/en.catkeys @@ -1,4 +1,4 @@ -1 English x-vnd.KapiX-Koder 3292494141 +1 English x-vnd.KapiX-Koder 4243475505 Something wrong has happened while opening the configuration file. Your personal settings will not be %s%. Preferences Something wrong has happened while opening the configuration file. Your personal settings will not be %s%. Access denied EditorWindow Access denied Line endings EditorWindow Line endings @@ -156,6 +156,7 @@ Unix format EditorWindow Unix format Open Terminal EditorStatusView Open Terminal File modified EditorWindow File modified Highlight braces AppPreferencesWindow Highlight braces +Show bold folding markers AppPreferencesWindow Show bold folding markers Save selected QuitAlert Save selected Max. characters per line: AppPreferencesWindow Max. characters per line: Use block cursor AppPreferencesWindow Use block cursor diff --git a/src/editor/Editor.cpp b/src/editor/Editor.cpp index 16b7d9a..de1b492 100644 --- a/src/editor/Editor.cpp +++ b/src/editor/Editor.cpp @@ -31,6 +31,7 @@ Editor::Editor() fFoldMarginEnabled(false), fBookmarkMarginEnabled(false), fBracesHighlightingEnabled(false), + fBoldFoldMarkersEnabled(false), fTrailingWSHighlightingEnabled(false), fType(""), fReadOnly(false) @@ -478,7 +479,7 @@ Editor::SetFoldMarginEnabled(bool enabled) fFoldMarginEnabled = enabled; const int foldEnabled = SendMessage(SCI_GETPROPERTYINT, (uptr_t) "fold", 0); const int32 fontSize = SendMessage(SCI_STYLEGETSIZE, 32); - const int32 foldWidth = foldEnabled && enabled ? fontSize * 0.95 : 0; + const int32 foldWidth = foldEnabled && enabled ? fontSize * (fBoldFoldMarkersEnabled ? 1.25 : 0.95) : 0; SendMessage(SCI_SETMARGINWIDTHN, Margin::FOLD, foldWidth); } @@ -501,6 +502,30 @@ Editor::SetBracesHighlightingEnabled(bool enabled) } +void +Editor::SetBoldFoldMarkersEnabled(bool enabled) +{ + if(fBoldFoldMarkersEnabled == enabled) { + // no changes needed + return; + } + + const int32 strokeWidth = enabled ? 300 : 100; + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDER, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDEROPEN, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDEREND, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDERMIDTAIL, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDEROPENMID, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDEROPEN, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDERSUB, strokeWidth); + SendMessage(SCI_MARKERSETSTROKEWIDTH, SC_MARKNUM_FOLDERTAIL, strokeWidth); + + fBoldFoldMarkersEnabled = enabled; + // reset our margin width + SetFoldMarginEnabled(fFoldMarginEnabled); +} + + void Editor::SetTrailingWSHighlightingEnabled(bool enabled) { diff --git a/src/editor/Editor.h b/src/editor/Editor.h index 1b979e3..3279e39 100644 --- a/src/editor/Editor.h +++ b/src/editor/Editor.h @@ -90,6 +90,7 @@ class Editor : public BScintillaView { void SetFoldMarginEnabled(bool enabled); void SetBookmarkMarginEnabled(bool enabled); void SetBracesHighlightingEnabled(bool enabled); + void SetBoldFoldMarkersEnabled(bool enabled); void SetTrailingWSHighlightingEnabled(bool enabled); std::string SelectionText(); @@ -124,6 +125,7 @@ class Editor : public BScintillaView { bool fFoldMarginEnabled; bool fBookmarkMarginEnabled; bool fBracesHighlightingEnabled; + bool fBoldFoldMarkersEnabled; bool fTrailingWSHighlightingEnabled; // needed for StatusView diff --git a/src/editor/EditorWindow.cpp b/src/editor/EditorWindow.cpp index 26b4bfc..b767b06 100644 --- a/src/editor/EditorWindow.cpp +++ b/src/editor/EditorWindow.cpp @@ -1219,6 +1219,7 @@ EditorWindow::_SyncWithPreferences() fEditor->SetBookmarkMarginEnabled(fPreferences->fBookmarkMargin); fEditor->SetBracesHighlightingEnabled( fPreferences->fBracesHighlighting); + fEditor->SetBoldFoldMarkersEnabled(fPreferences->fBoldFoldMarkers); fEditor->SetTrailingWSHighlightingEnabled( fPreferences->fHighlightTrailingWhitespace); diff --git a/src/preferences/AppPreferencesWindow.cpp b/src/preferences/AppPreferencesWindow.cpp index 2fc98ef..f214928 100644 --- a/src/preferences/AppPreferencesWindow.cpp +++ b/src/preferences/AppPreferencesWindow.cpp @@ -160,6 +160,10 @@ AppPreferencesWindow::MessageReceived(BMessage* message) fPreferences->fUseBlockCursor = IsChecked(fBlockCursorCB); _PreferencesModified(); } break; + case Actions::BOLD_FOLD_MARKERS: { + fPreferences->fBoldFoldMarkers = IsChecked(fBoldFoldMarkersCB); + _PreferencesModified(); + } break; case Actions::EDITOR_STYLE: { fPreferences->fStyle = message->GetString("style", "default"); _PreferencesModified(); @@ -335,6 +339,7 @@ AppPreferencesWindow::_InitInterface() fBracesHighlightingCB = new BCheckBox("bracesHighlighting", B_TRANSLATE("Highlight braces"), new BMessage((uint32) Actions::BRACES_HIGHLIGHTING)); fBlockCursorCB = new BCheckBox("blockCursor", B_TRANSLATE("Use block cursor"), new BMessage((uint32) Actions::BLOCK_CURSOR)); + fBoldFoldMarkersCB = new BCheckBox("boldFoldMarkers", B_TRANSLATE("Show bold folding markers"), new BMessage((uint32) Actions::BOLD_FOLD_MARKERS)); fEditorStyleMenu = new BPopUpMenu("style"); fEditorStyleMF = new BMenuField("style", B_TRANSLATE("Style"), fEditorStyleMenu); @@ -374,6 +379,7 @@ AppPreferencesWindow::_InitInterface() .Add(fFullPathInTitleCB) .Add(fBracesHighlightingCB) .Add(fBlockCursorCB) + .Add(fBoldFoldMarkersCB) .Add(fToolbarBox) .AddStrut(B_USE_HALF_ITEM_SPACING) .Add(fLineLimitBox) @@ -479,6 +485,7 @@ AppPreferencesWindow::_SyncPreferences(Preferences* preferences) SetChecked(fBracesHighlightingCB, preferences->fBracesHighlighting); SetChecked(fBlockCursorCB, preferences->fUseBlockCursor); + SetChecked(fBoldFoldMarkersCB, preferences->fBoldFoldMarkers); SetChecked(fAttachNewWindowsCB, preferences->fOpenWindowsInStack); SetChecked(fHighlightTrailingWSCB, preferences->fHighlightTrailingWhitespace); SetChecked(fTrimTrailingWSOnSaveCB, preferences->fTrimTrailingWhitespaceOnSave); diff --git a/src/preferences/AppPreferencesWindow.h b/src/preferences/AppPreferencesWindow.h index c07622b..6a09031 100644 --- a/src/preferences/AppPreferencesWindow.h +++ b/src/preferences/AppPreferencesWindow.h @@ -43,6 +43,7 @@ class AppPreferencesWindow : public BWindow { TOOLBAR_ICON_SIZE = 'tlis', FULL_PATH_IN_TITLE = 'fpit', BLOCK_CURSOR = 'bloc', + BOLD_FOLD_MARKERS = 'bfld', TABS_TO_SPACES = 'ttsp', TAB_WIDTH = 'tbwd', LINE_HIGHLIGHTING = 'lhlt', @@ -136,6 +137,7 @@ class AppPreferencesWindow : public BWindow { BCheckBox* fBracesHighlightingCB; BCheckBox* fBlockCursorCB; + BCheckBox* fBoldFoldMarkersCB; BPopUpMenu* fEditorStyleMenu; BMenuField* fEditorStyleMF; diff --git a/src/preferences/Preferences.cpp b/src/preferences/Preferences.cpp index 77c43c3..df72bc6 100644 --- a/src/preferences/Preferences.cpp +++ b/src/preferences/Preferences.cpp @@ -91,6 +91,7 @@ Preferences::Load(const char* filename) fLineHighlighting = storage.GetBool("lineHighlighting", true); fLineHighlightingMode = storage.GetUInt8("lineHighlightingMode", 0); fLineNumbers = storage.GetBool("lineNumbers", true); + fBoldFoldMarkers = storage.GetBool("boldFoldMarkers", false); fFoldMargin = storage.GetBool("foldMargin", true); fBookmarkMargin = storage.GetBool("bookmarkMargin", true); fIndentGuidesShow = storage.GetBool("indentGuidesShow", true); @@ -135,6 +136,7 @@ Preferences::Save(const char* filename) storage.AddBool("lineHighlighting", fLineHighlighting); storage.AddUInt8("lineHighlightingMode", fLineHighlightingMode); storage.AddBool("lineNumbers", fLineNumbers); + storage.AddBool("boldFoldMarkers", fBoldFoldMarkers); storage.AddBool("foldMargin", fFoldMargin); storage.AddBool("bookmarkMargin", fBookmarkMargin); storage.AddBool("whiteSpaceVisible", fWhiteSpaceVisible); @@ -179,6 +181,7 @@ Preferences::operator =(Preferences& p) fLineHighlighting = p.fLineHighlighting; fLineHighlightingMode = p.fLineHighlightingMode; fLineNumbers = p.fLineNumbers; + fBoldFoldMarkers = p.fBoldFoldMarkers; fFoldMargin = p.fFoldMargin; fBookmarkMargin = p.fBookmarkMargin; fEOLVisible = p.fEOLVisible; diff --git a/src/preferences/Preferences.h b/src/preferences/Preferences.h index 398c95f..54b6fcb 100644 --- a/src/preferences/Preferences.h +++ b/src/preferences/Preferences.h @@ -37,6 +37,7 @@ class Preferences { uint8 fLineHighlightingMode; bool fLineNumbers; bool fFoldMargin; + bool fBoldFoldMarkers; bool fBookmarkMargin; bool fEOLVisible; bool fWhiteSpaceVisible;