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
statusBar()->addPermanentWidget(zoom_value_);
zoom_value_->setEnabled(currentBufferView());
+ act_zoom_default_ = new QAction(toqstr(bformat(_("&Reset to default (%1$d%)"),
+ lyxrc.defaultZoom)), this);
+ act_zoom_in_ = new QAction(qt_("Zoom &in"), this);
+ act_zoom_out_ = new QAction(qt_("Zoom &out"), 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);
}
+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;
{
if (value != lyxrc.currentZoom)
zoomSliderMoved(value);
+ enableZoomOptions();
}
}
+void GuiView::resetDefaultZoom()
+{
+ zoomValueChanged(lyxrc.defaultZoom);
+ enableZoomOptions();
+}
+
+
QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
{
QVector<GuiWorkArea*> areas;
class QLabel;
class QShowEvent;
class QSlider;
+class QToolButton;
namespace lyx {
///
void zoomOutPressed();
///
+ void resetDefaultZoom();
+ ///
void on_currentWorkAreaChanged(GuiWorkArea *);
///
void onBufferViewChanged();
void dispatchToBufferView(FuncRequest const & cmd, DispatchResult & dr);
///
void showMessage();
+ ///
+ void enableZoomOptions();
/// This view ID.
int id_;
/// 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