You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
2.9 KiB
109 lines
2.9 KiB
14 years ago
|
/*
|
||
4 years ago
|
* kis_tool_example.cpp -- part of Chalk
|
||
14 years ago
|
*
|
||
|
* Copyright (c) 2006 Emanuele Tamponi <emanuele@valinor.it>
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program 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 General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
|
||
|
#include <tqpainter.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#include <tqrect.h>
|
||
|
|
||
12 years ago
|
#include <tdeaction.h>
|
||
14 years ago
|
#include <kdebug.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
14 years ago
|
#include <kdebug.h>
|
||
|
#include <knuminput.h>
|
||
|
|
||
|
#include "kis_global.h"
|
||
|
#include "kis_doc.h"
|
||
|
#include "kis_painter.h"
|
||
|
#include "kis_point.h"
|
||
|
#include "kis_canvas_subject.h"
|
||
|
#include "kis_canvas_controller.h"
|
||
|
#include "kis_button_press_event.h"
|
||
|
#include "kis_button_release_event.h"
|
||
|
#include "kis_move_event.h"
|
||
|
#include "kis_paintop_registry.h"
|
||
|
#include "kis_canvas.h"
|
||
|
#include "kis_canvas_painter.h"
|
||
|
#include "kis_cursor.h"
|
||
|
#include "kis_vec.h"
|
||
|
|
||
|
#include "kis_curve_framework.h"
|
||
|
|
||
|
#include "kis_tool_example.h"
|
||
|
|
||
|
|
||
|
class KisCurveExample : public KisCurve {
|
||
|
|
||
|
typedef KisCurve super;
|
||
|
|
||
|
public:
|
||
|
|
||
|
KisCurveExample() : super() {}
|
||
|
|
||
|
~KisCurveExample() {}
|
||
|
|
||
|
virtual iterator pushPivot (const KisPoint&);
|
||
|
|
||
|
};
|
||
|
|
||
|
KisCurve::iterator KisCurveExample::pushPivot (const KisPoint& point)
|
||
|
{
|
||
|
return selectPivot(iterator(*this,m_curve.append(CurvePoint(point,true,false,LINEHINT))), true);
|
||
|
}
|
||
|
|
||
|
KisToolExample::KisToolExample()
|
||
|
: super(i18n("Tool for Curves - Example"))
|
||
|
{
|
||
|
setName("tool_example");
|
||
|
m_cursor = "tool_example_cursor.png";
|
||
|
setCursor(KisCursor::load(m_cursor, 6, 6));
|
||
|
|
||
|
m_curve = new KisCurveExample;
|
||
|
}
|
||
|
|
||
|
KisToolExample::~KisToolExample()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
12 years ago
|
void KisToolExample::setup(TDEActionCollection *collection)
|
||
14 years ago
|
{
|
||
12 years ago
|
m_action = static_cast<TDERadioAction *>(collection->action(name()));
|
||
14 years ago
|
|
||
|
if (m_action == 0) {
|
||
12 years ago
|
TDEShortcut shortcut(TQt::Key_Plus);
|
||
|
shortcut.append(TDEShortcut(TQt::Key_F9));
|
||
|
m_action = new TDERadioAction(i18n("&Example"),
|
||
14 years ago
|
"tool_example",
|
||
|
shortcut,
|
||
|
this,
|
||
|
TQT_SLOT(activate()),
|
||
|
collection,
|
||
|
name());
|
||
13 years ago
|
TQ_CHECK_PTR(m_action);
|
||
14 years ago
|
|
||
|
m_action->setToolTip(i18n("This is a test tool for the Curve Framework."));
|
||
|
m_action->setExclusiveGroup("tools");
|
||
|
m_ownAction = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#include "kis_tool_example.moc"
|