mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Improve stats update times for buffer switches and toolbar toggles.
This commit is contained in:
parent
a11a4db8b2
commit
7e2c1dca36
@ -303,6 +303,7 @@ struct BufferView::Private
|
|||||||
int stats_ref_value_w_ = 0;
|
int stats_ref_value_w_ = 0;
|
||||||
int stats_ref_value_c_ = 0;
|
int stats_ref_value_c_ = 0;
|
||||||
int stats_ref_value_nb_ = 0;
|
int stats_ref_value_nb_ = 0;
|
||||||
|
bool stats_update_trigger_ = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2026,6 +2027,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_STATISTICS_REFERENCE_CLAMP: {
|
case LFUN_STATISTICS_REFERENCE_CLAMP: {
|
||||||
|
d->stats_update_trigger_ = true;
|
||||||
if (cmd.argument() == "reset") {
|
if (cmd.argument() == "reset") {
|
||||||
d->stats_ref_value_w_ = d->stats_ref_value_c_ = d->stats_ref_value_nb_ = 0;
|
d->stats_ref_value_w_ = d->stats_ref_value_c_ = d->stats_ref_value_nb_ = 0;
|
||||||
break;
|
break;
|
||||||
@ -3921,4 +3923,14 @@ bool BufferView::clickableInset() const
|
|||||||
return d->clickable_inset_;
|
return d->clickable_inset_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BufferView::stats_update_trigger()
|
||||||
|
{
|
||||||
|
if (d->stats_update_trigger_) {
|
||||||
|
d->stats_update_trigger_ = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -403,6 +403,8 @@ public:
|
|||||||
int stats_ref_value_w() const;
|
int stats_ref_value_w() const;
|
||||||
int stats_ref_value_c() const;
|
int stats_ref_value_c() const;
|
||||||
int stats_ref_value_nb() const;
|
int stats_ref_value_nb() const;
|
||||||
|
//signals need for update in gui
|
||||||
|
bool stats_update_trigger();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// noncopyable
|
/// noncopyable
|
||||||
|
@ -555,6 +555,8 @@ public:
|
|||||||
bool already_in_selection_ = false;
|
bool already_in_selection_ = false;
|
||||||
/// Maximum size of "short" selection for which we can update with faster timer_rate
|
/// Maximum size of "short" selection for which we can update with faster timer_rate
|
||||||
int const max_sel_chars = 5000;
|
int const max_sel_chars = 5000;
|
||||||
|
/// equivalent time_to_update = 0; but better to see it the code
|
||||||
|
bool stats_update_trigger_ = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1454,6 +1456,12 @@ void GuiView::showStats()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UI toggle, buffer change, etc
|
||||||
|
if (bv->stats_update_trigger() || d.stats_update_trigger_) {
|
||||||
|
d.stats_update_trigger_ = false;
|
||||||
|
d.time_to_update = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Cursor const & cur = bv->cursor();
|
Cursor const & cur = bv->cursor();
|
||||||
|
|
||||||
// we start new selection and need faster update
|
// we start new selection and need faster update
|
||||||
@ -1587,6 +1595,7 @@ void GuiView::onBufferViewChanged()
|
|||||||
&& zoom_slider_->value() < zoom_slider_->maximum());
|
&& zoom_slider_->value() < zoom_slider_->maximum());
|
||||||
zoom_out_->setEnabled(currentBufferView()
|
zoom_out_->setEnabled(currentBufferView()
|
||||||
&& zoom_slider_->value() > zoom_slider_->minimum());
|
&& zoom_slider_->value() > zoom_slider_->minimum());
|
||||||
|
d.stats_update_trigger_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5162,6 +5171,7 @@ bool GuiView::lfunUiToggle(string const & ui_component)
|
|||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
stat_counts_->setVisible(statsEnabled());
|
stat_counts_->setVisible(statsEnabled());
|
||||||
|
d.stats_update_trigger_ = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user