diff options
-rw-r--r-- | avmedia/inc/bitmaps.hlst | 14 | ||||
-rw-r--r-- | avmedia/inc/mediacontrol.hxx | 31 | ||||
-rw-r--r-- | avmedia/inc/strings.hrc | 3 | ||||
-rw-r--r-- | avmedia/source/framework/MediaControlBase.cxx | 301 | ||||
-rw-r--r-- | avmedia/source/framework/mediacontrol.cxx | 283 | ||||
-rw-r--r-- | avmedia/source/framework/mediatoolbox.cxx | 1 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.cxx | 2 | ||||
-rw-r--r-- | include/avmedia/MediaControlBase.hxx | 25 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 5 | ||||
-rw-r--r-- | solenv/sanitizers/ui/svx.suppr | 16 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 2 | ||||
-rw-r--r-- | svx/source/sidebar/media/MediaPlaybackPanel.cxx | 100 | ||||
-rw-r--r-- | svx/source/sidebar/media/MediaPlaybackPanel.hxx | 10 | ||||
-rw-r--r-- | svx/uiconfig/ui/medialine.ui | 292 | ||||
-rw-r--r-- | svx/uiconfig/ui/mediaplayback.ui | 204 | ||||
-rw-r--r-- | svx/uiconfig/ui/mediawindow.ui | 277 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 17 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 19 |
18 files changed, 1058 insertions, 544 deletions
diff --git a/avmedia/inc/bitmaps.hlst b/avmedia/inc/bitmaps.hlst index 24441a26f688..682d090fe7b1 100644 --- a/avmedia/inc/bitmaps.hlst +++ b/avmedia/inc/bitmaps.hlst @@ -10,20 +10,6 @@ #ifndef INCLUDED_AVMEDIA_INC_BITMAPS_HRC #define INCLUDED_AVMEDIA_INC_BITMAPS_HRC -#define AVMEDIA_IMG_OPEN_NORMAL "avmedia/res/av02048.png" -#define AVMEDIA_IMG_PLAY_NORMAL "avmedia/res/av02049.png" -#define AVMEDIA_IMG_PAUSE_NORMAL "avmedia/res/av02050.png" -#define AVMEDIA_IMG_STOP_NORMAL "avmedia/res/av02051.png" -#define AVMEDIA_IMG_LOOP_NORMAL "avmedia/res/av02052.png" -#define AVMEDIA_IMG_INSERT_NORMAL "avmedia/res/av02053.png" -#define AVMEDIA_IMG_MUTE_NORMAL "avmedia/res/av02054.png" -#define AVMEDIA_IMG_OPEN_LARGE "avmedia/res/avl02048.png" -#define AVMEDIA_IMG_PLAY_LARGE "avmedia/res/avl02049.png" -#define AVMEDIA_IMG_PAUSE_LARGE "avmedia/res/avl02050.png" -#define AVMEDIA_IMG_STOP_LARGE "avmedia/res/avl02051.png" -#define AVMEDIA_IMG_LOOP_LARGE "avmedia/res/avl02052.png" -#define AVMEDIA_IMG_INSERT_LARGE "avmedia/res/avl02053.png" -#define AVMEDIA_IMG_MUTE_LARGE "avmedia/res/avl02054.png" #define AVMEDIA_BMP_AUDIOLOGO "avmedia/res/avaudiologo.png" #define AVMEDIA_BMP_EMPTYLOGO "avmedia/res/avemptylogo.png" diff --git a/avmedia/inc/mediacontrol.hxx b/avmedia/inc/mediacontrol.hxx index 9172195eea71..b67ac0a36808 100644 --- a/avmedia/inc/mediacontrol.hxx +++ b/avmedia/inc/mediacontrol.hxx @@ -22,17 +22,14 @@ #include <avmedia/mediaitem.hxx> +#include <vcl/ctrl.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> -#include <vcl/slider.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> #include <avmedia/MediaControlBase.hxx> #define AVMEDIA_CONTROLOFFSET 6 -class ListBox; - namespace avmedia { @@ -41,12 +38,11 @@ class MediaItem; class MediaControl : public Control, public MediaControlBase { public: - MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyle ); virtual ~MediaControl() override; virtual void dispose() override; - const Size& getMinSizePixel() const; + Size getMinSizePixel() const; void setState( const MediaItem& rItem ); void UpdateURLField( MediaItem const & maItem ); @@ -58,21 +54,24 @@ protected: virtual void Resize() override; virtual void InitializeWidgets() override; - VclPtr<FixedText> mpMediaPath; + std::unique_ptr<weld::Label> mxMediaPath; private: - DECL_LINK( implTimeHdl, Slider*, void ); - DECL_LINK( implTimeEndHdl, Slider*, void ); - DECL_LINK( implVolumeHdl, Slider*, void ); - DECL_LINK( implSelectHdl, ToolBox*, void ); - DECL_LINK( implZoomSelectHdl, ListBox&, void ); - DECL_LINK(implTimeoutHdl, Timer *, void); + DECL_LINK(implTimeHdl, weld::Scale&, void); + DECL_LINK(implTimeEndHdl, Timer*, void); + DECL_LINK(implVolumeHdl, weld::Scale&, void); + DECL_LINK(implSelectHdl, const OString&, void); + DECL_LINK(implZoomSelectHdl, weld::ComboBox&, void); + DECL_LINK(implTimeoutHdl, Timer*, void); + + std::unique_ptr<weld::Builder> m_xBuilder; + VclPtr<vcl::Window> m_xVclContentArea; + std::unique_ptr<weld::Container> m_xContainer; Idle maIdle; + Idle maChangeTimeIdle; MediaItem maItem; - VclPtr<ToolBox> mpZoomToolBox; - Size maMinSize; bool mbLocked; MediaControlStyle meControlStyle; double mfTime; diff --git a/avmedia/inc/strings.hrc b/avmedia/inc/strings.hrc index cc1692a220b3..d9103dd545a1 100644 --- a/avmedia/inc/strings.hrc +++ b/avmedia/inc/strings.hrc @@ -44,7 +44,8 @@ #define AVMEDIA_STR_ALL_MEDIAFILES NC_("AVMEDIA_STR_ALL_MEDIAFILES", "All audio and video files") #define AVMEDIA_STR_ALL_FILES NC_("AVMEDIA_STR_ALL_FILES", "All files") #define AVMEDIA_STR_ERR_URL NC_("AVMEDIA_STR_ERR_URL", "The format of the selected file is not supported.") +#define AVMEDIA_STR_ZOOM_TOOLTIP NC_("AVMEDIA_STR_ZOOM_TOOLTIP", "View") #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx index f2e32cf7a182..c3df197f4f15 100644 --- a/avmedia/source/framework/MediaControlBase.cxx +++ b/avmedia/source/framework/MediaControlBase.cxx @@ -18,9 +18,6 @@ */ #include <avmedia/MediaControlBase.hxx> #include <avmedia/mediaplayer.hxx> -#include <vcl/edit.hxx> -#include <vcl/slider.hxx> -#include <vcl/toolbox.hxx> #include <avmedia/mediaitem.hxx> #include <svtools/miscopt.hxx> #include <tools/time.hxx> @@ -36,6 +33,7 @@ using ::rtl::OUString; namespace avmedia { MediaControlBase::MediaControlBase() + : mbCurrentlySettingZoom(false) { } @@ -52,20 +50,20 @@ void MediaControlBase::UpdateTimeField( MediaItem const & aMediaItem, double fTi " / " + rLocaleData.getDuration( tools::Time( 0, 0, static_cast< sal_uInt32 >( floor( aMediaItem.getDuration() ) )) ); - if( mpTimeEdit->GetText() != aTimeString ) - mpTimeEdit->SetText( aTimeString ); + if( mxTimeEdit->get_text() != aTimeString ) + mxTimeEdit->set_text( aTimeString ); } } void MediaControlBase::UpdateVolumeSlider( MediaItem const & aMediaItem ) { if( aMediaItem.getURL().isEmpty() ) - mpVolumeSlider->Disable(); + mxVolumeSlider->set_sensitive(false); else { - mpVolumeSlider->Enable(); + mxVolumeSlider->set_sensitive(true); const sal_Int32 nVolumeDB = aMediaItem.getVolumeDB(); - mpVolumeSlider->SetThumbPos( std::min( std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ), + mxVolumeSlider->set_value( std::min( std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ), static_cast< sal_Int32 >( 0 ) ) ); } } @@ -73,10 +71,10 @@ void MediaControlBase::UpdateVolumeSlider( MediaItem const & aMediaItem ) void MediaControlBase::UpdateTimeSlider( MediaItem const & aMediaItem ) { if( aMediaItem.getURL().isEmpty() ) - mpTimeSlider->Disable(); + mxTimeSlider->set_sensitive(false); else { - mpTimeSlider->Enable(); + mxTimeSlider->set_sensitive(true); const double fDuration = aMediaItem.getDuration(); @@ -84,103 +82,101 @@ void MediaControlBase::UpdateTimeSlider( MediaItem const & aMediaItem ) { const double fTime = std::min( aMediaItem.getTime(), fDuration ); - if( !mpTimeSlider->GetLineSize() ) - mpTimeSlider->SetLineSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration ) ); - - if( !mpTimeSlider->GetPageSize() ) - mpTimeSlider->SetPageSize( static_cast< sal_uInt32 >( AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration ) ); + bool bChanged(false); + int nStep(0), nPage(0); + if (!nStep) + { + nStep = AVMEDIA_TIME_RANGE * AVMEDIA_LINEINCREMENT / fDuration; + bChanged = true; + } + if (!nPage) + { + nPage = AVMEDIA_TIME_RANGE * AVMEDIA_PAGEINCREMENT / fDuration; + bChanged = true; + } + if (bChanged) + mxTimeSlider->set_increments(nStep, nPage); - mpTimeSlider->SetThumbPos( static_cast< sal_Int32 >( fTime / fDuration * AVMEDIA_TIME_RANGE ) ); + mxTimeSlider->set_value(fTime / fDuration * AVMEDIA_TIME_RANGE); } } } void MediaControlBase::InitializeWidgets() { - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PLAY, GetImage(AVMEDIA_TOOLBOXITEM_PLAY), AvmResId( AVMEDIA_STR_PLAY ), ToolBoxItemBits::CHECKABLE ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PLAY, HID_AVMEDIA_TOOLBOXITEM_PLAY ); - - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_PAUSE, GetImage(AVMEDIA_TOOLBOXITEM_PAUSE), AvmResId( AVMEDIA_STR_PAUSE ), ToolBoxItemBits::CHECKABLE ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_PAUSE, HID_AVMEDIA_TOOLBOXITEM_PAUSE ); - - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_STOP, GetImage(AVMEDIA_TOOLBOXITEM_STOP), AvmResId( AVMEDIA_STR_STOP ), ToolBoxItemBits::CHECKABLE ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_STOP, HID_AVMEDIA_TOOLBOXITEM_STOP ); - - mpPlayToolBox->InsertSeparator(); - - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_LOOP, GetImage(AVMEDIA_TOOLBOXITEM_LOOP), AvmResId( AVMEDIA_STR_LOOP ) ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_LOOP, HID_AVMEDIA_TOOLBOXITEM_LOOP ); - - mpMuteToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_MUTE, GetImage(AVMEDIA_TOOLBOXITEM_MUTE), AvmResId( AVMEDIA_STR_MUTE ) ); - mpMuteToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_MUTE, HID_AVMEDIA_TOOLBOXITEM_MUTE ); - - mpZoomListBox->InsertEntry( AvmResId( AVMEDIA_STR_ZOOM_50 ), AVMEDIA_ZOOMLEVEL_50 ); - mpZoomListBox->InsertEntry( AvmResId( AVMEDIA_STR_ZOOM_100 ), AVMEDIA_ZOOMLEVEL_100 ); - mpZoomListBox->InsertEntry( AvmResId( AVMEDIA_STR_ZOOM_200 ), AVMEDIA_ZOOMLEVEL_200 ); - mpZoomListBox->InsertEntry( AvmResId( AVMEDIA_STR_ZOOM_FIT ), AVMEDIA_ZOOMLEVEL_FIT ); - mpZoomListBox->SetHelpId( HID_AVMEDIA_ZOOMLISTBOX ); + mxPlayToolBox->set_item_help_id("play", HID_AVMEDIA_TOOLBOXITEM_PLAY); + mxPlayToolBox->set_item_label("play", AvmResId(AVMEDIA_STR_PLAY)); + mxPlayToolBox->set_item_help_id("pause", HID_AVMEDIA_TOOLBOXITEM_PAUSE); + mxPlayToolBox->set_item_label("pause", AvmResId(AVMEDIA_STR_PAUSE)); + mxPlayToolBox->set_item_help_id("stop", HID_AVMEDIA_TOOLBOXITEM_STOP); + mxPlayToolBox->set_item_label("stop", AvmResId(AVMEDIA_STR_STOP)); + mxPlayToolBox->set_item_help_id("loop", HID_AVMEDIA_TOOLBOXITEM_LOOP); + mxPlayToolBox->set_item_label("loop", AvmResId(AVMEDIA_STR_LOOP)); + mxMuteToolBox->set_item_help_id("mute", HID_AVMEDIA_TOOLBOXITEM_MUTE); + mxMuteToolBox->set_item_label("mute", AvmResId(AVMEDIA_STR_MUTE)); + + mxZoomListBox->append(OUString::number(AVMEDIA_ZOOMLEVEL_50), AvmResId( AVMEDIA_STR_ZOOM_50 )); + mxZoomListBox->append(OUString::number(AVMEDIA_ZOOMLEVEL_100), AvmResId( AVMEDIA_STR_ZOOM_100 )); + mxZoomListBox->append(OUString::number(AVMEDIA_ZOOMLEVEL_200), AvmResId( AVMEDIA_STR_ZOOM_200 )); + mxZoomListBox->append(OUString::number(AVMEDIA_ZOOMLEVEL_FIT), AvmResId( AVMEDIA_STR_ZOOM_FIT )); + mxZoomListBox->set_help_id( HID_AVMEDIA_ZOOMLISTBOX ); + mxZoomListBox->set_tooltip_text(AvmResId( AVMEDIA_STR_ZOOM_TOOLTIP )); const OUString aTimeText( " 00:00:00/00:00:00 " ); - mpTimeEdit->SetText( aTimeText ); - mpTimeEdit->SetUpdateMode( true ); - mpTimeEdit->SetHelpId( HID_AVMEDIA_TIMEEDIT ); - mpTimeEdit->Disable(); - mpTimeEdit->Show(); + mxTimeEdit->set_text( aTimeText ); + mxTimeEdit->set_help_id( HID_AVMEDIA_TIMEEDIT ); + mxTimeEdit->set_sensitive(false); - mpVolumeSlider->SetRange( Range( AVMEDIA_DB_RANGE, 0 ) ); - mpVolumeSlider->SetUpdateMode( true ); - mpVolumeSlider->SetQuickHelpText( AvmResId( AVMEDIA_STR_VOLUME )); - mpVolumeSlider->SetHelpId( HID_AVMEDIA_VOLUMESLIDER ); + mxVolumeSlider->set_range(AVMEDIA_DB_RANGE, 0); + mxVolumeSlider->set_tooltip_text( AvmResId( AVMEDIA_STR_VOLUME )); + mxVolumeSlider->set_help_id( HID_AVMEDIA_VOLUMESLIDER ); - mpTimeSlider->SetRange( Range( 0, AVMEDIA_TIME_RANGE ) ); - mpTimeSlider->SetUpdateMode( true ); - mpTimeSlider->SetQuickHelpText( AvmResId( AVMEDIA_STR_POSITION )); - mpTimeSlider->SetStyle(WB_HORZ | WB_DRAG | WB_3DLOOK); - mpTimeSlider->SetScrollTypeSet(true); + mxTimeSlider->set_range( 0, AVMEDIA_TIME_RANGE ); + mxTimeSlider->set_tooltip_text( AvmResId( AVMEDIA_STR_POSITION )); } -void MediaControlBase::UpdateToolBoxes(MediaItem aMediaItem) +void MediaControlBase::UpdateToolBoxes(const MediaItem& rMediaItem) { - const bool bValidURL = !aMediaItem.getURL().isEmpty(); - mpPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PLAY, bValidURL ); - mpPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_PAUSE, bValidURL ); - mpPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_STOP, bValidURL ); - mpPlayToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_LOOP, bValidURL ); - mpMuteToolBox->EnableItem( AVMEDIA_TOOLBOXITEM_MUTE, bValidURL ); + const bool bValidURL = !rMediaItem.getURL().isEmpty(); + mxPlayToolBox->set_item_sensitive("play", bValidURL); + mxPlayToolBox->set_item_sensitive("pause", bValidURL); + mxPlayToolBox->set_item_sensitive("stop", bValidURL); + mxPlayToolBox->set_item_sensitive("loop", bValidURL); + mxMuteToolBox->set_item_sensitive("mute", bValidURL); if( !bValidURL ) { - mpZoomListBox->Disable(); - mpMuteToolBox->Disable(); + mxZoomListBox->set_sensitive(false); + mxMuteToolBox->set_sensitive(false); } else { - mpPlayToolBox->Enable(); - mpMuteToolBox->Enable(); - if( aMediaItem.getState() == MediaState::Play ) + mxPlayToolBox->set_sensitive(true); + mxMuteToolBox->set_sensitive(true); + if( rMediaItem.getState() == MediaState::Play ) { - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); + mxPlayToolBox->set_item_active("play", true); + mxPlayToolBox->set_item_active("pause", false); + mxPlayToolBox->set_item_active("stop", false); } - else if( aMediaItem.getState() == MediaState::Pause ) + else if( rMediaItem.getState() == MediaState::Pause ) { - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP, false ); + mxPlayToolBox->set_item_active("play", false); + mxPlayToolBox->set_item_active("pause", true); + mxPlayToolBox->set_item_active("stop", false); } else { - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PLAY, false ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_PAUSE, false ); - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_STOP ); + mxPlayToolBox->set_item_active("play", false); + mxPlayToolBox->set_item_active("pause", false); + mxPlayToolBox->set_item_active("stop", true); } - mpPlayToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_LOOP, aMediaItem.isLoop() ); - mpMuteToolBox->CheckItem( AVMEDIA_TOOLBOXITEM_MUTE, aMediaItem.isMute() ); - if( !mpZoomListBox->IsTravelSelect() && !mpZoomListBox->IsInDropDown() ) + mxPlayToolBox->set_item_active("loop", rMediaItem.isLoop()); + mxMuteToolBox->set_item_active("mute", rMediaItem.isMute()); + if (!mbCurrentlySettingZoom) { sal_uInt16 nSelectEntryPos ; - switch( aMediaItem.getZoom() ) + switch( rMediaItem.getZoom() ) { case css::media::ZoomLevel_ZOOM_1_TO_2: nSelectEntryPos = AVMEDIA_ZOOMLEVEL_50; @@ -205,134 +201,61 @@ void MediaControlBase::UpdateToolBoxes(MediaItem aMediaItem) if( nSelectEntryPos != AVMEDIA_ZOOMLEVEL_INVALID ) { - mpZoomListBox->Enable(); - mpZoomListBox->SelectEntryPos( nSelectEntryPos ); + mxZoomListBox->show(); + mxZoomListBox->set_sensitive(true); + mxZoomListBox->set_active(nSelectEntryPos); } else - mpZoomListBox->Disable(); + mxZoomListBox->set_sensitive(false); } } } -void MediaControlBase::SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem const & aItem, sal_uInt16 nId) +void MediaControlBase::SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem const & aItem, const OString& rId) { - switch( nId ) + if (rId == "apply") { - case AVMEDIA_TOOLBOXITEM_INSERT: - { - MediaFloater* pFloater = avmedia::getMediaFloater(); + MediaFloater* pFloater = avmedia::getMediaFloater(); - if( pFloater ) - pFloater->dispatchCurrentURL(); - } - break; - - case AVMEDIA_TOOLBOXITEM_PLAY: - { - aExecItem.setState( MediaState::Play ); - - if( aItem.getTime() == aItem.getDuration() ) - aExecItem.setTime( 0.0 ); - else - aExecItem.setTime( aItem.getTime() ); - } - break; - - case AVMEDIA_TOOLBOXITEM_PAUSE: - { - aExecItem.setState( MediaState::Pause ); - } - break; + if( pFloater ) + pFloater->dispatchCurrentURL(); + } + else if (rId == "play") + { + aExecItem.setState( MediaState::Play ); - case AVMEDIA_TOOLBOXITEM_STOP: - { - aExecItem.setState( MediaState::Stop ); + if( aItem.getTime() == aItem.getDuration() ) aExecItem.setTime( 0.0 ); - } - break; - - case AVMEDIA_TOOLBOXITEM_MUTE: - { - aExecItem.setMute( !mpMuteToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) ); - } - break; - - case AVMEDIA_TOOLBOXITEM_LOOP: - { - aExecItem.setLoop( !mpPlayToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) ); - } - break; - - default: - break; + else + aExecItem.setTime( aItem.getTime() ); } -} - -Image MediaControlBase::GetImage(sal_Int32 nImageId) -{ - const bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge(); - - OUString sImageId; - - if (bLarge) + else if (rId == "pause") { - switch (nImageId) - { - default: - case AVMEDIA_TOOLBOXITEM_PLAY: - sImageId = AVMEDIA_IMG_PLAY_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_PAUSE: - sImageId = AVMEDIA_IMG_PAUSE_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_STOP: - sImageId = AVMEDIA_IMG_STOP_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_MUTE: - sImageId = AVMEDIA_IMG_MUTE_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_LOOP: - sImageId = AVMEDIA_IMG_LOOP_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_OPEN: - sImageId = AVMEDIA_IMG_OPEN_LARGE; - break; - case AVMEDIA_TOOLBOXITEM_INSERT: - sImageId = AVMEDIA_IMG_INSERT_LARGE; - break; - - } + aExecItem.setState( MediaState::Pause ); } - else + else if (rId == "stop") { - switch (nImageId) - { - default: - case AVMEDIA_TOOLBOXITEM_PLAY: - sImageId = AVMEDIA_IMG_PLAY_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_PAUSE: - sImageId = AVMEDIA_IMG_PAUSE_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_STOP: - sImageId = AVMEDIA_IMG_STOP_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_MUTE: - sImageId = AVMEDIA_IMG_MUTE_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_LOOP: - sImageId = AVMEDIA_IMG_LOOP_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_OPEN: - sImageId = AVMEDIA_IMG_OPEN_NORMAL; - break; - case AVMEDIA_TOOLBOXITEM_INSERT: - sImageId = AVMEDIA_IMG_INSERT_NORMAL; - break; - } + aExecItem.setState( MediaState::Stop ); + aExecItem.setTime( 0.0 ); } + else if (rId == "mute") + { + aExecItem.setMute( mxMuteToolBox->get_item_active("mute") ); + } + else if (rId == "loop") + { + aExecItem.setLoop( mxPlayToolBox->get_item_active("loop") ); + } +} - return Image(StockImage::Yes, sImageId); +void MediaControlBase::disposeWidgets() +{ + mxZoomListBox.reset(); + mxTimeEdit.reset(); + mxVolumeSlider.reset(); + mxMuteToolBox.reset(); + mxTimeSlider.reset(); + mxPlayToolBox.reset(); } } diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 43f04ce40b3e..fc83dd1baa79 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -24,7 +24,12 @@ #include <helpids.h> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <vcl/lstbox.hxx> +#include <vcl/layout.hxx> +#include <vcl/weld.hxx> +#include <unotools/syslocale.hxx> +#include <sfx2/viewfrm.hxx> +#include <math.h> +#include <algorithm> #include <avmedia/MediaControlBase.hxx> namespace avmedia @@ -34,21 +39,31 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl Control( pParent ), MediaControlBase(), maIdle( "avmedia MediaControl Idle" ), + maChangeTimeIdle( "avmedia MediaControl Change Time Idle" ), maItem( 0, AVMediaSetMask::ALL ), mbLocked( false ), meControlStyle( eControlStyle ), mfTime(0.0) { - mpPlayToolBox = VclPtr<ToolBox>::Create(this, WB_3DLOOK) ; - mpTimeSlider = VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK) ; - mpTimeSlider->SetScrollTypeSet(true); - mpMuteToolBox = VclPtr<ToolBox>::Create(this, WB_3DLOOK) ; - mpVolumeSlider = VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG) ; - mpVolumeSlider->SetScrollTypeSet(true); - mpZoomToolBox = VclPtr<ToolBox>::Create(this, WB_3DLOOK) ; - mpZoomListBox = VclPtr<ListBox>::Create( mpZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ; - mpTimeEdit = VclPtr<Edit>::Create(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK ) ; - mpMediaPath = VclPtr<FixedText>::Create(this, WB_VCENTER | WB_READONLY | WB_BORDER | WB_3DLOOK ) ; + SetStyle(GetStyle() | WB_DIALOGCONTROL); + + m_xVclContentArea = VclPtr<VclVBox>::Create(this); + m_xVclContentArea->Show(); + // MEDIACONTROLSTYLE_MULTILINE is the normal docking windows of tools->media player + // MEDIACONTROLSTYLE_SINGLELINE is the toolbar of view->toolbar->media playback + m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, + eControlStyle == MEDIACONTROLSTYLE_MULTILINE ? + OUString("svx/ui/mediawindow.ui") : + OUString("svx/ui/medialine.ui"))); + m_xContainer = m_xBuilder->weld_container("MediaWindow"); + + mxPlayToolBox = m_xBuilder->weld_toolbar("playtoolbox"); + mxTimeSlider = m_xBuilder->weld_scale("timeslider"); + mxMuteToolBox = m_xBuilder->weld_toolbar("mutetoolbox"); + mxVolumeSlider = m_xBuilder->weld_scale("volumeslider"); + mxZoomListBox = m_xBuilder->weld_combo_box("zoombox"); + mxTimeEdit = m_xBuilder->weld_entry("timeedit"); + mxMediaPath = m_xBuilder->weld_label("url"); SetBackground(); SetPaintTransparent( true ); @@ -56,59 +71,31 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl InitializeWidgets(); - mpPlayToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - mpPlayToolBox->SetSizePixel( mpPlayToolBox->CalcWindowSizePixel() ); - mpPlayToolBox->Show(); - maMinSize = mpPlayToolBox->GetSizePixel(); + mxPlayToolBox->connect_clicked( LINK( this, MediaControl, implSelectHdl ) ); - mpTimeSlider->SetSlideHdl( LINK( this, MediaControl, implTimeHdl ) ); - mpTimeSlider->SetEndSlideHdl( LINK( this, MediaControl, implTimeEndHdl ) ); - mpTimeSlider->SetSizePixel( Size( 128, mpPlayToolBox->GetSizePixel().Height() ) ); - mpTimeSlider->Show(); - maMinSize.AdjustWidth(mpTimeSlider->GetSizePixel().Width() ); + mxTimeSlider->connect_value_changed( LINK( this, MediaControl, implTimeHdl ) ); + // when changint the time, use this to do the time change after active scrolling + // has stopped for a little which + maChangeTimeIdle.SetPriority( TaskPriority::LOWEST ); + maChangeTimeIdle.SetInvokeHandler( LINK( this, MediaControl, implTimeEndHdl ) ); const OUString aTimeText( " 00:00:00/00:00:00 " ); - mpTimeEdit->SetSizePixel( Size( mpTimeEdit->GetTextWidth( aTimeText ) + 8, mpPlayToolBox->GetSizePixel().Height() ) ); - mpTimeEdit->SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - maMinSize.AdjustWidth(mpTimeEdit->GetSizePixel().Width() ); + mxTimeEdit->set_text(aTimeText); + Size aTextSize = mxTimeEdit->get_preferred_size(); + mxTimeEdit->set_size_request(aTextSize.Width(), aTextSize.Height()); + mxTimeEdit->set_text(OUString()); - mpMuteToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - mpMuteToolBox->SetSizePixel( mpMuteToolBox->CalcWindowSizePixel() ); - mpMuteToolBox->Show(); - maMinSize.AdjustWidth(mpMuteToolBox->GetSizePixel().Width() ); + mxMuteToolBox->connect_clicked( LINK( this, MediaControl, implSelectHdl ) ); + mxVolumeSlider->connect_value_changed( LINK( this, MediaControl, implVolumeHdl ) ); - mpVolumeSlider->SetSlideHdl( LINK( this, MediaControl, implVolumeHdl ) ); - mpVolumeSlider->SetSizePixel( Size( 48, mpPlayToolBox->GetSizePixel().Height() ) ); - mpVolumeSlider->Show(); - maMinSize.AdjustWidth(mpVolumeSlider->GetSizePixel().Width() ); - - mpZoomListBox->SetSizePixel( Size( mpTimeEdit->GetSizePixel().Width(), 260 ) ); - mpZoomListBox->SetSelectHdl( LINK( this, MediaControl, implZoomSelectHdl ) ); - - mpZoomToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_ZOOM, AvmResId( AVMEDIA_STR_ZOOM ) ); - mpZoomToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_ZOOM, HID_AVMEDIA_ZOOMLISTBOX ); - - mpZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, mpZoomListBox ); - mpZoomToolBox->SetSelectHdl( LINK( this, MediaControl, implSelectHdl ) ); - mpZoomToolBox->SetSizePixel( mpZoomToolBox->CalcWindowSizePixel() ); - mpZoomToolBox->Show(); - maMinSize.AdjustWidth(mpZoomToolBox->GetSizePixel().Width() ); + mxZoomListBox->connect_changed( LINK( this, MediaControl, implZoomSelectHdl ) ); + mxZoomListBox->set_help_id(HID_AVMEDIA_ZOOMLISTBOX); const OUString aMediaPath( AvmResId( AVMEDIA_MEDIA_PATH_DEFAULT ) ); - mpMediaPath->SetText(aMediaPath); - mpMediaPath->SetUpdateMode( false ); - mpMediaPath->SetSizePixel( Size( mpMediaPath->GetTextWidth( aMediaPath ) + 400, mpPlayToolBox->GetSizePixel().Height() ) ); // maybe extend the no. 400 to span the screen width - mpMediaPath->SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - mpMediaPath->Show(); - maMinSize.AdjustWidth(mpMediaPath->GetSizePixel().Width() ); - - if( meControlStyle == MEDIACONTROLSTYLE_MULTILINE ) - { - maMinSize.setWidth( 256 ); - maMinSize.setHeight( ( maMinSize.Height() << 1 ) + AVMEDIA_CONTROLOFFSET ); - mpZoomToolBox->SetBackground(); - mpZoomToolBox->SetPaintTransparent( true ); - } + mxMediaPath->set_label(aMediaPath); + if (meControlStyle == MEDIACONTROLSTYLE_SINGLELINE) + mxMediaPath->set_size_request(mxMediaPath->get_preferred_size().Width() + 400, -1); // maybe extend the no. 400 to span the screen width + // we want time field + progress slider to update as the media plays // give this task a lower prio than REPAINT so that UI updates are not starved maIdle.SetPriority( TaskPriority::POST_PAINT ); @@ -119,25 +106,12 @@ void MediaControl::InitializeWidgets() { if( meControlStyle != MEDIACONTROLSTYLE_SINGLELINE ) { - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, GetImage(AVMEDIA_TOOLBOXITEM_OPEN), AvmResId( AVMEDIA_STR_OPEN ) ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); - mpPlayToolBox->InsertItem( AVMEDIA_TOOLBOXITEM_INSERT, GetImage(AVMEDIA_TOOLBOXITEM_INSERT), AvmResId( AVMEDIA_STR_INSERT ) ); - mpPlayToolBox->SetHelpId( AVMEDIA_TOOLBOXITEM_INSERT, HID_AVMEDIA_TOOLBOXITEM_INSERT ); - mpPlayToolBox->InsertSeparator(); - } - else - { - mpZoomListBox->SetBackground(); - mpPlayToolBox->SetBackground(); - mpPlayToolBox->SetPaintTransparent( true ); - mpMuteToolBox->SetBackground(); - mpMuteToolBox->SetPaintTransparent( true ); - mpMuteToolBox->InsertSeparator(); + mxPlayToolBox->set_item_help_id("open", HID_AVMEDIA_TOOLBOXITEM_OPEN); + mxPlayToolBox->set_item_label("open", AvmResId(AVMEDIA_STR_OPEN)); + mxPlayToolBox->set_item_help_id("apply", HID_AVMEDIA_TOOLBOXITEM_INSERT); + mxPlayToolBox->set_item_label("apply", AvmResId(AVMEDIA_STR_INSERT)); } avmedia::MediaControlBase::InitializeWidgets(); - - if( meControlStyle == MEDIACONTROLSTYLE_SINGLELINE ) - mpPlayToolBox->InsertSeparator(); } MediaControl::~MediaControl() @@ -147,95 +121,32 @@ MediaControl::~MediaControl() void MediaControl::dispose() { - mpZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, nullptr ); - mpZoomListBox.disposeAndClear(); - mpTimeEdit.disposeAndClear(); - mpMediaPath.disposeAndClear(); - mpZoomToolBox.disposeAndClear(); - mpVolumeSlider.disposeAndClear(); - mpMuteToolBox.disposeAndClear(); - mpTimeSlider.disposeAndClear(); - mpPlayToolBox.disposeAndClear(); + disposeWidgets(); + mxMediaPath.reset(); + m_xContainer.reset(); + m_xBuilder.reset(); + m_xVclContentArea.disposeAndClear(); Control::dispose(); } -const Size& MediaControl::getMinSizePixel() const +Size MediaControl::getMinSizePixel() const { - return maMinSize; + return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild)); } void MediaControl::UpdateURLField(MediaItem const & tempItem) { const OUString aURL( AvmResId(AVMEDIA_MEDIA_PATH) + ": " + tempItem.getURL() ) ; - mpMediaPath->SetText(aURL); - mpMediaPath->SetUpdateMode( false ); - mpMediaPath->SetSizePixel( Size( mpMediaPath->GetTextWidth( aURL ) + 8, mpPlayToolBox->GetSizePixel().Height() ) ); - mpMediaPath->SetControlBackground( Application::GetSettings().GetStyleSettings().GetWindowColor() ); - mpMediaPath->Show(); - maMinSize.AdjustWidth(mpMediaPath->GetSizePixel().Width() ); + mxMediaPath->set_label(aURL); } void MediaControl::Resize() { - Point aPos( 0, 0 ); - const sal_Int32 nPlayToolBoxWidth = mpPlayToolBox->GetSizePixel().Width(); - const sal_Int32 nMuteToolBoxWidth = mpMuteToolBox->GetSizePixel().Width(); - const sal_Int32 nVolumeSliderWidth = mpVolumeSlider->GetSizePixel().Width(); - const sal_Int32 nZoomToolBoxWidth = mpZoomToolBox->GetSizePixel().Width(); - const sal_Int32 nTimeEditWidth = mpTimeEdit->GetSizePixel().Width(); - const sal_Int32 nMediaPathWidth = mpMediaPath->GetSizePixel().Width(); - const sal_Int32 nTimeSliderHeight = mpTimeSlider->GetSizePixel().Height(); - - if( meControlStyle == MEDIACONTROLSTYLE_SINGLELINE ) - { - const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - ( AVMEDIA_CONTROLOFFSET * 4 ) - - nPlayToolBoxWidth - nMuteToolBoxWidth - nVolumeSliderWidth - nTimeEditWidth - nZoomToolBoxWidth - nMediaPathWidth; - - mpPlayToolBox->SetPosSizePixel( aPos, mpPlayToolBox->GetSizePixel() ); - - aPos.AdjustX(nPlayToolBoxWidth ); - mpTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); - - aPos.AdjustX(nTimeSliderWidth + AVMEDIA_CONTROLOFFSET ); - mpTimeEdit->SetPosSizePixel( aPos, mpTimeEdit->GetSizePixel() ); - - aPos.AdjustX(nTimeEditWidth + AVMEDIA_CONTROLOFFSET ); - mpMuteToolBox->SetPosSizePixel( aPos, mpMuteToolBox->GetSizePixel() ); - - aPos.AdjustX(nMuteToolBoxWidth ); - mpVolumeSlider->SetPosSizePixel( aPos, mpVolumeSlider->GetSizePixel() ); - - aPos.AdjustX(nVolumeSliderWidth + AVMEDIA_CONTROLOFFSET ); - mpZoomToolBox->SetPosSizePixel( aPos, mpZoomToolBox->GetSizePixel() ); - - aPos.AdjustX(nZoomToolBoxWidth + AVMEDIA_CONTROLOFFSET ); - mpMediaPath->SetPosSizePixel( aPos, mpMediaPath->GetSizePixel() ); - } - else - { - const sal_Int32 nTimeSliderWidth = GetSizePixel().Width() - AVMEDIA_CONTROLOFFSET - nTimeEditWidth; - - mpTimeSlider->SetPosSizePixel( aPos, Size( nTimeSliderWidth, nTimeSliderHeight ) ); - - aPos.AdjustX(nTimeSliderWidth + AVMEDIA_CONTROLOFFSET ); - mpTimeEdit->SetPosSizePixel( aPos, mpTimeEdit->GetSizePixel() ); - - aPos.setX( 0 ); - aPos.AdjustY(nTimeSliderHeight + AVMEDIA_CONTROLOFFSET ); - mpPlayToolBox->SetPosSizePixel( aPos, mpPlayToolBox->GetSizePixel() ); - - aPos.setX( GetSizePixel().Width() - nVolumeSliderWidth - nMuteToolBoxWidth - nZoomToolBoxWidth - AVMEDIA_CONTROLOFFSET ); - mpMuteToolBox->SetPosSizePixel( aPos, mpMuteToolBox->GetSizePixel() ); - - aPos.AdjustX(nMuteToolBoxWidth ); - mpVolumeSlider->SetPosSizePixel( aPos, mpVolumeSlider->GetSizePixel() ); - - aPos.setX( GetSizePixel().Width() - nZoomToolBoxWidth ); - mpZoomToolBox->SetPosSizePixel( aPos, mpZoomToolBox->GetSizePixel() ); - } + vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); + assert(pChild); + VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); } - void MediaControl::setState( const MediaItem& rItem ) { double fTime = rItem.getTime(); @@ -244,7 +155,7 @@ void MediaControl::setState( const MediaItem& rItem ) mfTime = fTime; maItem.merge( rItem ); if( rItem.getURL().isEmpty() && meControlStyle == MEDIACONTROLSTYLE_SINGLELINE ) - mpPlayToolBox->Disable(); + mxPlayToolBox->set_sensitive(false); UpdateToolBoxes( maItem ); UpdateTimeSlider( maItem ); UpdateVolumeSlider( maItem ); @@ -253,19 +164,19 @@ void MediaControl::setState( const MediaItem& rItem ) } } -IMPL_LINK( MediaControl, implTimeHdl, Slider*, p, void ) +IMPL_LINK( MediaControl, implTimeHdl, weld::Scale&, rSlider, void ) { mbLocked = true; maIdle.Stop(); - UpdateTimeField( maItem, p->GetThumbPos() * maItem.getDuration() / AVMEDIA_TIME_RANGE ); + UpdateTimeField(maItem, rSlider.get_value() * maItem.getDuration() / AVMEDIA_TIME_RANGE); + maChangeTimeIdle.Start(); } - -IMPL_LINK( MediaControl, implTimeEndHdl, Slider*, p, void ) +IMPL_LINK_NOARG(MediaControl, implTimeEndHdl, Timer*, void) { MediaItem aExecItem; - aExecItem.setTime( p->GetThumbPos() * maItem.getDuration() / AVMEDIA_TIME_RANGE ); + aExecItem.setTime( mxTimeSlider->get_value() * maItem.getDuration() / AVMEDIA_TIME_RANGE ); // keep state (if the media was playing, keep it playing) aExecItem.setState(maItem.getState()); execute( aExecItem ); @@ -274,63 +185,56 @@ IMPL_LINK( MediaControl, implTimeEndHdl, Slider*, p, void ) mbLocked = false; } - -IMPL_LINK( MediaControl, implVolumeHdl, Slider*, p, void ) +IMPL_LINK( MediaControl, implVolumeHdl, weld::Scale&, rSlider, void ) { MediaItem aExecItem; - aExecItem.setVolumeDB( static_cast< sal_Int16 >( p->GetThumbPos() ) ); + aExecItem.setVolumeDB(rSlider.get_value()); execute( aExecItem ); update(); } - -IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p, void ) +IMPL_LINK( MediaControl, implSelectHdl, const OString&, rIdent, void ) { - if( p ) + MediaItem aExecItem; + if (rIdent == "open") { - MediaItem aExecItem; - if( p->GetCurItemId() == AVMEDIA_TOOLBOXITEM_OPEN ) + OUString aURL; + if (MediaWindow::executeMediaURLDialog(GetFrameWeld(), aURL, nullptr)) { - OUString aURL; - if (MediaWindow::executeMediaURLDialog(GetFrameWeld(), aURL, nullptr)) + if( !MediaWindow::isMediaURL( aURL, ""/*TODO?*/, true ) ) + MediaWindow::executeFormatErrorBox(GetFrameWeld()); + else { - if( !MediaWindow::isMediaURL( aURL, ""/*TODO?*/, true ) ) - MediaWindow::executeFormatErrorBox(GetFrameWeld()); - else - { - aExecItem.setURL( aURL, "", ""/*TODO?*/ ); - aExecItem.setState( MediaState::Play ); - } + aExecItem.setURL( aURL, "", ""/*TODO?*/ ); + aExecItem.setState( MediaState::Play ); } } - else - SelectPlayToolBoxItem( aExecItem, maItem, p->GetCurItemId() ); + } + else + SelectPlayToolBoxItem( aExecItem, maItem, rIdent ); - if (aExecItem.getState() == MediaState::Play) - maIdle.Start(); - else if (aExecItem.getState() == MediaState::Pause || - aExecItem.getState() == MediaState::Stop) - maIdle.Stop(); + if (aExecItem.getState() == MediaState::Play) + maIdle.Start(); + else if (aExecItem.getState() == MediaState::Pause || + aExecItem.getState() == MediaState::Stop) + maIdle.Stop(); - if( aExecItem.getMaskSet() != AVMediaSetMask::NONE ) - execute( aExecItem ); - } + if( aExecItem.getMaskSet() != AVMediaSetMask::NONE ) + execute( aExecItem ); update(); - if(p) - { - p->Invalidate( InvalidateFlags::Update ); - } } - -IMPL_LINK( MediaControl, implZoomSelectHdl, ListBox&, p, void ) +IMPL_LINK( MediaControl, implZoomSelectHdl, weld::ComboBox&, rBox, void ) { + bool bCurrentlySettingZoom = mbCurrentlySettingZoom; + mbCurrentlySettingZoom = true; + MediaItem aExecItem; css::media::ZoomLevel eLevel; - switch( p.GetSelectedEntryPos() ) + switch (rBox.get_active()) { case AVMEDIA_ZOOMLEVEL_50: eLevel = css::media::ZoomLevel_ZOOM_1_TO_2; break; case AVMEDIA_ZOOMLEVEL_100: eLevel = css::media::ZoomLevel_ORIGINAL; break; @@ -344,8 +248,9 @@ IMPL_LINK( MediaControl, implZoomSelectHdl, ListBox&, p, void ) aExecItem.setZoom( eLevel ); execute( aExecItem ); update(); -} + mbCurrentlySettingZoom = bCurrentlySettingZoom; +} IMPL_LINK_NOARG(MediaControl, implTimeoutHdl, Timer *, void) { diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index 69aeb220295c..b085d8a77f39 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -23,6 +23,7 @@ #include <tools/debug.hxx> #include <sfx2/sfxsids.hrc> +#include <vcl/toolbox.hxx> #include <comphelper/propertysequence.hxx> diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index e34b7fb0d6a0..fdc78575f8b7 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -31,6 +31,8 @@ #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <unotools/securityoptions.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/svapp.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/ptrstyle.hxx> diff --git a/include/avmedia/MediaControlBase.hxx b/include/avmedia/MediaControlBase.hxx index 73febe30fd76..2db0cf637160 100644 --- a/include/avmedia/MediaControlBase.hxx +++ b/include/avmedia/MediaControlBase.hxx @@ -19,10 +19,7 @@ #ifndef INCLUDED_AVMEDIA_MEDIACONTROLBASE_HXX #define INCLUDED_AVMEDIA_MEDIACONTROLBASE_HXX -#include <vcl/edit.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/slider.hxx> +#include <vcl/weld.hxx> #include <avmedia/avmediadllapi.h> @@ -64,19 +61,21 @@ public: virtual ~MediaControlBase(){}; protected: - VclPtr<ToolBox> mpPlayToolBox; - VclPtr<Slider> mpTimeSlider; - VclPtr<ToolBox> mpMuteToolBox; - VclPtr<Slider> mpVolumeSlider; - VclPtr<ListBox> mpZoomListBox; - VclPtr<Edit> mpTimeEdit; - static Image GetImage(sal_Int32 nImageId); + std::unique_ptr<weld::Toolbar> mxPlayToolBox; + std::unique_ptr<weld::Scale> mxTimeSlider; + std::unique_ptr<weld::Toolbar> mxMuteToolBox; + std::unique_ptr<weld::Scale> mxVolumeSlider; + std::unique_ptr<weld::ComboBox> mxZoomListBox; + std::unique_ptr<weld::Entry> mxTimeEdit; + bool mbCurrentlySettingZoom; + virtual void InitializeWidgets(); - virtual void UpdateToolBoxes( MediaItem aMediaItem ); + virtual void UpdateToolBoxes(const MediaItem& rMediaItem); void UpdateVolumeSlider( MediaItem const & aMediaItem ); void UpdateTimeSlider( MediaItem const & aMediaItem ); void UpdateTimeField( MediaItem const & aMediaItem, double fTime ); - void SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem const & aItem, sal_uInt16 nId); + void SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem const & aItem, const OString& rId); + void disposeWidgets(); }; } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e8046664e1a2..9bbf612b3375 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1262,6 +1262,10 @@ public: virtual void set_value(int value) = 0; virtual int get_value() const = 0; virtual void set_range(int min, int max) = 0; + + virtual void set_increments(int step, int page) = 0; + virtual void get_increments(int& step, int& page) const = 0; + void connect_value_changed(const Link<Scale&, void>& rLink) { m_aValueChangedHdl = rLink; } }; @@ -1986,6 +1990,7 @@ public: virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0; virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0; virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0; + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0; virtual bool get_item_visible(const OString& rIdent) const = 0; virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0; virtual OUString get_item_label(const OString& rIdent) const = 0; diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr index 97ec0ee9083c..fec4f1c6f10f 100644 --- a/solenv/sanitizers/ui/svx.suppr +++ b/solenv/sanitizers/ui/svx.suppr @@ -45,12 +45,15 @@ svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelFooterFormat'] orphan svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statusurl'] orphan-label svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statuspos'] orphan-label svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statussize'] orphan-label -svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label1'] orphan-label -svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label2'] orphan-label -svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label3'] orphan-label -svx/uiconfig/ui/mediaplayback.ui://GtkScale[@id='timeslider'] no-labelled-by -svx/uiconfig/ui/mediaplayback.ui://GtkEntry[@id='timeedit:border'] no-labelled-by -svx/uiconfig/ui/mediaplayback.ui://GtkScale[@id='volumeslider'] no-labelled-by +svx/uiconfig/ui/mediaplayback.ui://GtkEntry[@id='timeedit'] no-labelled-by +svx/uiconfig/ui/medialine.ui://GtkEntry[@id='timeedit'] no-labelled-by +svx/uiconfig/ui/medialine.ui://GtkLabel[@id='url'] orphan-label +svx/uiconfig/ui/medialine.ui://GtkScale[@id='timeslider'] no-labelled-by +svx/uiconfig/ui/medialine.ui://GtkScale[@id='volumeslider'] no-labelled-by +svx/uiconfig/ui/mediawindow.ui://GtkEntry[@id='timeedit'] no-labelled-by +svx/uiconfig/ui/mediawindow.ui://GtkLabel[@id='url'] orphan-label +svx/uiconfig/ui/mediawindow.ui://GtkScale[@id='timeslider'] no-labelled-by +svx/uiconfig/ui/mediawindow.ui://GtkScale[@id='volumeslider'] no-labelled-by svx/uiconfig/ui/numberingwindow.ui://GtkButton[@id='more'] button-no-label svx/uiconfig/ui/oldcolorwindow.ui://GtkButton[@id='auto_color_button'] button-no-label svx/uiconfig/ui/oldcolorwindow.ui://GtkComboBox[@id='palette_listbox'] no-labelled-by @@ -69,6 +72,7 @@ svx/uiconfig/ui/redlinefilterpage.ui://GtkLabel[@id='and'] orphan-label svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label1'] orphan-label svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label3'] orphan-label svx/uiconfig/ui/safemodedialog.ui://GtkLabel[@id='label4'] orphan-label +svx/uiconfig/ui/sidebararea.ui://GtkLabel[@id='filllabel'] orphan-label svx/uiconfig/ui/sidebararea.ui://GtkLabel[@id='transparencylabel'] orphan-label svx/uiconfig/ui/sidebarshadow.ui://GtkLabel[@id='transparency_label'] orphan-label svx/uiconfig/ui/sidebarshadow.ui://GtkSpinButton[@id='FIELD_TRANSPARENCY'] no-labelled-by diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index bf3d64b015cf..e8a02daec4b6 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -75,7 +75,9 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/lightingwindow \ svx/uiconfig/ui/linkwarndialog \ svx/uiconfig/ui/measurewidthbar \ + svx/uiconfig/ui/medialine \ svx/uiconfig/ui/mediaplayback \ + svx/uiconfig/ui/mediawindow \ svx/uiconfig/ui/namespacedialog \ svx/uiconfig/ui/numberingwindow \ svx/uiconfig/ui/oldcolorwindow \ diff --git a/svx/source/sidebar/media/MediaPlaybackPanel.cxx b/svx/source/sidebar/media/MediaPlaybackPanel.cxx index 5fb0e2c8e86f..909eb2798a22 100644 --- a/svx/source/sidebar/media/MediaPlaybackPanel.cxx +++ b/svx/source/sidebar/media/MediaPlaybackPanel.cxx @@ -36,18 +36,19 @@ MediaPlaybackPanel::MediaPlaybackPanel ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) - : PanelLayout(pParent, "MediaPlaybackPanel", "svx/ui/mediaplayback.ui", rxFrame), + : PanelLayout(pParent, "MediaPlaybackPanel", "svx/ui/mediaplayback.ui", rxFrame, true), MediaControlBase(), maMediaController(SID_AVMEDIA_TOOLBOX, *pBindings, *this), maIdle("MediaPlaybackPanel"), mpBindings(pBindings) { - get(mpTimeEdit, "timeedit"); - get(mpPlayToolBox, "playtoolbox"); - get(mpMuteToolBox, "mutetoolbox"); - get(mpTimeSlider, "timeslider"); - get(mpVolumeSlider, "volumeslider"); - get(mpZoomListBox, "zoombox"); + mxTimeEdit = m_xBuilder->weld_entry("timeedit"); + mxPlayToolBox = m_xBuilder->weld_toolbar("playtoolbox"); + mxMuteToolBox = m_xBuilder->weld_toolbar("mutetoolbox"); + mxTimeSlider = m_xBuilder->weld_scale("timeslider"); + mxVolumeSlider = m_xBuilder->weld_scale("volumeslider"); + mxZoomListBox = m_xBuilder->weld_combo_box("zoombox"); + Initialize(); } @@ -77,10 +78,10 @@ MediaPlaybackPanel::~MediaPlaybackPanel() void MediaPlaybackPanel::Initialize() { InitializeWidgets(); - mpVolumeSlider->SetSlideHdl(LINK(this, MediaPlaybackPanel, VolumeSlideHdl)); - mpPlayToolBox->SetSelectHdl(LINK(this, MediaPlaybackPanel, PlayToolBoxSelectHdl)); - mpMuteToolBox->SetSelectHdl(LINK(this, MediaPlaybackPanel, PlayToolBoxSelectHdl)); - mpTimeSlider->SetSlideHdl(LINK(this, MediaPlaybackPanel, SeekHdl)); + mxVolumeSlider->connect_value_changed(LINK(this, MediaPlaybackPanel, VolumeSlideHdl)); + mxPlayToolBox->connect_clicked(LINK(this, MediaPlaybackPanel, PlayToolBoxSelectHdl)); + mxMuteToolBox->connect_clicked(LINK(this, MediaPlaybackPanel, PlayToolBoxSelectHdl)); + mxTimeSlider->connect_value_changed(LINK(this, MediaPlaybackPanel, SeekHdl)); maIdle.SetPriority( TaskPriority::HIGHEST ); maIdle.SetInvokeHandler( LINK( this, MediaPlaybackPanel, TimeoutHdl ) ); @@ -90,7 +91,7 @@ void MediaPlaybackPanel::Initialize() void MediaPlaybackPanel::dispose() { - mpTimeEdit.disposeAndClear(); + disposeWidgets(); PanelLayout::dispose(); } @@ -109,10 +110,10 @@ void MediaPlaybackPanel::NotifyItemUpdate( } } -void MediaPlaybackPanel::UpdateToolBoxes(MediaItem aMediaItem) +void MediaPlaybackPanel::UpdateToolBoxes(const MediaItem& rMediaItem) { - mpPlayToolBox->Disable(); - avmedia::MediaControlBase::UpdateToolBoxes(aMediaItem); + mxPlayToolBox->set_sensitive(false); + avmedia::MediaControlBase::UpdateToolBoxes(rMediaItem); } void MediaPlaybackPanel::Update() @@ -126,20 +127,20 @@ void MediaPlaybackPanel::Update() } } -IMPL_LINK_NOARG( MediaPlaybackPanel, VolumeSlideHdl, Slider*, void) +IMPL_LINK_NOARG( MediaPlaybackPanel, VolumeSlideHdl, weld::Scale&, void) { MediaItem aItem(SID_AVMEDIA_TOOLBOX); - aItem.setVolumeDB( static_cast< sal_Int16 > (mpVolumeSlider->GetThumbPos())); + aItem.setVolumeDB(mxVolumeSlider->get_value()); mpBindings->GetDispatcher()->ExecuteList(SID_AVMEDIA_TOOLBOX, SfxCallMode::RECORD, { &aItem }); } -IMPL_LINK_NOARG( MediaPlaybackPanel, SeekHdl, Slider*, void) +IMPL_LINK_NOARG( MediaPlaybackPanel, SeekHdl, weld::Scale&, void) { MediaItem aItem(SID_AVMEDIA_TOOLBOX); aItem.setState( MediaState::Pause ); double nTime = 0; if (mpMediaItem) - nTime = mpTimeSlider->GetThumbPos() * mpMediaItem->getDuration() / AVMEDIA_TIME_RANGE; + nTime = mxTimeSlider->get_value() * mpMediaItem->getDuration() / AVMEDIA_TIME_RANGE; aItem.setTime(nTime); mpBindings->GetDispatcher()->ExecuteList(SID_AVMEDIA_TOOLBOX, SfxCallMode::RECORD, { &aItem }); mpBindings->Invalidate(SID_AVMEDIA_TOOLBOX); @@ -150,48 +151,37 @@ IMPL_LINK_NOARG( MediaPlaybackPanel, TimeoutHdl, Timer*, void) mpBindings->Invalidate(SID_AVMEDIA_TOOLBOX); } -IMPL_LINK( MediaPlaybackPanel, PlayToolBoxSelectHdl, ToolBox*, pControl, void) +IMPL_LINK( MediaPlaybackPanel, PlayToolBoxSelectHdl, const OString&, rId, void) { MediaItem aItem(SID_AVMEDIA_TOOLBOX); - switch(pControl->GetCurItemId()) - { - case AVMEDIA_TOOLBOXITEM_PLAY: - { - aItem.setState( MediaState::Play ); - if( !mpMediaItem || (mpMediaItem->getTime() == mpMediaItem->getDuration() )) - aItem.setTime( 0.0 ); - else - aItem.setTime( mpMediaItem->getTime()); - } - break; - - case AVMEDIA_TOOLBOXITEM_PAUSE: - { - aItem.setState( MediaState::Pause ); - } - break; + if (rId == "play") + { + aItem.setState( MediaState::Play ); - case AVMEDIA_TOOLBOXITEM_STOP: - { - aItem.setState( MediaState::Stop ); + if( !mpMediaItem || (mpMediaItem->getTime() == mpMediaItem->getDuration() )) aItem.setTime( 0.0 ); - } - break; - - case AVMEDIA_TOOLBOXITEM_MUTE: - { - aItem.setMute( !mpMuteToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_MUTE ) ); - } - break; - - case AVMEDIA_TOOLBOXITEM_LOOP: - { - aItem.setLoop( !mpPlayToolBox->IsItemChecked( AVMEDIA_TOOLBOXITEM_LOOP ) ); - } - break; - default: break; + else + aItem.setTime( mpMediaItem->getTime()); + } + else if (rId == "pause") + { + aItem.setState( MediaState::Pause ); + } + else if (rId == "stop") + { + aItem.setState( MediaState::Stop ); + aItem.setTime( 0.0 ); + } + else if (rId == "mute") + { + aItem.setMute( mxMuteToolBox->get_item_active("mute") ); } + else if (rId == "loop") + { + aItem.setLoop( mxPlayToolBox->get_item_active("loop") ); + } + if(aItem.getMaskSet() != AVMediaSetMask::NONE) { mpBindings->GetDispatcher()->ExecuteList(SID_AVMEDIA_TOOLBOX, SfxCallMode::RECORD, { &aItem } ); diff --git a/svx/source/sidebar/media/MediaPlaybackPanel.hxx b/svx/source/sidebar/media/MediaPlaybackPanel.hxx index 3f9d06de1d03..b7f516aaf746 100644 --- a/svx/source/sidebar/media/MediaPlaybackPanel.hxx +++ b/svx/source/sidebar/media/MediaPlaybackPanel.hxx @@ -23,8 +23,6 @@ #include <com/sun/star/frame/XFrame.hpp> #include <svx/sidebar/PanelLayout.hxx> -#include <vcl/slider.hxx> -#include <vcl/toolbox.hxx> #include <avmedia/mediaitem.hxx> #include <sfx2/bindings.hxx> #include <sfx2/sidebar/ControllerItem.hxx> @@ -56,7 +54,7 @@ public: virtual void dispose() override; protected: - virtual void UpdateToolBoxes(avmedia::MediaItem aMediaItem) override; + virtual void UpdateToolBoxes(const avmedia::MediaItem& rMediaItem) override; private: std::unique_ptr< ::avmedia::MediaItem > mpMediaItem; @@ -68,9 +66,9 @@ private: virtual void NotifyItemUpdate( const sal_uInt16 nSID, const SfxItemState eState, const SfxPoolItem* pState) override; - DECL_LINK(PlayToolBoxSelectHdl, ToolBox*, void); - DECL_LINK(VolumeSlideHdl, Slider*, void); - DECL_LINK(SeekHdl, Slider*, void); + DECL_LINK(PlayToolBoxSelectHdl, const OString&, void); + DECL_LINK(VolumeSlideHdl, weld::Scale&, void); + DECL_LINK(SeekHdl, weld::Scale&, void); DECL_LINK(TimeoutHdl, Timer*, void); }; diff --git a/svx/uiconfig/ui/medialine.ui b/svx/uiconfig/ui/medialine.ui new file mode 100644 index 000000000000..30f39cf12ecc --- /dev/null +++ b/svx/uiconfig/ui/medialine.ui @@ -0,0 +1,292 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkGrid" id="MediaWindow"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkToolbar" id="playtoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToolButton" id="open"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="no">Open</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02048.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="apply"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="no">Apply</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02053.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator1"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="play"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Play</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02049.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="pause"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Pause</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02050.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="stop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Stop</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02051.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="loop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Repeat</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02052.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkToolbar" id="timetoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToolItem"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkScale" id="timeslider"> + <property name="width_request">128</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + <property name="draw_value">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="timeedit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="xalign">0.5</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="homogeneous">False</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="GtkToolbar" id="mutetoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToggleToolButton" id="mute"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Mute</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02054.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolItem"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkScale" id="volumeslider"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="opacity">0.9882352941176471</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment2</property> + <property name="draw_value">False</property> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="homogeneous">False</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkToolbar" id="zoomtoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToolItem"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkComboBoxText" id="zoombox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="homogeneous">False</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="url"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="ellipsize">middle</property> + <property name="width_chars">10</property> + <property name="max_width_chars">10</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">10</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> diff --git a/svx/uiconfig/ui/mediaplayback.ui b/svx/uiconfig/ui/mediaplayback.ui index ac98284e0e6c..829855450117 100644 --- a/svx/uiconfig/ui/mediaplayback.ui +++ b/svx/uiconfig/ui/mediaplayback.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="svx"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="MediaPlaybackPanel"> @@ -11,21 +11,21 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> + <property name="hexpand">True</property> <property name="border_width">6</property> <property name="column_spacing">7</property> - <property name="row_homogeneous">True</property> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mediaplayback|label1">Playback:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">playtoolbox</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -34,12 +34,12 @@ <property name="can_focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mediaplayback|label2">Seek:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">timeslider</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -48,12 +48,12 @@ <property name="can_focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="mediaplayback|label3">Volume:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">volumeslider</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -61,83 +61,191 @@ <property name="width_request">150</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="round_digits">1</property> + <property name="hexpand">True</property> <property name="digits">2</property> <property name="draw_value">False</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="width">2</property> </packing> </child> <child> - <object class="GtkComboBox" id="zoombox"> + <object class="GtkScale" id="volumeslider"> <property name="width_request">150</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes" context="mediaplayback|zoombox|tooltip_text">View</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="opacity">0.9882352941176471</property> + <property name="hexpand">True</property> + <property name="draw_value">False</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="top_attach">3</property> </packing> </child> <child> - <object class="GtkEntry" id="timeedit:border"> - <property name="width_request">150</property> - <property name="visible">True</property> + <object class="GtkComboBoxText" id="zoombox"> <property name="can_focus">False</property> - <property name="editable">False</property> - <property name="xalign">0.5</property> + <property name="no_show_all">True</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="top_attach">4</property> + <property name="width">2</property> </packing> </child> <child> - <object class="GtkToolbar" id="playtoolbox"> + <object class="GtkEntry" id="timeedit"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="xalign">0.5</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="top_attach">2</property> + <property name="width">2</property> </packing> </child> <child> <object class="GtkToolbar" id="mutetoolbox"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">2</property> + <child> + <object class="GtkToggleToolButton" id="mute"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Mute</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02054.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> </object> <packing> <property name="left_attach">2</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkScale" id="volumeslider"> - <property name="width_request">150</property> + <object class="GtkToolbar" id="playtoolbox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="opacity">0.98999999999999999</property> - <property name="draw_value">False</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">2</property> + <child> + <object class="GtkToolButton" id="open"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="no">Open</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02048.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="apply"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="no">Apply</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02053.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator1"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="play"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Play</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02049.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="pause"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Pause</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02050.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="stop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Stop</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02051.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="loop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Repeat</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02052.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="top_attach">0</property> + <property name="width">2</property> </packing> </child> <child> @@ -146,24 +254,10 @@ <child> <placeholder/> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/svx/uiconfig/ui/mediawindow.ui b/svx/uiconfig/ui/mediawindow.ui new file mode 100644 index 000000000000..3c2bfb969ffc --- /dev/null +++ b/svx/uiconfig/ui/mediawindow.ui @@ -0,0 +1,277 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkGrid" id="MediaWindow"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="url"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="ellipsize">middle</property> + <property name="width_chars">10</property> + <property name="max_width_chars">10</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkScale" id="timeslider"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + <property name="draw_value">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="timeedit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="xalign">0.5</property> + </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">3</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkToolbar" id="playtoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToolButton" id="open"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Open</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02048.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="apply"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Apply</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02053.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="play"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Play</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02049.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="pause"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Pause</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02050.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="stop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Stop</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02051.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="separator2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="loop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Repeat</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02052.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkToolbar" id="mutetoolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToggleToolButton" id="mute"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="no">Mute</property> + <property name="use_underline">True</property> + <property name="icon_name">avmedia/res/av02054.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScale" id="volumeslider"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="opacity">0.9882352941176471</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment2</property> + <property name="draw_value">False</property> + </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">5</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="zoombox"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">7</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> +</interface> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 46f2f070e3ca..fedf54d2b833 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -985,6 +985,11 @@ public: m_xToolBox->ShowItem(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)), bVisible); } + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + { + m_xToolBox->SetHelpId(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)), rHelpId); + } + virtual bool get_item_visible(const OString& rIdent) const override { return m_xToolBox->IsItemVisible(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))); @@ -3173,6 +3178,18 @@ public: return m_xScale->GetThumbPos(); } + virtual void set_increments(int step, int page) override + { + m_xScale->SetLineSize(step); + m_xScale->SetPageSize(page); + } + + virtual void get_increments(int& step, int& page) const override + { + step = m_xScale->GetLineSize(); + page = m_xScale->GetPageSize(); + } + virtual ~SalInstanceScale() override { m_xScale->SetSlideHdl(Link<Slider*, void>()); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 2622ccf46d5d..0c4fecab4818 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -7462,6 +7462,11 @@ public: enable_item_notify_events(); } + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + { + ::set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId); + } + virtual bool get_item_visible(const OString& rIdent) const override { return gtk_widget_get_visible(GTK_WIDGET(m_aMap.find(rIdent)->second)); @@ -7785,6 +7790,20 @@ public: enable_notify_events(); } + virtual void set_increments(int step, int page) override + { + disable_notify_events(); + gtk_range_set_increments(GTK_RANGE(m_pScale), step, page); + enable_notify_events(); + } + + virtual void get_increments(int& step, int& page) const override + { + GtkAdjustment* pAdjustment = gtk_range_get_adjustment(GTK_RANGE(m_pScale)); + step = gtk_adjustment_get_step_increment(pAdjustment); + page = gtk_adjustment_get_page_increment(pAdjustment); + } + virtual int get_value() const override { return gtk_range_get_value(GTK_RANGE(m_pScale)); |