summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-09 12:12:00 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-09 21:47:50 +0200
commit54e13125860b124535c48e93b8001cd1aab25d8f (patch)
tree9c59b61c54e6d51b5c7337619dce6a82698b7e85 /vcl/unx
parent0062b0b09b84fa275bbd921d0775eb1ae6d2ba64 (diff)
ppd value list jumps around on selecting scrolled entries
the whole list is emptied and refilled on every selection, which causes visible jumps on selecting scrolled entries as its cleared, then refilled and the same position selected again. seems we need this just for the case that the custom value was selected/unselected Change-Id: I01e72cd9377027c5fd598b02dee27b682f1b92af Reviewed-on: https://gerrit.libreoffice.org/52630 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/print/prtsetup.cxx21
-rw-r--r--vcl/unx/generic/print/prtsetup.hxx5
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx1
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