00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "canvasmode_legacy.h"
00018
00019 #include <QApplication>
00020 #include <QButtonGroup>
00021 #include <QCheckBox>
00022 #include <QCursor>
00023 #include <QEvent>
00024 #include <QMessageBox>
00025 #include <QMouseEvent>
00026 #include <QPainterPath>
00027 #include <QPoint>
00028 #include <QRect>
00029 #include <QTimer>
00030 #include <QWidgetAction>
00031
00032
00033 #include "canvas.h"
00034 #include "canvasgesture_linemove.h"
00035 #include "canvasgesture_resize.h"
00036 #include "canvasgesture_rulermove.h"
00037 #include "contextmenu.h"
00038 #include "customfdialog.h"
00039 #include "fpoint.h"
00040 #include "fpointarray.h"
00041
00042
00043 #include "hyphenator.h"
00044 #include "insertTable.h"
00045 #include "oneclick.h"
00046 #include "pageitem_textframe.h"
00047 #include "pageselector.h"
00048 #include "prefscontext.h"
00049 #include "prefsfile.h"
00050 #include "prefsmanager.h"
00051 #include "propertiespalette.h"
00052
00053 #include "scribus.h"
00054 #include "scribusdoc.h"
00055 #include "scribusview.h"
00056 #include "scribusXml.h"
00057 #include "selection.h"
00058 #include "stencilreader.h"
00059 #include "undomanager.h"
00060 #include "units.h"
00061 #include "util.h"
00062 #include "util_icon.h"
00063 #include "util_math.h"
00064 #include "loadsaveplugin.h"
00065 #include "fileloader.h"
00066 #include "plugins/formatidlist.h"
00067
00068
00069
00070 LegacyMode::LegacyMode(ScribusView* view) : QObject(), CanvasMode(view), m_ScMW(view->m_ScMW)
00071 {
00072 GxM = GyM = -1;
00073 Mxp = Myp = -1;
00074 Dxp = Dyp = -1;
00075 MoveGX = MoveGY = false;
00076 oldCp = Cp = -1;
00077 frameResizeHandle = -1;
00078 RotMode = 0;
00079 inItemCreation = false;
00080 shiftSelItems = false;
00081 FirstPoly = true;
00082 resizeGesture = NULL;
00083 lineMoveGesture = NULL;
00084 guideMoveGesture = NULL;
00085 m_blinker = new QTimer(view);
00086 connect(m_blinker, SIGNAL(timeout()), this, SLOT(blinkTextCursor()));
00087 }
00088
00089 inline bool LegacyMode::GetItem(PageItem** pi)
00090 {
00091 *pi = m_doc->m_Selection->itemAt(0);
00092 return (*pi) != NULL;
00093 }
00094
00095
00096 void LegacyMode::blinkTextCursor()
00097 {
00098 PageItem* currItem;
00099 if (m_doc->appMode == modeEdit && GetItem(&currItem))
00100 {
00101 QRectF brect = currItem->getBoundingRect();
00102
00103 m_canvas->update(QRectF(m_canvas->canvasToLocal(brect.topLeft()), QSizeF(brect.width(),brect.height())*m_canvas->scale()).toRect());
00104 }
00105 }
00106
00107
00108
00109 void LegacyMode::drawControls(QPainter* p)
00110 {
00111
00112 if (m_canvas->m_viewMode.operItemMoving)
00113 {
00114 drawOutline(p);
00115 }
00116 else
00117 {
00118 drawSelection(p);
00119 }
00120 PageItem* currItem;
00121 if (m_doc->appMode == modeEdit && GetItem(&currItem))
00122 {
00123 PageItem_TextFrame* textframe = currItem->asTextFrame();
00124 if (textframe)
00125 drawTextCursor(p, textframe);
00126 }
00127 }
00128
00129
00130 void LegacyMode::drawTextCursor(QPainter *p, PageItem_TextFrame* textframe)
00131 {
00132 int x, y, y1;
00133 if (textframe->CPos > textframe->itemText.length())
00134 {
00135 textframe->CPos = textframe->itemText.length();
00136 }
00137 if (textframe->lastInFrame() >= signed(textframe->itemText.nrOfItems())
00138 || textframe->itemText.length() == 0)
00139 {
00140 x = 0;
00141 y = 0;
00142 y1 = static_cast<int>(textframe->itemText.defaultStyle().charStyle().fontSize() / 10);
00143 }
00144 else if ( textframe->CPos > textframe->itemText.endOfItem(textframe->lastInFrame())
00145 || (textframe->CPos >= textframe->itemText.length() && textframe->itemText.text(textframe->itemText.length()-1) != SpecialChars::PARSEP) )
00146 {
00147 FRect bbox = textframe->itemText.boundingBox(qMax(0,qMin(textframe->lastInFrame(), textframe->itemText.length()-1)));
00148 x = static_cast<int>(bbox.x() + textframe->itemText.item(qMax(0,qMin(textframe->lastInFrame(), textframe->itemText.length()-1)))->glyph.wide());
00149 y = static_cast<int>(bbox.y());
00150 if (bbox.height() <= 2)
00151 y1 = static_cast<int>(bbox.y() + textframe->itemText.defaultStyle().charStyle().fontSize() / 30);
00152 else
00153 y1 = static_cast<int>(bbox.y() + bbox.height());
00154 }
00155 else
00156 {
00157 FRect bbox = textframe->itemText.boundingBox(qMax(0,qMin(textframe->CPos, textframe->itemText.length())));
00158 x = static_cast<int>(bbox.x());
00159 y = static_cast<int>(bbox.y());
00160 if (bbox.height() <= 2)
00161 y1 = static_cast<int>(bbox.y() + textframe->itemText.charStyle(textframe->CPos).fontSize() / 30);
00162 else
00163 y1 = static_cast<int>(bbox.y() + bbox.height());
00164 }
00165
00166
00167 if (x < 1)
00168 x = 1;
00169
00170 p->save();
00171 p->translate(textframe->xPos(), textframe->yPos());
00172 p->rotate(textframe->rotation());
00173 p->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
00174 if (m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2)
00175 {
00176
00177 m_cursorVisible = !m_cursorVisible;
00178 m_blinkTime.restart();
00179 }
00180
00181
00182 if (m_cursorVisible)
00183 {
00184 int p1 = qMin(qMax(y,0),static_cast<int>(textframe->height()));
00185 int p2 = qMin(qMax(y1,0),static_cast<int>(textframe->height()));
00186 p->drawLine(x, p1, x, p2);
00187 }
00188 p->restore();
00189 }
00190
00191 void LegacyMode::enterEvent(QEvent *)
00192 {
00193 if (!m_canvas->m_viewMode.m_MouseButtonPressed)
00194 {
00195 setModeCursor();
00196 }
00197 }
00198
00199
00200 void LegacyMode::leaveEvent(QEvent *e)
00201 {
00202 if (!m_canvas->m_viewMode.m_MouseButtonPressed)
00203 qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
00204 }
00205
00206
00207 void LegacyMode::activate(bool fromGesture)
00208 {
00209 qDebug() << "LegacyMode::activate" << fromGesture;
00210 m_canvas->m_viewMode.m_MouseButtonPressed = false;
00211 m_canvas->resetRenderMode();
00212 m_doc->DragP = false;
00213 m_doc->leaveDrag = false;
00214 m_canvas->m_viewMode.operItemMoving = false;
00215 m_canvas->m_viewMode.operItemResizing = false;
00216 m_view->MidButt = false;
00217 GxM = GyM = -1;
00218 Mxp = Myp = -1;
00219 Dxp = Dyp = -1;
00220 MoveGX = MoveGY = false;
00221 oldCp = Cp = -1;
00222 frameResizeHandle = -1;
00223 RotMode = 0;
00224 inItemCreation = false;
00225 shiftSelItems = false;
00226 FirstPoly = true;
00227 setModeCursor();
00228 if (m_doc->appMode == modeEdit)
00229 {
00230 m_blinker->start(500);
00231 m_blinkTime.start();
00232 m_cursorVisible = true;
00233 }
00234 if (fromGesture)
00235 {
00236 m_canvas->m_viewMode.operItemResizeInEditMode = false;
00237 m_view->update();
00238 }
00239 }
00240
00241 void LegacyMode::deactivate(bool forGesture)
00242 {
00243 qDebug() << "LegacyMode::deactivate" << forGesture;
00244 m_view->redrawMarker->hide();
00245 if (!forGesture)
00246 m_blinker->stop();
00247 }
00248
00249 void LegacyMode::mouseDoubleClickEvent(QMouseEvent *m)
00250 {
00251 m->accept();
00252 m_canvas->m_viewMode.m_MouseButtonPressed = false;
00253 m_canvas->resetRenderMode();
00254 m_view->stopDragTimer();
00255 PageItem *currItem = 0;
00256 if ((m_doc->m_Selection->isMultipleSelection()) || (m_doc->appMode != modeNormal))
00257 {
00258 if ((m_doc->m_Selection->isMultipleSelection()) && (m_doc->appMode == modeNormal))
00259 {
00260 if (GetItem(&currItem))
00261 {
00262 if (currItem->isTableItem)
00263 {
00264 m_view->Deselect(false);
00265 m_doc->m_Selection->addItem(currItem);
00266 currItem->isSingleSel = true;
00267
00268 if (!m_doc->m_Selection->primarySelectionIs(currItem))
00269 currItem->emitAllToGUI();
00270 m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
00271 }
00272 }
00273 return;
00274 }
00275 else
00276 {
00277 if (!(GetItem(&currItem) && (m_doc->appMode == modeEdit) && currItem->asTextFrame()))
00278 {
00279 mousePressEvent(m);
00280 return;
00281 }
00282 }
00283 }
00284 if (GetItem(&currItem))
00285 {
00286 if (currItem->asLatexFrame()) {
00287 if ((currItem->locked()) || (!currItem->ScaleType))
00288 {
00289 return;
00290 }
00291 if (currItem->imageShown())
00292 m_view->requestMode(modeEdit);
00293 } else if ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::PolyLine) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
00294 {
00295 if ((currItem->locked()) || (!currItem->ScaleType))
00296 {
00297
00298 return;
00299 }
00300
00301
00302 if (currItem->itemType() == PageItem::ImageFrame)
00303 {
00304 if (currItem->Pfile.isEmpty())
00305 m_view->requestMode(submodeLoadPic);
00306 else if (!currItem->PicAvail)
00307 m_view->requestMode(submodeStatusPic);
00308 else if (currItem->imageShown())
00309 m_view->requestMode(modeEdit);
00310 }
00311 else if (currItem->itemType() == PageItem::TextFrame)
00312 m_view->requestMode(modeEdit);
00313 else
00314 m_view->requestMode(modeEditClip);
00315 }
00316 else
00317 if (currItem->itemType() == PageItem::TextFrame)
00318 {
00319
00320
00321
00322
00323 if (currItem->isAnnotation())
00324 {
00325 m_view->requestMode(submodeAnnotProps);
00326
00327 }
00328
00329 else if (m_doc->appMode != modeEdit)
00330 {
00331 m_view->requestMode(modeEdit);
00332 m_view->slotSetCurs(m->x(), m->y());
00333
00334
00335
00336
00337
00338 }
00339
00340 else
00341 {
00342 PageItem_TextFrame *cItem=currItem->asTextFrame();
00343 bool inText = m_view->slotSetCurs(m->x(), m->y());
00344 if (!inText)
00345 {
00346 m_view->Deselect(true);
00347
00348 m_view->requestMode(modeNormal);
00349 return;
00350 }
00351 int a=cItem->CPos;
00352 while(a>0)
00353 {
00354 if (cItem->itemText.text(a-1).isLetterOrNumber())
00355 --a;
00356 else
00357 break;
00358 }
00359 int b=cItem->CPos;
00360 while(b<cItem->itemText.length())
00361 {
00362 if (cItem->itemText.text(b).isLetterOrNumber())
00363 ++b;
00364 else
00365 break;
00366 }
00367 oldCp = a;
00368 cItem->CPos=b;
00369 cItem->ExpandSel(1, oldCp);
00370
00371 }
00372 }
00373 }
00374 }
00375
00376
00377 void LegacyMode::mouseMoveEvent(QMouseEvent *m)
00378 {
00379
00380
00381 const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
00382
00383 double newX, newY;
00384 double nx, ny;
00385 PageItem *currItem;
00386 QPoint np, np2, mop;
00387 FPoint npf, npf2;
00388 QPainter p;
00389 QRect tx;
00390 bool erf = false;
00391
00392
00393
00394 m->accept();
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEditGradientVectors))
00435 {
00436 PageItem *currItem = m_doc->m_Selection->itemAt(0);
00437 newX = mousePointDoc.x();
00438 newY = mousePointDoc.y();
00439 double dx = fabs(Mxp - newX) + 5.0 / m_canvas->scale();
00440 double dy = fabs(Myp - newY) + 5.0 / m_canvas->scale();
00441 if (m->buttons() & Qt::LeftButton)
00442 {
00443 currItem->GrStartX -= (Mxp - newX);
00444 currItem->GrStartY -= (Myp - newY);
00445 }
00446 if (m->buttons() & Qt::RightButton)
00447 {
00448 currItem->GrEndX -= (Mxp - newX);
00449 currItem->GrEndY -= (Myp - newY);
00450 }
00451 Mxp = newX;
00452 Myp = newY;
00453 m_view->RefreshGradient(currItem, dx * m_canvas->scale(), dy * m_canvas->scale());
00454 m_ScMW->propertiesPalette->updateColorSpecialGradient();
00455 return;
00456 }
00457 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeMeasurementTool))
00458 {
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476 return;
00477 }
00478 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::RightButton) && (m->modifiers() & Qt::ControlModifier))
00479 {
00480 m_ScMW->setAppMode(modePanning);
00481 }
00482 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modePanning))
00483 {
00484 double sc = m_canvas->scale();
00485 int scroX = qRound((mousePointDoc.x() - Mxp) * sc);
00486 int scroY = qRound((mousePointDoc.y() - Myp) * sc);
00487 m_view->scrollBy(-scroX, -scroY);
00488
00489
00490 Mxp = mousePointDoc.x();
00491 Myp = mousePointDoc.y();
00492 return;
00493 }
00494 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeDrawFreehandLine))
00495 {
00496
00497
00498 double newXF = mousePointDoc.x();
00499 double newYF = mousePointDoc.y();
00500 if (RecordP.size() > 0)
00501 {
00502 if (FPoint(newXF, newYF) != RecordP.point(RecordP.size()-1))
00503 RecordP.addPoint(FPoint(newXF, newYF));
00504 }
00505 else
00506 RecordP.addPoint(FPoint(newXF, newYF));
00507 QPolygon& redrawPolygon(m_canvas->newRedrawPolygon());
00508 for (uint pp = 0; pp < RecordP.size(); pp++)
00509 {
00510 redrawPolygon << RecordP.pointQ(pp);
00511 }
00512 m_canvas->m_viewMode.operItemResizing = true;
00513 QRect bRect = m_canvas->redrawPolygon().boundingRect();
00514
00515
00516
00517
00518 m_view->updateContents(bRect);
00519 return;
00520 }
00521 if ((GetItem(&currItem)) && (!shiftSelItems))
00522 {
00523 newX = qRound(mousePointDoc.x());
00524 newY = qRound(mousePointDoc.y());
00525 if ((((m_view->dragTimerElapsed()) && (m->buttons() & Qt::LeftButton)) || (m_view->moveTimerElapsed() && (m->buttons() & Qt::RightButton)))
00526 && (m_canvas->m_viewMode.m_MouseButtonPressed)
00527 && (!m_doc->DragP)
00528 && (m_doc->appMode == modeNormal)
00529 && (!(currItem->isSingleSel)))
00530 {
00531
00532 m_view->stopDragTimer();
00533 if ((fabs(Dxp - newX) > 10) || (fabs(Dyp - newY) > 10))
00534 {
00535 m_canvas->setRenderMode(Canvas::RENDER_NORMAL);
00536 m_view->resetDragTimer();
00537 m_doc->DragP = true;
00538 m_doc->leaveDrag = false;
00539 m_doc->DraggedElem = currItem;
00540 m_doc->DragElements.clear();
00541 for (int dre=0; dre<m_doc->m_Selection->count(); ++dre)
00542 m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre)->ItemNr);
00543 ScriXmlDoc *ss = new ScriXmlDoc();
00544
00545 QMimeData* md = new QMimeData();
00546 md->setText(ss->WriteElem(m_doc, m_view, m_doc->m_Selection));
00547 QDrag* dr = new QDrag(m_view);
00548 dr->setMimeData(md);
00549 const QPixmap& pm = loadIcon("DragPix.xpm");
00550 dr->setDragCursor(pm, Qt::CopyAction);
00551 dr->setDragCursor(pm, Qt::MoveAction);
00552 dr->setDragCursor(pm, Qt::LinkAction);
00553 dr->exec();
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565 delete ss;
00566 ss=NULL;
00567 m_doc->DragP = false;
00568 m_doc->leaveDrag = false;
00569 m_canvas->m_viewMode.m_MouseButtonPressed = false;
00570 m_doc->DraggedElem = 0;
00571 m_doc->DragElements.clear();
00572 qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
00573 m_view->updateContents();
00574 }
00575 return;
00576 }
00577 if (m_doc->DragP)
00578 return;
00579 if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeRotation))
00580 {
00581 m_view->stopDragTimer();
00582 if (!m_view->groupTransactionStarted() && m_doc->m_Selection->isMultipleSelection())
00583 {
00584 m_view->startGroupTransaction(Um::Rotate, "", Um::IRotate);
00585 }
00586 double newW = xy2Deg(mousePointDoc.x()-m_view->RCenter.x(), mousePointDoc.y()-m_view->RCenter.y());
00587 if (m->modifiers() & Qt::ControlModifier)
00588 {
00589 newW=constrainAngle(newW, m_doc->toolSettings.constrain);
00590 m_view->oldW=constrainAngle(m_view->oldW, m_doc->toolSettings.constrain);
00591
00592 if (m_doc->m_Selection->isMultipleSelection())
00593 m_doc->rotateGroup(newW-m_view->oldW, m_view->RCenter);
00594 else
00595 m_doc->RotateItem(newW, currItem->ItemNr);
00596 }
00597 else
00598 {
00599 if (m_doc->m_Selection->isMultipleSelection())
00600 m_doc->rotateGroup(newW - m_view->oldW, m_view->RCenter);
00601 else
00602 m_doc->RotateItem(currItem->rotation() - (m_view->oldW - newW), currItem->ItemNr);
00603 }
00604 m_view->oldW = newW;
00605
00606 }
00607 if (m_doc->appMode == modeDrawBezierLine)
00608 {
00609 if ((m_doc->useRaster) && (m_doc->OnPage(currItem) != -1))
00610 {
00611 newX = qRound(newX / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00612 newY = qRound(newY / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00613 }
00614 m_canvas->newRedrawPolygon() << QPoint(qRound(newX - currItem->xPos()), qRound(newY - currItem->yPos()));
00615 m_view->updateContents();
00616 Mxp = newX;
00617 Myp = newY;
00618 }
00619 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeDrawRegularPolygon))
00620 {
00621 if (m->modifiers() & Qt::ShiftModifier)
00622 {
00623
00624 newY = static_cast<int>(currItem->yPos() + (newX - currItem->xPos()));
00625 QCursor::setPos(m_canvas->canvasToGlobal(FPoint(newX, newY)));
00626
00627 }
00628 if ((m_doc->useRaster) && (m_doc->OnPage(currItem) != -1))
00629 {
00630 newX = qRound(newX / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00631 newY = qRound(newY / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00632 }
00633 QMatrix mp = currItem->getTransform();
00634
00635
00636
00637 np2 = QPoint(static_cast<int>(newX), static_cast<int>(newY)) * mp.inverted();
00638 QMatrix pm;
00639 m_canvas->Transform(currItem, pm);
00640 m_canvas->PaintSizeRect(pm.mapToPolygon(QRect(QPoint(0, 0), np2)));
00641
00642 Mxp = newX;
00643 Myp = newY;
00644 }
00645 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeDrawLine))
00646 {
00647 if (m_doc->useRaster)
00648 {
00649 newX = qRound(newX / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00650 newY = qRound(newY / m_doc->guidesSettings.minorGrid) * m_doc->guidesSettings.minorGrid;
00651 }
00652 double newRot=xy2Deg(newX - currItem->xPos(), newY - currItem->yPos());
00653
00654 if (m->modifiers() & Qt::ControlModifier)
00655 {
00656
00657 if (newRot<0.0)
00658 newRot=-newRot;
00659 else
00660 newRot=360-newRot;
00661 newRot=constrainAngle(newRot, m_doc->toolSettings.constrain);
00662 double hlen=sqrt(pow(newX - currItem->xPos(),2)+pow(newY - currItem->yPos(),2));
00663 newX = qRound(currItem->xPos()+(hlen * cos(newRot/(180.0/M_PI))));
00664 newY = qRound(currItem->yPos()-(hlen * sin(newRot/(180.0/M_PI))));
00665 }
00666
00667
00668 m_canvas->newRedrawPolygon() << QPoint(qRound(currItem->xPos()), qRound(currItem->yPos())) << QPoint(qRound(newX), qRound(newY));
00669 newX = mousePointDoc.x();
00670 newY = mousePointDoc.y();
00671 m_view->updateCanvas(QRectF(QPointF(Dxp, Dyp), QPointF(newX, newY)).normalized().adjusted(-10, -10, 20, 20));
00672 Mxp = newX;
00673 Myp = newY;
00674 }
00675 if (m_canvas->m_viewMode.m_MouseButtonPressed && (m_doc->appMode == modeEdit) && (!m_canvas->m_viewMode.operItemResizeInEditMode))
00676 {
00677 if (currItem->asImageFrame())
00678 {
00679 QMatrix ro;
00680 ro.rotate(-currItem->rotation());
00681 QPointF rota = ro.map(QPointF(newX-Mxp,newY-Myp));
00682 currItem->moveImageInFrame(rota.x()/currItem->imageXScale(), rota.y()/currItem->imageYScale());
00683
00684 currItem->update();
00685 Mxp = newX;
00686 Myp = newY;
00687 }
00688 if (currItem->asTextFrame())
00689 {
00690 currItem->itemText.deselectAll();
00691 currItem->HasSel = false;
00692 m_view->slotSetCurs(m->x(), m->y());
00693
00694 if (oldCp!=-1 && currItem->itemText.length() > 0)
00695 {
00696 if (currItem->CPos < oldCp)
00697 {
00698 currItem->itemText.select(currItem->CPos, oldCp - currItem->CPos);
00699 currItem->HasSel = true;
00700 }
00701 if (currItem->CPos > oldCp)
00702 {
00703 currItem->itemText.select(oldCp, currItem->CPos - oldCp);
00704 currItem->HasSel = true;
00705 }
00706 }
00707 currItem->update();
00708 if(currItem->HasSel)
00709 m_ScMW->EnableTxEdit();
00710 else
00711 m_ScMW->DisableTxEdit();
00712 }
00713 }
00714
00715
00716 if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::LeftButton) &&
00717 ((m_doc->appMode == modeNormal) || ((m_doc->appMode == modeEdit) && m_canvas->m_viewMode.operItemResizeInEditMode)) && (!currItem->locked()))
00718 {
00719 m_view->stopDragTimer();
00720 if (m_canvas->m_viewMode.operItemResizing)
00721 {
00722
00723
00724 m_canvas->m_viewMode.operItemMoving = false;
00725 if (m_doc->m_Selection->isMultipleSelection())
00726 {
00727
00728
00729 double gx, gy, gh, gw;
00730 m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
00731 const double sc=1;
00732 int ox1 = qRound(gx*sc);
00733 int oy1 = qRound(gy*sc);
00734 int ox2 = qRound((gx+gw)*sc);
00735 int oy2 = qRound((gy+gh)*sc);
00736 FPoint np2 = FPoint(newX, newY);
00737 np2 = m_doc->ApplyGridF(mousePointDoc);
00738 double nx = np2.x();