View Issue Details

IDProjectCategoryView StatusLast Update
0011526ScribusGraphics / Image Framespublic2015-10-25 13:58
ReporterJLuc Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.0svn 
Target Version1.5.1Fixed in Version1.5.1svn 
Summary0011526: DELETE key in "Edit Image" mode should empty image frame
DescriptionAs for now, DELETE key (SUPPR) does nothing when edit image mode is ON.
Steps To ReproduceCreate an image frame and insert an image in it
Select it, double click in frame so as to enter "Edit Image" mode : you can move the image around,
ie behaviour is as if "the image itself is selected", not the frame.
In such a mode, pressing DELETE key should empty the image frame.
Additional InformationSame on 1.4 and 1.5
TagsHOST-Oman
PatchYes

Relationships

related to 0011568 closedcbradney DELETE key in "Outline" palette should delete selected element 
related to 0012428 closedcbradney DELETE key on selected pattern should delete it 
has duplicate 0011334 closedjghali Enable emptying image frame 

Activities

sarathms

2013-06-06 02:31

reporter  

git-trunk-11526.patch (1,029 bytes)   
diff --git Scribus/scribus/pageitem_imageframe.cpp Scribus/scribus/pageitem_imageframe.cpp
index 9f57ef6..7c1ed12 100644
--- Scribus/scribus/pageitem_imageframe.cpp
+++ Scribus/scribus/pageitem_imageframe.cpp
@@ -241,8 +241,8 @@ void PageItem_ImageFrame::clearContents()
 	setImageFlippedH(false);
 	setImageFlippedV(false);
 	EmProfile = "";
-	ScaleType = true;
-	AspectRatio = false;
+	ScaleType = false;			// So that next image fits in the frame
+	AspectRatio = true;			// and keeps aspect ratio, at import.
 	setFillTransparency(0.0);
 	setLineTransparency(0.0);
 	imageClip.resize(0);
@@ -271,7 +271,12 @@ void PageItem_ImageFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
 		resizingImage=true;
 	double dX=0.0,dY=0.0;
 	int kk = k->key();
