weld GraphicPropertyPanel

Change-Id: I05293f7421815e7588dcf344fcd221ca337b116d
Reviewed-on: https://gerrit.libreoffice.org/85550
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2019-12-19 17:25:51 +00:00
parent 07754d0102
commit 49285e4370
4 changed files with 156 additions and 182 deletions

View File

@ -67,14 +67,6 @@ 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://GtkLabel[@id='transparency_label'] orphan-label
svx/uiconfig/ui/sidebarshadow.ui://GtkSpinButton[@id='FIELD_TRANSPARENCY'] no-labelled-by svx/uiconfig/ui/sidebarshadow.ui://GtkSpinButton[@id='FIELD_TRANSPARENCY'] no-labelled-by
svx/uiconfig/ui/sidebarshadow.ui://GtkScale[@id='transparency_slider'] no-labelled-by svx/uiconfig/ui/sidebarshadow.ui://GtkScale[@id='transparency_slider'] no-labelled-by
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setbrightness:%'] missing-label-for
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setbrightness:%'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setcontrast:%'] missing-label-for
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setcontrast:%'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebargraphic.ui://GtkComboBoxText[@id='setcolormode'] missing-label-for
svx/uiconfig/ui/sidebargraphic.ui://GtkComboBoxText[@id='setcolormode'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setgraphtransparency:%'] missing-label-for
svx/uiconfig/ui/sidebargraphic.ui://GtkSpinButton[@id='setgraphtransparency:%'] labelled-by-and-mnemonic
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='widthlabel'] orphan-label svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='widthlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='colorlabel'] orphan-label svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='colorlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='translabel'] orphan-label svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='translabel'] orphan-label

View File

