diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 460fdb0c..08d609bf 100755 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -76,6 +76,8 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll , mpPageNavigWidget(NULL) , mpLibWidget(NULL) , mpCachePropWidget(NULL) + , mDesktopRightPalette(NULL) + , mpDesktopLibWidget(NULL) { setupPalettes(); connectPalettes(); @@ -117,6 +119,17 @@ UBBoardPaletteManager::~UBBoardPaletteManager() delete mStylusPalette; mStylusPalette = NULL; } + + if(NULL != mpDesktopLibWidget) + { + delete mpDesktopLibWidget; + mpDesktopLibWidget = NULL; + } + if(NULL != mDesktopRightPalette) + { + delete mDesktopRightPalette; + mDesktopRightPalette = NULL; + } } void UBBoardPaletteManager::initPalettesPosAtStartup() @@ -693,3 +706,14 @@ void UBBoardPaletteManager::changeStylusPaletteOrientation(QVariant var) connect(mStylusPalette, SIGNAL(stylusToolDoubleClicked(int)), UBApplication::boardController, SLOT(stylusToolDoubleClicked(int))); mStylusPalette->setVisible(bVisible); // always show stylus palette at startup } + +UBRightPalette* UBBoardPaletteManager::createDesktopRightPalette(QWidget* parent) +{ + mpDesktopLibWidget = new UBLibWidget(); + mDesktopRightPalette = new UBRightPalette(parent); + mDesktopRightPalette->registerWidget(mpDesktopLibWidget); + mDesktopRightPalette->addTabWidget(mpDesktopLibWidget); + mDesktopRightPalette->connectSignals(); + + return mDesktopRightPalette; +} diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index a4d0e08e..4ca00fd7 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -51,6 +51,7 @@ class UBBoardPaletteManager : public QObject void initPalettesPosAtStartup(); UBKeyboardPalette *mKeyboardPalette; + UBRightPalette* createDesktopRightPalette(QWidget* parent); public slots: @@ -78,6 +79,11 @@ class UBBoardPaletteManager : public QObject /** The right dock palette */ UBRightPalette* mRightPalette; + // HACK: here we duplicate the right palette for the desktop mode + // we MUST refactor the architecture in order to use only one + // right palette! + UBRightPalette* mDesktopRightPalette; + UBActionPalette *mBackgroundsPalette; UBActionPalette *mToolsPalette; UBActionPalette* mAddItemPalette; @@ -108,6 +114,11 @@ class UBBoardPaletteManager : public QObject /** The cache properties widget */ UBCachePropertiesWidget* mpCachePropWidget; + // HACK: here we duplicate the lib widget for the desktop mode + // we MUST refactor the architecture in order to use only one + // lib widget! + UBLibWidget* mpDesktopLibWidget; + private slots: void changeBackground(); diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 063359fc..90424d31 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -31,6 +31,7 @@ #include "board/UBBoardView.h" #include "board/UBDrawingController.h" #include "board/UBBoardController.h" +#include "board/UBBoardPaletteManager.h" #include "domain/UBGraphicsScene.h" @@ -87,7 +88,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingScene = new UBGraphicsScene(0); mTransparentDrawingView->setScene(mTransparentDrawingScene); - mRightPalette = new UBRightPalette(mTransparentDrawingView); + mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView); + //mRightPalette = new UBRightPalette(mTransparentDrawingView); mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView); @@ -810,6 +812,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent) } if(mRightPalette->isVisible()) { + qDebug() << ">>>>>> Drawing the mask for the right palette"; p.drawRect(mRightPalette->geometry().x(), mRightPalette->geometry().y(), mRightPalette->width(), mRightPalette->height()); } diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 7e0e49fe..ca66ec4c 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -167,6 +167,9 @@ void UBDockPalette::mouseMoveEvent(QMouseEvent *event) resize(parentWidget()->width() - (this->x() + p.x()), height()); mResized = true; } + + qDebug() << ">>>>> UBRightPalette x=" << this->x() << ", y=" << this->y(); + break; case eUBDockOrientation_Top: case eUBDockOrientation_Bottom: