mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Fix bug #6129: Show paragraph marks / pilcrows.
To be activated in Tools->Preferences->Display. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31155 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
41c1dcdc27
commit
6ee19b2a54
@ -239,6 +239,7 @@ ColorSet::ColorSet()
|
||||
{ Color_buttonframe, N_("frame of button"), "buttonframe", "#dcd2c8", "buttonframe" },
|
||||
{ Color_buttonbg, N_("button background"), "buttonbg", "#dcd2c8", "buttonbg" },
|
||||
{ Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "buttonhoverbg" },
|
||||
{ Color_paragraphmarker, N_("paragraph marker"), "paragraphmarker", grey60, "paragraphmarker"},
|
||||
{ Color_inherit, N_("inherit"), "inherit", "black", "inherit" },
|
||||
{ Color_ignore, N_("ignore"), "ignore", "black", "ignore" },
|
||||
{ Color_ignore, 0, 0, 0, 0 }
|
||||
|
@ -189,6 +189,8 @@ enum ColorCode
|
||||
Color_buttonbg,
|
||||
/// Color used for buttom under focus
|
||||
Color_buttonhoverbg,
|
||||
/// Color used for the pilcrow sign to mark the end of a paragraph
|
||||
Color_paragraphmarker,
|
||||
|
||||
// Logical attributes
|
||||
|
||||
|
@ -126,6 +126,7 @@ LexerKeyword lyxrcTags[] = {
|
||||
{ "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
|
||||
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
|
||||
{ "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
|
||||
{ "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
|
||||
{ "\\path_prefix", LyXRC::RC_PATH_PREFIX },
|
||||
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT },
|
||||
{ "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
|
||||
@ -296,6 +297,7 @@ void LyXRC::setDefaults()
|
||||
date_insert_format = "%x";
|
||||
cursor_follows_scrollbar = false;
|
||||
scroll_below_document = false;
|
||||
paragraph_markers = false;
|
||||
mac_like_word_movement = false;
|
||||
macro_edit_style = MACRO_EDIT_INLINE_BOX;
|
||||
dialogs_iconify_with_main = false;
|
||||
@ -854,6 +856,10 @@ int LyXRC::read(Lexer & lexrc)
|
||||
lexrc >> scroll_below_document;
|
||||
break;
|
||||
|
||||
case RC_PARAGRAPH_MARKERS:
|
||||
lexrc >> paragraph_markers;
|
||||
break;
|
||||
|
||||
case RC_MAC_LIKE_WORD_MOVEMENT:
|
||||
lexrc >> mac_like_word_movement;
|
||||
break;
|
||||
@ -1609,6 +1615,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_PARAGRAPH_MARKERS:
|
||||
if (ignore_system_lyxrc ||
|
||||
paragraph_markers
|
||||
!= system_lyxrc.paragraph_markers) {
|
||||
os << "\\paragraph_markers "
|
||||
<< convert<string>(paragraph_markers) << '\n';
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_MAC_LIKE_WORD_MOVEMENT:
|
||||
if (ignore_system_lyxrc ||
|
||||
mac_like_word_movement
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
RC_NOMENCL_COMMAND,
|
||||
RC_NUMLASTFILES,
|
||||
RC_OPEN_BUFFERS_IN_TABS,
|
||||
RC_PARAGRAPH_MARKERS,
|
||||
RC_PATH_PREFIX,
|
||||
RC_PERS_DICT,
|
||||
RC_PLAINTEXT_LINELEN,
|
||||
@ -328,6 +329,8 @@ public:
|
||||
unsigned int plaintext_linelen;
|
||||
/// Accept compound words in spellchecker?
|
||||
bool spellchecker_accept_compound;
|
||||
/// End of paragraph markers?
|
||||
bool paragraph_markers;
|
||||
/// Use tooltips?
|
||||
bool use_tooltip;
|
||||
/// Use pixmap cache?
|
||||
|
@ -831,11 +831,20 @@ pos_type TextMetrics::rowBreakPoint(int width, pit_type const pit,
|
||||
// pixel width since last breakpoint
|
||||
int chunkwidth = 0;
|
||||
|
||||
docstring const s(1, char_type(0x00B6));
|
||||
Font f;
|
||||
int par_marker_width = theFontMetrics(f).width(s);
|
||||
|
||||
FontIterator fi = FontIterator(*this, par, pit, pos);
|
||||
pos_type point = end;
|
||||
pos_type i = pos;
|
||||
for ( ; i < end; ++i, ++fi) {
|
||||
int thiswidth = pm.singleWidth(i, *fi);
|
||||
|
||||
if (i == end - 1 && lyxrc.paragraph_markers)
|
||||
// enlarge the last character to hold the
|
||||
// end-of-par marker
|
||||
thiswidth += par_marker_width;
|
||||
|
||||
// add inline completion width
|
||||
if (inlineCompletionLPos == i) {
|
||||
@ -965,6 +974,13 @@ int TextMetrics::rowWidth(int right_margin, pit_type const pit,
|
||||
}
|
||||
}
|
||||
|
||||
// count the paragraph end marker.
|
||||
if (end == par.size() && lyxrc.paragraph_markers) {
|
||||
docstring const s(1, char_type(0x00B6));
|
||||
Font f;
|
||||
w += theFontMetrics(f).width(s);
|
||||
}
|
||||
|
||||
if (body_pos > 0 && body_pos >= end) {
|
||||
FontMetrics const & fm = theFontMetrics(
|
||||
text_->labelFont(par));
|
||||
@ -1664,6 +1680,12 @@ int TextMetrics::cursorX(CursorSlice const & sl,
|
||||
if (end > 0 && end < par.size() && par.isSeparator(end - 1))
|
||||
skipped_sep_vpos = bidi.log2vis(end - 1);
|
||||
|
||||
if (lyxrc.paragraph_markers && text_->isRTL(par)) {
|
||||
FontInfo f;
|
||||
docstring const s = docstring(1, char_type(0x00B6));
|
||||
x += theFontMetrics(f).width(s);
|
||||
}
|
||||
|
||||
// Inline completion RTL special case row_pos == cursor_pos:
|
||||
// "__|b" => cursor_pos is right of __
|
||||
if (row_pos == inlineCompletionVPos && row_pos == cursor_vpos) {
|
||||
|
@ -1066,11 +1066,12 @@ void PrefColors::changeLyxObjectsSelection()
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
PrefDisplay::PrefDisplay(GuiPreferences * form)
|
||||
: PrefModule(qt_(catLookAndFeel), qt_("Graphics"), form)
|
||||
: PrefModule(qt_(catLookAndFeel), qt_("Display"), form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(displayGraphicsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
connect(instantPreviewCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
|
||||
connect(paragraphMarkerCB, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
}
|
||||
|
||||
|
||||
@ -1083,6 +1084,7 @@ void PrefDisplay::apply(LyXRC & rc) const
|
||||
}
|
||||
|
||||
rc.display_graphics = displayGraphicsCB->isChecked();
|
||||
rc.paragraph_markers = paragraphMarkerCB->isChecked();
|
||||
|
||||
// FIXME!! The graphics cache no longer has a changeDisplay method.
|
||||
#if 0
|
||||
@ -1110,6 +1112,7 @@ void PrefDisplay::update(LyXRC const & rc)
|
||||
|
||||
displayGraphicsCB->setChecked(rc.display_graphics);
|
||||
instantPreviewCO->setEnabled(rc.display_graphics);
|
||||
paragraphMarkerCB->setChecked(rc.paragraph_markers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,6 +63,26 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="paragraphMarkerCB" >
|
||||
<property name="text" >
|
||||
<string>&Mark end of paragraphs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="2" row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -687,6 +687,15 @@ void RowPainter::paintLast()
|
||||
}
|
||||
|
||||
case END_LABEL_NO_LABEL:
|
||||
if (lyxrc.paragraph_markers) {
|
||||
docstring const s = docstring(1, char_type(0x00B6));
|
||||
FontInfo f = FontInfo();
|
||||
FontMetrics const & fm = theFontMetrics(f);
|
||||
double const x = x_;
|
||||
f.setColor(Color_paragraphmarker);
|
||||
pi_.pain.text(int(x), yo_, s, f);
|
||||
x_ += fm.width(s);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user