mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix some toc ui glitches:
- revert r26360, because this causes irritating flickering, and reset the slider in updateView instead, - disable also the sort checkbox and the slider when the list and combobox are disabled, - disable the keep checkbox when the type is not navigatable, as it doesn't make sense to keep something that won't change. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29477 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b0936fac4c
commit
61e32e1c25
@ -305,7 +305,7 @@ void TocWidget::select(QModelIndex const & index)
|
||||
}
|
||||
|
||||
|
||||
/// Test if outlining operation is possible
|
||||
/// Test whether outlining operation is possible
|
||||
static bool canOutline(QString const & type)
|
||||
{
|
||||
return type == "tableofcontents";
|
||||
@ -323,20 +323,16 @@ void TocWidget::enableControls(bool enable)
|
||||
moveDownTB->setEnabled(enable);
|
||||
moveInTB->setEnabled(enable);
|
||||
moveOutTB->setEnabled(enable);
|
||||
if (!enable) {
|
||||
depthSL->setMaximum(0);
|
||||
depthSL->setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Test if synchronized navigation is possible
|
||||
/// Test whether synchronized navigation is possible
|
||||
static bool canNavigate(QString const & type)
|
||||
{
|
||||
// It is not possible to have synchronous navigation in a correctl
|
||||
// and efficient way with the label type because Toc::item() do a linear
|
||||
// seatch. Even if fixed, it might even not be desirable to do so if we
|
||||
// want to support drag&drop of labels and references.
|
||||
// It is not possible to have synchronous navigation in a correct
|
||||
// and efficient way with the label and change type because Toc::item()
|
||||
// does a linear search. Even when fixed, it might even not be desirable
|
||||
// to do so if we want to support drag&drop of labels and references.
|
||||
return type != "label" && type != "change";
|
||||
}
|
||||
|
||||
@ -348,8 +344,15 @@ void TocWidget::updateView()
|
||||
typeCO->setEnabled(false);
|
||||
tocTV->setModel(0);
|
||||
tocTV->setEnabled(false);
|
||||
depthSL->setMaximum(0);
|
||||
depthSL->setValue(0);
|
||||
persistentCB->setEnabled(false);
|
||||
sortCB->setEnabled(false);
|
||||
depthSL->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
sortCB->setEnabled(true);
|
||||
depthSL->setEnabled(true);
|
||||
typeCO->setEnabled(true);
|
||||
tocTV->setEnabled(false);
|
||||
tocTV->setUpdatesEnabled(false);
|
||||
@ -366,7 +369,8 @@ void TocWidget::updateView()
|
||||
sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_));
|
||||
sortCB->blockSignals(false);
|
||||
|
||||
persistentCB->setChecked(persistent_);
|
||||
bool const can_navigate_ = canNavigate(current_type_);
|
||||
persistentCB->setEnabled(can_navigate_);
|
||||
|
||||
bool controls_enabled = toc_model && toc_model->rowCount() > 0
|
||||
&& !gui_view_.buffer()->isReadonly();
|
||||
@ -374,10 +378,12 @@ void TocWidget::updateView()
|
||||
|
||||
depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));
|
||||
depthSL->setValue(depth_);
|
||||
if (!persistent_)
|
||||
if (!persistent_ && can_navigate_)
|
||||
setTreeDepth(depth_);
|
||||
if (canNavigate(current_type_))
|
||||
if (can_navigate_) {
|
||||
persistentCB->setChecked(persistent_);
|
||||
select(gui_view_.tocModels().currentIndex(current_type_));
|
||||
}
|
||||
tocTV->setEnabled(true);
|
||||
tocTV->setUpdatesEnabled(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user