mirror of https://github.com/odrling/Aegisub
assdraw: strip trailing whitespace from files
Originally committed to SVN as r6866.
This commit is contained in:
parent
8c6d047115
commit
c3aa3cbe00
|
@ -5,20 +5,20 @@
|
|||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace agg
|
|||
init(num, x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void bcspline::init(int max)
|
||||
{
|
||||
|
@ -92,12 +92,12 @@ namespace agg
|
|||
if(m_num > 2)
|
||||
{
|
||||
int i, k, n1;
|
||||
double* temp;
|
||||
double* r;
|
||||
double* temp;
|
||||
double* r;
|
||||
double* s;
|
||||
double h, p, d, f, e;
|
||||
|
||||
for(k = 0; k < m_num; k++)
|
||||
|
||||
for(k = 0; k < m_num; k++)
|
||||
{
|
||||
m_am[k] = 0.0;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace agg
|
|||
pod_array<double> al(n1);
|
||||
temp = &al[0];
|
||||
|
||||
for(k = 0; k < n1; k++)
|
||||
for(k = 0; k < n1; k++)
|
||||
{
|
||||
temp[k] = 0.0;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace agg
|
|||
d = m_x[1] - m_x[0];
|
||||
e = (m_y[1] - m_y[0]) / d;
|
||||
|
||||
for(k = 1; k < n1; k++)
|
||||
for(k = 1; k < n1; k++)
|
||||
{
|
||||
h = d;
|
||||
d = m_x[k + 1] - m_x[k];
|
||||
|
@ -130,18 +130,18 @@ namespace agg
|
|||
s[k] = 6.0 * (e - f) / (h + d);
|
||||
}
|
||||
|
||||
for(k = 1; k < n1; k++)
|
||||
for(k = 1; k < n1; k++)
|
||||
{
|
||||
p = 1.0 / (r[k] * al[k - 1] + 2.0);
|
||||
al[k] *= -p;
|
||||
s[k] = (s[k] - r[k] * s[k - 1]) * p;
|
||||
s[k] = (s[k] - r[k] * s[k - 1]) * p;
|
||||
}
|
||||
|
||||
m_am[n1] = 0.0;
|
||||
al[n1 - 1] = s[n1 - 1];
|
||||
m_am[n1 - 1] = al[n1 - 1];
|
||||
|
||||
for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--)
|
||||
for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--)
|
||||
{
|
||||
al[k] = al[k] * al[k + 1] + s[k];
|
||||
m_am[k] = al[k];
|
||||
|
@ -170,14 +170,14 @@ namespace agg
|
|||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
void bcspline::bsearch(int n, const double *x, double x0, int *i)
|
||||
void bcspline::bsearch(int n, const double *x, double x0, int *i)
|
||||
{
|
||||
int j = n - 1;
|
||||
int k;
|
||||
|
||||
for(*i = 0; (j - *i) > 1; )
|
||||
|
||||
for(*i = 0; (j - *i) > 1; )
|
||||
{
|
||||
if(x0 < x[k = (*i + j) >> 1]) j = k;
|
||||
if(x0 < x[k = (*i + j) >> 1]) j = k;
|
||||
else *i = k;
|
||||
}
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ namespace agg
|
|||
double bcspline::extrapolation_left(double x) const
|
||||
{
|
||||
double d = m_x[1] - m_x[0];
|
||||
return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) *
|
||||
(x - m_x[0]) +
|
||||
return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) *
|
||||
(x - m_x[0]) +
|
||||
m_y[0];
|
||||
}
|
||||
|
||||
|
@ -210,8 +210,8 @@ namespace agg
|
|||
double bcspline::extrapolation_right(double x) const
|
||||
{
|
||||
double d = m_x[m_num - 1] - m_x[m_num - 2];
|
||||
return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) *
|
||||
(x - m_x[m_num - 1]) +
|
||||
return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) *
|
||||
(x - m_x[m_num - 1]) +
|
||||
m_y[m_num - 1];
|
||||
}
|
||||
|
||||
|
@ -253,15 +253,15 @@ namespace agg
|
|||
if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1])
|
||||
{
|
||||
// Check if x between next points (most probably)
|
||||
if(m_last_idx < m_num - 2 &&
|
||||
if(m_last_idx < m_num - 2 &&
|
||||
x >= m_x[m_last_idx + 1] &&
|
||||
x <= m_x[m_last_idx + 2])
|
||||
{
|
||||
++m_last_idx;
|
||||
}
|
||||
else
|
||||
if(m_last_idx > 0 &&
|
||||
x >= m_x[m_last_idx - 1] &&
|
||||
if(m_last_idx > 0 &&
|
||||
x >= m_x[m_last_idx - 1] &&
|
||||
x <= m_x[m_last_idx])
|
||||
{
|
||||
// x is between pevious points
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
// Contact: mcseem@antigrain.com
|
||||
// mcseemagg@yahoo.com
|
||||
// http://antigrain.com
|
||||
//
|
||||
//
|
||||
// AGG is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// AGG is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with AGG; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ BEGIN_EVENT_TABLE(ASSDrawFrame, wxFrame)
|
|||
EVT_TOOL(TB_TRANSFORM, ASSDrawFrame::OnSelect_Transform)
|
||||
EVT_TOOL_RANGE(MODE_ARR, MODE_DEL, ASSDrawFrame::OnChoose_Mode)
|
||||
EVT_TOOL_RCLICKED(wxID_ANY, ASSDrawFrame::OnToolRClick)
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_SETTINGS_CHANGED, ASSDrawFrame::OnSettingsChanged)
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_SETTINGS_CHANGED, ASSDrawFrame::OnSettingsChanged)
|
||||
EVT_MENU_RANGE(MENU_TB_ALL, MENU_TB_BGIMG, ASSDrawFrame::OnChoose_TBarRClickMenu)
|
||||
EVT_MENU(MENU_CLEAR, ASSDrawFrame::OnSelect_Clear)
|
||||
EVT_MENU(MENU_PREVIEW, ASSDrawFrame::OnSelect_Preview)
|
||||
|
@ -130,15 +130,15 @@ ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& po
|
|||
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(appico));
|
||||
|
||||
|
||||
// Create status bar for the frame
|
||||
CreateStatusBar(3);
|
||||
int statwidths[] = { 64, -1, 64 };
|
||||
GetStatusBar()->SetStatusWidths(3, statwidths);
|
||||
SetStatusBarPane(1);
|
||||
|
||||
|
||||
InitializeDefaultSettings();
|
||||
|
||||
|
||||
// load config
|
||||
configfile = wxFileName(::wxGetCwd(), _T("ASSDraw3.cfg")).GetFullPath();
|
||||
if (!::wxFileExists(configfile))
|
||||
|
@ -170,7 +170,7 @@ ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& po
|
|||
// settings
|
||||
settingsdlg = new ASSDrawSettingsDialog(this, this);
|
||||
settingsdlg->Init();
|
||||
|
||||
|
||||
SetMenus();
|
||||
SetToolBars();
|
||||
SetPanes();
|
||||
|
@ -195,14 +195,14 @@ ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& po
|
|||
{
|
||||
wxString libcmds;
|
||||
config->Read(wxString::Format(_T("%d"),i), &libcmds);
|
||||
shapelib->AddShapePreview(libcmds);
|
||||
shapelib->AddShapePreview(libcmds);
|
||||
}
|
||||
config->SetPath(_T(".."));
|
||||
|
||||
|
||||
m_mgr.Update();
|
||||
m_canvas->SetFocus();
|
||||
m_canvas->Show();
|
||||
|
||||
|
||||
wxSize clientsize = m_canvas->GetClientSize();
|
||||
m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(clientsize.x / 2, clientsize.y / 2));
|
||||
m_canvas->MoveCanvasOriginTo(clientsize.x / 2, clientsize.y / 2);
|
||||
|
@ -268,7 +268,7 @@ void ASSDrawFrame::SetToolBars()
|
|||
|
||||
m_mgr.AddPane(bgimgtbar, wxAuiPaneInfo().Name(_T("bgimgtbar")).Caption(TBNAME_BGIMG).
|
||||
ToolbarPane().Top().Position(2).Dockable(true).LeftDockable(false).RightDockable(false));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ASSDrawFrame::SetMenus()
|
||||
|
@ -358,7 +358,7 @@ void ASSDrawFrame::SetPanes()
|
|||
|
||||
m_mgr.AddPane(srctxtctrl, wxAuiPaneInfo().Name(_T("commands")).Caption(_T("Drawing commands")).
|
||||
Bottom().Layer(1).CloseButton(false).BestSize(wxSize(320, 48)));
|
||||
|
||||
|
||||
if (settingsdlg)
|
||||
m_mgr.AddPane(settingsdlg, wxAuiPaneInfo().Name(_T("settings")).Caption(_T("Settings")).
|
||||
Right().Layer(3).Position(0).CloseButton(true).BestSize(wxSize(240, 480)).MinSize(wxSize(200, 200)).Show(false));
|
||||
|
@ -372,7 +372,7 @@ ASSDrawFrame::~ASSDrawFrame()
|
|||
config->SetPath(_T(".."));
|
||||
|
||||
SaveSettings();
|
||||
|
||||
|
||||
config->SetPath(_T("perspective"));
|
||||
config->Write(_T("perspective"), m_mgr.SavePerspective());
|
||||
config->SetPath(_T(".."));
|
||||
|
@ -390,7 +390,7 @@ ASSDrawFrame::~ASSDrawFrame()
|
|||
wxFileOutputStream cfgf(configfile);
|
||||
config->Save(cfgf);
|
||||
delete config;
|
||||
|
||||
|
||||
if (settingsdlg) settingsdlg->Destroy(); // we need this since wxPropertyGrid must be Clear()ed before deleting
|
||||
|
||||
m_mgr.UnInit();
|
||||
|
@ -398,7 +398,7 @@ ASSDrawFrame::~ASSDrawFrame()
|
|||
|
||||
void ASSDrawFrame::_Clear()
|
||||
{
|
||||
wxMessageDialog msgb(this, _T("Clear the canvas and create a new drawing?"),
|
||||
wxMessageDialog msgb(this, _T("Clear the canvas and create a new drawing?"),
|
||||
_T("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION );
|
||||
if (msgb.ShowModal() == wxID_OK)
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ void ASSDrawFrame::OnChoose_RecenterToBG(wxCommandEvent& event)
|
|||
int lx = (int)disp.x, ty = (int)disp.y;
|
||||
int rx = lx + (int)(w * scale);
|
||||
int by = ty + (int)(h * scale);
|
||||
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case MENU_REPOS_BGTOPLEFT: x = lx, y = ty; break;
|
||||
|
@ -530,7 +530,7 @@ void ASSDrawFrame::OnChoose_RecenterToBG(wxCommandEvent& event)
|
|||
case MENU_REPOS_BGBOTLEFT: x = lx, y = by; break;
|
||||
case MENU_REPOS_BGBOTRIGHT: x = rx, y = by; break;
|
||||
}
|
||||
|
||||
|
||||
m_canvas->MoveCanvasDrawing(x - m_canvas->GetOriginX(), y - m_canvas->GetOriginY());
|
||||
m_canvas->RefreshDisplay();
|
||||
}
|
||||
|
@ -592,31 +592,31 @@ void ASSDrawFrame::OnChoose_TBarRClickMenu(wxCommandEvent& event)
|
|||
bool dock[2] = { false, true };
|
||||
switch (id)
|
||||
{
|
||||
case MENU_TB_ALL:
|
||||
case MENU_TB_ALL:
|
||||
tb[0] = true, tb[1] = true, tb[2] = true;
|
||||
show[0] = true, show[1] = true;
|
||||
break;
|
||||
case MENU_TB_NONE:
|
||||
case MENU_TB_NONE:
|
||||
tb[0] = true, tb[1] = true, tb[2] = true;
|
||||
show[0] = true, show[1] = false;
|
||||
break;
|
||||
case MENU_TB_DOCK:
|
||||
case MENU_TB_DOCK:
|
||||
tb[0] = true, tb[1] = true, tb[2] = true;
|
||||
dock[0] = true, dock[1] = true;
|
||||
break;
|
||||
case MENU_TB_UNDOCK:
|
||||
case MENU_TB_UNDOCK:
|
||||
tb[0] = true, tb[1] = true, tb[2] = true;
|
||||
dock[0] = true, dock[1] = false;
|
||||
break;
|
||||
case MENU_TB_DRAW:
|
||||
case MENU_TB_DRAW:
|
||||
tb[0] = true;
|
||||
show[0] = true, show[1] = !m_mgr.GetPane(tbar[0]).IsShown();
|
||||
break;
|
||||
case MENU_TB_MODE:
|
||||
case MENU_TB_MODE:
|
||||
tb[1] = true;
|
||||
show[0] = true, show[1] = !m_mgr.GetPane(tbar[1]).IsShown();
|
||||
break;
|
||||
case MENU_TB_BGIMG:
|
||||
case MENU_TB_BGIMG:
|
||||
tb[2] = true;
|
||||
show[0] = true, show[1] = !m_mgr.GetPane(tbar[2]).IsShown();
|
||||
break;
|
||||
|
@ -730,10 +730,10 @@ void ASSDrawFrame::OnClose(wxCloseEvent &event)
|
|||
if (event.CanVeto() && behaviors.confirmquit)
|
||||
{
|
||||
if (wxMessageDialog(this, _T("Do you want to close ASSDraw3 now?"), _T("Confirmation"), wxOK | wxCANCEL).ShowModal() == wxID_OK)
|
||||
Destroy();
|
||||
Destroy();
|
||||
else
|
||||
event.Veto();
|
||||
}
|
||||
else
|
||||
Destroy();
|
||||
Destroy();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void ASSDrawFrame::ApplySettings()
|
|||
for (int i = 0; i < n; i++)
|
||||
wxColourToAggRGBA(colors.library_shape, shapes[i]->rgba_shape);
|
||||
shapelib->libarea->Refresh();
|
||||
|
||||
|
||||
m_canvas->SetDrawCmdSet(behaviors.parse_spc? _T("m n l b s p c _"):_T("m n l b _"));
|
||||
|
||||
UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS());
|
||||
|
|
|
@ -92,7 +92,7 @@ ASSDrawCanvas::ASSDrawCanvas(wxWindow *parent, ASSDrawFrame *frame, int extrafla
|
|||
bgimg.bgimg = NULL;
|
||||
bgimg.alpha = 0.5;
|
||||
rectbound2upd = -1, rectbound2upd2 = -1;
|
||||
|
||||
|
||||
rgba_shape_normal = agg::rgba(0,0,1,0.5);
|
||||
rgba_outline = agg::rgba(0,0,0);
|
||||
rgba_guideline = agg::rgba(0.5,0.5,0.5);
|
||||
|
@ -115,7 +115,7 @@ ASSDrawCanvas::ASSDrawCanvas(wxWindow *parent, ASSDrawFrame *frame, int extrafla
|
|||
bgimg.bgimg = NULL;
|
||||
// drag image background file
|
||||
SetDropTarget(new ASSDrawFileDropTarget(this));
|
||||
|
||||
|
||||
hasStatusBar = m_frame->GetStatusBar() != NULL;
|
||||
|
||||
// cursor = crosshair
|
||||
|
@ -132,7 +132,7 @@ ASSDrawCanvas::ASSDrawCanvas(wxWindow *parent, ASSDrawFrame *frame, int extrafla
|
|||
bgimg.alpha_slider->Connect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
|
||||
bgimg.alpha_slider->Connect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
|
||||
bgimg.alpha_slider->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
|
||||
|
||||
|
||||
RefreshUndocmds();
|
||||
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ void ASSDrawCanvas::SetPreviewMode(bool mode)
|
|||
}
|
||||
|
||||
// (Re)draw canvas
|
||||
void ASSDrawCanvas::RefreshDisplay()
|
||||
{
|
||||
void ASSDrawCanvas::RefreshDisplay()
|
||||
{
|
||||
ASSDrawEngine::RefreshDisplay();
|
||||
wxString asscmds = GenerateASS();
|
||||
if (oldasscmds != asscmds)
|
||||
|
@ -199,9 +199,9 @@ void ASSDrawCanvas::RefreshDisplay()
|
|||
}
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::SetDrawMode( MODE mode )
|
||||
{
|
||||
draw_mode = mode;
|
||||
void ASSDrawCanvas::SetDrawMode( MODE mode )
|
||||
{
|
||||
draw_mode = mode;
|
||||
|
||||
if (!selected_points.empty())
|
||||
ClearPointsSelection();
|
||||
|
@ -211,7 +211,7 @@ void ASSDrawCanvas::SetDrawMode( MODE mode )
|
|||
if (IsTransformMode())
|
||||
{
|
||||
isshapetransformable = cmds.size() > 1;
|
||||
|
||||
|
||||
if (isshapetransformable)
|
||||
{
|
||||
|
||||
|
@ -226,9 +226,9 @@ void ASSDrawCanvas::SetDrawMode( MODE mode )
|
|||
backupcmds.move_to(pp.x, pp.y);
|
||||
}
|
||||
wxPoint pp = (*iterate)->m_point->ToWxPoint();
|
||||
backupcmds.move_to(pp.x, pp.y);
|
||||
backupcmds.move_to(pp.x, pp.y);
|
||||
}
|
||||
|
||||
|
||||
// calculate bounding rectangle
|
||||
agg::trans_affine mtx;
|
||||
trans_path *rm, *rb;
|
||||
|
@ -241,28 +241,28 @@ void ASSDrawCanvas::SetDrawMode( MODE mode )
|
|||
delete rc;
|
||||
int minx = rasterizer.min_x(), miny = rasterizer.min_y();
|
||||
int maxx = rasterizer.max_x(), maxy = rasterizer.max_y();
|
||||
|
||||
|
||||
rectbound[0] = wxRealPoint(minx, miny);
|
||||
rectbound[1] = wxRealPoint(maxx, miny);
|
||||
rectbound[2] = wxRealPoint(maxx, maxy);
|
||||
rectbound[3] = wxRealPoint(minx, maxy);
|
||||
for (int i = 0; i < 4; i++)
|
||||
rectbound2[i] = rectbound[i];
|
||||
|
||||
|
||||
rectbound2upd = -1;
|
||||
rectbound2upd2 = -1;
|
||||
|
||||
|
||||
backupowner = NONE;
|
||||
InitiateDraggingIfTransformMode();
|
||||
|
||||
|
||||
if (maxx - minx < 5 || maxy - miny < 5)
|
||||
isshapetransformable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RefreshUndocmds();
|
||||
m_frame->UpdateFrameUI();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::SetDragMode( DRAGMODE mode )
|
||||
|
@ -271,8 +271,8 @@ void ASSDrawCanvas::SetDragMode( DRAGMODE mode )
|
|||
}
|
||||
|
||||
bool ASSDrawCanvas::IsTransformMode()
|
||||
{
|
||||
return draw_mode == MODE_NUT_BILINEAR || draw_mode == MODE_SCALEROTATE;
|
||||
{
|
||||
return draw_mode == MODE_NUT_BILINEAR || draw_mode == MODE_SCALEROTATE;
|
||||
}
|
||||
|
||||
bool ASSDrawCanvas::CanZoom()
|
||||
|
@ -319,14 +319,14 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
if (rectbound2upd2 == -1) //only one vertex dragged
|
||||
{
|
||||
int adjacent[2] = { (rectbound2upd + 3) % 4, (rectbound2upd + 1) % 4 };
|
||||
int opposite = (rectbound2upd + 2) % 4;
|
||||
int opposite = (rectbound2upd + 2) % 4;
|
||||
wxRealPoint newpoint = backup[rectbound2upd] + rdiff;
|
||||
//wxPoint newadjacent[2];
|
||||
double nx, ny;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
bool isect = agg::calc_intersection(
|
||||
backup[opposite].x, backup[opposite].y,
|
||||
backup[opposite].x, backup[opposite].y,
|
||||
backup[adjacent[i]].x, backup[adjacent[i]].y,
|
||||
newpoint.x, newpoint.y,
|
||||
backup[adjacent[i]].x + diff.x, backup[adjacent[i]].y + diff.y,
|
||||
|
@ -334,9 +334,9 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
if (isect && !(fabs(nx - backup[opposite].x) < 10 && fabs(ny - backup[opposite].y) < 10))
|
||||
rectbound2[adjacent[i]] = wxRealPoint(nx, ny);
|
||||
}
|
||||
GetThe4thPoint(backup[opposite].x, backup[opposite].y,
|
||||
GetThe4thPoint(backup[opposite].x, backup[opposite].y,
|
||||
rectbound2[adjacent[0]].x, rectbound2[adjacent[0]].y,
|
||||
rectbound2[adjacent[1]].x, rectbound2[adjacent[1]].y,
|
||||
rectbound2[adjacent[1]].x, rectbound2[adjacent[1]].y,
|
||||
&rectbound2[rectbound2upd].x, &rectbound2[rectbound2upd].y);
|
||||
if (event.ShiftDown()) // shift down = maintain aspect ratio (damn so complicated)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
undodesc = _T("Scale");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// update points
|
||||
UpdateNonUniformTransformation();
|
||||
RefreshDisplay();
|
||||
|
@ -416,21 +416,21 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
{
|
||||
|
||||
// point left-dragged
|
||||
if (mousedownAt_point != NULL && mousedownAt_point->isselected)
|
||||
if (mousedownAt_point != NULL && mousedownAt_point->isselected)
|
||||
{
|
||||
if (!mousedownAt_point->IsAt( wx, wy ))
|
||||
{
|
||||
if (draw_mode == MODE_ARR) {
|
||||
int movex = wx - mousedownAt_point->x(), movey = wy - mousedownAt_point->y();
|
||||
PointSet::iterator iter = selected_points.begin();
|
||||
for (; iter != selected_points.end(); iter++)
|
||||
for (; iter != selected_points.end(); iter++)
|
||||
(*iter)->setXY( (*iter)->x() + movex, (*iter)->y() + movey );
|
||||
}
|
||||
else
|
||||
mousedownAt_point->setXY( wx, wy );
|
||||
|
||||
|
||||
EnforceC1Continuity (mousedownAt_point->cmd_main, mousedownAt_point);
|
||||
|
||||
|
||||
RefreshDisplay();
|
||||
if (undodesc == _T(""))
|
||||
{
|
||||
|
@ -440,9 +440,9 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
undodesc = _T("Drag control point");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// origin left-dragged
|
||||
else if (dragOrigin)
|
||||
else if (dragOrigin)
|
||||
{
|
||||
if (wx != 0 || wy != 0)
|
||||
{
|
||||
|
@ -452,7 +452,7 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
pointsys->originy = wxp.y;
|
||||
RefreshDisplay();
|
||||
undodesc = _T("Move origin");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dragAnchor_left != NULL)
|
||||
{
|
||||
|
@ -500,15 +500,15 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
undodesc = _T("Rotate");
|
||||
}
|
||||
}
|
||||
else if (CanMove())
|
||||
else if (CanMove())
|
||||
{
|
||||
MoveCanvas(xx - dragAnchor_right->x, yy - dragAnchor_right->y);
|
||||
dragAnchor_right->x = xx;
|
||||
dragAnchor_right->y = yy;
|
||||
RefreshDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!preview_mode)// not dragging and not preview mode
|
||||
{
|
||||
if (IsTransformMode())
|
||||
|
@ -539,7 +539,7 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
mouse_point.x - pointsys->scale, mouse_point.y,
|
||||
mouse_point.x + pointsys->scale, mouse_point.y, &ix, &iy);
|
||||
intersect &= fabs(mouse_point.x - ix) <= pointsys->scale;
|
||||
intersect &= (pj.y > pi.y?
|
||||
intersect &= (pj.y > pi.y?
|
||||
pj.y - dy3 > iy && iy > pi.y + dy3:
|
||||
pj.y + dy3 < iy && iy < pi.y - dy3);
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
mouse_point.x, mouse_point.y - pointsys->scale,
|
||||
mouse_point.x, mouse_point.y + pointsys->scale, &ix, &iy);
|
||||
intersect &= fabs(mouse_point.y - iy) <= pointsys->scale;
|
||||
intersect &= (pj.x > pi.x?
|
||||
intersect &= (pj.x > pi.x?
|
||||
pj.x - dx3 > ix && ix > pi.x + dx3:
|
||||
pj.x + dx3 < ix && ix < pi.x - dx3);
|
||||
}
|
||||
|
@ -569,14 +569,14 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
we need not do this for dragging since this same block has set
|
||||
the related variables before the user starts to hold the button
|
||||
(well, before you can drag something you have to move the pointer
|
||||
over that thing first, right?) and we don't want to mess with those
|
||||
over that thing first, right?) and we don't want to mess with those
|
||||
when it's dragging
|
||||
*/
|
||||
|
||||
|
||||
// check if mouse points on any control point first
|
||||
Point* last_pointedAt_point = pointedAt_point;
|
||||
ControlAt( wx, wy, pointedAt_point );
|
||||
|
||||
|
||||
// then check if mouse points on any m_points
|
||||
// override any control point set to pointedAt_point above
|
||||
DrawCmd* p = PointAt( wx, wy );
|
||||
|
@ -584,7 +584,7 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
{
|
||||
pointedAt_point = p->m_point;
|
||||
}
|
||||
|
||||
|
||||
if (pointedAt_point != last_pointedAt_point)
|
||||
{
|
||||
if (pointedAt_point != NULL)
|
||||
|
@ -600,9 +600,9 @@ void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
|
|||
// oh yeah, we need to set the status bar just for fun
|
||||
if (hasStatusBar)
|
||||
{
|
||||
m_frame->SetStatusText(
|
||||
m_frame->SetStatusText(
|
||||
wxString::Format( _T("%5d %5d"), (int)wx, (int)wy ), 0 );
|
||||
if (pointedAt_point == NULL ||
|
||||
if (pointedAt_point == NULL ||
|
||||
(newcommand != NULL && !newcommand->initialized) )
|
||||
m_frame->SetStatusText( _T(""), 1 );
|
||||
else
|
||||
|
@ -621,9 +621,9 @@ void ASSDrawCanvas::OnMouseLeftUp(wxMouseEvent& event)
|
|||
void ASSDrawCanvas::ProcessOnMouseLeftUp()
|
||||
{
|
||||
if (!capturemouse_left) return;
|
||||
|
||||
|
||||
// draw mode
|
||||
if (newcommand != NULL)
|
||||
if (newcommand != NULL)
|
||||
{
|
||||
newcommand->Init();
|
||||
switch (newcommand->type)
|
||||
|
@ -668,8 +668,8 @@ void ASSDrawCanvas::ProcessOnMouseLeftUp()
|
|||
else
|
||||
{
|
||||
RefreshDisplay(); // redraw before showing the error box
|
||||
wxMessageDialog msgb(m_frame,
|
||||
_T("You must delete that command/point last"),
|
||||
wxMessageDialog msgb(m_frame,
|
||||
_T("You must delete that command/point last"),
|
||||
_T("Error"), wxOK | wxICON_EXCLAMATION );
|
||||
msgb.ShowModal();
|
||||
}
|
||||
|
@ -678,11 +678,11 @@ void ASSDrawCanvas::ProcessOnMouseLeftUp()
|
|||
{
|
||||
if (lastDrag_left && dragAnchor_left != lastDrag_left)
|
||||
delete lastDrag_left;
|
||||
delete dragAnchor_left;
|
||||
delete dragAnchor_left;
|
||||
lastDrag_left = NULL;
|
||||
dragAnchor_left = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (dragOrigin)
|
||||
{
|
||||
dragOrigin = false;
|
||||
|
@ -705,7 +705,7 @@ void ASSDrawCanvas::ProcessOnMouseLeftUp()
|
|||
if (HasCapture())
|
||||
ReleaseMouse();
|
||||
capturemouse_left = false;
|
||||
|
||||
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ void ASSDrawCanvas::OnMouseLeftDown(wxMouseEvent& event)
|
|||
// wxPoint to Point
|
||||
int px, py;
|
||||
pointsys->FromWxPoint(q, px, py);
|
||||
|
||||
|
||||
// create new cmd if in draw mode / or delete point if del tool selected
|
||||
switch (draw_mode)
|
||||
{
|
||||
|
@ -748,11 +748,11 @@ void ASSDrawCanvas::OnMouseLeftDown(wxMouseEvent& event)
|
|||
delete newcommand;
|
||||
newcommand = NULL;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// first set to drag the new command no matter what
|
||||
mousedownAt_point = newcommand->m_point;
|
||||
|
||||
|
||||
// if user drags from existing point, insert the new command
|
||||
// else append the new command
|
||||
if (pointedAt_point != NULL)
|
||||
|
@ -765,10 +765,10 @@ void ASSDrawCanvas::OnMouseLeftDown(wxMouseEvent& event)
|
|||
}
|
||||
|
||||
pointedAt_point = mousedownAt_point;
|
||||
|
||||
|
||||
//highlight it
|
||||
SetHighlighted( newcommand, newcommand->m_point );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we already calculated pointedAt_point in OnMouseMove() so just use it
|
||||
|
@ -802,7 +802,7 @@ void ASSDrawCanvas::OnMouseLeftDown(wxMouseEvent& event)
|
|||
|
||||
if (InitiateDraggingIfTransformMode())
|
||||
backupowner = LEFT;
|
||||
|
||||
|
||||
CaptureMouse();
|
||||
capturemouse_left = true;
|
||||
RefreshDisplay();
|
||||
|
@ -882,7 +882,7 @@ void ASSDrawCanvas::OnMouseRightDClick(wxMouseEvent& event)
|
|||
f.SetWeight(wxFONTWEIGHT_BOLD);
|
||||
cmdmenuitem->SetFont(f);
|
||||
#endif
|
||||
menu->Append(cmdmenuitem);
|
||||
menu->Append(cmdmenuitem);
|
||||
menu->Enable(MENU_DUMMY, false);
|
||||
switch (dblclicked_point_right->cmd_main->type)
|
||||
{
|
||||
|
@ -944,9 +944,9 @@ void ASSDrawCanvas::UpdateTranformModeRectCenter()
|
|||
double cx, cy;
|
||||
if (agg::calc_intersection(rectbound2[0].x, rectbound2[0].y, rectbound2[2].x, rectbound2[2].y,
|
||||
rectbound2[1].x, rectbound2[1].y, rectbound2[3].x, rectbound2[3].y, &cx, &cy))
|
||||
{
|
||||
rectcenter = wxRealPoint(cx, cy);
|
||||
}
|
||||
{
|
||||
rectcenter = wxRealPoint(cx, cy);
|
||||
}
|
||||
}
|
||||
|
||||
bool ASSDrawCanvas::GetThe4thPoint(double ox, double oy, double a1x, double a1y, double a2x, double a2y, double *x, double *y)
|
||||
|
@ -959,7 +959,7 @@ bool ASSDrawCanvas::GetThe4thPoint(double ox, double oy, double a1x, double a1y,
|
|||
a1x + a2x - ox,
|
||||
a1y + a2y - oy,
|
||||
x, y); //*/
|
||||
|
||||
|
||||
*x = a1x + a2x - ox;
|
||||
*y = a1y + a2y - oy;
|
||||
return true;
|
||||
|
@ -991,7 +991,7 @@ void ASSDrawCanvas::ChangeZoomLevel( double amount, wxPoint bgzoomctr )
|
|||
|
||||
case DRAG_BOTH:
|
||||
ChangeDrawingZoomLevel( amount );
|
||||
ChangeBackgroundZoomLevel(bgimg.scale * pointsys->scale / old_scale,
|
||||
ChangeBackgroundZoomLevel(bgimg.scale * pointsys->scale / old_scale,
|
||||
wxRealPoint(pointsys->originx, pointsys->originy));
|
||||
break;
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ void ASSDrawCanvas::ChangeZoomLevel( double amount, wxPoint bgzoomctr )
|
|||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (CanZoom() && drag_mode.drawing)
|
||||
ChangeDrawingZoomLevel( amount );
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ void ASSDrawCanvas::ChangeZoomLevel( double amount, wxPoint bgzoomctr )
|
|||
ChangeBackgroundZoomLevel(bgimg.scale * pointsys->scale / old_scale, wxRealPoint(pointsys->originx, pointsys->originy));
|
||||
else
|
||||
ChangeBackgroundZoomLevel(bgimg.scale + amount / 10.0, wxRealPoint(bgzoomctr.x, bgzoomctr.y));
|
||||
|
||||
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ void ASSDrawCanvas::ChangeDrawingZoomLevel( double scrollamount )
|
|||
if (zoom < 1.0) zoom = 1.0;
|
||||
pointsys->scale = zoom;
|
||||
}
|
||||
|
||||
|
||||
m_frame->UpdateFrameUI();
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ void ASSDrawCanvas::ChangeBackgroundZoomLevel(double zoom, wxRealPoint newcenter
|
|||
bgimg.new_scale = zoom;
|
||||
bgimg.new_center = newcenter;
|
||||
if (bgimg.new_scale < 0.01) bgimg.new_scale = 0.01;
|
||||
UpdateBackgroundImgScalePosition();
|
||||
UpdateBackgroundImgScalePosition();
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::MoveCanvasOriginTo(double originx, double originy)
|
||||
|
@ -1057,7 +1057,7 @@ void ASSDrawCanvas::MoveCanvasDrawing(double xamount, double yamount)
|
|||
{
|
||||
if (!CanMove()) return;
|
||||
pointsys->originx += xamount;
|
||||
pointsys->originy += yamount;
|
||||
pointsys->originy += yamount;
|
||||
if (IsTransformMode())
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -1082,14 +1082,14 @@ void ASSDrawCanvas::MoveCanvasBackground(double xamount, double yamount)
|
|||
//bgimg.new_center.x += xamount, bgimg.new_center.y += yamount;
|
||||
bgimg.new_disp.x += xamount;
|
||||
bgimg.new_disp.y += yamount;
|
||||
UpdateBackgroundImgScalePosition();
|
||||
UpdateBackgroundImgScalePosition();
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::OnSelect_ConvertLineToBezier(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (!dblclicked_point_right) return;
|
||||
AddUndo( _T("Convert Line to Bezier") );
|
||||
DrawCmd_B *newB = new DrawCmd_B(dblclicked_point_right->x(), dblclicked_point_right->y(),
|
||||
DrawCmd_B *newB = new DrawCmd_B(dblclicked_point_right->x(), dblclicked_point_right->y(),
|
||||
pointsys, dblclicked_point_right->cmd_main);
|
||||
InsertCmd ( newB, dblclicked_point_right->cmd_main );
|
||||
ClearPointsSelection();
|
||||
|
@ -1168,7 +1168,7 @@ void ASSDrawCanvas::EnforceC1Continuity (DrawCmd* cmd, Point* pnt)
|
|||
{
|
||||
DrawCmd_B *thisb = static_cast< DrawCmd_B* >(cmd);
|
||||
if (!thisb->C1Cont) return;
|
||||
theotherpoint = *(cmd->m_point->cmd_next->controlpoints.begin());
|
||||
theotherpoint = *(cmd->m_point->cmd_next->controlpoints.begin());
|
||||
mainpoint = thisb->m_point;
|
||||
}
|
||||
else
|
||||
|
@ -1178,7 +1178,7 @@ void ASSDrawCanvas::EnforceC1Continuity (DrawCmd* cmd, Point* pnt)
|
|||
}
|
||||
|
||||
// Undo/Redo system
|
||||
void ASSDrawCanvas::AddUndo( wxString desc )
|
||||
void ASSDrawCanvas::AddUndo( wxString desc )
|
||||
{
|
||||
PrepareUndoRedo(_undo, false, _T(""), desc);
|
||||
undos.push_back( _undo );
|
||||
|
@ -1198,7 +1198,7 @@ bool ASSDrawCanvas::UndoOrRedo(bool isundo)
|
|||
UndoRedo r = main->back();
|
||||
// push into sub
|
||||
UndoRedo nr(r);
|
||||
PrepareUndoRedo(nr, true, GenerateASS(), r.desc);
|
||||
PrepareUndoRedo(nr, true, GenerateASS(), r.desc);
|
||||
//PrepareUndoRedo(nr, false, _T(""), r.desc);
|
||||
sub->push_back( nr );
|
||||
// parse
|
||||
|
@ -1249,10 +1249,10 @@ void ASSDrawCanvas::RefreshUndocmds()
|
|||
_undo.Import(this, true, GenerateASS());
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::PrepareUndoRedo(UndoRedo& ur, bool prestage, wxString cmds, wxString desc)
|
||||
void ASSDrawCanvas::PrepareUndoRedo(UndoRedo& ur, bool prestage, wxString cmds, wxString desc)
|
||||
{
|
||||
ur.Import(this, prestage, cmds);
|
||||
ur.desc = desc;
|
||||
ur.desc = desc;
|
||||
}
|
||||
|
||||
// set command and point to highlight
|
||||
|
@ -1290,7 +1290,7 @@ int ASSDrawCanvas::SelectPointsWithin( int lx, int rx, int ty, int by, SELECTMOD
|
|||
(*pnt_iterator)->isselected = (smode != DEL);
|
||||
else
|
||||
(*pnt_iterator)->isselected &= (smode != NEW);
|
||||
|
||||
|
||||
if ((*pnt_iterator)->isselected)
|
||||
selected_points.insert(*pnt_iterator);
|
||||
else
|
||||
|
@ -1331,7 +1331,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
int ww, hh; GetClientSize(&ww, &hh);
|
||||
|
||||
if (bgimg.bgbmp)
|
||||
{
|
||||
{
|
||||
rasterizer.reset();
|
||||
interpolator_type interpolator(bgimg.img_mtx);
|
||||
PixelFormat::AGGType ipixfmt(bgimg.ibuf);
|
||||
|
@ -1344,7 +1344,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
}
|
||||
|
||||
ASSDrawEngine::Draw_Draw( rbase, rprim, rsolid, mtx, preview_mode? rgba_shape:rgba_shape_normal );
|
||||
|
||||
|
||||
if (!preview_mode)
|
||||
{
|
||||
// [0, 0]
|
||||
|
@ -1395,14 +1395,14 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rasterizer.add_path(chstroke);
|
||||
if (rectbound2upd != -1)
|
||||
{
|
||||
agg::ellipse circ(rectbound2[rectbound2upd].x, rectbound2[rectbound2upd].y,
|
||||
agg::ellipse circ(rectbound2[rectbound2upd].x, rectbound2[rectbound2upd].y,
|
||||
pointsys->scale, pointsys->scale);
|
||||
agg::conv_contour< agg::ellipse > c(circ);
|
||||
rasterizer.add_path(c);
|
||||
}
|
||||
if (rectbound2upd2 != -1)
|
||||
{
|
||||
agg::ellipse circ(rectbound2[rectbound2upd2].x, rectbound2[rectbound2upd2].y,
|
||||
agg::ellipse circ(rectbound2[rectbound2upd2].x, rectbound2[rectbound2upd2].y,
|
||||
pointsys->scale, pointsys->scale);
|
||||
agg::conv_contour< agg::ellipse > c(circ);
|
||||
rasterizer.add_path(c);
|
||||
|
@ -1417,13 +1417,13 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rsolid.color(rgba_guideline);
|
||||
rasterizer.add_path(bguidestroke);
|
||||
render_scanlines(rsolid);
|
||||
|
||||
|
||||
agg::conv_stroke< agg::conv_curve< agg::conv_transform< agg::path_storage > > > stroke(*rm_curve);
|
||||
stroke.width(1);
|
||||
rsolid.color(rgba_outline);
|
||||
rasterizer.add_path(stroke);
|
||||
render_scanlines(rsolid);
|
||||
|
||||
|
||||
double diameter = pointsys->scale;
|
||||
double radius = diameter / 2.0;
|
||||
// hilite
|
||||
|
@ -1442,7 +1442,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rasterizer.add_path(stroke);
|
||||
render_scanlines(rsolid);
|
||||
}
|
||||
|
||||
|
||||
// m_point
|
||||
rasterizer.reset();
|
||||
DrawCmdList::iterator ci = cmds.begin();
|
||||
|
@ -1456,7 +1456,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
ci++;
|
||||
}
|
||||
render_scanlines_aa_solid(rbase, rgba_mainpoint);
|
||||
|
||||
|
||||
// control_points
|
||||
rasterizer.reset();
|
||||
ci = cmds.begin();
|
||||
|
@ -1465,7 +1465,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
PointList::iterator pi = (*ci)->controlpoints.begin();
|
||||
while (pi != (*ci)->controlpoints.end())
|
||||
{
|
||||
agg::ellipse circ((*pi)->x() * pointsys->scale + pointsys->originx,
|
||||
agg::ellipse circ((*pi)->x() * pointsys->scale + pointsys->originx,
|
||||
(*pi)->y() * pointsys->scale + pointsys->originy, radius, radius);
|
||||
agg::conv_contour< agg::ellipse > c(circ);
|
||||
rasterizer.add_path(c);
|
||||
|
@ -1474,31 +1474,31 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
ci++;
|
||||
}
|
||||
render_scanlines_aa_solid(rbase, rgba_controlpoint);
|
||||
|
||||
|
||||
// selection
|
||||
rasterizer.reset();
|
||||
PointSet::iterator si = selected_points.begin();
|
||||
while (si != selected_points.end())
|
||||
{
|
||||
agg::ellipse circ((*si)->x() * pointsys->scale + pointsys->originx,
|
||||
agg::ellipse circ((*si)->x() * pointsys->scale + pointsys->originx,
|
||||
(*si)->y() * pointsys->scale + pointsys->originy, radius + 3, radius + 3);
|
||||
agg::conv_stroke< agg::ellipse > s(circ);
|
||||
rasterizer.add_path(s);
|
||||
si++;
|
||||
}
|
||||
render_scanlines_aa_solid(rbase, rgba_selectpoint);
|
||||
|
||||
|
||||
// hover
|
||||
if (hilite_point)
|
||||
{
|
||||
rasterizer.reset();
|
||||
agg::ellipse circ(hilite_point->x() * pointsys->scale + pointsys->originx,
|
||||
agg::ellipse circ(hilite_point->x() * pointsys->scale + pointsys->originx,
|
||||
hilite_point->y() * pointsys->scale + pointsys->originy, radius + 3, radius + 3);
|
||||
agg::conv_stroke< agg::ellipse > s(circ);
|
||||
s.width(2);
|
||||
rasterizer.add_path(s);
|
||||
render_scanlines_aa_solid(rbase, rgba_selectpoint);
|
||||
|
||||
|
||||
rasterizer.reset();
|
||||
agg::gsv_text t;
|
||||
t.flip(true);
|
||||
|
@ -1513,7 +1513,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rasterizer.add_path(pt);
|
||||
rsolid.color(agg::rgba(0,0,0));
|
||||
render_scanlines(rsolid, false);
|
||||
|
||||
|
||||
rasterizer.reset();
|
||||
agg::path_storage sb_path;
|
||||
sb_path.move_to(pxy.x, 0);
|
||||
|
@ -1529,7 +1529,7 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rasterizer.add_path(stroke);
|
||||
render_scanlines(rsolid);
|
||||
}
|
||||
|
||||
|
||||
// selection box
|
||||
if (lastDrag_left)
|
||||
{
|
||||
|
@ -1551,9 +1551,9 @@ void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, Rend
|
|||
rasterizer.add_path(stroke);
|
||||
render_scanlines(rsolid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ruler
|
||||
int w, h;
|
||||
GetClientSize( &w, &h );
|
||||
|
@ -1688,7 +1688,7 @@ void ASSDrawCanvas::AskUserForBackgroundAlpha()
|
|||
bgimg.alpha_dlg->Show();
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void ASSDrawCanvas::PrepareBackgroundBitmap(double alpha)
|
||||
{
|
||||
if (alpha >= 0.0 && alpha <= 1.0) bgimg.alpha = alpha;
|
||||
|
@ -1701,7 +1701,7 @@ void ASSDrawCanvas::PrepareBackgroundBitmap(double alpha)
|
|||
if (stride < 0)
|
||||
pd += (data.GetHeight() - 1) * stride;
|
||||
bgimg.ibuf.attach(pd, data.GetWidth(), data.GetHeight(), stride);
|
||||
|
||||
|
||||
// apply alpha
|
||||
rasterizer.reset();
|
||||
unsigned w = bgimg.bgbmp->GetWidth(), h = bgimg.bgbmp->GetHeight();
|
||||
|
@ -1791,7 +1791,7 @@ void ASSDrawCanvas::UpdateNonUniformTransformation()
|
|||
agg::path_storage trans;
|
||||
unsigned vertices = backupcmds.total_vertices();
|
||||
double x, y;
|
||||
|
||||
|
||||
//if (draw_mode == MODE_NUT_BILINEAR)
|
||||
//{
|
||||
agg::trans_bilinear trans_b(rectbound[0].x, rectbound[0].y, rectbound[2].x, rectbound[2].y, bound);
|
||||
|
@ -1833,14 +1833,14 @@ void ASSDrawCanvas::UpdateNonUniformTransformation()
|
|||
pointsys->FromWxPoint ( wxPoint((int)x, (int)y), wx, wy );
|
||||
(*iterate)->m_point->setXY(wx, wy);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ASSDrawCanvas::CustomOnKeyDown(wxKeyEvent &event)
|
||||
{
|
||||
int keycode = event.GetKeyCode();
|
||||
//m_frame->SetStatusText(wxString::Format(_T("Key: %d"), keycode));
|
||||
double scrollamount = (event.GetModifiers() == wxMOD_CMD? 10.0:1.0);
|
||||
double scrollamount = (event.GetModifiers() == wxMOD_CMD? 10.0:1.0);
|
||||
if (event.GetModifiers() == wxMOD_SHIFT)
|
||||
{
|
||||
MODE d_mode = GetDrawMode();
|
||||
|
@ -1874,7 +1874,7 @@ void ASSDrawCanvas::CustomOnKeyDown(wxKeyEvent &event)
|
|||
case WXK_LEFT:
|
||||
MoveCanvas(-scrollamount, 0.0);
|
||||
RefreshDisplay();
|
||||
break;
|
||||
break;
|
||||
case WXK_RIGHT:
|
||||
MoveCanvas(scrollamount, 0.0);
|
||||
RefreshDisplay();
|
||||
|
@ -1905,8 +1905,8 @@ void ASSDrawCanvas::CustomOnKeyDown(wxKeyEvent &event)
|
|||
{
|
||||
nearest = (*it2);
|
||||
dist = distance;
|
||||
}
|
||||
it2++;
|
||||
}
|
||||
it2++;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ void UndoRedo::Import(ASSDrawCanvas *canvas, bool prestage, wxString cmds)
|
|||
this->originx = canvas->pointsys->originx;
|
||||
this->originy = canvas->pointsys->originy;
|
||||
this->scale = canvas->pointsys->scale;
|
||||
|
||||
|
||||
this->bgimgfile = canvas->bgimg.bgimgfile;
|
||||
this->bgdisp = canvas->bgimg.disp;
|
||||
this->bgcenter = canvas->bgimg.center;
|
||||
|
@ -2038,8 +2038,8 @@ void UndoRedo::Export(ASSDrawCanvas *canvas)
|
|||
canvas->bgimg.new_disp = this->bgdisp;
|
||||
canvas->bgimg.alpha = this->bgalpha;
|
||||
canvas->UpdateBackgroundImgScalePosition();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//canvas->SetDrawMode(this->draw_mode);
|
||||
canvas->draw_mode = this->draw_mode;
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// constructor
|
||||
DrawCmd_M::DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
DrawCmd_M::DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
{
|
||||
type = M;
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ wxString DrawCmd_M::ToString()
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// constructor
|
||||
DrawCmd_L::DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
DrawCmd_L::DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
{
|
||||
type = L;
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ wxString DrawCmd_L::ToString()
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// constructor
|
||||
DrawCmd_B::DrawCmd_B
|
||||
( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
DrawCmd_B::DrawCmd_B
|
||||
( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
{
|
||||
type = B;
|
||||
controlpoints.push_back( new Point(x1, y1, ps, CP, this, 1) );
|
||||
|
@ -90,8 +90,8 @@ DrawCmd_B::DrawCmd_B
|
|||
}
|
||||
|
||||
// constructor
|
||||
DrawCmd_B::DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
DrawCmd_B::DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev )
|
||||
: DrawCmd ( x, y, ps, prev )
|
||||
{
|
||||
type = B;
|
||||
initialized = false;
|
||||
|
@ -106,8 +106,8 @@ void DrawCmd_B::Init ( unsigned n )
|
|||
|
||||
wxPoint wx0 = prev->m_point->ToWxPoint();
|
||||
wxPoint wx1 = m_point->ToWxPoint();
|
||||
int xdiff = (wx1.x - wx0.x) / 3;
|
||||
int ydiff = (wx1.y - wx0.y) / 3;
|
||||
int xdiff = (wx1.x - wx0.x) / 3;
|
||||
int ydiff = (wx1.y - wx0.y) / 3;
|
||||
int xg, yg;
|
||||
|
||||
// first control
|
||||
|
@ -119,7 +119,7 @@ void DrawCmd_B::Init ( unsigned n )
|
|||
controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 2 ) );
|
||||
|
||||
initialized = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// to ASS drawing command
|
||||
|
@ -203,7 +203,7 @@ wxString DrawCmd_S::ToString()
|
|||
for (; iterate != controlpoints.end(); iterate++)
|
||||
{
|
||||
if (initialized)
|
||||
assout = wxString::Format(_T("%s %d %d"), assout.c_str(), (*iterate)->x(), (*iterate)->y());
|
||||
assout = wxString::Format(_T("%s %d %d"), assout.c_str(), (*iterate)->x(), (*iterate)->y());
|
||||
else
|
||||
assout = wxString::Format(_T("%s ? ?"), assout.c_str());
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ void ASSDrawSrcTxtCtrl::CustomOnChar(wxKeyEvent &event)
|
|||
//m_frame->SetTitle(wxString::Format(_T("Key: %d"), event.GetKeyCode()));
|
||||
event.Skip(true);
|
||||
}
|
||||
|
||||
|
||||
//SetBackgroundColour(IsModified()? wxColour(0xFF, 0xFF, 0x99):*wxWHITE);
|
||||
}
|
||||
|
||||
|
@ -257,13 +257,13 @@ Control points for Bezier curves are generated once you release the mouse button
|
|||
</ul> \
|
||||
<p>ai-chan recommends Aegisub for all your subtitle and typesetting needs! \
|
||||
</body></html>")
|
||||
);
|
||||
);
|
||||
htmlwin->Connect(wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler(ASSDrawAboutDlg::OnURL), NULL, this);
|
||||
|
||||
|
||||
wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
|
||||
sizer->AddGrowableCol(0);
|
||||
//sizer->AddGrowableRow(1);
|
||||
|
||||
|
||||
sizer->Add(new BigStaticBitmapCtrl(this, wxBITMAP(assdraw3_), *wxWHITE, this), 1, wxEXPAND);
|
||||
sizer->Add(htmlwin, 1, wxLEFT | wxRIGHT, 2);
|
||||
sizer->Add(new wxStaticText(this, wxID_ANY, wxString::Format(_T("Version: %s"), VERSION)), 1, wxEXPAND | wxALL, 2);
|
||||
|
@ -271,10 +271,10 @@ Control points for Bezier curves are generated once you release the mouse button
|
|||
SetSizer(sizer);
|
||||
sizer->Layout();
|
||||
sizer->Fit(this);
|
||||
|
||||
|
||||
Center();
|
||||
//if (CanSetTransparent()) SetTransparent(0xCC);
|
||||
|
||||
|
||||
timer.SetOwner(this);
|
||||
Connect(wxEVT_TIMER, wxTimerEventHandler(ASSDrawAboutDlg::OnTimeout));
|
||||
Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(ASSDrawAboutDlg::OnMouseEnterWindow));
|
||||
|
@ -282,7 +282,7 @@ Control points for Bezier curves are generated once you release the mouse button
|
|||
|
||||
ASSDrawAboutDlg::~ASSDrawAboutDlg()
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
int ASSDrawAboutDlg::ShowModal()
|
||||
|
@ -311,7 +311,7 @@ void ASSDrawAboutDlg::OnMouseEnterWindow(wxMouseEvent& event)
|
|||
{
|
||||
// if mouse enters this dialog, stop the timout timer
|
||||
// and dialog will only close through user input
|
||||
timer.Stop();
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(BigStaticBitmapCtrl, wxPanel)
|
||||
|
@ -332,7 +332,7 @@ BigStaticBitmapCtrl::BigStaticBitmapCtrl(wxWindow *parent, wxBitmap bmap, wxColo
|
|||
}
|
||||
|
||||
BigStaticBitmapCtrl::~BigStaticBitmapCtrl()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
void BigStaticBitmapCtrl::OnPaint(wxPaintEvent& event)
|
||||
|
@ -354,7 +354,7 @@ void BigStaticBitmapCtrl::OnMouseLeftDown(wxMouseEvent &event)
|
|||
|
||||
void BigStaticBitmapCtrl::OnMouseLeftUp(wxMouseEvent &event)
|
||||
{
|
||||
ReleaseMouse();
|
||||
ReleaseMouse();
|
||||
}
|
||||
|
||||
void BigStaticBitmapCtrl::OnMouseMove(wxMouseEvent &event)
|
||||
|
|
|
@ -40,24 +40,24 @@
|
|||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Point
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// constructor
|
||||
Point::Point ( int _x, int _y, PointSystem* ps, POINTTYPE t, DrawCmd* cmd, unsigned n )
|
||||
Point::Point ( int _x, int _y, PointSystem* ps, POINTTYPE t, DrawCmd* cmd, unsigned n )
|
||||
{
|
||||
x_ = _x;
|
||||
y_ = _y;
|
||||
pointsys = ps;
|
||||
cmd_main = cmd;
|
||||
cmd_next = NULL;
|
||||
cmd_main = cmd;
|
||||
cmd_next = NULL;
|
||||
type = t;
|
||||
isselected = false;
|
||||
num = n;
|
||||
}
|
||||
}
|
||||
|
||||
// setters
|
||||
void Point::setXY( int _x, int _y)
|
||||
|
@ -67,11 +67,11 @@ void Point::setXY( int _x, int _y)
|
|||
}
|
||||
|
||||
// simply returns true if px and py are the coordinate values
|
||||
bool Point::IsAt( int px, int py )
|
||||
bool Point::IsAt( int px, int py )
|
||||
{
|
||||
return (x_ == px && y_ == py );
|
||||
}
|
||||
|
||||
|
||||
// convert this point to wxPoint using scale and originx, originy
|
||||
wxPoint Point::ToWxPoint ( bool useorigin )
|
||||
{
|
||||
|
@ -80,9 +80,9 @@ wxPoint Point::ToWxPoint ( bool useorigin )
|
|||
else
|
||||
return *(new wxPoint(x_ * (int) pointsys->scale, y_ * (int) pointsys->scale ));
|
||||
}
|
||||
|
||||
|
||||
// check if wxpoint is nearby this point
|
||||
bool Point::CheckWxPoint ( wxPoint wxpoint )
|
||||
bool Point::CheckWxPoint ( wxPoint wxpoint )
|
||||
{
|
||||
wxPoint p = ToWxPoint();
|
||||
int cx, cy;
|
||||
|
@ -90,7 +90,7 @@ bool Point::CheckWxPoint ( wxPoint wxpoint )
|
|||
//delete &p;
|
||||
return (x_ == cx && y_ == cy );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -98,14 +98,14 @@ bool Point::CheckWxPoint ( wxPoint wxpoint )
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// constructor
|
||||
DrawCmd::DrawCmd ( int x, int y, PointSystem *ps, DrawCmd *pv )
|
||||
{
|
||||
DrawCmd::DrawCmd ( int x, int y, PointSystem *ps, DrawCmd *pv )
|
||||
{
|
||||
m_point = new Point ( x, y, ps, MP, this );
|
||||
m_point->cmd_main = this;
|
||||
prev = pv;
|
||||
dobreak = false;
|
||||
invisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// destructor
|
||||
DrawCmd::~DrawCmd ( )
|
||||
|
@ -115,7 +115,7 @@ DrawCmd::~DrawCmd ( )
|
|||
for (PointList::iterator iter_cpoint = controlpoints.begin();
|
||||
iter_cpoint != controlpoints.end(); iter_cpoint++)
|
||||
delete (*iter_cpoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -163,22 +163,22 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
std::vector<int> val;
|
||||
wxString token;
|
||||
long tmp_int;
|
||||
|
||||
|
||||
bool n_collected = false;
|
||||
DrawCmd_S *s_command = NULL;
|
||||
wxPoint tmp_n_pnt;
|
||||
|
||||
|
||||
while ( tkz.HasMoreTokens() )
|
||||
{
|
||||
token = tkz.GetNextToken();
|
||||
|
||||
|
||||
if ( drawcmdset.Find(token) > -1 )
|
||||
{
|
||||
bool done;
|
||||
|
||||
|
||||
do {
|
||||
done = true;
|
||||
|
||||
|
||||
// N
|
||||
if (currcmd.IsSameAs(_T("n")) && val.size() >= 2)
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
AppendCmd ( L, tmp_n_pnt.x, tmp_n_pnt.y );
|
||||
n_collected = false;
|
||||
}
|
||||
|
||||
|
||||
if (s_command != NULL)
|
||||
{
|
||||
bool ends = true;
|
||||
|
@ -208,14 +208,14 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
if (ends)
|
||||
{
|
||||
AppendCmd(s_command);
|
||||
s_command = NULL;
|
||||
s_command = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// M
|
||||
if (currcmd.IsSameAs(_T("m")) && val.size() >= 2)
|
||||
AppendCmd ( M, val[0], val[1] );
|
||||
|
||||
|
||||
// L
|
||||
if (currcmd.IsSameAs(_T("l")) && val.size() >= 2)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
if (val.size() >= 2)
|
||||
done = false;
|
||||
}
|
||||
|
||||
|
||||
// B
|
||||
if (currcmd.IsSameAs(_T("b")) && val.size() >= 6)
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
if (val.size() >= 6)
|
||||
done = false;
|
||||
}
|
||||
|
||||
|
||||
// S
|
||||
if (currcmd.IsSameAs(_T("s")) && val.size() >= 6)
|
||||
{
|
||||
|
@ -250,16 +250,16 @@ int ASSDrawEngine::ParseASS ( wxString str )
|
|||
}
|
||||
// more to come later
|
||||
} while (!done);
|
||||
|
||||
|
||||
val.clear();
|
||||
currcmd = token;
|
||||
}
|
||||
else if (token.ToLong( &tmp_int ))
|
||||
{
|
||||
val.push_back( (int) tmp_int );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (int) cmds.size();
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ void ASSDrawEngine::MovePoints ( int x, int y )
|
|||
for (; iterate != cmds.end(); iterate++)
|
||||
{
|
||||
(*iterate)->m_point->setXY( (*iterate)->m_point->x() + x, (*iterate)->m_point->y() + y );
|
||||
for (iterate2 = (*iterate)->controlpoints.begin();
|
||||
for (iterate2 = (*iterate)->controlpoints.begin();
|
||||
iterate2 != (*iterate)->controlpoints.end(); iterate2++)
|
||||
{
|
||||
(*iterate2)->setXY( (*iterate2)->x() + x, (*iterate2)->y() + y );
|
||||
|
@ -487,13 +487,13 @@ DrawCmd* ASSDrawEngine::ControlAt ( int x, int y, Point* &point )
|
|||
// attempts to delete a commmand, returns true|false if successful|fail
|
||||
bool ASSDrawEngine::DeleteCommand ( DrawCmd* cmd )
|
||||
{
|
||||
|
||||
|
||||
DrawCmdList::iterator iterate = cmds.begin();
|
||||
// can't delete the first command without deleting other commands first
|
||||
if ( cmd == (*iterate) && cmds.size() > 1) return false;
|
||||
|
||||
|
||||
DrawCmd* lastiter = NULL;
|
||||
|
||||
|
||||
for (; iterate != cmds.end(); iterate++)
|
||||
{
|
||||
if ( cmd == (*iterate) )
|
||||
|
@ -509,7 +509,7 @@ bool ASSDrawEngine::DeleteCommand ( DrawCmd* cmd )
|
|||
else
|
||||
lastiter = (*iterate);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -521,14 +521,14 @@ void ASSDrawEngine::ConnectSubsequentCmds (DrawCmd* cmd1, DrawCmd* cmd2)
|
|||
{
|
||||
cmd1->m_point->cmd_next = cmd2;
|
||||
}
|
||||
|
||||
|
||||
if (cmd2 != NULL)
|
||||
{
|
||||
cmd2->prev = cmd1;
|
||||
}
|
||||
}
|
||||
|
||||
void ASSDrawEngine::RefreshDisplay()
|
||||
void ASSDrawEngine::RefreshDisplay()
|
||||
{
|
||||
if (!refresh_called)
|
||||
{
|
||||
|
@ -552,7 +552,7 @@ void ASSDrawEngine::OnPaint(wxPaintEvent& event)
|
|||
void ASSDrawEngine::draw()
|
||||
{
|
||||
refresh_called = false;
|
||||
|
||||
|
||||
PixelFormat::AGGType pixf(rBuf);
|
||||
RendererBase rbase(pixf);
|
||||
RendererPrimitives rprim(rbase);
|
||||
|
@ -564,11 +564,11 @@ void ASSDrawEngine::draw()
|
|||
rasterizer.reset();
|
||||
update_rendered_bound_coords(true);
|
||||
DoDraw(rbase, rprim, rsolid, mtx);
|
||||
|
||||
|
||||
delete rm_path, rb_path, rm_curve;
|
||||
}
|
||||
|
||||
void ASSDrawEngine::ConstructPathsAndCurves(agg::trans_affine& mtx,
|
||||
void ASSDrawEngine::ConstructPathsAndCurves(agg::trans_affine& mtx,
|
||||
trans_path*& _rm_path, trans_path*& _rb_path, agg::conv_curve<trans_path>*& _rm_curve)
|
||||
{
|
||||
mtx *= agg::trans_affine_scaling(pointsys->scale);
|
||||
|
@ -639,7 +639,7 @@ void ASSDrawEngine::AddDrawCmdToAGGPathStorage(DrawCmd* cmd, agg::path_storage&
|
|||
else
|
||||
path.line_to(cmd->m_point->x(),cmd->m_point->y());
|
||||
break;
|
||||
|
||||
|
||||
case S:
|
||||
unsigned np = cmd->controlpoints.size();
|
||||
agg::pod_array<double> m_polygon(np * 2);
|
||||
|
@ -663,9 +663,9 @@ void ASSDrawEngine::AddDrawCmdToAGGPathStorage(DrawCmd* cmd, agg::path_storage&
|
|||
_pn += 2;
|
||||
}
|
||||
path.line_to(cmd->m_point->x(), cmd->m_point->y());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//path.line_to((int) m_polygon[0],(int) m_polygon[1]);
|
||||
aggpolygon poly(&m_polygon[0], np, false, false);
|
||||
agg::conv_bcspline<agg::simple_polygon_vertex_source> bspline(poly);
|
||||
|
@ -678,7 +678,7 @@ void ASSDrawEngine::AddDrawCmdToAGGPathStorage(DrawCmd* cmd, agg::path_storage&
|
|||
path.line_to(cmd->m_point->x(), cmd->m_point->y());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -51,11 +51,11 @@ void ASSDrawShapePreview::OnSize(wxSizeEvent& event)
|
|||
{
|
||||
return;
|
||||
wxSize siz = event.GetSize();
|
||||
|
||||
|
||||
if (shapelib->layout == HORIZONTAL)
|
||||
SetSize(siz.x, siz.x);
|
||||
else
|
||||
SetSize(siz.y, siz.y);
|
||||
SetSize(siz.y, siz.y);
|
||||
SetFitToViewPointOnNextPaint(10, 10);
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,13 @@ BEGIN_EVENT_TABLE(ASSDrawShapeLibrary, wxScrolledWindow)
|
|||
EVT_TOOL(TOOL_DELETE, ASSDrawShapeLibrary::DeleteChecked)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ASSDrawShapeLibrary::ASSDrawShapeLibrary( wxWindow *parent, ASSDrawFrame *frame )
|
||||
ASSDrawShapeLibrary::ASSDrawShapeLibrary( wxWindow *parent, ASSDrawFrame *frame )
|
||||
: wxScrolledWindow(parent, wxID_ANY)
|
||||
{
|
||||
m_frame = frame;
|
||||
//sizer = NULL;
|
||||
layout = VERTICAL;
|
||||
|
||||
|
||||
wxToolBar *tbar = new wxToolBar(this, wxID_ANY, __DPDS__ , wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT | wxTB_NODIVIDER);
|
||||
tbar->SetMargins(0, 3);
|
||||
tbar->AddTool(TOOL_SAVE, _T("Save canvas"), wxBITMAP(add));
|
||||
|
@ -105,7 +105,7 @@ void ASSDrawShapeLibrary::OnSize(wxSizeEvent& event)
|
|||
|
||||
wxSize siz = GetClientSize();
|
||||
libsizer->SetDimension(0, 0, siz.x, siz.y);
|
||||
|
||||
|
||||
UpdatePreviewDisplays();
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ void ASSDrawShapeLibrary::UpdatePreviewDisplays()
|
|||
node = node->GetNext();
|
||||
}
|
||||
sizer->Layout();
|
||||
sizer->FitInside(libarea);
|
||||
sizer->FitInside(libarea);
|
||||
libarea->Show(true);
|
||||
}
|
||||
|
||||
|
@ -209,12 +209,12 @@ void ASSDrawShapeLibrary::OnPopupMenuClicked(wxCommandEvent &event)
|
|||
|
||||
void ASSDrawShapeLibrary::SaveShapeFromCanvas(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
AddShapePreview(m_frame->m_canvas->GenerateASS(), true);
|
||||
AddShapePreview(m_frame->m_canvas->GenerateASS(), true);
|
||||
}
|
||||
|
||||
void ASSDrawShapeLibrary::CheckUncheckAllPreviews(wxCommandEvent &event)
|
||||
{
|
||||
bool checked = event.GetId() == TOOL_CHECK;
|
||||
bool checked = event.GetId() == TOOL_CHECK;
|
||||
wxwxSizerItemListNode *node = sizer->GetChildren().GetFirst();
|
||||
while (node != NULL)
|
||||
{
|
||||
|
@ -262,4 +262,4 @@ void ASSDrawShapeLibrary::LoadToCanvas(ASSDrawShapePreview *preview)
|
|||
m_frame->m_canvas->RefreshDisplay();
|
||||
m_frame->m_canvas->RefreshUndocmds();
|
||||
m_frame->UpdateFrameUI();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ ASSDrawSettingsDialog::ASSDrawSettingsDialog(wxWindow *parent, ASSDrawFrame *fra
|
|||
m_frame = frame;
|
||||
propgrid = NULL;
|
||||
}
|
||||
|
||||
|
||||
void ASSDrawSettingsDialog::Init()
|
||||
{
|
||||
propgrid = new wxPropertyGrid(this,
|
||||
|
@ -73,7 +73,7 @@ void ASSDrawSettingsDialog::Init()
|
|||
pgid = propgrid->Append(new wxBoolProperty (label, wxPG_LABEL, boolvar ) ); \
|
||||
propgrid->SetPropertyAttribute( pgid, wxPG_BOOL_USE_CHECKBOX, (long)1 );
|
||||
wxLongPropertyValidator validator(0x0,0xFF);
|
||||
|
||||
|
||||
propgrid->Append(new wxPropertyCategory(_T("Appearance"),wxPG_LABEL) );
|
||||
APPENDCOLOURPROP(colors_canvas_bg_pgid, _T("Canvas"), m_frame->colors.canvas_bg)
|
||||
APPENDCOLOURPROP(colors_canvas_shape_normal_pgid, _T("Drawing"), m_frame->colors.canvas_shape_normal)
|
||||
|
@ -103,7 +103,7 @@ void ASSDrawSettingsDialog::Init()
|
|||
APPENDBOOLPROP(behaviors_parse_spc_pgid, _T("Parse S/P/C"), m_frame->behaviors.parse_spc);
|
||||
APPENDBOOLPROP(behaviors_nosplashscreen_pgid, _T("No splash screen"), m_frame->behaviors.nosplashscreen);
|
||||
APPENDBOOLPROP(behaviors_confirmquit_pgid, _T("Confirm quit"), m_frame->behaviors.confirmquit);
|
||||
|
||||
|
||||
wxFlexGridSizer *sizer = new wxFlexGridSizer(2, 1, 0, 0);
|
||||
sizer->AddGrowableCol(0);
|
||||
sizer->AddGrowableRow(0);
|
||||
|
@ -156,7 +156,7 @@ void ASSDrawSettingsDialog::OnSettingsApplyButtonClicked(wxCommandEvent &event)
|
|||
PARSECOLOR(m_frame->colors.origin, colors_origin_pgid)
|
||||
PARSECOLOR(m_frame->colors.ruler_h, colors_ruler_h_pgid)
|
||||
PARSECOLOR(m_frame->colors.ruler_v, colors_ruler_v_pgid)
|
||||
|
||||
|
||||
PARSE(&m_frame->alphas.canvas_shape_controlpoint, alphas_canvas_shape_controlpoint_pgid)
|
||||
PARSE(&m_frame->alphas.canvas_shape_guideline, alphas_canvas_shape_guideline_pgid)
|
||||
PARSE(&m_frame->alphas.canvas_shape_mainpoint, alphas_canvas_shape_mainpoint_pgid)
|
||||
|
@ -176,7 +176,7 @@ void ASSDrawSettingsDialog::OnSettingsApplyButtonClicked(wxCommandEvent &event)
|
|||
wxCommandEvent evento( wxEVT_SETTINGS_CHANGED, event.GetId() );
|
||||
evento.SetEventObject( button );
|
||||
m_frame->GetEventHandler()->ProcessEvent( evento );
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ASSDrawSettingsDialog::OnSettingsRevertButtonClicked(wxCommandEvent &event)
|
||||
|
@ -187,7 +187,7 @@ void ASSDrawSettingsDialog::OnSettingsRevertButtonClicked(wxCommandEvent &event)
|
|||
void ASSDrawSettingsDialog::RefreshSettingsDisplay()
|
||||
{
|
||||
if (propgrid == NULL) return;
|
||||
|
||||
|
||||
#define UPDATESETTING(value, pgid) propgrid->SetPropertyValue(pgid, value);
|
||||
|
||||
UPDATESETTING(m_frame->colors.canvas_bg, colors_canvas_bg_pgid)
|
||||
|
|
Loading…
Reference in New Issue