Merge branch 'master' into features/indexmacros

This commit is contained in:
Juergen Spitzmueller 2022-10-29 11:42:14 +02:00
commit 3a949b32f0
16 changed files with 135 additions and 166 deletions

View File

@ -2002,7 +2002,7 @@ if __name__ == '__main__':
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
lyxrc_fileformat = 36
lyxrc_fileformat = 37
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''

View File

@ -162,6 +162,12 @@
# (the new default is true, so this keeps behavior the same for
# existing users)
# Incremented to format 37, by chillenb
# Remove \fullscreen_width
# Remove \fullscreen_limit
# Add \screen_width
# Add \screen_limit
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py (search for lyxrc_fileformat).
@ -492,6 +498,12 @@ def add_spellcheck_default(lines):
return
lines.append("\\spellcheck_continuously false")
def remove_fullscreen_widthlimit(line):
lower = line.lower()
if lower.startswith("\\fullscreen_width") or lower.startswith("\\fullscreen_limit"):
return (True, "")
return no_match
# End conversions for LyX 2.3 to 2.4
####################################
@ -542,5 +554,6 @@ conversions = [
[ 33, []],
[ 34, [rename_cyrillic_kmap_files]],
[ 35, [add_dark_color]],
[ 36, [add_spellcheck_default]]
[ 36, [add_spellcheck_default]],
[ 37, [remove_fullscreen_widthlimit]]
]

View File

@ -2704,7 +2704,7 @@ void Buffer::markDepClean(string const & name)
}
bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag) const
{
if (isInternal()) {
// FIXME? if there is an Buffer LFUN that can be dispatched even

View File

@ -171,7 +171,7 @@ public:
/// Can this function be exectued?
/// \return true if we made a decision
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
bool getStatus(FuncRequest const & cmd, FuncStatus & flag) const;
///
DocIterator getParFromID(int id) const;

View File

@ -342,11 +342,14 @@ int BufferView::defaultMargin() const
int BufferView::rightMargin() const
{
// The additional test for the case the outliner is opened.
if (full_screen_ && lyxrc.full_screen_limit)
return max(defaultMargin(), (width_ - lyxrc.full_screen_width) / 2);
const int screen_width = inPixels(lyxrc.screen_width);
return defaultMargin();
// The additional test for the case the outliner is opened.
if (!lyxrc.screen_limit || width_ < screen_width + 2 * defaultMargin()) {
return defaultMargin();
} else {
return (width_ - screen_width) / 2;
}
}

View File

@ -2217,7 +2217,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
if (updateNeeded)
forceBufferUpdate();
}
return valid_destination;
return false;
}
// with and without selection are handled differently

View File

@ -496,9 +496,8 @@ public:
/// return true if fullscreen update is needed
bool down();
/// move up/down in a text inset, called for LFUN_UP/DOWN,
/// return true if the cursor has moved or can move, updateNeeded
/// set to true if fullscreen update is needed, otherwise it's not
/// touched
/// return true if successful, updateNeeded set to true if fullscreen
/// update is needed, otherwise it's not touched
bool upDownInText(bool up, bool & updateNeeded);
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
/// return true if successful

View File

@ -500,8 +500,6 @@ enum FuncCode
LFUN_SPELLING_ADD_LOCAL, // jspitzm 20210306
// 390
LFUN_SPELLING_REMOVE_LOCAL, // jspitzm 20210307
LFUN_FINISHED_DOWN, // lasgouttes 20210629
LFUN_FINISHED_UP, // lasgouttes 20210629
LFUN_BRANCH_SYNC_ALL, // sanda 20220415
LFUN_INDEXMACRO_INSERT, // spitz 20220220
// 395

View File

