View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0010295 | Scribus | Usability | public | 2011-10-02 12:10 | 2014-10-11 18:35 |
Reporter | cezaryece | Assigned To | cbradney | ||
Priority | normal | Severity | tweak | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.0svn | ||||
Fixed in Version | 1.5.0svn | ||||
Summary | 0010295: [PATCH] further enhacement of frame linking tool | ||||
Description | 0010116 was closed, but work does not finish. Here you have two patches. First finish 0010116 request - make possibility to create new frame if user click on empty page space with linking tool. Second create new Item menus commands to unlink selected text frame from text chain but with copy or cut its contents from text story. Specially cut text option is useful for me while I was working with that feature a bit. | ||||
Tags | No tags attached. | ||||
Attached Files | linkAFTERdraw.patch (2,186 bytes)
Index: scribus/scribusview.h =================================================================== --- scribus/scribusview.h (wersja 16859) +++ scribus/scribusview.h (kopia robocza) @@ -293,7 +293,12 @@ void PasteToPage(); void TextToPath(); void adjustCMS(); - + +//for linking frame after draw new frame +private: + bool linkAfterDraw; + PageItem * firstFrame; + private: // Private attributes int m_previousMode; QMenu *pmen3; Index: scribus/scribusview.cpp =================================================================== --- scribus/scribusview.cpp (wersja 16859) +++ scribus/scribusview.cpp (kopia robocza) @@ -79,6 +79,7 @@ #include "commonstrings.h" #include "filewatcher.h" #include "hyphenator.h" +#include "pageitem.h" #include "pageitem_imageframe.h" #include "pageitem_line.h" #include "pageitem_pathtext.h" @@ -161,7 +162,8 @@ m_groupTransactions(0), m_groupTransaction(NULL), _isGlobalMode(true), - m_vhRulerHW(17) + m_vhRulerHW(17), + linkAfterDraw(false) { setObjectName("s"); QPalette p=palette(); @@ -4196,12 +4198,36 @@ QMouseEvent* m = static_cast<QMouseEvent*> (event); m_canvasMode->mouseReleaseEvent(m); m_canvas->m_viewMode.m_MouseButtonPressed = false; + if (linkAfterDraw) + { + //user creates new frame using linking tool + PageItem * secondFrame = Doc->m_Selection->itemAt(0); + if (secondFrame && firstFrame) + { + firstFrame->link(secondFrame); + firstFrame = NULL; + } + linkAfterDraw = false; + } return true; } else if (obj == widget() && event->type() == QEvent::MouseButtonPress) { QMouseEvent* m = static_cast<QMouseEvent*> (event); + bool linkmode = (Doc->appMode == modeLinkFrames); + firstFrame = Doc->m_Selection->itemAt(0); m_canvasMode->mousePressEvent(m); + //if user dont click any frame he want to draw new frame and link it + bool requestDrawMode = (Doc->ElemToLink == NULL); + if (linkmode && requestDrawMode) + { + //switch to drawing new text frame + linkAfterDraw = true; + requestMode(modeDrawText); + m_canvasMode->mousePressEvent(m); + } + else + firstFrame = NULL; m_canvas->m_viewMode.m_MouseButtonPressed = true; return true; } unlinkWithText.patch (13,169 bytes)
Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (wersja 16859) +++ scribus/scribusdoc.cpp (kopia robocza) @@ -14267,4 +14267,33 @@ pp->setYOffset(scratch()->Top); } } +void ScribusDoc::itemSelection_UnlinkTextFrameWithText( Selection *customSelection, bool cutText) +{ + Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection; + assert(itemSelection!=0); + uint selectedItemCount=itemSelection->count(); + if (selectedItemCount == 0) + return; + if (selectedItemCount > 0) + { + for (uint i = 0; i < selectedItemCount; ++i) + { + PageItem *currItem = itemSelection->itemAt(i); + if (currItem!=NULL) + { + if (currItem->asTextFrame() && (currItem->nextInChain() != NULL || currItem->prevInChain() != NULL)) + currItem->unlinkWithText(cutText); + } + } + regionsChanged()->update(QRectF()); + changed(); + itemSelection->itemAt(0)->emitAllToGUI(); + } + +} + +void ScribusDoc::itemSelection_UnlinkTextFrameWithTextCut( Selection *customSelection) +{ + itemSelection_UnlinkTextFrameWithText(customSelection, true); +} Index: scribus/pageitem.h =================================================================== --- scribus/pageitem.h (wersja 16859) +++ scribus/pageitem.h (kopia robocza) @@ -540,6 +540,7 @@ void unlink(); void link(PageItem* nextFrame); void dropLinks(); + void unlinkWithText(bool); protected: PageItem *BackBox; Index: scribus/pageitem.cpp =================================================================== --- scribus/pageitem.cpp (wersja 16859) +++ scribus/pageitem.cpp (kopia robocza) @@ -1308,7 +1308,24 @@ BackBox = NextBox = NULL; } } +//unlink selected frame from text chain +//but copy or cut its content from itemText +void PageItem::unlinkWithText(bool cutText) +{ + // FIX ME - make this operation undoable + PageItem * Next = NextBox; + itemText.select(firstInFrame(),lastInFrame() - firstInFrame() +1); + StoryText content(m_Doc); + content.insert(0, itemText, true); + if (cutText) + itemText.removeSelection(); + dropLinks(); + itemText.append(content); + if (Next) + Next->update(); +} + /// tests if a character is displayed by this frame bool PageItem::frameDisplays(int textpos) const { Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (wersja 16859) +++ scribus/scribusdoc.h (kopia robocza) @@ -1025,7 +1025,6 @@ void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0); void itemSelection_SetCompressionMethod(int cmIndex, Selection* customSelection=0); void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0); - // void chAbStyle(PageItem *currItem, int s); @@ -1337,6 +1336,10 @@ void itemSelection_Rotate(double angle, Selection* customSelection = 0); void itemSelection_DoHyphenate(); void itemSelection_DoDeHyphenate(); + + void itemSelection_UnlinkTextFrameWithText(Selection *customSelection=0, bool cutText=false); + void itemSelection_UnlinkTextFrameWithTextCut(Selection *customSelection=0); + void itemSelection_SendToLayer(int layerID); void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0); void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0); Index: scribus/actionmanager.cpp =================================================================== --- scribus/actionmanager.cpp (wersja 16859) +++ scribus/actionmanager.cpp (kopia robocza) @@ -767,6 +767,10 @@ scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("16/color-picker.png"), loadIcon("22/color-picker.png"), "", defaultKey(name), mainWindow, modeEyeDropper)); name="toolsCopyProperties"; scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("wizard16.png"), loadIcon("wizard.png"), "", defaultKey(name), mainWindow, modeCopyProperties)); + name="toolsUnlinkTextFrameWithTextCopy"; + scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeUnlinkFrames)); + name="toolsUnlinkTextFrameWithTextCut"; + scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeUnlinkFrames)); //PDF toolbar name="toolsPDFPushButton"; @@ -816,7 +820,7 @@ *modeActionNames << "toolsSelect" << "toolsInsertTextFrame" << "toolsInsertImageFrame" << "toolsInsertTableFrame" << "toolsInsertTable"; *modeActionNames << "toolsInsertShape" << "toolsInsertPolygon" << "toolsInsertArc" << "toolsInsertSpiral" << "toolsInsertLine" << "toolsInsertBezier"; *modeActionNames << "toolsInsertFreehandLine" << "toolsInsertCalligraphicLine" << "toolsInsertRenderFrame" << "toolsRotate" << "toolsZoom" << "toolsEditContents"; - *modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame"; + *modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame" << "toolsUnlinkTextFrameWithTextCopy" << "toolsUnlinkTextFrameWithTextCut"; *modeActionNames << "toolsEyeDropper" << "toolsCopyProperties"; *modeActionNames << "toolsPDFPushButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink"; #ifdef HAVE_OSG @@ -1109,7 +1113,8 @@ disconnect( (*scrActions)["itemDelete"], 0, 0, 0); disconnect( (*scrActions)["extrasHyphenateText"], 0, 0, 0 ); disconnect( (*scrActions)["extrasDeHyphenateText"], 0, 0, 0 ); - + disconnect( (*scrActions)["toolsUnlinkTextFrameWithTextCopy"], 0, 0, 0 ); + disconnect( (*scrActions)["toolsUnlinkTextFrameWithTextCut"], 0, 0, 0 ); } void ActionManager::connectNewDocActions(ScribusDoc *currDoc) @@ -1141,6 +1146,8 @@ connect( (*scrActions)["tableAdjustTableToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustTableToFrame())); connect( (*scrActions)["itemAdjustFrameToImage"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrametoImageSize()) ); connect( (*scrActions)["itemAdjustImageToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustImagetoFrameSize()) ); + connect( (*scrActions)["toolsUnlinkTextFrameWithTextCopy"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameWithText()) ); + connect( (*scrActions)["toolsUnlinkTextFrameWithTextCut"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameWithTextCut()) ); } void ActionManager::disconnectNewViewActions() @@ -1533,6 +1540,8 @@ (*scrActions)["toolsEditWithStoryEditor"]->setText( tr("Edit Text...")); (*scrActions)["toolsLinkTextFrame"]->setTexts( tr("Link Text Frames")); (*scrActions)["toolsUnlinkTextFrame"]->setTexts( tr("Unlink Text Frames")); + (*scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setTexts( tr("Unlink Text Frame with Text Copy")); + (*scrActions)["toolsUnlinkTextFrameWithTextCut"]->setTexts( tr("Unlink Text Frame with Text Cut")); (*scrActions)["toolsEyeDropper"]->setTexts( tr("&Eye Dropper")); (*scrActions)["toolsCopyProperties"]->setTexts( tr("Copy Item Properties")); @@ -2163,6 +2172,8 @@ itnmenua->second << "toolsEditContents"; itnmenua->second << "toolsLinkTextFrame"; itnmenua->second << "toolsUnlinkTextFrame"; + itnmenua->second << "toolsUnlinkTextFrameWithTextCopy"; + itnmenua->second << "toolsUnlinkTextFrameWithTextCut"; itnmenua->second << "toolsEyeDropper"; itnmenua->second << "toolsCopyProperties"; itnmenua->second << "toolsPDFPushButton"; Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (wersja 16859) +++ scribus/scribus.cpp (kopia robocza) @@ -819,6 +819,8 @@ scrMenuMgr->addMenuSeparator("Item"); scrMenuMgr->addMenuItem(scrActions["toolsLinkTextFrame"], "Item", false); scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrame"], "Item", false); + scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCopy"], "Item", false); + scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCut"], "Item", false); scrMenuMgr->addMenuSeparator("Item"); scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item", false); scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item", false); @@ -2722,6 +2724,8 @@ scrActions["toolsUnlinkTextFrame"]->setEnabled(false); scrActions["toolsLinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); scrActions["toolsEditContents"]->setEnabled(false); scrActions["toolsEditWithStoryEditor"]->setEnabled(false); scrActions["toolsRotate"]->setEnabled(false); @@ -2773,6 +2777,8 @@ scrActions["itemConvertToTextFrame"]->setEnabled(doc->appMode != modeEdit); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); scrActions["toolsLinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); scrActions["toolsEditContents"]->setEnabled(currItem->ScaleType); scrActions["toolsEditWithStoryEditor"]->setEnabled(false); scrActions["toolsRotate"]->setEnabled(true); @@ -2838,6 +2844,8 @@ scrActions["itemConvertToPolygon"]->setEnabled(false); scrActions["itemConvertToTextFrame"]->setEnabled(false); scrActions["toolsUnlinkTextFrame"]->setEnabled(true); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true); // FIXME: once there's one itemtext per story, always enable editcontents if ((currItem->prevInChain() != 0) && (currItem->itemText.length() == 0)) scrActions["toolsEditContents"]->setEnabled(false); @@ -2848,6 +2856,8 @@ { scrActions["toolsEditContents"]->setEnabled(true); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); } if (currItem->nextInChain() == 0) scrActions["toolsLinkTextFrame"]->setEnabled(true); @@ -2928,6 +2938,8 @@ scrActions["toolsEditWithStoryEditor"]->setEnabled(true); scrActions["toolsLinkTextFrame"]->setEnabled(false); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); if (doc->appMode == modeEdit) setTBvals(currItem); else @@ -3020,6 +3032,8 @@ scrActions["toolsEditContents"]->setEnabled(false); scrActions["toolsEditWithStoryEditor"]->setEnabled(false); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); scrActions["toolsLinkTextFrame"]->setEnabled(false); // if (SelectedType != 5) scrActions["toolsRotate"]->setEnabled(true); @@ -4635,6 +4649,8 @@ scrActions["toolsInsertRenderFrame"]->setEnabled(false); scrActions["toolsLinkTextFrame"]->setEnabled(false); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); scrActions["toolsMeasurements"]->setEnabled(false); scrActions["toolsCopyProperties"]->setEnabled(false); scrActions["toolsEyeDropper"]->setEnabled(false); @@ -6154,6 +6170,8 @@ scrActions["toolsInsertRenderFrame"]->setEnabled(false); scrActions["toolsLinkTextFrame"]->setEnabled(false); scrActions["toolsUnlinkTextFrame"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false); scrActions["toolsMeasurements"]->setEnabled(false); scrActions["toolsCopyProperties"]->setEnabled(false); scrActions["toolsEyeDropper"]->setEnabled(false); @@ -6252,6 +6270,8 @@ scrActions["toolsCopyProperties"]->setEnabled(true); scrActions["toolsEyeDropper"]->setEnabled(true); scrActions["toolsUnlinkTextFrame"]->setEnabled(true); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true); scrActions["itemDelete"]->setEnabled(true); scrActions["itemShapeEdit"]->setChecked(false); layerPalette->setEnabled(true); @@ -6338,6 +6358,8 @@ scrActions["toolsEditWithStoryEditor"]->setChecked(mode==modeStoryEditor); scrActions["toolsLinkTextFrame"]->setChecked(mode==modeLinkFrames); scrActions["toolsUnlinkTextFrame"]->setChecked(mode==modeUnlinkFrames); + scrActions["toolsUnlinkTextFrameWithTextCopy"]->setChecked(mode==modeUnlinkFrames); + scrActions["toolsUnlinkTextFrameWithTextCut"]->setChecked(mode==modeUnlinkFrames); scrActions["toolsEyeDropper"]->setChecked(mode==modeEyeDropper); scrActions["toolsMeasurements"]->setChecked(mode==modeMeasurementTool); scrActions["toolsCopyProperties"]->setChecked(mode==modeCopyProperties); | ||||
Patch | |||||
|
- automatic creating a frame with the link tool: yeah! - unlink with cut: well... yes, can be useful - unlink with copy: does anybody have a use case for it? |
|
is there any reason why this patch has not been accepted? at least the two first features are useful to very useful... is there anything i can do to improve it and make it fit for being integrated into trunk (beside renaming the menu entries...) |
|
First patch committed |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-10-02 12:10 | cezaryece | New Issue | |
2011-10-02 12:10 | cezaryece | File Added: linkAFTERdraw.patch | |
2011-10-02 12:10 | cezaryece | File Added: unlinkWithText.patch | |
2011-10-02 12:10 | cezaryece | Tag Attached: oif2011 | |
2011-10-02 20:48 | ale | Note Added: 0026947 | |
2011-10-25 06:12 | cezaryece | Tag Attached: oif 2011 | |
2012-05-23 06:25 | ale | Note Added: 0028022 | |
2012-05-27 21:32 | cbradney | Note Added: 0028038 | |
2012-06-14 20:55 | cbradney | Status | new => resolved |
2012-06-14 20:55 | cbradney | Fixed in Version | => 1.5.0svn |
2012-06-14 20:55 | cbradney | Resolution | open => fixed |
2012-06-14 20:55 | cbradney | Assigned To | => cbradney |
2012-06-18 05:59 | ale | Relationship added | related to 0007999 |
2012-06-19 18:32 | cbradney | Status | resolved => closed |
2014-10-08 22:59 | Kunda | Tag Detached: oif 2011 | |
2014-10-11 18:35 | Kunda | Tag Detached: oif2011 |