@ -41,7 +41,7 @@ GraphicPropertyPanel::GraphicPropertyPanel(
vcl::Window* pParent, vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame, const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings) SfxBindings* pBindings)
: PanelLayout(pParent, "GraphicPropertyPanel", "svx/ui/sidebargraphic.ui", rxFrame), : PanelLayout(pParent, "GraphicPropertyPanel", "svx/ui/sidebargraphic.ui", rxFrame, true),
maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this), maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this),
maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this), maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this),
maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this), maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this),
@ -50,17 +50,17 @@ GraphicPropertyPanel::GraphicPropertyPanel(
maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this), maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this),
maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this), maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this),
maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this), maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this),
mpBindings(pBindings) mpBindings(pBindings),
mxMtrBrightness(m_xBuilder->weld_metric_spin_button("setbrightness", FieldUnit::PERCENT)),
mxMtrContrast(m_xBuilder->weld_metric_spin_button("setcontrast", FieldUnit::PERCENT)),
mxLBColorMode(m_xBuilder->weld_combo_box("setcolormode")),
mxMtrTrans(m_xBuilder->weld_metric_spin_button("setgraphtransparency", FieldUnit::PERCENT)),
mxMtrRed(m_xBuilder->weld_metric_spin_button("setred", FieldUnit::PERCENT)),
mxMtrGreen(m_xBuilder->weld_metric_spin_button("setgreen", FieldUnit::PERCENT)),
mxMtrBlue(m_xBuilder->weld_metric_spin_button("setblue", FieldUnit::PERCENT)),
mxMtrGamma(m_xBuilder->weld_spin_button("setgamma"))
{ {
get(mpMtrBrightness, "setbrightness"); mxLBColorMode->set_size_request(mxLBColorMode->get_preferred_size().Width(), -1);
get(mpMtrContrast, "setcontrast");
get(mpLBColorMode, "setcolormode");
mpLBColorMode->set_width_request(mpLBColorMode->get_preferred_size().Width());
get(mpMtrTrans, "setgraphtransparency");
get(mpMtrRed, "setred");
get(mpMtrGreen, "setgreen");
get(mpMtrBlue, "setblue");
get(mpMtrGamma, "setgamma");
Initialize(); Initialize();
} }
@ -71,14 +71,14 @@ GraphicPropertyPanel::~GraphicPropertyPanel()
void GraphicPropertyPanel::dispose() void GraphicPropertyPanel::dispose()
{ {
mpMtrBrightness.clear(); mxMtrBrightness.reset();
mpMtrContrast.clear(); mxMtrContrast.reset();
mpLBColorMode.clear(); mxLBColorMode.reset();
mpMtrTrans.clear(); mxMtrTrans.reset();
mpMtrRed.clear(); mxMtrRed.reset();
mpMtrGreen.clear(); mxMtrGreen.reset();
mpMtrBlue.clear(); mxMtrBlue.reset();
mpMtrGamma.clear(); mxMtrGamma.reset();
maBrightControl.dispose(); maBrightControl.dispose();
maContrastControl.dispose(); maContrastControl.dispose();
@ -92,109 +92,90 @@ void GraphicPropertyPanel::dispose()
PanelLayout::dispose(); PanelLayout::dispose();
} }
void GraphicPropertyPanel::Initialize() void GraphicPropertyPanel::Initialize()
{ {
mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) ); mxMtrBrightness->connect_value_changed( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) );
mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) ); mxMtrContrast->connect_value_changed( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) );
mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) ); mxMtrTrans->connect_value_changed( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) );
mpLBColorMode->InsertEntry(SvxResId(RID_SVXSTR_GRAFMODE_STANDARD)); mxLBColorMode->append_text(SvxResId(RID_SVXSTR_GRAFMODE_STANDARD));
mpLBColorMode->InsertEntry(SvxResId(RID_SVXSTR_GRAFMODE_GREYS)); mxLBColorMode->append_text(SvxResId(RID_SVXSTR_GRAFMODE_GREYS));
mpLBColorMode->InsertEntry(SvxResId(RID_SVXSTR_GRAFMODE_MONO)); mxLBColorMode->append_text(SvxResId(RID_SVXSTR_GRAFMODE_MONO));
mpLBColorMode->InsertEntry(SvxResId(RID_SVXSTR_GRAFMODE_WATERMARK)); mxLBColorMode->append_text(SvxResId(RID_SVXSTR_GRAFMODE_WATERMARK));
mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl )); mxLBColorMode->connect_changed( LINK( this, GraphicPropertyPanel, ClickColorModeHdl ));
mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) ); mxMtrRed->connect_value_changed( LINK( this, GraphicPropertyPanel, RedHdl ) );
mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) ); mxMtrGreen->connect_value_changed( LINK( this, GraphicPropertyPanel, GreenHdl ) );
mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) ); mxMtrBlue->connect_value_changed( LINK( this, GraphicPropertyPanel, BlueHdl ) );
mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) ); mxMtrGamma->connect_value_changed( LINK( this, GraphicPropertyPanel, GammaHdl ) );
// Fix left position of some controls that may be wrong due to
// rounding errors.
const sal_Int32 nRight0 (mpLBColorMode->GetPosPixel().X() + mpLBColorMode->GetSizePixel().Width());
const sal_Int32 nRight1 (mpMtrTrans->GetPosPixel().X() + mpMtrTrans->GetSizePixel().Width());
mpMtrRed->SetPosPixel(Point(
nRight0 - mpMtrRed->GetSizePixel().Width(),
mpMtrRed->GetPosPixel().Y()));
mpMtrBlue->SetPosPixel(Point(
nRight0 - mpMtrBlue->GetSizePixel().Width(),
mpMtrBlue->GetPosPixel().Y()));
mpMtrGreen->SetPosPixel(Point(
nRight1 - mpMtrGreen->GetSizePixel().Width(),
mpMtrGreen->GetPosPixel().Y()));
mpMtrGamma->SetPosPixel(Point(
nRight1 - mpMtrGamma->GetSizePixel().Width(),
mpMtrGamma->GetPosPixel().Y()));
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyBrightnessHdl, weld::MetricSpinButton&, void )
IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyBrightnessHdl, Edit&, void )
{ {
const sal_Int16 nBright = mpMtrBrightness->GetValue(); const sal_Int16 nBright = mxMtrBrightness->get_value(FieldUnit::PERCENT);
const SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright ); const SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_LUMINANCE, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_LUMINANCE,
SfxCallMode::RECORD, { &aBrightItem }); SfxCallMode::RECORD, { &aBrightItem });
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyContrastHdl, Edit&, void ) IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyContrastHdl, weld::MetricSpinButton&, void )
{ {
const sal_Int16 nContrast = mpMtrContrast->GetValue(); const sal_Int16 nContrast = mxMtrContrast->get_value(FieldUnit::PERCENT);
const SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast ); const SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_CONTRAST, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_CONTRAST,
SfxCallMode::RECORD, { &aContrastItem }); SfxCallMode::RECORD, { &aContrastItem });
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyTransHdl, Edit&, void ) IMPL_LINK_NOARG( GraphicPropertyPanel, ModifyTransHdl, weld::MetricSpinButton&, void )
{ {
const sal_Int16 nTrans = mpMtrTrans->GetValue(); const sal_Int16 nTrans = mxMtrTrans->get_value(FieldUnit::PERCENT);
const SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans ); const SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_TRANSPARENCE, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_TRANSPARENCE,
SfxCallMode::RECORD, { &aTransItem }); SfxCallMode::RECORD, { &aTransItem });
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, ClickColorModeHdl, ListBox&, void ) IMPL_LINK_NOARG( GraphicPropertyPanel, ClickColorModeHdl, weld::ComboBox&, void )
{ {
const sal_Int16 nTrans = mpLBColorMode->GetSelectedEntryPos(); const sal_Int16 nTrans = mxLBColorMode->get_active();
const SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans ); const SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_MODE, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_MODE,
SfxCallMode::RECORD, { &aTransItem }); SfxCallMode::RECORD, { &aTransItem });
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, RedHdl, Edit&, void ) IMPL_LINK_NOARG( GraphicPropertyPanel, RedHdl, weld::MetricSpinButton&, void )
{ {
const sal_Int16 nRed = mpMtrRed->GetValue(); const sal_Int16 nRed = mxMtrRed->get_value(FieldUnit::PERCENT);
const SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed ); const SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_RED, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_RED,
SfxCallMode::RECORD, { &aRedItem }); SfxCallMode::RECORD, { &aRedItem });
} }
IMPL_LINK_NOARG( GraphicPropertyPanel, GreenHdl, Edit&, void ) IMPL_LINK_NOARG( GraphicPropertyPanel, GreenHdl, weld::MetricSpinButton&, void )
{ {
const sal_Int16 nGreen = mpMtrGreen->GetValue(); const sal_Int16 nGreen = mxMtrGreen->get_value(FieldUnit::PERCENT);
const SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen ); const SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_GREEN, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_GREEN,
SfxCallMode::RECORD, { &aGreenItem }); SfxCallMode::RECORD, { &aGreenItem });
} }
IMPL_LINK_NOARG(GraphicPropertyPanel, BlueHdl, Edit&, void) IMPL_LINK_NOARG(GraphicPropertyPanel, BlueHdl, weld::MetricSpinButton&, void)
{ {
const sal_Int16 nBlue = mpMtrBlue->GetValue(); const sal_Int16 nBlue = mxMtrBlue->get_value(FieldUnit::PERCENT);
const SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue ); const SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_BLUE, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_BLUE,
SfxCallMode::RECORD, { &aBlueItem }); SfxCallMode::RECORD, { &aBlueItem });
} }
IMPL_LINK_NOARG(GraphicPropertyPanel, GammaHdl, Edit&, void) IMPL_LINK_NOARG(GraphicPropertyPanel, GammaHdl, weld::SpinButton&, void)
{ {
const sal_Int32 nGamma = mpMtrGamma->GetValue(); const sal_Int32 nGamma = mxMtrGamma->get_value();
const SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma ); const SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma );
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_GAMMA, GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_GRAF_GAMMA,
SfxCallMode::RECORD, { &nGammaItem }); SfxCallMode::RECORD, { &nGammaItem });
@ -237,23 +218,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrBrightness->Enable(); mxMtrBrightness->set_sensitive(true);
const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nBright = pItem->GetValue(); const sal_Int64 nBright = pItem->GetValue();
mpMtrBrightness->SetValue(nBright); mxMtrBrightness->set_value(nBright, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrBrightness->Disable(); mxMtrBrightness->set_sensitive(false);
} }
else else
{ {
mpMtrBrightness->Enable(); mxMtrBrightness->set_sensitive(true);
mpMtrBrightness->SetText(OUString()); mxMtrBrightness->set_text(OUString());
} }
break; break;
} }
@ -261,23 +242,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrContrast->Enable(); mxMtrContrast->set_sensitive(true);
const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nContrast = pItem->GetValue(); const sal_Int64 nContrast = pItem->GetValue();
mpMtrContrast->SetValue(nContrast); mxMtrContrast->set_value(nContrast, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrContrast->Disable(); mxMtrContrast->set_sensitive(false);
} }
else else
{ {
mpMtrContrast->Enable(); mxMtrContrast->set_sensitive(true);
mpMtrContrast->SetText(OUString()); mxMtrContrast->set_text(OUString());
} }
break; break;
} }
@ -285,23 +266,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrTrans->Enable(); mxMtrTrans->set_sensitive(true);
const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nTrans = pItem->GetValue(); const sal_Int64 nTrans = pItem->GetValue();
mpMtrTrans->SetValue(nTrans); mxMtrTrans->set_value(nTrans, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrTrans->Disable(); mxMtrTrans->set_sensitive(false);
} }
else else
{ {
mpMtrTrans->Enable(); mxMtrTrans->set_sensitive(true);
mpMtrTrans->SetText(OUString()); mxMtrTrans->set_text(OUString());
} }
break; break;
} }
@ -309,23 +290,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpLBColorMode->Enable(); mxLBColorMode->set_sensitive(true);
const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nTrans = pItem->GetValue(); const sal_Int64 nTrans = pItem->GetValue();
mpLBColorMode->SelectEntryPos(nTrans); mxLBColorMode->set_active(nTrans);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpLBColorMode->Disable(); mxLBColorMode->set_sensitive(false);
} }
else else
{ {
mpLBColorMode->Enable(); mxLBColorMode->set_sensitive(true);
mpLBColorMode->SetNoSelection(); mxLBColorMode->set_active(-1);
} }
break; break;
} }
@ -333,23 +314,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrRed->Enable(); mxMtrRed->set_sensitive(true);
const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nRed = pItem->GetValue(); const sal_Int64 nRed = pItem->GetValue();
mpMtrRed->SetValue( nRed ); mxMtrRed->set_value(nRed, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrRed->Disable(); mxMtrRed->set_sensitive(false);
} }
else else
{ {
mpMtrRed->Enable(); mxMtrRed->set_sensitive(true);
mpMtrRed->SetText(OUString()); mxMtrRed->set_text(OUString());
} }
break; break;
} }
@ -357,23 +338,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrGreen->Enable(); mxMtrGreen->set_sensitive(true);
const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nGreen = pItem->GetValue(); const sal_Int64 nGreen = pItem->GetValue();
mpMtrGreen->SetValue( nGreen ); mxMtrGreen->set_value(nGreen, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrGreen->Disable(); mxMtrGreen->set_sensitive(false);
} }
else else
{ {
mpMtrGreen->Enable(); mxMtrGreen->set_sensitive(true);
mpMtrGreen->SetText(OUString()); mxMtrGreen->set_text(OUString());
} }
break; break;
} }
@ -381,23 +362,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrBlue->Enable(); mxMtrBlue->set_sensitive(true);
const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nBlue = pItem->GetValue(); const sal_Int64 nBlue = pItem->GetValue();
mpMtrBlue->SetValue( nBlue ); mxMtrBlue->set_value(nBlue, FieldUnit::PERCENT);
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrBlue->Disable(); mxMtrBlue->set_sensitive(false);
} }
else else
{ {
mpMtrBlue->Enable(); mxMtrBlue->set_sensitive(true);
mpMtrBlue->SetText(OUString()); mxMtrBlue->set_text(OUString());
} }
break; break;
} }
@ -405,23 +386,23 @@ void GraphicPropertyPanel::NotifyItemUpdate(
{ {
if(eState >= SfxItemState::DEFAULT) if(eState >= SfxItemState::DEFAULT)
{ {
mpMtrGamma->Enable(); mxMtrGamma->set_sensitive(true);
const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState); const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState);
if(pItem) if(pItem)
{ {
const sal_Int64 nGamma = pItem->GetValue(); const sal_Int64 nGamma = pItem->GetValue();
mpMtrGamma->SetValue( nGamma ); mxMtrGamma->set_value( nGamma );
} }
} }
else if(SfxItemState::DISABLED == eState) else if(SfxItemState::DISABLED == eState)
{ {
mpMtrGamma->Disable(); mxMtrGamma->set_sensitive(false);
} }
else else
{ {
mpMtrGamma->Enable(); mxMtrGamma->set_sensitive(true);
mpMtrGamma->SetText(OUString()); mxMtrGamma->set_text(OUString());
} }
break; break;
} }

View File

@ -19,17 +19,10 @@
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_GRAPHIC_GRAPHICPROPERTYPANEL_HXX #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_GRAPHIC_GRAPHICPROPERTYPANEL_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_GRAPHIC_GRAPHICPROPERTYPANEL_HXX #define INCLUDED_SVX_SOURCE_SIDEBAR_GRAPHIC_GRAPHICPROPERTYPANEL_HXX
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/ControllerItem.hxx>
#include <svx/sidebar/PanelLayout.hxx> #include <svx/sidebar/PanelLayout.hxx>
#include <vcl/fixed.hxx> #include <vcl/weld.hxx>
class FixedText;
class MetricField;
class ListBox;
class FloatingWindow;
namespace svx { namespace sidebar { namespace svx { namespace sidebar {
@ -63,16 +56,6 @@ public:
SfxBindings* pBindings); SfxBindings* pBindings);
private: private:
//ui controls
VclPtr<MetricField> mpMtrBrightness;
VclPtr<MetricField> mpMtrContrast;
VclPtr<ListBox> mpLBColorMode;
VclPtr<MetricField> mpMtrTrans;
VclPtr<MetricField> mpMtrRed;
VclPtr<MetricField> mpMtrGreen;
VclPtr<MetricField> mpMtrBlue;
VclPtr<MetricField> mpMtrGamma;
::sfx2::sidebar::ControllerItem maBrightControl; ::sfx2::sidebar::ControllerItem maBrightControl;
::sfx2::sidebar::ControllerItem maContrastControl; ::sfx2::sidebar::ControllerItem maContrastControl;
::sfx2::sidebar::ControllerItem maTransparenceControl; ::sfx2::sidebar::ControllerItem maTransparenceControl;
@ -84,19 +67,28 @@ private:
SfxBindings* const mpBindings; SfxBindings* const mpBindings;
DECL_LINK( ModifyBrightnessHdl, Edit&, void ); //ui controls
DECL_LINK( ModifyContrastHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrBrightness;
DECL_LINK( ModifyTransHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrContrast;
DECL_LINK( ClickColorModeHdl, ListBox&, void ); std::unique_ptr<weld::ComboBox> mxLBColorMode;
DECL_LINK( RedHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrTrans;
DECL_LINK( GreenHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrRed;
DECL_LINK( BlueHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrGreen;
DECL_LINK( GammaHdl, Edit&, void ); std::unique_ptr<weld::MetricSpinButton> mxMtrBlue;
std::unique_ptr<weld::SpinButton> mxMtrGamma;
DECL_LINK( ModifyBrightnessHdl, weld::MetricSpinButton&, void );
DECL_LINK( ModifyContrastHdl, weld::MetricSpinButton&, void );
DECL_LINK( ModifyTransHdl, weld::MetricSpinButton&, void );
DECL_LINK( ClickColorModeHdl, weld::ComboBox&, void );
DECL_LINK( RedHdl, weld::MetricSpinButton&, void );
DECL_LINK( GreenHdl, weld::MetricSpinButton&, void );
DECL_LINK( BlueHdl, weld::MetricSpinButton&, void );
DECL_LINK( GammaHdl, weld::SpinButton&, void );
void Initialize(); void Initialize();
}; };
} } // end of namespace svx::sidebar } } // end of namespace svx::sidebar
#endif #endif

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.22.1 -->
<interface domain="svx"> <interface domain="svx">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="0to100adjustment"> <object class="GtkAdjustment" id="0to100adjustment">
@ -20,6 +20,30 @@
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
</object> </object>
<object class="GtkAdjustment" id="plusminus100adjustment1">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="plusminus100adjustment2">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="plusminus100adjustment3">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="plusminus100adjustment4">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkGrid" id="GraphicPropertyPanel"> <object class="GtkGrid" id="GraphicPropertyPanel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -45,7 +69,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes" context="sidebargraphic|brightnesslabel">_Brightness:</property> <property name="label" translatable="yes" context="sidebargraphic|brightnesslabel">_Brightness:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">setbrightness:%</property> <property name="mnemonic_widget">setbrightness</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -54,17 +78,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setbrightness:%"> <object class="GtkSpinButton" id="setbrightness">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setbrightness|tooltip_text">Specify the luminance of the graphic.</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setbrightness|tooltip_text">Specify the luminance of the graphic.</property>
<property name="adjustment">plusminus100adjustment</property> <property name="adjustment">plusminus100adjustment</property>
<accessibility>
<relation type="labelled-by" target="brightnesslabel"/>
</accessibility>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setbrightness:%-atkobject"> <object class="AtkObject" id="setbrightness-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setbrightness-atkobject">Brightness</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setbrightness-atkobject">Brightness</property>
</object> </object>
</child> </child>
@ -80,7 +101,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes" context="sidebargraphic|contrastlabel">_Contrast:</property> <property name="label" translatable="yes" context="sidebargraphic|contrastlabel">_Contrast:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">setcontrast:%</property> <property name="mnemonic_widget">setcontrast</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -89,17 +110,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setcontrast:%"> <object class="GtkSpinButton" id="setcontrast">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setcontrast|tooltip_text">Specify the degree of difference between the lightest and darkest parts of the graphic.</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setcontrast|tooltip_text">Specify the degree of difference between the lightest and darkest parts of the graphic.</property>
<property name="adjustment">plusminus100adjustment</property> <property name="adjustment">plusminus100adjustment1</property>
<accessibility>
<relation type="labelled-by" target="contrastlabel"/>
</accessibility>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setcontrast:%-atkobject"> <object class="AtkObject" id="setcontrast-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setcontrast-atkobject">Contrast</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setcontrast-atkobject">Contrast</property>
</object> </object>
</child> </child>
@ -127,9 +145,6 @@
<object class="GtkComboBoxText" id="setcolormode"> <object class="GtkComboBoxText" id="setcolormode">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<accessibility>
<relation type="labelled-by" target="colorlmodelabel"/>
</accessibility>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setcolormode-atkobject"> <object class="AtkObject" id="setcolormode-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setcolormode-atkobject">Color mode</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setcolormode-atkobject">Color mode</property>
@ -147,7 +162,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes" context="sidebargraphic|transparencylabel">_Transparency:</property> <property name="label" translatable="yes" context="sidebargraphic|transparencylabel">_Transparency:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">setgraphtransparency:%</property> <property name="mnemonic_widget">setgraphtransparency</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>
@ -156,17 +171,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setgraphtransparency:%"> <object class="GtkSpinButton" id="setgraphtransparency">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setgraphtransparency|tooltip_text">Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent.</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setgraphtransparency|tooltip_text">Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent.</property>
<property name="adjustment">0to100adjustment</property> <property name="adjustment">0to100adjustment</property>
<accessibility>
<relation type="labelled-by" target="transparencylabel"/>
</accessibility>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setgraphtransparency:%-atkobject"> <object class="AtkObject" id="setgraphtransparency-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgraphtransparency-atkobject">Transparency</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgraphtransparency-atkobject">Transparency</property>
</object> </object>
</child> </child>
@ -187,7 +199,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="pixbuf">svx/res/symphony/AdjustColorRed_16x16.png</property> <property name="icon_name">svx/res/symphony/AdjustColorRed_16x16.png</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -196,14 +208,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setred:%"> <object class="GtkSpinButton" id="setred">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setred|tooltip_text">Red</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setred|tooltip_text">Red</property>
<property name="adjustment">plusminus100adjustment</property> <property name="adjustment">plusminus100adjustment2</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setred:%-atkobject"> <object class="AtkObject" id="setred-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setred-atkobject">Red</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setred-atkobject">Red</property>
</object> </object>
</child> </child>
@ -231,7 +243,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="pixbuf">svx/res/symphony/AdjustColorGreen_16x16.png</property> <property name="icon_name">svx/res/symphony/AdjustColorGreen_16x16.png</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -240,14 +252,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setgreen:%"> <object class="GtkSpinButton" id="setgreen">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setgreen|tooltip_text">Green</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setgreen|tooltip_text">Green</property>
<property name="adjustment">plusminus100adjustment</property> <property name="adjustment">plusminus100adjustment3</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setgreen:%-atkobject"> <object class="AtkObject" id="setgreen-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgreen-atkobject">Green</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgreen-atkobject">Green</property>
</object> </object>
</child> </child>
@ -276,7 +288,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="pixbuf">svx/res/symphony/AdjustColorBlue_16x16.png</property> <property name="icon_name">svx/res/symphony/AdjustColorBlue_16x16.png</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -285,14 +297,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setblue:%"> <object class="GtkSpinButton" id="setblue">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setblue|tooltip_text">Blue</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setblue|tooltip_text">Blue</property>
<property name="adjustment">plusminus100adjustment</property> <property name="adjustment">plusminus100adjustment4</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setblue:%-atkobject"> <object class="AtkObject" id="setblue-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setblue-atkobject">Blue</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setblue-atkobject">Blue</property>
</object> </object>
</child> </child>
@ -320,7 +332,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="pixbuf">svx/res/symphony/AdjustColorGamma_16x16.png</property> <property name="icon_name">svx/res/symphony/AdjustColorGamma_16x16.png</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -329,18 +341,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkSpinButton" id="setgamma:0"> <object class="GtkSpinButton" id="setgamma">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebargraphic|setgamma|tooltip_text">Specify the gamma value that affects the brightness of the midtone values.</property> <property name="tooltip_text" translatable="yes" context="sidebargraphic|setgamma|tooltip_text">Specify the gamma value that affects the brightness of the midtone values.</property>
<property name="adjustment">gammaadjustment</property> <property name="adjustment">gammaadjustment</property>
<property name="digits">2</property> <property name="digits">2</property>
<accessibility>
<relation target="image4"/>
</accessibility>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="setgamma:0-atkobject"> <object class="AtkObject" id="setgamma-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgamma-atkobject">Gamma value</property> <property name="AtkObject::accessible-name" translatable="yes" context="sidebargraphic|setgamma-atkobject">Gamma value</property>
</object> </object>
</child> </child>