@ -408,11 +408,6 @@ public:
/// Depth of XML command
int commanddepth;
/// Return a pointer on a new layout suitable to describe a caption.
/// FIXME: remove this eventually. This is only for tex2lyx
/// until it has proper support for the caption inset (JMarc)
static Layout * forCaption();
/// Is this spellchecked?
bool spellcheck;
/**

View File

@ -1677,22 +1677,6 @@ void LyXAction::init()
*/
{ LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
/*!
* \var lyx::FuncCode lyx::LFUN_FINISHED_UP
* \li Action: Moves the cursor out of the current slice, going up.
* \li Notion: See also #LFUN_FINISHED_DOWN.
* \endvar
*/
{ LFUN_FINISHED_UP, "", ReadOnly, Hidden },
/*!
* \var lyx::FuncCode lyx::LFUN_FINISHED_DOWN
* \li Action: Moves the cursor out of the current slice, going down.
* \li Notion: See also #LFUN_FINISHED_DOWN.
* \endvar
*/
{ LFUN_FINISHED_DOWN, "", ReadOnly, Hidden },
/*!
* \var lyx::FuncCode lyx::LFUN_FLEX_INSERT
* \li Action: Inserts CharStyle, Custom inset or XML short element.

View File

@ -60,7 +60,7 @@ namespace {
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
static unsigned int const LYXRC_FILEFORMAT = 36; // rkh: spellcheck_continuously default
static unsigned int const LYXRC_FILEFORMAT = 37; // chillenb: screen_width and screen_limit
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
@ -116,13 +116,11 @@ 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 },
{ "\\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 },
{ "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
{ "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
{ "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
@ -177,6 +175,8 @@ LexerKeyword lyxrcTags[] = {
{ "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
{ "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
{ "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
{ "\\screen_limit", LyXRC::RC_SCREEN_LIMIT },
{ "\\screen_width", LyXRC::RC_SCREEN_WIDTH },
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
{ "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
{ "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
@ -1038,8 +1038,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;
@ -1056,8 +1056,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;
@ -1920,11 +1920,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)
@ -1980,11 +1980,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 "
<< screen_width.asString()
<< '\n';
}
if (tag != RC_LAST)
@ -3064,13 +3064,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:

View File

@ -90,13 +90,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,
@ -511,9 +511,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
Length screen_width = Length(7, Length::IN);
///
bool completion_cursor_text = true;
///

View File

@ -915,12 +915,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_UP:
case LFUN_DOWN: {
// stop/start the selection
bool const select = cmd.action() == LFUN_DOWN_SELECT
|| cmd.action() == LFUN_UP_SELECT;
// move cursor up/down
bool const up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
bool select = cmd.action() == LFUN_DOWN_SELECT ||
cmd.action() == LFUN_UP_SELECT;
if (!cur.atFirstOrLastRow(up)) {
// move cursor up/down
bool up = cmd.action() == LFUN_UP_SELECT || cmd.action() == LFUN_UP;
bool const atFirstOrLastRow = cur.atFirstOrLastRow(up);
if (!atFirstOrLastRow) {
needsUpdate |= cur.selHandle(select);
cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
@ -936,35 +938,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
cur.forceBufferUpdate();
break;
}
needsUpdate |= cur.selHandle(select);
bool const can_move = cur.upDownInText(up, needsUpdate);
// if the cursor can be moved up or down at an upper level,
// delegate the dispatch to next level. Otherwise, we are
// done.
if (can_move) {
cmd = FuncRequest(up ? LFUN_FINISHED_UP : LFUN_FINISHED_DOWN);
cur.undispatched();
}
}
break;
}
case LFUN_FINISHED_UP:
case LFUN_FINISHED_DOWN: {
// move cursor up/down
bool const up = cmd.action() == LFUN_FINISHED_UP;
if (!cur.atFirstOrLastRow(up)) {
// if the cursor cannot be moved up or down do not remove
// the selection right now, but wait for the next dispatch.
if (select)
needsUpdate |= cur.selHandle(select);
cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
} else {
bool const can_move = cur.upDownInText(up, needsUpdate);
// if the cursor can be moved up or down and we are not
// moving cusor at top level, wait for the next dispatch.
// Otherwise, we are done.
if (can_move)
cur.undispatched();
cur.undispatched();
}
break;

View File

@ -33,6 +33,7 @@
#include "FuncRequest.h"
#include "KeySequence.h"
#include "Language.h"
#include "LengthCombo.h"
#include "LyXAction.h"
#include "LyX.h"
#include "PanelStack.h"
@ -2812,7 +2813,9 @@ PrefEdit::PrefEdit(GuiPreferences * form)
this, SIGNAL(changed()));
connect(citationSearchLE, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
connect(screenWidthLE, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(screenWidthUnitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SIGNAL(changed()));
connect(toggleTabbarCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
@ -2827,10 +2830,10 @@ PrefEdit::PrefEdit(GuiPreferences * form)
}
void PrefEdit::on_fullscreenLimitCB_toggled(bool const state)
void PrefEdit::on_screenLimitCB_toggled(bool const state)
{
fullscreenWidthSB->setEnabled(state);
fullscreenWidthLA->setEnabled(state);
screenWidthLE->setEnabled(state);
screenWidthUnitCO->setEnabled(state);
changed();
}
@ -2864,8 +2867,8 @@ 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 = fullscreenLimitCB->isChecked();
rc.screen_width = Length(widgetsToLength(screenWidthLE, screenWidthUnitCO));
rc.screen_limit = screenLimitCB->isChecked();
}
@ -2888,10 +2891,10 @@ 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);
fullscreenLimitCB->setChecked(rc.full_screen_limit);
fullscreenWidthSB->setEnabled(rc.full_screen_limit);
fullscreenWidthLA->setEnabled(rc.full_screen_limit);
lengthToWidgets(screenWidthLE, screenWidthUnitCO, rc.screen_width, Length::defaultUnit());
screenWidthUnitCO->setEnabled(rc.screen_limit);
screenLimitCB->setChecked(rc.screen_limit);
screenWidthLE->setEnabled(rc.screen_limit);
}

View File

@ -451,7 +451,7 @@ public:
void updateRC(LyXRC const & rc) override;
public Q_SLOTS:
void on_fullscreenLimitCB_toggled(bool);
void on_screenLimitCB_toggled(bool);
void on_citationSearchCB_toggled(bool);
};

View File

@ -212,6 +212,59 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="screenLimitCB">
<property name="toolTip">
<string>Limit the width of the text in the work area to the specified length</string>
</property>
<property name="text">
<string>&amp;Limit text width</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="screenWidthLE">
<property name="toolTip">
<string>Limit the width of the text in the work area to the specified length</string>
</property>
</widget>
</item>
<item>
<widget class="lyx::frontend::LengthCombo" name="screenWidthUnitCO"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>157</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@ -300,72 +353,6 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="6">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="fullscreenLimitCB">
<property name="text">
<string>&amp;Limit text width</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="fullscreenWidthLA">
<property name="text">
<string>Screen used (pi&amp;xels):</string>
</property>
<property name="buddy">
<cstring>fullscreenWidthSB</cstring>
</property>
</widget>
</item>
<item>
<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>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>157</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="toggleToolbarsCB">
<property name="sizePolicy">
@ -414,6 +401,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>