2007-07-01 02:19:55 +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/
|
2007-07-01 02:19:55 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file visual_tool.cpp
|
|
|
|
/// @brief Base class for visual typesetting functions
|
|
|
|
/// @ingroup visual_ts
|
2007-07-01 02:19:55 +02:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2007-07-01 02:19:55 +02:00
|
|
|
#include <wx/glcanvas.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
2007-09-12 01:22:26 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <OpenGL/GL.h>
|
|
|
|
#else
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#endif
|
2009-09-10 15:06:40 +02:00
|
|
|
|
2007-07-01 02:19:55 +02:00
|
|
|
#include "ass_dialogue.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_file.h"
|
2007-07-01 02:19:55 +02:00
|
|
|
#include "ass_override.h"
|
|
|
|
#include "ass_style.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_time.h"
|
|
|
|
#include "export_visible_lines.h"
|
2007-07-01 02:19:55 +02:00
|
|
|
#include "options.h"
|
|
|
|
#include "subs_edit_box.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_grid.h"
|
2007-07-01 02:19:55 +02:00
|
|
|
#include "utils.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "vfr.h"
|
|
|
|
#include "video_context.h"
|
|
|
|
#include "video_display.h"
|
|
|
|
#include "video_provider_manager.h"
|
|
|
|
#include "visual_tool.h"
|
2007-07-01 02:19:55 +02:00
|
|
|
|
2010-05-16 08:39:11 +02:00
|
|
|
const wxColour VisualTool::colour[4] = {wxColour(106,32,19), wxColour(255,169,40), wxColour(255,253,185), wxColour(187,0,0)};
|
|
|
|
|
|
|
|
/// @brief Constructor
|
|
|
|
/// @param parent
|
|
|
|
VisualTool::VisualTool(VideoDisplay *parent, VideoState const& video)
|
|
|
|
: parent(parent)
|
|
|
|
, holding(false)
|
|
|
|
, curDiag(NULL)
|
|
|
|
, dragging(false)
|
|
|
|
, curFeature(-1)
|
|
|
|
, dragListOK(false)
|
|
|
|
, video(video)
|
|
|
|
, frame_n(0)
|
|
|
|
{
|
2007-07-04 07:22:35 +02:00
|
|
|
if (VideoContext::Get()->IsLoaded()) {
|
|
|
|
frame_n = VideoContext::Get()->GetFrameN();
|
|
|
|
}
|
2007-07-01 09:09:37 +02:00
|
|
|
|
2010-05-20 10:55:35 +02:00
|
|
|
PopulateFeatureList();
|
2007-07-01 02:19:55 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Destructor
|
2007-07-01 02:19:55 +02:00
|
|
|
VisualTool::~VisualTool() {
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Mouse event
|
|
|
|
/// @param event
|
2007-07-01 04:23:57 +02:00
|
|
|
void VisualTool::OnMouseEvent (wxMouseEvent &event) {
|
2010-05-16 08:39:11 +02:00
|
|
|
bool realTime = Options.AsBool(L"Video Visual Realtime");
|
2007-07-01 04:23:57 +02:00
|
|
|
|
|
|
|
if (event.Leaving()) {
|
2007-07-08 21:50:54 +02:00
|
|
|
Update();
|
2007-07-08 09:22:09 +02:00
|
|
|
return;
|
2007-07-01 04:23:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
leftClick = event.ButtonDown(wxMOUSE_BTN_LEFT);
|
|
|
|
leftDClick = event.LeftDClick();
|
|
|
|
shiftDown = event.m_shiftDown;
|
2007-09-22 00:56:44 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
ctrlDown = event.m_metaDown; // Cmd key
|
|
|
|
#else
|
2007-07-01 04:23:57 +02:00
|
|
|
ctrlDown = event.m_controlDown;
|
2007-09-22 00:56:44 +02:00
|
|
|
#endif
|
2007-07-01 04:23:57 +02:00
|
|
|
altDown = event.m_altDown;
|
|
|
|
|
2010-05-20 10:55:35 +02:00
|
|
|
if (!dragListOK) {
|
|
|
|
PopulateFeatureList();
|
|
|
|
dragListOK = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dragging) {
|
|
|
|
// continue drag
|
|
|
|
if (event.LeftIsDown()) {
|
|
|
|
features[curFeature].x = (video.x - dragStartX + dragOrigX);
|
|
|
|
features[curFeature].y = (video.y - dragStartY + dragOrigY);
|
|
|
|
if (shiftDown) {
|
|
|
|
if (abs(video.x - dragStartX) > abs(video.y - dragStartY)) {
|
|
|
|
features[curFeature].y = dragOrigY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
features[curFeature].x = dragOrigX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UpdateDrag(features[curFeature]);
|
|
|
|
|
|
|
|
if (realTime) {
|
|
|
|
CommitDrag(features[curFeature]);
|
|
|
|
Commit();
|
|
|
|
}
|
2007-07-01 09:09:37 +02:00
|
|
|
}
|
2010-05-20 10:55:35 +02:00
|
|
|
// end drag
|
|
|
|
else {
|
|
|
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
2007-07-01 09:09:37 +02:00
|
|
|
|
2010-05-20 10:55:35 +02:00
|
|
|
dragging = false;
|
|
|
|
CommitDrag(features[curFeature]);
|
|
|
|
Commit(true);
|
|
|
|
|
|
|
|
curFeature = -1;
|
|
|
|
parent->ReleaseMouse();
|
|
|
|
parent->SetFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (holding) {
|
|
|
|
// continue hold
|
|
|
|
if (event.LeftIsDown()) {
|
|
|
|
UpdateHold();
|
|
|
|
|
|
|
|
if (realTime) {
|
|
|
|
CommitHold();
|
|
|
|
Commit();
|
2007-07-07 07:51:18 +02:00
|
|
|
}
|
|
|
|
}
|
2010-05-20 10:55:35 +02:00
|
|
|
// end hold
|
|
|
|
else {
|
|
|
|
if (realTime) AssLimitToVisibleFilter::SetFrame(-1);
|
2007-07-07 07:51:18 +02:00
|
|
|
|
2010-05-20 10:55:35 +02:00
|
|
|
holding = false;
|
|
|
|
CommitHold();
|
|
|
|
Commit(true);
|
|
|
|
|
|
|
|
curDiag = NULL;
|
|
|
|
parent->ReleaseMouse();
|
|
|
|
parent->SetFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (leftClick) {
|
|
|
|
curFeature = GetHighlightedFeature();
|
|
|
|
// start drag
|
|
|
|
if (curFeature > -1) {
|
|
|
|
if (InitializeDrag(features[curFeature])) {
|
2009-07-12 07:30:01 +02:00
|
|
|
if (features[curFeature].lineN != -1) {
|
|
|
|
VideoContext::Get()->grid->editBox->SetToLine(features[curFeature].lineN,true);
|
|
|
|
VideoContext::Get()->grid->SelectRow(features[curFeature].lineN);
|
|
|
|
}
|
2007-07-01 09:09:37 +02:00
|
|
|
|
2010-05-16 08:39:11 +02:00
|
|
|
dragStartX = video.x;
|
|
|
|
dragStartY = video.y;
|
2007-07-01 09:09:37 +02:00
|
|
|
dragOrigX = features[curFeature].x;
|
|
|
|
dragOrigY = features[curFeature].y;
|
|
|
|
|
|
|
|
dragging = true;
|
|
|
|
parent->CaptureMouse();
|
|
|
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
|
|
|
}
|
|
|
|
}
|
2010-05-20 10:55:35 +02:00
|
|
|
// start hold
|
|
|
|
else {
|
2007-07-01 04:23:57 +02:00
|
|
|
curDiag = GetActiveDialogueLine();
|
2010-05-20 10:55:35 +02:00
|
|
|
if (curDiag && InitializeHold()) {
|
2007-07-01 04:23:57 +02:00
|
|
|
holding = true;
|
|
|
|
parent->CaptureMouse();
|
|
|
|
if (realTime) AssLimitToVisibleFilter::SetFrame(frame_n);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Commit
|
|
|
|
/// @param full
|
2007-07-07 09:27:28 +02:00
|
|
|
void VisualTool::Commit(bool full) {
|
|
|
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
2007-07-07 23:18:00 +02:00
|
|
|
if (full) grid->ass->FlagAsModified(_("visual typesetting"));
|
2007-07-07 09:27:28 +02:00
|
|
|
grid->CommitChanges(false,!full);
|
2010-05-20 10:55:29 +02:00
|
|
|
grid->editBox->Update(false, true, false);
|
2007-07-07 09:27:28 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get active dialogue line
|
|
|
|
/// @return
|
2007-07-01 04:23:57 +02:00
|
|
|
AssDialogue* VisualTool::GetActiveDialogueLine() {
|
|
|
|
SubtitlesGrid *grid = VideoContext::Get()->grid;
|
|
|
|
AssDialogue *diag = grid->GetDialogue(grid->editBox->linen);
|
|
|
|
|
|
|
|
// Check if it's within range
|
|
|
|
if (diag) {
|
|
|
|
int f1 = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
|
|
|
|
int f2 = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
|
|
|
|
|
|
|
|
if (f1 > frame_n || f2 < frame_n) return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return diag;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get feature under mouse
|
|
|
|
/// @return
|
2007-07-01 09:09:37 +02:00
|
|
|
int VisualTool::GetHighlightedFeature() {
|
2010-05-16 08:39:11 +02:00
|
|
|
int highestLayerFound = INT_MIN;
|
2007-07-01 09:09:37 +02:00
|
|
|
int bestMatch = -1;
|
|
|
|
for (size_t i=0;i<features.size();i++) {
|
2010-05-16 08:39:11 +02:00
|
|
|
if (features[i].IsMouseOver(video.x, video.y) && features[i].layer > highestLayerFound) {
|
2007-07-01 09:09:37 +02:00
|
|
|
bestMatch = i;
|
|
|
|
highestLayerFound = features[i].layer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bestMatch;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Draw all features
|
2007-07-01 09:09:37 +02:00
|
|
|
void VisualTool::DrawAllFeatures() {
|
|
|
|
if (!dragListOK) {
|
|
|
|
PopulateFeatureList();
|
|
|
|
dragListOK = true;
|
|
|
|
}
|
2007-07-04 08:50:03 +02:00
|
|
|
|
|
|
|
int mouseOver = curFeature;
|
|
|
|
if (curFeature == -1) mouseOver = GetHighlightedFeature();
|
|
|
|
|
2007-07-01 09:09:37 +02:00
|
|
|
for (size_t i=0;i<features.size();i++) {
|
2007-07-04 22:25:24 +02:00
|
|
|
SetFillColour(colour[(signed)i == mouseOver ? 2 : 1],0.6f);
|
|
|
|
SetLineColour(colour[0],1.0f,2);
|
2010-05-19 05:23:55 +02:00
|
|
|
features[i].Draw(*this);
|
2007-07-01 09:09:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Refresh
|
2007-07-01 09:09:37 +02:00
|
|
|
void VisualTool::Refresh() {
|
|
|
|
frame_n = VideoContext::Get()->GetFrameN();
|
2007-07-04 08:50:03 +02:00
|
|
|
if (!dragging) dragListOK = false;
|
2007-07-04 06:24:47 +02:00
|
|
|
DoRefresh();
|
2007-07-01 09:09:37 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get position of line
|
|
|
|
/// @param diag
|
|
|
|
/// @param x
|
|
|
|
/// @param y
|
2007-07-01 02:19:55 +02:00
|
|
|
void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y) {
|
|
|
|
int orgx=0,orgy=0;
|
|
|
|
GetLinePosition(diag,x,y,orgx,orgy);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param diag
|
|
|
|
/// @param x
|
|
|
|
/// @param y
|
|
|
|
/// @param orgx
|
|
|
|
/// @param orgy
|
2007-07-01 02:19:55 +02:00
|
|
|
void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, int &orgy) {
|
|
|
|
if (!diag) {
|
2010-05-01 03:45:16 +02:00
|
|
|
x = INT_MIN;
|
|
|
|
y = INT_MIN;
|
|
|
|
orgx = INT_MIN;
|
|
|
|
orgy = INT_MIN;
|
2007-07-01 02:19:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int margin[4];
|
|
|
|
for (int i=0;i<4;i++) margin[i] = diag->Margin[i];
|
|
|
|
int align = 2;
|
|
|
|
|
|
|
|
AssStyle *style = VideoContext::Get()->grid->ass->GetStyle(diag->Style);
|
|
|
|
if (style) {
|
|
|
|
align = style->alignment;
|
|
|
|
for (int i=0;i<4;i++) {
|
|
|
|
if (margin[i] == 0) margin[i] = style->Margin[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int sw,sh;
|
|
|
|
VideoContext::Get()->GetScriptSize(sw,sh);
|
|
|
|
|
|
|
|
// Process margins
|
|
|
|
margin[3] = margin[2];
|
|
|
|
margin[1] = sw - margin[1];
|
|
|
|
margin[3] = sh - margin[3];
|
|
|
|
|
|
|
|
// Position
|
|
|
|
bool posSet = false;
|
|
|
|
bool orgSet = false;
|
|
|
|
|
|
|
|
// Overrides processing
|
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
for (size_t i=0;i<blockn;i++) {
|
2010-05-16 08:39:11 +02:00
|
|
|
if (posSet && orgSet) break;
|
|
|
|
|
2007-07-01 02:19:55 +02:00
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(i));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
|
|
|
|
|
|
|
// Position
|
2010-05-16 08:39:11 +02:00
|
|
|
if ((tag->Name == L"\\pos" || tag->Name == L"\\move") && tag->Params.size() >= 2) {
|
2007-07-01 02:19:55 +02:00
|
|
|
if (!posSet) {
|
2010-05-16 08:39:11 +02:00
|
|
|
x = tag->Params[0]->AsInt();
|
|
|
|
y = tag->Params[1]->AsInt();
|
2007-07-01 02:19:55 +02:00
|
|
|
posSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alignment
|
2010-05-16 08:39:11 +02:00
|
|
|
else if ((tag->Name == L"\\an" || tag->Name == L"\\a") && tag->Params.size() >= 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
align = tag->Params[0]->AsInt();
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\a") {
|
2007-07-01 02:19:55 +02:00
|
|
|
switch(align) {
|
2010-05-16 08:39:11 +02:00
|
|
|
case 1: case 2: case 3:
|
|
|
|
break;
|
|
|
|
case 5: case 6: case 7:
|
|
|
|
align += 2;
|
|
|
|
break;
|
|
|
|
case 9: case 10: case 11:
|
|
|
|
align -= 5;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
align = 2;
|
|
|
|
break;
|
2007-07-01 02:19:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Origin
|
2010-05-16 08:39:11 +02:00
|
|
|
else if (!orgSet && tag->Name == L"\\org" && tag->Params.size() >= 2) {
|
2007-07-01 02:19:55 +02:00
|
|
|
orgx = tag->Params[0]->AsInt();
|
|
|
|
orgy = tag->Params[1]->AsInt();
|
2010-05-16 08:39:11 +02:00
|
|
|
parent->FromScriptCoords(&orgx, &orgy);
|
2007-07-01 02:19:55 +02:00
|
|
|
orgSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
|
|
|
|
2010-05-16 08:39:11 +02:00
|
|
|
if (!posSet) {
|
|
|
|
// Alignment type
|
|
|
|
int hor = (align - 1) % 3;
|
|
|
|
int vert = (align - 1) / 3;
|
|
|
|
|
|
|
|
// Calculate positions
|
|
|
|
if (hor == 0) x = margin[0];
|
|
|
|
else if (hor == 1) x = (margin[0] + margin[1])/2;
|
|
|
|
else if (hor == 2) x = margin[1];
|
|
|
|
if (vert == 0) y = margin[3];
|
|
|
|
else if (vert == 1) y = (margin[2] + margin[3])/2;
|
|
|
|
else if (vert == 2) y = margin[2];
|
2007-07-01 02:19:55 +02:00
|
|
|
}
|
|
|
|
|
2010-05-16 08:39:11 +02:00
|
|
|
parent->FromScriptCoords(&x, &y);
|
2007-07-01 02:19:55 +02:00
|
|
|
|
|
|
|
// No origin?
|
|
|
|
if (!orgSet) {
|
|
|
|
orgx = x;
|
|
|
|
orgy = y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get the destination of move, if any
|
|
|
|
/// @param diag
|
|
|
|
/// @param hasMove
|
|
|
|
/// @param x1
|
|
|
|
/// @param y1
|
|
|
|
/// @param x2
|
|
|
|
/// @param y2
|
|
|
|
/// @param t1
|
|
|
|
/// @param t2
|
2007-07-04 02:36:04 +02:00
|
|
|
void VisualTool::GetLineMove(AssDialogue *diag,bool &hasMove,int &x1,int &y1,int &x2,int &y2,int &t1,int &t2) {
|
|
|
|
// Parse tags
|
|
|
|
hasMove = false;
|
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
|
|
|
|
// For each block
|
|
|
|
for (size_t i=0;i<blockn;i++) {
|
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(i));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
|
|
|
|
|
|
|
// Position
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\move" && tag->Params.size() >= 4) {
|
2007-07-04 02:36:04 +02:00
|
|
|
hasMove = true;
|
|
|
|
x1 = tag->Params[0]->AsInt();
|
|
|
|
y1 = tag->Params[1]->AsInt();
|
|
|
|
x2 = tag->Params[2]->AsInt();
|
|
|
|
y2 = tag->Params[3]->AsInt();
|
2010-05-16 08:39:11 +02:00
|
|
|
parent->FromScriptCoords(&x1, &y1);
|
|
|
|
parent->FromScriptCoords(&x2, &y2);
|
2010-04-22 03:09:24 +02:00
|
|
|
if (tag->Params.size() >= 6 &&
|
|
|
|
!tag->Params[4]->ommited &&
|
|
|
|
!tag->Params[5]->ommited) {
|
|
|
|
|
2007-07-04 02:36:04 +02:00
|
|
|
t1 = tag->Params[4]->AsInt();
|
|
|
|
t2 = tag->Params[5]->AsInt();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get line's rotation
|
|
|
|
/// @param diag
|
|
|
|
/// @param rx
|
|
|
|
/// @param ry
|
|
|
|
/// @param rz
|
2007-07-01 02:19:55 +02:00
|
|
|
void VisualTool::GetLineRotation(AssDialogue *diag,float &rx,float &ry,float &rz) {
|
|
|
|
// Default values
|
|
|
|
rx = ry = rz = 0.0f;
|
|
|
|
|
2007-07-29 11:15:32 +02:00
|
|
|
// No dialogue
|
|
|
|
if (!diag) return;
|
|
|
|
|
2007-07-01 02:19:55 +02:00
|
|
|
// Prepare overrides
|
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
if (blockn == 0) {
|
|
|
|
diag->ClearBlocks();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process override
|
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(0));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\frx" && tag->Params.size() == 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
rx = tag->Params[0]->AsFloat();
|
|
|
|
}
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\fry" && tag->Params.size() == 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
ry = tag->Params[0]->AsFloat();
|
|
|
|
}
|
2010-05-16 08:39:11 +02:00
|
|
|
if ((tag->Name == L"\\frz" || tag->Name == L"\fr") && tag->Params.size() == 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
rz = tag->Params[0]->AsFloat();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get line's scale
|
|
|
|
/// @param diag
|
|
|
|
/// @param scalX
|
|
|
|
/// @param scalY
|
2007-07-01 02:19:55 +02:00
|
|
|
void VisualTool::GetLineScale(AssDialogue *diag,float &scalX,float &scalY) {
|
|
|
|
// Default values
|
|
|
|
scalX = scalY = 100.0f;
|
|
|
|
|
|
|
|
// Prepare overrides
|
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
if (blockn == 0) {
|
|
|
|
diag->ClearBlocks();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process override
|
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(0));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\fscx" && tag->Params.size() == 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
scalX = tag->Params[0]->AsFloat();
|
|
|
|
}
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\fscy" && tag->Params.size() == 1) {
|
2007-07-01 02:19:55 +02:00
|
|
|
scalY = tag->Params[0]->AsFloat();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Get line's clip
|
|
|
|
/// @param diag
|
|
|
|
/// @param x1
|
|
|
|
/// @param y1
|
|
|
|
/// @param x2
|
|
|
|
/// @param y2
|
|
|
|
/// @param inverse
|
2008-09-10 18:13:54 +02:00
|
|
|
void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse) {
|
2007-07-01 02:19:55 +02:00
|
|
|
// Default values
|
|
|
|
x1 = y1 = 0;
|
|
|
|
int sw,sh;
|
|
|
|
VideoContext::Get()->GetScriptSize(sw,sh);
|
|
|
|
x2 = sw-1;
|
|
|
|
y2 = sh-1;
|
2008-09-10 18:13:54 +02:00
|
|
|
inverse = false;
|
2007-07-01 02:19:55 +02:00
|
|
|
|
|
|
|
// Prepare overrides
|
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
if (blockn == 0) {
|
|
|
|
diag->ClearBlocks();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process override
|
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(0));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\clip" && tag->Params.size() == 4) {
|
2007-07-01 02:19:55 +02:00
|
|
|
x1 = tag->Params[0]->AsInt();
|
|
|
|
y1 = tag->Params[1]->AsInt();
|
|
|
|
x2 = tag->Params[2]->AsInt();
|
|
|
|
y2 = tag->Params[3]->AsInt();
|
2008-09-10 18:13:54 +02:00
|
|
|
inverse = false;
|
|
|
|
}
|
2010-05-16 08:39:11 +02:00
|
|
|
else if (tag->Name == L"\\iclip" && tag->Params.size() == 4) {
|
2008-09-10 18:13:54 +02:00
|
|
|
x1 = tag->Params[0]->AsInt();
|
|
|
|
y1 = tag->Params[1]->AsInt();
|
|
|
|
x2 = tag->Params[2]->AsInt();
|
|
|
|
y2 = tag->Params[3]->AsInt();
|
|
|
|
inverse = true;
|
2007-07-01 02:19:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
2010-05-16 08:39:11 +02:00
|
|
|
|
|
|
|
parent->FromScriptCoords(&x1, &y1);
|
|
|
|
parent->FromScriptCoords(&x2, &y2);
|
2007-07-01 02:19:55 +02:00
|
|
|
}
|
2007-07-01 05:57:34 +02:00
|
|
|
|
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
|
|
|
/// @brief Get line vector clip, if it exists
|
|
|
|
/// @param diag
|
|
|
|
/// @param scale
|
|
|
|
/// @param inverse
|
2008-09-10 18:13:54 +02:00
|
|
|
wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse) {
|
2007-07-05 06:32:46 +02:00
|
|
|
// Prepare overrides
|
|
|
|
wxString result;
|
|
|
|
scale = 1;
|
2008-09-10 18:13:54 +02:00
|
|
|
inverse = false;
|
2007-07-05 06:32:46 +02:00
|
|
|
diag->ParseASSTags();
|
|
|
|
AssDialogueBlockOverride *override;
|
|
|
|
AssOverrideTag *tag;
|
|
|
|
size_t blockn = diag->Blocks.size();
|
|
|
|
if (blockn == 0) {
|
|
|
|
diag->ClearBlocks();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process override
|
|
|
|
override = AssDialogueBlock::GetAsOverride(diag->Blocks.at(0));
|
|
|
|
if (override) {
|
|
|
|
for (size_t j=0;j<override->Tags.size();j++) {
|
|
|
|
tag = override->Tags.at(j);
|
2010-05-16 08:39:11 +02:00
|
|
|
if (tag->Name == L"\\clip" || tag->Name == L"\\iclip") {
|
2007-07-05 06:32:46 +02:00
|
|
|
if (tag->Params.size() == 1) {
|
|
|
|
result = tag->Params[0]->AsText();
|
|
|
|
}
|
2008-09-10 18:13:54 +02:00
|
|
|
else if (tag->Params.size() == 2) {
|
2007-07-05 06:32:46 +02:00
|
|
|
scale = tag->Params[0]->AsInt();
|
|
|
|
result = tag->Params[1]->AsText();
|
|
|
|
}
|
2008-09-10 18:13:54 +02:00
|
|
|
else if (tag->Params.size() == 4) {
|
|
|
|
int x1 = tag->Params[0]->AsInt(),
|
|
|
|
y1 = tag->Params[1]->AsInt(),
|
|
|
|
x2 = tag->Params[2]->AsInt(),
|
|
|
|
y2 = tag->Params[3]->AsInt();
|
2010-05-16 08:39:11 +02:00
|
|
|
result = wxString::Format(L"m %d %d l %d %d %d %d %d %d", x1, y1, x2, y1, x2, y2, x1, y2);
|
2008-09-10 18:13:54 +02:00
|
|
|
}
|
2010-05-16 08:39:11 +02:00
|
|
|
inverse = tag->Name == L"\\iclip";
|
2007-07-05 06:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diag->ClearBlocks();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// @brief Set override
|
|
|
|
/// @param tag
|
|
|
|
/// @param value
|
2010-05-20 10:55:29 +02:00
|
|
|
void VisualTool::SetOverride(AssDialogue* line, wxString tag, wxString value) {
|
|
|
|
if (!line) return;
|
|
|
|
|
|
|
|
wxString removeTag;
|
|
|
|
if (tag == L"\\1c") removeTag = L"\\c";
|
|
|
|
else if (tag == L"\\fr") removeTag = L"\\frz";
|
|
|
|
else if (tag == L"\\pos") removeTag = L"\\move";
|
|
|
|
else if (tag == L"\\move") removeTag = L"\\pos";
|
|
|
|
else if (tag == L"\\clip") removeTag = L"\\iclip";
|
|
|
|
else if (tag == L"\\iclip") removeTag = L"\\clip";
|
|
|
|
|
|
|
|
wxString insert = tag + value;
|
|
|
|
|
|
|
|
// Get block at start
|
|
|
|
line->ParseASSTags();
|
|
|
|
AssDialogueBlock *block = line->Blocks.at(0);
|
|
|
|
|
|
|
|
// Get current block as plain or override
|
|
|
|
AssDialogueBlockPlain *plain = dynamic_cast<AssDialogueBlockPlain*>(block);
|
|
|
|
AssDialogueBlockOverride *ovr = dynamic_cast<AssDialogueBlockOverride*>(block);
|
|
|
|
|
|
|
|
if (plain) {
|
|
|
|
line->Text = L"{" + insert + L"}" + line->Text;
|
|
|
|
}
|
|
|
|
else if (ovr) {
|
|
|
|
ovr->text += insert;
|
|
|
|
ovr->ParseTags();
|
|
|
|
|
|
|
|
// Remove old of same
|
|
|
|
for (size_t i = 0; i < ovr->Tags.size() - 1; i++) {
|
|
|
|
wxString name = ovr->Tags.at(i)->Name;
|
|
|
|
if (tag == name || removeTag == name) {
|
|
|
|
delete ovr->Tags.at(i);
|
|
|
|
ovr->Tags.erase(ovr->Tags.begin() + i);
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
line->UpdateText();
|
|
|
|
}
|
|
|
|
|
|
|
|
parent->SetFocus();
|
2007-07-01 05:57:34 +02:00
|
|
|
}
|