diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp
index 3a0cff16..547be184 100644
--- a/src/desktop/UBDesktopAnnotationController.cpp
+++ b/src/desktop/UBDesktopAnnotationController.cpp
@@ -38,9 +38,7 @@
#include "UBCustomCaptureWindow.h"
#include "UBWindowCapture.h"
#include "UBDesktopPalette.h"
-#include "UBDesktopPenPalette.h"
-#include "UBDesktopMarkerPalette.h"
-#include "UBDesktopEraserPalette.h"
+#include "UBDesktopPropertyPalette.h"
#include "gui/UBKeyboardPalette.h"
#include "gui/UBResources.h"
@@ -55,6 +53,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
, mDesktopPenPalette(NULL)
, mDesktopMarkerPalette(NULL)
, mDesktopEraserPalette(NULL)
+ , mRightPalette(rightPalette)
, mWindowPositionInitialized(0)
, mIsFullyTransparent(false)
, mDesktopToolsPalettePositioned(false)
@@ -121,13 +120,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
connect(UBDrawingController::drawingController(), SIGNAL(stylusToolChanged(int)), this, SLOT(stylusToolChanged(int)));
// Add the desktop associated palettes
- mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette
+ mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView, rightPalette);
connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized()));
connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), mDesktopPenPalette, SLOT(onParentMinimized()));
- mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette
- mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView); // FIX #633: The palette must be 'floating' in order to stay on top of the library palette
+ mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView, rightPalette);
+ mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView, rightPalette);
mDesktopPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
mDesktopPenPalette->setBackgroundBrush(UBSettings::settings()->opaquePaletteColor);
@@ -161,36 +160,12 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
//mDesktopEraserPalette->raise();
//mDesktopMarkerPalette->raise();
//mDesktopPenPalette->raise();
- //mDesktopPalette->raise();
}
UBDesktopAnnotationController::~UBDesktopAnnotationController()
{
delete mTransparentDrawingScene;
delete mTransparentDrawingView;
-
- /*
- if(NULL != mDesktopPenPalette)
- {
- delete mDesktopPalette;
- mDesktopPenPalette = NULL;
- }
- if(NULL != mDesktopMarkerPalette)
- {
- delete mDesktopMarkerPalette;
- mDesktopMarkerPalette = NULL;
- }
- if(NULL != mDesktopEraserPalette)
- {
- delete mDesktopEraserPalette;
- mDesktopEraserPalette = NULL;
- }
- if(NULL != mRightPalette)
- {
- delete mRightPalette;
- mRightPalette = NULL;
- }
- */
}
@@ -257,7 +232,7 @@ void UBDesktopAnnotationController::setAssociatedPalettePosition(UBActionPalette
}
// First determine if the palette must be shown on the left or on the right
- if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + 20))) // we take a small margin of 20 pixels
+ if(desktopPalettePos.x() <= (mTransparentDrawingView->width() - (palette->width() + mDesktopPalette->width() + mRightPalette->width() + 20))) // we take a small margin of 20 pixels
{
// Display it on the right
desktopPalettePos += QPoint(mDesktopPalette->width(), yPen);
diff --git a/src/desktop/UBDesktopEraserPalette.cpp b/src/desktop/UBDesktopEraserPalette.cpp
deleted file mode 100644
index aeb615ee..00000000
--- a/src/desktop/UBDesktopEraserPalette.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#include "UBDesktopEraserPalette.h"
-
-#include "core/UBApplication.h"
-#include "core/UBSettings.h"
-#include "board/UBBoardController.h"
-#include "board/UBDrawingController.h"
-#include "gui/UBMainWindow.h"
-#include "gui/UBToolbarButtonGroup.h"
-
-
-#include "core/memcheck.h"
-
-UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent)
- : UBPropertyPalette(Qt::Horizontal, parent)
-{
- // Setup eraser width choice widget
- QList eraserWidthActions;
- eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall);
- eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium);
- eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge);
-
- UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions);
-
- connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int)));
- connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
- connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close()));
-
- eraserWidthChoice->displayText(false);
- eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex());
-
- layout()->addWidget(eraserWidthChoice);
-
- addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations);
-}
diff --git a/src/desktop/UBDesktopEraserPalette.h b/src/desktop/UBDesktopEraserPalette.h
deleted file mode 100644
index 846b1c4c..00000000
--- a/src/desktop/UBDesktopEraserPalette.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#ifndef UBDESKTOPERASERPALETTE_H
-#define UBDESKTOPERASERPALETTE_H
-
-#include
-
-#include "gui/UBPropertyPalette.h"
-
-class UBDesktopEraserPalette : public UBPropertyPalette
-{
- public:
- UBDesktopEraserPalette(QWidget *parent = 0);
- virtual ~UBDesktopEraserPalette(){}
-};
-
-#endif // UBDESKTOPERASERPALETTE_H
diff --git a/src/desktop/UBDesktopMarkerPalette.cpp b/src/desktop/UBDesktopMarkerPalette.cpp
deleted file mode 100644
index b2189987..00000000
--- a/src/desktop/UBDesktopMarkerPalette.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#include "UBDesktopMarkerPalette.h"
-
-#include "core/UBApplication.h"
-#include "board/UBBoardController.h"
-#include "board/UBDrawingController.h"
-#include "gui/UBMainWindow.h"
-#include "gui/UBToolbarButtonGroup.h"
-
-#include "core/memcheck.h"
-
-UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent)
- : UBPropertyPalette(Qt::Horizontal, parent)
-{
- // Setup color choice widget
- QList colorActions;
- colorActions.append(UBApplication::mainWindow->actionColor0);
- colorActions.append(UBApplication::mainWindow->actionColor1);
- colorActions.append(UBApplication::mainWindow->actionColor2);
- colorActions.append(UBApplication::mainWindow->actionColor3);
-
- UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
- colorChoice->displayText(false);
-
- //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
- connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
- connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
-
- layout()->addWidget(colorChoice);
-
- // Setup line width choice widget
- QList lineWidthActions;
- lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
- lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
- lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
-
- UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
- lineWidthChoice->displayText(false);
-
- connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
- connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
- connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
-
- layout()->addWidget(lineWidthChoice);
-}
diff --git a/src/desktop/UBDesktopMarkerPalette.h b/src/desktop/UBDesktopMarkerPalette.h
deleted file mode 100644
index 7918a81e..00000000
--- a/src/desktop/UBDesktopMarkerPalette.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#ifndef UBDESKTOPMARKERPALETTE_H
-#define UBDESKTOPMARKERPALETTE_H
-
-#include
-
-#include "gui/UBPropertyPalette.h"
-
-class UBDesktopMarkerPalette : public UBPropertyPalette
-{
- public:
- UBDesktopMarkerPalette(QWidget *parent = 0);
- virtual ~UBDesktopMarkerPalette(){}
-};
-
-#endif // UBDESKTOPMARKERPALETTE_H
diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp
index 01b6581b..25bbad61 100644
--- a/src/desktop/UBDesktopPalette.cpp
+++ b/src/desktop/UBDesktopPalette.cpp
@@ -112,6 +112,9 @@ void UBDesktopPalette::updateShowHideState(bool pShowEnabled)
mShowHideAction->setToolTip(tr("Show Board on Secondary Screen"));
else
mShowHideAction->setToolTip(tr("Show Desktop on Secondary Screen"));
+
+ if (pShowEnabled)
+ raise();
}
@@ -222,12 +225,18 @@ QPoint UBDesktopPalette::buttonPos(QAction *action)
}
-int UBDesktopPalette::getParentWidth(QWidget *parent)
+int UBDesktopPalette::getParentRightOffset()
{
- return parent->width() - rightPalette->width();
+ return rightPalette->width();
}
void UBDesktopPalette::parentResized()
{
- moveInsideParent(pos());
+ QPoint p = pos();
+ if (minimizedLocation() == eMinimizedLocation_Right)
+ {
+ p.setX(parentWidget()->width() - getParentRightOffset() -width());
+ }
+
+ moveInsideParent(p);
}
\ No newline at end of file
diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h
index 19a439c1..aaa47273 100644
--- a/src/desktop/UBDesktopPalette.h
+++ b/src/desktop/UBDesktopPalette.h
@@ -53,7 +53,7 @@ protected:
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
- int getParentWidth(QWidget *parent);
+ virtual int getParentRightOffset();
private:
QAction *mShowHideAction;
diff --git a/src/desktop/UBDesktopPenPalette.cpp b/src/desktop/UBDesktopPenPalette.cpp
deleted file mode 100644
index 10af7ab0..00000000
--- a/src/desktop/UBDesktopPenPalette.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-#include "UBDesktopPenPalette.h"
-
-#include "core/UBApplication.h"
-#include "board/UBBoardController.h"
-#include "board/UBDrawingController.h"
-#include "gui/UBMainWindow.h"
-#include "gui/UBToolbarButtonGroup.h"
-
-#include "core/memcheck.h"
-
-UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent)
- : UBPropertyPalette(Qt::Horizontal, parent)
-{
- // Setup color choice widget
- QList colorActions;
- colorActions.append(UBApplication::mainWindow->actionColor0);
- colorActions.append(UBApplication::mainWindow->actionColor1);
- colorActions.append(UBApplication::mainWindow->actionColor2);
- colorActions.append(UBApplication::mainWindow->actionColor3);
-
- UBToolbarButtonGroup *colorChoice =
- new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
-
- colorChoice->displayText(false);
-
- //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
- connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
- connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
-
- layout()->addWidget(colorChoice);
-
- // Setup line width choice widget
- QList lineWidthActions;
- lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
- lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
- lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
-
- UBToolbarButtonGroup *lineWidthChoice =
- new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
- lineWidthChoice->displayText(false);
-
- connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
- connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
- connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
- connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
-
- onParentMaximized();
-
- layout()->addWidget(lineWidthChoice);
-}
-
-void UBDesktopPenPalette::onButtonReleased()
-{
- qDebug() << "Pen palette released!";
- // trigger the related action
-
-
- // Close the palette
- close();
-}
-
-/**
- * \brief Disconnect the released event of the buttons
- */
-void UBDesktopPenPalette::onParentMinimized()
-{
- for(int i = 0; i < mButtons.size(); i++)
- {
- disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
- }
-}
-
-/**
- * \brief Connect the released event of the buttons
- */
-void UBDesktopPenPalette::onParentMaximized()
-{
- for(int i = 0; i < mButtons.size(); i++)
- {
- connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
- }
-}
-
-void UBDesktopPenPalette::resizeEvent(QResizeEvent *)
-{
- qDebug("pen palette resized!");
-}
diff --git a/src/desktop/UBDesktopPropertyPalette.cpp b/src/desktop/UBDesktopPropertyPalette.cpp
new file mode 100644
index 00000000..e694e7f3
--- /dev/null
+++ b/src/desktop/UBDesktopPropertyPalette.cpp
@@ -0,0 +1,170 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include "UBDesktopPropertyPalette.h"
+
+#include "core/UBApplication.h"
+#include "board/UBBoardController.h"
+#include "board/UBDrawingController.h"
+#include "gui/UBMainWindow.h"
+#include "gui/UBToolbarButtonGroup.h"
+#include "gui/UBRightPalette.h"
+
+#include "core/memcheck.h"
+
+UBDesktopPropertyPalette::UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette)
+ :UBPropertyPalette(Qt::Horizontal, parent)
+ ,rightPalette(_rightPalette)
+{}
+
+int UBDesktopPropertyPalette::getParentRightOffset()
+{
+ return rightPalette->width();
+}
+
+
+UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette)
+ : UBDesktopPropertyPalette(parent, rightPalette)
+{
+ // Setup color choice widget
+ QList colorActions;
+ colorActions.append(UBApplication::mainWindow->actionColor0);
+ colorActions.append(UBApplication::mainWindow->actionColor1);
+ colorActions.append(UBApplication::mainWindow->actionColor2);
+ colorActions.append(UBApplication::mainWindow->actionColor3);
+
+ UBToolbarButtonGroup *colorChoice =
+ new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
+
+ colorChoice->displayText(false);
+
+ //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
+
+ layout()->addWidget(colorChoice);
+
+ // Setup line width choice widget
+ QList lineWidthActions;
+ lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
+ lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
+ lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
+
+ UBToolbarButtonGroup *lineWidthChoice =
+ new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
+ lineWidthChoice->displayText(false);
+
+ connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
+ connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
+ connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
+
+ onParentMaximized();
+
+ layout()->addWidget(lineWidthChoice);
+}
+
+
+void UBDesktopPenPalette::onButtonReleased()
+{
+ close();
+}
+
+/**
+ * \brief Disconnect the released event of the buttons
+ */
+void UBDesktopPenPalette::onParentMinimized()
+{
+ for(int i = 0; i < mButtons.size(); i++)
+ {
+ disconnect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
+ }
+}
+
+/**
+ * \brief Connect the released event of the buttons
+ */
+void UBDesktopPenPalette::onParentMaximized()
+{
+ for(int i = 0; i < mButtons.size(); i++)
+ {
+ connect(mButtons.at(i), SIGNAL(released()), this, SLOT(onButtonReleased()));
+ }
+}
+
+
+UBDesktopEraserPalette::UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette)
+ : UBDesktopPropertyPalette(parent, rightPalette)
+{
+ // Setup eraser width choice widget
+ QList eraserWidthActions;
+ eraserWidthActions.append(UBApplication::mainWindow->actionEraserSmall);
+ eraserWidthActions.append(UBApplication::mainWindow->actionEraserMedium);
+ eraserWidthActions.append(UBApplication::mainWindow->actionEraserLarge);
+
+ UBToolbarButtonGroup *eraserWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, eraserWidthActions);
+
+ connect(eraserWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setEraserWidthIndex(int)));
+ connect(eraserWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
+ connect(UBApplication::mainWindow->actionEraseDesktopAnnotations, SIGNAL(triggered()), this, SLOT(close()));
+
+ eraserWidthChoice->displayText(false);
+ eraserWidthChoice->setCurrentIndex(UBSettings::settings()->eraserWidthIndex());
+
+ layout()->addWidget(eraserWidthChoice);
+
+ addAction(UBApplication::mainWindow->actionEraseDesktopAnnotations);
+}
+
+
+UBDesktopMarkerPalette::UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette)
+ : UBDesktopPropertyPalette(parent, rightPalette)
+{
+ // Setup color choice widget
+ QList colorActions;
+ colorActions.append(UBApplication::mainWindow->actionColor0);
+ colorActions.append(UBApplication::mainWindow->actionColor1);
+ colorActions.append(UBApplication::mainWindow->actionColor2);
+ colorActions.append(UBApplication::mainWindow->actionColor3);
+
+ UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions);
+ colorChoice->displayText(false);
+
+ //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close()));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged()));
+ connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close()));
+
+ layout()->addWidget(colorChoice);
+
+ // Setup line width choice widget
+ QList lineWidthActions;
+ lineWidthActions.append(UBApplication::mainWindow->actionLineSmall);
+ lineWidthActions.append(UBApplication::mainWindow->actionLineMedium);
+ lineWidthActions.append(UBApplication::mainWindow->actionLineLarge);
+
+ UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions);
+ lineWidthChoice->displayText(false);
+
+ connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int)));
+ connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close()));
+ connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int)));
+ connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close()));
+
+ layout()->addWidget(lineWidthChoice);
+}
+
diff --git a/src/desktop/UBDesktopPenPalette.h b/src/desktop/UBDesktopPropertyPalette.h
similarity index 55%
rename from src/desktop/UBDesktopPenPalette.h
rename to src/desktop/UBDesktopPropertyPalette.h
index 6ed2c2ee..0a8bb138 100644
--- a/src/desktop/UBDesktopPenPalette.h
+++ b/src/desktop/UBDesktopPropertyPalette.h
@@ -20,22 +20,48 @@
#include "gui/UBPropertyPalette.h"
-class UBDesktopPenPalette : public UBPropertyPalette
+class UBRightPalette;
+
+class UBDesktopPropertyPalette : public UBPropertyPalette
{
Q_OBJECT
+
public:
- UBDesktopPenPalette(QWidget *parent = 0);
- virtual ~UBDesktopPenPalette(){}
+ UBDesktopPropertyPalette(QWidget *parent, UBRightPalette* _rightPalette);
+ private:
+ UBRightPalette* rightPalette;
+ protected:
+ virtual int getParentRightOffset();
+};
+class UBDesktopPenPalette : public UBDesktopPropertyPalette
+{
+ Q_OBJECT
+ public:
+ UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette);
+ virtual ~UBDesktopPenPalette(){}
public slots:
void onParentMinimized();
void onParentMaximized();
- protected:
- void resizeEvent(QResizeEvent *);
-
private slots:
void onButtonReleased();
+
+};
+
+class UBDesktopEraserPalette : public UBDesktopPropertyPalette
+{
+ public:
+ UBDesktopEraserPalette(QWidget *parent, UBRightPalette* rightPalette);
+ virtual ~UBDesktopEraserPalette(){}
};
+class UBDesktopMarkerPalette : public UBDesktopPropertyPalette
+{
+ public:
+ UBDesktopMarkerPalette(QWidget *parent, UBRightPalette* rightPalette);
+ virtual ~UBDesktopMarkerPalette(){}
+};
+
+
#endif // UBDESKTOPPENPALETTE_H
diff --git a/src/desktop/desktop.pri b/src/desktop/desktop.pri
index d17410a2..5fb3934e 100644
--- a/src/desktop/desktop.pri
+++ b/src/desktop/desktop.pri
@@ -2,16 +2,12 @@ HEADERS += src/desktop/UBDesktopPalette.h \
src/desktop/UBDesktopAnnotationController.h \
src/desktop/UBCustomCaptureWindow.h \
src/desktop/UBWindowCapture.h \
- src/desktop/UBDesktopPenPalette.h \
- src/desktop/UBDesktopMarkerPalette.h \
- src/desktop/UBDesktopEraserPalette.h
+ src/desktop/UBDesktopPropertyPalette.h
SOURCES += src/desktop/UBDesktopPalette.cpp \
src/desktop/UBDesktopAnnotationController.cpp \
src/desktop/UBCustomCaptureWindow.cpp \
- src/desktop/UBDesktopPenPalette.cpp \
- src/desktop/UBDesktopMarkerPalette.cpp \
- src/desktop/UBDesktopEraserPalette.cpp
+ src/desktop/UBDesktopPropertyPalette.cpp
win32 {
HEADERS += src/desktop/UBWindowCaptureDelegate_win.h
diff --git a/src/gui/UBFloatingPalette.cpp b/src/gui/UBFloatingPalette.cpp
index 5027173b..e52893b2 100644
--- a/src/gui/UBFloatingPalette.cpp
+++ b/src/gui/UBFloatingPalette.cpp
@@ -129,9 +129,9 @@ void UBFloatingPalette::mouseReleaseEvent(QMouseEvent *event)
}
}
-int UBFloatingPalette::getParentWidth(QWidget *parent)
+int UBFloatingPalette::getParentRightOffset()
{
- return parent->width();
+ return 0;
}
void UBFloatingPalette::moveInsideParent(const QPoint &position)
@@ -141,7 +141,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
if (parent)
{
int margin = UBSettings::boardMargin - border();
- qreal newX = qMax(margin, qMin(getParentWidth(parent) - width() - margin, position.x()));
+ qreal newX = qMax(margin, qMin(parent->width() - getParentRightOffset() - width() - margin, position.x()));
qreal newY = qMax(margin, qMin(parent->height() - height() - margin, position.y()));
if (!mCustomPosition && !mIsMoving)
@@ -152,7 +152,7 @@ void UBFloatingPalette::moveInsideParent(const QPoint &position)
}
else
{
- newX = qMax(margin, getParentWidth(parent) - width() - margin);
+ newX = qMax(margin, parent->width() - getParentRightOffset() - width() - margin);
}
}
move(newX, newY);
@@ -265,7 +265,6 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
return;
}
- QSize parentSize = parentWidget()->size();
if(mMinimizedLocation == eMinimizedLocation_None)
{
// Verify if we have to minimize this palette
@@ -277,7 +276,7 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
// {
// mMinimizedLocation = eMinimizedLocation_Top;
// }
- else if(pos.x() == parentSize.width() - width() - 5)
+ else if(pos.x() == parentWidget()->width() - getParentRightOffset() - width() - 5)
{
mMinimizedLocation = eMinimizedLocation_Right;
}
@@ -297,8 +296,8 @@ void UBFloatingPalette::minimizePalette(const QPoint& pos)
// Restore the palette
if(pos.x() > 5 &&
pos.y() > 5 &&
- pos.x() < parentSize.width() - width() - 5 &&
- pos.y() < parentSize.height() - height() - 5)
+ pos.x() < parentWidget()->width() - getParentRightOffset() - width() - 5 &&
+ pos.y() < parentWidget()->size().height() - height() - 5)
{
mMinimizedLocation = eMinimizedLocation_None;
emit maximizeStart();
diff --git a/src/gui/UBFloatingPalette.h b/src/gui/UBFloatingPalette.h
index 2503af46..2f670b8f 100644
--- a/src/gui/UBFloatingPalette.h
+++ b/src/gui/UBFloatingPalette.h
@@ -63,7 +63,9 @@ class UBFloatingPalette : public QWidget
bool mCustomPosition;
bool mIsMoving;
- virtual int getParentWidth(QWidget *parent);
+ virtual int getParentRightOffset();
+
+ eMinimizedLocation minimizedLocation(){return mMinimizedLocation;}
private:
void removeAllAssociatedPalette();
diff --git a/src/gui/UBPropertyPalette.cpp b/src/gui/UBPropertyPalette.cpp
index 643f87a7..8d587c99 100644
--- a/src/gui/UBPropertyPalette.cpp
+++ b/src/gui/UBPropertyPalette.cpp
@@ -25,7 +25,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction
{
setObjectName(name);
mbGrip = false;
- setMaximumHeight(MAX_HEIGHT);
}
/**
@@ -36,7 +35,6 @@ UBPropertyPalette::UBPropertyPalette(QWidget *parent, const char *name):UBAction
UBPropertyPalette::UBPropertyPalette(Qt::Orientation orientation, QWidget *parent):UBActionPalette(orientation, parent)
{
mbGrip = false;
- setMaximumHeight(MAX_HEIGHT);
}
/**
diff --git a/src/gui/UBPropertyPalette.h b/src/gui/UBPropertyPalette.h
index 47bacf13..777e976e 100644
--- a/src/gui/UBPropertyPalette.h
+++ b/src/gui/UBPropertyPalette.h
@@ -20,8 +20,6 @@
#include "UBActionPalette.h"
-#define MAX_HEIGHT 20
-
class UBPropertyPalette : public UBActionPalette
{
Q_OBJECT