Commit 1adbb8bc authored by Clarence Dang's avatar Clarence Dang
Browse files

missed part of last commit

svn path=/trunk/KDE/kdegraphics/kolourpaint/; revision=517839
parent 1eb2786a
......@@ -210,9 +210,6 @@ int main (int argc, char *argv [])
// mainly for the Spraycan Tool
srand ((unsigned int) (getpid () + getppid ()));
// access more formats
// Qt says this is necessary but I don't think it is...
QObject::connect (&app, SIGNAL (lastWindowClosed ()),
......
......@@ -57,9 +57,9 @@ kpColor::kpColor (int red, int green, int blue, bool isTransparent)
green < 0 || green > 255 ||
blue < 0 || blue > 255)
{
kError () << "kpColor::<ctor>(r=" << Qt::red
<< ",g=" << Qt::green
<< ",b=" << Qt::blue
kError () << "kpColor::<ctor>(r=" << red
<< ",g=" << green
<< ",b=" << blue
<< ",t=" << isTransparent
<< ") passed out of range values" << endl;
m_rgbaIsValid = false;
......
......@@ -939,4 +939,3 @@ void kpCommandHistory::redo ()
}
#include <kpcommandhistory.moc>
#include <kglobal.h>
......@@ -889,4 +889,3 @@ void kpMainWindow::slotDocumentRestored ()
#include <kpmainwindow.moc>
#include <kglobal.h>
......@@ -599,6 +599,7 @@ void kpMainWindow::slotPaste ()
i18n ("Cannot Paste"));
// TODO: PROPAGATE: interprocess
// COMPAT: it's not a pointer...
if (KMainWindow::memberList())
{
#if DEBUG_KP_MAIN_WINDOW
......
......@@ -164,6 +164,7 @@ void kpMainWindow::addRecentURL (const KUrl &url)
// TODO: PROPAGATE: interprocess
// COMPAT: it's not a pointer...
if (KMainWindow::memberList())
{
#if DEBUG_KP_MAIN_WINDOW
......@@ -419,13 +420,13 @@ KUrl kpMainWindow::askForSaveURL (const QString &caption,
// KConfig::readEntry() does not actually reread from disk, hence doesn't
// realise what other processes have done e.g. Settings / Show Path
// so reparseConfiguration() must be called
#define SETUP_READ_CFG() \
if (!reparsedConfiguration) \
{ \
#define SETUP_READ_CFG() \
if (!reparsedConfiguration) \
{ \
KGlobal::config ()->reparseConfiguration (); \
reparsedConfiguration = true; \
} \
\
reparsedConfiguration = true; \
} \
\
KConfigGroupSaver cfgGroupSaver (KGlobal::config (), forcedSaveOptionsGroup); \
KConfigBase *cfg = cfgGroupSaver.config ();
......
......@@ -497,13 +497,13 @@ void kpTool::beginInternal ()
m_beganDraw = false;
uint keyState = KApplication::keyboardModifiers ();
uint keyState = QApplication::keyboardModifiers ();
m_shiftPressed = (keyState & KApplication::ShiftModifier);
m_controlPressed = (keyState & KApplication::ControlModifier);
m_shiftPressed = (keyState & Qt::ShiftModifier);
m_controlPressed = (keyState & Qt::ControlModifier);
// TODO: Can't do much about ALT - unless it's always KApplication::Modifier1?
// Ditto for everywhere else where I set SHIFT & CTRL but not alt.
// Ditto for everywhere else where I set SHIFT & CTRL but not alt. COMPAT: supported by Qt
m_altPressed = false;
}
}
......@@ -905,8 +905,8 @@ bool kpTool::currentPointNextToLast () const
if (m_lastPoint == QPoint (-1, -1))
return true;
int dx = kAbs (m_currentPoint.x () - m_lastPoint.x ());
int dy = kAbs (m_currentPoint.y () - m_lastPoint.y ());
int dx = qAbs (m_currentPoint.x () - m_lastPoint.x ());
int dy = qAbs (m_currentPoint.y () - m_lastPoint.y ());
return (dx <= 1 && dy <= 1);
}
......@@ -916,8 +916,8 @@ bool kpTool::currentPointCardinallyNextToLast () const
if (m_lastPoint == QPoint (-1, -1))
return true;
int dx = kAbs (m_currentPoint.x () - m_lastPoint.x ());
int dy = kAbs (m_currentPoint.y () - m_lastPoint.y ());
int dx = qAbs (m_currentPoint.x () - m_lastPoint.x ());
int dy = qAbs (m_currentPoint.y () - m_lastPoint.y ());
return (dx + dy <= 1);
}
......@@ -1370,10 +1370,10 @@ void kpTool::keyUpdateModifierState (QKeyEvent *e)
#if DEBUG_KP_TOOL && 0
kDebug () << "\t\tmodifiers not changed - figure out the truth" << endl;
#endif
uint keyState = KApplication::keyboardModifiers ();
uint keyState = QApplication::keyboardModifiers ();
setShiftPressed (keyState & KApplication::ShiftModifier);
setControlPressed (keyState & KApplication::ControlModifier);
setShiftPressed (keyState & Qt::ShiftModifier);
setControlPressed (keyState & Qt::ControlModifier);
// TODO: Can't do much about ALT - unless it's always KApplication::Modifier1?
// Ditto for everywhere else where I set SHIFT & CTRL but not alt.
......
......@@ -37,7 +37,11 @@
#include <kpdefs.h>
class QFocusEvent;
class QIcon;
class QInputMethodEvent;
class QKeyEvent;
class QMouseEvent;
class QPixmap;
class KKeySequence;
......
......@@ -627,7 +627,9 @@ void kpView::updateMicroFocusHint (const QRect &microFocusHint)
int y = microFocusHint.topLeft().y();
int width = microFocusHint.width();
int height = microFocusHint.height();
setMicroFocusHint (x, y, width, height);
// COMPAT
//setMicroFocusHint (x, y, width, height);
}
// public
......@@ -826,6 +828,7 @@ QRegion kpView::selectionResizeHandlesViewRegion (bool forRenderer) const
}
// public
// COMPAT: use Qt Flags to be safer
int kpView::mouseOnSelectionResizeHandle (const QPoint &viewPoint) const
{
#if DEBUG_KP_VIEW
......@@ -876,37 +879,37 @@ int kpView::mouseOnSelectionResizeHandle (const QPoint &viewPoint) const
if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength,
selViewRect.height () - atomicLength))
{
return Qt::DockBottom | Qt::DockRight;
return kpView::Bottom | kpView::Right;
}
else if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength, 0))
{
return Qt::DockTop | Qt::DockRight;
return kpView::Top | kpView::Right;
}
else if (LOCAL_POINT_IN_BOX_AT (0, selViewRect.height () - atomicLength))
{
return Qt::DockBottom | Qt::DockLeft;
return kpView::Bottom | kpView::Left;
}
else if (LOCAL_POINT_IN_BOX_AT (0, 0))
{
return Qt::DockTop | Qt::DockLeft;
return kpView::Top | kpView::Left;
}
else if (LOCAL_POINT_IN_BOX_AT (selViewRect.width () - atomicLength,
(selViewRect.height () - atomicLength) / 2))
{
return Qt::DockRight;
return kpView::Right;
}
else if (LOCAL_POINT_IN_BOX_AT ((selViewRect.width () - atomicLength) / 2,
selViewRect.height () - atomicLength))
{
return Qt::DockBottom;
return kpView::Bottom;
}
else if (LOCAL_POINT_IN_BOX_AT ((selViewRect.width () - atomicLength) / 2, 0))
{
return Qt::DockTop;
return kpView::Top;
}
else if (LOCAL_POINT_IN_BOX_AT (0, (selViewRect.height () - atomicLength) / 2))
{
return Qt::DockLeft;
return kpView::Left;
}
else
{
......@@ -1148,6 +1151,8 @@ void kpView::resizeEvent (QResizeEvent *e)
}
// COMPAT
#if 0
// private virtual
void kpView::imStartEvent (QIMEvent *e)
{
......@@ -1183,6 +1188,7 @@ void kpView::imEndEvent (QIMEvent *e)
tool ()->imEndEvent (e);
e->accept();
}
#endif
//
......
......@@ -494,9 +494,10 @@ protected:
virtual void dragEnterEvent (QDragEnterEvent *);
virtual void dragLeaveEvent (QDragLeaveEvent *);
virtual void imStartEvent (QIMEvent *e);
virtual void imComposeEvent (QIMEvent *e);
virtual void imEndEvent (QIMEvent *e);
// COMPAT
//virtual void imStartEvent (QIMEvent *e);
//virtual void imComposeEvent (QIMEvent *e);
//virtual void imEndEvent (QIMEvent *e);
public:
virtual void resize (int w, int h);
......
......@@ -60,7 +60,7 @@ public:
enum GripType
{
Right = 1, Bottom = 2,
BottomRight = Qt::DockRight | Qt::DockBottom
BottomRight = Right | Bottom
};
kpGrip (GripType type,
......
......@@ -238,7 +238,7 @@ double kpEffectBlurSharpenWidget::radius () const
return SharpenMin +
(m_amountInput->value () - 1) *
(SharpenMax - SharpenMin) /
(m_amountInput->maximum() - 1);
(m_amountInput->maximum () - 1);
}
}
......@@ -266,7 +266,7 @@ double kpEffectBlurSharpenWidget::sigma () const
return SharpenMin +
(m_amountInput->value () - 1) *
(SharpenMax - SharpenMin) /
(m_amountInput->maximum() - 1);
(m_amountInput->maximum () - 1);
}
}
......
......@@ -153,6 +153,7 @@ kpEffectFlattenWidget::kpEffectFlattenWidget (bool actOnSelection,
m_enableCheckBox = new QCheckBox (i18n ("E&nable"), this);
// COMPAT: What happened to QVBox?
KVBox *colorButtonContainer = new KVBox (this);
colorButtonContainer->setMargin (KDialog::marginHint () / 2);
colorButtonContainer->setSpacing (spacingHint ());
......@@ -188,7 +189,8 @@ kpEffectFlattenWidget::~kpEffectFlattenWidget ()
cfgGroupSaver.writeEntry (kpSettingFlattenEffectColor1, s_lastColor1);
cfgGroupSaver.writeEntry (kpSettingFlattenEffectColor2, s_lastColor2);
KGlobal::config ()->sync ();
// COMPAT: cfgGroupSaver.sync ()?
KGlobal::config ()->sync ();
}
......
......@@ -115,7 +115,7 @@ QImage convertImageDepth (const QImage &image, int depth, bool dither)
color0Valid = true;
monoImage.setPixel (x, y, 0);
#if DEBUG_KP_EFFECT_REDUCE_COLORS
kDebug () << "\t\t\tcolor0=" << (int *) Qt::color0
kDebug () << "\t\t\tcolor0=" << (int *) color0
<< " at x=" << x << ",y=" << y << endl;
#endif
}
......@@ -125,7 +125,7 @@ QImage convertImageDepth (const QImage &image, int depth, bool dither)
color1Valid = true;
monoImage.setPixel (x, y, 1);
#if DEBUG_KP_EFFECT_REDUCE_COLORS
kDebug () << "\t\t\tcolor1=" << (int *) Qt::color1
kDebug () << "\t\t\tcolor1=" << (int *) color1
<< " at x=" << x << ",y=" << y << endl;
#endif
}
......
......@@ -304,7 +304,7 @@ static void convertToPixmapWarnAboutLoss (const QImage &image,
bool moreColorsThanDisplay =
(KMessageBox::shouldBeShownContinue (colorDepthDontAskAgain) &&
image.depth () > QPixmap::defaultDepth() &&
QPixmap::defaultDepth() < 24); // 32 indicates alpha channel
QPixmap::defaultDepth () < 24); // 32 indicates alpha channel
int screenDepthNeeded = 0;
......@@ -440,7 +440,7 @@ QPixmap kpPixmapFX::convertToPixmapAsLosslessAsPossible (const QImage &image,
QPixmap::defaultDepth ());
QPixmap destPixmap;
int ditherFlags = 0;
Qt::ImageConversionFlags ditherFlags = 0;
if (image.depth () <= screenDepth)
{
......@@ -492,13 +492,11 @@ QPixmap kpPixmapFX::convertToPixmapAsLosslessAsPossible (const QImage &image,
int configDitherIfNumColorsGreaterThan = 323;
KConfigGroup cfg (KGlobal::config (),
kpSettingsGroupGeneral);
//KConfigBase *cfg = cfgGroupSaver.config ();
KConfigGroup cfg (KGlobal::config (), kpSettingsGroupGeneral);
if (cfg.hasKey (kpSettingDitherOnOpen))
{
configDitherIfNumColorsGreaterThan = cfg.readEntry (kpSettingDitherOnOpen,0);
// COMPAT: the 0?
configDitherIfNumColorsGreaterThan = cfg.readEntry (kpSettingDitherOnOpen, 0);
}
else
{
......@@ -621,7 +619,7 @@ QPixmap kpPixmapFX::getPixmapAt (const QPixmap &pm, const QRect &rect)
validSrcRect.x (), validSrcRect.y (), /* src pt */
validSrcRect.width (), validSrcRect.height ());
if (wouldHaveUndefinedPixels && !retPixmap.mask ().isNull() && !pm.mask ().isNull())
if (wouldHaveUndefinedPixels && !retPixmap.mask ().isNull() && pm.mask ().isNull ())
{
#if DEBUG_KP_PIXMAP_FX && 0
kDebug () << "\tensure opaque in valid region" << endl;
......@@ -694,6 +692,7 @@ void kpPixmapFX::setPixmapAt (QPixmap *destPixmapPtr, const QRect &destRect,
0, 0,
destRect.width (), destRect.height ());
#else
// COMPAT: supposed to CopyROP & ignore mask.
bitBlt (destPixmapPtr,
destRect.x (), destRect.y (),
&srcPixmap,
......@@ -701,19 +700,21 @@ void kpPixmapFX::setPixmapAt (QPixmap *destPixmapPtr, const QRect &destRect,
destRect.width (), destRect.height ()
);
if (!srcPixmap.mask ().isNull())
if (!srcPixmap.mask ().isNull ())
{
QBitmap mask = getNonNullMask (*destPixmapPtr);
// COMPAT: supposed CopyROP & ignore mask.
const QBitmap srcMask = srcPixmap.mask ();
bitBlt (&mask,
destRect.x (), destRect.y (),
srcPixmap.mask (),
&srcMask
0, 0,
destRect.width (), destRect.height ());
destPixmapPtr->setMask (mask);
}
#endif
if (!destPixmapPtr->mask ().isNull() && !srcPixmap.mask ().isNull())
if (!destPixmapPtr->mask ().isNull () && srcPixmap.mask ().isNull ())
{
#if DEBUG_KP_PIXMAP_FX && 0
kDebug () << "\t\topaque'ing dest rect" << endl;
......@@ -866,7 +867,7 @@ QBitmap kpPixmapFX::getNonNullMaskAt (const QPixmap &pm, const QRect &rect)
{
QBitmap destMaskBitmap (rect.width (), rect.height ());
if (!pm.mask ().isNull())
if (!pm.mask ().isNull ())
{
copyBlt (&destMaskBitmap, 0, 0,
&pm, rect.x (), rect.y (), rect.width (), rect.height ());
......@@ -950,12 +951,13 @@ void kpPixmapFX::paintMaskTransparentWithBrush (QPixmap *destPixmapPtr, const QP
// Brush Bitmap value of 1 means "make transparent"
// 0 means "leave it as it is"
bitBlt (&destMaskBitmap,
destAt.x (), destAt.y (),
&brushBitmap,
0, 0,
brushBitmap.width (), brushBitmap.height (),
Qt::NotAndROP);
QPixmap brushPixmap (brushBitmap.width (), brushBitmap.height ());
brushPixmap.setMask (brushBitmap);
QPainter painter (&destMaskBitmap);
painter.setCompositionMode (QPainter::CompositionMode_DestinationIn);
painter.drawPixmap (destAt.x (), destAt.y (), brushPixmap);
painter.end ();
destPixmapPtr->setMask (destMaskBitmap);
}
......@@ -994,18 +996,21 @@ void kpPixmapFX::ensureOpaqueAt (QPixmap *destPixmapPtr, const QRect &destRect)
void kpPixmapFX::ensureOpaqueAt (QPixmap *destPixmapPtr, const QPoint &destAt,
const QPixmap &srcPixmap)
{
if (!destPixmapPtr || !destPixmapPtr->mask ().isNull()/*already opaque*/)
if (!destPixmapPtr || destPixmapPtr->mask ().isNull ()/*already opaque*/)
return;
QBitmap destMask = destPixmapPtr->mask ();
if (!srcPixmap.mask ().isNull())
if (!srcPixmap.mask ().isNull ())
{
// COMPAT: Would have to check Qt4 mask & painting behaviour
#if 0
bitBlt (&destMask, /* dest */
destAt, /* dest pt */
srcPixmap.mask (), /* src */
QRect (0, 0, srcPixmap.width (), srcPixmap.height ()), /* src rect */
Qt::OrROP/*if either is opaque, it's opaque*/);
#endif
}
else
{
......@@ -1156,7 +1161,7 @@ void kpPixmapFX::resize (QPixmap *destPixmapPtr, int w, int h,
painter.setBrush (backgroundColor.toQColor ());
}
if (backgroundColor.isTransparent () || !destPixmapPtr->mask ().isNull())
if (backgroundColor.isTransparent () || !destPixmapPtr->mask ().isNull ())
{
maskBitmap = kpPixmapFX::getNonNullMask (*destPixmapPtr);
maskPainter.begin (&maskBitmap);
......@@ -1398,7 +1403,7 @@ static QPixmap xForm (const QPixmap &pm, const QMatrix &transformMatrix_,
if (backgroundColor.isOpaque ())
newPixmap.fill (backgroundColor.toQColor ());
if (backgroundColor.isTransparent () || !pm.mask ().isNull())
if (backgroundColor.isTransparent () || !pm.mask ().isNull ())
{
newBitmapMask.resize (newPixmap.width (), newPixmap.height ());
newBitmapMask.fill (backgroundColor.maskColor ());
......
......@@ -34,11 +34,11 @@
kpToolAction::kpToolAction (const QString &text,
const QString &pic, const KShortcut &shortcut,
const QObject *receiver, const char *slot,
QObject *parent, const char *name)
KActionCollection *ac, const char *name)
: KToggleAction (text,
pic, shortcut,
receiver, slot,
parent, name)
ac, name)
{
updateToolTip ();
}
......
......@@ -33,6 +33,9 @@
#include <kpsinglekeytriggersaction.h>
class KActionCollection;
// Same as KToggleAction but shows the first single key trigger in the tooltip.
class kpToolAction : public KToggleAction,
public kpSingleKeyTriggersActionInterface
......@@ -43,7 +46,7 @@ public:
kpToolAction (const QString &text,
const QString &pic, const KShortcut &shortcut,
const QObject *receiver, const char *slot,
QObject *parent, const char *name);
KActionCollection *ac, const char *name);
virtual ~kpToolAction ();
......
......@@ -322,7 +322,7 @@ void kpToolAirSprayCommand::addPoints (const Q3PointArray &points)
painter.setPen (m_color.toQColor ());
}
if (!pixmap.mask ().isNull() || m_color.isTransparent ())
if (!pixmap.mask ().isNull () || m_color.isTransparent ())
{
mask = kpPixmapFX::getNonNullMask (pixmap);
maskPainter.begin (&mask);
......
......@@ -399,7 +399,7 @@ void kpToolPen::globalDraw ()
}
if (backgroundColor ().isTransparent () ||
!document ()->pixmap ()->mask ().isNull() )
!document ()->pixmap ()->mask ().isNull ())
{
maskBitmap = kpPixmapFX::getNonNullMask (*document ()->pixmap ());
maskPainter.begin (&maskBitmap);
......@@ -530,7 +530,7 @@ void kpToolPen::draw (const QPoint &thisPoint, const QPoint &lastPoint, const QR
}
if (color (m_mouseButton).isTransparent () ||
!pixmap.mask ().isNull())
!pixmap.mask ().isNull ())
{
maskBitmap = kpPixmapFX::getNonNullMask (pixmap);
maskPainter.begin (&maskBitmap);
......@@ -607,7 +607,7 @@ void kpToolPen::draw (const QPoint &thisPoint, const QPoint &lastPoint, const QR
painter.setPen (c.toQColor ());
}
if (transparent || !pixmap.mask ().isNull())
if (transparent || !pixmap.mask ().isNull ())
{
maskBitmap = kpPixmapFX::getNonNullMask (pixmap);
maskPainter.begin (&maskBitmap);
......
......@@ -166,7 +166,7 @@ static QPixmap pixmap (const QPixmap &oldPixmap,
QPainter painter, maskPainter;
if (!pixmap.mask ().isNull() ||
if (!pixmap.mask ().isNull () ||
(maskPen.style () != Qt::NoPen &&
maskPen.color () == Qt::color0/*transparent*/) ||
(maskBrush.style () != Qt::NoBrush &&
......@@ -238,6 +238,7 @@ static QPixmap pixmap (const QPixmap &oldPixmap,
QPen XORpen = painter.pen ();
XORpen.setColor (Qt::white);
// COMPAT
painter.setPen (XORpen);
#warning "QT4 fix it "
//painter.setRasterOp (Qt::XorROP);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment