Coalesce visual tool changes

Originally committed to SVN as r4827.
This commit is contained in:
Thomas Goyne 2010-11-01 04:36:13 +00:00
parent 516b2cec93
commit a73091ef5c
2 changed files with 9 additions and 1 deletions

View file

@ -64,6 +64,7 @@ template<class FeatureType>
VisualTool<FeatureType>::VisualTool(VideoDisplay *parent, VideoState const& video)
: dragStartX(0)
, dragStartY(0)
, commitId(-1)
, selChanged(false)
, selectedFeatures(selFeatures)
, grid(VideoContext::Get()->grid)
@ -232,6 +233,11 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
if (Update() || needRender) parent->Render();
externalChange = true;
if (!event.LeftIsDown()) {
// Only coalesce the changes made in a single drag
commitId = -1;
}
}
template<class FeatureType>
@ -240,7 +246,7 @@ void VisualTool<FeatureType>::Commit(wxString message) {
if (message.empty()) {
message = _("visual typesetting");
}
grid->ass->Commit(message);
commitId = grid->ass->Commit(message, commitId);
grid->CommitChanges();
externalChange = true;

View file

@ -98,6 +98,8 @@ private:
int dragStartX; /// Starting x coordinate of the current drag, if any
int dragStartY; /// Starting y coordinate of the current drag, if any
int commitId;
/// Set curFeature to the topmost feature under the mouse, or end() if there
/// are none
void GetHighlightedFeature();