View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007999 | Scribus | Story Editor / Text Frames | public | 2009-05-01 16:13 | 2012-06-19 18:32 |
Reporter | mecirt | Assigned To | ale | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x86-64 | OS | linux | OS Version | opensuse 11 |
Product Version | 1.3.5svn | ||||
Target Version | 1.5.0 | Fixed in Version | 1.5.0svn | ||
Summary | 0007999: Text autoflow (patch implementing the feature attached) | ||||
Description | This is not a bug report/fix, but an implementation of a text autoflow feature. In particular, this does two things: When using the frame linking tool and choosing an empty area instead of the target frame, it generates a new frame on that page and links the selected frame with it. This allows to easily expand text onto new pages. When doing the same thing as above, but holding Shift while clicking, it creates the frame as above, and then it keeps going, creating more frames on subsequent pages until all the text fits in. If there aren't enough pages in the document, it automatically creates new pages as well. This feature is important when type3setting books, so I hope that it can be included. It mimics a similar feature from other DTP applications. It also most likely obsoletes the "Automatic Text Frames" option when creating documents - it can do the same thing, but offers greater flexibility (can have multiple text chains, chains can start on a page other than 1, etc). | ||||
Tags | No tags attached. | ||||
Patch | |||||
2009-05-01 16:13
|
scribus-autoflow.patch (7,485 bytes)
Index: scribus/pageitem.cpp =================================================================== --- scribus/pageitem.cpp (revision 13437) +++ scribus/pageitem.cpp (working copy) @@ -741,6 +741,9 @@ assert (ff != this); } itemText.append(nxt->itemText); + // set the new item's text - this must be done before actually linking, + // otherwise we get unneeded layout invalidation calls + nxt->itemText = itemText; NextBox = nxt; nxt->BackBox = this; // update AutoText Index: scribus/canvasmode_framelinks.cpp =================================================================== --- scribus/canvasmode_framelinks.cpp (revision 13437) +++ scribus/canvasmode_framelinks.cpp (working copy) @@ -151,7 +151,7 @@ double Rxp = 0; double Ryp = 0; - PageItem *currItem, *bb; + PageItem *currItem, *bb = 0; m_canvas->PaintSizeRect(QRect()); m_canvas->m_viewMode.m_MouseButtonPressed = true; m_canvas->m_viewMode.operItemMoving = false; @@ -178,14 +178,25 @@ } switch (m_doc->appMode) { - case modeLinkFrames: + case modeLinkFrames: { if (m->button() != Qt::LeftButton) break; currItem = m_doc->ElemToLink; if (currItem==NULL) break; SeleItem(m); - if (GetItem(&bb) && (bb->asTextFrame())) + GetItem(&bb); + int autoFlowFrom = 0; + if (!bb) { + // clicked outside any object - create a new textframe on this page + int page, frame = -1; + page = m_doc->OnPage(Mxp, Myp); + if (page != -1) frame = m_doc->addFullTextFrame (page); + if (frame != -1) bb = m_doc->Items->at (frame); + // shift+click on empty space = auto-flow + if (m->modifiers() & Qt::ShiftModifier) autoFlowFrom = page; + } + if (bb && bb->asTextFrame()) { PageItem* bblast = bb; while (bblast->nextInChain()) @@ -202,6 +213,31 @@ bb = m_doc->Items->takeAt(bb->ItemNr); m_doc->renumberItemsInListOrder(); } + if (autoFlowFrom) { + bb->layout (); // relayout the new frame right now + // autoflow the text, creating new pages as needed + int lastChar = currItem->itemText.length()-1; + int lastShown = bb->lastInFrame(); + int page = autoFlowFrom; + while (lastShown < lastChar) { + // go to next page, creating it if needed + ++page; + if (page >= m_doc->DocPages.size()) { + m_doc->addPage (page, CommonStrings::masterPageNormal, true); + m_doc->view()->addPage (page, false); + } + + int frame = m_doc->addFullTextFrame (page); + if (frame == -1) break; + PageItem *bb2 = m_doc->Items->at (frame); + bb->link(bb2); + bb = bb2; + bb->layout(); + int last = bb->lastInFrame(); + if (last == lastShown) break; // frame added no new content - bail out to prevent infinite looping + lastShown = last; + } + } // m_view->updateContents(); // link calls PageItem::update // emit DocChanged(); @@ -224,7 +260,7 @@ } else m_doc->ElemToLink = NULL; - break; + } break; case modeUnlinkFrames: if (m->button() != Qt::LeftButton) break; Index: scribus/text/storytext.cpp =================================================================== --- scribus/text/storytext.cpp (revision 13437) +++ scribus/text/storytext.cpp (working copy) @@ -195,6 +195,7 @@ int otherStart = onlySelection? other.startOfSelection() : 0; int otherEnd = onlySelection? other.endOfSelection() : other.length(); + if (otherStart >= otherEnd) return; // nothing to do int cstyleStart = otherStart; for (int i=otherStart; i < otherEnd; ++i) { if (other.charStyle(i) == cstyle Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (revision 13437) +++ scribus/scribusdoc.cpp (working copy) @@ -1876,29 +1876,33 @@ int ScribusDoc::addAutomaticTextFrame(const int pageNumber) { - if (!automaticTextFrames) + if (masterPageMode() || (!automaticTextFrames)) return -1; + int z = addFullTextFrame (pageNumber); + if (z < 0) return z; + if (LastAuto != 0) { + LastAuto->link(Items->at(z)); + } + else + FirstAuto = Items->at(z); + LastAuto = Items->at(z); + return z; +} + +int ScribusDoc::addFullTextFrame(const int pageNumber) +{ Page *addToPage=DocPages.at(pageNumber); - if ((!masterPageMode()) && (usesAutomaticTextFrames()))// && (!isLoading())) - { - int z = itemAdd(PageItem::TextFrame, PageItem::Unspecified, - addToPage->Margins.Left+addToPage->xOffset(), - addToPage->Margins.Top+addToPage->yOffset(), pageWidth-addToPage->Margins.Right-addToPage->Margins.Left, - pageHeight-addToPage->Margins.Bottom-addToPage->Margins.Top, - 1, CommonStrings::None, toolSettings.dPen, true); - Items->at(z)->isAutoText = true; - Items->at(z)->Cols = qRound(PageSp); - Items->at(z)->ColGap = PageSpa; - if (LastAuto != 0) { - LastAuto->link(Items->at(z)); - } - else - FirstAuto = Items->at(z); - LastAuto = Items->at(z); - Items->at(z)->setRedrawBounding(); - return z; - } - return -1; + if (!addToPage) return -1; + if (masterPageMode()) return -1; + int z = itemAdd(PageItem::TextFrame, PageItem::Unspecified, + addToPage->Margins.Left+addToPage->xOffset(), + addToPage->Margins.Top+addToPage->yOffset(), pageWidth-addToPage->Margins.Right-addToPage->Margins.Left, + pageHeight-addToPage->Margins.Bottom-addToPage->Margins.Top, + 1, CommonStrings::None, toolSettings.dPen, true); + Items->at(z)->Cols = qRound(PageSp); + Items->at(z)->ColGap = PageSpa; + Items->at(z)->setRedrawBounding(); + return z; } Index: scribus/canvasmode_edit.cpp =================================================================== --- scribus/canvasmode_edit.cpp (revision 13437) +++ scribus/canvasmode_edit.cpp (working copy) @@ -961,25 +961,29 @@ else if (resizeGesture->frameHandle() < 0) { m_view->Deselect(true); + bool wantNormal = true; if (SeleItem(m)) { currItem = m_doc->m_Selection->itemAt(0); if ((currItem->asTextFrame()) || (currItem->asImageFrame())) { m_view->requestMode(modeEdit); + wantNormal = false; } else { m_view->requestMode(submodePaintingDone); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); } + if (currItem->asTextFrame()) + m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y()); } else { m_view->requestMode(submodePaintingDone); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); } - m_view->requestMode(modeNormal); + if (wantNormal) m_view->requestMode(modeNormal); return; } } Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (revision 13437) +++ scribus/scribusdoc.h (working copy) @@ -169,6 +169,14 @@ */ int addAutomaticTextFrame(const int pageNumber); /** + * @brief Add a full-size text frame to the page. Similar to addAutomaticTextFrame, + * but works regardless on whether automaticTextFrames is set, and it also + * doesn't connect the frame with other automatically created frames + * @param pageNumber page number + * @return number of frame + */ + int addFullTextFrame(const int pageNumber); + /** * Set the left and right margins based on the location of the page * @param pageIndex */ |
|
I am not sure we can include this at this late stage of 1.3.5.. we are really trying to close down changes to the absolute minimum and I do not think we have time left to test, however we can include in 1.3.6 (and don't fear, 1.3.6 is planned to be a lot lot shorter). Will have to see what the others say. |
|
Okay so, now that SVN trunk is 1.5.0, any updates on this ? |
|
Updating target to 1.5.0 to not lose track of that one |
|
I second the above. Pagemaker has a similar functionality and it is very useful when placing long texts into documents. |
|
shift+click is already taken for creating a frame which expands to fill the page margin / guides surrounding. i propose to adapt the patch to use the state of sticky tool instead of the shift key... however, i know somebody who will love this patch! thanks a.l.e |
|
Shift-click in this context only works if you are auto-filling (so a different tool), thus I don't really see a problem with this. But, if a change like this desirable, I can indeed to that - by state of the sticky tool, I assume you mean something like adding a menu item determining whether the auto-fill will continue creating frames or not? That would work too, yes, although I find Shift-clicks easier to use (even if harder to discover, other such combinations suffer from a similar problem, and some text in the status bar or such would remedy that). |
|
hi mecirt, i would use the normal setting for sticky tool (insert > sticky tool; i think that i will post a bug report to fix this: the chain tool is the only one that doesn't respect the general stickyness!). imho, it is important to keep shift+click as the shortcut for autofill an area. |
|
If you use shift-click while creating a frame to autofill, i 'd really like that the shift-click on an existing frame force it to became square like it was before. And keep ctrl-click to keep the proportion of the frame while changing it's size. Could it be possible to make a different behaviour between "holding shift, the mouse drawing start and end click" and "mouse drawing start, holding shift, mouse drawing end" sequences ? So having one for auto-fill, the other for square shaped. Btw, to be consistent, the behaviour of shift-click for auto-fill should be applied for the insert table button too. |
|
most of this patch has been integrated into 1.5 through cezary's patch. also ctrl is now used to force the form to be a square. i'll close this bug and open a new one for the sticky part. |
|
it's a pity that this patch has been laying around for so long... however, it has been reimplemented by cezary and committed in 1.5svn |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-05-01 16:13 | mecirt | New Issue | |
2009-05-01 16:13 | mecirt | File Added: scribus-autoflow.patch | |
2009-05-01 17:02 | cbradney | Note Added: 0021660 | |
2009-05-01 17:03 | cbradney | Note Edited: 0021660 | |
2009-06-08 13:54 | mecirt | Note Added: 0021904 | |
2009-07-22 20:58 | jghali | Note Added: 0022232 | |
2009-07-22 20:58 | jghali | Target Version | => 1.5.0 |
2009-07-27 11:31 | victorp | Note Added: 0022238 | |
2009-08-02 16:55 | ale | Note Added: 0022267 | |
2009-08-09 09:33 | mecirt | Note Added: 0022294 | |
2009-10-07 14:43 | ale | Note Added: 0022631 | |
2009-11-03 09:24 | brunod | Note Added: 0022790 | |
2009-11-03 09:26 | brunod | Note Edited: 0022790 | |
2012-06-18 05:57 | ale | Note Added: 0028177 | |
2012-06-18 05:59 | ale | Relationship added | related to 0010295 |
2012-06-18 06:00 | ale | Note Added: 0028178 | |
2012-06-18 06:00 | ale | Status | new => resolved |
2012-06-18 06:00 | ale | Fixed in Version | => 1.5.0svn |
2012-06-18 06:00 | ale | Resolution | open => fixed |
2012-06-18 06:00 | ale | Assigned To | => ale |
2012-06-19 18:32 | 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 |