2011-11-06 18:18:20 +01:00
|
|
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
2007-07-01 05:36:17 +02:00
|
|
|
//
|
2011-11-06 18:18:20 +01:00
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
2007-07-01 05:36:17 +02:00
|
|
|
//
|
2011-11-06 18:18:20 +01:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2007-07-01 05:36:17 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file visual_tool_drag.h
|
|
|
|
/// @see visual_tool_drag.cpp
|
|
|
|
/// @ingroup visual_ts
|
|
|
|
///
|
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;
|
2013-09-17 20:13:52 +02:00
|
|
|
VisualToolDragDraggableFeature *parent;
|
|
|
|
VisualToolDragDraggableFeature() : VisualDraggableFeature(), time(0), parent(nullptr) { }
|
2010-05-20 10:55:52 +02:00
|
|
|
};
|
|
|
|
|
2011-11-06 18:18:20 +01:00
|
|
|
class wxBitmapButton;
|
|
|
|
class wxToolBar;
|
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
|
|
|
|
|
|
|
/// @class VisualToolDrag
|
2011-11-06 18:18:20 +01:00
|
|
|
/// @brief Moveable features for the positions of each visible line
|
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
|
2011-11-06 18:18:20 +01:00
|
|
|
wxToolBar *toolbar;
|
2010-06-30 08:29:14 +02:00
|
|
|
/// The feature last clicked on for the double-click handler
|
|
|
|
/// Equal to curFeature during drags; possibly different at all other times
|
2012-11-13 17:51:01 +01:00
|
|
|
/// nullptr if no features have been clicked on or the last clicked on one no
|
2010-06-30 08:29:14 +02:00
|
|
|
/// longer exists
|
2013-12-12 01:29:48 +01:00
|
|
|
Feature *primary = nullptr;
|
2010-06-30 08:29:14 +02:00
|
|
|
/// The last announced selection set
|
2012-10-05 05:22:54 +02:00
|
|
|
SubtitleSelection selection;
|
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
|
2013-12-12 01:29:48 +01:00
|
|
|
bool button_is_move = false;
|
2007-07-04 06:24:47 +02:00
|
|
|
|
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
|
2013-09-17 20:13:52 +02:00
|
|
|
void MakeFeatures(AssDialogue *diag, feature_list::iterator pos);
|
2010-06-30 08:29:14 +02:00
|
|
|
void MakeFeatures(AssDialogue *diag);
|
2010-05-26 09:17:39 +02:00
|
|
|
|
2012-10-05 05:22:54 +02:00
|
|
|
void OnSelectedSetChanged(SubtitleSelection const& lines_added, SubtitleSelection const& 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
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void OnFrameChanged() override;
|
|
|
|
void OnFileChanged() override;
|
|
|
|
void OnLineChanged() override;
|
|
|
|
void OnCoordinateSystemsChanged() override { OnFileChanged(); }
|
2007-07-01 05:36:17 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool InitializeDrag(Feature *feature) override;
|
|
|
|
void UpdateDrag(Feature *feature) override;
|
|
|
|
void Draw() override;
|
|
|
|
void OnDoubleClick() override;
|
2010-06-28 09:13:15 +02:00
|
|
|
|
2011-11-06 18:18:20 +01:00
|
|
|
/// Set the pos/move button to the correct icon based on the active line
|
|
|
|
void UpdateToggleButtons();
|
2010-05-20 10:55:23 +02:00
|
|
|
void OnSubTool(wxCommandEvent &event);
|
2011-11-06 18:18:20 +01:00
|
|
|
public:
|
|
|
|
VisualToolDrag(VideoDisplay *parent, agi::Context *context);
|
2013-11-21 18:13:36 +01:00
|
|
|
void SetToolbar(wxToolBar *tb) override;
|
2007-07-01 05:36:17 +02:00
|
|
|
};
|