mirror of https://github.com/odrling/Aegisub
Add configuration options for colors in visual typesetting tools
This commit is contained in:
parent
837d5a41d7
commit
9abcc03202
|
@ -266,6 +266,13 @@
|
|||
},
|
||||
"Video Dummy" : {
|
||||
"Last Colour" : "rgb(47, 163, 254)"
|
||||
},
|
||||
"Visual Tools" : {
|
||||
"Highlight Primary" : "rgb(255, 169, 40)",
|
||||
"Highlight Secondary" : "rgb(255, 253, 185)",
|
||||
"Lines Primary" : "rgb(187, 0, 0)",
|
||||
"Lines Secondary" : "rgb(106, 32, 19)",
|
||||
"Shaded Area Alpha" : 0.5
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -266,6 +266,13 @@
|
|||
},
|
||||
"Video Dummy" : {
|
||||
"Last Colour" : "rgb(47, 163, 254)"
|
||||
},
|
||||
"Visual Tools" : {
|
||||
"Highlight Primary" : "rgb(255, 169, 40)",
|
||||
"Highlight Secondary" : "rgb(255, 253, 185)",
|
||||
"Lines Primary" : "rgb(187, 0, 0)",
|
||||
"Lines Secondary" : "rgb(106, 32, 19)",
|
||||
"Shaded Area Alpha" : 0.5
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
//
|
||||
// Aegisub Project http://www.aegisub.org/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libaegisub/mru.h>
|
||||
#include <libaegisub/option.h>
|
||||
#include <libaegisub/option_value.h>
|
||||
|
|
|
@ -288,6 +288,16 @@ void Interface_Colours(wxTreebook *book, Preferences *parent) {
|
|||
p->OptionAdd(grid, _("Lines"), "Colour/Subtitle Grid/Lines");
|
||||
p->OptionAdd(grid, _("CPS Error"), "Colour/Subtitle Grid/CPS Error");
|
||||
|
||||
auto visual_tools = p->PageSizer(_("Visual Typesetting Tools"));
|
||||
p->OptionAdd(visual_tools, _("Primary Lines"), "Colour/Visual Tools/Lines Primary");
|
||||
p->OptionAdd(visual_tools, _("Secondary Lines"), "Colour/Visual Tools/Lines Secondary");
|
||||
p->OptionAdd(visual_tools, _("Primary Highlight"), "Colour/Visual Tools/Highlight Primary");
|
||||
p->OptionAdd(visual_tools, _("Secondary Highlight"), "Colour/Visual Tools/Highlight Secondary");
|
||||
|
||||
// Separate sizer to prevent the colors in the visual tools section from getting resized
|
||||
auto visual_tools_alpha = p->PageSizer(_("Visual Typesetting Tools Alpha"));
|
||||
p->OptionAdd(visual_tools_alpha, _("Shaded Area"), "Colour/Visual Tools/Shaded Area Alpha", 0, 1, 0.1);
|
||||
|
||||
p->sizer = main_sizer;
|
||||
|
||||
p->SetSizerAndFit(p->sizer);
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include "ass_dialogue.h"
|
||||
#include "ass_file.h"
|
||||
#include "ass_style.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "options.h"
|
||||
#include "selection_controller.h"
|
||||
#include "video_controller.h"
|
||||
#include "video_display.h"
|
||||
|
@ -37,17 +39,15 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
const wxColour VisualToolBase::colour[] = {
|
||||
wxColour(106,32,19),
|
||||
wxColour(255,169,40),
|
||||
wxColour(255,253,185),
|
||||
wxColour(187,0,0)
|
||||
};
|
||||
|
||||
VisualToolBase::VisualToolBase(VideoDisplay *parent, agi::Context *context)
|
||||
: c(context)
|
||||
, parent(parent)
|
||||
, frame_number(c->videoController->GetFrameN())
|
||||
, highlight_color_primary_opt(OPT_GET("Colour/Visual Tools/Highlight Primary"))
|
||||
, highlight_color_secondary_opt(OPT_GET("Colour/Visual Tools/Highlight Secondary"))
|
||||
, line_color_primary_opt(OPT_GET("Colour/Visual Tools/Lines Primary"))
|
||||
, line_color_secondary_opt(OPT_GET("Colour/Visual Tools/Lines Secondary"))
|
||||
, shaded_area_alpha_opt(OPT_GET("Colour/Visual Tools/Shaded Area Alpha"))
|
||||
, file_changed_connection(c->ass->AddCommitListener(&VisualToolBase::OnCommit, this))
|
||||
{
|
||||
int script_w, script_h;
|
||||
|
@ -273,14 +273,18 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
|||
|
||||
template<class FeatureType>
|
||||
void VisualTool<FeatureType>::DrawAllFeatures() {
|
||||
gl.SetLineColour(colour[0], 1.0f, 1);
|
||||
wxColour grid_color = to_wx(line_color_secondary_opt->GetColor());
|
||||
gl.SetLineColour(grid_color, 1.0f, 1);
|
||||
wxColour base_fill = to_wx(line_color_primary_opt->GetColor());
|
||||
wxColour active_fill = to_wx(highlight_color_secondary_opt->GetColor());
|
||||
wxColour alt_fill = to_wx(line_color_primary_opt->GetColor());
|
||||
for (auto& feature : features) {
|
||||
int fill = 1;
|
||||
wxColour fill = base_fill;
|
||||
if (&feature == active_feature)
|
||||
fill = 2;
|
||||
fill = active_fill;
|
||||
else if (sel_features.count(&feature))
|
||||
fill = 3;
|
||||
gl.SetFillColour(colour[fill], 0.3f);
|
||||
fill = alt_fill;
|
||||
gl.SetFillColour(fill, 0.3f);
|
||||
feature.Draw(gl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "gl_wrap.h"
|
||||
#include "vector2d.h"
|
||||
#include "options.h"
|
||||
|
||||
#include <libaegisub/owning_intrusive_list.h>
|
||||
#include <libaegisub/signal.h>
|
||||
|
@ -85,8 +86,6 @@ protected:
|
|||
/// Called when the user double-clicks
|
||||
virtual void OnDoubleClick() { }
|
||||
|
||||
static const wxColour colour[4];
|
||||
|
||||
agi::Context *c;
|
||||
VideoDisplay *parent;
|
||||
|
||||
|
@ -106,6 +105,12 @@ protected:
|
|||
Vector2D video_pos; ///< Top-left corner of the video in the display area
|
||||
Vector2D video_res; ///< Video resolution
|
||||
|
||||
const agi::OptionValue *highlight_color_primary_opt;
|
||||
const agi::OptionValue *highlight_color_secondary_opt;
|
||||
const agi::OptionValue *line_color_primary_opt;
|
||||
const agi::OptionValue *line_color_secondary_opt;
|
||||
const agi::OptionValue *shaded_area_alpha_opt;
|
||||
|
||||
agi::signal::Connection file_changed_connection;
|
||||
int commit_id = -1; ///< Last used commit id for coalescing
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
#include "visual_tool_clip.h"
|
||||
|
||||
#include "ass_dialogue.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "options.h"
|
||||
#include "selection_controller.h"
|
||||
|
||||
#include <libaegisub/format.h>
|
||||
|
@ -66,14 +68,18 @@ void VisualToolClip::Draw() {
|
|||
|
||||
DrawAllFeatures();
|
||||
|
||||
// Load colors from options
|
||||
wxColour line_color = to_wx(line_color_primary_opt->GetColor());
|
||||
float shaded_alpha = static_cast<float>(shaded_area_alpha_opt->GetDouble());
|
||||
|
||||
// Draw rectangle
|
||||
gl.SetLineColour(colour[3], 1.0f, 2);
|
||||
gl.SetFillColour(colour[3], 0.0f);
|
||||
gl.SetLineColour(line_color, 1.0f, 2);
|
||||
gl.SetFillColour(line_color, 0.0f);
|
||||
gl.DrawRectangle(cur_1, cur_2);
|
||||
|
||||
// Draw outside area
|
||||
gl.SetLineColour(colour[3], 0.0f);
|
||||
gl.SetFillColour(*wxBLACK, 0.5f);
|
||||
gl.SetLineColour(line_color, 0.0f);
|
||||
gl.SetFillColour(*wxBLACK, shaded_alpha);
|
||||
if (inverse) {
|
||||
gl.DrawRectangle(cur_1, cur_2);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "ass_dialogue.h"
|
||||
#include "ass_file.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "options.h"
|
||||
|
@ -182,6 +183,9 @@ void VisualToolDrag::OnSelectedSetChanged() {
|
|||
void VisualToolDrag::Draw() {
|
||||
DrawAllFeatures();
|
||||
|
||||
// Load colors from options
|
||||
wxColour line_color = to_wx(line_color_primary_opt->GetColor());
|
||||
|
||||
// Draw connecting lines
|
||||
for (auto& feature : features) {
|
||||
if (feature.type == DRAG_START) continue;
|
||||
|
@ -203,7 +207,7 @@ void VisualToolDrag::Draw() {
|
|||
Vector2D end = p2->pos - direction * (10 + arrow_len);
|
||||
|
||||
if (has_arrow) {
|
||||
gl.SetLineColour(colour[3], 0.8f, 2);
|
||||
gl.SetLineColour(line_color, 0.8f, 2);
|
||||
|
||||
// Arrow line
|
||||
gl.DrawLine(start, end);
|
||||
|
@ -214,7 +218,7 @@ void VisualToolDrag::Draw() {
|
|||
}
|
||||
// Draw dashed line
|
||||
else {
|
||||
gl.SetLineColour(colour[3], 0.5f, 2);
|
||||
gl.SetLineColour(line_color, 0.5f, 2);
|
||||
gl.DrawDashedLine(start, end, 6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#include "visual_tool_rotatexy.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "options.h"
|
||||
#include "selection_controller.h"
|
||||
|
||||
#include <libaegisub/format.h>
|
||||
|
@ -41,17 +43,21 @@ void VisualToolRotateXY::Draw() {
|
|||
|
||||
DrawAllFeatures();
|
||||
|
||||
// Load colors from options
|
||||
wxColour line_color_primary = to_wx(line_color_primary_opt->GetColor());
|
||||
wxColour line_color_secondary = to_wx(line_color_secondary_opt->GetColor());
|
||||
|
||||
// Transform grid
|
||||
gl.SetOrigin(org->pos);
|
||||
gl.SetRotation(angle_x, angle_y, angle_z);
|
||||
gl.SetShear(fax, fay);
|
||||
|
||||
// Draw grid
|
||||
gl.SetLineColour(colour[0], 0.5f, 2);
|
||||
gl.SetLineColour(line_color_secondary, 0.5f, 2);
|
||||
gl.SetModeLine();
|
||||
float r = colour[0].Red() / 255.f;
|
||||
float g = colour[0].Green() / 255.f;
|
||||
float b = colour[0].Blue() / 255.f;
|
||||
float r = line_color_secondary.Red() / 255.f;
|
||||
float g = line_color_secondary.Green() / 255.f;
|
||||
float b = line_color_secondary.Blue() / 255.f;
|
||||
|
||||
// Number of lines on each side of each axis
|
||||
static const int radius = 15;
|
||||
|
@ -103,7 +109,7 @@ void VisualToolRotateXY::Draw() {
|
|||
gl.DrawLines(2, points, 4, colors);
|
||||
|
||||
// Draw vectors
|
||||
gl.SetLineColour(colour[3], 1.f, 2);
|
||||
gl.SetLineColour(line_color_primary, 1.f, 2);
|
||||
float vectors[] = {
|
||||
0.f, 0.f, 0.f,
|
||||
50.f, 0.f, 0.f,
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#include "visual_tool_rotatez.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "options.h"
|
||||
#include "selection_controller.h"
|
||||
|
||||
#include <libaegisub/format.h>
|
||||
|
@ -44,6 +46,11 @@ void VisualToolRotateZ::Draw() {
|
|||
|
||||
DrawAllFeatures();
|
||||
|
||||
// Load colors from options
|
||||
wxColour line_color_primary = to_wx(line_color_primary_opt->GetColor());
|
||||
wxColour line_color_secondary = to_wx(line_color_secondary_opt->GetColor());
|
||||
wxColour highlight_color = to_wx(highlight_color_primary_opt->GetColor());
|
||||
|
||||
float radius = (pos - org->pos).Len();
|
||||
float oRadius = radius;
|
||||
if (radius < 50)
|
||||
|
@ -55,8 +62,8 @@ void VisualToolRotateZ::Draw() {
|
|||
gl.SetScale(scale);
|
||||
|
||||
// Draw the circle
|
||||
gl.SetLineColour(colour[0]);
|
||||
gl.SetFillColour(colour[1], 0.3f);
|
||||
gl.SetLineColour(line_color_secondary);
|
||||
gl.SetFillColour(highlight_color, 0.3f);
|
||||
gl.DrawRing(Vector2D(0, 0), radius + 4, radius - 4);
|
||||
|
||||
// Draw markers around circle
|
||||
|
@ -70,7 +77,7 @@ void VisualToolRotateZ::Draw() {
|
|||
|
||||
// Draw the baseline through the origin showing current rotation
|
||||
Vector2D angle_vec(Vector2D::FromAngle(angle * deg2rad));
|
||||
gl.SetLineColour(colour[3], 1, 2);
|
||||
gl.SetLineColour(line_color_primary, 1, 2);
|
||||
gl.DrawLine(angle_vec * -radius, angle_vec * radius);
|
||||
|
||||
if (org->pos != pos) {
|
||||
|
@ -84,8 +91,8 @@ void VisualToolRotateZ::Draw() {
|
|||
}
|
||||
|
||||
// Draw the fake features on the ring
|
||||
gl.SetLineColour(colour[0], 1.f, 1);
|
||||
gl.SetFillColour(colour[1], 0.3f);
|
||||
gl.SetLineColour(line_color_secondary, 1.f, 1);
|
||||
gl.SetFillColour(highlight_color, 0.3f);
|
||||
gl.DrawCircle(angle_vec * radius, 4);
|
||||
gl.DrawCircle(angle_vec * -radius, 4);
|
||||
|
||||
|
@ -94,7 +101,7 @@ void VisualToolRotateZ::Draw() {
|
|||
|
||||
// Draw line to mouse if it isn't over the origin feature
|
||||
if (mouse_pos && (mouse_pos - org->pos).SquareLen() > 100) {
|
||||
gl.SetLineColour(colour[0]);
|
||||
gl.SetLineColour(line_color_secondary);
|
||||
gl.DrawLine(org->pos, mouse_pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#include "visual_tool_scale.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "options.h"
|
||||
|
||||
#include <wx/colour.h>
|
||||
|
||||
VisualToolScale::VisualToolScale(VideoDisplay *parent, agi::Context *context)
|
||||
|
@ -35,6 +38,11 @@ void VisualToolScale::Draw() {
|
|||
// The width of the y scale guide/height of the x scale guide
|
||||
static const int guide_size = 10;
|
||||
|
||||
// Load colors from options
|
||||
wxColour line_color_primary = to_wx(line_color_primary_opt->GetColor());
|
||||
wxColour line_color_secondary = to_wx(line_color_secondary_opt->GetColor());
|
||||
wxColour highlight_color = to_wx(highlight_color_primary_opt->GetColor());
|
||||
|
||||
// Ensure that the scaling UI is comfortably visible on screen
|
||||
Vector2D base_point = pos
|
||||
.Max(Vector2D(base_len / 2 + guide_size, base_len / 2 + guide_size))
|
||||
|
@ -54,13 +62,13 @@ void VisualToolScale::Draw() {
|
|||
Vector2D y_p2(scale_half_length.X(), minor_dim_offset);
|
||||
|
||||
// Current scale amount lines
|
||||
gl.SetLineColour(colour[3], 1.f, 2);
|
||||
gl.SetLineColour(line_color_primary, 1.f, 2);
|
||||
gl.DrawLine(x_p1, x_p2);
|
||||
gl.DrawLine(y_p1, y_p2);
|
||||
|
||||
// Fake features at the end of the lines
|
||||
gl.SetLineColour(colour[0], 1.f, 1);
|
||||
gl.SetFillColour(colour[1], 0.3f);
|
||||
gl.SetLineColour(line_color_secondary, 1.f, 1);
|
||||
gl.SetFillColour(highlight_color, 0.3f);
|
||||
gl.DrawCircle(x_p1, 4);
|
||||
gl.DrawCircle(x_p2, 4);
|
||||
gl.DrawCircle(y_p1, 4);
|
||||
|
@ -68,12 +76,12 @@ void VisualToolScale::Draw() {
|
|||
|
||||
// Draw the guides
|
||||
int half_len = base_len / 2;
|
||||
gl.SetLineColour(colour[0], 1.f, 1);
|
||||
gl.SetLineColour(line_color_secondary, 1.f, 1);
|
||||
gl.DrawRectangle(Vector2D(half_len, -half_len), Vector2D(half_len + guide_size, half_len));
|
||||
gl.DrawRectangle(Vector2D(-half_len, half_len), Vector2D(half_len, half_len + guide_size));
|
||||
|
||||
// Draw the feet
|
||||
gl.SetLineColour(colour[0], 1.f, 2);
|
||||
gl.SetLineColour(line_color_secondary, 1.f, 2);
|
||||
gl.DrawLine(Vector2D(half_len + guide_size, -half_len), Vector2D(half_len + guide_size + guide_size / 2, -half_len));
|
||||
gl.DrawLine(Vector2D(half_len + guide_size, half_len), Vector2D(half_len + guide_size + guide_size / 2, half_len));
|
||||
gl.DrawLine(Vector2D(-half_len, half_len + guide_size), Vector2D(-half_len, half_len + guide_size + guide_size / 2));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "visual_tool_vector_clip.h"
|
||||
|
||||
#include "ass_dialogue.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "options.h"
|
||||
|
@ -92,8 +93,14 @@ void VisualToolVectorClip::Draw() {
|
|||
assert(!start.empty());
|
||||
assert(!count.empty());
|
||||
|
||||
gl.SetLineColour(colour[3], .5f, 2);
|
||||
gl.SetFillColour(wxColour(0, 0, 0), 0.5f);
|
||||
// Load colors from options
|
||||
wxColour line_color = to_wx(line_color_primary_opt->GetColor());
|
||||
wxColour highlight_color_primary = to_wx(highlight_color_primary_opt->GetColor());
|
||||
wxColour highlight_color_secondary = to_wx(highlight_color_secondary_opt->GetColor());
|
||||
float shaded_alpha = static_cast<float>(shaded_area_alpha_opt->GetDouble());
|
||||
|
||||
gl.SetLineColour(line_color, .5f, 2);
|
||||
gl.SetFillColour(*wxBLACK, shaded_alpha);
|
||||
|
||||
// draw the shade over clipped out areas and line showing the clip
|
||||
gl.DrawMultiPolygon(points, start, count, video_pos, video_res, !inverse);
|
||||
|
@ -117,13 +124,13 @@ void VisualToolVectorClip::Draw() {
|
|||
if ((mode == 3 || mode == 4) && !active_feature && points.size() > 2) {
|
||||
auto highlighted_points = spline.GetPointList(highlighted_curve);
|
||||
if (!highlighted_points.empty()) {
|
||||
gl.SetLineColour(colour[2], 1.f, 2);
|
||||
gl.SetLineColour(highlight_color_secondary, 1.f, 2);
|
||||
gl.DrawLineStrip(2, highlighted_points);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw lines connecting the bicubic features
|
||||
gl.SetLineColour(colour[3], 0.9f, 1);
|
||||
gl.SetLineColour(line_color, 0.9f, 1);
|
||||
for (auto const& curve : spline) {
|
||||
if (curve.type == SplineCurve::BICUBIC) {
|
||||
gl.DrawDashedLine(curve.p1, curve.p2, 6);
|
||||
|
@ -133,19 +140,19 @@ void VisualToolVectorClip::Draw() {
|
|||
|
||||
// Draw features
|
||||
for (auto& feature : features) {
|
||||
int color = 3;
|
||||
wxColour feature_color = line_color;
|
||||
if (&feature == active_feature)
|
||||
color = 1;
|
||||
feature_color = highlight_color_primary;
|
||||
else if (sel_features.count(&feature))
|
||||
color = 2;
|
||||
gl.SetFillColour(colour[color], .6f);
|
||||
feature_color = highlight_color_secondary;
|
||||
gl.SetFillColour(feature_color, .6f);
|
||||
|
||||
if (feature.type == DRAG_SMALL_SQUARE) {
|
||||
gl.SetLineColour(colour[3], .5f, 1);
|
||||
gl.SetLineColour(line_color, .5f, 1);
|
||||
gl.DrawRectangle(feature.pos - 3, feature.pos + 3);
|
||||
}
|
||||
else {
|
||||
gl.SetLineColour(colour[color], .5f, 1);
|
||||
gl.SetLineColour(feature_color, .5f, 1);
|
||||
gl.DrawCircle(feature.pos, 2.f);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue