diff options
-rw-r--r-- | vcl/unx/generic/print/prtsetup.cxx | 21 | ||||
-rw-r--r-- | vcl/unx/generic/print/prtsetup.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 1 |
3 files changed, 26 insertions, 1 deletions
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx index 9fbbdd0617d4..2762cba2a716 100644 --- a/vcl/unx/generic/print/prtsetup.cxx +++ b/vcl/unx/generic/print/prtsetup.cxx @@ -288,6 +288,9 @@ RTSDevicePage::RTSDevicePage(weld::Widget* pPage, RTSDialog* pParent) , m_xSpaceBox(m_xBuilder->weld_combo_box_text("colorspace")) , m_xDepthBox(m_xBuilder->weld_combo_box_text("colordepth")) { + m_aReselectCustomIdle.SetInvokeHandler(LINK(this, RTSDevicePage, ImplHandleReselectHdl)); + m_aReselectCustomIdle.SetDebugName("RTSDevicePage m_aReselectCustomIdle"); + m_xPPDKeyBox->set_size_request(m_xPPDKeyBox->get_approximate_digit_width() * 32, m_xPPDKeyBox->get_height_rows(12)); @@ -438,7 +441,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, weld::TreeView&, rBox, void ) if (pKey && pValue) { m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); - FillValueBox( pKey ); + ValueBoxChanged(pKey); } } m_pParent->SetDataModified( true ); @@ -469,13 +472,29 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey ) } pValue = m_pParent->m_aJobData.m_aContext.getValue( pKey ); m_xPPDValueBox->select_id(OUString::number(reinterpret_cast<sal_Int64>(pValue))); + + ValueBoxChanged(pKey); +} + +IMPL_LINK_NOARG(RTSDevicePage, ImplHandleReselectHdl, Timer*, void) +{ + //in case selected entry is now not visible select it again to scroll it into view + m_xPPDValueBox->select(m_xPPDValueBox->get_selected_index()); +} + +void RTSDevicePage::ValueBoxChanged( const PPDKey* pKey ) +{ + const PPDValue* pValue = m_pParent->m_aJobData.m_aContext.getValue(pKey); if (pValue->m_bCustomOption) { m_pCustomValue = pValue; m_pParent->m_aJobData.m_aContext.setValue(pKey, pValue); m_xCustomEdit->set_text(m_pCustomValue->m_aCustomOption); m_xCustomEdit->show(); + m_aReselectCustomIdle.Start(); } + else + m_xCustomEdit->hide(); } int SetupPrinterDriver(weld::Window* pParent, ::psp::PrinterInfo& rJobData) diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx index 8162150447a9..d9f2f67df911 100644 --- a/vcl/unx/generic/print/prtsetup.hxx +++ b/vcl/unx/generic/print/prtsetup.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_VCL_GENERIC_PRINT_PRTSETUP_HXX #define INCLUDED_VCL_GENERIC_PRINT_PRTSETUP_HXX +#include <vcl/idle.hxx> #include <vcl/ppdparser.hxx> #include <vcl/weld.hxx> #include <printerinfomanager.hxx> @@ -114,9 +115,13 @@ private: std::unique_ptr<weld::ComboBoxText> m_xDepthBox; void FillValueBox( const ::psp::PPDKey* ); + void ValueBoxChanged( const ::psp::PPDKey* ); + + Idle m_aReselectCustomIdle; DECL_LINK(SelectHdl, weld::TreeView&, void); DECL_LINK(ModifyHdl, weld::Entry&, void); + DECL_LINK(ImplHandleReselectHdl, Timer*, void); public: RTSDevicePage(weld::Widget* pPage, RTSDialog* pDialog); ~RTSDevicePage(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index f646b70d7d2a..e3e961ecf4ca 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2737,6 +2737,7 @@ public: { GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1); gtk_tree_selection_select_path(gtk_tree_view_get_selection(m_pTreeView), path); + gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0); gtk_tree_path_free(path); } else |