[Libreoffice-commits] core.git: sd/source sd/uiconfig sd/UIConfig_simpress.mk
Caolán McNamara
caolanm at redhat.com
Thu Apr 13 13:59:43 UTC 2017
sd/UIConfig_simpress.mk | 1
sd/source/ui/animations/CustomAnimation.hrc | 8 --
sd/source/ui/animations/CustomAnimation.src | 41 --------------
sd/source/ui/animations/CustomAnimationDialog.cxx | 39 ++++++-------
sd/uiconfig/simpress/ui/rotatemenu.ui | 63 ++++++++++++++++++++++
5 files changed, 83 insertions(+), 69 deletions(-)
New commits:
commit a756bd31dd2da1ef134d80b2dc276cb0be228aba
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 13 14:58:33 2017 +0100
convert rotate menu to .ui
Change-Id: I2740862b10bb065a6fdd64a23afb6b1b9571109d
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index feae99758a85..a4f981a8c6be 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -137,6 +137,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
sd/uiconfig/simpress/ui/prntopts \
sd/uiconfig/simpress/ui/publishingdialog \
sd/uiconfig/simpress/ui/remotedialog \
+ sd/uiconfig/simpress/ui/rotatemenu \
sd/uiconfig/simpress/ui/scalemenu \
sd/uiconfig/simpress/ui/sdviewpage \
sd/uiconfig/simpress/ui/sidebarslidebackground \
diff --git a/sd/source/ui/animations/CustomAnimation.hrc b/sd/source/ui/animations/CustomAnimation.hrc
index 062def473af8..d940c17c8e0a 100644
--- a/sd/source/ui/animations/CustomAnimation.hrc
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -26,7 +26,6 @@
// attention, we have 200 ids free after RID_CUSTOMANIMATION_START
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-#define RID_CUSTOMANIMATION_ROTATION_POPUP RID_CUSTOMANIMATION_START+9
#define RID_CUSTOMANIMATION_FONTSTYLE_POPUP RID_CUSTOMANIMATION_START+12
#define BMP_CUSTOMANIMATION_ON_CLICK RID_CUSTOMANIMATION_START+0
@@ -72,13 +71,6 @@
#define STR_CUSTOMANIMATION_EXIT RID_CUSTOMANIMATION_START+41
#define STR_CUSTOMANIMATION_MOTION_PATHS RID_CUSTOMANIMATION_START+42
-#define CM_QUARTER_SPIN 1
-#define CM_HALF_SPIN 2
-#define CM_FULL_SPIN 3
-#define CM_TWO_SPINS 4
-#define CM_CLOCKWISE 5
-#define CM_COUNTERCLOCKWISE 6
-
#define CM_BOLD 1
#define CM_ITALIC 2
#define CM_UNDERLINED 3
diff --git a/sd/source/ui/animations/CustomAnimation.src b/sd/source/ui/animations/CustomAnimation.src
index b3eda0013c87..ff23e8897f6e 100644
--- a/sd/source/ui/animations/CustomAnimation.src
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -19,47 +19,6 @@
#include "CustomAnimation.hrc"
-Menu RID_CUSTOMANIMATION_ROTATION_POPUP
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = CM_QUARTER_SPIN ;
- Text [ en-US ] = "Quarter spin" ;
- };
- MenuItem
- {
- Identifier = CM_HALF_SPIN ;
- Text [ en-US ] = "Half spin" ;
- };
- MenuItem
- {
- Identifier = CM_FULL_SPIN;
- Text [ en-US ] = "Full spin" ;
- };
- MenuItem
- {
- Identifier = CM_TWO_SPINS;
- Text [ en-US ] = "Two spins" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = CM_CLOCKWISE;
- Text [ en-US ] = "Clockwise" ;
- };
- MenuItem
- {
- Identifier = CM_COUNTERCLOCKWISE;
- Text [ en-US ] = "Counter-clockwise" ;
- };
- };
-};
-
Menu RID_CUSTOMANIMATION_FONTSTYLE_POPUP
{
ItemList =
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index e59968b9c660..fcd86cdcab0e 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -602,6 +602,7 @@ public:
void updateMenu();
private:
+ VclBuilder maBuilder;
VclPtr<DropdownMenuBox> mpControl;
VclPtr<PopupMenu> mpMenu;
VclPtr<MetricField> mpMetric;
@@ -609,8 +610,9 @@ private:
};
RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl )
-: PropertySubControl( nControlType )
-, maModifyHdl( rModifyHdl )
+ : PropertySubControl(nControlType)
+ , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/rotatemenu.ui", "")
+ , maModifyHdl(rModifyHdl)
{
mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
mpMetric->SetUnit( FUNIT_CUSTOM );
@@ -618,7 +620,7 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p
mpMetric->SetMin( -10000 );
mpMetric->SetMax( 10000 );
- mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) );
+ mpMenu = maBuilder.get_menu("menu");
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX );
@@ -632,6 +634,7 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p
RotationPropertyBox::~RotationPropertyBox()
{
+ maBuilder.disposeBuilder();
mpControl.disposeAndClear();
}
@@ -641,13 +644,13 @@ void RotationPropertyBox::updateMenu()
bool bDirection = nValue >= 0;
nValue = (nValue < 0 ? -nValue : nValue);
- mpMenu->CheckItem( CM_QUARTER_SPIN, nValue == 90 );
- mpMenu->CheckItem( CM_HALF_SPIN, nValue == 180 );
- mpMenu->CheckItem( CM_FULL_SPIN, nValue == 360 );
- mpMenu->CheckItem( CM_TWO_SPINS, nValue == 720 );
+ mpMenu->CheckItem(mpMenu->GetItemId("90"), nValue == 90);
+ mpMenu->CheckItem(mpMenu->GetItemId("180"), nValue == 180);
+ mpMenu->CheckItem(mpMenu->GetItemId("360"), nValue == 360);
+ mpMenu->CheckItem(mpMenu->GetItemId("720"), nValue == 720);
- mpMenu->CheckItem( CM_CLOCKWISE, bDirection );
- mpMenu->CheckItem( CM_COUNTERCLOCKWISE, !bDirection );
+ mpMenu->CheckItem(mpMenu->GetItemId("closewise"), bDirection);
+ mpMenu->CheckItem(mpMenu->GetItemId("counterclock"), !bDirection);
}
IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl, Edit&, void)
@@ -662,17 +665,13 @@ IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
bool bDirection = nValue >= 0;
nValue = (nValue < 0 ? -nValue : nValue);
- switch( pPb->GetCurItemId() )
- {
- case CM_QUARTER_SPIN: nValue = 90; break;
- case CM_HALF_SPIN: nValue = 180; break;
- case CM_FULL_SPIN: nValue = 360; break;
- case CM_TWO_SPINS: nValue = 720; break;
-
- case CM_CLOCKWISE: bDirection = true; break;
- case CM_COUNTERCLOCKWISE: bDirection = false; break;
-
- }
+ OString sIdent = pPb->GetCurItemIdent();
+ if (sIdent == "clockwise")
+ bDirection = true;
+ else if (sIdent == "counterclock")
+ bDirection = false;
+ else
+ nValue = sIdent.toInt32();
if( !bDirection )
nValue = -nValue;
diff --git a/sd/uiconfig/simpress/ui/rotatemenu.ui b/sd/uiconfig/simpress/ui/rotatemenu.ui
new file mode 100644
index 000000000000..b5ac2f060875
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/rotatemenu.ui
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="90">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Quarter Spin</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="180">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Half Spin</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="360">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Full Spin</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="720">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Two Spins</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="menuitem1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="clockwise">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Clockwise</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="counterclock">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Counter-clockwise</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list