[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/ui/tool
From: Lukáš Tvrdý <lukast.dev () gmail ! com>
Date: 2010-04-07 17:53:19
Message-ID: 20100407175319.C9BECAC857 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1112253 by lukast:
Fix how the . and , (keyboard shortcuts for changing brush size) interacts with user.
Before the user did not know about the change of the size visually, now we temporary \
(800 ms) show the brush outline. If the user starts to paint, the outline is also \
hidden.
M +27 -4 kis_tool_freehand.cc
M +6 -2 kis_tool_freehand.h
--- trunk/koffice/krita/ui/tool/kis_tool_freehand.cc #1112252:1112253
@@ -74,6 +74,7 @@
#include "kis_color_picker_utils.h"
#define ENABLE_RECORDING
+static const int HIDE_OUTLINE_TIMEOUT = 800; // ms
KisToolFreehand::KisToolFreehand(KoCanvasBase * canvas, const QCursor & cursor, \
const QString & transactionText) : KisToolPaint(canvas, cursor)
@@ -116,6 +117,11 @@
KisCanvas2* canvas2 = static_cast<KisCanvas2*>(canvas);
connect(this, SIGNAL(sigFavoritePaletteCalled(const QPoint&)), canvas2, \
SIGNAL(favoritePaletteCalled(const QPoint&)));
connect(this, SIGNAL(sigPainting()), canvas2->view()->resourceProvider(), \
SLOT(slotPainting())); +
+ m_showOutline = false;
+ m_timer.setSingleShot(true);
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT( hideOutline() ));
+
}
KisToolFreehand::~KisToolFreehand()
@@ -255,7 +261,7 @@
KisConfig cfg;
KisPaintOpSettings::OutlineMode outlineMode;
- if (m_mode != PAINT && (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || m_mode == \
EDIT_BRUSH)) { + if (m_mode != PAINT && (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE \
|| m_mode == EDIT_BRUSH || m_showOutline)) { outlineMode = \
KisPaintOpSettings::CURSOR_IS_OUTLINE; } else {
outlineMode = KisPaintOpSettings::CURSOR_ISNT_OUTLINE;
@@ -630,7 +636,8 @@
{
KisPaintOpSettings::OutlineMode outlineMode;
- if (m_mode != PAINT && (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || m_mode \
== EDIT_BRUSH)) { + if (m_mode == PAINT) m_showOutline = false;
+ if (m_mode != PAINT && (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || m_mode \
== EDIT_BRUSH || m_showOutline)) { outlineMode = \
KisPaintOpSettings::CURSOR_IS_OUTLINE; } else {
outlineMode = KisPaintOpSettings::CURSOR_ISNT_OUTLINE;
@@ -706,13 +713,13 @@
{
currentPaintOpPreset()->settings()->changePaintOpSize(1, 0);
m_oldOutlineRect.adjust(-1, -1, 1, 1);
- canvas()->updateCanvas(m_oldOutlineRect);
+ showOutlineTemporary();
}
void KisToolFreehand::decreaseBrushSize()
{
currentPaintOpPreset()->settings()->changePaintOpSize(-1, 0);
- canvas()->updateCanvas(m_oldOutlineRect);
+ showOutlineTemporary();
}
QPointF KisToolFreehand::outlinePos() const
@@ -724,5 +731,21 @@
}
}
+void KisToolFreehand::showOutlineTemporary()
+{
+ m_showOutline = true;
+ m_timer.start(HIDE_OUTLINE_TIMEOUT);
+ canvas()->updateCanvas(m_oldOutlineRect);
+ //canvas()->updateCanvas(QRect(QPoint(0, 0), QSize(currentImage()->width(), \
currentImage()->height()))); +}
+
+void KisToolFreehand::hideOutline()
+{
+ m_showOutline = false;
+ canvas()->updateCanvas(m_oldOutlineRect);
+ //canvas()->updateCanvas(QRect(QPoint(0, 0), QSize(currentImage()->width(), \
currentImage()->height()))); +}
+
+
#include "kis_tool_freehand.moc"
--- trunk/koffice/krita/ui/tool/kis_tool_freehand.h #1112252:1112253
@@ -96,12 +96,13 @@
*/
QPointF adjustPosition(const QPointF& point);
void queuePaintJob(FreehandPaintJob* job, FreehandPaintJob* previousJob);
-
+ void showOutlineTemporary();
+
private slots:
void increaseBrushSize();
void decreaseBrushSize();
-
+ void hideOutline();
protected:
KisPaintInformation m_previousPaintInformation;
@@ -159,6 +160,9 @@
KAction* m_decreaseBrushSize;
bool m_hasPaintAtLeastOnce; ///< this indicates wether mouseReleaseEvent should \
call paintAt or not +
+ QTimer m_timer;
+ bool m_showOutline;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic