Kaydet (Commit) e9958242 authored tarafından Ivan Timofeev's avatar Ivan Timofeev

fdo#51231 Revert "Slidesorter: Show the buttons on the opposite side..."

This reverts commit 4866b20e.
üst 2cfe2712
...@@ -225,15 +225,13 @@ public: ...@@ -225,15 +225,13 @@ public:
const bool bAnimate = true); const bool bAnimate = true);
void SetPageUnderMouse ( void SetPageUnderMouse (
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const bool bAnimate = true, const bool bAnimate = true);
const Point& rMousePosition = Point());
bool SetState ( bool SetState (
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const model::PageDescriptor::State eState, const model::PageDescriptor::State eState,
const bool bStateValue, const bool bStateValue,
const bool bAnimate = true, const bool bAnimate = true);
const Point& rMousePosition = Point());
void UpdateOrientation (void); void UpdateOrientation (void);
......
...@@ -69,11 +69,6 @@ public: ...@@ -69,11 +69,6 @@ public:
const Point aMouseModelLocation, const Point aMouseModelLocation,
const bool bIsMouseButtonDown); const bool bIsMouseButtonDown);
/// Decide whether the button should be drawn at the top, or the bottom.
void UpdateButtonPosition(
const model::SharedPageDescriptor& rpDescriptor,
const Point& rMousePosition);
void ResetPage (void); void ResetPage (void);
bool IsMouseOverBar (void) const; bool IsMouseOverBar (void) const;
......
...@@ -956,7 +956,7 @@ void SlideSorterView::UpdatePageUnderMouse ( ...@@ -956,7 +956,7 @@ void SlideSorterView::UpdatePageUnderMouse (
const bool bAnimate) const bool bAnimate)
{ {
// Update the page under the mouse. // Update the page under the mouse.
SetPageUnderMouse(rpDescriptor, bAnimate, rMousePosition); SetPageUnderMouse(rpDescriptor, bAnimate);
// Tell the button bar about the new mouse position. // Tell the button bar about the new mouse position.
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
...@@ -984,8 +984,7 @@ void SlideSorterView::UpdatePageUnderMouse ( ...@@ -984,8 +984,7 @@ void SlideSorterView::UpdatePageUnderMouse (
void SlideSorterView::SetPageUnderMouse ( void SlideSorterView::SetPageUnderMouse (
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const bool bAnimate, const bool bAnimate)
const Point& rMousePosition)
{ {
if (mpPageUnderMouse != rpDescriptor) if (mpPageUnderMouse != rpDescriptor)
{ {
...@@ -995,7 +994,7 @@ void SlideSorterView::SetPageUnderMouse ( ...@@ -995,7 +994,7 @@ void SlideSorterView::SetPageUnderMouse (
mpPageUnderMouse = rpDescriptor; mpPageUnderMouse = rpDescriptor;
if (mpPageUnderMouse) if (mpPageUnderMouse)
SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, true, bAnimate, rMousePosition); SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, true, bAnimate);
// Change the quick help text to display the name of the page under // Change the quick help text to display the name of the page under
// the mouse. // the mouse.
...@@ -1010,8 +1009,7 @@ bool SlideSorterView::SetState ( ...@@ -1010,8 +1009,7 @@ bool SlideSorterView::SetState (
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const PageDescriptor::State eState, const PageDescriptor::State eState,
const bool bStateValue, const bool bStateValue,
const bool bAnimate, const bool bAnimate)
const Point& rMousePosition)
{ {
model::SharedPageDescriptor pDescriptor (rpDescriptor); model::SharedPageDescriptor pDescriptor (rpDescriptor);
if ( ! pDescriptor) if ( ! pDescriptor)
...@@ -1039,11 +1037,7 @@ bool SlideSorterView::SetState ( ...@@ -1039,11 +1037,7 @@ bool SlideSorterView::SetState (
if (eState == PageDescriptor::ST_MouseOver) if (eState == PageDescriptor::ST_MouseOver)
{ {
if (bStateValue) if (bStateValue)
{
if (bAnimate)
GetButtonBar().UpdateButtonPosition(rpDescriptor, rMousePosition);
GetButtonBar().RequestFadeIn(rpDescriptor, bAnimate); GetButtonBar().RequestFadeIn(rpDescriptor, bAnimate);
}
else else
GetButtonBar().RequestFadeOut(rpDescriptor, bAnimate); GetButtonBar().RequestFadeOut(rpDescriptor, bAnimate);
} }
......
...@@ -69,26 +69,20 @@ namespace sd { namespace slidesorter { namespace view { ...@@ -69,26 +69,20 @@ namespace sd { namespace slidesorter { namespace view {
*/ */
class ButtonBar::BackgroundTheme class ButtonBar::BackgroundTheme
{ {
public:
enum ButtonPosition { TOP, BOTTOM };
public: public:
BackgroundTheme( BackgroundTheme(
const ::boost::shared_ptr<Theme>& rpTheme, const ::boost::shared_ptr<Theme>& rpTheme,
const ::std::vector<SharedButton>& rButtons); const ::std::vector<SharedButton>& rButtons);
~BackgroundTheme() { } virtual ~BackgroundTheme() { }
/** Set the preview bounding box, the maximal area in which to display /** Set the preview bounding box, the maximal area in which to display
buttons. A call to this method triggers a call to Layout(). buttons. A call to this method triggers a call to Layout().
*/ */
void SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox); void SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox);
Button::IconSize GetIconSize (void) const; Button::IconSize GetIconSize (void) const;
BitmapEx CreateBackground () const; virtual BitmapEx CreateBackground () const;
Point GetBackgroundLocation (void); virtual Point GetBackgroundLocation (void);
Rectangle GetButtonArea (void); virtual Rectangle GetButtonArea (void);
void SetButtonPosition( ButtonPosition ePosition ) { mePosition = ePosition; }
/// Compute the positions & sizes.
void Layout (void);
protected: protected:
::boost::shared_ptr<Theme> mpTheme; ::boost::shared_ptr<Theme> mpTheme;
...@@ -100,8 +94,7 @@ protected: ...@@ -100,8 +94,7 @@ protected:
Rectangle maButtonArea; Rectangle maButtonArea;
Point maBackgroundLocation; Point maBackgroundLocation;
/// This comes into effect only during Layout(), before it only caches the value. virtual void Layout (void);
ButtonPosition mePosition;
private: private:
/// Compute the size of the are for the given button size. /// Compute the size of the are for the given button size.
...@@ -286,24 +279,6 @@ void ButtonBar::ProcessMouseMotionEvent ( ...@@ -286,24 +279,6 @@ void ButtonBar::ProcessMouseMotionEvent (
} }
void ButtonBar::UpdateButtonPosition(
const model::SharedPageDescriptor& rpDescriptor,
const Point& rMousePosition)
{
if (rpDescriptor && mpBackgroundTheme)
{
Rectangle aRectangle( rpDescriptor->GetBoundingBox() );
aRectangle.Bottom() -= aRectangle.GetHeight() / 2;
if (aRectangle.IsInside(rMousePosition))
mpBackgroundTheme->SetButtonPosition(ButtonBar::BackgroundTheme::BOTTOM);
else
mpBackgroundTheme->SetButtonPosition(ButtonBar::BackgroundTheme::TOP);
// Relayout, to propagate the newest location of the buttons
LayoutButtons();
}
}
void ButtonBar::ResetPage (void) void ButtonBar::ResetPage (void)
...@@ -532,7 +507,6 @@ bool ButtonBar::LayoutButtons (void) ...@@ -532,7 +507,6 @@ bool ButtonBar::LayoutButtons (void)
nMaximumHeight += 2*nBorder; nMaximumHeight += 2*nBorder;
// Set up the bounding box of the button bar. // Set up the bounding box of the button bar.
mpBackgroundTheme->Layout();
maButtonBoundingBox = mpBackgroundTheme->GetButtonArea(); maButtonBoundingBox = mpBackgroundTheme->GetButtonArea();
maBackgroundLocation = mpBackgroundTheme->GetBackgroundLocation(); maBackgroundLocation = mpBackgroundTheme->GetBackgroundLocation();
if (Theme_ButtonPaintType == 1) if (Theme_ButtonPaintType == 1)
...@@ -737,8 +711,7 @@ ButtonBar::BackgroundTheme::BackgroundTheme ( ...@@ -737,8 +711,7 @@ ButtonBar::BackgroundTheme::BackgroundTheme (
: mpTheme(rpTheme), : mpTheme(rpTheme),
meIconSize( Button::IconSize_Large ), meIconSize( Button::IconSize_Large ),
maButtonArea(), maButtonArea(),
maBackgroundLocation(), maBackgroundLocation()
mePosition( BOTTOM )
{ {
UpdateMinimumIconSizes(rButtons); UpdateMinimumIconSizes(rButtons);
} }
...@@ -847,9 +820,9 @@ void ButtonBar::BackgroundTheme::Layout (void) ...@@ -847,9 +820,9 @@ void ButtonBar::BackgroundTheme::Layout (void)
} }
maBackgroundLocation = Point( maBackgroundLocation = Point(
maPreviewBoundingBox.Left() + (maPreviewBoundingBox.GetWidth()-aImageSize.Width())/2, maPreviewBoundingBox.Left()
mePosition == TOP? maPreviewBoundingBox.Top(): + (maPreviewBoundingBox.GetWidth()-aImageSize.Width())/2,
maPreviewBoundingBox.Bottom() - aImageSize.Height()); maPreviewBoundingBox.Bottom() - aImageSize.Height());
maButtonArea = Rectangle(maBackgroundLocation, aImageSize); maButtonArea = Rectangle(maBackgroundLocation, aImageSize);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment