diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 45f4c262..32d9b211 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -118,6 +118,7 @@ void UBBoardController::init() UBDocumentProxy* doc = UBPersistenceManager::persistenceManager()->createDocument(); setActiveDocumentScene(doc); + undoRedoStateChange(true); } diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 4c71868e..3be40a03 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -92,6 +92,10 @@ UBBoardPaletteManager::~UBBoardPaletteManager() } } +void UBBoardPaletteManager::initPalettesPosAtStartup() +{ + mStylusPalette->initPosition(); +} void UBBoardPaletteManager::setupLayout() { @@ -342,6 +346,7 @@ void UBBoardPaletteManager::containerResized() mStylusPalette->move(userLeft, userTop); mStylusPalette->adjustSizeAndPosition(); + mStylusPalette->initPosition(); mZoomPalette->move(userLeft + userWidth - mZoomPalette->width() , userTop + userHeight /*- mPageNumberPalette->height()*/ - innerMargin - mZoomPalette->height()); diff --git a/src/board/UBBoardPaletteManager.h b/src/board/UBBoardPaletteManager.h index 69924527..ef82b1ac 100644 --- a/src/board/UBBoardPaletteManager.h +++ b/src/board/UBBoardPaletteManager.h @@ -37,6 +37,7 @@ class UBBoardPaletteManager : public QObject void setupLayout(); UBNavigatorPalette* navigatorPalette(){return mNavigPalette;} void showVirtualKeyboard(bool show = true); + void initPalettesPosAtStartup(); public slots: diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 3a907292..6c117f7e 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -167,7 +167,7 @@ void UBSettings::init() appToolBarDisplayText = new UBSetting(this, "App", "ToolBarDisplayText", true); appEnableAutomaticSoftwareUpdates = new UBSetting(this, "App", "EnableAutomaticSoftwareUpdates", true); appEnableSoftwareUpdates = new UBSetting(this, "App", "EnableSoftwareUpdates", true); - appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", true); + appToolBarOrientationVertical = new UBSetting(this, "App", "ToolBarOrientationVertical", false); navigPaletteWidth = new UBSetting(this, "Board", "NavigPaletteWidth", 300); libPaletteWidth = new UBSetting(this, "Board", "LibPaletteWidth", 300); diff --git a/src/gui/UBFloatingPalette.h b/src/gui/UBFloatingPalette.h index 55e991f2..a4b37bfb 100644 --- a/src/gui/UBFloatingPalette.h +++ b/src/gui/UBFloatingPalette.h @@ -57,16 +57,16 @@ class UBFloatingPalette : public QWidget bool mbGrip; static const int sLayoutContentMargin = 12; static const int sLayoutSpacing = 15; + void moveInsideParent(const QPoint &position); + bool mCustomPosition; private: - void moveInsideParent(const QPoint &position); void removeAllAssociatedPalette(); void minimizePalette(const QPoint& pos); QList mAssociatedPalette; QPoint mDragPosition; bool mIsMoving; - bool mCustomPosition; bool mCanBeMinimized; eMinimizedLocation mMinimizedLocation; Qt::Corner mDefaultPosition; diff --git a/src/gui/UBStylusPalette.cpp b/src/gui/UBStylusPalette.cpp index e3e18ef7..3db3c0b8 100644 --- a/src/gui/UBStylusPalette.cpp +++ b/src/gui/UBStylusPalette.cpp @@ -57,6 +57,8 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient) adjustSizeAndPosition(); + initPosition(); + foreach(const UBActionPaletteButton* button, mButtons) { connect(button, SIGNAL(doubleClicked()), this, SLOT(stylusToolDoubleClicked())); @@ -64,6 +66,26 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient) } +void UBStylusPalette::initPosition() +{ + if(!UBSettings::settings()->appToolBarOrientationVertical->get().toBool()) + { + QWidget* pParentW = parentWidget(); + if(NULL != pParentW) + { + mCustomPosition = true; + QPoint pos; + int parentWidth = pParentW->width(); + int parentHeight = pParentW->height(); + int posX = (parentWidth / 2) - (width() / 2); + int posY = parentHeight - border() - height(); + + pos.setX(posX); + pos.setY(posY); + moveInsideParent(pos); + } + } +} UBStylusPalette::~UBStylusPalette() { diff --git a/src/gui/UBStylusPalette.h b/src/gui/UBStylusPalette.h index 2a037fc2..7faceb4c 100644 --- a/src/gui/UBStylusPalette.h +++ b/src/gui/UBStylusPalette.h @@ -12,9 +12,11 @@ class UBStylusPalette : public UBActionPalette Q_OBJECT; public: - UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical); + UBStylusPalette(QWidget *parent = 0, Qt::Orientation orient = Qt::Vertical); virtual ~UBStylusPalette(); + void initPosition(); + private slots: void stylusToolDoubleClicked();