View Issue Details

IDProjectCategoryView StatusLast Update
0010864ScribusStory Editor / Text Framespublic2012-08-02 19:49
Reportercezaryece Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0010864: [PATCH] linking inside frames chain
DescriptionAttached patch make possible to insert empty text frame in the middle of frames chain. If you click some frame in chain with linking tool then dialog will appear with question if selected frame has to be inserted in chain before or after clicked frame.
TagsNo tags attached.
Patch

Activities

cezaryece

2012-07-10 10:32

updater  

linkInsideChain.diff (2,930 bytes)   
diff --git a/Scribus/scribus/canvasmode_framelinks.cpp b/Scribus/scribus/canvasmode_framelinks.cpp
index d44bba0..d982954 100644
--- a/Scribus/scribus/canvasmode_framelinks.cpp
+++ b/Scribus/scribus/canvasmode_framelinks.cpp
@@ -189,8 +189,43 @@ void CanvasMode_FrameLinks::mousePressEvent(QMouseEvent *m)
 				while (bblast->nextInChain())
 					bblast = bblast->nextInChain();
 				
-				if (currItem->nextInChain() == 0 && bb->prevInChain() == 0 && currItem != bblast)
+				if (currItem->nextInChain() == NULL && currItem != bblast) //possibility to insert empty frames into chain
 				{
+					if (bb->prevInChain() != NULL)
+					{
+						QMessageBox msgBox;
+						QPushButton *beforeButton = msgBox.addButton(tr("Before"), QMessageBox::AcceptRole);
+						QPushButton *afterButton = msgBox.addButton(tr("After"), QMessageBox::AcceptRole);
+						QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel);
+						msgBox.setIcon(QMessageBox::Question);
+						msgBox.setWindowTitle(ScribusView::tr("Linking Text Frames"));
+						msgBox.setText( "<qt>" + ScribusView::tr("You want to insert frame into text chain. Where you want to insert it?") + "<qt>");
+						msgBox.exec();
+						if ((QPushButton *) msgBox.clickedButton() == abortButton)
+							break;
+						if ((QPushButton *) msgBox.clickedButton() == beforeButton)
+						{
+							PageItem * prev = bb->prevInChain();
+							prev->unlink();
+							prev->link(currItem);
+						}
+						else if ((QPushButton *) msgBox.clickedButton() == afterButton)
+						{
+							if (bb->nextInChain() != NULL)
+							{
+								PageItem * next = bb->nextInChain();
+								bb->unlink();
+								bb->link(currItem);
+								bb = next;
+							}
+							else
+							{ // link at end of last frame in chain - switch currItem <-> bb
+								PageItem* tmp = currItem;
+								currItem = bb;
+								bb = tmp;
+							}
+						}
+					}
 					currItem->link(bb);
 					int cid = m_doc->Items->indexOf(currItem);
 					int bid = m_doc->Items->indexOf(bb);
@@ -203,7 +238,10 @@ void CanvasMode_FrameLinks::mousePressEvent(QMouseEvent *m)
 					}
 					// m_view->updateContents();
 					// link calls PageItem::update	
-					// emit DocChanged();
+					//ECE no, link() not force update
+					currItem->update();
+					m_view->DrawNew();
+					//emit DocChanged();
 					m_doc->ElemToLink = bb;
 				}
 				else if (currItem == bblast)
@@ -218,7 +256,7 @@ void CanvasMode_FrameLinks::mousePressEvent(QMouseEvent *m)
 					//CB Mouse is released when this messagebox takes focus
 					m_canvas->m_viewMode.m_MouseButtonPressed = false;
 					QMessageBox::warning(m_view, ScribusView::tr("Linking Text Frames"),
-										 "<qt>" + ScribusView::tr("You are trying to link a frame which is already linked.") + "</qt>");
+										 "<qt>" + ScribusView::tr("You are trying to link a non-empty frame to frame which is already linked.") + "</qt>");
 				}
 			}
 			else
linkInsideChain.diff (2,930 bytes)   

cezaryece

2012-07-10 10:39

updater   ~0028414

Reminder sent to: cbradney

for review and commit

cbradney

2012-07-11 20:34

administrator   ~0028424

Applied a slightly modified version, although I am not happy with the buttons appearing in the order of After/Cancel/Before.

ale

2012-07-12 11:53

manager   ~0028426

nice productivity hack! i would have needed during one of my presentations at rmll.

i just wonder if we can't do it without the dialog...

just add the frame after (or before... we have to choose one of both; the most likely for the user) which you can undo (or unlinking / deleting of the frame if somebody doesn't think of the undo).

cezaryece

2012-07-12 13:16

updater   ~0028427

For me "add before" is better choice as with "add after" there may occur some misleading with adding frame as first to chain. With "add after" we will have situation when frame will be add after each frame but not for first in chain where it should be add before (maybe I am wrong?).
With "add before" adding as last will be as usual by linking from last frame to new, vice versa add new before last.

Better would be if user can drag chain arrow to new frame, but I think it can be difficult to achieving (at least for me).

ale

2012-07-12 19:35

manager   ~0028428

yep, add before the one you clicked on is imo the way to go

Issue History

Date Modified Username Field Change
2012-07-10 10:32 cezaryece New Issue
2012-07-10 10:32 cezaryece File Added: linkInsideChain.diff
2012-07-10 10:39 cezaryece Note Added: 0028414
2012-07-11 20:21 cbradney Assigned To => cbradney
2012-07-11 20:21 cbradney Status new => assigned
2012-07-11 20:34 cbradney Note Added: 0028424
2012-07-11 20:34 cbradney Status assigned => resolved
2012-07-11 20:34 cbradney Fixed in Version => 1.5.0svn
2012-07-11 20:34 cbradney Resolution open => fixed
2012-07-12 11:53 ale Note Added: 0028426
2012-07-12 13:16 cezaryece Note Added: 0028427
2012-07-12 19:35 ale Note Added: 0028428
2012-08-02 19:49 cbradney Status resolved => closed
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames