r16845 by craig - #10116: Move text overflow indicator to corner of frame. Create overflow count HUD on hover of overflow icon. Allow clicking on overflow icon to get into link frame mode
scribus-commit
scribus-commit at lists.scribus.net
Mon Sep 19 19:40:29 UTC 2011
Author: craig
Date: Mon Sep 19 19:40:29 2011
New Revision: 16845
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16845
Log:
#10116: Move text overflow indicator to corner of frame. Create overflow count HUD on hover of overflow icon. Allow clicking on overflow icon to get into link frame mode
Modified:
trunk/Scribus/scribus/canvas.cpp
trunk/Scribus/scribus/canvas.h
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Mon Sep 19 19:40:29 2011
@@ -494,6 +494,19 @@
--currNr;
}
return NULL;
+}
+
+bool Canvas::cursorOverTextFrameControl(QPoint globalPos, PageItem* frame)
+{
+ FPoint mp=globalToCanvas(globalPos);
+ qreal sideLength = 10 / qMax(m_viewMode.scale, 1.0);
+ qreal left = frame->xPos() + frame->width() - sideLength;// / 2;
+ qreal right = left + sideLength;
+ qreal top = frame->yPos() + frame->height() - sideLength;// * 1.5;
+ qreal bottom = top + sideLength;
+ if(mp.x()>left && mp.x()<right && mp.y()>top && mp.y()<bottom)
+ return true;
+ return false;
}
PageItem* Canvas::itemInGroup(PageItem* group, QTransform itemPos, QRectF mouseArea) const
Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Mon Sep 19 19:40:29 2011
@@ -159,7 +159,8 @@
// QRectF globalToCanvas(QRectF p) const;
bool hitsCanvasPoint(QPoint globalPoint, FPoint canvasPoint) const;
bool hitsCanvasPoint(QPoint globalPoint, QPointF canvasPoint) const;
- QRect exposedRect()const;
+ QRect exposedRect() const;
+ bool cursorOverTextFrameControl(QPoint globalPos, PageItem* frame);
/** Returns the framehandle or INSIDE if the position falls into the frame. */
FrameHandle frameHitTest(QPointF canvasPoint, PageItem* frame) const;
FrameHandle frameHitTest(QPointF point, QRectF frame) const;
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Mon Sep 19 19:40:29 2011
@@ -27,6 +27,7 @@
#include <QPoint>
#include <QRect>
#include <QTimer>
+#include <QToolTip>
#include <QWidgetAction>
#include <QDebug>
@@ -332,6 +333,32 @@
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
+ //<<#10116 Show overflow counter HUD
+ if (!movingOrResizing && mouseIsOnPage)
+ {
+ PageItem* hoveredItem=NULL;
+ hoveredItem = m_canvas->itemUnderCursor(m->globalPos(), hoveredItem, m->modifiers());
+ if (hoveredItem)
+ {
+ if (hoveredItem->asTextFrame() && hoveredItem->frameOverflows())
+ {
+ if (m_canvas->cursorOverTextFrameControl(m->globalPos(), hoveredItem))
+ {
+ QToolTip::showText(m->globalPos() + QPoint(5, 5), tr("Overflow Characters: %1").arg(hoveredItem->frameOverflowCount()), m_canvas);
+ }
+ }
+ else
+ if (QToolTip::isVisible())
+ QToolTip::hideText();
+ }
+ else
+ {
+ if (QToolTip::isVisible())
+ QToolTip::hideText();
+ }
+ }
+ //>>#10116
+
if ((GetItem(&currItem)) && (!shiftSelItems))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
@@ -812,6 +839,21 @@
createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y());
return;
}
+ //<<#10116: Click on overflow icon to get into link frame mode
+ PageItem* clickedItem=NULL;
+ clickedItem = m_canvas->itemUnderCursor(m->globalPos(), clickedItem, m->modifiers());
+ if (clickedItem && clickedItem->asTextFrame())
+ {
+ if (clickedItem->frameOverflows())
+ {
+ if (m_canvas->cursorOverTextFrameControl(m->globalPos(), clickedItem))
+ {
+ m_view->requestMode(modeLinkFrames);
+ return;
+ }
+ }
+ }
+ //>>#10116
if (m_view->moveTimerElapsed() && (GetItem(&currItem)))
{
// m_view->stopDragTimer();
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Mon Sep 19 19:40:29 2011
@@ -1084,6 +1084,13 @@
#else
return false; // FIXME:NLS
#endif
+}
+
+int PageItem::frameOverflowCount() const
+{
+ if (frameOverflows())
+ return itemText.length()-MaxChars;
+ return 0;
}
/// returns true if text is ending before that frame
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Mon Sep 19 19:40:29 2011
@@ -351,6 +351,7 @@
/// returns true if text overflows
bool frameOverflows() const;
bool frameUnderflows() const;
+ int frameOverflowCount() const;
/// returns index of first char displayed in this frame, used to be 0
int firstInFrame() const;
/// returns index of last char displayed in this frame, used to be MaxChars-1
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16845&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Mon Sep 19 19:40:29 2011
@@ -2678,7 +2678,7 @@
//Draw the overflow icon
if (frameOverflows())
- {//CB && added here for jghali prior to commit access
+ {
if ((!m_Doc->drawAsPreview))
drawOverflowMarker(p);
}
@@ -3469,9 +3469,9 @@
void PageItem_TextFrame::drawOverflowMarker(ScPainter *p)
{
qreal sideLength = 10 / qMax(p->zoomFactor(), 1.0);
- qreal left = Width - sideLength / 2;
+ qreal left = Width - sideLength;// / 2;
qreal right = left + sideLength;
- qreal top = Height - sideLength * 1.5;
+ qreal top = Height - sideLength;// * 1.5;
qreal bottom = top + sideLength;
QColor color(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor);
More information about the scribus-commit
mailing list