diff --git a/src/dialogs/katedialogs.cpp b/src/dialogs/katedialogs.cpp --- a/src/dialogs/katedialogs.cpp +++ b/src/dialogs/katedialogs.cpp @@ -670,6 +670,7 @@ connect(textareaUi->chkShowTabs, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(textareaUi->chkShowSpaces, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(textareaUi->chkShowIndentationLines, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); + connect(textareaUi->sliSetMarkerSize, SIGNAL(valueChanged(int)), this, SLOT(slotChanged())); connect(textareaUi->chkShowWholeBracketExpression, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(textareaUi->chkAnimateBracketMatching, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(textareaUi->chkFoldFirstLine, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); @@ -712,6 +713,7 @@ KateViewConfig::global()->setDynWordWrapAlignIndent(textareaUi->sbDynamicWordWrapDepth->value()); KateDocumentConfig::global()->setShowTabs(textareaUi->chkShowTabs->isChecked()); KateDocumentConfig::global()->setShowSpaces(textareaUi->chkShowSpaces->isChecked()); + KateDocumentConfig::global()->setMarkerSize(textareaUi->sliSetMarkerSize->value()); KateViewConfig::global()->setLineNumbers(bordersUi->chkLineNumbers->isChecked()); KateViewConfig::global()->setIconBar(bordersUi->chkIconBorder->isChecked()); KateViewConfig::global()->setScrollBarMarks(bordersUi->chkScrollbarMarks->isChecked()); @@ -741,6 +743,7 @@ textareaUi->sbDynamicWordWrapDepth->setValue(KateViewConfig::global()->dynWordWrapAlignIndent()); textareaUi->chkShowTabs->setChecked(KateDocumentConfig::global()->showTabs()); textareaUi->chkShowSpaces->setChecked(KateDocumentConfig::global()->showSpaces()); + textareaUi->sliSetMarkerSize->setValue(KateDocumentConfig::global()->markerSize()); bordersUi->chkLineNumbers->setChecked(KateViewConfig::global()->lineNumbers()); bordersUi->chkIconBorder->setChecked(KateViewConfig::global()->iconBar()); bordersUi->chkScrollbarMarks->setChecked(KateViewConfig::global()->scrollBarMarks()); diff --git a/src/dialogs/textareaappearanceconfigwidget.ui b/src/dialogs/textareaappearanceconfigwidget.ui --- a/src/dialogs/textareaappearanceconfigwidget.ui +++ b/src/dialogs/textareaappearanceconfigwidget.ui @@ -1,211 +1,246 @@ - TextareaAppearanceConfigWidget - - - - - - If this option is checked, the text lines will be wrapped at the view border on the screen. - - - &Dynamic Word Wrap - - - true - - - - - - Dynamic &word wrap indicators (if applicable): - - - cmbDynamicWordWrapIndicator - - - - - - - Choose when the Dynamic Word Wrap Indicators should be displayed. - - - - - - - Align dynamically wrapped lines to indentation depth: - - - sbDynamicWordWrapDepth - - - - - - - - 0 - 0 - - - - <p>Enables the start of dynamically wrapped lines to be aligned vertically to the indentation level of the first line. This can help to make code and markup more readable.</p><p>Additionally, this allows you to set a maximum width of the screen, as a percentage, after which dynamically wrapped lines will no longer be vertically aligned. For example, at 50%, lines whose indentation levels are deeper than 50% of the width of the screen will not have vertical alignment applied to subsequent wrapped lines.</p> - - - Disabled - - - % of View Width - - - 80 - - - 10 - - - - - - - - - - Whitespace Highlighting - - - - - - The editor will display a symbol to indicate the presence of a tab in the text. - - - &Highlight tabulators - - - + TextareaAppearanceConfigWidget + + - - - Highlight trailing &spaces - - + + + If this option is checked, the text lines will be wrapped at the view border on the screen. + + + &Dynamic Word Wrap + + + true + + + + + + Dynamic &word wrap indicators (if applicable): + + + cmbDynamicWordWrapIndicator + + + + + + + Choose when the Dynamic Word Wrap Indicators should be displayed. + + + + + + + Align dynamically wrapped lines to indentation depth: + + + sbDynamicWordWrapDepth + + + + + + + + 0 + 0 + + + + <p>Enables the start of dynamically wrapped lines to be aligned vertically to the indentation level of the first line. This can help to make code and markup more readable.</p><p>Additionally, this allows you to set a maximum width of the screen, as a percentage, after which dynamically wrapped lines will no longer be vertically aligned. For example, at 50%, lines whose indentation levels are deeper than 50% of the width of the screen will not have vertical alignment applied to subsequent wrapped lines.</p> + + + Disabled + + + % of View Width + + + 80 + + + 10 + + + + + - - - - - - - Advanced - - - - - If this is enabled, the editor will display vertical lines to help identify indent lines. - - - Show i&ndentation lines - - + + + Whitespace Highlighting + + + + + + The editor will display a symbol to indicate the presence of a tab in the text. + + + &Highlight tabulators + + + + + + + Highlight trailing &spaces + + + + + + + 1 + + + + + + Highlight marker size: + + + + + + + Size of the visible highlight marker. + + + Qt::Horizontal + + + 1 + + + 5 + + + 1 + + + + + + + + - - - If this is enabled, the range between the selected matching brackets will be highlighted. - - - Highlight range between selected brackets - - - - - - - Flash matching brackets - - - If this is enabled, matching brackets are animated for better visibility. - - - Animate bracket matching - - - - - - - When this setting is enabled, the editor view automatically folds + + + Advanced + + + + + + If this is enabled, the editor will display vertical lines to help identify indent lines. + + + Show i&ndentation lines + + + + + + + If this is enabled, the range between the selected matching brackets will be highlighted. + + + Highlight range between selected brackets + + + + + + + Flash matching brackets + + + If this is enabled, matching brackets are animated for better visibility. + + + Animate bracket matching + + + + + + + When this setting is enabled, the editor view automatically folds comment blocks that start on the first line of the document. This is helpful to hide license headers which are commonly placed at the beginning of a file. - - - Fold first line - - + + + Fold first line + + + + + + + + + + Qt::Vertical + + + + 0 + 1 + + + - - - - - - - Qt::Vertical - - - - 0 - 1 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- - - - gbWordWrap - toggled(bool) - cmbDynamicWordWrapIndicator - setEnabled(bool) - - - 115 - 7 - - - 340 - 44 - - - - - gbWordWrap - toggled(bool) - sbDynamicWordWrapDepth - setEnabled(bool) - - - 59 - 6 - - - 385 - 72 - - - - + + + + + KComboBox + QComboBox +
kcombobox.h
+
+
+ + + + gbWordWrap + toggled(bool) + cmbDynamicWordWrapIndicator + setEnabled(bool) + + + 115 + 7 + + + 340 + 44 + + + + + gbWordWrap + toggled(bool) + sbDynamicWordWrapDepth + setEnabled(bool) + + + 59 + 6 + + + 385 + 72 + + + +
diff --git a/src/render/katerenderer.h b/src/render/katerenderer.h --- a/src/render/katerenderer.h +++ b/src/render/katerenderer.h @@ -181,6 +181,11 @@ */ void setShowTrailingSpaces(bool showSpaces); + /** + * Update marker size shown. + */ + void updateMarkerSize(); + /** * @returns whether non-printable spaces should be shown */ @@ -403,6 +408,7 @@ bool m_showSelections; bool m_showTabs; bool m_showSpaces; + float m_markerSize; bool m_showNonPrintableSpaces; bool m_printerFriendly; QColor m_caretOverrideColor; diff --git a/src/render/katerenderer.cpp b/src/render/katerenderer.cpp --- a/src/render/katerenderer.cpp +++ b/src/render/katerenderer.cpp @@ -63,6 +63,9 @@ // initialize with a sane font height updateFontHeight(); + + // make the proper calculation for markerSize + updateMarkerSize(); } KateRenderer::~KateRenderer() @@ -267,7 +270,8 @@ { QPen penBackup(paint.pen()); QPen pen(config()->tabMarkerColor()); - pen.setWidthF(spaceWidth() / 3.5); + + pen.setWidthF(m_markerSize); pen.setCapStyle(Qt::RoundCap); paint.setPen(pen); paint.setRenderHint(QPainter::Antialiasing, true); @@ -948,6 +952,14 @@ m_fontHeight = qMax(1, qFloor(height)); } +void KateRenderer::updateMarkerSize() +{ + // marker size will be calculated over the value defined + // on dialog + + m_markerSize = spaceWidth() / (3.5 - (m_doc->config()->markerSize() * 0.5)); +} + qreal KateRenderer::spaceWidth() const { return config()->fontMetrics().width(spaceChar); diff --git a/src/utils/kateconfig.h b/src/utils/kateconfig.h --- a/src/utils/kateconfig.h +++ b/src/utils/kateconfig.h @@ -239,6 +239,9 @@ void setShowSpaces(bool on); bool showSpaces() const; + void setMarkerSize(uint markerSize); + uint markerSize() const; + void setReplaceTabsDyn(bool on); bool replaceTabsDyn() const; @@ -359,6 +362,7 @@ bool m_showTabs : 1; bool m_showSpacesSet : 1; bool m_showSpaces : 1; + uint m_markerSize; bool m_replaceTabsDynSet : 1; bool m_replaceTabsDyn : 1; bool m_removeSpacesSet : 1; diff --git a/src/utils/kateconfig.cpp b/src/utils/kateconfig.cpp --- a/src/utils/kateconfig.cpp +++ b/src/utils/kateconfig.cpp @@ -307,6 +307,7 @@ const char KEY_INDENT_PASTED_TEXT[] = "Indent On Text Paste"; const char KEY_BACKSPACE_INDENTS[] = "Indent On Backspace"; const char KEY_SHOW_SPACES[] = "Show Spaces"; +const char KEY_MARKER_SIZE[] = "Trailing Marker Size"; const char KEY_REPLACE_TABS_DYN[] = "ReplaceTabsDyn"; const char KEY_REMOVE_SPACES[] = "Remove Spaces"; const char KEY_NEWLINE_AT_EOF[] = "Newline at End of File"; @@ -348,6 +349,7 @@ setIndentPastedText(config.readEntry(KEY_INDENT_PASTED_TEXT, false)); setBackspaceIndents(config.readEntry(KEY_BACKSPACE_INDENTS, true)); setShowSpaces(config.readEntry(KEY_SHOW_SPACES, false)); + setMarkerSize(config.readEntry(KEY_MARKER_SIZE, 1)); setReplaceTabsDyn(config.readEntry(KEY_REPLACE_TABS_DYN, true)); setRemoveSpaces(config.readEntry(KEY_REMOVE_SPACES, 0)); setNewLineAtEof(config.readEntry(KEY_NEWLINE_AT_EOF, true)); @@ -398,6 +400,7 @@ config.writeEntry(KEY_INDENT_PASTED_TEXT, indentPastedText()); config.writeEntry(KEY_BACKSPACE_INDENTS, backspaceIndents()); config.writeEntry(KEY_SHOW_SPACES, showSpaces()); + config.writeEntry(KEY_MARKER_SIZE, markerSize()); config.writeEntry(KEY_REPLACE_TABS_DYN, replaceTabsDyn()); config.writeEntry(KEY_REMOVE_SPACES, removeSpaces()); config.writeEntry(KEY_NEWLINE_AT_EOF, newLineAtEof()); @@ -752,6 +755,28 @@ return s_global->showSpaces(); } +void KateDocumentConfig::setMarkerSize(uint markerSize) +{ + if (m_markerSize == markerSize) { + return; + } + + configStart(); + + m_markerSize = markerSize; + + configEnd(); +} + +uint KateDocumentConfig::markerSize() const +{ + if (isGlobal()) { + return m_markerSize; + } + + return s_global->markerSize(); +} + void KateDocumentConfig::setReplaceTabsDyn(bool on) { if (m_replaceTabsDynSet && m_replaceTabsDyn == on) { diff --git a/src/view/kateviewinternal.cpp b/src/view/kateviewinternal.cpp --- a/src/view/kateviewinternal.cpp +++ b/src/view/kateviewinternal.cpp @@ -2955,6 +2955,7 @@ renderer()->setCaretStyle(m_currentInputMode->caretStyle()); renderer()->setShowTabs(doc()->config()->showTabs()); renderer()->setShowTrailingSpaces(doc()->config()->showSpaces()); + renderer()->updateMarkerSize(); int sy = startz * h; paint.translate(unionRect.x(), startz * h);