r17422 by fschmid - Inline Frames: allow editing of inline frames by doubleclicking on them
scribus-commit
scribus-commit at lists.scribus.net
Mon Apr 9 09:10:04 UTC 2012
Author: fschmid
Date: Mon Apr 9 09:10:04 2012
New Revision: 17422
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17422
Log:
Inline Frames: allow editing of inline frames by doubleclicking on them
Modified:
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/text/storytext.cpp
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17422&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Mon Apr 9 09:10:04 2012
@@ -318,7 +318,14 @@
else
{ //Double click in a frame to select a word
oldCp = currItem->itemText.cursorPosition();
- currItem->itemText.setCursorPosition(currItem->itemText.selectWord(currItem->itemText.cursorPosition()));
+ if (currItem->itemText.hasObject(oldCp))
+ {
+ currItem->itemText.select(oldCp, 1, true);
+ PageItem *iItem = currItem->itemText.object(oldCp);
+ m_ScMW->editInlineStart(iItem->inlineCharID);
+ }
+ else
+ currItem->itemText.setCursorPosition(currItem->itemText.selectWord(currItem->itemText.cursorPosition()));
}
currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
}
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17422&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Mon Apr 9 09:10:04 2012
@@ -1490,12 +1490,18 @@
if (ls.y + ls.descent < coord.y())
continue;
qreal xpos = ls.x;
- for (int j = ls.firstItem; j <= ls.lastItem; ++j) {
+ for (int j = ls.firstItem; j <= ls.lastItem; ++j)
+ {
// qDebug() << QString("screenToPosition: (%1,%2) -> x %3 + %4").arg(coord.x()).arg(coord.y()).arg(xpos).arg(item(j)->glyph.wide());
qreal width = item(j)->glyph.wide();
xpos += width;
if (xpos >= coord.x())
- return xpos - width/2 > coord.x() ? j : j+1;
+ {
+ if (hasObject(j))
+ return j;
+ else
+ return xpos - width/2 > coord.x() ? j : j+1;
+ }
}
if (xpos > maxx)
maxx = xpos;
@@ -1541,13 +1547,13 @@
for (int j = ls.firstItem; j < pos; ++j)
{
if (hasObject(j))
- xpos += (object(j)->gWidth + object(j)->lineWidth()) * item(j)->glyph.scaleH;
+ xpos += (object(j)->width() + object(j)->lineWidth()) * item(j)->glyph.scaleH;
else
xpos += item(j)->glyph.wide();
}
qreal finalw = 1;
if (hasObject(pos))
- finalw = (object(pos)->gWidth + object(pos)->lineWidth()) * item(pos)->glyph.scaleH;
+ finalw = (object(pos)->width() + object(pos)->lineWidth()) * item(pos)->glyph.scaleH;
else
finalw = item(pos)->glyph.wide();
const CharStyle& cs(charStyle(pos));
More information about the scribus-commit
mailing list