2007-07-01 05:36:17 +02:00
|
|
|
// Copyright (c) 2007, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2007-07-01 05:36:17 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file visual_tool_drag.h
|
|
|
|
/// @see visual_tool_drag.cpp
|
|
|
|
/// @ingroup visual_ts
|
|
|
|
///
|
2007-07-01 05:36:17 +02:00
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#ifndef AGI_PRE
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/bmpbuttn.h>
|
|
|
|
#include <wx/toolbar.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#endif
|
2007-07-01 05:36:17 +02:00
|
|
|
|
2010-05-20 10:55:46 +02:00
|
|
|
#include "visual_feature.h"
|
2009-09-11 04:36:34 +02:00
|
|
|
#include "visual_tool.h"
|
2007-07-01 05:36:17 +02:00
|
|
|
|
2010-05-20 10:55:52 +02:00
|
|
|
/// @class VisualToolDragDraggableFeature
|
|
|
|
/// @brief VisualDraggableFeature with a time value
|
|
|
|
class VisualToolDragDraggableFeature : public VisualDraggableFeature {
|
|
|
|
public:
|
|
|
|
int time;
|
2010-06-30 08:29:14 +02:00
|
|
|
std::list<VisualToolDragDraggableFeature>::iterator parent;
|
|
|
|
VisualToolDragDraggableFeature() : VisualDraggableFeature(), time(0) { }
|
2010-05-20 10:55:52 +02:00
|
|
|
};
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// DOCME
|
|
|
|
/// @class VisualToolDrag
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
|
|
|
/// DOCME
|
2010-05-20 10:55:52 +02:00
|
|
|
class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> {
|
2010-06-30 08:29:14 +02:00
|
|
|
/// The subtoolbar for the move/pos conversion button
|
|
|
|
wxToolBar *toolBar;
|
|
|
|
/// The feature last clicked on for the double-click handler
|
|
|
|
/// Equal to curFeature during drags; possibly different at all other times
|
|
|
|
/// Null if no features have been clicked on or the last clicked on one no
|
|
|
|
/// longer exists
|
|
|
|
Feature *primary;
|
|
|
|
/// The last announced selection set
|
|
|
|
Selection selection;
|
|
|
|
int change;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-05-23 10:53:27 +02:00
|
|
|
/// When the button is pressed, will it convert the line to a move (vs. from
|
|
|
|
/// move to pos)? Used to avoid changing the button's icon unnecessarily
|
2007-07-04 06:24:47 +02:00
|
|
|
bool toggleMoveOnMove;
|
|
|
|
|
2010-06-30 08:29:14 +02:00
|
|
|
/// @brief Create the features for a line
|
|
|
|
/// @param diag Line to create the features for
|
|
|
|
/// @param pos Insertion point in the feature list
|
|
|
|
void MakeFeatures(AssDialogue *diag, feature_iterator pos);
|
|
|
|
void MakeFeatures(AssDialogue *diag);
|
2010-05-26 09:17:39 +02:00
|
|
|
|
2010-06-30 08:29:14 +02:00
|
|
|
bool InitializeDrag(feature_iterator feature);
|
|
|
|
void CommitDrag(feature_iterator feature);
|
2007-07-01 05:36:17 +02:00
|
|
|
|
2010-05-23 10:53:27 +02:00
|
|
|
/// Set the pos/move button to the correct icon based on the active line
|
2007-07-04 06:24:47 +02:00
|
|
|
void UpdateToggleButtons();
|
|
|
|
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
// Overriding SubtitleSelectionListener inherited from base VisualTool<>
|
2010-06-28 09:13:15 +02:00
|
|
|
void OnSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed);
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-28 09:13:15 +02:00
|
|
|
void OnFrameChanged();
|
|
|
|
void OnFileChanged();
|
|
|
|
void OnLineChanged();
|
2007-07-01 05:36:17 +02:00
|
|
|
|
|
|
|
void Draw();
|
2010-06-07 09:24:30 +02:00
|
|
|
bool Update();
|
2010-06-28 09:13:15 +02:00
|
|
|
public:
|
|
|
|
VisualToolDrag(VideoDisplay *parent, VideoState const& video, wxToolBar *toolbar);
|
|
|
|
|
2010-05-20 10:55:23 +02:00
|
|
|
void OnSubTool(wxCommandEvent &event);
|
2007-07-01 05:36:17 +02:00
|
|
|
};
|