mirror of https://github.com/odrling/Aegisub
Merge branch 'vector_clip_actions' into feature
This commit is contained in:
commit
5e51c59e8e
|
@ -622,6 +622,7 @@
|
||||||
"Grid": false,
|
"Grid": false,
|
||||||
"Org Mode": 0
|
"Org Mode": 0
|
||||||
},
|
},
|
||||||
|
"Shape Handle Size": 3,
|
||||||
"Autohide": false
|
"Autohide": false
|
||||||
},
|
},
|
||||||
"Align to Video" : {
|
"Align to Video" : {
|
||||||
|
|
|
@ -622,6 +622,7 @@
|
||||||
"Grid": false,
|
"Grid": false,
|
||||||
"Org Mode": 0
|
"Org Mode": 0
|
||||||
},
|
},
|
||||||
|
"Shape Handle Size": 3,
|
||||||
"Autohide": false
|
"Autohide": false
|
||||||
},
|
},
|
||||||
"Align to Video" : {
|
"Align to Video" : {
|
||||||
|
|
|
@ -232,6 +232,9 @@ void Interface(wxTreebook *book, Preferences *parent) {
|
||||||
auto tl_assistant = p->PageSizer(_("Translation Assistant"));
|
auto tl_assistant = p->PageSizer(_("Translation Assistant"));
|
||||||
p->OptionAdd(tl_assistant, _("Skip over whitespace"), "Tool/Translation Assistant/Skip Whitespace");
|
p->OptionAdd(tl_assistant, _("Skip over whitespace"), "Tool/Translation Assistant/Skip Whitespace");
|
||||||
|
|
||||||
|
auto visual_tools = p->PageSizer(_("Visual Tools"));
|
||||||
|
p->OptionAdd(visual_tools, _("Shape handle size"), "Tool/Visual/Shape Handle Size");
|
||||||
|
|
||||||
auto color_picker = p->PageSizer(_("Colour Picker"));
|
auto color_picker = p->PageSizer(_("Colour Picker"));
|
||||||
p->OptionAdd(color_picker, _("Restrict Screen Picker to Window"), "Tool/Colour Picker/Restrict to Window");
|
p->OptionAdd(color_picker, _("Restrict Screen Picker to Window"), "Tool/Colour Picker/Restrict to Window");
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,13 @@
|
||||||
///
|
///
|
||||||
|
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
|
#include "options.h"
|
||||||
#include "visual_feature.h"
|
#include "visual_feature.h"
|
||||||
|
|
||||||
|
VisualDraggableFeature::VisualDraggableFeature()
|
||||||
|
: size(OPT_GET("Tool/Visual/Shape Handle Size")->GetInt())
|
||||||
|
{}
|
||||||
|
|
||||||
bool VisualDraggableFeature::IsMouseOver(Vector2D mouse_pos) const {
|
bool VisualDraggableFeature::IsMouseOver(Vector2D mouse_pos) const {
|
||||||
if (!pos) return false;
|
if (!pos) return false;
|
||||||
|
|
||||||
|
@ -54,10 +59,10 @@ bool VisualDraggableFeature::IsMouseOver(Vector2D mouse_pos) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
case DRAG_SMALL_SQUARE:
|
case DRAG_SMALL_SQUARE:
|
||||||
return fabs(delta.X()) < 3 && fabs(delta.Y()) < 3;
|
return fabs(delta.X()) < size && fabs(delta.Y()) < size;
|
||||||
|
|
||||||
case DRAG_SMALL_CIRCLE:
|
case DRAG_SMALL_CIRCLE:
|
||||||
return delta.SquareLen() < 9;
|
return delta.SquareLen() < 3 * size;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -88,11 +93,11 @@ void VisualDraggableFeature::Draw(OpenGLWrapper const& gl) const {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAG_SMALL_SQUARE:
|
case DRAG_SMALL_SQUARE:
|
||||||
gl.DrawRectangle(pos - 3, pos + 3);
|
gl.DrawRectangle(pos - size, pos + size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAG_SMALL_CIRCLE:
|
case DRAG_SMALL_CIRCLE:
|
||||||
gl.DrawCircle(pos, 3);
|
gl.DrawCircle(pos, size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,10 +61,13 @@ class VisualDraggableFeature : public boost::intrusive::make_list_base_hook<boos
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DraggableFeatureType type = DRAG_NONE; ///< Shape of feature
|
DraggableFeatureType type = DRAG_NONE; ///< Shape of feature
|
||||||
|
int size = 0;
|
||||||
Vector2D pos; ///< Position of this feature
|
Vector2D pos; ///< Position of this feature
|
||||||
int layer = 0; ///< Layer; Higher = above
|
int layer = 0; ///< Layer; Higher = above
|
||||||
AssDialogue* line = nullptr; ///< The dialogue line this feature is for; may be nullptr
|
AssDialogue* line = nullptr; ///< The dialogue line this feature is for; may be nullptr
|
||||||
|
|
||||||
|
VisualDraggableFeature();
|
||||||
|
|
||||||
/// @brief Is the given point over this feature?
|
/// @brief Is the given point over this feature?
|
||||||
/// @param mouse_pos Position of the mouse
|
/// @param mouse_pos Position of the mouse
|
||||||
bool IsMouseOver(Vector2D mouse_pos) const;
|
bool IsMouseOver(Vector2D mouse_pos) const;
|
||||||
|
|
|
@ -35,6 +35,7 @@ int BUTTON_ID_BASE = 1300;
|
||||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, agi::Context *context)
|
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent, agi::Context *context)
|
||||||
: VisualTool<VisualToolVectorClipDraggableFeature>(parent, context)
|
: VisualTool<VisualToolVectorClipDraggableFeature>(parent, context)
|
||||||
, spline(this)
|
, spline(this)
|
||||||
|
, featureSize(OPT_GET("Tool/Visual/Shape Handle Size")->GetInt())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,11 +155,11 @@ void VisualToolVectorClip::Draw() {
|
||||||
|
|
||||||
if (feature.type == DRAG_SMALL_SQUARE) {
|
if (feature.type == DRAG_SMALL_SQUARE) {
|
||||||
gl.SetLineColour(line_color, .5f, 1);
|
gl.SetLineColour(line_color, .5f, 1);
|
||||||
gl.DrawRectangle(feature.pos - 3, feature.pos + 3);
|
gl.DrawRectangle(feature.pos - featureSize, feature.pos + featureSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gl.SetLineColour(feature_color, .5f, 1);
|
gl.SetLineColour(feature_color, .5f, 1);
|
||||||
gl.DrawCircle(feature.pos, 2.f);
|
gl.DrawCircle(feature.pos, featureSize * 2.f / 3.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ class VisualToolVectorClip final : public VisualTool<VisualToolVectorClipDraggab
|
||||||
wxToolBar *toolBar = nullptr; /// The subtoolbar
|
wxToolBar *toolBar = nullptr; /// The subtoolbar
|
||||||
int mode = VCLIP_DRAG; /// 0-7
|
int mode = VCLIP_DRAG; /// 0-7
|
||||||
bool inverse = false; /// is iclip?
|
bool inverse = false; /// is iclip?
|
||||||
|
int featureSize = 0;
|
||||||
|
|
||||||
std::set<Feature *> box_added;
|
std::set<Feature *> box_added;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue