2007-06-30 23:56:15 +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/
|
|
|
|
|
2010-05-20 10:55:58 +02:00
|
|
|
/// @file visual_feature->h
|
|
|
|
/// @see visual_feature->cpp
|
2009-07-29 07:43:02 +02:00
|
|
|
/// @ingroup visual_ts
|
|
|
|
///
|
2007-06-30 23:56:15 +02:00
|
|
|
|
2010-05-20 10:55:46 +02:00
|
|
|
#pragma once
|
|
|
|
|
2011-11-06 18:18:20 +01:00
|
|
|
#include "vector2d.h"
|
|
|
|
|
2013-09-17 20:13:52 +02:00
|
|
|
#include <boost/intrusive/list_hook.hpp>
|
|
|
|
|
2007-07-01 09:09:37 +02:00
|
|
|
class OpenGLWrapper;
|
2009-09-10 03:41:34 +02:00
|
|
|
class AssDialogue;
|
2007-07-01 09:09:37 +02:00
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// VisualDraggableFeature display types
|
2007-07-01 00:14:50 +02:00
|
|
|
enum DraggableFeatureType {
|
2007-06-30 23:56:15 +02:00
|
|
|
DRAG_NONE,
|
|
|
|
DRAG_BIG_SQUARE,
|
|
|
|
DRAG_BIG_CIRCLE,
|
2007-07-04 09:26:24 +02:00
|
|
|
DRAG_BIG_TRIANGLE,
|
2007-06-30 23:56:15 +02:00
|
|
|
DRAG_SMALL_SQUARE,
|
|
|
|
DRAG_SMALL_CIRCLE
|
|
|
|
};
|
|
|
|
|
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 VisualDraggableFeature
|
2012-03-12 01:07:09 +01:00
|
|
|
/// @brief Onscreen control used by many visual tools
|
|
|
|
///
|
|
|
|
/// By itself this class doesn't do much. It mostly just draws itself at a
|
|
|
|
/// specified position and performs hit-testing.
|
2013-09-17 20:13:52 +02:00
|
|
|
class VisualDraggableFeature : public boost::intrusive::make_list_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>::type {
|
2012-03-12 01:07:09 +01:00
|
|
|
Vector2D start; ///< position before the last drag operation began
|
2011-11-06 18:18:20 +01:00
|
|
|
|
2007-06-30 23:56:15 +02:00
|
|
|
public:
|
2013-12-12 01:29:48 +01:00
|
|
|
DraggableFeatureType type = DRAG_NONE; ///< Shape of feature
|
|
|
|
Vector2D pos; ///< Position of this feature
|
|
|
|
int layer = 0; ///< Layer; Higher = above
|
|
|
|
AssDialogue* line = nullptr; ///< The dialogue line this feature is for; may be nullptr
|
2007-06-30 23:56:15 +02:00
|
|
|
|
2010-05-19 05:23:55 +02:00
|
|
|
/// @brief Is the given point over this feature?
|
2011-11-06 18:18:20 +01:00
|
|
|
/// @param mouse_pos Position of the mouse
|
|
|
|
bool IsMouseOver(Vector2D mouse_pos) const;
|
|
|
|
|
2010-05-19 05:23:55 +02:00
|
|
|
/// @brief Draw this feature
|
|
|
|
/// @param gl OpenGLWrapper to use
|
2010-05-20 10:55:58 +02:00
|
|
|
void Draw(OpenGLWrapper const& gl) const;
|
2011-11-06 18:18:20 +01:00
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Start a drag
|
2011-11-06 18:18:20 +01:00
|
|
|
void StartDrag();
|
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Update the position of the feature during a drag
|
|
|
|
/// @param d New position of the feature
|
|
|
|
/// @param single_axis Only apply the larger of the two changes to the position
|
2011-11-06 18:18:20 +01:00
|
|
|
void UpdateDrag(Vector2D d, bool single_axis);
|
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Has this feature actually moved since a drag was last started?
|
2011-11-06 18:18:20 +01:00
|
|
|
bool HasMoved() const;
|
2007-06-30 23:56:15 +02:00
|
|
|
};
|