-	if (!resizingImage)
+	if (kk == Qt::Key_Delete)		// Delete in edit mode, to empty the frame
+	{
+		clearContents();
+		update();
+	}
+	else if (!resizingImage)
 	{
 		moveBy/=m_Doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
 		switch (kk)
git-trunk-11526.patch (1,029 bytes)   

jghali

2013-06-07 06:59

administrator   ~0030246

The patch is incomplete : edit mode should be exited after emptying image frame.

JLuc

2013-06-10 10:03

developer   ~0030266

Note (beside the DEL action in edit mode) :

WHEN NOT IN EDIT MODE, the CTRL+SHIFT+C enables to copy the CONTENT of the frame (that can be accessed too through the Right click > Content > Copy right-clic context menu).
Hence, the CTRL+SHIFT+DEL would provide in an efficient and affordant way for this "image frame content delete" action (that is also available through the Right click > Content > Delete right-clic context menu).

JLuc

2014-09-05 07:52

developer   ~0033515

Last edited: 2015-01-01 20:53

OK now : when not in edit mode, CTRL+SHIFT+DEL does delete the content OK,
But ATM, when in edit mode, DEL still does nothing.
[edit:] and CTRL+SHIFT+DEL does nothing also.

Mazoon

2015-10-20 08:18

reporter   ~0036721

Last edited: 2015-10-20 11:58

patch file was uploaded to fix:
when in EDIT MODE,pressing DEL, CTRL+SHIFT+DEL or Backspace, should empty image
plus, edit mode should be exited after emptying image frame

Mazoon

2015-10-20 11:56

reporter  

issue0011526.patch (1,824 bytes)   
Index: scribus/pageitem_imageframe.cpp
===================================================================
--- scribus/pageitem_imageframe.cpp	(revision 20473)
+++ scribus/pageitem_imageframe.cpp	(working copy)
@@ -41,6 +41,7 @@
 #include "scribusstructs.h"
 #include "scribuscore.h"
 #include "scribusdoc.h"
+#include "scribusview.h"
 #include "commonstrings.h"
 #include "undomanager.h"
 #include "undostate.h"
@@ -48,11 +49,14 @@
 #include "util_formats.h"
 #include "util_color.h"
 
+#include "appmodes.h"
+
 #include "util.h"
 
 
 PageItem_ImageFrame::PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
 	: PageItem(pa, PageItem::ImageFrame, x, y, w, h, w2, fill, outline)
+	, m_vw(pa->view())  // to access requestMode function
 {
 }
 
@@ -271,8 +275,14 @@
 		resizingImage=true;
 	double dX=0.0,dY=0.0;
 	int kk = k->key();
-	if (!resizingImage)
+	if (kk == Qt::Key_Delete || kk == Qt::Key_Backspace || (shiftDown && controlDown && kk == Qt::Key_Delete) )	// Delete in edit mode, to empty the frame
 	{
+		clearContents();
+		m_vw->requestMode(modeNormal);
+		update();
+	}
+	else if (!resizingImage)
+	{
 		moveBy/=m_Doc->unitRatio();//Lets allow movement by the current doc ratio, not only points
 		switch (kk)
 		{
Index: scribus/pageitem_imageframe.h
===================================================================
--- scribus/pageitem_imageframe.h	(revision 20473)
+++ scribus/pageitem_imageframe.h	(working copy)
@@ -30,10 +30,12 @@
 #include "pageitem.h"
 class ScPainter;
 class ScribusDoc;
+class ScribusView;
 
 class SCRIBUS_API PageItem_ImageFrame : public PageItem
 {
 	Q_OBJECT
+	ScribusView *m_vw;
 
 public:
 	PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline);
issue0011526.patch (1,824 bytes)   

Kunda

2015-10-20 13:05

updater   ~0036734

Thanks for the patch, Mazoon.
Lets see what the devs say.
Cheers!

jghali

2015-10-20 19:32

administrator   ~0036743

Thanks Mazoon! I applied a slightly modified version of your patch.

Kunda

2015-10-20 22:23

updater   ~0036751

Works!
Thanks Mazoon, jghali, and jluc.
Jghali revised and committed mazoon's inspired patch in r20478

Issue History

Date Modified Username Field Change
2013-05-09 10:18 JLuc New Issue
2013-05-20 06:04 christoph_s Status new => acknowledged
2013-06-06 02:31 sarathms File Added: git-trunk-11526.patch
2013-06-06 06:38 christoph_s Assigned To => jghali
2013-06-06 06:38 christoph_s Status acknowledged => assigned
2013-06-07 06:59 jghali Note Added: 0030246
2013-06-09 17:12 jghali Relationship added has duplicate 0011334
2013-06-10 10:03 JLuc Note Added: 0030266
2014-08-29 12:20 Kunda Relationship added related to 0011568
2014-08-29 12:20 Kunda Relationship added related to 0012428
2014-08-29 21:39 Kunda Target Version => 1.5.1
2014-09-05 07:52 JLuc Note Added: 0033515
2015-01-01 20:53 JLuc Note Edited: 0033515
2015-09-17 20:10 Kunda Category Graphics / Image Frames => Graphics/Img Frames
2015-09-17 20:11 Kunda Category Graphics/Img Frames => Graphics / Image Frames
2015-10-20 08:18 Mazoon Note Added: 0036721
2015-10-20 11:56 Mazoon File Added: issue0011526.patch
2015-10-20 11:58 Mazoon Note Edited: 0036721
2015-10-20 13:05 Kunda Note Added: 0036734
2015-10-20 16:26 Kunda Patch => Yes
2015-10-20 19:32 jghali Note Added: 0036743
2015-10-20 19:32 jghali Status assigned => resolved
2015-10-20 19:32 jghali Fixed in Version => 1.5.1svn
2015-10-20 19:32 jghali Resolution open => fixed
2015-10-20 22:23 Kunda Note Added: 0036751
2015-10-20 22:23 Kunda Status resolved => closed
2015-10-25 13:58 user5122 Tag Attached: HOST-Oman