mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Add +/- buttons to zoom slider
This commit is contained in:
parent
3c43a01ba2
commit
ebb7ee7d5f
@ -650,12 +650,29 @@ GuiView::GuiView(int id)
|
|||||||
zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust."));
|
zoom_slider_->setToolTip(qt_("Workarea zoom level. Drag, use Ctrl-+/- or Shift-Mousewheel to adjust."));
|
||||||
zoom_slider_->setTickPosition(QSlider::TicksBelow);
|
zoom_slider_->setTickPosition(QSlider::TicksBelow);
|
||||||
zoom_slider_->setTickInterval(lyxrc.defaultZoom - 10);
|
zoom_slider_->setTickInterval(lyxrc.defaultZoom - 10);
|
||||||
|
|
||||||
|
// Buttons to change zoom stepwise
|
||||||
|
zoom_in_ = new QPushButton(statusBar());
|
||||||
|
zoom_in_->setText("+");
|
||||||
|
zoom_in_->setFlat(true);
|
||||||
|
zoom_in_->setFixedSize(QSize(fm.height(), fm.height()));
|
||||||
|
zoom_out_ = new QPushButton(statusBar());
|
||||||
|
zoom_out_->setText("-");
|
||||||
|
zoom_out_->setFixedSize(QSize(fm.height(), fm.height()));
|
||||||
|
zoom_out_->setFlat(true);
|
||||||
|
|
||||||
|
statusBar()->addPermanentWidget(zoom_out_);
|
||||||
|
zoom_out_->setEnabled(currentBufferView());
|
||||||
statusBar()->addPermanentWidget(zoom_slider_);
|
statusBar()->addPermanentWidget(zoom_slider_);
|
||||||
zoom_slider_->setEnabled(currentBufferView());
|
zoom_slider_->setEnabled(currentBufferView());
|
||||||
|
zoom_out_->setEnabled(currentBufferView());
|
||||||
|
statusBar()->addPermanentWidget(zoom_in_);
|
||||||
|
|
||||||
connect(zoom_slider_, SIGNAL(sliderMoved(int)), this, SLOT(zoomSliderMoved(int)));
|
connect(zoom_slider_, SIGNAL(sliderMoved(int)), this, SLOT(zoomSliderMoved(int)));
|
||||||
connect(zoom_slider_, SIGNAL(valueChanged(int)), this, SLOT(zoomValueChanged(int)));
|
connect(zoom_slider_, SIGNAL(valueChanged(int)), this, SLOT(zoomValueChanged(int)));
|
||||||
connect(this, SIGNAL(currentZoomChanged(int)), zoom_slider_, SLOT(setValue(int)));
|
connect(this, SIGNAL(currentZoomChanged(int)), zoom_slider_, SLOT(setValue(int)));
|
||||||
|
connect(zoom_in_, SIGNAL(clicked()), this, SLOT(zoomInPressed()));
|
||||||
|
connect(zoom_out_, SIGNAL(clicked()), this, SLOT(zoomOutPressed()));
|
||||||
|
|
||||||
zoom_value_ = new QLabel(statusBar());
|
zoom_value_ = new QLabel(statusBar());
|
||||||
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom)));
|
zoom_value_->setText(toqstr(bformat(_("[[ZOOM]]%1$d%"), zoom)));
|
||||||
@ -782,6 +799,22 @@ void GuiView::zoomValueChanged(int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiView::zoomInPressed()
|
||||||
|
{
|
||||||
|
DispatchResult dr;
|
||||||
|
dispatch(FuncRequest(LFUN_BUFFER_ZOOM_IN), dr);
|
||||||
|
currentWorkArea()->scheduleRedraw(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiView::zoomOutPressed()
|
||||||
|
{
|
||||||
|
DispatchResult dr;
|
||||||
|
dispatch(FuncRequest(LFUN_BUFFER_ZOOM_OUT), dr);
|
||||||
|
currentWorkArea()->scheduleRedraw(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
|
QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
|
||||||
{
|
{
|
||||||
QVector<GuiWorkArea*> areas;
|
QVector<GuiWorkArea*> areas;
|
||||||
@ -1369,6 +1402,8 @@ void GuiView::onBufferViewChanged()
|
|||||||
updateDialogs();
|
updateDialogs();
|
||||||
zoom_slider_->setEnabled(currentBufferView());
|
zoom_slider_->setEnabled(currentBufferView());
|
||||||
zoom_value_->setEnabled(currentBufferView());
|
zoom_value_->setEnabled(currentBufferView());
|
||||||
|
zoom_in_->setEnabled(currentBufferView());
|
||||||
|
zoom_out_->setEnabled(currentBufferView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QDragEnterEvent;
|
class QDragEnterEvent;
|
||||||
class QDropEvent;
|
class QDropEvent;
|
||||||
|
class QPushButton;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
class QSlider;
|
class QSlider;
|
||||||
@ -248,6 +249,10 @@ private Q_SLOTS:
|
|||||||
///
|
///
|
||||||
void zoomValueChanged(int);
|
void zoomValueChanged(int);
|
||||||
///
|
///
|
||||||
|
void zoomInPressed();
|
||||||
|
///
|
||||||
|
void zoomOutPressed();
|
||||||
|
///
|
||||||
void on_currentWorkAreaChanged(GuiWorkArea *);
|
void on_currentWorkAreaChanged(GuiWorkArea *);
|
||||||
///
|
///
|
||||||
void onBufferViewChanged();
|
void onBufferViewChanged();
|
||||||
@ -498,6 +503,10 @@ private:
|
|||||||
QLabel * zoom_value_;
|
QLabel * zoom_value_;
|
||||||
/// The zoom slider widget
|
/// The zoom slider widget
|
||||||
QSlider * zoom_slider_;
|
QSlider * zoom_slider_;
|
||||||
|
/// Zoom in ("+") Button
|
||||||
|
QPushButton * zoom_in_;
|
||||||
|
/// Zoom out ("-") Button
|
||||||
|
QPushButton * zoom_out_;
|
||||||
|
|
||||||
/// The rate from which the actual zoom value is calculated
|
/// The rate from which the actual zoom value is calculated
|
||||||
/// from the default zoom pref
|
/// from the default zoom pref
|
||||||
|
Loading…
Reference in New Issue
Block a user