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::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(860,600),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
||||
: wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
/* XXX HACK XXX
|
||||
|
@ -495,6 +494,7 @@ void FrameMain::InitContents() {
|
|||
TopSizer->Add(ToolSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
||||
|
||||
// Set sizers/hints
|
||||
MainSizer->Add(new wxStaticLine(Panel),0,wxEXPAND | wxALL,0);
|
||||
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,0);
|
||||
MainSizer->Add(BottomSizer,1,wxEXPAND | wxALL,0);
|
||||
Panel->SetSizer(MainSizer);
|
||||
|
|
|
@ -68,7 +68,7 @@ VideoBox::VideoBox(wxWindow *parent)
|
|||
frame = AegisubApp::Get()->frame;
|
||||
|
||||
// Visual controls sub-toolbar
|
||||
visualSubToolBar = new wxBoxSizer(wxHORIZONTAL);
|
||||
visualSubToolBar = new wxToolBar(videoPage,-1,wxDefaultPosition,wxDefaultSize,wxTB_HORIZONTAL | wxTB_BOTTOM | wxTB_FLAT);
|
||||
|
||||
// Buttons
|
||||
wxBitmapButton *VideoPlayButton = new wxBitmapButton(videoPage,Video_Play,wxBITMAP(button_play),wxDefaultPosition,wxSize(25,-1));
|
||||
|
@ -120,13 +120,14 @@ VideoBox::VideoBox(wxWindow *parent)
|
|||
visualToolBar->Realize();
|
||||
|
||||
// Top sizer
|
||||
wxFlexGridSizer *topSizer = new wxFlexGridSizer(2,2,0,0);
|
||||
topSizer->Add(visualToolBar,0,wxEXPAND,0);
|
||||
topSizer->Add(videoDisplay,1,wxEXPAND,0);
|
||||
topSizer->AddSpacer(0);
|
||||
topSizer->Add(visualSubToolBar,1,wxEXPAND,0);
|
||||
topSizer->AddGrowableCol(1);
|
||||
topSizer->AddGrowableRow(0);
|
||||
wxSizer *topTopSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
|
||||
visualSubToolBar->Show(false);
|
||||
topTopSizer->Add(visualToolBar,0,wxEXPAND,0);
|
||||
topTopSizer->Add(videoDisplay,1,wxEXPAND,0);
|
||||
topSizer->Add(topTopSizer,1,wxEXPAND,0);
|
||||
topSizer->Add(visualSubToolBar,0,wxEXPAND | wxBOTTOM,4);
|
||||
topSizer->Add(new wxStaticLine(videoPage),0,wxEXPAND,0);
|
||||
|
||||
// Sizers
|
||||
videoSliderSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -141,7 +142,6 @@ VideoBox::VideoBox(wxWindow *parent)
|
|||
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
|
||||
VideoSizer = new wxBoxSizer(wxVERTICAL);
|
||||
VideoSizer->Add(topSizer,1,wxEXPAND,0);
|
||||
VideoSizer->Add(new wxStaticLine(videoPage),0,wxEXPAND,0);
|
||||
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);
|
||||
VideoSizer->Add(videoBottomSizer,0,wxEXPAND,0);
|
||||
SetSizer(VideoSizer);
|
||||
|
|
|
@ -66,7 +66,8 @@ private:
|
|||
|
||||
public:
|
||||
wxToolBar *visualToolBar;
|
||||
wxSizer *visualSubToolBar;
|
||||
wxToolBar *visualSubToolBar;
|
||||
//wxSizer *visualSubToolBar;
|
||||
|
||||
ToggleBitmap *AutoScroll;
|
||||
wxBoxSizer *VideoSizer;
|
||||
|
|
|
@ -652,10 +652,12 @@ void VideoDisplay::SetVisualMode(int mode) {
|
|||
// Set visual
|
||||
if (visualMode != mode) {
|
||||
// Get toolbar
|
||||
wxSizer *toolBar = NULL;
|
||||
wxToolBar *toolBar = NULL;
|
||||
if (box) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -664,12 +666,12 @@ void VideoDisplay::SetVisualMode(int mode) {
|
|||
delete visual;
|
||||
switch (mode) {
|
||||
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 3: visual = new VisualToolRotateXY(this); break;
|
||||
case 4: visual = new VisualToolScale(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,16 +57,18 @@ enum {
|
|||
|
||||
///////////////
|
||||
// Constructor
|
||||
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxSizer *toolbar,wxWindow *toolWindow)
|
||||
VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxToolBar *toolBar)
|
||||
: VisualTool(_parent)
|
||||
{
|
||||
_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);
|
||||
toolbar->Add(toggleMove,0,wxEXPAND);
|
||||
toolbar->AddStretchSpacer(1);
|
||||
toolBar->AddControl(toggleMove);
|
||||
toggleMoveOnMove = true;
|
||||
UpdateToggleButtons();
|
||||
//UpdateToggleButtons();
|
||||
toolBar->Realize();
|
||||
toolBar->Show(true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
void DoRefresh();
|
||||
|
||||
public:
|
||||
VisualToolDrag(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow);
|
||||
VisualToolDrag(VideoDisplay *parent,wxToolBar *toolbar);
|
||||
|
||||
void Update();
|
||||
void Draw();
|
||||
|
|
|
@ -55,44 +55,23 @@ enum {
|
|||
|
||||
///////////////
|
||||
// Constructor
|
||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow)
|
||||
VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxToolBar *toolBar)
|
||||
: VisualTool(parent)
|
||||
{
|
||||
DoRefresh();
|
||||
|
||||
// Create toolbar
|
||||
wxButton *drag = new wxBitmapButton(toolWindow,BUTTON_DRAG,wxBITMAP(visual_vector_clip_drag));
|
||||
wxButton *line = new wxBitmapButton(toolWindow,BUTTON_LINE,wxBITMAP(visual_vector_clip_line));
|
||||
wxButton *bicubic = new wxBitmapButton(toolWindow,BUTTON_BICUBIC,wxBITMAP(visual_vector_clip_bicubic));
|
||||
wxButton *convert = new wxBitmapButton(toolWindow,BUTTON_CONVERT,wxBITMAP(visual_vector_clip_convert));
|
||||
wxButton *insert = new wxBitmapButton(toolWindow,BUTTON_INSERT,wxBITMAP(visual_vector_clip_insert));
|
||||
wxButton *remove = new wxBitmapButton(toolWindow,BUTTON_REMOVE,wxBITMAP(visual_vector_clip_remove));
|
||||
wxButton *freehand = new wxBitmapButton(toolWindow,BUTTON_FREEHAND,wxBITMAP(visual_vector_clip_freehand));
|
||||
drag->SetToolTip(_("Drag control points."));
|
||||
line->SetToolTip(_("Appends a line."));
|
||||
bicubic->SetToolTip(_("Appends a bezier bicubic curve."));
|
||||
convert->SetToolTip(_("Converts a segment between line and bicubic."));
|
||||
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);
|
||||
|
||||
toolBar->AddTool(BUTTON_DRAG,_("Drag"),wxBITMAP(visual_vector_clip_drag),_("Drag control points."),wxITEM_CHECK);
|
||||
toolBar->AddTool(BUTTON_LINE,_("Line"),wxBITMAP(visual_vector_clip_line),_("Appends a line."),wxITEM_CHECK);
|
||||
toolBar->AddTool(BUTTON_BICUBIC,_("Bicubic"),wxBITMAP(visual_vector_clip_bicubic),_("Appends a bezier bicubic curve."),wxITEM_CHECK);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(BUTTON_CONVERT,_("Convert"),wxBITMAP(visual_vector_clip_convert),_("Converts a segment between line and bicubic."),wxITEM_CHECK);
|
||||
toolBar->AddTool(BUTTON_INSERT,_("Insert"),wxBITMAP(visual_vector_clip_insert),_("Inserts a control point."),wxITEM_CHECK);
|
||||
toolBar->AddTool(BUTTON_REMOVE,_("Remove"),wxBITMAP(visual_vector_clip_remove),_("Removes a control point."),wxITEM_CHECK);
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(BUTTON_FREEHAND,_("Freehand"),wxBITMAP(visual_vector_clip_freehand),_("Draws a freehand shape."),wxITEM_CHECK);
|
||||
toolBar->Realize();
|
||||
toolBar->Show(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,7 +96,7 @@ void VisualToolVectorClip::Draw() {
|
|||
// Draw lines
|
||||
SetLineColour(colour[3],1.0f,2);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -126,7 +105,7 @@ void VisualToolVectorClip::Draw() {
|
|||
glColorMask(0,0,0,0);
|
||||
glStencilFunc(GL_NEVER,1,1);
|
||||
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);
|
||||
glVertex2f(points[0].x,points[0].y);
|
||||
glVertex2f(points[i].x,points[i].y);
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
void DoRefresh();
|
||||
|
||||
public:
|
||||
VisualToolVectorClip(VideoDisplay *parent,wxSizer *toolbar,wxWindow *toolWindow);
|
||||
VisualToolVectorClip(VideoDisplay *parent,wxToolBar *toolbar);
|
||||
|
||||
void Update();
|
||||
void Draw();
|
||||
|
|
Loading…
Reference in a new issue