[LyX/master] Add menu to statusbar zoom value
commit f525bded59668218e86dba93240796c49e488e4b Author: Juergen Spitzmueller Date: Thu Mar 11 18:14:46 2021 +0100 Add menu to statusbar zoom value --- src/frontends/qt/GuiView.cpp | 38 +- src/frontends/qt/GuiView.h | 13 - 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 48aa13f..ceb3651 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -672,8 +672,12 @@ GuiView::GuiView(int id) connect(zoom_in_, SIGNAL(clicked()), this, SLOT(zoomInPressed())); connect(zoom_out_, SIGNAL(clicked()), this, SLOT(zoomOutPressed())); - zoom_value_ = new QLabel(statusBar()); + zoom_value_ = new QToolButton(statusBar()); zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom))); + zoom_value_->setToolButtonStyle(Qt::ToolButtonTextOnly); + zoom_value_->setAutoRaise(true); + zoom_value_->setPopupMode(QToolButton::InstantPopup); + zoom_value_->setFixedHeight(fm.height()); #if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) zoom_value_->setMinimumWidth(fm.horizontalAdvance("000%")); #else @@ -682,6 +686,21 @@ GuiView::GuiView(int id) statusBar()->addPermanentWidget(zoom_value_); zoom_value_->setEnabled(currentBufferView()); + act_zoom_default_ = new QAction(toqstr(bformat(_(" to default (%1$d%)"), + lyxrc.defaultZoom)), this); + act_zoom_in_ = new QAction(qt_("Zoom "), this); + act_zoom_out_ = new QAction(qt_("Zoom "), this); + zoom_value_->addAction(act_zoom_default_); + zoom_value_->addAction(act_zoom_in_); + zoom_value_->addAction(act_zoom_out_); + enableZoomOptions(); + connect(act_zoom_default_, SIGNAL(triggered()), + this, SLOT(resetDefaultZoom())); + connect(act_zoom_in_, SIGNAL(triggered()), + this, SLOT(zoomInPressed())); + connect(act_zoom_out_, SIGNAL(triggered()), + this, SLOT(zoomOutPressed())); + int const iconheight = max(int(d.normalIconSize), fm.height()); QSize const iconsize(iconheight, iconheight); @@ -779,6 +798,15 @@ void GuiView::checkCancelBackground() } +void GuiView::enableZoomOptions() +{ + act_zoom_default_->setEnabled(zoom_slider_->value() != lyxrc.defaultZoom); + FuncStatus status; + act_zoom_in_->setEnabled(getStatus(FuncRequest(LFUN_BUFFER_ZOOM_IN), status)); + act_zoom_out_->setEnabled(getStatus(FuncRequest(LFUN_BUFFER_ZOOM_OUT), status)); +} + + void GuiView::zoomSliderMoved(int value) { DispatchResult dr; @@ -792,6 +820,7 @@ void GuiView::zoomValueChanged(int value) { if (value != lyxrc.currentZoom) zoomSliderMoved(value); + enableZoomOptions(); } @@ -811,6 +840,13 @@ void GuiView::zoomOutPressed() } +void GuiView::resetDefaultZoom() +{ + zoomValueChanged(lyxrc.defaultZoom); + enableZoomOptions(); +} + + QVector GuiView::GuiViewPrivate::guiWorkAreas() { QVector areas; diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h index 728ed0d..015f885 100644 --- a/src/frontends/qt/GuiView.h +++ b/src/frontends/qt/GuiView.h @@ -29,6 +29,7 @@ class QPushButton; class QLabel; class QShowEvent; class QSlider; +class QToolButton; namespace lyx { @@ -253,6 +254,8 @@ private Q_SLOTS: /// void zoomOutPressed(); /// + void resetDefaultZoom(); + /// void on_currentWorkAreaChanged(GuiWorkArea *); /// void onBufferViewChanged(); @@ -476,6 +479,8 @@ private: void dispatchToBufferView(FuncRequest const & cmd, DispatchResult & dr); /// void showMessage(); + /// + void enableZoomOptions(); /// This view ID. int id_; @@ -500,13 +505,19 @@ private: /// Statusbar widget that shows version control status QLabel * version_control_; /// Statusbar widget that shows zoom value - QLabel * zoom_value_; + QToolButton * zoom_value_; /// The zoom slider widget QSlider * zoom_slider_; /// Zoom in ("+") Button QPushButton * zoom_in_; /// Zoom out ("-") Button QPushButton * zoom_out_; + /// Set zoom to default + QAction * act_zoom_default_; + /// Zoom in menu action + QAction * act_zoom_in_; + /// Zoom out menu action + QAction * act_zoom_out_; /// The rate from which the actual zoom value is calculated /// from the default zoom pref -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Update sk.po
commit 6805bb713f3a4f5dd839d470c5a9edf63fa189db Author: Kornel Benko Date: Thu Mar 11 18:41:17 2021 +0100 Update sk.po --- po/sk.po | 33 - 1 files changed, 28 insertions(+), 5 deletions(-) diff --git a/po/sk.po b/po/sk.po index 246eca1..b7b8164 100644 --- a/po/sk.po +++ b/po/sk.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: LyX-2.4\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" -"POT-Creation-Date: 2021-03-06 19:26+0100\n" -"PO-Revision-Date: 2021-03-06 19:03+\n" +"POT-Creation-Date: 2021-03-11 18:26+0100\n" +"PO-Revision-Date: 2021-03-11 17:31+\n" "Last-Translator: Kornel Benko \n" "Language-Team: Slovak \n" "Language: sk\n" @@ -33900,6 +33900,28 @@ msgstr "verzia " msgid "unknown version" msgstr "neznáma verzia" +#: src/frontends/qt/GuiView.cpp:641 +msgid "Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust." +msgstr "" +"Úroveň lupy v pracovnom poli. Použ Ctrl-+/- alebo Shift a koliesko myši na " +"úpravu." + +#: src/frontends/qt/GuiView.cpp:658 src/frontends/qt/GuiView.cpp:765 +msgid "[[ZOOM]]%1$d%" +msgstr "%1$d%" + +#: src/frontends/qt/GuiView.cpp:689 +msgid " to default (%1$d%)" +msgstr "Nastaviť na é (%1$d%)" + +#: src/frontends/qt/GuiView.cpp:691 +msgid "Zoom " +msgstr "ížiť" + +#: src/frontends/qt/GuiView.cpp:692 +msgid "Zoom " +msgstr "Oť" + #: src/frontends/qt/GuiView.cpp:639 msgid "" "WARNING: LaTeX is allowed to execute external commands for this document. " @@ -34575,6 +34597,10 @@ msgstr "Ignorovať všetky v tomto dokumente|d" msgid "Remove from personal dictionary|r" msgstr "Vyhodiť z osobného slovníka|y" +#: src/frontends/qt/Menus.cpp:884 +msgid "Remove from document dictionary|r" +msgstr "Vyhodiť zo slovníka pre dokument|u" + #: src/frontends/qt/Menus.cpp:905 msgid "Switch Language...|L" msgstr "Prepnúť jazyk…|ť" @@ -37107,9 +37133,6 @@ msgstr "Neznámy používateľ" #~ msgid "Find Ne" #~ msgstr "Hľadať ďašie" -#~ msgid "Filter:" -#~ msgstr "Filter:" - #~ msgid "Enter string to filter contents" #~ msgstr "Zadajte reťazec na filtrovanie obsahu" -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Option to hide the zoom slider
commit 2710ec08404f5d70637544e2a84943affc1715cf Author: Daniel Ramoeller Date: Mon Mar 8 06:38:33 2021 +0100 Option to hide the zoom slider Fix for bug #12187. --- src/frontends/qt/GuiView.cpp | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index ceb3651..23252c0 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -949,6 +949,7 @@ void GuiView::saveLayout() const settings.setValue("geometry", saveGeometry()); settings.setValue("layout", saveState(0)); settings.setValue("icon_size", toqstr(d.iconSize(iconSize(; + settings.setValue("zoom_slider_visible", zoom_slider_->isVisible()); } @@ -992,6 +993,9 @@ bool GuiView::restoreLayout() //code below is skipped when when ~/.config/LyX is (re)created setIconSize(d.iconSize(settings.value(icon_key).toString())); + zoom_slider_->setVisible(settings.value("zoom_slider_visible", true).toBool()); + zoom_value_->setVisible(settings.value("zoom_slider_visible", true).toBool()); + if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") { QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint(); QSize size = settings.value("size", QSize(690, 510)).toSize(); @@ -2341,7 +2345,11 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) break; case LFUN_UI_TOGGLE: - flag.setOnOff(isFullScreen()); + if (cmd.argument() == "zoomslider") { + enable = doc_buffer; + flag.setOnOff(zoom_slider_->isVisible()); + } else + flag.setOnOff(isFullScreen()); break; case LFUN_DIALOG_DISCONNECT_INSET: @@ -4842,6 +4850,9 @@ bool GuiView::lfunUiToggle(string const & ui_component) statusBar()->setVisible(!statusBar()->isVisible()); } else if (ui_component == "menubar") { menuBar()->setVisible(!menuBar()->isVisible()); + } else if (ui_component == "zoomslider") { + zoom_slider_->setVisible(!zoom_slider_->isVisible()); + zoom_value_->setVisible(!zoom_value_->isVisible()); } else if (ui_component == "frame") { int const l = contentsMargins().left(); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Add option to toggle zoom slider to zoom statusbar menu
commit 8a605ca8ad82aab306e5ea94c290b92f13544c6f Author: Juergen Spitzmueller Date: Thu Mar 11 18:41:02 2021 +0100 Add option to toggle zoom slider to zoom statusbar menu --- src/frontends/qt/GuiView.cpp | 26 +- src/frontends/qt/GuiView.h |4 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 23252c0..4c62484 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -690,9 +690,12 @@ GuiView::GuiView(int id) lyxrc.defaultZoom)), this); act_zoom_in_ = new QAction(qt_("Zoom "), this); act_zoom_out_ = new QAction(qt_("Zoom "), this); + act_zoom_show_ = new QAction(qt_("Show zoom slider")); + act_zoom_show_->setCheckable(true); zoom_value_->addAction(act_zoom_default_); zoom_value_->addAction(act_zoom_in_); zoom_value_->addAction(act_zoom_out_); + zoom_value_->addAction(act_zoom_show_); enableZoomOptions(); connect(act_zoom_default_, SIGNAL(triggered()), this, SLOT(resetDefaultZoom())); @@ -700,6 +703,8 @@ GuiView::GuiView(int id) this, SLOT(zoomInPressed())); connect(act_zoom_out_, SIGNAL(triggered()), this, SLOT(zoomOutPressed())); + connect(act_zoom_show_, SIGNAL(triggered()), + this, SLOT(toogleZoomSlider())); int const iconheight = max(int(d.normalIconSize), fm.height()); QSize const iconsize(iconheight, iconheight); @@ -840,6 +845,13 @@ void GuiView::zoomOutPressed() } +void GuiView::toogleZoomSlider() +{ + DispatchResult dr; + dispatch(FuncRequest(LFUN_UI_TOGGLE, "zoomslider"), dr); +} + + void GuiView::resetDefaultZoom() { zoomValueChanged(lyxrc.defaultZoom); @@ -993,8 +1005,11 @@ bool GuiView::restoreLayout() //code below is skipped when when ~/.config/LyX is (re)created setIconSize(d.iconSize(settings.value(icon_key).toString())); - zoom_slider_->setVisible(settings.value("zoom_slider_visible", true).toBool()); - zoom_value_->setVisible(settings.value("zoom_slider_visible", true).toBool()); + bool const show_zoom_slider = settings.value("zoom_slider_visible", true).toBool(); + zoom_slider_->setVisible(show_zoom_slider); + act_zoom_show_->setChecked(show_zoom_slider); + zoom_in_->setVisible(show_zoom_slider); + zoom_out_->setVisible(show_zoom_slider); if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") { QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint(); @@ -4852,9 +4867,10 @@ bool GuiView::lfunUiToggle(string const & ui_component) menuBar()->setVisible(!menuBar()->isVisible()); } else if (ui_component == "zoomslider") { zoom_slider_->setVisible(!zoom_slider_->isVisible()); - zoom_value_->setVisible(!zoom_value_->isVisible()); - } else - if (ui_component == "frame") { + zoom_in_->setVisible(zoom_slider_->isVisible()); + zoom_out_->setVisible(zoom_slider_->isVisible()); + act_zoom_show_->setChecked(zoom_slider_->isVisible()); + } else if (ui_component == "frame") { int const l = contentsMargins().left(); //are the frames in default state? diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h index 015f885..849718d 100644 --- a/src/frontends/qt/GuiView.h +++ b/src/frontends/qt/GuiView.h @@ -256,6 +256,8 @@ private Q_SLOTS: /// void resetDefaultZoom(); /// + void toogleZoomSlider(); + /// void on_currentWorkAreaChanged(GuiWorkArea *); /// void onBufferViewChanged(); @@ -518,6 +520,8 @@ private: QAction * act_zoom_in_; /// Zoom out menu action QAction * act_zoom_out_; + /// Show zoom slider + QAction * act_zoom_show_; /// The rate from which the actual zoom value is calculated /// from the default zoom pref -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Remove zoom slider ticks
commit a49abd73834d3a5dcf60ad0e65f0a7a3d3d72001 Author: Juergen Spitzmueller Date: Thu Mar 11 16:32:22 2021 +0100 Remove zoom slider ticks This doesn't align well --- src/frontends/qt/GuiView.cpp |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 679d84d..13e75ad 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -648,8 +648,6 @@ GuiView::GuiView(int id) zoom = zoom_min_; zoom_slider_->setValue(zoom); zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust.")); - zoom_slider_->setTickPosition(QSlider::TicksBelow); - zoom_slider_->setTickInterval(lyxrc.defaultZoom - 10); // Buttons to change zoom stepwise zoom_in_ = new QPushButton(statusBar()); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Do not scale statusbar icons
commit 7a000652c02f98dcff4d3c611b22af244409df73 Author: Juergen Spitzmueller Date: Thu Mar 11 17:22:57 2021 +0100 Do not scale statusbar icons This leads to stretched icons. --- src/frontends/qt/GuiView.cpp |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 13e75ad..48aa13f 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -688,7 +688,6 @@ GuiView::GuiView(int id) QPixmap shellescape = QIcon(getPixmap("images/", "emblem-shellescape", "svgz,png")).pixmap(iconsize); shell_escape_ = new QLabel(statusBar()); shell_escape_->setPixmap(shellescape); - shell_escape_->setScaledContents(true); shell_escape_->setAlignment(Qt::AlignCenter); shell_escape_->setContextMenuPolicy(Qt::CustomContextMenu); shell_escape_->setToolTip(qt_("WARNING: LaTeX is allowed to execute " @@ -703,7 +702,6 @@ GuiView::GuiView(int id) QPixmap readonly = QIcon(getPixmap("images/", "emblem-readonly", "svgz,png")).pixmap(iconsize); read_only_ = new QLabel(statusBar()); read_only_->setPixmap(readonly); - read_only_->setScaledContents(true); read_only_->setAlignment(Qt::AlignCenter); read_only_->hide(); statusBar()->addPermanentWidget(read_only_); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix bookmarks-goto inside insets.
commit 447a1056b4f97b102db9666a131ce85001c0676c Author: Jean-Marc Lasgouttes Date: Thu Mar 11 16:16:11 2021 +0100 Fix bookmarks-goto inside insets. A stupid oversight, as far as I can see. --- src/BufferView.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 730f0e5..4289e31 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -913,7 +913,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos, // restoration is inaccurate. If a bookmark was within an inset, // it will be restored to the left of the outmost inset that contains // the bookmark. - if (bottom_pit < int(buffer_.paragraphs().size())) { + if (!success && bottom_pit < int(buffer_.paragraphs().size())) { dit = doc_iterator_begin(_); dit.pit() = bottom_pit; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Adjust bookmark position when inserting/deleting from paragraph
commit 86bfa10abb57a0af7bbddc3af2c7cdb891c77203 Author: Jean-Marc Lasgouttes Date: Thu Mar 11 15:57:06 2021 +0100 Adjust bookmark position when inserting/deleting from paragraph Without this, bookmarks positions drift when editing. --- src/Paragraph.cpp |9 + src/Session.cpp |9 + src/Session.h |9 - 3 files changed, 26 insertions(+), 1 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index a327f15..8ac87d3 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -37,6 +37,7 @@ #include "output_xhtml.h" #include "output_docbook.h" #include "ParagraphParameters.h" +#include "Session.h" #include "SpellChecker.h" #include "texstream.h" #include "TexRow.h" @@ -832,6 +833,10 @@ void Paragraph::Private::insertChar(pos_type pos, char_type c, // Update list of misspelled positions speller_state_.increasePosAfterPos(pos); + + // Update bookmarks + theSession().bookmarks().adjustPosAfterPos(inset_owner_->buffer().fileName(), + id_, pos, 1); } @@ -916,6 +921,10 @@ bool Paragraph::eraseChar(pos_type pos, bool trackChanges) d->speller_state_.decreasePosAfterPos(pos); d->speller_state_.refreshLast(size()); + // Update bookmarks + theSession().bookmarks().adjustPosAfterPos(d->inset_owner_->buffer().fileName(), + d->id_, pos, -1); + return true; } diff --git a/src/Session.cpp b/src/Session.cpp index 16b6df7..a814991 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -353,6 +353,15 @@ BookmarksSection::bookmarksInPar(FileName const & fn, int const par_id) const } +void BookmarksSection::adjustPosAfterPos(FileName const & fn, + int const par_id, pos_type pos, int offset) +{ + for (Bookmark & bkm : bookmarks) + if (bkm.filename == fn && bkm.top_id == par_id && bkm.top_pos > pos) + bkm.top_pos += offset; +} + + LastCommandsSection::LastCommandsSection(unsigned int num) : default_num_last_commands(30), absolute_max_last_commands(100) diff --git a/src/Session.h b/src/Session.h index 857e056..b7443b9 100644 --- a/src/Session.h +++ b/src/Session.h @@ -196,7 +196,7 @@ public: /// top and bottom level information sometimes needs to be sync'ed. In particular, /// top_id is determined when a bookmark is restored from session; and /// bottom_pit and bottom_pos are determined from top_id when a bookmark - /// is save to session. (What a mess! :-) + /// is saved to session. (What a mess! :-) /// /// TODO: bottom level pit and pos will be replaced by StableDocIterator class Bookmark { @@ -268,6 +268,13 @@ public: /// return a list of bookmarks and position for this paragraph BookmarkPosList bookmarksInPar(support::FileName const & fn, int par_id) const; + /* An insertion/deletion in paragraph \c par_id of buffer \c fn +* lead to an offset \c offset after position \c pos. Update +* bookmarks accordingly. +*/ + void adjustPosAfterPos(support::FileName const & fn, + int const par_id, pos_type pos, int offset); + private: /// allow 9 regular bookmarks, bookmark 0 is temporary -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Fix deprecation warning
commit 1a35afbe8fb6a9d1495f46ad4cf7f66f1e8e592c Author: Juergen Spitzmueller Date: Thu Mar 11 19:06:03 2021 +0100 Fix deprecation warning --- src/frontends/qt/GuiWorkArea.cpp |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index 2ce276d..4050f8c 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -1829,8 +1829,13 @@ public: string const fn = (filename.extension() == "lyx") ? filename.onlyFileNameWithoutExt() : filename.onlyFileName(); filename_ = QString::fromUtf8(QByteArray::fromPercentEncoding(fn.c_str())); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + postfix_ = toqstr(filename.absoluteFilePath()). + split("/", Qt::SkipEmptyParts); +#else postfix_ = toqstr(filename.absoluteFilePath()). split("/", QString::SkipEmptyParts); +#endif postfix_.pop_back(); abs_ = toqstr(filename.absoluteFilePath()); dottedPrefix_ = false; -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs