diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 94f0710e..23b45123 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -316,7 +316,11 @@ int UBApplication::exec(const QString& pFileToImport) UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); - applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); + applicationController = new UBApplicationController(boardController->controlView(), + boardController->displayView(), + mainWindow, + staticMemoryCleaner, + boardController->paletteManager()->rightPalette()); connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)), diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index c0f9918a..8719a655 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -59,8 +59,11 @@ #include "core/memcheck.h" -UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, - UBMainWindow* pMainWindow, QObject* parent) +UBApplicationController::UBApplicationController(UBBoardView *pControlView, + UBBoardView *pDisplayView, + UBMainWindow* pMainWindow, + QObject* parent, + UBRightPalette* rightPalette) : QObject(parent) , mMainWindow(pMainWindow) , mControlView(pControlView) @@ -75,7 +78,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo { mDisplayManager = new UBDisplayManager(this); - mUninoteController = new UBDesktopAnnotationController(this); + mUninoteController = new UBDesktopAnnotationController(this, rightPalette); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), this, SLOT(screenLayoutChanged())); connect(mDisplayManager, SIGNAL(screenLayoutChanged()), mUninoteController, SLOT(screenLayoutChanged())); diff --git a/src/core/UBApplicationController.h b/src/core/UBApplicationController.h index 88688d2d..7d2e7bfd 100644 --- a/src/core/UBApplicationController.h +++ b/src/core/UBApplicationController.h @@ -31,6 +31,7 @@ class UBSoftwareUpdate; class QNetworkAccessManager; class QNetworkReply; class QHttp; +class UBRightPalette; class UBApplicationController : public QObject @@ -39,7 +40,7 @@ class UBApplicationController : public QObject public: - UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent = 0); + UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent, UBRightPalette* rightPalette); virtual ~UBApplicationController(); int initialHScroll() { return mInitialHScroll; } diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index b95b433d..e7ffce51 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -47,7 +47,7 @@ #include "core/memcheck.h" -UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) +UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette) : QObject(parent) , mTransparentDrawingView(0) , mTransparentDrawingScene(0) @@ -86,7 +86,9 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingView->setScene(mTransparentDrawingScene); mTransparentDrawingScene->setDrawingMode(true); - mDesktopPalette = new UBDesktopPalette(NULL); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette + mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView, rightPalette); + // This was not fix, parent reverted + // FIX #633: The palette must be 'floating' in order to stay on top of the library palette if (UBPlatformUtils::hasVirtualKeyboard()) { diff --git a/src/desktop/UBDesktopAnnotationController.h b/src/desktop/UBDesktopAnnotationController.h index c98b2466..5e8c9e08 100644 --- a/src/desktop/UBDesktopAnnotationController.h +++ b/src/desktop/UBDesktopAnnotationController.h @@ -29,8 +29,8 @@ class UBDesktopPenPalette; class UBDesktopMarkerPalette; class UBDesktopEraserPalette; class UBActionPalette; -//class UBKeyboardPalette; class UBMainWindow; +class UBRightPalette; #define PROPERTY_PALETTE_TIMER 1000 @@ -47,7 +47,7 @@ class UBDesktopAnnotationController : public QObject Q_OBJECT; public: - UBDesktopAnnotationController(QObject *parent = 0); + UBDesktopAnnotationController(QObject *parent, UBRightPalette* rightPalette); virtual ~UBDesktopAnnotationController(); void showWindow(); void hideWindow(); diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 2b3902b2..01b6581b 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -21,10 +21,11 @@ #include "core/memcheck.h" -UBDesktopPalette::UBDesktopPalette(QWidget *parent) +UBDesktopPalette::UBDesktopPalette(QWidget *parent, UBRightPalette* _rightPalette) : UBActionPalette(Qt::TopLeftCorner, parent) - , mShowHideAction(0) - , mDisplaySelectAction(0) + , rightPalette(_rightPalette) + , mShowHideAction(0) + , mDisplaySelectAction(0) { QList actions; @@ -72,6 +73,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) connect(this, SIGNAL(maximizeStart()), this, SLOT(maximizeMe())); connect(this, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(minimizeMe(eMinimizedLocation))); setMinimizePermission(true); + + connect(rightPalette, SIGNAL(resized()), this, SLOT(parentResized())); } @@ -217,3 +220,14 @@ QPoint UBDesktopPalette::buttonPos(QAction *action) return p; } + + +int UBDesktopPalette::getParentWidth(QWidget *parent) +{ + return parent->width() - rightPalette->width(); +} + +void UBDesktopPalette::parentResized() +{ + moveInsideParent(pos()); +} \ No newline at end of file diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index cd22d43e..19a439c1 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -12,6 +12,7 @@ #include #include "gui/UBActionPalette.h" +#include "gui/UBRightPalette.h" /** * The uninotes window. This window is controlled by UBUninotesWindowController. @@ -21,7 +22,7 @@ class UBDesktopPalette : public UBActionPalette Q_OBJECT; public: - UBDesktopPalette(QWidget *parent = 0); + UBDesktopPalette(QWidget *parent, UBRightPalette* rightPalette); virtual ~UBDesktopPalette(); void disappearForCapture(); @@ -41,17 +42,19 @@ class UBDesktopPalette : public UBActionPalette public slots: void showHideClick(bool checked); - void updateShowHideState(bool pShowEnabled); void setShowHideButtonVisible(bool visible); void setDisplaySelectButtonVisible(bool show); - void minimizeMe(eMinimizedLocation location); + void minimizeMe(eMinimizedLocation location); void maximizeMe(); + void parentResized(); protected: void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); + int getParentWidth(QWidget *parent); + private: QAction *mShowHideAction; QAction *mDisplaySelectAction; @@ -60,6 +63,9 @@ protected: QAction *mActionCustomSelect; QAction* mActionTest; + + UBRightPalette* rightPalette; + signals: void stylusToolChanged(int tool); diff --git a/src/domain/UBGraphicsItemUndoCommand.cpp b/src/domain/UBGraphicsItemUndoCommand.cpp index c8637242..be716a5e 100644 --- a/src/domain/UBGraphicsItemUndoCommand.cpp +++ b/src/domain/UBGraphicsItemUndoCommand.cpp @@ -112,8 +112,8 @@ void UBGraphicsItemUndoCommand::undo() } QMapIterator curMapElement(mExcludedFromGroup); - UBGraphicsGroupContainerItem *nextGroup = 0; - UBGraphicsGroupContainerItem *previousGroupItem; + UBGraphicsGroupContainerItem *nextGroup = NULL; + UBGraphicsGroupContainerItem *previousGroupItem = NULL; bool groupChanged = false; while (curMapElement.hasNext()) { @@ -157,8 +157,8 @@ void UBGraphicsItemUndoCommand::redo() } QMapIterator curMapElement(mExcludedFromGroup); - UBGraphicsGroupContainerItem *nextGroup = 0; - UBGraphicsGroupContainerItem *previousGroupItem; + UBGraphicsGroupContainerItem *nextGroup = NULL; + UBGraphicsGroupContainerItem *previousGroupItem = NULL; bool groupChanged = false; while (curMapElement.hasNext()) { diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp index 6be397c7..5027173b 100644 --- a/src/gui/UBFloatingPalette.cpp +++ b/src/gui/UBFloatingPalette.cpp @@ -129,6 +129,11 @@ void UBFloatingPalette::mouseReleaseEvent(QMouseEvent *event) } } +int UBFloatingPalette::getParentWidth(QWidget *parent) +{ + return parent->width(); +} + void UBFloatingPalette::moveInsideParent(const QPoint &position) { QWidget *parent = parentWidget(); @@ -136,7 +141,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position) if (parent) { int margin = UBSettings::boardMargin - border(); - qreal newX = qMax(margin, qMin(parent->width() - width() - margin, position.x())); + qreal newX = qMax(margin, qMin(getParentWidth(parent) - width() - margin, position.x())); qreal newY = qMax(margin, qMin(parent->height() - height() - margin, position.y())); if (!mCustomPosition && !mIsMoving) @@ -147,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position) } else { - newX = qMax(margin, parent->width() - width() - margin); + newX = qMax(margin, getParentWidth(parent) - width() - margin); } } move(newX, newY); diff --git a/src/gui/UBFloatingPalette.h b/src/gui/UBFloatingPalette.h index 0ddc6ade..2503af46 100644 --- a/src/gui/UBFloatingPalette.h +++ b/src/gui/UBFloatingPalette.h @@ -63,6 +63,8 @@ class UBFloatingPalette : public QWidget bool mCustomPosition; bool mIsMoving; + virtual int getParentWidth(QWidget *parent); + private: void removeAllAssociatedPalette(); void minimizePalette(const QPoint& pos);