mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 00:38:01 +00:00
Fix bug #3038: wish for lfuns for zoom-in and zoom-out
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29077 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
876dc0d54e
commit
6b5ce8a999
@ -423,6 +423,8 @@ enum FuncCode
|
||||
LFUN_INSET_BEGIN_SELECT, // JMarc, 20090316
|
||||
LFUN_INSET_END_SELECT, // JMarc, 20090316
|
||||
LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325
|
||||
LFUN_BUFFER_ZOOM_IN, // vfr, 20090330
|
||||
LFUN_BUFFER_ZOOM_OUT, // vfr, 20090330
|
||||
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
|
@ -3204,6 +3204,24 @@ void LyXAction::init()
|
||||
*/
|
||||
{ LFUN_COPY_LABEL_AS_REF, "copy-label-as-reference", ReadOnly | NoUpdate, Edit },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BUFFER_ZOOM_IN
|
||||
* \li Action: Increases the zoom of the screen fonts.
|
||||
* \li Syntax: buffer-zoom-in
|
||||
* \li Origin: vfr, 30 Mar 2009
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_BUFFER_ZOOM_IN, "buffer-zoom-in", ReadOnly, Buffer },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BUFFER_ZOOM_OUT
|
||||
* \li Action: Decreases the zoom of the screen fonts.
|
||||
* \li Syntax: buffer-zoom-out
|
||||
* \li Origin: vfr, 30 Mar 2009
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_BUFFER_ZOOM_OUT, "buffer-zoom-out", ReadOnly, Buffer },
|
||||
|
||||
{ LFUN_NOACTION, "", Noop, Hidden }
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
};
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "Dialog.h"
|
||||
#include "FileDialog.h"
|
||||
#include "FontLoader.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "GuiCommandBuffer.h"
|
||||
#include "GuiCompleter.h"
|
||||
@ -55,13 +56,14 @@
|
||||
#include "Toolbars.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "support/lassert.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/ExceptionMessage.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/ForkedCalls.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/os.h"
|
||||
#include "support/Package.h"
|
||||
@ -1326,13 +1328,21 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
enable = false;
|
||||
break;
|
||||
|
||||
case LFUN_COMPLETION_CANCEL:
|
||||
case LFUN_COMPLETION_CANCEL:
|
||||
if (!d.current_work_area_
|
||||
|| (!d.current_work_area_->completer().popupVisible()
|
||||
&& !d.current_work_area_->completer().inlineVisible()))
|
||||
enable = false;
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_ZOOM_OUT:
|
||||
enable = buf && lyxrc.zoom > 10;
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_ZOOM_IN:
|
||||
enable = buf;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -2202,6 +2212,25 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
||||
d.current_work_area_->completer().activate();
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_ZOOM_IN:
|
||||
case LFUN_BUFFER_ZOOM_OUT:
|
||||
if (cmd.argument().empty()) {
|
||||
if (cmd.action == LFUN_BUFFER_ZOOM_IN)
|
||||
lyxrc.zoom += 20;
|
||||
else
|
||||
lyxrc.zoom -= 20;
|
||||
} else
|
||||
lyxrc.zoom += convert<int>(cmd.argument());
|
||||
|
||||
if (lyxrc.zoom < 10)
|
||||
lyxrc.zoom = 10;
|
||||
|
||||
// The global QPixmapCache is used in GuiPainter to cache text
|
||||
// painting so we must reset it.
|
||||
QPixmapCache::clear();
|
||||
guiApp->fontLoader().update();
|
||||
lyx::dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
|
||||
break;
|
||||
|
||||
default:
|
||||
dispatched = false;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "graphics/GraphicsImage.h"
|
||||
#include "graphics/GraphicsLoader.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/FileName.h"
|
||||
@ -810,15 +811,8 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
|
||||
// documentation of QWheelEvent)
|
||||
int const delta = ev->delta() / 120;
|
||||
if (ev->modifiers() & Qt::ControlModifier) {
|
||||
lyxrc.zoom += 5 * delta;
|
||||
if (lyxrc.zoom < 10)
|
||||
lyxrc.zoom = 10;
|
||||
// The global QPixmapCache is used in GuiPainter to cache text
|
||||
// painting so we must reset it.
|
||||
QPixmapCache::clear();
|
||||
guiApp->fontLoader().update();
|
||||
ev->accept();
|
||||
lyx::dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
|
||||
docstring arg = convert<docstring>(5 * delta);
|
||||
lyx::dispatch(FuncRequest(LFUN_BUFFER_ZOOM_IN, arg));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user