On 2020-08-01 13:42, Stephan Witt wrote:
Am 01.08.2020 um 12:50 schrieb racoon <xraco...@gmx.de>:
On 2020-08-01 12:43, Stephan Witt wrote:
Am 01.08.2020 um 09:48 schrieb Daniel <xraco...@gmx.de>:
I am trying to fix Ticket #9376. My attempt so far is attached. However, I have
hit a little road block in that the clang compiler does not give me useful
information (for me at least):
CXXLD lyx
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
lyx::convert<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >,
lyx::Length>(lyx::Length)", referenced from:
lyx::LyXRC::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool,
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
const in liblyxcore.a(LyXRC.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [lyx] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
ERROR: Cannot build and install lyx for x86_64.
Maybe someone knows what I might be doing wrong?
IMO, it’s the change from int for full_screen_width to Length for screen_width.
In LyXRC::write() the operator << is not implemented for Length, probably.
Sounds plausible. So, short of implementing << for length, I should
probably store the length in some other format, like string. Length
seems to have a function for that: asString().
Yes, the lyxrc file stores strings only anyway :)
You have a similar problem with the opposite direction.
The "lexrc >> screen_width“ construct may not lead to errors at compile or link
time.
But may result in dataloss silently if the >> operator doesn’t do the right
thing.
Furthermore the move from „\fullscreen_width“ to „\screen_width“ in rc file
requires
the appropriate converter for existing rc files to the new syntax.
Yes, a pref2pref conversion is necessary anyway, since the new version
should store a length and a unit while the previous one only stored a
length.
Okay, I give up for now.
I tried to do it properly with strings this time. However, I can't
figure out how to get a Length from a string. From the name
Length::Length(string const & data)
seemed promising but I don't think it's the right function. (By the way
"widgetsToLength" also does not what the name suggests, i.e. it returns
a string rather than a Length.)
I am still getting the linker failure with the patch attached.
Daniel
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index fe02be5019..3758387e99 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -345,12 +345,13 @@ int BufferView::rightMargin() const
{
// The value used to be hardcoded to 10
int const default_margin = zoomedPixels(10);
+ int const screen_width = inPixels(Length(lyxrc.screen_width));
// The additional test for the case the outliner is opened.
- if (!full_screen_ || !lyxrc.full_screen_limit
- || width_ < lyxrc.full_screen_width + 2 * default_margin)
+ if (!lyxrc.screen_limit
+ || width_ < screen_width + 2 * default_margin)
return default_margin;
- return (width_ - lyxrc.full_screen_width) / 2;
+ return (width_ - screen_width) / 2;
}
@@ -2129,7 +2130,7 @@ void BufferView::dispatch(FuncRequest const & cmd,
DispatchResult & dr)
icp["key"] = from_utf8(arg);
if (!opt1.empty())
icp["before"] = from_utf8(opt1);
- icp["literal"] =
+ icp["literal"] =
from_ascii(InsetCitation::last_literal ? "true" :
"false");
string icstr = InsetCommand::params2string(icp);
FuncRequest fr(LFUN_INSET_INSERT, icstr);
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 42df207154..57d5078b80 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -112,13 +112,13 @@ LexerKeyword lyxrcTags[] = {
{ "\\format", LyXRC::RC_FILEFORMAT },
{ "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
{ "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
- { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
+ { "\\screen_limit", LyXRC::RC_SCREEN_LIMIT },
{ "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
{ "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
{ "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
{ "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
{ "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
- { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
+ { "\\screen_width", LyXRC::RC_SCREEN_WIDTH },
{ "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
{ "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
{ "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
@@ -1015,8 +1015,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool
check_format)
case RC_GROUP_LAYOUTS:
lexrc >> group_layouts;
break;
- case RC_FULL_SCREEN_LIMIT:
- lexrc >> full_screen_limit;
+ case RC_SCREEN_LIMIT:
+ lexrc >> screen_limit;
break;
case RC_FULL_SCREEN_TOOLBARS:
lexrc >> full_screen_toolbars;
@@ -1033,8 +1033,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool
check_format)
case RC_FULL_SCREEN_MENUBAR:
lexrc >> full_screen_menubar;
break;
- case RC_FULL_SCREEN_WIDTH:
- lexrc >> full_screen_width;
+ case RC_SCREEN_WIDTH:
+ lexrc >> screen_width;
break;
case RC_OPEN_BUFFERS_IN_TABS:
lexrc >> open_buffers_in_tabs;
@@ -1813,11 +1813,11 @@ void LyXRC::write(ostream & os, bool
ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
// fall through
- case RC_FULL_SCREEN_LIMIT:
+ case RC_SCREEN_LIMIT:
if (ignore_system_lyxrc ||
- full_screen_limit != system_lyxrc.full_screen_limit) {
- os << "\\fullscreen_limit "
- << convert<string>(full_screen_limit)
+ screen_limit != system_lyxrc.screen_limit) {
+ os << "\\screen_limit "
+ << convert<string>(screen_limit)
<< '\n';
}
if (tag != RC_LAST)
@@ -1873,11 +1873,11 @@ void LyXRC::write(ostream & os, bool
ignore_system_lyxrc, string const & name) c
if (tag != RC_LAST)
break;
// fall through
- case RC_FULL_SCREEN_WIDTH:
+ case RC_SCREEN_WIDTH:
if (ignore_system_lyxrc ||
- full_screen_width != system_lyxrc.full_screen_width) {
- os << "\\fullscreen_width "
- << convert<string>(full_screen_width)
+ screen_width != system_lyxrc.screen_width) {
+ os << "\\screen_width "
+ << convert<string>(screen_width)
<< '\n';
}
if (tag != RC_LAST)
@@ -2929,13 +2929,13 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC
const & lyxrc_new)
case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
case LyXRC::RC_SINGLE_INSTANCE:
case LyXRC::RC_SORT_LAYOUTS:
- case LyXRC::RC_FULL_SCREEN_LIMIT:
+ case LyXRC::RC_SCREEN_LIMIT:
case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
case LyXRC::RC_FULL_SCREEN_MENUBAR:
case LyXRC::RC_FULL_SCREEN_STATUSBAR:
case LyXRC::RC_FULL_SCREEN_TABBAR:
case LyXRC::RC_FULL_SCREEN_TOOLBARS:
- case LyXRC::RC_FULL_SCREEN_WIDTH:
+ case LyXRC::RC_SCREEN_WIDTH:
case LyXRC::RC_VISUAL_CURSOR:
case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
case LyXRC::RC_VIEWER:
diff --git a/src/LyXRC.h b/src/LyXRC.h
index ed7511a6d1..3a631ad86b 100644
--- a/src/LyXRC.h
+++ b/src/LyXRC.h
@@ -86,13 +86,13 @@ public:
RC_FILEFORMAT,
RC_FORWARD_SEARCH_DVI,
RC_FORWARD_SEARCH_PDF,
- RC_FULL_SCREEN_LIMIT,
+ RC_SCREEN_LIMIT,
RC_FULL_SCREEN_SCROLLBAR,
RC_FULL_SCREEN_STATUSBAR,
RC_FULL_SCREEN_TABBAR,
RC_FULL_SCREEN_MENUBAR,
RC_FULL_SCREEN_TOOLBARS,
- RC_FULL_SCREEN_WIDTH,
+ RC_SCREEN_WIDTH,
RC_GEOMETRY_SESSION,
RC_GROUP_LAYOUTS,
RC_GUI_LANGUAGE,
@@ -498,9 +498,9 @@ public:
/// Toggle statusbar in fullscreen mode?
bool full_screen_statusbar = true;
/// Limit the text width?
- bool full_screen_limit = false;
- /// Width of limited screen (in pixels) in fullscreen mode
- int full_screen_width = 700;
+ bool screen_limit = false;
+ /// Width of limited screen width
+ std::string screen_width = Length(7, Length::IN).asString();
///
bool completion_cursor_text = true;
///
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 98aa0c12b8..46edc6936a 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -34,6 +34,7 @@
#include "KeyMap.h"
#include "KeySequence.h"
#include "Language.h"
+#include "LengthCombo.h"
#include "LyXAction.h"
#include "LyX.h"
#include "PanelStack.h"
@@ -2756,10 +2757,12 @@ PrefEdit::PrefEdit(GuiPreferences * form)
this, SIGNAL(changed()));
connect(cursorWidthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
- connect(fullscreenLimitGB, SIGNAL(clicked()),
+ connect(screenLimitGB, SIGNAL(clicked()),
this, SIGNAL(changed()));
- connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
+ connect(screenWidthLE, SIGNAL(textChanged(const QString &)),
this, SIGNAL(changed()));
+ connect(screenWidthUnitCO, SIGNAL(activated(lyx::Length::UNIT)),
+ this, SLOT(change_adaptor()));
connect(toggleTabbarCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(toggleMenubarCB, SIGNAL(toggled(bool)),
@@ -2792,13 +2795,16 @@ void PrefEdit::applyRC(LyXRC & rc) const
rc.full_screen_statusbar = toggleStatusbarCB->isChecked();
rc.full_screen_tabbar = toggleTabbarCB->isChecked();
rc.full_screen_menubar = toggleMenubarCB->isChecked();
- rc.full_screen_width = fullscreenWidthSB->value();
- rc.full_screen_limit = fullscreenLimitGB->isChecked();
+ rc.screen_width = widgetsToLength(screenWidthLE, screenWidthUnitCO);
+ rc.screen_limit = screenLimitGB->isChecked();
}
void PrefEdit::updateRC(LyXRC const & rc)
{
+ // set the default unit
+ Length::UNIT const default_unit = Length::defaultUnit();
+
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
scrollBelowCB->setChecked(rc.scroll_below_document);
macLikeCursorMovementCB->setChecked(rc.mac_like_cursor_movement);
@@ -2812,8 +2818,8 @@ void PrefEdit::updateRC(LyXRC const & rc)
toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
toggleTabbarCB->setChecked(rc.full_screen_tabbar);
toggleMenubarCB->setChecked(rc.full_screen_menubar);
- fullscreenWidthSB->setValue(rc.full_screen_width);
- fullscreenLimitGB->setChecked(rc.full_screen_limit);
+ lengthToWidgets(screenWidthLE, screenWidthUnitCO,
Length(rc.screen_width), default_unit);
+ screenLimitGB->setChecked(rc.screen_limit);
}
diff --git a/src/frontends/qt/ui/PrefEditUi.ui
b/src/frontends/qt/ui/PrefEditUi.ui
index 987dc92d90..ab3964492b 100644
--- a/src/frontends/qt/ui/PrefEditUi.ui
+++ b/src/frontends/qt/ui/PrefEditUi.ui
@@ -46,19 +46,6 @@
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>200</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="0" column="0">
<widget class="QCheckBox" name="cursorFollowsCB">
<property name="text">
@@ -66,39 +53,6 @@
</property>
</widget>
</item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="toolTip">
- <string>Configure the width of the text cursor. Automatic
zoom-controlled cursor width used when set to 0.</string>
- </property>
- <property name="text">
- <string>Cursor width (&pixels):</string>
- </property>
- <property name="buddy">
- <cstring>cursorWidthSB</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="cursorWidthSB">
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item row="7" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -129,6 +83,16 @@
</property>
</widget>
</item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="copyCTMarkupCB">
+ <property name="toolTip">
+ <string>If this is checked, deleted and added text in change tracking
mode will not be resolved on copy/paste operations and when moving content
from/to insets</string>
+ </property>
+ <property name="text">
+ <string>&Keep change tracking markup on copy and paste</string>
+ </property>
+ </widget>
+ </item>
<item row="7" column="0" colspan="2">
<widget class="QComboBox" name="macroEditStyleCO">
<item>
@@ -148,14 +112,78 @@
</item>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QCheckBox" name="copyCTMarkupCB">
- <property name="toolTip">
- <string>If this is checked, deleted and added text in change tracking
mode will not be resolved on copy/paste operations and when moving content
from/to insets</string>
+ <item row="1" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="toolTip">
+ <string>Configure the width of the text cursor. Automatic
zoom-controlled cursor width used when set to 0.</string>
+ </property>
+ <property name="text">
+ <string>Cursor width (&pixels):</string>
+ </property>
+ <property name="buddy">
+ <cstring>cursorWidthSB</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="cursorWidthSB">
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="8" column="0" colspan="2">
+ <widget class="QGroupBox" name="screenLimitGB">
+ <property name="title">
+ <string>&Limit text width</string>
</property>
- <property name="text">
- <string>&Keep change tracking markup on copy and paste</string>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
</property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="screenWidthLE"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Screen used:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="lyx::frontend::LengthCombo" name="screenWidthUnitCO"/>
+ </item>
+ </layout>
</widget>
</item>
</layout>
@@ -214,47 +242,6 @@
</property>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QGroupBox" name="fullscreenLimitGB">
- <property name="title">
- <string>&Limit text width</string>
- </property>
- <property name="flat">
- <bool>true</bool>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Screen used (&pixels):</string>
- </property>
- <property name="buddy">
- <cstring>fullscreenWidthSB</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="fullscreenWidthSB">
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>700</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item row="4" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
@@ -287,6 +274,13 @@
</layout>
</widget>
<layoutdefault spacing="4" margin="9"/>
+ <customwidgets>
+ <customwidget>
+ <class>lyx::frontend::LengthCombo</class>
+ <extends>QComboBox</extends>
+ <header>LengthCombo.h</header>
+ </customwidget>
+ </customwidgets>
<tabstops>
<tabstop>cursorFollowsCB</tabstop>
<tabstop>cursorWidthSB</tabstop>
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel