diff options
author | Michele Calgaro <[email protected]> | 2021-05-23 20:48:35 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-05-29 15:16:28 +0900 |
commit | 8b78a8791bc539bcffe7159f9d9714d577cb3d7d (patch) | |
tree | 1328291f966f19a22d7b13657d3f01a588eb1083 /karbon/plugins/zoomtool/vzoomtool.cc | |
parent | 95834e2bdc5e01ae1bd21ac0dfa4fa1d2417fae9 (diff) | |
download | koffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.tar.gz koffice-8b78a8791bc539bcffe7159f9d9714d577cb3d7d.zip |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'karbon/plugins/zoomtool/vzoomtool.cc')
-rw-r--r-- | karbon/plugins/zoomtool/vzoomtool.cc | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/karbon/plugins/zoomtool/vzoomtool.cc b/karbon/plugins/zoomtool/vzoomtool.cc deleted file mode 100644 index 1cecb94a..00000000 --- a/karbon/plugins/zoomtool/vzoomtool.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2002, The Karbon Developers - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - -*/ - -#include <tqcursor.h> -#include <tqevent.h> - -#include <tdelocale.h> - -#include "vzoomtool.h" -#include <karbon_part.h> -#include <karbon_part.h> -#include <karbon_view.h> -#include <karbon_view.h> -#include <render/vpainter.h> -#include <render/vpainterfactory.h> -#include <core/vcursor.h> - -VZoomTool::VZoomTool(KarbonView *view ): VTool( view, "tool_zoom_plugin" ) -{ - m_plusCursor = new TQCursor( VCursor::createCursor( VCursor::ZoomPlus ) ); - - registerTool( this ); -} - -VZoomTool::~VZoomTool() -{ - delete m_plusCursor; -} - -TQString -VZoomTool::contextHelp() -{ - TQString s = i18n( "<qt><b>Zoom tool:</b><br>" ); - s += i18n( "<i>Click and drag</i> to zoom into a rectangular area.<br>" ); - s += i18n( "<i>Right click</i> to zoom out of canvas.<br>" ); - s += i18n( "<i>Pressing +/- keys</i><br>to zoom into/out of canvas." ); - return s; -} - -void -VZoomTool::activate() -{ - VTool::activate(); - view()->setCursor( *m_plusCursor ); -} - -TQString -VZoomTool::statusText() -{ - return i18n( "Zoom Tool" ); -} - -void -VZoomTool::deactivate() -{ -} - -void -VZoomTool::draw() -{ - VPainter *painter = view()->painterFactory()->editpainter(); - painter->setRasterOp( TQt::NotROP ); - - if( isDragging() ) - { - painter->setPen( TQt::DotLine ); - painter->newPath(); - painter->moveTo( KoPoint( first().x(), first().y() ) ); - painter->lineTo( KoPoint( m_current.x(), first().y() ) ); - painter->lineTo( KoPoint( m_current.x(), m_current.y() ) ); - painter->lineTo( KoPoint( first().x(), m_current.y() ) ); - painter->lineTo( KoPoint( first().x(), first().y() ) ); - painter->strokePath(); - } -} - -void -VZoomTool::mouseButtonPress() -{ - m_current = first(); - - recalc(); - - draw(); -} - -void -VZoomTool::rightMouseButtonRelease() -{ - view()->setZoomAt( view()->zoom() * 0.75, last() ); -} - -void -VZoomTool::mouseButtonRelease() -{ - view()->setZoomAt( view()->zoom() * 1.5, last() ); -} - -void -VZoomTool::mouseDrag() -{ - draw(); - - recalc(); - - draw(); -} - -void -VZoomTool::mouseDragRelease() -{ - KoRect rect( first().x(), first().y(), last().x() - first().x(), last().y() - first().y() ); - rect = rect.normalize(); - view()->setViewportRect( rect ); -} - -bool -VZoomTool::keyReleased( TQt::Key key ) -{ - double zoomChange = 0; - if( key == TQt::Key_Minus ) - zoomChange = 0.75; - else if( key == TQt::Key_Plus ) - zoomChange = 1.50; - - if( zoomChange != 0 ) - { - view()->setZoomAt( view()->zoom() * zoomChange ); - return true; - } - return false; -} - -void -VZoomTool::recalc() -{ - m_current = last(); -} - -void -VZoomTool::setup( TDEActionCollection *collection ) -{ - m_action = static_cast<TDERadioAction *>(collection -> action( name() ) ); - - if( m_action == 0 ) - { - m_action = new TDERadioAction( i18n( "Zoom Tool" ), "14_zoom", TQt::SHIFT+TQt::Key_H, this, TQT_SLOT( activate() ), collection, name() ); - m_action->setToolTip( i18n( "Zoom" ) ); - m_action->setExclusiveGroup( "misc" ); - //m_ownAction = true; - } -} - |