~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to scribus/canvasmode_legacy.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
void LegacyMode::drawTextCursor(QPainter *p, PageItem_TextFrame* textframe)
121
121
{
122
122
        int x, y, y1;
123
 
        if (textframe->CPos > textframe->itemText.length())
124
 
        {
125
 
                textframe->CPos = textframe->itemText.length();
126
 
        }
 
123
        textframe->itemText.normalizeCursorPosition();
127
124
        if (textframe->lastInFrame() >= signed(textframe->itemText.nrOfItems()) 
128
125
                || textframe->itemText.length() == 0)
129
126
        {
131
128
                y = 0;
132
129
                y1 = static_cast<int>(textframe->itemText.defaultStyle().charStyle().fontSize() / 10);
133
130
        }
134
 
        else if ( textframe->CPos > textframe->itemText.endOfItem(textframe->lastInFrame())
135
 
                          || (textframe->CPos >= textframe->itemText.length() && textframe->itemText.text(textframe->itemText.length()-1) != SpecialChars::PARSEP) )
 
131
        else if ( textframe->itemText.cursorPosition() > textframe->itemText.endOfItem(textframe->lastInFrame())
 
132
                          || (textframe->itemText.cursorPosition() >= textframe->itemText.length() && textframe->itemText.text(textframe->itemText.length()-1) != SpecialChars::PARSEP) )
136
133
        {
137
134
                FRect bbox = textframe->itemText.boundingBox(qMax(0,qMin(textframe->lastInFrame(), textframe->itemText.length()-1)));
138
135
                x = static_cast<int>(bbox.x() + bbox.width());
145
142
        }
146
143
        else
147
144
        {
148
 
                FRect bbox = textframe->itemText.boundingBox(qMax(0,qMin(textframe->CPos, textframe->itemText.length())));
 
145
                FRect bbox = textframe->itemText.boundingBox( textframe->itemText.normalizedCursorPosition() );
149
146
                x = static_cast<int>(bbox.x());
150
147
                y = static_cast<int>(bbox.y());
151
148
                if (bbox.height() <= 2) 
152
 
                        y1 = static_cast<int>(bbox.y() + textframe->itemText.charStyle(textframe->CPos).fontSize() / 30);
 
149
                        y1 = static_cast<int>(bbox.y() + textframe->itemText.charStyle().fontSize() / 30);
153
150
                else
154
151
                        y1 = static_cast<int>(bbox.y() + bbox.height());
155
152
        }
346
343
                                        m_view->requestMode(modeNormal);
347
344
                                        return;
348
345
                                }
349
 
                                int a=cItem->CPos;
 
346
                                int a = cItem->itemText.cursorPosition();
350
347
                                while(a>0)
351
348
                                {
352
349
                                        if (cItem->itemText.text(a-1).isLetterOrNumber())
354
351
                                        else
355
352
                                                break;
356
353
                                }
357
 
                                int b=cItem->CPos;
 
354
                                int b = cItem->itemText.cursorPosition();
358
355
                                while(b<cItem->itemText.length())
359
356
                                {
360
357
                                        if (cItem->itemText.text(b).isLetterOrNumber())
363
360
                                                break;
364
361
                                }
365
362
                                oldCp = a;
366
 
                                cItem->CPos=b;
 
363
                                cItem->itemText.setCursorPosition(b);
367
364
                                cItem->ExpandSel(1, oldCp);
368
365
//                              m_view->slotDoCurs(true);
369
366
                        }
712
709
                                //Make sure we dont go here if the old cursor position was not set
713
710
                                if (oldCp!=-1 && currItem->itemText.length() > 0)
714
711
                                {
715
 
                                        if (currItem->CPos < oldCp)
 
712
                                        int cPos = currItem->itemText.cursorPosition();
 
713
                                        if (currItem->itemText.cursorPosition() < oldCp)
716
714
                                        {
717
 
                                                currItem->itemText.select(currItem->CPos, oldCp - currItem->CPos);
 
715
                                                currItem->itemText.select(cPos, oldCp - cPos);
718
716
                                                currItem->HasSel = true;
719
717
                                        }
720
 
                                        if (currItem->CPos > oldCp)
 
718
                                        if (currItem->itemText.cursorPosition() > oldCp)
721
719
                                        {
722
 
                                                currItem->itemText.select(oldCp, currItem->CPos - oldCp);
 
720
                                                currItem->itemText.select(oldCp, cPos - oldCp);
723
721
                                                currItem->HasSel = true;
724
722
                                        }
725
723
                                }
1736
1734
                                                        return;
1737
1735
                                                }
1738
1736
                                        }
1739
 
                                        oldP = currItem->CPos;
 
1737
                                        oldP = currItem->itemText.cursorPosition();
1740
1738
                                        //CB Where we set the cursor for a click in text frame
1741
1739
                                        if (currItem->asTextFrame())
1742
1740
                                        {
1754
1752
                                                if (m->modifiers() & Qt::ShiftModifier)
1755
1753
                                                {
1756
1754
                                                        int dir=1;
1757
 
                                                        if (oldCp>currItem->CPos)
 
1755
                                                        if (oldCp > currItem->itemText.cursorPosition())
1758
1756
                                                                dir=-1;
1759
1757
                                                        currItem->asTextFrame()->ExpandSel(dir, oldP);
1760
1758
                                                        oldCp = oldP;
1761
1759
                                                }
1762
1760
                                                else //>>CB
1763
1761
                                                {
1764
 
                                                        oldCp = currItem->CPos;
 
1762
                                                        oldCp = currItem->itemText.cursorPosition();
1765
1763
                                                        currItem->itemText.deselectAll();
1766
1764
                                                        currItem->HasSel = false;
1767
1765
                                                }
4019
4017
                currItem = m_doc->m_Selection->itemAt(0);
4020
4018
                if (currItem->asTextFrame())
4021
4019
                {
4022
 
                        if (oldCp == currItem->CPos)
 
4020
                        if (oldCp == currItem->itemText.cursorPosition())
4023
4021
                        {
4024
4022
                                currItem->itemText.deselectAll();
4025
4023
                                currItem->HasSel = false;