2011-11-06 18:18:20 +01:00
|
|
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file vis_tool.cpp
|
|
|
|
/// @brief Visual typesetting tools commands
|
|
|
|
/// @ingroup command visual_ui
|
|
|
|
///
|
|
|
|
|
|
|
|
#include "../config.h"
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
|
|
|
|
#include "../include/aegisub/context.h"
|
|
|
|
#include "../video_box.h"
|
|
|
|
#include "../video_context.h"
|
|
|
|
#include "../video_display.h"
|
|
|
|
#include "../visual_tool_clip.h"
|
|
|
|
#include "../visual_tool_cross.h"
|
|
|
|
#include "../visual_tool_drag.h"
|
|
|
|
#include "../visual_tool_rotatexy.h"
|
|
|
|
#include "../visual_tool_rotatez.h"
|
|
|
|
#include "../visual_tool_scale.h"
|
|
|
|
#include "../visual_tool_vector_clip.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
using cmd::Command;
|
|
|
|
/// @defgroup cmd-visual Visual typesetting tools commands
|
|
|
|
/// @{
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
template<class T>
|
|
|
|
struct visual_tool_command : public Command {
|
|
|
|
CMD_TYPE(COMMAND_VALIDATE | COMMAND_RADIO)
|
|
|
|
|
|
|
|
bool Validate(const agi::Context *c) {
|
|
|
|
return c->videoController->IsLoaded();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsActive(const agi::Context *c) {
|
|
|
|
return c->videoDisplay->ToolIsType(typeid(T));
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator()(agi::Context *c) {
|
|
|
|
c->videoDisplay->SetTool(new T(c->videoDisplay, c));
|
2011-11-06 18:18:20 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_cross : public visual_tool_command<VisualToolCross> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/cross")
|
|
|
|
STR_MENU("Standard")
|
|
|
|
STR_DISP("Standard")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Standard mode, double click sets position")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_drag : public visual_tool_command<VisualToolDrag> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/drag")
|
|
|
|
STR_MENU("Drag")
|
|
|
|
STR_DISP("Drag")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Drag subtitles")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_rotate_z : public visual_tool_command<VisualToolRotateZ> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/rotate/z")
|
|
|
|
STR_MENU("Rotate Z")
|
|
|
|
STR_DISP("Rotate Z")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Rotate subtitles on their Z axis")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_rotate_xy : public visual_tool_command<VisualToolRotateXY> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/rotate/xy")
|
|
|
|
STR_MENU("Rotate XY")
|
|
|
|
STR_DISP("Rotate XY")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Rotate subtitles on their X and Y axes")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_scale : public visual_tool_command<VisualToolScale> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/scale")
|
|
|
|
STR_MENU("Scale")
|
|
|
|
STR_DISP("Scale")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Scale subtitles on X and Y axes")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_clip : public visual_tool_command<VisualToolClip> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/clip")
|
|
|
|
STR_MENU("Clip")
|
|
|
|
STR_DISP("Clip")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Clip subtitles to a rectangle")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
|
2012-01-13 21:18:40 +01:00
|
|
|
struct visual_mode_vector_clip : public visual_tool_command<VisualToolVectorClip> {
|
2011-11-06 18:18:20 +01:00
|
|
|
CMD_NAME("video/tool/vector_clip")
|
|
|
|
STR_MENU("Vector Clip")
|
|
|
|
STR_DISP("Vector Clip")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Clip subtitles to a vectorial area")
|
2011-11-06 18:18:20 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @}
|
|
|
|
|
|
|
|
namespace cmd {
|
|
|
|
void init_visual_tools() {
|
|
|
|
reg(new visual_mode_cross);
|
|
|
|
reg(new visual_mode_drag);
|
|
|
|
reg(new visual_mode_rotate_z);
|
|
|
|
reg(new visual_mode_rotate_xy);
|
|
|
|
reg(new visual_mode_scale);
|
|
|
|
reg(new visual_mode_clip);
|
|
|
|
reg(new visual_mode_vector_clip);
|
|
|
|
}
|
|
|
|
}
|