diff options
author | Katarina Behrens <bubli@bubli.org> | 2013-08-01 20:39:39 +0200 |
---|---|---|
committer | Katarina Behrens <bubli@bubli.org> | 2013-08-02 23:58:42 +0200 |
commit | 9695f38ca4ab26b40524f2eade98c45f0360131d (patch) | |
tree | c96be6758d022cf68a2c189a45fcb3135a14586b | |
parent | 6ed555d9889982f95b0846a451c95c9abd54c498 (diff) |
Converted custom animation popup dialog to .ui
Change-Id: I9a3d0036b7313867aff928e1f8d4d24dff552643
-rw-r--r-- | sd/UIConfig_simpress.mk | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationCreateDialog.cxx | 113 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationCreateDialog.hxx | 1 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/customanimationcreatedialog.ui | 158 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/customanimationcreatetab.ui | 86 |
5 files changed, 309 insertions, 51 deletions
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk index eb3953c49c3a..5706e465ba72 100644 --- a/sd/UIConfig_simpress.mk +++ b/sd/UIConfig_simpress.mk @@ -80,6 +80,8 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\ sd/uiconfig/simpress/ui/optimpressgeneralpage \ sd/uiconfig/simpress/ui/prntopts \ sd/uiconfig/simpress/ui/customanimationspanel \ + sd/uiconfig/simpress/ui/customanimationcreatedialog \ + sd/uiconfig/simpress/ui/customanimationcreatetab \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx index 22dff093f25b..138f8a0b7c86 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx @@ -64,14 +64,13 @@ const int EXIT = 2; const int MOTIONPATH = 3; const int MISCEFFECTS = 4; -//extern void fillDurationComboBox( ComboBox* pBox ); - // -------------------------------------------------------------------- class CategoryListBox : public ListBox { public: CategoryListBox( Window* pParent, const ResId& rResId ); + CategoryListBox( Window* pParent ); ~CategoryListBox(); virtual void MouseButtonUp( const MouseEvent& rMEvt ); @@ -95,6 +94,18 @@ CategoryListBox::CategoryListBox( Window* pParent, const ResId& rResId ) SetDoubleClickHdl( LINK( this, CategoryListBox, implDoubleClickHdl ) ); } +CategoryListBox::CategoryListBox( Window* pParent ) +: ListBox( pParent, WB_TABSTOP | WB_BORDER ) +{ + EnableUserDraw( sal_True ); + SetDoubleClickHdl( LINK( this, CategoryListBox, implDoubleClickHdl ) ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeCategoryListBox( Window *pParent ) +{ + return new CategoryListBox( pParent ); +} + CategoryListBox::~CategoryListBox() { } @@ -180,6 +191,8 @@ public: bool getIsPreview() const; void setIsPreview( bool bIsPreview ); + bool getId() const; + bool select( const OUString& rsPresetId ); private: @@ -193,11 +206,13 @@ private: private: CategoryListBox* mpLBEffects; FixedText* mpFTSpeed; - ComboBox* mpCBSpeed; + ListBox* mpCBSpeed; CheckBox* mpCBXPReview; CustomAnimationCreateDialog* mpParent; + sal_uInt16 mnId; + sal_uInt16 mnCurvePathPos; sal_uInt16 mnPolygonPathPos; sal_uInt16 mnFreeformPathPos; @@ -227,20 +242,21 @@ bool ImplStlEffectCategorySortHelper::operator()( const CustomAnimationPresetPtr } CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window* pParent, CustomAnimationCreateDialog* pDialogParent, int nTabId, const PresetCategoryList& rCategoryList, bool bHasText ) -: TabPage( pParent, SdResId( RID_TP_CUSTOMANIMATION_ENTRANCE ) ) +: TabPage( pParent, "CustomAnimationCreateTab", "modules/simpress/ui/customanimationcreatetab.ui" ) , mpParent( pDialogParent ) +, mnId( nTabId ) , mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND ) , mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND ) , mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND ) { - mpLBEffects = new CategoryListBox( this, SdResId( LB_EFFECTS ) ); - mpFTSpeed = new FixedText( this, SdResId( FT_SPEED ) ); - mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED ) ); - mpCBXPReview = new CheckBox( this, SdResId( CBX_PREVIEW ) ); + get( mpLBEffects, "effect_list" ); + mpLBEffects->set_height_request( mpLBEffects->GetTextHeight() * 16 ); - String sMotionPathLabel( SdResId( STR_USERPATH ) ); + get( mpFTSpeed, "effect_speed_label" ); + get( mpCBSpeed, "effect_speed_list" ); + get( mpCBXPReview, "auto_preview" ); - FreeResource(); + String sMotionPathLabel( SdResId( STR_USERPATH ) ); sal_uInt16 nFirstEffect = LISTBOX_ENTRY_NOTFOUND; @@ -286,8 +302,6 @@ CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window* pParent, Cus mpLBEffects->SelectEntryPos( nFirstEffect ); - //fillDurationComboBox( mpCBSpeed ); - if( nFirstEffect != LISTBOX_ENTRY_NOTFOUND ) onSelectEffect(); @@ -298,11 +312,6 @@ CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window* pParent, Cus CustomAnimationCreateTabPage::~CustomAnimationCreateTabPage() { clearEffects(); - - delete mpLBEffects; - delete mpFTSpeed; - delete mpCBSpeed; - delete mpCBXPReview; } IMPL_LINK( CustomAnimationCreateTabPage, implSelectHdl, Control*, pControl ) @@ -467,6 +476,11 @@ void CustomAnimationCreateTabPage::setIsPreview( bool bIsPreview ) mpCBXPReview->Check( bIsPreview ? sal_True : sal_False ); } +bool CustomAnimationCreateTabPage::getId() const +{ + return mnId; +} + bool CustomAnimationCreateTabPage::select( const OUString& rsPresetId ) { sal_uInt16 nPos = mpLBEffects->GetEntryCount(); @@ -490,37 +504,39 @@ bool CustomAnimationCreateTabPage::select( const OUString& rsPresetId ) // -------------------------------------------------------------------- CustomAnimationCreateDialog::CustomAnimationCreateDialog( Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const OUString& rsPresetId, double fDuration ) -: TabDialog( pParent, SdResId( DLG_CUSTOMANIMATION_CREATE ) ) +: TabDialog( pParent, "CustomAnimationCreate", "modules/simpress/ui/customanimationcreatedialog.ui" ) , mpPane( pPane ) , mrTargets( rTargets ) , mfDuration( fDuration ) { - mpTabControl = new TabControl( this, SdResId( 1 ) ); - mpOKButton = new OKButton(this, SdResId( 1 ) ) ; - mpCancelButton = new CancelButton(this, SdResId( 1 ) ); - mpHelpButton = new HelpButton(this, SdResId( 1 ) ); - - FreeResource(); + get( mpTabControl, "tabs" ); SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); mbIsPreview = pOptions->IsPreviewNewEffects(); + mnEntranceId = mpTabControl->GetPageId("entrance"); + mnEmphasisId = mpTabControl->GetPageId("emphasis"); + mnExitId = mpTabControl->GetPageId("exit"); + mnMPathId = mpTabControl->GetPageId("motion_paths"); + mnMiscId = mpTabControl->GetPageId("misc_effects"); + + //FIXME: Figure out what to do w/ those help IDs const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets(); - mpTabPages[ENTRANCE] = new CustomAnimationCreateTabPage( mpTabControl, this, ENTRANCE, rPresets.getEntrancePresets(), bHasText ); - mpTabPages[ENTRANCE]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE ); - mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_ENTRANCE, mpTabPages[ENTRANCE] ); - mpTabPages[EMPHASIS] = new CustomAnimationCreateTabPage( mpTabControl, this, EMPHASIS, rPresets.getEmphasisPresets(), bHasText ); - mpTabPages[EMPHASIS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS ); - mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EMPHASIS, mpTabPages[EMPHASIS] ); - mpTabPages[EXIT] = new CustomAnimationCreateTabPage( mpTabControl, this, EXIT, rPresets.getExitPresets(), bHasText ); - mpTabPages[EXIT]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EXIT ); - mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EXIT, mpTabPages[EXIT] ); - mpTabPages[MOTIONPATH] = new CustomAnimationCreateTabPage( mpTabControl, this, MOTIONPATH, rPresets.getMotionPathsPresets(), bHasText ); - mpTabPages[MOTIONPATH]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH ); - mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_MOTIONPATH, mpTabPages[MOTIONPATH] ); - mpTabPages[MISCEFFECTS] = new CustomAnimationCreateTabPage( mpTabControl, this, MISCEFFECTS, rPresets.getMiscPresets(), bHasText ); - mpTabPages[MISCEFFECTS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS ); - mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_MISCEFFECTS, mpTabPages[MISCEFFECTS] ); + mpTabPages[ENTRANCE] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEntranceId, rPresets.getEntrancePresets(), bHasText ); + //mpTabPages[ENTRANCE]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE ); + mpTabControl->SetTabPage( mnEntranceId, mpTabPages[ENTRANCE] ); + mpTabPages[EMPHASIS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnEmphasisId, rPresets.getEmphasisPresets(), bHasText ); + //mpTabPages[EMPHASIS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS ); + mpTabControl->SetTabPage( mnEmphasisId, mpTabPages[EMPHASIS] ); + mpTabPages[EXIT] = new CustomAnimationCreateTabPage( mpTabControl, this, mnExitId, rPresets.getExitPresets(), bHasText ); + //mpTabPages[EXIT]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EXIT ); + mpTabControl->SetTabPage( mnExitId, mpTabPages[EXIT] ); + mpTabPages[MOTIONPATH] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMPathId, rPresets.getMotionPathsPresets(), bHasText ); + //mpTabPages[MOTIONPATH]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH ); + mpTabControl->SetTabPage( mnMPathId, mpTabPages[MOTIONPATH] ); + mpTabPages[MISCEFFECTS] = new CustomAnimationCreateTabPage( mpTabControl, this, mnMiscId, rPresets.getMiscPresets(), bHasText ); + //mpTabPages[MISCEFFECTS]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS ); + mpTabControl->SetTabPage( mnMiscId, mpTabPages[MISCEFFECTS] ); getCurrentPage()->setDuration( mfDuration ); getCurrentPage()->setIsPreview( mbIsPreview ); @@ -537,7 +553,7 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( Window* pParent, Custo { if( mpTabPages[i]->select( rsPresetId ) ) { - mpTabControl->SetCurPageId( RID_TP_CUSTOMANIMATION_ENTRANCE + i ); + mpTabControl->SetCurPageId( mpTabPages[i]->getId() ); break; } } @@ -557,23 +573,18 @@ CustomAnimationCreateDialog::~CustomAnimationCreateDialog() delete mpTabPages[MOTIONPATH]; delete mpTabPages[MISCEFFECTS]; - delete mpTabControl; - delete mpOKButton; - delete mpCancelButton; - delete mpHelpButton; } CustomAnimationCreateTabPage* CustomAnimationCreateDialog::getCurrentPage() const { - switch( mpTabControl->GetCurPageId() ) + sal_Int16 curPageId = mpTabControl->GetCurPageId(); + + for( sal_uInt16 i = ENTRANCE; i <= MOTIONPATH; i++ ) { - case RID_TP_CUSTOMANIMATION_ENTRANCE: return mpTabPages[ENTRANCE]; - case RID_TP_CUSTOMANIMATION_EMPHASIS: return mpTabPages[EMPHASIS]; - case RID_TP_CUSTOMANIMATION_EXIT: return mpTabPages[EXIT]; - case RID_TP_CUSTOMANIMATION_MISCEFFECTS:return mpTabPages[MISCEFFECTS]; - default: - return mpTabPages[MOTIONPATH]; + if( mpTabPages[i]->getId() == curPageId ) + return mpTabPages[i]; } + return mpTabPages[MOTIONPATH]; } PathKind CustomAnimationCreateDialog::getCreatePathKind() const diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx index 4a0af710b320..e126146c4f48 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx @@ -70,6 +70,7 @@ private: HelpButton* mpHelpButton; CustomAnimationCreateTabPage* mpTabPages[5]; + sal_Int16 mnEntranceId, mnEmphasisId, mnExitId, mnMPathId, mnMiscId; }; } diff --git a/sd/uiconfig/simpress/ui/customanimationcreatedialog.ui b/sd/uiconfig/simpress/ui/customanimationcreatedialog.ui new file mode 100644 index 000000000000..e8c5cfe01ac6 --- /dev/null +++ b/sd/uiconfig/simpress/ui/customanimationcreatedialog.ui @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="CustomAnimationCreate"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkNotebook" id="tabs"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child type="tab"> + <object class="GtkLabel" id="entrance"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Entrance</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="emphasis"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Emphasis</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="exit"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Exit</property> + </object> + <packing> + <property name="position">2</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="motion_paths"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Motion Paths</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="misc_effects"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Misc Effects</property> + </object> + <packing> + <property name="position">4</property> + <property name="tab_fill">False</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> +</interface> diff --git a/sd/uiconfig/simpress/ui/customanimationcreatetab.ui b/sd/uiconfig/simpress/ui/customanimationcreatetab.ui new file mode 100644 index 000000000000..0a8c37097e3e --- /dev/null +++ b/sd/uiconfig/simpress/ui/customanimationcreatetab.ui @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkBox" id="CustomAnimationCreateTab"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="sdlo-CategoryListBox" id="effect_list"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="effect_speed_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Speed:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">effect_speed_list</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="effect_speed_list"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">Very slow</item> + <item translatable="yes">Slow</item> + <item translatable="yes">Normal</item> + <item translatable="yes">Fast</item> + <item translatable="yes">Very fast</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="auto_preview"> + <property name="label" translatable="yes">_Automatic preview</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> +</interface> |