[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdegraphics/kolourpaint
From: Clarence Dang <dang () kde ! org>
Date: 2007-10-07 2:03:42
Message-ID: 1191722622.974144.18745.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 722256 by dang:
* Make "Edit / Paste in New Window" always paste white pixels as white
(it used to paste them as transparent when the selection transparency
mode was set to Transparent)
M +4 -0 NEWS
M +42 -0 kpmainwindow_edit.cpp
--- branches/KDE/3.5/kdegraphics/kolourpaint/NEWS #722255:722256
@@ -8,6 +8,10 @@
when the app does not support pasting transparent pixels (such as
OpenOffice.org)
+ * Make "Edit / Paste in New Window" always paste white pixels as white
+ (it used to paste them as transparent when the selection transparency
+ mode was set to Transparent)
+
* Add error dialogs for:
- if scanning support is unavailable
- running out of graphics memory during a scan
--- branches/KDE/3.5/kdegraphics/kolourpaint/kpmainwindow_edit.cpp #722255:722256
@@ -48,6 +48,7 @@
#include <kppixmapfx.h>
#include <kpselection.h>
#include <kpselectiondrag.h>
+#include <kpselectiontransparency.h>
#include <kptool.h>
#include <kptoolcrop.h>
#include <kptoolresizescale.h>
@@ -345,6 +346,11 @@
// private
void kpMainWindow::paste (const kpSelection &sel, bool forceTopLeft)
{
+#if DEBUG_KP_MAIN_WINDOW && 1
+ kdDebug () << "kpMainWindow::paste(forceTopLeft=" << forceTopLeft << ")"
+ << endl;
+#endif
+
if (!sel.pixmap ())
{
kdError () << "kpMainWindow::paste() with sel without pixmap" << endl;
@@ -386,6 +392,13 @@
this));
+#if DEBUG_KP_MAIN_WINDOW && 1
+ kdDebug () << "sel.size=" << QSize (sel.width (), sel.height ())
+ << " document.size="
+ << QSize (m_document->width (), m_document->height ())
+ << endl;
+#endif
+
// If the selection is bigger than the document, automatically
// resize the document (with the option of Undo'ing) to fit
// the selection.
@@ -677,10 +690,39 @@
tool ()->endShapeInternal ();
+ //
+ // Pasting must ensure that:
+ //
+ // Requirement 1. the document is the same size as the image to be pasted.
+ // Requirement 2. transparent pixels in the image must remain as transparent.
+ //
+
kpMainWindow *win = new kpMainWindow (0/*no document*/);
win->show ();
+ // Make "Edit / Paste in New Window" always paste white pixels as white.
+ // Don't let selection transparency get in the way and paste them as
+ // transparent.
+ kpSelectionTransparency transparency = win->selectionTransparency ();
+ if (transparency.isTransparent ())
+ {
+ #if DEBUG_KP_MAIN_WINDOW && 1
+ kdDebug () << "\tchanging selection transparency to opaque" << endl;
+ #endif
+ transparency.setOpaque ();
+ // Since we are setting selection transparency programmatically
+ // -- as opposed to in response to user input -- this will not
+ // affect the selection transparency tool option widget's "last used"
+ // config setting.
+ win->setSelectionTransparency (transparency);
+ }
+
+ // (this handles Requirement 1. above)
win->slotPaste ();
+
+ // (this handles Requirement 2. above;
+ // slotDeselect() is not enough unless the document is filled with the
+ // transparent color in advance)
win->slotCrop ();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic