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

« back to all changes in this revision

Viewing changes to scribus/canvasmode_normal.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:
67
67
 
68
68
CanvasMode_Normal::CanvasMode_Normal(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW) 
69
69
{
70
 
        GxM = GyM = -1;
71
 
        MoveGX = MoveGY = false;
72
70
        frameResizeHandle = -1;
73
71
        shiftSelItems = false;
74
72
        resizeGesture = NULL;
130
128
        m_mouseCurrentPoint.setXY(0, 0);
131
129
        m_mouseSavedPoint.setXY(0, 0);
132
130
        m_objectDeltaPos.setXY(0,0 );
133
 
        GxM = GyM = -1;
134
 
        MoveGX = MoveGY = false;
135
131
        frameResizeHandle = -1;
136
132
        shiftSelItems = false;
137
133
        setModeCursor();
239
235
void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
240
236
{
241
237
//      qDebug()<<"CanvasMode_Normal::mouseMoveEvent";
242
 
//      const double mouseX = m->globalX();
243
 
//      const double mouseY = m->globalY();
244
238
        const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
245
239
        
246
240
        m_lastPosWasOverGuide = false;
249
243
        bool erf = false;
250
244
        m->accept();
251
245
//      qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
252
 
//      emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(), 
253
 
//                                m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
254
246
 
255
247
        if (commonMouseMove(m))
256
248
                return;
528
520
                {
529
521
                        if (m_doc->m_Selection->isMultipleSelection())
530
522
                        {
531
 
//                              QRect mpo = QRect(qRound(m->x()/m_canvas->scale())-m_doc->guidesSettings.grabRad, qRound(m->y()/m_canvas->scale())-m_doc->guidesSettings.grabRad, m_doc->guidesSettings.grabRad*2, m_doc->guidesSettings.grabRad*2);
532
 
//                              mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x()), qRound(m_doc->minCanvasCoordinate.y()));
533
523
                                double gx, gy, gh, gw;
534
524
                                m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
535
525
                                int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
536
 
//                              if ((QRect(static_cast<int>(gx), static_cast<int>(gy), static_cast<int>(gw), static_cast<int>(gh)).intersects(mpo))
537
526
                                if (how >= 0)
538
527
                                {
539
528
                                        if (how > 0)
559
548
                                QMatrix p;
560
549
                                m_canvas->Transform(currItem, p);
561
550
                                QRect mpo = QRect(m->x()-m_doc->guidesSettings.grabRad, m->y()-m_doc->guidesSettings.grabRad, m_doc->guidesSettings.grabRad*2, m_doc->guidesSettings.grabRad*2);
562
 
//                              mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
 
551
 
563
552
                                if ((QRegion(p.map(QPolygon(QRect(-3, -3, static_cast<int>(currItem->width()+6), static_cast<int>(currItem->height()+6))))).contains(mpo)))
564
553
                                {
565
554
                                        QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
596
585
        }
597
586
        else
598
587
        {
599
 
                if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton) && (GyM == -1) && (GxM == -1))
 
588
                if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
600
589
                {
601
590
                        newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
602
591
                        newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
625
614
        m_view->HaveSelRect = false;
626
615
        m_doc->DragP = false;
627
616
        m_doc->leaveDrag = false;
628
 
        MoveGX = MoveGY = false;
 
617
 
629
618
        m->accept();
630
619
        m_view->registerMousePress(m->globalPos());
631
620
        QRect mpo(m->x()-m_doc->guidesSettings.grabRad, m->y()-m_doc->guidesSettings.grabRad, m_doc->guidesSettings.grabRad*2, m_doc->guidesSettings.grabRad*2);
632
 
//      mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
633
 
 
634
621
        if (m->button() == Qt::MidButton)
635
622
        {
636
623
                m_view->MidButt = true;
911
898
                        //currItem->emitAllToGUI();
912
899
                        m_view->updatesOn(true);
913
900
                        m_view->updateContents();
 
901
                        m_doc->changed();
914
902
                }
915
903
        }
916
904
        //CB Drag selection performed here
1043
1031
        FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
1044
1032
        m_mouseCurrentPoint  = mousePointDoc;
1045
1033
        double grabRadius = m_doc->guidesSettings.grabRad / m_canvas->scale();
1046
 
        int MxpS = static_cast<int>(mousePointDoc.x()); //m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
1047
 
        int MypS = static_cast<int>(mousePointDoc.y()); //m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y());
 
1034
        int MxpS = static_cast<int>(mousePointDoc.x());
 
1035
        int MypS = static_cast<int>(mousePointDoc.y());
1048
1036
        QRectF mpo(m_mouseCurrentPoint.x()-grabRadius, m_mouseCurrentPoint.y()-grabRadius, grabRadius*2, grabRadius*2);
1049
 
//      mpo.translate(m_doc->minCanvasCoordinate.x() * m_canvas->scale(), m_doc->minCanvasCoordinate.y() * m_canvas->scale());
1050
1037
        m_doc->nodeEdit.deselect();
1051
1038
 
1052
1039
        if(!m_doc->guidesSettings.before) // guides are on foreground and want to be processed first
1299
1286
//                      m_view->startGesture(guideMoveGesture);
1300
1287
                        guideMoveGesture->mouseSelectGuide(m);
1301
1288
                }
1302
 
/*              GxM = -1;
1303
 
                GyM = -1;
1304
 
                QMap<double, uint> tmpGuidesSel;
1305
 
                Guides tmpGuides = m_doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
1306
 
                Guides::iterator it;
1307
 
                uint yg = 0;
1308
 
                uint xg = 0;
1309
 
                double lowX = ((m->x() - m_doc->guidesSettings.grabRad) / m_canvas->scale()) + 0*m_doc->minCanvasCoordinate.x();
1310
 
                double highX = ((m->x() + m_doc->guidesSettings.grabRad) / m_canvas->scale()) + 0*m_doc->minCanvasCoordinate.x();
1311
 
                double lowY = ((m->y() - m_doc->guidesSettings.grabRad) / m_canvas->scale()) + 0*m_doc->minCanvasCoordinate.y();
1312
 
                double highY = ((m->y() + m_doc->guidesSettings.grabRad) / m_canvas->scale()) + 0*m_doc->minCanvasCoordinate.y();
1313
 
                for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
1314
 
                {
1315
 
                        if (((*it) + m_doc->currentPage()->yOffset() < highY) && ((*it)+m_doc->currentPage()->yOffset() > lowY))
1316
 
                                tmpGuidesSel.insert(fabs(((*it)+m_doc->currentPage()->yOffset()) - MypS), yg);
1317
 
                }
1318
 
                if (tmpGuidesSel.count() != 0)
1319
 
                {
1320
 
                        GyM = tmpGuidesSel.begin().value();
1321
 
                        QPoint py = m_view->viewport()->mapFromGlobal(m->globalPos());
1322
 
                        m_view->DrHY = py.y();
1323
 
                }
1324
 
                tmpGuidesSel.clear();
1325
 
                tmpGuides = m_doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
1326
 
                for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
1327
 
                {
1328
 
                        if (((*it) + m_doc->currentPage()->xOffset() < highX) && ((*it)+m_doc->currentPage()->xOffset() > lowX))
1329
 
                                tmpGuidesSel.insert(fabs(((*it)+m_doc->currentPage()->xOffset()) - MypS), xg);
1330
 
                }
1331
 
                if (tmpGuidesSel.count() != 0)
1332
 
                {
1333
 
                        GxM = tmpGuidesSel.begin().value();
1334
 
                        QPoint py = m_view->viewport()->mapFromGlobal(m->globalPos());
1335
 
                        m_view->DrVX = py.x();
1336
 
                }
1337
 
                if (GxM!=-1 || GyM!=-1)
1338
 
                {
1339
 
                        if (GxM==-1)
1340
 
                        {
1341
 
                                // Horizontal Guide
1342
 
                                MoveGY = true;
1343
 
//FIXME:av                              emit signalGuideInformation(0, qRound(m_doc->currentPage()->guides.horizontal(GyM, GuideManagerCore::Standard) * 10000.0) / 10000.0);
1344
 
                        }
1345
 
                        else
1346
 
                        {
1347
 
                                // Vertical Guide
1348
 
                                MoveGX = true;
1349
 
//FIXME:av                              emit signalGuideInformation(1, qRound(m_doc->currentPage()->guides.vertical(GxM, GuideManagerCore::Standard) * 10000.0) / 10000.0);
1350
 
                        }
1351
 
                }
1352
 
                */
1353
1289
        }
1354
1290
        //m_doc->m_Selection->setIsGUISelection(true);
1355
1291
        m_doc->m_Selection->connectItemToGUI();