From fcbca14450ec09ebb4826fb293b8a3a1b6babc56 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Thu, 1 Sep 2011 17:55:41 +0300 Subject: [PATCH] SANKORE-92 Magnifier --- resources/images/close.svg | 3 +- resources/images/cursors/magnifier.png | Bin 4692 -> 0 bytes resources/images/decrease.svg | 9 + resources/images/increase.svg | 9 + resources/images/stylusPalette/magnifier.png | Bin 2071 -> 0 bytes .../images/stylusPalette/magnifierOn.png | Bin 2802 -> 0 bytes .../images/toolPalette/magnifierTool.png | Bin 0 -> 8250 bytes .../images/toolbar/largeMagnifierSize.png | Bin 476 -> 0 bytes .../images/toolbar/largeMagnifierZoom.png | Bin 270 -> 0 bytes .../images/toolbar/mediumMagnifierSize.png | Bin 396 -> 0 bytes .../images/toolbar/mediumMagnifierZoom.png | Bin 300 -> 0 bytes .../images/toolbar/smallMagnifierSize.png | Bin 272 -> 0 bytes .../images/toolbar/smallMagnifierZoom.png | Bin 295 -> 0 bytes resources/sankore.qrc | 12 +- src/board/UBBoardController.cpp | 48 +-- src/board/UBBoardController.h | 5 + src/board/UBBoardView.cpp | 3 - src/board/UBDrawingController.cpp | 24 -- src/board/UBDrawingController.h | 3 - src/core/UB.h | 3 +- src/core/UBSettings.cpp | 164 -------- src/core/UBSettings.h | 26 +- src/domain/UBGraphicsScene.cpp | 175 ++++++--- src/domain/UBGraphicsScene.h | 21 +- src/gui/UBMagnifer.cpp | 355 +++++++++++++++--- src/gui/UBMagnifer.h | 82 ++-- src/gui/UBStylusPalette.cpp | 1 - src/tools/UBToolsManager.cpp | 13 +- src/tools/UBToolsManager.h | 2 +- 29 files changed, 517 insertions(+), 441 deletions(-) delete mode 100644 resources/images/cursors/magnifier.png create mode 100644 resources/images/decrease.svg create mode 100644 resources/images/increase.svg delete mode 100644 resources/images/stylusPalette/magnifier.png delete mode 100644 resources/images/stylusPalette/magnifierOn.png create mode 100644 resources/images/toolPalette/magnifierTool.png delete mode 100644 resources/images/toolbar/largeMagnifierSize.png delete mode 100644 resources/images/toolbar/largeMagnifierZoom.png delete mode 100644 resources/images/toolbar/mediumMagnifierSize.png delete mode 100644 resources/images/toolbar/mediumMagnifierZoom.png delete mode 100644 resources/images/toolbar/smallMagnifierSize.png delete mode 100644 resources/images/toolbar/smallMagnifierZoom.png diff --git a/resources/images/close.svg b/resources/images/close.svg index 5fa855a2..f552d322 100644 --- a/resources/images/close.svg +++ b/resources/images/close.svg @@ -5,6 +5,5 @@ width="26px" height="26px" viewBox="0 0 26 26" style="enable-background:new 0 0 26 26;" xml:space="preserve"> - + diff --git a/resources/images/cursors/magnifier.png b/resources/images/cursors/magnifier.png deleted file mode 100644 index f2decb01f10ee9c513db63cce88b205a243672ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4692 zcmV-a607ZrP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wF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kRotQET$|wl40o?`$EJ#klEek%Ly=K^Pgj3WNX>kdTms zz>)-Je?L6L?J?aR57iv%%>G1z0LwhI7TD1j6HlPXLlg7zB_K zuxtql4BZ5ZQ4mT&7z1-qIEkh>7-g1i!-_s zvy0rJbiCW?FUh?>Xdpre{B$Vpk^x}D0NFSU126_@r6E)X+7k;GH8nNeH4LK_fH88@ z7-N`7Ip@9Cu3r0iS?R1L{m~Y`Vt|=IyKbOQFsPIcoqi+)Gz&wAj1vjQbwHPTZcR<~ zw7RA*M z5TH%1HOtR@cCtAViJS+}F|O7SLNJk1N}*|5!{6WC^0#Ma<$jMCk@bnLIOi1212$?I z1!EM-SWjeojg%QkRY1m4u@{dWKH|A};nGn6)d22~tAurRcOKh{Yie%)qrAL))#|lt zeiiO(RFm$|L8U0KYLHn=;-Ki5UP0XjEO>#d5fhwUmy=~%n-R>CIz|R0fHJZl>r)nf|OyG)Yjc9 z-M43_e(=DdimtA%LjZ1!O};UeP#YZ7^l0IjCex%RgNNT{ebTV1c+S=m2Qdw!8J#*$-RaMnN%eF58sK=0p9vw*1X#-BD ziexecT?f)>8=5AdC>)F_;GAy`1pL29B)U;^>sC)i#RnC!SnR~%!$)V7ghH?T3i3;x zE~hV@G4yCp_pL~K``t*mt;)3Rn*ip$rM*xOTJ(PGd`y8o+?<`!n=#QyX6b%gx z_Wu3*kH%uL&jHkGnpS)H%9WD|ez}?o?j6@=p+_r7oVbe4(0*H_OPk0Ida(sqZWm&mlbi%SE!r^du>(;Fw0;v41<30}H%{PCF&Q9aKva-^(9#00{-BEbGxr3WG zZ$2_OICvgF51yh>0N^}TURvryM@Iw;7A(S+En7}hS63ec(1@ojeCpH!XKCr;zc`(I zXE0de-?8I^{~S1Q;7GQ1%cl(hzrPT#z4j`mOqudbadGj_0jvYyd)juTl#o*5e**vz WcPh`O*%}1^0000| diff --git a/resources/images/decrease.svg b/resources/images/decrease.svg new file mode 100644 index 00000000..2f81bf5a --- /dev/null +++ b/resources/images/decrease.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/resources/images/increase.svg b/resources/images/increase.svg new file mode 100644 index 00000000..23a4cf44 --- /dev/null +++ b/resources/images/increase.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/resources/images/stylusPalette/magnifier.png b/resources/images/stylusPalette/magnifier.png deleted file mode 100644 index f17b51c72ab62d401ef1b10715749ed2fe03587a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2071 zcmV+y2*;rD@W1G_5A>!?d=FI&JEQN&B)&)3i<6mTFYWmwjkH3`#;?s*04P zSwx%Wtw|OdnuUe%67yC97y|}l9Iy?x&v&=yjDfT&4xrFdDSz?!&i6n5_q*r)&V($> z@Ix3R{6NNI(8r)FebDnw)YQ~0XaRyCKoA6Qtjh!M$cS+~5ZKLesuGS#AW5PW z428VCJ@;A-2E&EQ$|H4lyFKn|YlAivNs_*{-Z#HL6m&5IQyhhxw`^AH?>UXZJ`st* zcvSF%L`DdimPt-!U%z?PK0=KAasU1|zPNn(%HI&^;v>=MLI++@^K{WuRf8jepMT!a z?#W!6dt>!#o7bi@jO%$m$}o&1h$0yZhIs#|Z>^2dZT(et_Jy;beDaRV<@(EvRhA7@ zDHI5)-L|E$roDIQ#q!hF&Tjk3kB6TrE+)0SD$Edx#S;jMcUaQ25nE2C-!~TPbhqCw zE`6!=&tgn49XWdJces}HFxYuPRh%m2KdMzK$XR16^9DjMzE^$aLr3A$ouxm0&caa0 zF90bbAIQqbT+osPNEs$}Qnh9K7riaFqb0j`{kFTOr?0i8_25__@aUsnDY~*GJa(B#<=1awuvBm&bXXDUHrplY4LdI!8%e-Hj(`nr>P&XjWEcsv9iy1tute zDBhdDXOGz)6vkP1bAFAt3>(_%7Bgh>@~PL}C#VBR`TVxaS3Jy?b|FP*D^+_x)@= z$&zuC9G+wdGaHJgww1#x?ttr5Bw?DaDEA5lkcgTQ_fgyv>=jWy05MWd)#66$3E=#+3Z2Xfh!)rYDoo zD71)ZyN8Z!WQq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CcQ3R1Sn5!)Wg`Z%03I+bH}c8N>Bcu+f6dM33JYh>oQXgAhh^V!XLgBEZxNcA{76bG1bIR5C z-}i2R{&{ZSzJ2j$UwJNj^ytxbP19UqEk98YTkI-PR>IxFUfmPg5}wA~dStI%n;vdy z+0|PtrpWBfOr=yZ7QS=#+0^pVQuyt^z1303=NjRxfCc5fSt%D}Mb&$IdU7wn@=9TJ zbX4!{?X94fi@PY-nYMh&IC7%XSoX(+6L^c@`pJIu(Wm<~E%r#Mv;tP0@#g2}lV{JK zO`kY%g6XOF{0lFn^ZC4-N~KiRsssW7HyVvPO-)Ts2-=f6&MK0W1(GS;?HbWMTOaTZ z-;7DY+{-OXZr+^jHqGFOrs-s9DM4=Cn#qifjU^8qI#d!Z9*e~shA$B5{4*`lnji4N zgoGM3aB^V@Rkk<`t4>8`XYY0-ljX--TVA&_DnW@xC6K@^wOIyu&@wsnVwFL4Ggp>i;HsvG-)p^EF?~!KAqXUd$;uvBt?Tr zLU(ZqhiYX`)WM+7CKP`H=z=Dz^=dl3(tPF0%-Hz&-oU+kvqVu;GC4V!I(hPBQiy?H z)slR4sR-Q#o0$9^IaPam-o#nxOiZ|c6|SF(cK+IwDc7)is;}&0M}b)zRA8 z1wB{=2(FN(re+tmd<`dY*exr^_-b1{4C)+axQ-~Xbgr(b*f?SHV2Ge0pg!7@rfh_PSC*zqFZ55m~d z^j~YoLGHP8=MF<>_yUx5<4-*C1nuhTa{u3h+?___tao`1vscJxnVme}^EHkobeew( zBgV2|$sI@ITRm(DqP7^}9>8h9A)NkwnTHKam{cxeFn_3r4Lb#A?i9?@eSo9bZnxpA zNG#Eo0V{yJfU6Jn_~vVTAg21Bl(@pg#eCQYV*e9h06okWL&gNUVgLXD07*qoM6N<$ Eg3lINI{*Lx diff --git a/resources/images/toolPalette/magnifierTool.png b/resources/images/toolPalette/magnifierTool.png new file mode 100644 index 0000000000000000000000000000000000000000..a0a19206af7eea82d074379ecf3f082070968175 GIT binary patch literal 8250 zcmV-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A2j3Fry{rNYg`CYT!|?)o-3tXN^B>N}KA*#asymx;%cj z92+^+U`f%-*Kz#aw~%O#+vk0zlHz=iA3K7-`N22k+-Kfh!j{jv|1g#sxHE%|nVSK) zYtM3w9Kmekpz*eQZuy%y3x@lL;qkfP3wo!u*w$18T|GTGdEyi_R}dW^{2VV)vNb?6 zgBR8L6hyZC(Gv4RR%&1)uapSO0g~xl5y^#a*#K^z=E!FbRV|H=^_@sSwNk@yItQ26 zCCA3Qyi-Rk?5J7WH<7Gdz0rrhfnoUcGF;6e>BHfT%xwMPp#PyNF^_;><4hJy06GsjMW5QY&>|IF{6& z{_HCp1#I&Q7N*xukrW~-D)^I_&7axL?u>II39Dep zo^s}V=iXuNr9uc2)KRIl%9QA?;QsRPi~_szJ@<6KSiB5+=@6EX21@iW64lp|+4;C; zOpi>xcAYd{Z(Du0d%->TK!)^2umt14BIS5$)=JMTDdZo0JY9RO+M~^VZ%YQW01suG zCy8_}H4a4KeIlK=&_CcbU0>H?)@C-pqLK-uCo;6#eA6rEXLle|cFfG2K|%=q$bsN| zLDiFCSb~1!fD1py6g3pgA}ZnBHvlN>_?{CA_WKS2U~QlPRj1ns1*0E1kdsrk-|yRD zVDuvg^0O=Mm;F$CzTuOA=tDnpgCUVAg{Dlazf{FI5bv8mRSSP-+mwHI9GxIUD4tp>f{0t^62tHG>; Sg4Zhm0000F|c>h}RM;YmtuLlOHz=UAb1mW6%6|8&}pUqbYXGM-mP?o=#SF?ldViD*NEYJ{3 qp!}VGe}C^lwh^ypx?~K100RK`oq&ytKqU$Q0000 z2)Y5X0wcf(g$-Z?I|8i03XFi)U8B({3?f2InVJp(&X}B@}z8xFuJElE# zZY&bcjQtbN$P4^Gy<1(OSNN2-_bJY-HZ~dg30+M^(;1mx2_L*5Cv{R-;Q+(NT94;! TZx_A?x}L$))z4*}Q$iB}Q;24J diff --git a/resources/images/toolbar/smallMagnifierZoom.png b/resources/images/toolbar/smallMagnifierZoom.png deleted file mode 100644 index df7f8d56dfc35230352343db885104ebbb4315fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^{2~ zP~M`vMZ1JWl2QJovSN!wQoYBg*4@*}k27aIkNNuABE-7w$G6XyzANteDdMrA$$Eyj zRrN!LxCP8&KKmwU2>kA2vzhVxT>b*DBgRKxZfLsa=A&y-6xXoq#jFmtyt^#t6AyY6 z-Bsz<65Ez|dz!r1v)E(bC%gJ5c)yQyE1WHuC3g2xb>5BxA55IZz5ClfT59d;dLhtM r?j0}uxoxM{nis$F^Q))-P(HvQo@5fZEmP|s&{GVau6{1-oD!Mimages/uniboard.png images/bigUniboard.png images/close.svg + images/increase.svg + images/decrease.svg images/resize.svg images/play.svg images/pause.svg @@ -121,12 +123,6 @@ images/toolbar/eraserTool.png images/toolbar/lineTool.png images/toolbar/tools.png - images/toolbar/largeMagnifierSize.png - images/toolbar/mediumMagnifierSize.png - images/toolbar/smallMagnifierSize.png - images/toolbar/largeMagnifierZoom.png - images/toolbar/mediumMagnifierZoom.png - images/toolbar/smallMagnifierZoom.png images/stylusPalette/arrow.png images/stylusPalette/arrowOn.png images/stylusPalette/eraser.png @@ -150,8 +146,6 @@ images/stylusPalette/textOn.png images/stylusPalette/captureArea.png images/stylusPalette/captureAreaOn.png - images/stylusPalette/magnifier.png - images/stylusPalette/magnifierOn.png images/backgroundPalette/background1.svg images/backgroundPalette/background1On.svg images/backgroundPalette/background2.svg @@ -167,6 +161,7 @@ images/toolPalette/protractorTool.png images/toolPalette/compassTool.png images/toolPalette/maskTool.png + images/toolPalette/magnifierTool.png images/extraPalette/blackout.png images/extraPalette/keyboard.png images/extraPalette/trapFlash.png @@ -185,7 +180,6 @@ images/cursors/resize.png images/cursors/drawCompass.png images/cursors/drawRulerLine.png - images/cursors/magnifier.png images/print/onepage.png images/print/thumbnails.png images/print/twopages.png diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index c037db93..43c9088c 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -36,6 +36,7 @@ #include "gui/UBMainWindow.h" #include "gui/UBToolWidget.h" #include "gui/UBKeyboardPalette.h" +#include "gui/UBMagnifer.h" #include "domain/UBGraphicsPixmapItem.h" #include "domain/UBGraphicsItemUndoCommand.h" @@ -312,42 +313,6 @@ void UBBoardController::setupToolbar() //-----------------------------------------------------------// - QList magnifierZoomActions; - magnifierZoomActions.append(mMainWindow->actionMagnifierZoomSmall); - magnifierZoomActions.append(mMainWindow->actionMagnifierZoomMedium); - magnifierZoomActions.append(mMainWindow->actionMagnifierZoomLarge); - - UBToolbarButtonGroup *magnifierZoomChoice = - new UBToolbarButtonGroup(mMainWindow->boardToolBar, magnifierZoomActions); - - mMainWindow->boardToolBar->insertWidget(mMainWindow->actionBackgrounds, magnifierZoomChoice); - - connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), magnifierZoomChoice, SLOT(displayText(QVariant))); - connect(magnifierZoomChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setMagnifierZoomIndex(int))); - - magnifierZoomChoice->displayText(QVariant(settings->appToolBarDisplayText->get().toBool())); - magnifierZoomChoice->setCurrentIndex(settings->magnifierZoomIndex()); - - QList magnifierSizeActions; - magnifierSizeActions.append(mMainWindow->actionMagnifierSizeSmall); - magnifierSizeActions.append(mMainWindow->actionMagnifierSizeMedium); - magnifierSizeActions.append(mMainWindow->actionMagnifierSizeLarge); - - UBToolbarButtonGroup *magnifierSizeChoice = - new UBToolbarButtonGroup(mMainWindow->boardToolBar, magnifierSizeActions); - - mMainWindow->boardToolBar->insertWidget(mMainWindow->actionBackgrounds, magnifierSizeChoice); - - connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), magnifierSizeChoice, SLOT(displayText(QVariant))); - connect(magnifierSizeChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setMagnifierSizeIndex(int))); - - magnifierSizeChoice->displayText(QVariant(settings->appToolBarDisplayText->get().toBool())); - magnifierSizeChoice->setCurrentIndex(settings->magnifierSizeIndex()); - - mMainWindow->boardToolBar->insertSeparator(mMainWindow->actionBackgrounds); - - //-----------------------------------------------------------// - UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->boardToolBar, mMainWindow->actionBoard); UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->tutorialToolBar, mMainWindow->actionBoard); @@ -1056,9 +1021,14 @@ void UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QString mActiveScene->addTriangle(pPos); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } - else if(sourceUrl.toString() == UBToolsManager::manager()->cache.id) + else if (sourceUrl.toString() == UBToolsManager::manager()->magnifier.id) { - mActiveScene->addCache(); + UBMagnifierParams params; + params.x = controlContainer()->geometry().width() / 2; + params.y = controlContainer()->geometry().height() / 2; + params.zoom = 2; + params.sizePercentFromScene = 20; + mActiveScene->addMagnifier(params); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); } else if (sourceUrl.toString() == UBToolsManager::manager()->mask.id) @@ -1179,7 +1149,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, } // Notify the navigator palette that the document has changed - mPaletteManager->leftPalette()->pageNavigator()->setDocument(pDocumentProxy); + mPaletteManager->leftPalette()->pageNavigator()->setDocument(pDocumentProxy); if (sceneChange) emit activeSceneChanged(); diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index 5e1e0260..ebcffb33 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -81,6 +81,11 @@ class UBBoardController : public QObject return mDisplayView; } + UBGraphicsScene* activeScene() + { + return mActiveScene; + } + void setPenColorOnDarkBackground(const QColor& pColor) { if (mPenColorOnDarkBackground == pColor) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index d38df42c..c7d18ea5 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -857,9 +857,6 @@ UBBoardView::setToolCursor (int tool) case UBStylusTool::Eraser: controlViewport->setCursor (UBResources::resources ()->eraserCursor); break; - case UBStylusTool::Magnifier: - controlViewport->setCursor (UBResources::resources ()->magnifierCursor); - break; case UBStylusTool::Marker: controlViewport->setCursor (UBResources::resources ()->markerCursor); break; diff --git a/src/board/UBDrawingController.cpp b/src/board/UBDrawingController.cpp index 61196338..5d170470 100644 --- a/src/board/UBDrawingController.cpp +++ b/src/board/UBDrawingController.cpp @@ -44,7 +44,6 @@ UBDrawingController::UBDrawingController(QObject * parent) connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(penToolSelected(bool))); connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(eraserToolSelected(bool))); - connect(UBApplication::mainWindow->actionMagnifier, SIGNAL(triggered(bool)), this, SLOT(magnifierToolSelected(bool))); connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(markerToolSelected(bool))); connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(selectorToolSelected(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(handToolSelected(bool))); @@ -103,8 +102,6 @@ void UBDrawingController::setStylusTool(int tool) UBApplication::mainWindow->actionPen->setChecked(true); else if (mStylusTool == UBStylusTool::Eraser) UBApplication::mainWindow->actionEraser->setChecked(true); - else if (mStylusTool == UBStylusTool::Magnifier) - UBApplication::mainWindow->actionMagnifier->setChecked(true); else if (mStylusTool == UBStylusTool::Marker) UBApplication::mainWindow->actionMarker->setChecked(true); else if (mStylusTool == UBStylusTool::Selector) @@ -265,21 +262,6 @@ void UBDrawingController::setEraserWidthIndex(int index) UBSettings::settings()->setEraserWidthIndex(index); } - -void UBDrawingController::setMagnifierZoomIndex(int index) -{ - setStylusTool(UBStylusTool::Magnifier); - UBSettings::settings()->setMagnifierZoomIndex(index); -} - - -void UBDrawingController::setMagnifierSizeIndex(int index) -{ - setStylusTool(UBStylusTool::Magnifier); - UBSettings::settings()->setMagnifierSizeIndex(index); -} - - void UBDrawingController::setPenColor(bool onDarkBackground, const QColor& color, int pIndex) { if (onDarkBackground) @@ -340,12 +322,6 @@ void UBDrawingController::eraserToolSelected(bool checked) setStylusTool(UBStylusTool::Eraser); } -void UBDrawingController::magnifierToolSelected(bool checked) -{ - if (checked) - setStylusTool(UBStylusTool::Magnifier); -} - void UBDrawingController::markerToolSelected(bool checked) { if (checked) diff --git a/src/board/UBDrawingController.h b/src/board/UBDrawingController.h index 2e4e4394..2f6e8f3e 100644 --- a/src/board/UBDrawingController.h +++ b/src/board/UBDrawingController.h @@ -57,8 +57,6 @@ class UBDrawingController : public QObject void setLineWidthIndex(int index); void setColorIndex(int index); void setEraserWidthIndex(int index); - void setMagnifierZoomIndex(int index); - void setMagnifierSizeIndex(int index); signals: void stylusToolChanged(int tool); @@ -77,7 +75,6 @@ class UBDrawingController : public QObject void penToolSelected(bool checked); void eraserToolSelected(bool checked); - void magnifierToolSelected(bool checked); void markerToolSelected(bool checked); void selectorToolSelected(bool checked); void handToolSelected(bool checked); diff --git a/src/core/UB.h b/src/core/UB.h index 72fed56e..07ae8ecc 100644 --- a/src/core/UB.h +++ b/src/core/UB.h @@ -26,8 +26,7 @@ struct UBStylusTool { Pen = 0, Eraser, - Magnifier, - Marker, + Marker, Selector, Hand, ZoomIn, diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 2e8997b6..373b22b9 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -624,170 +624,6 @@ qreal UBSettings::currentEraserWidth() return width; } -//----------------------------------------// -// magnifier - -//-------------// -// zoom index - -int UBSettings::magnifierZoomIndex() -{ - return value("Board/MagnifierZoomIndex", 1).toInt(); -} - -void UBSettings::setMagnifierZoomIndex(int index) -{ - setValue("Board/MagnifierZoomIndex", index); -} - -//-------------// -// small zoom - -qreal UBSettings::magnifierSmallZoom() -{ - return value("Board/MagnifierSmallZoom", 2).toDouble(); -} - -void UBSettings::setMagnifierSmallZoom(qreal xZoom) -{ - setValue("Board/MagnifierSmallZoom", xZoom); -} - -//-------------// -// medium zoom - -qreal UBSettings::magnifierMediumZoom() -{ - return value("Board/MagnifierMediumZoom", 3).toDouble(); -} - -void UBSettings::setMagnifierMediumZoom(qreal xZoom) -{ - setValue("Board/MagnifierMediumZoom", xZoom); -} - -//-------------// -// large zoom - -qreal UBSettings::magnifierLargeZoom() -{ - return value("Board/MagnifierLargeZoom", 4).toDouble(); -} - -void UBSettings::setMagnifierLargeZoom(qreal xZoom) -{ - setValue("Board/MagnifierLargeZoom", xZoom); -} - -//-------------// - -qreal UBSettings::currentMagnifierZoom() -{ - qreal zoom = 0; - - switch (magnifierZoomIndex()) - { - case UBZoom::Small: - zoom = magnifierSmallZoom(); - break; - case UBZoom::Medium: - zoom = magnifierMediumZoom(); - break; - case UBZoom::Large: - zoom = magnifierLargeZoom(); - break; - default: - Q_ASSERT(false); - //failsafe - zoom = magnifierSmallZoom(); - break; - } - - return zoom; -} - -//-------------// -// size index - -int UBSettings::magnifierSizeIndex() -{ - return value("Board/MagnifierSizeIndex", 1).toInt(); -} - -void UBSettings::setMagnifierSizeIndex(int index) -{ - setValue("Board/MagnifierSizeIndex", index); -} - -//-------------// -// small zoom - -qreal UBSettings::magnifierSmallSize() -{ - return value("Board/MagnifierSmallSize", 10).toDouble(); -} - -void UBSettings::setMagnifierSmallSize(qreal xSize) -{ - setValue("Board/MagnifierSmallSize", xSize); -} - -//-------------// -// medium zoom - -qreal UBSettings::magnifierMediumSize() -{ - return value("Board/MagnifierMediumSize", 20).toDouble(); -} - -void UBSettings::setMagnifierMediumSize(qreal xSize) -{ - setValue("Board/MagnifierMediumSize", xSize); -} - -//-------------// -// large zoom - -qreal UBSettings::magnifierLargeSize() -{ - return value("Board/MagnifierLargeSize", 30).toDouble(); -} - -void UBSettings::setMagnifierLargeSize(qreal xSize) -{ - setValue("Board/MagnifierLargeSize", xSize); -} - -//-------------// - -qreal UBSettings::currentMagnifierSize() -{ - qreal size = 0; - - switch (magnifierSizeIndex()) - { - case UBSize::Small: - size = magnifierSmallSize(); - break; - case UBSize::Medium: - size = magnifierMediumSize(); - break; - case UBSize::Large: - size = magnifierLargeSize(); - break; - default: - Q_ASSERT(false); - //failsafe - size = magnifierSmallSize(); - break; - } - - return size; -} - -//----------------------------------------// - - bool UBSettings::isDarkBackground() { return value("Board/DarkBackground", 0).toBool(); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 67afc057..6b7a8961 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -66,19 +66,6 @@ class UBSettings : public QObject qreal eraserStrongWidth(); qreal currentEraserWidth(); - // Magnifier related - int magnifierZoomIndex(); - qreal magnifierSmallZoom(); - qreal magnifierMediumZoom(); - qreal magnifierLargeZoom(); - qreal currentMagnifierZoom(); - - int magnifierSizeIndex(); - qreal magnifierSmallSize(); - qreal magnifierMediumSize(); - qreal magnifierLargeSize(); - qreal currentMagnifierSize(); - // Background related bool isDarkBackground(); bool isCrossedBackground(); @@ -360,18 +347,7 @@ class UBSettings : public QObject void setEraserMediumWidth(qreal width); void setEraserStrongWidth(qreal width); - void setMagnifierZoomIndex(int index); - void setMagnifierSmallZoom(qreal xZoom); - void setMagnifierMediumZoom(qreal xZoom); - void setMagnifierLargeZoom(qreal xZoom); - - void setMagnifierSizeIndex(int index); - void setMagnifierSmallSize(qreal xSize); - void setMagnifierMediumSize(qreal xSize); - void setMagnifierLargeSize(qreal xSize); - - - void setStylusPaletteVisible(bool visible); + void setStylusPaletteVisible(bool visible); void setPenPressureSensitive(bool sensitive); void setMarkerPressureSensitive(bool sensitive); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 33e430ba..f908c9e6 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -36,7 +36,6 @@ #include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsTriangle.h" #include "tools/UBGraphicsCurtainItem.h" -#include "tools/UBGraphicsCache.h" #include "document/UBDocumentProxy.h" @@ -71,7 +70,6 @@ qreal UBGraphicsScene::toolOffsetProtractor = 100; qreal UBGraphicsScene::toolOffsetTriangle = 100; qreal UBGraphicsScene::toolOffsetCompass = 100; qreal UBGraphicsScene::toolOffsetEraser = 200; -qreal UBGraphicsScene::toolOffsetCache = 1000; qreal UBGraphicsScene::toolOffsetCurtain = 1000; qreal UBGraphicsScene::toolOffsetPointer = 1100; @@ -138,13 +136,13 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) } connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); - mHasCache = false; } UBGraphicsScene::~UBGraphicsScene() { // NOOP + DisposeMagnifierQWidgets(); } void UBGraphicsScene::selectionChangedProcessing() @@ -238,15 +236,6 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre drawPointer(scenePos); accepted = true; } - else if (currentTool == UBStylusTool::Magnifier) - { - CreateMagnifierQWidgets(); - magniferControlViewWidget->grabNMove(QCursor::pos(), true); - magniferDisplayViewWidget->grabNMove(scenePos, true); - magniferControlViewWidget->show(); - magniferDisplayViewWidget->show(); - accepted = true; - } } return accepted; @@ -320,11 +309,6 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres { drawPointer(position); } - else if (currentTool == UBStylusTool::Magnifier) - { - magniferControlViewWidget->grabNMove(QCursor::pos(), false); - magniferDisplayViewWidget->grabNMove(position, false); - } accepted = true; } @@ -363,13 +347,7 @@ bool UBGraphicsScene::inputDeviceRelease() { mCurrentStroke = 0; } - else - if (currentTool == UBStylusTool::Magnifier) - { - DisposeMagnifierQWidgets(); - //qDebug() << "deleted"; - } - + if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) { UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack @@ -425,24 +403,6 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint) } } -// call this function when user press mouse button in Magnifier mode -void UBGraphicsScene::CreateMagnifierQWidgets() -{ - UBApplication::app()->setOverrideCursor( QCursor( Qt::BlankCursor ) ); - - magniferControlViewWidget = new UBMagnifer((QWidget*)(UBApplication::boardController->controlContainer())); - magniferControlViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView()); - magniferControlViewWidget->setMoveView((QGraphicsView*)UBApplication::boardController->controlContainer()); - magniferControlViewWidget->setSize(UBSettings::settings()->currentMagnifierSize()); - magniferControlViewWidget->setZoom(UBSettings::settings()->currentMagnifierZoom()); - - magniferDisplayViewWidget = new UBMagnifer((QWidget*)(UBApplication::boardController->displayView())); - magniferDisplayViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView()); - magniferDisplayViewWidget->setMoveView((QGraphicsView*)UBApplication::boardController->displayView()); - magniferDisplayViewWidget->setSize(UBSettings::settings()->currentMagnifierSize()); - magniferDisplayViewWidget->setZoom(UBSettings::settings()->currentMagnifierZoom()); -} - // call this function when user release mouse button in Magnifier mode void UBGraphicsScene::DisposeMagnifierQWidgets() { @@ -1536,6 +1496,119 @@ void UBGraphicsScene::addTriangle(QPointF center) setModified(true); } +void UBGraphicsScene::addMagnifier(UBMagnifierParams params) +{ + // can have only one magnifier at one time + if(magniferControlViewWidget) return; + + QWidget *cContainer = (QWidget*)(UBApplication::boardController->controlContainer()); + QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView(); + QGraphicsView *dView = (QGraphicsView*)UBApplication::boardController->displayView(); + + QPoint ccZeroPoint = cContainer->mapToGlobal(QPoint(0,0)); + QPoint cvZeroPoint = cView->mapToGlobal(QPoint(0,0)); + QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); + + int cvW = cView->width(); + int dvW = dView->width(); + qreal wCoeff = (qreal)dvW / (qreal)cvW; + + int cvH = cView->height(); + int dvH = dView->height(); + qreal hCoeff = (qreal)dvH / (qreal)cvH; + + QPoint ccPoint(params.x,params.y); + QPoint globalPoint = cContainer->mapToGlobal(ccPoint); + QPoint cvPoint = cView->mapFromGlobal(globalPoint); + QPoint dvPoint( cvPoint.x() * wCoeff + dvZeroPoint.x(), cvPoint.y() * hCoeff + dvZeroPoint.y()); + + magniferControlViewWidget = new UBMagnifier((QWidget*)(UBApplication::boardController->controlContainer()), true); + magniferControlViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView()); + magniferControlViewWidget->setMoveView((QWidget*)(UBApplication::boardController->controlContainer())); + magniferControlViewWidget->setSize(params.sizePercentFromScene); + magniferControlViewWidget->setZoom(params.zoom); + + magniferDisplayViewWidget = new UBMagnifier((QWidget*)(UBApplication::boardController->displayView()), false); + magniferDisplayViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView()); + magniferDisplayViewWidget->setMoveView((QGraphicsView*)UBApplication::boardController->displayView()); + magniferDisplayViewWidget->setSize(params.sizePercentFromScene); + magniferDisplayViewWidget->setZoom(params.zoom); + + magniferControlViewWidget->grabNMove(globalPoint, globalPoint, true); + magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, true); + magniferControlViewWidget->show(); + magniferDisplayViewWidget->show(); + + connect(magniferControlViewWidget, SIGNAL(magnifierMoved_Signal(QPoint)), this, SLOT(moveMagnifier(QPoint))); + connect(magniferControlViewWidget, SIGNAL(magnifierClose_Signal()), this, SLOT(closeMagnifier())); + connect(magniferControlViewWidget, SIGNAL(magnifierZoomIn_Signal()), this, SLOT(zoomInMagnifier())); + connect(magniferControlViewWidget, SIGNAL(magnifierZoomOut_Signal()), this, SLOT(zoomOutMagnifier())); + connect(magniferControlViewWidget, SIGNAL(magnifierResized_Signal(qreal)), this, SLOT(resizedMagnifier(qreal))); + + setModified(true); +} + +void UBGraphicsScene::moveMagnifier(QPoint newPos) +{ + QWidget *cContainer = (QWidget*)(UBApplication::boardController->controlContainer()); + QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView(); + QGraphicsView *dView = (QGraphicsView*)UBApplication::boardController->displayView(); + + QPoint ccZeroPoint = cContainer->mapToGlobal(QPoint(0,0)); + QPoint cvZeroPoint = cView->mapToGlobal(QPoint(0,0)); + QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0)); + + int cvW = cView->width(); + int dvW = dView->width(); + qreal wCoeff = (qreal)dvW / (qreal)cvW; + + int cvH = cView->height(); + int dvH = dView->height(); + qreal hCoeff = (qreal)dvH / (qreal)cvH; + + QPoint globalPoint = cContainer->mapToGlobal(newPos); + QPoint cvPoint = cView->mapFromGlobal(globalPoint); + QPoint dvPoint( cvPoint.x() * wCoeff + dvZeroPoint.x(), cvPoint.y() * hCoeff + dvZeroPoint.y()); + + magniferControlViewWidget->grabNMove(globalPoint, globalPoint, false, false); + magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, false, true); + + setModified(true); +} + +void UBGraphicsScene::closeMagnifier() +{ + DisposeMagnifierQWidgets(); +} + +void UBGraphicsScene::zoomInMagnifier() +{ + if(magniferControlViewWidget->params.zoom < 8) + { + magniferControlViewWidget->setZoom(magniferControlViewWidget->params.zoom + 0.5); + magniferDisplayViewWidget->setZoom(magniferDisplayViewWidget->params.zoom + 0.5); + } +} + +void UBGraphicsScene::zoomOutMagnifier() +{ + if(magniferControlViewWidget->params.zoom > 1) + { + magniferControlViewWidget->setZoom(magniferControlViewWidget->params.zoom - 0.5); + magniferDisplayViewWidget->setZoom(magniferDisplayViewWidget->params.zoom - 0.5); + } +} + +void UBGraphicsScene::resizedMagnifier(qreal newPercent) +{ + if(newPercent > 18 && newPercent < 50) + { + magniferControlViewWidget->setSize(newPercent); + magniferControlViewWidget->grabPoint(); + magniferDisplayViewWidget->setSize(newPercent); + magniferDisplayViewWidget->grabPoint(); + } +} void UBGraphicsScene::addCompass(QPointF center) { @@ -1553,24 +1626,6 @@ void UBGraphicsScene::addCompass(QPointF center) setModified(true); } -void UBGraphicsScene::addCache() -{ - UBGraphicsCache* cache = new UBGraphicsCache(); - mTools << cache; - QGraphicsView* view; - - if(UBApplication::applicationController->displayManager()->hasDisplay()) - { - view = (QGraphicsView*)(UBApplication::boardController->displayView()); - } - else - { - view = (QGraphicsView*)(UBApplication::boardController->controlView()); - } - addItem(cache); - cache->setVisible(true); - cache->setSelected(true); -} void UBGraphicsScene::addMask() { diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index d1eb1b58..5a5ffe2e 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -44,8 +44,8 @@ class UBAbstractWidget; class UBDocumentProxy; class UBGraphicsCurtainItem; class UBGraphicsStroke; -class UBGraphicsCache; -class UBMagnifer; +class UBMagnifierParams; +class UBMagnifier; const double PI = 4.0 * atan(1.0); @@ -166,10 +166,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem qreal getNextObjectZIndex(); void addRuler(QPointF center); - void addTriangle(QPointF center); void addProtractor(QPointF center); void addCompass(QPointF center); - void addCache(); + void addTriangle(QPointF center); + void addMagnifier(UBMagnifierParams params); void addMask(); @@ -247,7 +247,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem static qreal toolOffsetCompass; static qreal toolOffsetCurtain; static qreal toolOffsetTriangle; - static qreal toolOffsetCache; QSet tools(){ return mTools;} @@ -277,6 +276,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem void selectionChangedProcessing(); + void moveMagnifier(QPoint newPos); + void closeMagnifier(); + void zoomInMagnifier(); + void zoomOutMagnifier(); + void resizedMagnifier(qreal newPercent); signals: @@ -292,7 +296,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem void drawEraser(const QPointF& pEndPoint); void drawPointer(const QPointF& pEndPoint); - void CreateMagnifierQWidgets(); void DisposeMagnifierQWidgets(); @@ -355,10 +358,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem //int mMesure1Ms, mMesure2Ms; - bool mHasCache; - - UBMagnifer *magniferControlViewWidget; - UBMagnifer *magniferDisplayViewWidget; + UBMagnifier *magniferControlViewWidget; + UBMagnifier *magniferDisplayViewWidget; }; #endif /* UBGRAPHICSSCENE_H_ */ diff --git a/src/gui/UBMagnifer.cpp b/src/gui/UBMagnifer.cpp index 0888522e..e36add3f 100644 --- a/src/gui/UBMagnifer.cpp +++ b/src/gui/UBMagnifer.cpp @@ -1,51 +1,124 @@ + +#include #include "UBMagnifer.h" -#include -#include -#include -#include -#include -#include -#include -#include - -UBMagnifer::UBMagnifer(QWidget *parent) - : QWidget(parent) + +#include "core/UBApplication.h" +#include "board/UBBoardController.h" +#include "domain/UBGraphicsScene.h" + +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + + +UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) + : QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)) , gView(0) , mView(0) - , sizePercentFromScene(20) , inTimer(false) , borderPen(Qt::darkGray) + , mShouldMoveWidget(false) + , mShouldResizeWidget(false) + { - borderPen.setWidth(2); + isCusrsorAlreadyStored = false; + setMouseTracking(true); + + //--------------------------------------------------// + + QPixmap pix(":/images/cursors/resize.png"); + QTransform tr; + tr.rotate(45); + mResizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); + + //--------------------------------------------------// + + params.sizePercentFromScene = 20; + m_isInteractive = isInteractive; + sClosePixmap = new QPixmap(":/images/close.svg"); + sIncreasePixmap = new QPixmap(":/images/increase.svg"); + sDecreasePixmap = new QPixmap(":/images/decrease.svg"); + mResizeItem = new QPixmap(":/images/resize.svg"); + + if (parent) + { + setAttribute(Qt::WA_NoMousePropagation); + } + else + { + // standalone window + // !!!! Should be included into Windows after QT recompilation +#ifndef Q_WS_WIN + setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_MacAlwaysShowToolWindow); +#endif +#ifdef Q_WS_MAC + setAttribute(Qt::WA_MacAlwaysShowToolWindow); + setAttribute(Qt::WA_MacNonActivatingToolWindow); + setAttribute(Qt::WA_MacNoShadow); +#endif + } + } -UBMagnifer::~UBMagnifer() +UBMagnifier::~UBMagnifier() { if (timerUpdate != 0) { killTimer(timerUpdate); timerUpdate = 0; } + + if(sClosePixmap) + { + delete sClosePixmap; + sClosePixmap = NULL; + } + + if(sIncreasePixmap) + { + delete sIncreasePixmap; + sIncreasePixmap = NULL; + } + + if(sDecreasePixmap) + { + delete sDecreasePixmap; + sDecreasePixmap = NULL; + } + } -void UBMagnifer::setSize(int percentFromScene) +void UBMagnifier::setSize(qreal percentFromScene) { - if(gView == NULL) return; + if(gView == NULL || mView == NULL) return; // calculate object size - sizePercentFromScene = percentFromScene; - QSize sceneSize = gView->size(); - int size = sizePercentFromScene * sceneSize.width() / 100; + params.sizePercentFromScene = percentFromScene; + QSize sceneSize = mView->size(); + qreal size = params.sizePercentFromScene * sceneSize.width() / 100; - setGeometry(0, 0, size, size); + QRect currGeom = geometry(); + if(currGeom.width() == currGeom.height()) + { + QPoint newPos = mView->mapFromGlobal(updPointMove); + setGeometry(newPos.x() - size / 2, newPos.y() - size / 2, size, size); + } + else + setGeometry(0, 0, size, size); // prepare transparent bit mask QImage mask_img(width(), height(), QImage::Format_Mono); mask_img.fill(0xff); QPainter mask_ptr(&mask_img); mask_ptr.setBrush( QBrush( QColor(0, 0, 0) ) ); - mask_ptr.drawEllipse(QPoint(size/2, size/2), size/2, size/2); + mask_ptr.drawEllipse(QPointF(size/2, size/2), size / 2 - sClosePixmap->width(), size / 2 - sClosePixmap->width()); bmpMask = QBitmap::fromImage(mask_img); // prepare general image @@ -54,49 +127,207 @@ void UBMagnifer::setSize(int percentFromScene) pMap.setMask(bmpMask); } -void UBMagnifer::setZoom(int z) +void UBMagnifier::setZoom(qreal zoom) +{ + params.zoom = zoom; +} + +void UBMagnifier::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); + +// painter.drawRect(0,0,size().width()-1, size().height()-1); + + painter.setRenderHint(QPainter::Antialiasing); + painter.setPen(Qt::NoPen); + + if (m_isInteractive) + { + painter.setBrush(QColor(127, 127, 127, 127)); + painter.drawRoundedRect(QRectF(size().width() / 2, size().height() / 2, ( size().width() - sClosePixmap->width() ) / 2, ( size().height() - sClosePixmap->width() ) / 2), 15, 15); + + painter.setBrush(QColor(190, 190, 190, 255)); + painter.drawEllipse(QPoint( size().width() / 2, size().height() / 2), ( size().width() - sClosePixmap->width() ) / 2, ( size().height() - sClosePixmap->height() ) / 2); + + painter.drawPixmap(size().width() - sClosePixmap->width(), size().height() / 2 + sClosePixmap->height() * 1, *sClosePixmap); + painter.drawPixmap(size().width() - sIncreasePixmap->width(), size().height() / 2 + sIncreasePixmap->height() * 2.5, *sIncreasePixmap); + painter.drawPixmap(size().width() - sDecreasePixmap->width(), size().height() / 2 + sDecreasePixmap->height() * 3.6, *sDecreasePixmap); + + painter.drawPixmap(size().width() - mResizeItem->width() - 20, size().height() - mResizeItem->height() - 20, *mResizeItem); + } + else + { + painter.setBrush(QColor(127, 127, 127, 127)); + painter.drawEllipse(QPoint( size().width() / 2, size().height() / 2), ( size().width() - sClosePixmap->width() ) / 2, ( size().height() - sClosePixmap->height() ) / 2); + } + + painter.drawPixmap(0, 0, pMap); +} + +void UBMagnifier::mousePressEvent ( QMouseEvent * event ) { - zoom = z; + if(m_isInteractive) + { + + QWidget::mousePressEvent(event); + + if (event->pos().x() >= size().width() - mResizeItem->width() - 20 && + event->pos().x() < size().width() - 20 && + event->pos().y() >= size().height() - mResizeItem->height() - 20 && + event->pos().y() < size().height() - - 20) + { + mShouldResizeWidget = true; + } + else + { + mShouldMoveWidget = !event->isAccepted() && (event->buttons() & Qt::LeftButton); + } + + mMousePressPos = event->pos(); + mMousePressDelta = (qreal)updPointGrab.x() + (qreal)size().width() / 2 - (qreal)event->globalPos().x(); + + event->accept(); - zWidth = size().width() / zoom; - zWidthHalf = zWidth / 2; - zHeight = size().height() / zoom; - zHeightHalf = zHeight / 2; + update(); + } + else + event->ignore(); } -void UBMagnifer::paintEvent(QPaintEvent *) +void UBMagnifier::mouseMoveEvent ( QMouseEvent * event ) { - QPainter p(this); - p.drawPixmap(0, 0, pMap); - - // in future replace to image border - QPen pen(Qt::darkGray); - pen.setWidth(2); - p.setPen(borderPen); - p.drawEllipse(QPoint( size().width() / 2, size().height() / 2), size().width() / 2, size().height() / 2); + if(m_isInteractive) + { + if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) + { + QPoint offset = event->pos() - mMousePressPos; + move(pos() - mMousePressPos + event->pos()); + event->accept(); + + QWidget::mouseMoveEvent(event); + emit magnifierMoved_Signal(QPoint(this->pos().x() + size().width() / 2, this->pos().y() + size().height() / 2 )); + return; + } + + if(mShouldResizeWidget && (event->buttons() & Qt::LeftButton)) + { + + QPoint currGlobalPos = event->globalPos(); + qreal cvW = mView->width(); + + qreal newXSize = ( currGlobalPos.x() + mMousePressDelta - updPointGrab.x() ) * 2; + qreal newPercentSize = newXSize * 100 / cvW; + + emit magnifierResized_Signal(newPercentSize); + + event->ignore(); + return; + } + + if (event->pos().x() >= size().width() - mResizeItem->width() - 20 && + event->pos().x() < size().width() - 20 && + event->pos().y() >= size().height() - mResizeItem->height() - 20 && + event->pos().y() < size().height() - - 20 && + isCusrsorAlreadyStored == false + ) + { + mOldCursor = cursor(); + isCusrsorAlreadyStored = true; + setCursor(mResizeCursor); + } + + } + else + event->ignore(); +} + + +void UBMagnifier::mouseReleaseEvent(QMouseEvent * event) +{ + if(m_isInteractive) + { + mShouldMoveWidget = false; + mShouldResizeWidget = false; + + if (event->pos().x() >= size().width() - sClosePixmap->width() && + event->pos().x() < size().width()&& + event->pos().y() >= size().height() / 2 + sClosePixmap->height() * 1 && + event->pos().y() < size().height() / 2 + sClosePixmap->height() * 2) + { + event->accept(); + emit magnifierClose_Signal(); + } + else + if (event->pos().x() >= size().width() - sIncreasePixmap->width() && + event->pos().x() < size().width()&& + event->pos().y() >= size().height() / 2 + sIncreasePixmap->height() * 2.5 && + event->pos().y() < size().height() / 2 + sIncreasePixmap->height() * 3.5) + { + event->accept(); + emit magnifierZoomIn_Signal(); + } + else + if (event->pos().x() >= size().width() - sDecreasePixmap->width() && + event->pos().x() < size().width()&& + event->pos().y() >= size().height() / 2 + sDecreasePixmap->height() * 3.6 && + event->pos().y() < size().height() / 2 + sDecreasePixmap->height() * 4.6) + { + event->accept(); + emit magnifierZoomOut_Signal(); + } + else + QWidget::mouseReleaseEvent(event); // don't propgate to parent, the widget is deleted in UBApplication::boardController->removeTool + } + else + event->ignore(); + } -void UBMagnifer::timerEvent(QTimerEvent *e) +void UBMagnifier::timerEvent(QTimerEvent *e) { if(inTimer) return; if (e->timerId() == timerUpdate) { inTimer = true; - if(!(updPoint.isNull())) grabPoint(updPoint); - if(!(updPointF.isNull()))grabPoint(updPointF); + if(!(updPointGrab.isNull())) + grabPoint(updPointGrab); + + if(isCusrsorAlreadyStored) + { + QPoint globalCursorPos = QCursor::pos(); + QPoint cursorPos = mapFromGlobal(globalCursorPos); + if (cursorPos.x() < size().width() - mResizeItem->width() - 20 || + cursorPos.x() > size().width() - 20 || + cursorPos.y() < size().height() - mResizeItem->height() - 20 || + cursorPos.y() > size().height() - - 20 + ) + { + isCusrsorAlreadyStored = false; + setCursor(mOldCursor); + } + + } + inTimer = false; } } -void UBMagnifer::grabPoint(const QPoint &point) +void UBMagnifier::grabPoint() { - QPointF itemPos = gView->mapFromGlobal(point); + QPointF itemPos = gView->mapFromGlobal(updPointGrab); + + qreal zWidth = size().width() / params.zoom; + qreal zWidthHalf = zWidth / 2; + qreal zHeight = size().height() / params.zoom; + qreal zHeightHalf = zHeight / 2; int x = itemPos.x() - zWidthHalf; int y = itemPos.y() - zHeightHalf; QPixmap newPixMap(QSize(zWidth,zHeight)); ((QWidget*)gView)->render(&newPixMap, QPoint(0, 0), QRegion(x, y, zWidth, zHeight)); + UBApplication::boardController->activeScene()->update(); + pMap.fill(Qt::transparent); pMap = newPixMap.scaled(QSize(width(), height())); pMap.setMask(bmpMask); @@ -104,15 +335,23 @@ void UBMagnifer::grabPoint(const QPoint &point) update(); } -void UBMagnifer::grabPoint(const QPointF &point) +void UBMagnifier::grabPoint(const QPoint &pGrab) { - QPoint itemPos = gView->mapFromScene(point); + updPointGrab = pGrab; + QPointF itemPos = gView->mapFromGlobal(pGrab); + + qreal zWidth = size().width() / params.zoom; + qreal zWidthHalf = zWidth / 2; + qreal zHeight = size().height() / params.zoom; + qreal zHeightHalf = zHeight / 2; int x = itemPos.x() - zWidthHalf; int y = itemPos.y() - zHeightHalf; QPixmap newPixMap(QSize(zWidth,zHeight)); ((QWidget*)gView)->render(&newPixMap, QPoint(0, 0), QRegion(x, y, zWidth, zHeight)); + UBApplication::boardController->activeScene()->update(); + pMap.fill(Qt::transparent); pMap = newPixMap.scaled(QSize(width(), height())); pMap.setMask(bmpMask); @@ -120,32 +359,24 @@ void UBMagnifer::grabPoint(const QPointF &point) update(); } - // from global -void UBMagnifer::grabNMove(const QPoint &point, bool needGrab = true) +void UBMagnifier::grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab, bool needMove) { - updPoint = point; + updPointGrab = pGrab; + updPointMove = pMove; if(needGrab) - grabPoint(point); - QPoint itemPos = mView->mapFromGlobal(point); - move(itemPos.x() - width()/2, itemPos.y() - height()/2); -// move(itemPos.x(), itemPos.y()); -} + grabPoint(pGrab); -// from scene -void UBMagnifer::grabNMove(const QPointF &point, bool needGrab = true) -{ - updPointF = point; - - if(needGrab) - grabPoint(point); - QPoint itemPos = mView->mapFromScene(point); - move(itemPos.x() - width()/2, itemPos.y() - height()/2); -// move(itemPos.x(), itemPos.y()); + if(needMove) + { + QPoint movePos = mView->mapFromGlobal(pMove); + move(movePos.x() - width()/2, movePos.y() - height()/2); + // move(itemPos.x(), itemPos.y()); + } } -void UBMagnifer::setGrabView(QGraphicsView *view) +void UBMagnifier::setGrabView(QWidget *view) { if (timerUpdate != 0) killTimer(timerUpdate); diff --git a/src/gui/UBMagnifer.h b/src/gui/UBMagnifer.h index 435775a3..9032a3cd 100644 --- a/src/gui/UBMagnifer.h +++ b/src/gui/UBMagnifer.h @@ -1,60 +1,82 @@ -#ifndef UBMAGNIFER_H -#define UBMAGNIFER_H +#ifndef UBMAGNIFIER_H +#define UBMAGNIFIER_H -#include -#include -#include +#include -class QPixmap; -class QBitmap; -class QPen; -class QGraphicsView; +class UBMagnifierParams +{ +public : + int x; + int y; + qreal zoom; + qreal sizePercentFromScene; +}; -class UBMagnifer : public QWidget +class UBMagnifier : public QWidget { Q_OBJECT public: - UBMagnifer(QWidget *parent = 0); - ~UBMagnifer(); + UBMagnifier(QWidget *parent = 0, bool isInteractive = false); + ~UBMagnifier(); - void setSize(int percentFromScene); - void setZoom(int z); + void setSize(qreal percentFromScene); + void setZoom(qreal zoom); - void setGrabView(QGraphicsView *view); - void setMoveView(QGraphicsView *view) {mView = view;} + void setGrabView(QWidget *view); + void setMoveView(QWidget *view) {mView = view;} + void grabPoint(); void grabPoint(const QPoint &point); - void grabPoint(const QPointF &point); - void grabNMove(const QPoint &point, bool needGrab); - void grabNMove(const QPointF &point, bool needGrab); + void grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab = true, bool needMove = true); + + UBMagnifierParams params; + +signals: + void magnifierMoved_Signal(QPoint newPos); + void magnifierClose_Signal(); + void magnifierZoomIn_Signal(); + void magnifierZoomOut_Signal(); + void magnifierResized_Signal(qreal newPercentSize); protected: void paintEvent(QPaintEvent *); void timerEvent(QTimerEvent *); - int sizePercentFromScene; + virtual void mousePressEvent ( QMouseEvent * event ); + virtual void mouseMoveEvent ( QMouseEvent * event ); + virtual void mouseReleaseEvent ( QMouseEvent * event ); + + QPoint mMousePressPos; + qreal mMousePressDelta; + bool mShouldMoveWidget; + bool mShouldResizeWidget; + + + QPixmap *sClosePixmap; + QPixmap *sIncreasePixmap; + QPixmap *sDecreasePixmap; + QPixmap *mResizeItem; + bool isCusrsorAlreadyStored; + QCursor mOldCursor; + QCursor mResizeCursor; private: - int zoom; - int zWidth; - int zHeight; - int zWidthHalf; - int zHeightHalf; bool inTimer; + bool m_isInteractive; int timerUpdate; - QPoint updPoint; - QPointF updPointF; + QPoint updPointGrab; + QPoint updPointMove; QPixmap pMap; QBitmap bmpMask; QPen borderPen; - QGraphicsView *gView; - QGraphicsView *mView; + QWidget *gView; + QWidget *mView; }; -#endif // UBMAGNIFER_H +#endif // UBMAGNIFIER_H diff --git a/src/gui/UBStylusPalette.cpp b/src/gui/UBStylusPalette.cpp index 4ae06f4c..93073ccd 100644 --- a/src/gui/UBStylusPalette.cpp +++ b/src/gui/UBStylusPalette.cpp @@ -37,7 +37,6 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient) actions << UBApplication::mainWindow->actionPen; actions << UBApplication::mainWindow->actionEraser; - actions << UBApplication::mainWindow->actionMagnifier; actions << UBApplication::mainWindow->actionMarker; actions << UBApplication::mainWindow->actionSelector; diff --git a/src/tools/UBToolsManager.cpp b/src/tools/UBToolsManager.cpp index 4bbd4f3a..5fb516e8 100644 --- a/src/tools/UBToolsManager.cpp +++ b/src/tools/UBToolsManager.cpp @@ -58,12 +58,13 @@ UBToolsManager::UBToolsManager(QObject *parent) mToolsIcon.insert(triangle.id,":/images/toolPalette/triangleTool.png"); mDescriptors << triangle; -// cache.id = "uniboardTool://uniboard.mnemis.com/cache"; -// cache.icon = QPixmap(":/images/toolPalette/cacheTool.png"); -// cache.label = tr("Cache"); -// cache.version = "1.0"; -// mToolsIcon.insert(cache.id, ":/images/toolPalette/cacheTool.png"); -// mDescriptors << cache; + magnifier.id = "uniboardTool://uniboard.mnemis.com/magnifier"; + magnifier.icon = QPixmap(":/images/toolPalette/magnifierTool.png"); + magnifier.label = tr("Magnifier"); + magnifier.version = "1.0"; + mToolsIcon.insert(magnifier.id,":/images/toolPalette/magnifierTool.png"); + mDescriptors << magnifier; + } UBToolsManager::~UBToolsManager() diff --git a/src/tools/UBToolsManager.h b/src/tools/UBToolsManager.h index 8517822b..df87db8a 100644 --- a/src/tools/UBToolsManager.h +++ b/src/tools/UBToolsManager.h @@ -78,7 +78,7 @@ class UBToolsManager : public QObject UBToolDescriptor compass; UBToolDescriptor mask; UBToolDescriptor triangle; - UBToolDescriptor cache; + UBToolDescriptor magnifier; QString iconFromToolId(QString id) { return mToolsIcon.value(id);}