forked from mia/Aegisub
Finished some clean up on visual typesetting
Originally committed to SVN as r1385.
This commit is contained in:
parent
9eb5ab4e25
commit
5f2508ee70
8 changed files with 42 additions and 58 deletions
|
@ -75,8 +75,7 @@
|
||||||
// FrameMain constructor
|
// FrameMain constructor
|
||||||
|
|
||||||
FrameMain::FrameMain (wxArrayString args)
|
FrameMain::FrameMain (wxArrayString args)
|
||||||
// FIXME: 860x600 default window size is tiny on high-res monitors, but maximised is not always desirable either
|
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
||||||
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(860,600),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
/* XXX HACK XXX
|
/* XXX HACK XXX
|
||||||
|
@ -495,6 +494,7 @@ void FrameMain::InitContents() {
|
||||||
TopSizer->Add(ToolSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
TopSizer->Add(ToolSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
||||||
|
|
||||||
// Set sizers/hints
|
// Set sizers/hints
|
||||||
|
MainSizer->Add(new wxStaticLine(Panel),0,wxEXPAND | wxALL,0);
|
||||||
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
||||||
MainSizer->Add(BottomSizer,1,wxEXPAND | wxALL,0);
|
MainSizer->Add(BottomSizer,1,wxEXPAND | wxALL,0);
|
||||||
Panel->SetSizer(MainSizer);
|
Panel->SetSizer(MainSizer);
|
||||||
|
|
|
@ -68,7 +68,7 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
frame = AegisubApp::Get()->frame;
|
frame = AegisubApp::Get()->frame;
|
||||||
|
|
||||||
// Visual controls sub-toolbar
|
// Visual controls sub-toolbar
|
||||||
visualSubToolBar = new wxBoxSizer(wxHORIZONTAL);
|
visualSubToolBar = new wxToolBar(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxTB_HORIZONTAL | wxTB_BOTTOM | wxTB_FLAT);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
wxBitmapButton *VideoPlayButton = new wxBitmapButton(videoPage,Video_Play,wxBITMAP(button_play),wxDefaultPosition,wxSize(25,-1));
|
wxBitmapButton *VideoPlayButton = new wxBitmapButton(videoPage,Video_Play,wxBITMAP(button_play),wxDefaultPosition,wxSize(25,-1));
|
||||||
|
@ -120,13 +120,14 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
visualToolBar->Realize();
|
visualToolBar->Realize();
|
||||||
|
|
||||||
// Top sizer
|
// Top sizer
|
||||||
wxFlexGridSizer *topSizer = new wxFlexGridSizer(2,2,0,0);
|
wxSizer *topTopSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
topSizer->Add(visualToolBar,0,wxEXPAND,0);
|
wxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
topSizer->Add(videoDisplay,1,wxEXPAND,0);
|
visualSubToolBar->Show(false);
|
||||||
topSizer->AddSpacer(0);
|
topTopSizer->Add(visualToolBar,0,wxEXPAND,0);
|
||||||
topSizer->Add(visualSubToolBar,1,wxEXPAND,0);
|
topTopSizer->Add(videoDisplay,1,wxEXPAND,0);
|
||||||
topSizer->AddGrowableCol(1);
|
topSizer->Add(topTopSizer,1,wxEXPAND,0);
|
||||||
topSizer->AddGrowableRow(0);
|
topSizer->Add(visualSubToolBar,0,wxEXPAND | wxBOTTOM,4);
|
||||||
|
topSizer->Add(new wxStaticLine(videoPage),0,wxEXPAND,0);
|
||||||
|
|
||||||
// Sizers
|
// Sizers
|
||||||
videoSliderSizer = new wxBoxSizer(wxHORIZONTAL);
|
videoSliderSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -141,7 +142,6 @@ VideoBox::VideoBox(wxWindow *parent)
|
||||||
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
|
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
|
||||||
VideoSizer = new wxBoxSizer(wxVERTICAL);
|
VideoSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
VideoSizer->Add(topSizer,1,wxEXPAND,0);
|
VideoSizer->Add(topSizer,1,wxEXPAND,0);
|
||||||
VideoSizer->Add(new wxStaticLine(videoPage),0,wxEXPAND,0);
|
|
||||||
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
|
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
|
||||||
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
|
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
|
||||||
SetSizer(VideoSizer);
|
SetSizer(VideoSizer);
|
||||||
|
|
|
@ -66,7 +66,8 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxToolBar *visualToolBar;
|
wxToolBar *visualToolBar;
|
||||||
wxSizer *visualSubToolBar;
|
wxToolBar *visualSubToolBar;
|
||||||
|
//wxSizer *visualSubToolBar;
|
||||||
|
|
||||||
ToggleBitmap *AutoScroll;
|
ToggleBitmap *AutoScroll;
|
||||||
wxBoxSizer *VideoSizer;
|
wxBoxSizer *VideoSizer;
|
||||||
|
|
|
@ -652,10 +652,12 @@ void VideoDisplay::SetVisualMode(int mode) {
|
||||||
// Set visual
|
// Set visual
|
||||||
if (visualMode != mode) {
|
if (visualMode != mode) {
|
||||||
// Get toolbar
|
// Get toolbar
|
||||||
wxSizer *toolBar = NULL;
|
wxToolBar *toolBar = NULL;
|
||||||
if (box) {
|
if (box) {
|
||||||
toolBar = box->visualSubToolBar;
|
toolBar = box->visualSubToolBar;
|
||||||
toolBar->Clear(true);
|
toolBar->ClearTools();
|
||||||
|
toolBar->Realize();
|
||||||
|
toolBar->Show(false);
|
||||||
if (!box->visualToolBar->GetToolState(mode + Video_Mode_Standard)) box->visualToolBar->ToggleTool(mode + Video_Mode_Standard,true);
|
if (!box->visualToolBar->GetToolState(mode + Video_Mode_Standard)) box->visualToolBar->ToggleTool(mode + Video_Mode_Standard,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,12 +666,12 @@ void VideoDisplay::SetVisualMode(int mode) {
|
||||||
delete visual;
|
delete visual;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0: visual = new VisualToolCross(this); break;
|
case 0: visual = new VisualToolCross(this); break;
|
||||||
case 1: visual = new VisualToolDrag(this,toolBar,box); break;
|
case 1: visual = new VisualToolDrag(this,toolBar); break;
|
||||||
case 2: visual = new VisualToolRotateZ(this); break;
|
case 2: visual = new VisualToolRotateZ(this); break;
|
||||||
case 3: visual = new VisualToolRotateXY(this); break;
|
case 3: visual = new VisualToolRotateXY(this); break;
|
||||||
case 4: visual = new VisualToolScale(this); break;
|
case 4: visual = new VisualToolScale(this); break;
|
||||||
case 5: visual = new VisualToolClip(this); break;
|
case 5: visual = new VisualToolClip(this); break;
|
||||||
case 6: visual = new VisualToolVectorClip(this,toolBar,box); break;
|
case 6: visual = new VisualToolVectorClip(this,toolBar); break;
|
||||||
default: visual = NULL;
|
default: visual = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,16 +57,18 @@ enum {
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxSizer *toolbar,wxWindow *toolWindow)
|
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxToolBar *toolBar)
|
||||||
: VisualTool(_parent)
|
: VisualTool(_parent)
|
||||||
{
|
{
|
||||||
_parent->ShowCursor(false);
|
_parent->ShowCursor(false);
|
||||||
toggleMove = new wxBitmapButton(toolWindow,BUTTON_TOGGLE_MOVE,wxBITMAP(visual_move_conv_move),wxDefaultPosition);
|
//toolBar->AddTool(BUTTON_TOGGLE_MOVE,_T("Toggle Move/Pos"),wxBITMAP(visual_move_conv_move));
|
||||||
|
toggleMove = new wxBitmapButton(toolBar,BUTTON_TOGGLE_MOVE,wxBITMAP(visual_move_conv_move),wxDefaultPosition);
|
||||||
ConnectButton(toggleMove);
|
ConnectButton(toggleMove);
|
||||||
toolbar->Add(toggleMove,0,wxEXPAND);
|
toolBar->AddControl(toggleMove);
|
||||||
toolbar->AddStretchSpacer(1);
|
|
||||||
toggleMoveOnMove = true;
|
toggleMoveOnMove = true;
|
||||||
UpdateToggleButtons();
|
//UpdateToggleButtons();
|
||||||
|
toolBar->Realize();
|
||||||
|
toolBar->Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualToolDrag(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow);
|
VisualToolDrag(VideoDisplay *parent,wxToolBar *toolbar);
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
|
@ -55,44 +55,23 @@ enum {
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow)
|
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxToolBar *toolBar)
|
||||||
: VisualTool(parent)
|
: VisualTool(parent)
|
||||||
{
|
{
|
||||||
DoRefresh();
|
DoRefresh();
|
||||||
|
|
||||||
// Create toolbar
|
// Create toolbar
|
||||||
wxButton *drag = new wxBitmapButton(toolWindow,BUTTON_DRAG,wxBITMAP(visual_vector_clip_drag));
|
toolBar->AddTool(BUTTON_DRAG,_("Drag"),wxBITMAP(visual_vector_clip_drag),_("Drag control points."),wxITEM_CHECK);
|
||||||
wxButton *line = new wxBitmapButton(toolWindow,BUTTON_LINE,wxBITMAP(visual_vector_clip_line));
|
toolBar->AddTool(BUTTON_LINE,_("Line"),wxBITMAP(visual_vector_clip_line),_("Appends a line."),wxITEM_CHECK);
|
||||||
wxButton *bicubic = new wxBitmapButton(toolWindow,BUTTON_BICUBIC,wxBITMAP(visual_vector_clip_bicubic));
|
toolBar->AddTool(BUTTON_BICUBIC,_("Bicubic"),wxBITMAP(visual_vector_clip_bicubic),_("Appends a bezier bicubic curve."),wxITEM_CHECK);
|
||||||
wxButton *convert = new wxBitmapButton(toolWindow,BUTTON_CONVERT,wxBITMAP(visual_vector_clip_convert));
|
toolBar->AddSeparator();
|
||||||
wxButton *insert = new wxBitmapButton(toolWindow,BUTTON_INSERT,wxBITMAP(visual_vector_clip_insert));
|
toolBar->AddTool(BUTTON_CONVERT,_("Convert"),wxBITMAP(visual_vector_clip_convert),_("Converts a segment between line and bicubic."),wxITEM_CHECK);
|
||||||
wxButton *remove = new wxBitmapButton(toolWindow,BUTTON_REMOVE,wxBITMAP(visual_vector_clip_remove));
|
toolBar->AddTool(BUTTON_INSERT,_("Insert"),wxBITMAP(visual_vector_clip_insert),_("Inserts a control point."),wxITEM_CHECK);
|
||||||
wxButton *freehand = new wxBitmapButton(toolWindow,BUTTON_FREEHAND,wxBITMAP(visual_vector_clip_freehand));
|
toolBar->AddTool(BUTTON_REMOVE,_("Remove"),wxBITMAP(visual_vector_clip_remove),_("Removes a control point."),wxITEM_CHECK);
|
||||||
drag->SetToolTip(_("Drag control points."));
|
toolBar->AddSeparator();
|
||||||
line->SetToolTip(_("Appends a line."));
|
toolBar->AddTool(BUTTON_FREEHAND,_("Freehand"),wxBITMAP(visual_vector_clip_freehand),_("Draws a freehand shape."),wxITEM_CHECK);
|
||||||
bicubic->SetToolTip(_("Appends a bezier bicubic curve."));
|
toolBar->Realize();
|
||||||
convert->SetToolTip(_("Converts a segment between line and bicubic."));
|
toolBar->Show(true);
|
||||||
insert->SetToolTip(_("Inserts a control point."));
|
|
||||||
remove->SetToolTip(_("Removes a control point."));
|
|
||||||
freehand->SetToolTip(_("Draws a freehand shape."));
|
|
||||||
ConnectButton(drag);
|
|
||||||
ConnectButton(line);
|
|
||||||
ConnectButton(bicubic);
|
|
||||||
ConnectButton(convert);
|
|
||||||
ConnectButton(insert);
|
|
||||||
ConnectButton(remove);
|
|
||||||
ConnectButton(freehand);
|
|
||||||
toolbar->Add(drag,0,wxEXPAND);
|
|
||||||
toolbar->Add(line,0,wxEXPAND);
|
|
||||||
toolbar->Add(bicubic,0,wxEXPAND | wxRIGHT,5);
|
|
||||||
toolbar->Add(new wxStaticLine(toolWindow,-1,wxDefaultPosition,wxDefaultSize,wxLI_VERTICAL),0,wxEXPAND | wxRIGHT,5);
|
|
||||||
toolbar->Add(convert,0,wxEXPAND);
|
|
||||||
toolbar->Add(insert,0,wxEXPAND);
|
|
||||||
toolbar->Add(remove,0,wxEXPAND | wxRIGHT,5);
|
|
||||||
toolbar->Add(new wxStaticLine(toolWindow,-1,wxDefaultPosition,wxDefaultSize,wxLI_VERTICAL),0,wxEXPAND | wxRIGHT,5);
|
|
||||||
toolbar->Add(freehand,0,wxEXPAND);
|
|
||||||
toolbar->AddStretchSpacer(1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +96,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
// Draw lines
|
// Draw lines
|
||||||
SetLineColour(colour[3],1.0f,2);
|
SetLineColour(colour[3],1.0f,2);
|
||||||
SetFillColour(colour[3],0.0f);
|
SetFillColour(colour[3],0.0f);
|
||||||
for (size_t i=0;i<points.size()-1;i++) {
|
for (int i=0;i<((signed)points.size())-1;i++) {
|
||||||
DrawLine(points[i].x,points[i].y,points[i+1].x,points[i+1].y);
|
DrawLine(points[i].x,points[i].y,points[i+1].x,points[i+1].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +105,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
glColorMask(0,0,0,0);
|
glColorMask(0,0,0,0);
|
||||||
glStencilFunc(GL_NEVER,1,1);
|
glStencilFunc(GL_NEVER,1,1);
|
||||||
glStencilOp(GL_INVERT,GL_INVERT,GL_INVERT);
|
glStencilOp(GL_INVERT,GL_INVERT,GL_INVERT);
|
||||||
for (size_t i=1;i<points.size()-1;i++) {
|
for (int i=0;i<((signed)points.size())-1;i++) {
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
glVertex2f(points[0].x,points[0].y);
|
glVertex2f(points[0].x,points[0].y);
|
||||||
glVertex2f(points[i].x,points[i].y);
|
glVertex2f(points[i].x,points[i].y);
|
||||||
|
|
|
@ -57,7 +57,7 @@ private:
|
||||||
void DoRefresh();
|
void DoRefresh();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualToolVectorClip(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow);
|
VisualToolVectorClip(VideoDisplay *parent,wxToolBar *toolbar);
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
Loading…
Reference in a new issue