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

View File

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