[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Re: Layers, layergroups, dockwindow, preview and dynamic layersize
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2004-06-30 21:07:19
Message-ID: 200406302307.19965.boud () valdyas ! org
[Download RAW message or body]
On Wednesday 30 June 2004 22:59, Casper Boemann wrote:
> probably not a lot since they don't have the patch and files. Perhabs you
> could post them (or commit) when you have merged with cyrille's changes?
I've attached the patch -- committing is bit fraught with problems since
painting no longer works on a layer which has been moved, and I have sworn
to never break the brush tool again. That's the one thing that should keep
working!
--
Boudewijn Rempt | http://www.valdyas.org/fading/index.cgi
["kis_layerbox.ui.h" (text/x-chdr)]
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/
void KisLayerBox::init()
{
clear();
connect(m_lst, SIGNAL(selectionChanged(QListViewItem *)),
SLOT(slotSelectionChanged(QListViewItem*)));
}
void KisLayerBox::clear()
{
QListViewItem *layerItem;
while ( (layerItem = m_lst -> firstChild() ) )
delete layerItem;
}
void KisLayerBox::insertItem(const QString& name, bool visible, bool linked)
{
QListViewItem *layerItem = new QListViewItem(m_lst, name, QString(visible?"O":"-"));
m_lst -> setSelected(layerItem, TRUE);
}
void KisLayerBox::slotSelectionChanged(QListViewItem *item)
{
Q_INT32 n = -1;
while (item) {
n++;
item = item -> nextSibling();
}
emit itemSelected(n);
}
["mydiff" (text/x-diff)]
? core/kis_tile_command.loT
? pics/cr16-2-app-krita.png
? plugins/colorrange/wdg_colorrange.loT
? plugins/imagesize/wdg_imagesize.loT
? ui/kis_layerbox.ui
? ui/kis_layerbox.ui.h
Index: core/KRayonViewIface.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/KRayonViewIface.cc,v
retrieving revision 1.8
diff -u -3 -p -r1.8 KRayonViewIface.cc
--- core/KRayonViewIface.cc 16 Jun 2004 19:38:12 -0000 1.8
+++ core/KRayonViewIface.cc 29 Jun 2004 14:54:53 -0000
@@ -90,11 +90,6 @@ void KRayonViewIface::export_image()
m_view->export_image();
}
-void KRayonViewIface::imgResizeToActiveLayer()
-{
- m_view->imgResizeToActiveLayer();
-}
-
void KRayonViewIface::add_new_image_tab()
{
m_view->add_new_image_tab();
Index: core/KRayonViewIface.h
===================================================================
RCS file: /home/kde/koffice/krita/core/KRayonViewIface.h,v
retrieving revision 1.11
diff -u -3 -p -r1.11 KRayonViewIface.h
--- core/KRayonViewIface.h 16 Jun 2004 20:24:14 -0000 1.11
+++ core/KRayonViewIface.h 29 Jun 2004 14:54:53 -0000
@@ -53,7 +53,6 @@ public:
void slotImportImage();
void export_image();
- void imgResizeToActiveLayer();
void add_new_image_tab();
void remove_current_image_tab();
//void imageResize(); // XXX: made into a plugin, don't know yet how to export a \
plugin with DCOP.
Index: core/kis_doc.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_doc.cc,v
retrieving revision 1.168
diff -u -3 -p -r1.168 kis_doc.cc
--- core/kis_doc.cc 11 Jun 2004 19:26:23 -0000 1.168
+++ core/kis_doc.cc 29 Jun 2004 14:54:53 -0000
@@ -631,10 +631,10 @@ QDomElement KisDoc::saveLayer(QDomDocume
QDomElement layerElement = doc.createElement("layer");
layerElement.setAttribute("name", layer -> name());
- layerElement.setAttribute("x", layer -> x());
- layerElement.setAttribute("y", layer -> y());
- layerElement.setAttribute("width", layer -> width());
- layerElement.setAttribute("height", layer -> height());
+ layerElement.setAttribute("x", layer -> x() + layer -> extentLeft());
+ layerElement.setAttribute("y", layer -> y() + layer -> extentUp());
+ layerElement.setAttribute("width", layer -> extentWidth());
+ layerElement.setAttribute("height", layer -> extentHeight());
layerElement.setAttribute("opacity", layer -> opacity());
layerElement.setAttribute("visible", layer -> visible());
layerElement.setAttribute("linked", layer -> linked());
@@ -710,10 +710,10 @@ QDomElement KisDoc::saveChannel(QDomDocu
QDomElement channelElement = doc.createElement("CHANNEL");
channelElement.setAttribute("name", channel -> name());
- channelElement.setAttribute("x", channel -> x());
- channelElement.setAttribute("y", channel -> y());
- channelElement.setAttribute("width", channel -> width());
- channelElement.setAttribute("height", channel -> height());
+ channelElement.setAttribute("x", channel -> x() + channel -> extentLeft());
+ channelElement.setAttribute("y", channel -> y() + channel -> extentUp());
+ channelElement.setAttribute("width", channel -> extentWidth());
+ channelElement.setAttribute("height", channel -> extentHeight());
channelElement.setAttribute("opacity", channel -> opacity());
return channelElement;
}
@@ -1047,7 +1047,7 @@ bool KisDoc::slotNewImage()
img -> setResolution(100.0, 100.0); // XXX needs to be added to dialog
layer = new KisLayer(img, dlg.imgWidth(), dlg.imgHeight(), img -> nextLayerName(), \
OPACITY_OPAQUE); gc.begin(layer.data());
- gc.fillRect(0, 0, layer -> width(), layer -> height(), c, opacity);
+ gc.fillRect(0, 0, dlg.imgWidth(), dlg.imgHeight(), c, opacity);
gc.end();
img -> add(layer, -1);
addImage(img);
@@ -1260,7 +1260,7 @@ KisLayerSP KisDoc::layerAdd(KisImageSP i
if (layer) {
KisPainter gc(layer.data());
- gc.fillRect(0, 0, layer -> width(), layer -> height(), KoColor::black(), \
OPACITY_TRANSPARENT); + gc.fillRect(0, 0, width, height, KoColor::black(), \
OPACITY_TRANSPARENT); gc.end();
img -> top(layer);
@@ -1299,7 +1299,7 @@ KisLayerSP KisDoc::layerAdd(KisImageSP i
if (layer) {
KisPainter gc(layer.data());
- gc.fillRect(0, 0, layer -> width(), layer -> height(), KoColor::black(), \
OPACITY_TRANSPARENT); + gc.fillRect(0, 0, width, height, KoColor::black(), \
OPACITY_TRANSPARENT); gc.end();
img -> top(layer);
@@ -1446,7 +1446,7 @@ void KisDoc::layerNext(KisImageSP img, K
if (layer) {
layer -> visible(false);
- img -> invalidate(layer -> x(), layer -> y(), layer -> width(), layer -> \
height()); + img -> invalidate(layer -> bounds());
}
}
@@ -1486,7 +1486,7 @@ void KisDoc::layerPrev(KisImageSP img, K
if (layer) {
layer -> visible(false);
- img -> invalidate(layer -> x(), layer -> y(), layer -> width(), layer -> \
height()); + img -> invalidate(layer -> bounds());
}
}
Index: core/kis_floatingselection.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_floatingselection.cc,v
retrieving revision 1.1
diff -u -3 -p -r1.1 kis_floatingselection.cc
--- core/kis_floatingselection.cc 23 May 2004 20:59:34 -0000 1.1
+++ core/kis_floatingselection.cc 29 Jun 2004 14:54:54 -0000
@@ -92,8 +92,8 @@ void KisFloatingSelection::commit()
KisPainter gc;
QRect rc = clip();
QPoint pt(0, 0);
- Q_INT32 w = width();
- Q_INT32 h = height();
+ Q_INT32 w = extentWidth();
+ Q_INT32 h = extentHeight();
if (!rc.isEmpty()) {
w = rc.width();
@@ -121,13 +121,10 @@ void KisFloatingSelection::commit()
if (img -> height() < y() + h)
h = img -> height() - y();
- if (x() + w > m_parent -> x() + m_parent -> width() || y() + h > m_parent -> y() + \
m_parent -> height())
- m_parent -> expand(x() + w - m_parent -> x(), y() + h - m_parent -> y());
-
gc.begin(m_parent);
gc.beginTransaction("copy selection to parent");
- Q_ASSERT(w <= width());
- Q_ASSERT(h <= height());
+ Q_ASSERT(w <= extentWidth());
+ Q_ASSERT(h <= extentHeight());
gc.bitBlt(x() - m_parent -> x(), y() - m_parent -> y(), COMPOSITE_COPY, this, \
opacity(), pt.x(), pt.y(), w, h); adapter -> addCommand(gc.endTransaction());
gc.end();
@@ -150,7 +147,8 @@ void KisFloatingSelection::move(Q_INT32
adapter -> beginMacro(i18n("Move Selection"));
adapter -> addCommand(new KisResetFirstMoveCmd(this));
gc.beginTransaction("clear the parent's background from \
KisFloatingSelection::move");
- gc.eraseRect(this -> x() - m_parent -> x(), this -> y() - m_parent -> y(), \
width(), height()); + gc.eraseRect(this -> x() - m_parent -> x(), this -> y() - \
m_parent -> y(), extentWidth(), + extentHeight());
m_firstMove = false;
m_parent -> invalidate(rc);
adapter -> addCommand(gc.endTransaction());
@@ -181,8 +179,8 @@ void KisFloatingSelection::fromImage(con
if (img.isNull())
return;
- for (Q_INT32 y = 0; y < height(); y++) {
- for (Q_INT32 x = 0; x < width(); x++) {
+ for (Q_INT32 y = 0; y < extentHeight(); y++) {
+ for (Q_INT32 x = 0; x < extentWidth(); x++) {
rgb = img.pixel(x, y);
c.setRGB(upscale(qRed(rgb)), upscale(qGreen(rgb)), upscale(qBlue(rgb)));
Index: core/kis_image.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_image.cc,v
retrieving revision 1.130
diff -u -3 -p -r1.130 kis_image.cc
--- core/kis_image.cc 23 Jun 2004 13:52:33 -0000 1.130
+++ core/kis_image.cc 29 Jun 2004 14:54:54 -0000
@@ -291,7 +291,7 @@ void KisImage::resize(Q_INT32 w, Q_INT32
m_ntileRows = (h + TILE_HEIGHT - 1) / TILE_HEIGHT;
// m_bkg = new KisBackground(this, m_width, m_height);
m_projection = new KisLayer(this, m_width, m_height, "projection", OPACITY_OPAQUE);
- m_bkg -> resize(w, h);
+// m_bkg -> resize(w, h);
// m_projection -> resize(w, h);
invalidate();
}
@@ -1150,6 +1150,7 @@ KisFloatingSelectionSP KisImage::selecti
void KisImage::expand(KisPaintDeviceSP dev)
{
+/*CBR
Q_INT32 w;
Q_INT32 h;
@@ -1159,6 +1160,7 @@ void KisImage::expand(KisPaintDeviceSP d
resize(w, h);
invalidate();
}
+*/
}
void KisImage::notify()
Index: core/kis_iterators.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_iterators.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 kis_iterators.h
--- core/kis_iterators.h 18 Jun 2004 14:36:56 -0000 1.8
+++ core/kis_iterators.h 29 Jun 2004 14:54:54 -0000
@@ -167,12 +167,35 @@ class KisIteratorLine {
public:
KisIteratorLine( KisPaintDeviceSP ndevice,
KisTileCommand* command,
- Q_INT32 nypos = 0,
- Q_INT32 nxstart = -1,
- Q_INT32 nxend = -1) :
+ Q_INT32 nypos,
+ Q_INT32 nxstart,
+ Q_INT32 nxend) :
m_device( ndevice ),
- m_xstart( (nxstart < 0) ? 0 : nxstart ),
- m_xend( ( nxend < 0 ) ? ndevice->width()-1 : nxend ),
+ m_xstart( nxstart ),
+ m_xend( nxend ),
+ m_ypos( nypos ), m_command( command )
+ {
+// kdDebug() << "nxend=" << nxend << " m_xend=" << m_xend << " nxstart=" << \
nxstart << " m_xstart=" << m_xstart << endl; + }
+
+ KisIteratorLine( KisPaintDeviceSP ndevice,
+ KisTileCommand* command,
+ Q_INT32 nypos,
+ Q_INT32 nxstart) :
+ m_device( ndevice ),
+ m_xstart( nxstart ),
+ m_xend( ndevice -> extentRight() ),
+ m_ypos( nypos ), m_command( command )
+ {
+// kdDebug() << "nxend=" << nxend << " m_xend=" << m_xend << " nxstart=" << \
nxstart << " m_xstart=" << m_xstart << endl; + }
+
+ KisIteratorLine( KisPaintDeviceSP ndevice,
+ KisTileCommand* command,
+ Q_INT32 nypos) :
+ m_device( ndevice ),
+ m_xstart( ndevice -> extentLeft() ),
+ m_xend( ndevice -> extentRight() ),
m_ypos( nypos ), m_command( command )
{
// kdDebug() << "nxend=" << nxend << " m_xend=" << m_xend << " nxstart=" << \
nxstart << " m_xstart=" << m_xstart << endl;
Index: core/kis_paint_device.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_paint_device.cc,v
retrieving revision 1.70
diff -u -3 -p -r1.70 kis_paint_device.cc
--- core/kis_paint_device.cc 23 Jun 2004 13:52:33 -0000 1.70
+++ core/kis_paint_device.cc 29 Jun 2004 14:54:54 -0000
@@ -39,6 +39,10 @@
#include "kis_colorspace_factory.h"
#include "kis_iterators.h"
+// the following definition is for use in transitioing to dynamic layersizes
+// In time it should become obsolete - if not used in this file it is obsolete and \
can be removed +//#define CBR_DEFAULT_LAYERSIZE 256
+
namespace {
class KisResizeDeviceCmd : public KNamedCommand {
typedef KNamedCommand super;
@@ -90,17 +94,15 @@ namespace {
KisPaintDevice::KisPaintDevice(Q_INT32 width, Q_INT32 height, const enumImgType& \
imgType, const QString& name) {
init();
- m_width = width;
- m_height = height;
m_imgType = imgType;
m_alpha = ::imgTypeHasAlpha(imgType);
m_depth = ::imgTypeDepth(imgType);
m_x = 0;
m_y = 0;
- m_offX = 0;
- m_offY = 0;
- m_offW = 0;
- m_offH = 0;
+ m_clipLeft = 0;
+ m_clipTop = 0;
+ m_clipRight = 0;
+ m_clipBottom = 0;
m_tiles = new KisTileMgr(m_depth, width, height);
m_visible = true;
m_owner = 0;
@@ -122,17 +124,15 @@ KisPaintDevice::KisPaintDevice(KisImageS
KisPaintDevice::KisPaintDevice(KisTileMgrSP tm, KisImageSP img, const QString& name)
{
init();
- m_width = tm -> width();
- m_height = tm -> height();
m_imgType = img -> imgType();
m_depth = img -> depth();
m_alpha = img -> alpha();
m_x = 0;
m_y = 0;
- m_offX = 0;
- m_offY = 0;
- m_offW = 0;
- m_offH = 0;
+ m_clipLeft = 0;
+ m_clipTop = 0;
+ m_clipRight = 0;
+ m_clipBottom = 0;
m_tiles = tm;
m_visible = true;
m_owner = img;
@@ -159,13 +159,11 @@ KisPaintDevice::KisPaintDevice(const Kis
m_visible = rhs.m_visible;
m_x = rhs.m_x;
m_y = rhs.m_y;
- m_width = rhs.m_width;
- m_height = rhs.m_height;
m_depth = rhs.m_depth;
- m_offX = rhs.m_offX;
- m_offY = rhs.m_offY;
- m_offW = rhs.m_offW;
- m_offH = rhs.m_offH;
+ m_clipLeft = rhs.m_clipLeft;
+ m_clipTop = rhs.m_clipTop;
+ m_clipRight = rhs.m_clipRight;
+ m_clipBottom = rhs.m_clipBottom;
m_quantumSize = rhs.m_quantumSize;
m_imgType = rhs.m_imgType;
m_alpha = rhs.m_alpha;
@@ -196,16 +194,22 @@ void KisPaintDevice::invalidate(Q_INT32
void KisPaintDevice::invalidate(Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h)
{
- Q_INT32 dx = x + w + 1;
- Q_INT32 dy = y + h + 1;
- Q_INT32 x1;
- Q_INT32 y1;
-
- m_projectionValid = false;
-
- for (y1 = y; y1 < dy; y1 += TILE_HEIGHT - y1 % TILE_HEIGHT)
- for (x1 = x; x1 < dx; x1 += TILE_WIDTH - x1 % TILE_WIDTH)
- data() -> invalidate(x1, y1);
+ Q_INT32 dx = x + w + 1;
+ Q_INT32 dy = y + h + 1;
+ Q_INT32 x1;
+ Q_INT32 y1;
+
+ m_projectionValid = false;
+
+ // No need to invalidate every point. One per tile is enough
+ for (y1 = y; y1 < dy; y1 += TILE_HEIGHT) {
+ for (x1 = x; x1 < dx; x1 += TILE_WIDTH)
+ data() -> invalidate(x1, y1);
+ data() -> invalidate(dx, y1);
+ }
+ for (x1 = x; x1 < dx; x1 += TILE_WIDTH)
+ data() -> invalidate(x1, dy);
+ data() -> invalidate(dx, dy);
}
void KisPaintDevice::invalidate(const QRect& rc)
@@ -215,7 +219,7 @@ void KisPaintDevice::invalidate(const QR
void KisPaintDevice::invalidate()
{
- invalidate(0, 0, width(), height());
+ invalidate(extentLeft(), extentUp(), extentWidth(), extentHeight());
}
void KisPaintDevice::configure(KisImageSP image,
@@ -227,17 +231,15 @@ void KisPaintDevice::configure(KisImageS
if (image == 0 || name.isEmpty())
return;
- m_width = width;
- m_height = height;
m_imgType = imgType;
m_depth = image -> depth();
m_alpha = image -> alpha();
m_x = 0;
m_y = 0;
- m_offX = 0;
- m_offY = 0;
- m_offW = 0;
- m_offH = 0;
+ m_clipLeft = 0;
+ m_clipTop = 0;
+ m_clipRight = 0;
+ m_clipBottom = 0;
m_tiles = new KisTileMgr(m_depth, width, height);
m_visible = true;
m_owner = image;
@@ -253,22 +255,22 @@ void KisPaintDevice::configure(KisImageS
void KisPaintDevice::update()
{
- update(0, 0, width(), height());
+ update(extentLeft(), extentUp(), extentWidth(), extentHeight());
}
void KisPaintDevice::update(Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h)
{
- if (x < m_offX)
- x = m_offX;
+ if (x < m_clipLeft)
+ x = m_clipLeft;
- if (y < m_offY)
- y = m_offY;
+ if (y < m_clipTop)
+ y = m_clipTop;
- if (w > m_offW)
- w = m_offW;
+ if (x + w > m_clipRight)
+ w = m_clipRight - x;
- if (h > m_offH)
- h = m_offH;
+ if (y + h > m_clipBottom)
+ h = m_clipBottom - y;
invalidate(x, y, w, h);
}
@@ -285,11 +287,11 @@ void KisPaintDevice::move(const QPoint&
move(pt.x(), pt.y());
}
-bool KisPaintDevice::contains(Q_INT32 x, Q_INT32 y) const
+bool KisPaintDevice::contains(Q_INT32 outsideX, Q_INT32 outsideY) const
{
- QRect rc(m_x, m_y, m_width, m_height);
+ QRect rc(x()+extentLeft(), y()+extentUp(), extentWidth(), extentHeight());
- return rc.contains(x, y);
+ return rc.contains(outsideX, outsideY);
}
bool KisPaintDevice::contains(const QPoint& pt) const
@@ -384,7 +386,7 @@ enumImgType KisPaintDevice::typeWithAlph
QImage KisPaintDevice::convertToImage()
{
- return m_colorStrategy -> convertToImage(data(), m_depth, 0, 0, m_width, m_height);
+ return m_colorStrategy -> convertToImage(data(), m_depth, 0, 0, extentWidth(), \
extentHeight()); }
KisTileMgrSP KisPaintDevice::data()
@@ -419,7 +421,7 @@ Q_INT32 KisPaintDevice::quantumSizeWithA
QRect KisPaintDevice::bounds() const
{
- return QRect(m_x, m_y, m_width, m_height);
+ return QRect(m_x + extentLeft(), m_y + extentUp(), extentWidth(), \
extentHeight()); }
Q_INT32 KisPaintDevice::x() const
@@ -442,16 +444,37 @@ void KisPaintDevice::setY(Q_INT32 y)
m_y = y;
}
-Q_INT32 KisPaintDevice::width() const
+Q_INT32 KisPaintDevice::extentRight() const
+{
+ return m_tiles -> width() - 1;
+}
+
+Q_INT32 KisPaintDevice::extentDown() const
{
- return m_width;
+ return m_tiles -> height() - 1;
}
-Q_INT32 KisPaintDevice::height() const
+Q_INT32 KisPaintDevice::extentLeft() const
{
- return m_height;
+ return 0;
+}
+
+Q_INT32 KisPaintDevice::extentUp() const
+{
+ return 0;
}
+Q_INT32 KisPaintDevice::extentWidth() const
+{
+ return extentRight() - extentLeft() + 1;
+}
+
+Q_INT32 KisPaintDevice::extentHeight() const
+{
+ return extentDown() - extentUp() + 1;
+}
+
+
const bool KisPaintDevice::visible() const
{
return m_visible;
@@ -467,25 +490,25 @@ void KisPaintDevice::visible(bool v)
QRect KisPaintDevice::clip() const
{
- return QRect(m_offX, m_offY, m_offW, m_offH);
+ return QRect(m_clipLeft, m_clipTop, m_clipRight - m_clipLeft, m_clipBottom - \
m_clipTop); }
void KisPaintDevice::clip(Q_INT32 *offx, Q_INT32 *offy, Q_INT32 *offw, Q_INT32 \
*offh) const {
if (offx && offy && offw && offh) {
- *offx = m_offX;
- *offy = m_offY;
- *offw = m_offW;
- *offh = m_offH;
+ *offx = m_clipLeft;
+ *offy = m_clipTop;
+ *offw = m_clipRight - m_clipLeft;
+ *offh = m_clipBottom - m_clipTop;
}
}
void KisPaintDevice::setClip(Q_INT32 offx, Q_INT32 offy, Q_INT32 offw, Q_INT32 offh)
{
- m_offX = offx;
- m_offY = offy;
- m_offW = offw;
- m_offH = offh;
+ m_clipLeft = offx;
+ m_clipTop = offy;
+ m_clipRight = offx + offw;
+ m_clipBottom = offy + offh;
}
bool KisPaintDevice::cmap(KoColorMap& cm)
@@ -517,15 +540,13 @@ void KisPaintDevice::setImage(KisImageSP
void KisPaintDevice::init()
{
m_visible = false;
- m_width = 0;
- m_height = 0;
m_depth = 0;
m_alpha = false;
m_quantumSize = 0;
- m_offX = 0;
- m_offY = 0;
- m_offW = 0;
- m_offH = 0;
+ m_clipLeft = 0;
+ m_clipTop = 0;
+ m_clipRight = 0;
+ m_clipBottom = 0;
m_x = 0;
m_y = 0;
m_projectionValid = false;
@@ -621,53 +642,6 @@ void KisPaintDevice::data(KisTileMgrSP m
}
m_tiles = mgr;
- width(mgr -> width());
- height(mgr -> height());
-}
-
-void KisPaintDevice::width(Q_INT32 w)
-{
- m_width = w;
-}
-
-void KisPaintDevice::height(Q_INT32 h)
-{
- m_height = h;
-}
-
-void KisPaintDevice::resize(Q_INT32 w, Q_INT32 h)
-{
- KisTileMgrSP old = data();
- KisTileMgrSP tm = new KisTileMgr(old, old -> depth(), w, h);
- Q_INT32 oldW = width();
- Q_INT32 oldH = height();
- KisPainter gc;
-
- data(tm);
- width(w);
- height(h);
- gc.begin(this);
-
- if (oldW < w)
- gc.eraseRect(oldW, 0, w, h);
-
- if (oldH < h)
- gc.eraseRect(0, oldH, w, h);
-
- gc.end();
-}
-
-void KisPaintDevice::resize(const QSize& size)
-{
- resize(size.width(), size.height());
-}
-
-void KisPaintDevice::resize()
-{
- KisImageSP img = image();
-
- if (img)
- resize(img -> bounds().size());
}
void KisPaintDevice::scale(double sx, double sy)
@@ -696,20 +670,20 @@ void KisPaintDevice::transform(const QWM
// compute size of target image
// (this bit seems to be mostly from QImage.xForm)
- QWMatrix mat = QPixmap::trueMatrix( matrix, width(), height() );
+ QWMatrix mat = QPixmap::trueMatrix( matrix, extentWidth(), extentHeight() );
if ( mat.m12() == 0.0F && mat.m21() == 0.0F ) {
kdDebug() << "Scaling layer: " << m_name << "\n";
if ( mat.m11() == 1.0F && mat.m22() == 1.0F ) {
kdDebug() << "Identity matrix, do nothing.\n";
return;
}
- targetW = qRound( mat.m11() * width() );
- targetH = qRound( mat.m22() * height() );
+ targetW = qRound( mat.m11() * extentWidth() );
+ targetH = qRound( mat.m22() * extentHeight() );
targetW = QABS( targetW );
targetH = QABS( targetH );
} else {
kdDebug() << "Rotating or shearing layer " << m_name << "\n";
- QPointArray a( QRect(0, 0, width(), height()) );
+ QPointArray a( QRect(0+extentLeft(), extentUp(), extentWidth(), \
extentHeight()) ); a = mat.map( a );
QRect r = a.boundingRect().normalize();
targetW = r.width();
@@ -754,7 +728,7 @@ void KisPaintDevice::transform(const QWM
Q_INT32 orY = qRound(targetMat.m22() * y + targetMat.m12() * \
x + targetMat.dy());
int currentPos = (y*targetW+x) * depth(); // try to be at \
least a little efficient
- if (!(orX < 0 || orY < 0 || orX >= width() || orY >= \
height())) { + if (!(orX < extentDown() || orY < extentUp() || \
orX >= extentRight() || orY >= extentDown())) {
data() -> readPixelData(orX, orY, orX, orY, \
origPixel, depth()); for(int i = 0; i < depth(); i++)
newData[currentPos + i] = origPixel[i];
@@ -777,19 +751,19 @@ void KisPaintDevice::mirrorX()
/* Should be bit depth independent, but I don't have anything to test that \
with.
I don't know about colour strategy, but if bit depth works that should \
too */
- QUANTUM *line1 = new QUANTUM[width() * depth() * sizeof(QUANTUM)];
- QUANTUM *line2 = new QUANTUM[width() * depth() * sizeof(QUANTUM)];
- KisTileMgrSP tm = new KisTileMgr(depth(), width(), height());
-
- int cutoff = static_cast<int>(height()/2);
-
- for(int i = 0; i < cutoff; i++) {
- data() -> readPixelData(0, i, width() - 1, i, line1, width() * \
depth());
- data() -> readPixelData(0, height() - i - 1, width() - 1, height() - \
i - 1, line2, width() * depth()); + QUANTUM *line1 = new QUANTUM[extentWidth() \
* depth() * sizeof(QUANTUM)]; + QUANTUM *line2 = new QUANTUM[extentWidth() * \
depth() * sizeof(QUANTUM)]; + KisTileMgrSP tm = new KisTileMgr(depth(), \
extentWidth(), extentHeight()); +
+ int cutoff = static_cast<int>(extentUp() + extentDown()/2);
+/*CBR
+ for(int i = extentUp(); i < cutoff; i++) {
+ data() -> readPixelData(extentLeft(), i, width() - 1, i, line1, \
width() * depth()); + data() -> readPixelData(extentLeft(), height() - \
i - 1, width() - 1, height() - i - 1, line2, width() * depth());
tm -> writePixelData(0, height() - i - 1, width() - 1, height() - i \
- 1, line1, width() * depth());
tm -> writePixelData(0, i, width() - 1, i, line2, width() * \
depth()); }
-
+*/
data(tm);
delete[] line1;
@@ -805,6 +779,7 @@ void KisPaintDevice::mirrorY()
/* Should be bit depth and arch independent, but I don't have anything to \
test
that with I don't know about colour strategy, but if bit depth works that
should too */
+/*CBR
QUANTUM *pixel = new QUANTUM[depth() * sizeof(QUANTUM)]; // the right pixel
QUANTUM *line = new QUANTUM[width() * depth() * sizeof(QUANTUM)];
KisTileMgrSP tm = new KisTileMgr(depth(), width(), height());
@@ -826,18 +801,7 @@ void KisPaintDevice::mirrorY()
delete[] line;
delete[] pixel;
-}
-
-void KisPaintDevice::expand(Q_INT32 w, Q_INT32 h)
-{
- w = QMAX(w, width());
- h = QMAX(h, height());
- resize(w, h);
-}
-
-void KisPaintDevice::expand(const QSize& size)
-{
- expand(size.width(), size.height());
+*/
}
void KisPaintDevice::anchor()
@@ -846,6 +810,8 @@ void KisPaintDevice::anchor()
void KisPaintDevice::offsetBy(Q_INT32 x, Q_INT32 y)
{
+
+/*CBR
if (x < 0)
x = 0;
@@ -868,19 +834,20 @@ void KisPaintDevice::offsetBy(Q_INT32 x,
tm -> releasePixelData(dst);
m_x -= x;
m_y -= y;
+*/
}
bool KisPaintDevice::write(KoStore *store)
{
KisTileMgrSP tm = data();
- Q_INT32 totalBytes = m_height * m_width * m_depth * sizeof(QUANTUM);
+ Q_INT32 totalBytes = extentHeight() * extentWidth() * m_depth * \
sizeof(QUANTUM); Q_INT32 nbytes = 0;
Q_ASSERT(store);
Q_ASSERT(tm);
- for (Q_INT32 y = 0; y < m_height; y += TILE_HEIGHT) {
- for (Q_INT32 x = 0; x < m_width; x += TILE_WIDTH) {
+ for (Q_INT32 y = 0; y < extentHeight(); y += TILE_HEIGHT) {
+ for (Q_INT32 x = 0; x < extentWidth(); x += TILE_WIDTH) {
KisTileSP tile = tm -> tile(x, y, TILEMODE_READ);
Q_INT32 tileBytes = tile -> height() * tile -> width() * \
m_depth * sizeof(QUANTUM);
@@ -903,14 +870,14 @@ bool KisPaintDevice::write(KoStore *stor
bool KisPaintDevice::read(KoStore *store)
{
KisTileMgrSP tm = data();
- Q_INT32 totalBytes = m_height * m_width * m_depth * sizeof(QUANTUM);
+ Q_INT32 totalBytes = extentHeight() * extentWidth() * m_depth * \
sizeof(QUANTUM); Q_INT32 nbytes = 0;
Q_ASSERT(store);
Q_ASSERT(tm);
- for (Q_INT32 y = 0; y < m_height; y += TILE_HEIGHT) {
- for (Q_INT32 x = 0; x < m_width; x += TILE_WIDTH) {
+ for (Q_INT32 y = 0; y < extentHeight(); y += TILE_HEIGHT) {
+ for (Q_INT32 x = 0; x < extentWidth(); x += TILE_WIDTH) {
KisTileSP tile = tm -> tile(x, y, TILEMODE_WRITE);
Q_INT32 tileBytes = tile -> height() * tile -> width() * \
m_depth * sizeof(QUANTUM);
@@ -955,7 +922,7 @@ KisIteratorLineQuantum KisPaintDevice::i
}
KisIteratorLineQuantum KisPaintDevice::iteratorQuantumEnd(KisTileCommand* command)
{
- return KisIteratorLineQuantum( this, command, height() - 1);
+ return KisIteratorLineQuantum( this, command, extentUp());
}
KisIteratorLineQuantum KisPaintDevice::iteratorQuantumEnd(KisTileCommand* command, \
Q_INT32 xstart, Q_INT32 xend, Q_INT32 yend) {
@@ -971,7 +938,7 @@ KisIteratorLineQuantum KisPaintDevice::i
}
KisIteratorLineQuantum KisPaintDevice::iteratorQuantumSelectionEnd(KisTileCommand* \
command) {
- return KisIteratorLineQuantum( this, command, height() - 1);
+ return KisIteratorLineQuantum( this, command, extentDown());
}
KisIteratorLineQuantum KisPaintDevice::iteratorQuantumSelectionEnd(KisTileCommand* \
command, Q_INT32 xstart, Q_INT32 xend, Q_INT32 yend) {
Index: core/kis_paint_device.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_paint_device.h,v
retrieving revision 1.55
diff -u -3 -p -r1.55 kis_paint_device.h
--- core/kis_paint_device.h 7 Jun 2004 20:31:14 -0000 1.55
+++ core/kis_paint_device.h 29 Jun 2004 14:54:55 -0000
@@ -140,7 +140,7 @@ public:
Q_INT32 quantumSize() const;
Q_INT32 quantumSizeWithAlpha() const;
- QRect bounds() const;
+ QRect bounds() const;
Q_INT32 x() const;
void setX(Q_INT32 x);
@@ -149,8 +149,14 @@ public:
void setY(Q_INT32 y);
Q_INT32 depth() const;
- Q_INT32 width() const;
- Q_INT32 height() const;
+// Q_INT32 width() const;
+// Q_INT32 height() const;
+ Q_INT32 extentLeft() const;
+ Q_INT32 extentRight() const;
+ Q_INT32 extentUp() const;
+ Q_INT32 extentDown() const;
+ Q_INT32 extentWidth() const;
+ Q_INT32 extentHeight() const;
void clip(Q_INT32 *offx, Q_INT32 *offy, Q_INT32 *offw, Q_INT32 *offh) const;
QRect clip() const;
@@ -163,9 +169,6 @@ public:
const KisImageSP image() const;
void setImage(KisImageSP image);
- void resize(Q_INT32 w, Q_INT32 h);
- void resize(const QSize& size);
- void resize();
void scale(double sx, double sy);
@@ -183,9 +186,6 @@ public:
*/
void mirrorY();
- void expand(Q_INT32 w, Q_INT32 h);
- void expand(const QSize& size);
-
void offsetBy(Q_INT32 x, Q_INT32 y);
/**
@@ -223,8 +223,8 @@ signals:
void ioProgress(Q_INT8 percentage);
protected:
- void width(Q_INT32 w);
- void height(Q_INT32 h);
+// void width(Q_INT32 w);
+// void height(Q_INT32 h);
private:
KisPaintDevice& operator=(const KisPaintDevice&);
@@ -235,15 +235,15 @@ private:
KisTileMgrSP m_tiles;
KisTileMgrSP m_shadow;
bool m_visible;
- Q_INT32 m_x;
- Q_INT32 m_y;
- Q_INT32 m_width;
- Q_INT32 m_height;
+ Q_INT32 m_x; // position relativ to owner
+ Q_INT32 m_y; // position relativ to owner
+// Q_INT32 m_width;
+// Q_INT32 m_height;
Q_INT32 m_depth;
- Q_INT32 m_offX;
- Q_INT32 m_offY;
- Q_INT32 m_offW;
- Q_INT32 m_offH;
+ Q_INT32 m_clipLeft;
+ Q_INT32 m_clipTop;
+ Q_INT32 m_clipRight;
+ Q_INT32 m_clipBottom;
Q_INT32 m_quantumSize;
enumImgType m_imgType;
bool m_alpha;
Index: core/kis_painter.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_painter.cc,v
retrieving revision 1.90
diff -u -3 -p -r1.90 kis_painter.cc
--- core/kis_painter.cc 18 Jun 2004 14:36:56 -0000 1.90
+++ core/kis_painter.cc 29 Jun 2004 14:54:55 -0000
@@ -924,9 +924,10 @@ void KisPainter::paintAt(const KisPoint
y = 0;
}
- bitBlt( x, y, m_compositeOp, m_dab.data(), m_opacity, sx, sy, m_dab -> width(), \
m_dab -> height()); + bitBlt( x, y, m_compositeOp, m_dab.data(), m_opacity, sx, sy, \
m_dab -> extentWidth(), + m_dab -> extentHeight());
- m_dirtyRect |= QRect(x, y, m_dab -> width(), m_dab -> height());
+ m_dirtyRect |= QRect(x, y, m_dab -> extentWidth(), m_dab -> extentHeight());
}
void KisPainter::penAt(const KisPoint & pos,
@@ -976,9 +977,10 @@ void KisPainter::penAt(const KisPoint &
y = 0;
}
- bitBlt( x, y, m_compositeOp, m_dab.data(), m_opacity, sx, sy, m_dab -> width(), \
m_dab -> height()); + bitBlt( x, y, m_compositeOp, m_dab.data(), m_opacity, sx, sy, \
m_dab -> extentWidth(), + m_dab -> extentHeight());
- m_dirtyRect |= QRect(x, y, m_dab -> width(), m_dab -> height());
+ m_dirtyRect |= QRect(x, y, m_dab -> extentWidth(), m_dab -> extentHeight());
}
@@ -1122,9 +1124,10 @@ void KisPainter::airBrushAt(const KisPoi
y = 0;
}
- bitBlt( x, y, COMPOSITE_OVER, m_dab.data(), OPACITY_OPAQUE / 50, sx, sy, m_dab -> \
width(), m_dab -> height()); + bitBlt( x, y, COMPOSITE_OVER, m_dab.data(), \
OPACITY_OPAQUE / 50, sx, sy, + m_dab -> extentWidth(), m_dab -> extentHeight());
- m_dirtyRect |= QRect(x, y, m_dab -> width(), m_dab -> height());
+ m_dirtyRect |= QRect(x, y, m_dab -> extentWidth(), m_dab -> extentHeight());
}
Index: core/kis_selection.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_selection.cc,v
retrieving revision 1.42
diff -u -3 -p -r1.42 kis_selection.cc
--- core/kis_selection.cc 25 Jun 2004 19:08:04 -0000 1.42
+++ core/kis_selection.cc 29 Jun 2004 14:54:55 -0000
@@ -27,7 +27,7 @@ KisSelection::KisSelection(KisLayerSP la
m_name = name;
m_layer = layer;
m_mask = QImage();
- m_mask.create(m_layer -> width(), m_layer -> height(), 8, 256);
+ m_mask.create(m_layer -> extentWidth(), m_layer -> extentHeight(), 8, 256);
for (int i = 0; i < 256; i++) {
m_mask.setColor(i, qRgb(i, i, i));
}
Index: core/kis_view.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_view.cc,v
retrieving revision 1.276
diff -u -3 -p -r1.276 kis_view.cc
--- core/kis_view.cc 22 Jun 2004 12:51:18 -0000 1.276
+++ core/kis_view.cc 29 Jun 2004 14:54:57 -0000
@@ -141,7 +141,6 @@ KisView::KisView(KisDoc *doc, KisUndoAda
m_layerHide = 0;
m_layerProperties = 0;
m_layerSaveAs = 0;
- m_layerResizeToImage = 0;
m_layerToImage = 0;
m_layerTransform = 0;
m_layerRaise = 0;
@@ -163,7 +162,6 @@ KisView::KisView(KisDoc *doc, KisUndoAda
m_imgImport = 0;
m_imgExport = 0;
m_imgScan = 0;
- m_imgResizeToLayer = 0;
m_imgMergeAll = 0;
m_imgMergeVisible = 0;
m_imgMergeLinked = 0;
@@ -258,7 +256,7 @@ void KisView::setupDockers()
m_resourcedocker -> plug(m_patternMediator -> chooserWidget());
connect(m_patternMediator, SIGNAL(activatedResource(KisResource*)), this, \
SLOT(patternActivated(KisResource*)));
- m_layerBox = new KisLayerBox(i18n("layer"), KisLayerBox::SHOWALL, \
m_layerchanneldocker); + m_layerBox = new KisLayerBox(m_layerchanneldocker, \
"layer box", NULL ); m_layerBox -> setCaption(i18n("Layers"));
connect(m_layerBox, SIGNAL(itemToggleVisible()), \
SLOT(layerToggleVisible())); @@ -484,7 +482,6 @@ void KisView::setupActions()
m_imgImport = new KAction(i18n("Import Image..."), "wizard", 0, this, \
SLOT(slotImportImage()), actionCollection(), "import_image");
m_imgExport = new KAction(i18n("Export Image..."), "wizard", 0, this, \
SLOT(export_image()), actionCollection(), "export_image");
m_imgScan = 0; // How the hell do I get a KAction to the scan plug-in?!?
- m_imgResizeToLayer = new KAction(i18n("Resize Image to Current Layer"), 0, \
this, SLOT(imgResizeToActiveLayer()), actionCollection(), "resizeimgtolayer");
// view actions
m_zoomIn = KStdAction::zoomIn(this, SLOT(slotZoomIn()), actionCollection(), \
"zoom_in"); @@ -506,7 +503,6 @@ void KisView::setupActions()
m_layerProperties = new KAction(i18n("Layer Properties..."), 0, this, \
SLOT(layerProperties()), actionCollection(), "layer_properties");
(void)new KAction(i18n("I&nsert Image as Layer..."), 0, this, \
SLOT(slotInsertImageAsLayer()), actionCollection(), \
"insert_image_as_layer");
m_layerSaveAs = new KAction(i18n("Save Layer as Image..."), 0, this, \
SLOT(save_layer_as_image()), actionCollection(), \
"save_layer_as_image");
- m_layerResizeToImage = new KAction(i18n("Resize Layer to Image"), 0, this, \
SLOT(layerResizeToImage()), actionCollection(), \
"resizelayertoowner");
m_layerToImage = new KAction(i18n("Layer to Image"), 0, this, \
SLOT(layerToImage()), actionCollection(), "layer_to_image");
// layer transformations - should be generic, for selection too
@@ -810,7 +806,6 @@ void KisView::layerUpdateGUI(bool enable
m_layerHide -> setEnabled(enable);
m_layerProperties -> setEnabled(enable);
m_layerSaveAs -> setEnabled(enable);
- m_layerResizeToImage -> setEnabled(enable);
m_layerToImage -> setEnabled(enable);
m_layerTransform -> setEnabled(enable);
m_layerRaise -> setEnabled(enable && nlayers > 1 && layerPos);
@@ -948,7 +943,6 @@ void KisView::imgUpdateGUI()
m_imgDup -> setEnabled(img != 0);
m_imgExport -> setEnabled(img != 0);
m_layerAdd -> setEnabled(img != 0);
- m_imgResizeToLayer -> setEnabled(img && img -> activeLayer());
if (img) {
const vKisLayerSP& layers = img -> layers();
@@ -1260,19 +1254,6 @@ void KisView::slotImportImage()
m_doc -> setModified(true);
}
-void KisView::imgResizeToActiveLayer()
-{
- KisImageSP img = currentImg();
- KisLayerSP layer;
-
- if (img && (layer = img -> activeLayer())) {
- if (layer -> width() != img -> width() || layer -> height() != img \
-> height()) {
- img -> resize(layer -> width(), layer -> height());
- canvasRefresh();
- }
- }
-}
-
void KisView::export_image()
{
KURL url = KFileDialog::getSaveURL(QString::null, \
KisImageMagickConverter::writeFilters(), this, i18n("Export Image")); @@ -1462,7 \
+1443,7 @@ Q_INT32 KisView::importImage(bool create layer -> setImage(current);
layer -> setName(current -> nextLayerName());
m_doc -> layerAdd(current, layer, 0);
- m_layerBox -> setCurrentItem(img -> index(layer));
+//CBR m_layerBox -> setCurrentItem(img -> \
index(layer)); }
current -> invalidate();
@@ -1605,7 +1586,7 @@ void KisView::merge_all_layers()
if (img) {
KisLayerSP dst = new KisLayer(img, img -> width(), img -> height(), \
img -> nextLayerName(), OPACITY_OPAQUE); KisPainter gc(dst.data());
- gc.fillRect(0, 0, dst -> width(), dst -> height(), KoColor(0, 0, 0), \
OPACITY_TRANSPARENT); + gc.fillRect(0, 0, img -> width(), img -> \
height(), KoColor(0, 0, 0), OPACITY_TRANSPARENT); vKisLayerSP layers = img -> \
layers(); KisMerge<flattenAll> visitor(img, false);
@@ -1623,7 +1604,7 @@ void KisView::merge_visible_layers()
if (img) {
KisLayerSP dst = new KisLayer(img, img -> width(), img -> height(), \
img -> nextLayerName(), OPACITY_OPAQUE); KisPainter gc(dst.data());
- gc.fillRect(0, 0, dst -> width(), dst -> height(), KoColor(0, 0, 0), \
OPACITY_TRANSPARENT); + gc.fillRect(0, 0, img -> width(), img -> \
height(), KoColor(0, 0, 0), OPACITY_TRANSPARENT); KisMerge<flattenAllVisible> \
visitor(img, false); vKisLayerSP layers = img -> layers();
@@ -1641,7 +1622,7 @@ void KisView::merge_linked_layers()
if (img) {
KisLayerSP dst = new KisLayer(img, img -> width(), img -> height(), \
img -> nextLayerName(), OPACITY_OPAQUE); KisPainter gc(dst.data());
- gc.fillRect(0, 0, dst -> width(), dst -> height(), KoColor(0, 0, 0), \
OPACITY_TRANSPARENT); + gc.fillRect(0, 0, img -> width(), img -> \
height(), KoColor(0, 0, 0), OPACITY_TRANSPARENT); KisMerge<flattenAllLinked> \
visitor(img, false); vKisLayerSP layers = img -> layers();
@@ -2098,9 +2079,9 @@ void KisView::layerAdd()
dlg.imageType());
if (layer) {
- m_layerBox -> setCurrentItem(img -> index(layer));
+//CBR m_layerBox -> setCurrentItem(img -> \
index(layer)); resizeEvent(0);
- updateCanvas(layer -> x(), layer -> y(), layer -> \
width(), layer -> height()); + updateCanvas(layer -> \
bounds()); cfg.defLayerWidth(dlg.layerWidth());
cfg.defLayerHeight(dlg.layerHeight());
} else {
@@ -2121,7 +2102,7 @@ void KisView::layerRemove()
Q_INT32 n = img -> index(layer);
m_doc -> layerRemove(img, layer);
- m_layerBox -> setCurrentItem(n - 1);
+//CBR m_layerBox -> setCurrentItem(n - 1);
resizeEvent(0);
updateCanvas();
layerUpdateGUI(img -> activeLayer() != 0);
@@ -2221,7 +2202,7 @@ void KisView::layersUpdated()
for (vKisLayerSP_it it = l.begin(); it != l.end(); it++)
m_layerBox -> insertItem((*it) -> name(), (*it) -> \
visible(), (*it) -> linked());
- m_layerBox -> setCurrentItem(img -> index(img -> activeLayer()));
+//CBR m_layerBox -> setCurrentItem(img -> index(img -> \
activeLayer())); m_doc -> setModified(true);
}
@@ -2407,41 +2388,6 @@ void KisView::imgUpdated(KisImageSP img,
}
}
-void KisView::resizeLayer(Q_INT32 w, Q_INT32 h)
-{
- KisImageSP img = currentImg();
- if (img) {
- KisLayerSP layer = img -> activeLayer();
- if (layer) {
- layer -> resize(w, h);
- img -> invalidate();
- layersUpdated();
- resizeEvent(0);
- canvasRefresh();
- }
- }
-}
-
-void KisView::layerResizeToImage()
-{
- KisImageSP img = currentImg();
-
- if (img) {
- KisLayerSP layer = img -> activeLayer();
-
- if (layer) {
- if (layer -> width() == img -> width() || layer -> height() \
== img -> height())
- return;
-
- layer -> resize(img -> width(), img -> height());
- img -> invalidate();
- layersUpdated();
- resizeEvent(0);
- canvasRefresh();
- }
- }
-}
-
void KisView::layerToImage()
{
KisImageSP img = currentImg();
@@ -2456,7 +2402,7 @@ void KisView::layerToImage()
img -> activeLayer();
if (layer) {
- KisImageSP dupedImg = new KisImage(m_adapter, layer -> \
width(), layer -> height(), img -> nativeImgType(), m_doc -> nextImageName()); + \
KisImageSP dupedImg = new KisImage(m_adapter, img -> width(), img -> height(), img -> \
nativeImgType(), m_doc -> nextImageName()); KisLayerSP duped = new KisLayer(*layer);
duped -> setName(dupedImg -> nextLayerName());
Index: core/kis_view.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_view.h,v
retrieving revision 1.130
diff -u -3 -p -r1.130 kis_view.h
--- core/kis_view.h 16 Jun 2004 19:38:12 -0000 1.130
+++ core/kis_view.h 29 Jun 2004 14:54:57 -0000
@@ -123,7 +123,6 @@ public slots:
// image action slots
void slotImportImage();
void export_image();
- void imgResizeToActiveLayer();
void add_new_image_tab();
void remove_current_image_tab();
void resizeCurrentImage(Q_INT32 w, Q_INT32 h);
@@ -141,7 +140,6 @@ public slots:
void rotateLayerCustom();
void mirrorLayerX();
void mirrorLayerY();
- void resizeLayer(Q_INT32 w, Q_INT32 h);
void scaleLayer(double sx, double sy);
void selectAll();
void unSelectAll();
@@ -261,7 +259,6 @@ private slots:
void layerToggleLinked();
void layerProperties();
- void layerResizeToImage();
void layerToImage();
void layerTransform();
void layerAdd();
@@ -328,7 +325,6 @@ private:
KAction *m_imgMergeLinked;
KAction *m_imgMergeVisible;
KAction *m_imgRename;
- KAction *m_imgResizeToLayer;
KAction *m_imgRm;
KAction *m_imgScan;
KAction *m_layerAdd;
@@ -336,10 +332,9 @@ private:
KAction *m_layerDup;
KAction *m_layerHide;
KAction *m_layerLink;
+ KAction *m_layerRaise;
KAction *m_layerLower;
KAction *m_layerProperties;
- KAction *m_layerRaise;
- KAction *m_layerResizeToImage;
KAction *m_layerRm;
KAction *m_layerSaveAs;
KAction *m_layerToImage;
Index: core/builder/kis_image_magick_converter.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/builder/kis_image_magick_converter.cc,v
retrieving revision 1.16
diff -u -3 -p -r1.16 kis_image_magick_converter.cc
--- core/builder/kis_image_magick_converter.cc 27 Feb 2004 11:14:27 -0000 1.16
+++ core/builder/kis_image_magick_converter.cc 29 Jun 2004 14:54:57 -0000
@@ -310,25 +310,25 @@ KisImageBuilder_Result KisImageMagickCon
return KisImageBuilder_RESULT_PATH;
}
- if (!layer -> width() || !layer -> height())
+ if (layer -> extentLeft() == layer->extentRight() || !layer -> extentUp() == layer \
-> extentDown()) return KisImageBuilder_RESULT_EMPTY;
image = AllocateImage(ii);
tm = layer -> data();
- image -> columns = layer -> width();
- image -> rows = layer -> height();
+ image -> columns = layer -> extentRight() - layer -> extentLeft();
+ image -> rows = layer -> extentDown() - layer -> extentUp();;
image -> matte = layer -> alpha();
w = TILE_WIDTH;
h = TILE_HEIGHT;
totalTiles = ((image -> columns + TILE_WIDTH - 1) / TILE_WIDTH) * ((image -> rows + \
TILE_HEIGHT - 1) / TILE_HEIGHT);
- for (Q_INT32 y = 0; y < layer -> height(); y += TILE_HEIGHT) {
- if ((y + h) > layer -> height())
- h = TILE_HEIGHT + layer -> height() - (y + h);
-
- for (Q_INT32 x = 0; x < layer -> width(); x += TILE_WIDTH) {
- if ((x + w) > layer -> width())
- w = TILE_WIDTH + layer -> width() - (x + w);
+ for (Q_INT32 y = layer -> extentUp(); y < layer -> extentDown(); y += TILE_HEIGHT) \
{ + if ((y + h) > layer -> extentDown())
+ h = TILE_HEIGHT + layer -> extentDown() - (y + h);
+
+ for (Q_INT32 x = layer -> extentLeft(); x < layer -> extentRight(); x += \
TILE_WIDTH) { + if ((x + w) > layer -> extentRight())
+ w = TILE_WIDTH + layer -> extentRight() - (x + w);
KisPixelDataSP pd = tm -> pixelData(x, y, x + w - 1, y + h - 1, TILEMODE_READ);
PixelPacket *pp = SetImagePixels(image, x, y, w, h);
Index: core/strategy/kis_strategy_move.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/strategy/kis_strategy_move.cc,v
retrieving revision 1.8
diff -u -3 -p -r1.8 kis_strategy_move.cc
--- core/strategy/kis_strategy_move.cc 16 Nov 2003 20:17:10 -0000 1.8
+++ core/strategy/kis_strategy_move.cc 29 Jun 2004 14:54:57 -0000
@@ -80,9 +80,11 @@ namespace {
{
QRect rc;
- rc.setRect(m_device -> x(), m_device -> y(), m_device -> width(), m_device -> \
height()); + rc.setRect(m_device -> x() + m_device -> extentLeft(), m_device -> y() \
+m_device -> extentUp(), + m_device -> extentWidth(), m_device -> extentHeight());
m_device -> move(pos.x(), pos.y());
- rc |= QRect(m_device -> x(), m_device -> y(), m_device -> width(), m_device -> \
height()); + rc |= QRect(m_device -> x() + m_device -> extentLeft(), m_device -> y() \
+m_device -> extentUp(), + m_device -> extentWidth(), m_device -> extentHeight());
m_img -> invalidate(); //rc);
m_controller -> updateCanvas(); //rc);
}
@@ -147,28 +149,25 @@ void KisStrategyMove::drag(const QPoint&
KisPaintDeviceSP dev;
if (img && (dev = img -> activeDevice())) {
- QPoint pos = original;
+ QPoint delta = original - m_dragStart;
QRect rc;
-
- if (pos.x() >= img -> width() || pos.y() >= img -> height())
- return;
-
- pos -= m_dragStart;
- rc.setRect(dev -> x(), dev -> y(), dev -> width(), dev -> height());
- dev -> move(dev -> x() + pos.x(), dev -> y() + pos.y());
- rc = rc.unite(QRect(dev -> x(), dev -> y(), dev -> width(), dev -> height()));
+
+ rc.setRect(dev -> x() + dev -> extentLeft(), dev -> y() + dev -> extentUp(),
+ dev -> extentWidth(), dev -> extentHeight());
+
+ dev -> move(dev -> x() + delta.x(), dev -> y() + delta.y());
+
+ rc = rc.unite(QRect(dev ->x() + dev -> extentLeft(), dev -> y() + dev -> \
extentUp(), + dev -> extentWidth(), dev -> extentHeight()));
+
rc.setX(QMAX(0, rc.x()));
rc.setY(QMAX(0, rc.y()));
img -> invalidate(rc);
+
m_layerPosition = QPoint(dev -> x(), dev -> y());
m_dragStart = original;
-#if 0
- rc.setX(static_cast<Q_INT32>(rc.x() * m_subject -> zoom()));
- rc.setY(static_cast<Q_INT32>(rc.y() * m_subject -> zoom()));
- rc.setWidth(static_cast<Q_INT32>(rc.width() * m_subject -> zoom()));
- rc.setHeight(static_cast<Q_INT32>(rc.height() * m_subject -> zoom()));
-#endif
- m_controller -> updateCanvas(); //rc);
+
+ m_controller -> updateCanvas();
}
}
}
Index: core/visitors/kis_flatten.h
===================================================================
RCS file: /home/kde/koffice/krita/core/visitors/kis_flatten.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 kis_flatten.h
--- core/visitors/kis_flatten.h 23 May 2004 20:59:35 -0000 1.4
+++ core/visitors/kis_flatten.h 29 Jun 2004 14:54:57 -0000
@@ -123,10 +123,10 @@ private:
return;
clip = dev -> clip();
- sx = dev -> x();
- sy = dev -> y();
- w = dev -> width();
- h = dev -> height();
+ sx = dev -> x() + dev-> extentLeft();
+ sy = dev -> y() + dev -> extentUp();
+ w = dev -> extentWidth();
+ h = dev -> extentHeight();
if (!clip.isEmpty()) {
sx = sx + clip.x();
Index: core/visitors/kis_merge.h
===================================================================
RCS file: /home/kde/koffice/krita/core/visitors/kis_merge.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 kis_merge.h
--- core/visitors/kis_merge.h 10 Jun 2004 14:44:02 -0000 1.8
+++ core/visitors/kis_merge.h 29 Jun 2004 14:54:57 -0000
@@ -77,12 +77,12 @@ public:
Q_INT32 w;
Q_INT32 h;
- sx = layer -> x();
- sy = layer -> y();
- dx = layer -> x();
- dy = layer -> y();
- w = layer -> width();
- h = layer -> height();
+ sx = layer -> x() + layer -> extentLeft();
+ sy = layer -> y() + layer -> extentUp();
+ dx = layer -> x() + layer -> extentLeft();
+ dy = layer -> y() + layer -> extentUp();
+ w = layer -> extentWidth();
+ h = layer -> extentHeight();
if (sx < 0) {
w += sx;
Index: plugins/Makefile.am
===================================================================
RCS file: /home/kde/koffice/krita/plugins/Makefile.am,v
retrieving revision 1.7
diff -u -3 -p -r1.7 Makefile.am
--- plugins/Makefile.am 14 Jun 2004 14:41:11 -0000 1.7
+++ plugins/Makefile.am 29 Jun 2004 14:54:58 -0000
@@ -1 +1 @@
-SUBDIRS = example colorsfilters variations colorrange screenmode imagesize \
screenshot +SUBDIRS = example colorsfilters variations screenmode screenshot
Index: plugins/colorrange/wdg_colorrange.ui
===================================================================
RCS file: /home/kde/koffice/krita/plugins/colorrange/wdg_colorrange.ui,v
retrieving revision 1.4
diff -u -3 -p -r1.4 wdg_colorrange.ui
--- plugins/colorrange/wdg_colorrange.ui 25 Jun 2004 19:08:05 -0000 1.4
+++ plugins/colorrange/wdg_colorrange.ui 29 Jun 2004 14:55:00 -0000
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>WdgColorRange</class>
<widget class="QWidget">
<property name="name">
Index: plugins/imagesize/wdg_imagesize.ui
===================================================================
RCS file: /home/kde/koffice/krita/plugins/imagesize/wdg_imagesize.ui,v
retrieving revision 1.5
diff -u -3 -p -r1.5 wdg_imagesize.ui
--- plugins/imagesize/wdg_imagesize.ui 22 Jun 2004 12:51:19 -0000 1.5
+++ plugins/imagesize/wdg_imagesize.ui 29 Jun 2004 14:55:01 -0000
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>WdgImageSize</class>
<widget class="QWidget">
<property name="name">
Index: plugins/imagesize/wdg_resolution.ui
===================================================================
RCS file: /home/kde/koffice/krita/plugins/imagesize/wdg_resolution.ui,v
retrieving revision 1.1
diff -u -3 -p -r1.1 wdg_resolution.ui
--- plugins/imagesize/wdg_resolution.ui 22 Jun 2004 12:51:39 -0000 1.1
+++ plugins/imagesize/wdg_resolution.ui 29 Jun 2004 14:55:01 -0000
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>WdgResolution</class>
<widget class="QWidget">
<property name="name">
Index: plugins/screenmode/screenmode.cc
===================================================================
RCS file: /home/kde/koffice/krita/plugins/screenmode/Attic/screenmode.cc,v
retrieving revision 1.1
diff -u -3 -p -r1.1 screenmode.cc
--- plugins/screenmode/screenmode.cc 29 May 2004 21:54:30 -0000 1.1
+++ plugins/screenmode/screenmode.cc 29 Jun 2004 14:55:01 -0000
@@ -86,7 +86,7 @@ ScreenMode::~ScreenMode()
void ScreenMode::slotFullScreen()
{
- m_view -> setWindowState( m_view -> windowState() ^ WindowFullScreen);
+// m_view -> setWindowState( m_view -> windowState() ^ WindowFullScreen);
}
void ScreenMode::slotFullScreenMenu()
Index: tools/kis_tool_move.cc
===================================================================
RCS file: /home/kde/koffice/krita/tools/kis_tool_move.cc,v
retrieving revision 1.41
diff -u -3 -p -r1.41 kis_tool_move.cc
--- tools/kis_tool_move.cc 26 May 2004 15:55:06 -0000 1.41
+++ tools/kis_tool_move.cc 29 Jun 2004 14:55:01 -0000
@@ -58,8 +58,7 @@ void KisToolMove::mousePress(QMouseEvent
if (!img || !(dev = img -> activeDevice()))
return;
- if (dev -> contains(pos))
- m_strategy.startDrag(pos);
+ m_strategy.startDrag(pos);
}
}
Index: tools/kis_tool_pen.cc
===================================================================
RCS file: /home/kde/koffice/krita/tools/kis_tool_pen.cc,v
retrieving revision 1.41
diff -u -3 -p -r1.41 kis_tool_pen.cc
--- tools/kis_tool_pen.cc 18 Jun 2004 19:19:34 -0000 1.41
+++ tools/kis_tool_pen.cc 29 Jun 2004 14:55:01 -0000
@@ -66,23 +66,20 @@ void KisToolPen::update(KisCanvasSubject
m_subject = subject;
m_currentImage = subject -> currentImg();
- super::update(m_subject);
+ super::update( m_subject );
}
void KisToolPen::mousePress(QMouseEvent *e)
{
if (!m_subject) return;
- if (!m_subject->currentBrush()) return;
+ if (!m_subject -> currentBrush()) return;
if (!m_currentImage -> activeDevice()) return;
if (e->button() == QMouseEvent::LeftButton) {
m_mode = PAINT;
- initPaint(e -> pos());
- m_painter -> penAt(e->pos(), PRESSURE_DEFAULT, 0, 0);
- // XXX: get the rect that should be notified
- m_currentImage -> notify( m_painter -> dirtyRect() );
+ initPaint(e -> pos(), PRESSURE_DEFAULT, 0, 0);
}
}
@@ -98,7 +95,7 @@ void KisToolPen::mouseRelease(QMouseEven
void KisToolPen::mouseMove(QMouseEvent *e)
{
if (m_mode == PAINT) {
- paintLine(m_dragStart, e -> pos(), PRESSURE_DEFAULT, 0, 0);
+ paintLine(e -> pos(), PRESSURE_DEFAULT, 0, 0);
}
}
@@ -126,39 +123,46 @@ void KisToolPen::tabletEvent(QTabletEven
endPaint();
} else if (pressure >= PRESSURE_THRESHOLD && m_mode == HOVER) {
m_mode = PAINT_STYLUS;
- initPaint(e -> pos());
- m_painter -> penAt(e -> pos(), pressure, e->xTilt(), e->yTilt());
- // XXX: Get the rect that should be updated
- m_currentImage -> notify( m_painter -> dirtyRect() );
-
+ initPaint( e -> pos(), pressure, e->xTilt(), e->yTilt() );
} else if (pressure >= PRESSURE_THRESHOLD && m_mode == PAINT_STYLUS) {
- paintLine(m_dragStart, e -> pos(), pressure, e -> xTilt(), e -> yTilt());
+ paintLine( e -> pos(), pressure, e -> xTilt(), e -> yTilt() );
}
}
e -> accept();
}
+void KisToolPen::initPaint(const QPoint & pos,
+ const double pressure,
+ const double xtilt,
+ const double ytilt)
-void KisToolPen::initPaint(const QPoint & pos)
{
-
- if (!m_currentImage -> activeDevice()) return;
- m_dragStart = pos;
+ KisPaintDeviceSP dev;
+
+ if (!m_currentImage) return ;
+
+ dev = m_currentImage -> activeDevice();
+ if (!dev) return;
+
+ m_dragStart = pos - QPoint(dev -> x(), dev -> y());
m_dragDist = 0;
- // Create painter
- KisPaintDeviceSP device;
- if (m_currentImage && (device = m_currentImage -> activeDevice())) {
- if (m_painter)
- delete m_painter;
- m_painter = new KisPainter( device );
- m_painter -> beginTransaction(i18n("pen"));
- }
-
+ // Create painter
+ if (m_painter)
+ delete m_painter;
+ m_painter = new KisPainter( dev );
+ m_painter -> beginTransaction(i18n("pen"));
m_painter -> setPaintColor(m_subject -> fgColor());
m_painter -> setBrush(m_subject -> currentBrush());
m_painter -> setOpacity(m_opacity);
m_painter -> setCompositeOp(m_compositeOp);
+ m_painter -> penAt(m_dragStart, pressure, xtilt, ytilt);
+ // XXX: Get the rect that should be updated
+ QRect rc = m_painter -> dirtyRect();
+ rc.moveLeft(rc.x() + dev -> x());
+ rc.moveTop(rc.y() + dev -> y());
+ m_currentImage -> notify(rc);
+
// Set the cursor -- ideally. this should be a mask created from the brush,
// now that X11 can handle colored cursors.
@@ -186,17 +190,23 @@ void KisToolPen::endPaint()
}
}
-void KisToolPen::paintLine(const QPoint & pos1,
- const QPoint & pos2,
- const double pressure,
- const double xtilt,
- const double ytilt)
+void KisToolPen::paintLine(const QPoint & pos2,
+ const double pressure,
+ const double xtilt,
+ const double ytilt)
{
- if (!m_currentImage -> activeDevice()) return;
+ KisPaintDeviceSP dev = m_currentImage -> activeDevice();
+
+ if (!dev) return;
- m_dragDist = m_painter -> paintLine(PAINTOP_PEN, pos1, pos2, pressure, xtilt, \
ytilt, m_dragDist);
- m_currentImage -> notify( m_painter -> dirtyRect() );
- m_dragStart = pos2;
+ QPoint pos = pos2 - QPoint(dev -> x(), dev -> y());
+
+ m_dragDist = m_painter -> paintLine(PAINTOP_PEN, m_dragStart, pos, pressure, xtilt, \
ytilt, m_dragDist); + QRect rc = m_painter -> dirtyRect();
+ rc.moveLeft(rc.x() + dev -> x());
+ rc.moveTop(rc.y() + dev -> y());
+ m_currentImage -> notify( rc);
+ m_dragStart = pos;
}
Index: tools/kis_tool_pen.h
===================================================================
RCS file: /home/kde/koffice/krita/tools/kis_tool_pen.h,v
retrieving revision 1.20
diff -u -3 -p -r1.20 kis_tool_pen.h
--- tools/kis_tool_pen.h 18 Jun 2004 14:36:57 -0000 1.20
+++ tools/kis_tool_pen.h 29 Jun 2004 14:55:01 -0000
@@ -62,13 +62,15 @@ public slots:
virtual void slotSetCompositeMode(int);
private:
- virtual void paintLine(const QPoint & pos1,
- const QPoint & pos2,
- const double pressure,
- const double xtilt,
- const double ytilt);
+ virtual void paintLine(const QPoint & pos2,
+ const double pressure,
+ const double xtilt,
+ const double ytilt);
- virtual void initPaint(const QPoint & pos);
+ virtual void initPaint(const QPoint & pos,
+ const double pressure,
+ const double xtilt,
+ const double ytilt);
virtual void endPaint();
enumBrushMode m_mode;
Index: ui/Makefile.am
===================================================================
RCS file: /home/kde/koffice/krita/ui/Makefile.am,v
retrieving revision 1.60
diff -u -3 -p -r1.60 Makefile.am
--- ui/Makefile.am 16 Jun 2004 19:38:14 -0000 1.60
+++ ui/Makefile.am 29 Jun 2004 14:55:01 -0000
@@ -16,7 +16,6 @@ libkisui_la_SOURCES = integerwidget.cc \
kis_colordocker.cc \
kis_color_widget.cc \
kis_controlframe.cc \
- kis_layerbox.cc \
kis_dlg_create_img.cc \
kis_dlg_new_layer.cc \
kis_dlg_paintoffset.cc \
@@ -31,7 +30,8 @@ libkisui_la_SOURCES = integerwidget.cc \
kis_itemchooser.cc \
kis_previewwidget.cc \
kis_rgb_widget.cc \
- kis_hsv_widget.cc
+ kis_hsv_widget.cc \
+ kis_layerbox.ui
libkisui_la_METASOURCES = AUTO
SUBDIRS = labels dialogs
Index: ui/kis_layerbox.cc
===================================================================
RCS file: /home/kde/koffice/krita/ui/kis_layerbox.cc,v
retrieving revision 1.2
diff -u -3 -p -r1.2 kis_layerbox.cc
--- ui/kis_layerbox.cc 7 Jun 2004 20:31:15 -0000 1.2
+++ ui/kis_layerbox.cc 29 Jun 2004 14:55:01 -0000
@@ -1,460 +1,239 @@
-/*
- * kis_layerbox.cc - part of Krita aka Krayon aka KimageShop
- *
- * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <qbutton.h>
-#include <qtoolbutton.h>
-#include <qbrush.h>
-#include <qfont.h>
-#include <qfontmetrics.h>
-#include <qhbox.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qpoint.h>
-#include <qrect.h>
-#include <qstring.h>
-#include <qstyle.h>
-#include <qtooltip.h>
-#include <qwidget.h>
-
-#include <kdebug.h>
-#include <kglobal.h>
-#include <kpushbutton.h>
-#include <kiconloader.h>
-#include <kicontheme.h>
+#include <kdialog.h>
#include <klocale.h>
-#include <kmessagebox.h>
-#include <kpopupmenu.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './kis_layerbox.ui'
+**
+** Created: Mon Jun 28 00:47:43 2004
+** by: The User Interface Compiler ($Id: qt/main.cpp 3.2.3 edited May 19 \
14:22 $) +**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
#include "kis_layerbox.h"
-const int HEIGHT = 32;
-
-KisLayerBox::KisLayerBox(const QString& label, flags f, QWidget *parent, const char \
*name) : super(parent, name)
-{
- QVBoxLayout *vbox = new QVBoxLayout(this);
- KPopupMenu *mnu;
- QHBox *hbox;
- QButton *btn;
-
- m_flags = f;
- vbox -> setAutoAdd(true);
- m_lst = new KListBox(this);
-
- hbox = new QHBox(this);
- hbox -> setMargin(4);
- hbox -> setSpacing(4);
- hbox -> setMaximumHeight(30);
-
- btn = new QToolButton(hbox);
- btn -> setPixmap(BarIcon("newlayer"));
- btn -> setFixedSize(24, 24);
- QToolTip::add(btn, i18n("Create new %1").arg(label));
-
- m_btnRm = new QToolButton(hbox);
- m_btnRm -> setPixmap(BarIcon("deletelayer"));
- m_btnRm -> setFixedSize(24, 24);
- QToolTip::add(m_btnRm, i18n("Remove current %1").arg(label));
-
- m_btnRaise = new QToolButton(hbox);
- m_btnRaise -> setPixmap(BarIcon("raiselayer"));
- QToolTip::add(m_btnRaise, i18n("Upper current %1").arg(label));
- m_btnRaise -> setEnabled(false);
- m_btnRaise -> setFixedSize(24, 24);
-
- m_btnLower = new QToolButton(hbox);
- m_btnLower -> setPixmap(BarIcon("lowerlayer"));
- m_btnLower -> setEnabled(false);
- QToolTip::add(m_btnLower, i18n("Lower current %1").arg(label));
- m_btnLower -> setFixedSize(24, 24);
-
- QWidget * spacer = new QWidget(hbox);
- hbox -> setStretchFactor(spacer, 10);
-
- mnu = new KPopupMenu();
- mnu -> insertItem(i18n("Raise %1").arg(label), RAISE);
- mnu -> insertItem(i18n("Lower %1").arg(label), LOWER);
- mnu -> insertItem(i18n("Foremost %1").arg(label), FRONT);
- mnu -> insertItem(i18n("Hindmost %1").arg(label), BACK);
-
- m_contextMnu = new KPopupMenu();
- m_contextMnu -> setCheckable(true);
-
- if (f & SHOWVISIBLE)
- m_contextMnu -> insertItem(i18n("Visible" ), VISIBLE);
-
- m_contextMnu -> insertItem(i18n("Selection"), SELECTION);
- m_contextMnu -> insertItem(i18n("Level"), mnu, LEVEL);
-
- if (f & SHOWLINKED)
- m_contextMnu -> insertItem(i18n("Linked"), LINKING);
-
- m_contextMnu -> insertItem(i18n("Properties..."), PROPERTIES);
- m_contextMnu -> insertSeparator();
-
- m_contextMnu -> insertItem(i18n("Add %1...").arg(label), ADD);
- m_contextMnu -> insertItem(i18n("Remove %1").arg(label), REMOVE);
-
- if (f & SHOWMASK) {
- m_contextMnu -> insertItem(i18n("Add Mask"), ADDMASK);
- m_contextMnu -> insertItem(i18n("Remove Mask"), REMOVEMASK);
- }
-
- connect(m_contextMnu, SIGNAL(activated(int)),
- SLOT(slotMenuAction(int)));
- connect(m_contextMnu, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
- connect(mnu, SIGNAL(activated(int)), SLOT(slotMenuAction(int)));
- connect(m_lst, SIGNAL(contextMenuRequested(QListBoxItem *, const
- QPoint&)), SLOT(slotShowContextMenu(QListBoxItem*, const QPoint&)));
- connect(m_lst, SIGNAL(pressed(QListBoxItem*)),
- SLOT(slotSelectionChanged(QListBoxItem*)));
- connect(m_lst, SIGNAL(clicked(QListBoxItem *, const QPoint&)),
- SLOT(slotClicked(QListBoxItem*, const QPoint&)));
- connect(m_lst, SIGNAL(doubleClicked(QListBoxItem*)),
- SLOT(slotDoubleClicked(QListBoxItem*)));
- connect(m_lst, SIGNAL(returnPressed(QListBoxItem*)),
- SLOT(slotDoubleClicked(QListBoxItem*)));
- connect(btn, SIGNAL(clicked()), SLOT(slotAddClicked()));
- connect(m_btnRm, SIGNAL(clicked()), SLOT(slotRmClicked()));
- connect(m_btnRaise, SIGNAL(clicked()), SLOT(slotRaiseClicked()));
- connect(m_btnLower, SIGNAL(clicked()), SLOT(slotLowerClicked()));
-}
-
-KisLayerBox::~KisLayerBox()
-{
-}
-
-void KisLayerBox::slotMenuAction(int mnuId)
-{
- int n = m_lst -> currentItem();
- KisLayerBoxItem *p;
-
- if (n == -1 && mnuId != ADD) {
- setCurrentItem(n);
- return;
- }
-
- p = dynamic_cast<KisLayerBoxItem*>(m_lst -> item(n));
-
- switch (mnuId) {
- case VISIBLE:
- emit itemToggleVisible();
- break;
- case SELECTION:
- emit itemSelected(n);
- break;
- case LINKING:
- emit itemToggleLinked();
- break;
- case PROPERTIES:
- emit itemProperties();
- break;
- case ADD:
- emit itemAdd();
- break;
- case REMOVE:
- emit itemRemove();
- break;
- case ADDMASK:
- emit itemAddMask(n);
- break;
- case REMOVEMASK:
- emit itemRmMask(n);
- break;
- case RAISE:
- emit itemRaise();
- break;
- case LOWER:
- emit itemLower();
- break;
- case FRONT:
- emit itemFront();
- break;
- case BACK:
- emit itemBack();
- break;
- case LEVEL:
- emit itemLevel(n);
- break;
- }
-
- m_btnRm -> setEnabled(m_lst -> count());
- m_btnRaise -> setEnabled(m_lst -> selectedItem() && m_lst ->
- selectedItem() != m_lst -> item(0));
- m_btnLower -> setEnabled(m_lst -> selectedItem() && m_lst ->
- currentItem() != -1 && static_cast<uint>(m_lst -> currentItem()) != m_lst ->
- count() - 1);
- m_lst -> triggerUpdate(false);
-}
-
-void KisLayerBox::slotAboutToShow()
-{
- bool enabled = m_lst -> isSelected(m_lst -> currentItem());
-
- m_contextMnu -> setItemEnabled(VISIBLE, enabled);
- m_contextMnu -> setItemEnabled(SELECTION, enabled);
- m_contextMnu -> setItemEnabled(LEVEL, m_lst -> count() > 1);
- m_contextMnu -> setItemEnabled(LINKING, enabled);
- m_contextMnu -> setItemEnabled(PROPERTIES, enabled);
- m_contextMnu -> setItemEnabled(REMOVE, enabled);
- m_contextMnu -> setItemEnabled(ADDMASK, enabled);
- m_contextMnu -> setItemEnabled(REMOVEMASK, enabled);
- m_contextMnu -> setItemEnabled(RAISE, m_lst -> item(m_lst ->
- currentItem()) != m_lst -> firstItem());
- m_contextMnu -> setItemEnabled(LOWER, m_lst -> item(m_lst ->
- currentItem()) != m_lst -> item(m_lst -> count() - 1));
-}
-
-void KisLayerBox::slotShowContextMenu(QListBoxItem *item, const QPoint& pos)
-{
- m_lst -> setCurrentItem(item);
- m_contextMnu -> popup(pos);
- m_btnRm -> setEnabled(item != 0);
- m_btnRaise -> setEnabled(item && item != m_lst -> item(0));
- m_btnLower -> setEnabled(item != 0);
-}
-
-void KisLayerBox::slotSelectionChanged(QListBoxItem *item)
-{
- Q_INT32 n;
-
- if (item) {
- n = m_lst -> currentItem();
- slotMenuAction(SELECTION);
- m_btnLower -> setEnabled(item && static_cast<Q_UINT32>(n) !=
- m_lst -> count() - 1);
- } else {
- emit itemSelected(-1);
- }
-
- m_btnRm -> setEnabled(item != 0);
- m_btnRaise -> setEnabled(item && item != m_lst -> item(0));
-}
-
-void KisLayerBox::slotClicked(QListBoxItem *item, const QPoint& pos)
-{
- int n = m_lst -> currentItem();
-
- if (item) {
- KisLayerBoxItem *p = dynamic_cast<KisLayerBoxItem*>(item);
- int m = n - m_lst -> topItem();
-
- if (p -> intersectVisibleRect(pos, m))
- slotMenuAction(VISIBLE);
- else if (p -> intersectLinkedRect(pos, m))
- slotMenuAction(LINKING);
- }
-
- m_btnRm -> setEnabled(item != 0);
- m_btnRaise -> setEnabled(item && item != m_lst -> item(0));
- m_btnLower -> setEnabled(item && n != -1 && static_cast<uint>(n) !=
- m_lst -> count() - 1);
-}
-
-void KisLayerBox::slotDoubleClicked(QListBoxItem * /*item*/)
-{
- slotMenuAction(PROPERTIES);
-}
-
-void KisLayerBox::setCurrentItem(int n)
-{
- m_lst -> setSelected(n, true);
-}
-
-void KisLayerBox::setTopItem(int n)
-{
- m_lst -> setTopItem(n);
- m_lst -> triggerUpdate(false);
-}
-
-void KisLayerBox::insertItem(const QString& name, bool visible, bool linked)
-{
- KisLayerBoxItem *p = new KisLayerBoxItem(name, m_lst, m_flags);
-
- p -> setVisible(visible);
- p -> setLinked(linked);
- m_lst -> insertItem(p);
- m_lst -> setCurrentItem(p);
-}
-
-void KisLayerBox::clear()
-{
- m_lst -> clear();
-}
-
-void KisLayerBox::slotAddClicked()
-{
- slotMenuAction(ADD);
-}
-
-void KisLayerBox::slotRmClicked()
-{
- slotMenuAction(REMOVE);
-}
-
-void KisLayerBox::slotRaiseClicked()
-{
- slotMenuAction(RAISE);
-}
-
-void KisLayerBox::slotLowerClicked()
-{
- slotMenuAction(LOWER);
-}
-
-int KisLayerBox::getCurrentItem() const
-{
- QListBoxItem *p = 0;
- int n = 0;
-
- for (p = m_lst -> firstItem(); p; p = p -> next()) {
- if (p -> isSelected())
- return n;
-
- n++;
- }
-
- return -1;
-}
-
-void KisLayerBox::setSelected(int index)
-{
- m_lst -> setSelected(index, true);
- m_lst -> setCurrentItem(index);
-}
-
-KisLayerBoxItem::KisLayerBoxItem(const QString& label, QListBox *parent,
- KisLayerBox::flags f)
-{
- init(label, parent, f);
-}
-
-void KisLayerBoxItem::init(const QString& label, QListBox *parent,
- KisLayerBox::flags f)
-{
- KIconLoader il;
-
- m_label = label;
- m_visiblePix = loadPixmap("visible.png", il, 21);
- m_visibleRect = QRect(QPoint(3, (HEIGHT - 24) / 2), QSize(24,24));
- m_invisiblePix = loadPixmap("novisible.png", il, 21);
- m_linkedPix = loadPixmap("linked.png", il, 21);
- m_linkedRect = QRect(QPoint(30, (HEIGHT - 24) / 2), QSize(24,24));
- m_unlinkedPix = loadPixmap("unlinked.png", il, 21);
- m_previewRect = QRect(QPoint(57, (HEIGHT - 24) / 2), QSize(24,24));
- m_parent = parent;
- m_visible = true;
- m_linked = false;
- m_flags = f;
-}
-
-KisLayerBoxItem::~KisLayerBoxItem()
-{
-}
-
-int KisLayerBoxItem::height(const QListBox * /*lb*/) const
-{
- return HEIGHT;
-}
-
-int KisLayerBoxItem::width(const QListBox *lb) const
-{
- const QFont& font = lb -> font();
- QFontMetrics fm(font);
-
- m_size.setWidth(kMax(fm.maxWidth() * m_label.length(),
- static_cast<uint>(lb -> width())));
- return m_size.width();
-}
-
-int KisLayerBoxItem::height() const
-{
- return HEIGHT;
-}
-
-int KisLayerBoxItem::width() const
-{
- return m_parent ? m_parent -> width() : m_size.width();
-}
-
-void KisLayerBoxItem::paint(QPainter *gc)
-{
- QBrush br = isSelected() ? m_parent -> colorGroup().highlight() :
- QBrush::white;
- QPoint pt;
- QPixmap *pix;
-
- gc -> fillRect(0, 0, width(), height() - 1, br);
-
- m_parent -> style().drawPrimitive(QStyle::PE_Panel, gc, m_visibleRect,
- m_parent -> colorGroup());
- pt = QPoint(m_visibleRect.left() + 2, m_visibleRect.top() + 2);
- pix = m_visible ? &m_visiblePix : &m_invisiblePix;
- gc -> drawPixmap(pt, *pix, QRect(0, 0, m_visibleRect.width(),
- m_visibleRect.height()));
-
- m_parent -> style().drawPrimitive(QStyle::PE_Panel, gc, m_linkedRect,
- m_parent -> colorGroup());
- pt = QPoint(m_linkedRect.left() + 2, m_linkedRect.top() + 2);
- pix = m_linked ? &m_linkedPix : &m_unlinkedPix;
- gc -> drawPixmap(pt, *pix, QRect(0, 0, m_linkedRect.width(),
- m_linkedRect.height()));
-
- m_parent -> style().drawPrimitive(QStyle::PE_Panel, gc, m_previewRect,
- m_parent -> colorGroup());
- gc -> drawRect(0, 0, width() - 1, height() - 1);
- gc -> drawText(HEIGHT * 3 + 3 * 3, 20, m_label);
-}
-
-QPixmap KisLayerBoxItem::loadPixmap(const QString& filename, const KIconLoader&
- il, int size)
-{
- QPixmap pixmap = il.loadIcon(filename, KIcon::NoGroup, size);
-
- if (pixmap.isNull())
- KMessageBox::error(0, i18n("Can't find %1").arg(filename),
- i18n("Canvas"));
+#include <qvariant.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qimage.h>
+#include <qpixmap.h>
+
+#include "./kis_layerbox.ui.h"
+static const char* const img0_kis_layerbox[] = {
+"16 16 47 1",
+". c None",
+"n c #616161",
+"b c #626262",
+"s c #9f9f9f",
+"y c #a3a3a3",
+"x c #a6a6a6",
+"a c #aaaaaa",
+"# c #ababab",
+"B c #adadad",
+"k c #afafaf",
+"A c #b3b3b3",
+"r c #b5b5b5",
+"G c #b7b7b7",
+"w c #bababa",
+"F c #bcbcbc",
+"E c #bebebe",
+"K c #c1c1c1",
+"D c #c5c5c5",
+"O c #c7c7c7",
+"S c #c8c8c8",
+"Q c #cccccc",
+"J c #cecece",
+"q c #cfcfcf",
+"C c #d1d1d1",
+"N c #d3d3d3",
+"f c #d5d5d5",
+"M c #d7d7d7",
+"g c #d9d9d9",
+"j c #dadada",
+"v c #dedede",
+"m c #e0e0e0",
+"L c #e2e2e2",
+"p c #e4e4e4",
+"u c #e6e6e6",
+"z c #e8e8e8",
+"P c #e9e9e9",
+"e c #ececec",
+"I c #eeeeee",
+"i c #f1f1f1",
+"d c #f3f3f3",
+"l c #f4f4f4",
+"R c #f5f5f5",
+"h c #f9f9f9",
+"H c #fbfbfb",
+"o c #fcfcfc",
+"t c #fdfdfd",
+"c c #ffffff",
+"..##aaaaaab.....",
+"..acccdefgab....",
+"..accchijgakb...",
+"..accchlmgbnbn..",
+"..acccodpgqrsn..",
+"..acccthuvwxyb..",
+"..acccchzgABab..",
+"..acctleCDEFGn..",
+"..actHIvqJDKEn..",
+"..accdLvMNJODb..",
+"..acHPpmgMqQDb..",
+"..acRzpmgMCJSb..",
+"..acezpLvMCJOn..",
+"..aczuLmjMqJOb..",
+"..#hzzpmgMCJOb..",
+"..bbnbbbbnbnnb.."};
+
+static const char* const img1_kis_layerbox[] = {
+"16 16 63 1",
+"d c None",
+". c #696969",
+"8 c #6a6a6a",
+"m c #696969",
+"c c #6a6a6a",
+"# c #696969",
+"g c #6a6a6a",
+"3 c #696969",
+"b c #6a6a6a",
+"e c #696969",
+"l c #696969",
+"n c #6a6a6a",
+"a c #696969",
+"f c #6a6a6a",
+"r c #6e6e6e",
+"h c #6f6f6f",
+"5 c #747474",
+"S c #757575",
+"k c #777777",
+"C c #787878",
+"o c #7b7b7b",
+"6 c #919191",
+"y c #949494",
+"7 c #969696",
+"F c #999999",
+"q c #a3a3a3",
+"2 c #a6a6a6",
+"4 c #a7a7a7",
+"Y c #aaaaaa",
+"R c #ababab",
+"K c #acacac",
+"1 c #adadad",
+"0 c #aeaeae",
+"X c #afafaf",
+"W c #b0b0b0",
+"E c #b1b1b1",
+"x c #b2b2b2",
+"D c #b4b4b4",
+"w c #b5b5b5",
+"T c #b6b6b6",
+"V c #b7b7b7",
+"U c #b8b8b8",
+"z c #b9b9b9",
+"O c #bababa",
+"L c #bbbbbb",
+"N c #bcbcbc",
+"M c #bebebe",
+"G c #bfbfbf",
+"I c #c1c1c1",
+"B c #c2c2c2",
+"H c #c3c3c3",
+"A c #c5c5c5",
+"u c #c9c9c9",
+"t c #cfcfcf",
+"Q c #e5e5e5",
+"P c #e8e8e8",
+"J c #ebebeb",
+"Z c #ededed",
+"p c #eeeeee",
+"v c #f1f1f1",
+"j c #f2f2f2",
+"s c #fafafa",
+"i c #fcfcfc",
+".#aabcddddceaf#.",
+"ghijklmddcnopqr#",
+"fstuvklmclopwxya",
+"fzuABpCllopwDEFf",
+"bkGHIGJkopwDEKkb",
+"mlkLMNOPQwxERSnm",
+"dclkTzUVwxERSncd",
+"ddcnkxTwDWRSnmdd",
+"ddcloQDxEXYSnmdd",
+"dcnoZDxEX012Slcd",
+"mnoZwxERYKKY2Slc",
+"3oZwxWRSS4RYR2S3",
+"apwxERSnlS2YRYya",
+"fqxERSnmmn52RR6f",
+"#ryFklmddmnS76r#",
+"8#ff3cddddc3afg8"};
- return pixmap;
-}
-bool KisLayerBoxItem::intersectVisibleRect(const QPoint& pos, int yOffset) const
-{
- return intersectRect(m_visibleRect, pos, yOffset);
-}
-
-bool KisLayerBoxItem::intersectLinkedRect(const QPoint& pos, int yOffset) const
-{
- return intersectRect(m_linkedRect, pos, yOffset);
+/*
+ * Constructs a KisLayerBox as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+KisLayerBox::KisLayerBox( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl ),
+ image0( (const char **) img0_kis_layerbox ),
+ image1( (const char **) img1_kis_layerbox )
+{
+ if ( !name )
+ setName( "KisLayerBox" );
+ setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)2, \
0, 0, sizePolicy().hasHeightForWidth() ) ); + setAcceptDrops( FALSE );
+ KisLayerBoxLayout = new QVBoxLayout( this, 0, 6, "KisLayerBoxLayout");
+
+ m_lst = new QListView( this, "m_lst" );
+ m_lst->addColumn( tr2i18n( "Column 1" ) );
+ m_lst->setAcceptDrops( TRUE );
+ m_lst->setHScrollBarMode( QListView::AlwaysOff );
+ m_lst->setRootIsDecorated( FALSE );
+ m_lst->setResizeMode( QListView::LastColumn );
+ KisLayerBoxLayout->addWidget( m_lst );
+
+ layout12 = new QHBoxLayout( 0, 3, 6, "layout12");
+ QSpacerItem* spacer = new QSpacerItem( 398, 20, QSizePolicy::Expanding, \
QSizePolicy::Minimum ); + layout12->addItem( spacer );
+
+ pushButton7 = new QPushButton( this, "pushButton7" );
+ pushButton7->setPixmap( image0 );
+ layout12->addWidget( pushButton7 );
+
+ pushButton6 = new QPushButton( this, "pushButton6" );
+ pushButton6->setPixmap( image1 );
+ layout12->addWidget( pushButton6 );
+ KisLayerBoxLayout->addLayout( layout12 );
+ languageChange();
+ resize( QSize(560, 200).expandedTo(minimumSizeHint()) );
+ clearWState( WState_Polished );
+ init();
}
-bool KisLayerBoxItem::intersectPreviewRect(const QPoint& pos, int yOffset) const
+/*
+ * Destroys the object and frees any allocated resources
+ */
+KisLayerBox::~KisLayerBox()
{
- return intersectRect(m_previewRect, pos, yOffset);
+ // no need to delete child widgets, Qt does it all for us
}
-bool KisLayerBoxItem::intersectRect(const QRect& rc, const QPoint& pos, int yOffset) \
const +/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void KisLayerBox::languageChange()
{
- QRect global(rc.x(), rc.y() + height() * yOffset, rc.width(), rc.height());
+ setCaption( tr2i18n( "Form1" ) );
+ m_lst->header()->setLabel( 0, tr2i18n( "Column 1" ) );
+ m_lst->clear();
+ QListViewItem * item = new QListViewItem( m_lst, 0 );
+ item->setText( 0, tr2i18n( "New Item" ) );
- global = QRect(m_parent -> mapToGlobal(global.topLeft()), m_parent -> \
mapToGlobal(global.bottomRight()));
- return global.contains(pos);
+ pushButton7->setText( QString::null );
+ pushButton6->setText( QString::null );
}
#include "kis_layerbox.moc"
Index: ui/kis_layerbox.h
===================================================================
RCS file: /home/kde/koffice/krita/ui/kis_layerbox.h,v
retrieving revision 1.1
diff -u -3 -p -r1.1 kis_layerbox.h
--- ui/kis_layerbox.h 29 May 2004 21:53:25 -0000 1.1
+++ ui/kis_layerbox.h 29 Jun 2004 14:55:01 -0000
@@ -1,183 +1,59 @@
-/*
- * kis_layerbox.h - part of Krita aka Krayon aka KimageShop
- *
- * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
+/****************************************************************************
+** Form interface generated from reading ui file './kis_layerbox.ui'
+**
+** Created: Mon Jun 28 00:47:35 2004
+** by: The User Interface Compiler ($Id: qt/main.cpp 3.2.3 edited May 19 \
14:22 $) +**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
-#if !defined KIS_LAYERBOX_H
-#define KIS_LAYERBOX_H
+#ifndef KISLAYERBOX_H
+#define KISLAYERBOX_H
-#include <qframe.h>
+#include <qvariant.h>
#include <qpixmap.h>
-#include <qrect.h>
-#include <qsize.h>
-#include <qstring.h>
-
-#include <klistbox.h>
-
-class QButton;
-class QPainter;
-class QWidget;
-class KIconLoader;
-class KPopupMenu;
-
-class KisLayerBox : public QFrame {
- typedef QFrame super;
- Q_OBJECT
+#include <qwidget.h>
-public:
- enum action {VISIBLE, SELECTION, LINKING, PROPERTIES, ADD, REMOVE,
-ADDMASK, REMOVEMASK, RAISE, LOWER, FRONT, BACK, LEVEL};
- enum flags {SHOWVISIBLE = 1, SHOWLINKED = (1 << 1), SHOWPREVIEW = (1 <<
-2), SHOWMASK = (1 << 3), SHOWALL =
-(SHOWMASK|SHOWPREVIEW|SHOWLINKED|SHOWVISIBLE)};
-
- KisLayerBox(const QString& label, flags f = SHOWALL, QWidget *parent =
-0, const char *name = 0);
- virtual ~KisLayerBox();
-
- void insertItem(const QString& name, bool visible = true, bool linked =
-false);
- void setCurrentItem(int n);
- int getCurrentItem() const;
- void setTopItem(int n);
- void clear();
- void setSelected(int index);
-
-signals:
- void itemToggleVisible();
- void itemSelected(int n);
- void itemToggleLinked();
- void itemProperties();
- void itemAdd();
- void itemRemove();
- void itemAddMask(int n);
- void itemRmMask(int n);
- void itemRaise();
- void itemLower();
- void itemFront();
- void itemBack();
- void itemLevel(int n);
-
-private slots:
- void slotMenuAction(int mnuId);
- void slotAboutToShow();
- void slotShowContextMenu(QListBoxItem *item, const QPoint& pos);
- void slotClicked(QListBoxItem *item, const QPoint& pos);
- void slotSelectionChanged(QListBoxItem *item);
- void slotDoubleClicked(QListBoxItem* item);
- void slotAddClicked();
- void slotRmClicked();
- void slotRaiseClicked();
- void slotLowerClicked();
-
-private:
- flags m_flags;
- KListBox *m_lst;
- KPopupMenu *m_contextMnu;
- QButton *m_btnRm;
- QButton *m_btnRaise;
- QButton *m_btnLower;
-};
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QListView;
+class QListViewItem;
+class QPushButton;
-class KisLayerBoxItem : public QListBoxItem {
- typedef QListBoxItem super;
+class KisLayerBox : public QWidget
+{
+ Q_OBJECT
public:
- KisLayerBoxItem(const QString& label, QListBox *parent,
-KisLayerBox::flags f = KisLayerBox::SHOWALL);
- virtual ~KisLayerBoxItem();
-
- virtual int height(const QListBox *lb) const;
- virtual int width(const QListBox *lb) const;
- virtual int height() const;
- virtual int width() const;
- virtual void paint(QPainter *gc);
-
- bool visible();
- bool linked();
- void toggleVisible();
- void toggleLinked();
- void setVisible(bool v);
- void setLinked(bool v);
-
- bool intersectVisibleRect(const QPoint& pos, int yOffset) const;
- bool intersectLinkedRect(const QPoint& pos, int yOffset) const;
- bool intersectPreviewRect(const QPoint& pos, int yOffset) const;
-
-private:
- void init(const QString& label, QListBox *parent, KisLayerBox::flags f);
- QPixmap loadPixmap(const QString& filename, const KIconLoader& il, int
-size);
- bool intersectRect(const QRect& rc, const QPoint& pos, int yOffset)
-const;
+ KisLayerBox( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~KisLayerBox();
-private:
- mutable QSize m_size;
- QString m_label;
- QPixmap m_visiblePix;
- QPixmap m_invisiblePix;
- QPixmap m_linkedPix;
- QPixmap m_unlinkedPix;
- QPixmap m_preview;
- QRect m_visibleRect;
- QRect m_linkedRect;
- QRect m_previewRect;
- QWidget *m_parent;
- bool m_visible;
- bool m_linked;
- KisLayerBox::flags m_flags;
-};
+ QListView* m_lst;
+ QPushButton* pushButton7;
+ QPushButton* pushButton6;
+
+public slots:
+ virtual void clear();
+ virtual void insertItem( const QString & name, bool visible, bool linked );
+ virtual void slotSelectionChanged( QListViewItem * item );
-inline
-bool KisLayerBoxItem::visible()
-{
- return m_visible;
-}
-
-inline
-bool KisLayerBoxItem::linked()
-{
- return m_linked;
-}
+signals:
+ void itemSelected(int n);
-inline
-void KisLayerBoxItem::toggleVisible()
-{
- m_visible = !m_visible;
-}
+protected:
+ QVBoxLayout* KisLayerBoxLayout;
+ QHBoxLayout* layout12;
-inline
-void KisLayerBoxItem::toggleLinked()
-{
- m_linked = !m_linked;
-}
+protected slots:
+ virtual void languageChange();
-inline
-void KisLayerBoxItem::setVisible(bool v)
-{
- m_visible = v;
-}
+private:
+ QPixmap image0;
+ QPixmap image1;
-inline
-void KisLayerBoxItem::setLinked(bool v)
-{
- m_linked = v;
-}
+ void init();
-#endif // KIS_LAYERBOX_H
+};
+#endif // KISLAYERBOX_H
["kis_layerbox.ui" (application/x-designer)]
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic