From 0dd60ed25a3a9d5bf6c618075e614e6ff566afb9 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Mon, 24 Sep 2007 17:40:03 +0000 Subject: [PATCH] Fix remaining static box sizer problems (hopefully) and also fix a few other, minor dialogue layout problems. Originally committed to SVN as r1590. --- aegisub/ass_exporter.cpp | 7 ++++++- aegisub/dialog_export.cpp | 2 +- aegisub/dialog_paste_over.cpp | 12 ++++++------ aegisub/dialog_properties.cpp | 2 +- aegisub/dialog_selection.cpp | 8 +++++--- aegisub/dialog_shift_times.cpp | 28 ++++++++++++++-------------- aegisub/dialog_timing_processor.cpp | 2 +- aegisub/export_framerate.cpp | 3 +-- 8 files changed, 35 insertions(+), 29 deletions(-) diff --git a/aegisub/ass_exporter.cpp b/aegisub/ass_exporter.cpp index a89b7e34d..21ece053a 100644 --- a/aegisub/ass_exporter.cpp +++ b/aegisub/ass_exporter.cpp @@ -65,14 +65,19 @@ void AssExporter::DrawSettings(wxWindow *parent,wxSizer *AddTo) { FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin(); FilterList::iterator end = AssExportFilterChain::GetFilterList()->end(); for (FilterList::iterator cur=begin;cur!=end;cur++) { + // Make sure to construct static box sizer first, so it won't overlap + // the controls on wxMac. + box = new wxStaticBoxSizer(wxVERTICAL,parent,(*cur)->RegisterName); window = (*cur)->GetConfigDialogWindow(parent); if (window) { - box = new wxStaticBoxSizer(wxVERTICAL,parent,(*cur)->RegisterName); box->Add(window,0,wxEXPAND,0); AddTo->Add(box,0,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5); AddTo->Show(box,false); Sizers[(*cur)->RegisterName] = box; } + else { + delete box; + } } } diff --git a/aegisub/dialog_export.cpp b/aegisub/dialog_export.cpp index d93a30109..d892b2a76 100644 --- a/aegisub/dialog_export.cpp +++ b/aegisub/dialog_export.cpp @@ -53,6 +53,7 @@ DialogExport::DialogExport (wxWindow *parent) : wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, _T("Export")) { // Filter list + wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters")); Export = new AssExporter(AssFile::top); wxArrayString filters = Export->GetAllFilterNames(); FilterList = new wxCheckListBox(this, Filter_List_Box, wxDefaultPosition, wxSize(200,100), filters); @@ -102,7 +103,6 @@ DialogExport::DialogExport (wxWindow *parent) } // Top sizer - wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters")); TopSizer->Add(FilterList,1,wxEXPAND,0); TopSizer->Add(TopButtons,0,wxEXPAND,0); TopSizer->Add(Description,0,wxEXPAND | wxTOP,5); diff --git a/aegisub/dialog_paste_over.cpp b/aegisub/dialog_paste_over.cpp index 5ac618219..7051f9a9f 100644 --- a/aegisub/dialog_paste_over.cpp +++ b/aegisub/dialog_paste_over.cpp @@ -52,6 +52,11 @@ DialogPasteOver::DialogPasteOver (wxWindow *parent) // Script mode int mode = 1; // ASS + // Label and list sizer + wxSizer *ListSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Fields")); + wxStaticText *label = new wxStaticText(this,-1,_("Please select the fields that you want to paste over:"),wxDefaultPosition,wxDefaultSize); + ListSizer->Add(label,0,wxEXPAND,0); + // List box wxArrayString choices; choices.Add(_("Layer")); @@ -71,16 +76,11 @@ DialogPasteOver::DialogPasteOver (wxWindow *parent) choices.Add(_("Effect")); choices.Add(_("Text")); ListBox = new wxCheckListBox(this,-1,wxDefaultPosition,wxSize(250,170), choices); + ListSizer->Add(ListBox,0,wxEXPAND|wxTOP,5); // Load checked items for (unsigned int i=0;iCheck(i,Options.AsBool(wxString::Format(_T("Paste Over #%i"),i))); - // Label and list sizer - wxStaticText *label = new wxStaticText(this,-1,_("Please select the fields that you want to paste over:"),wxDefaultPosition,wxDefaultSize); - wxSizer *ListSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Fields")); - ListSizer->Add(label,0,wxEXPAND,0); - ListSizer->Add(ListBox,0,wxEXPAND|wxTOP,5); - // Top buttons wxSizer *TopButtonSizer = new wxBoxSizer(wxHORIZONTAL); TopButtonSizer->Add(new wxButton(this, Paste_Over_All, _("All")),1,0,0); diff --git a/aegisub/dialog_properties.cpp b/aegisub/dialog_properties.cpp index 2c258fa3c..dc54261cc 100644 --- a/aegisub/dialog_properties.cpp +++ b/aegisub/dialog_properties.cpp @@ -61,6 +61,7 @@ DialogProperties::DialogProperties (wxWindow *parent) AssFile *subs = AssFile::top; // Script details crap + wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Script")); wxStaticText *TitleLabel = new wxStaticText(this,-1,_("Title:")); TitleEdit = new wxTextCtrl(this,-1,subs->GetScriptInfo(_T("Title")),wxDefaultPosition,wxSize(200,20)); wxStaticText *OrigScriptLabel = new wxStaticText(this,-1,_("Original script:")); @@ -77,7 +78,6 @@ DialogProperties::DialogProperties (wxWindow *parent) UpdatedEdit = new wxTextCtrl(this,-1,subs->GetScriptInfo(_T("Script Updated By")),wxDefaultPosition,wxSize(200,20)); wxStaticText *UpdateDetailsLabel = new wxStaticText(this,-1,_("Update details:")); UpdateDetailsEdit = new wxTextCtrl(this,-1,subs->GetScriptInfo(_T("Update Details")),wxDefaultPosition,wxSize(200,20)); - wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Script")); wxFlexGridSizer *TopSizerGrid = new wxFlexGridSizer(0,2,5,5); TopSizerGrid->Add(TitleLabel,0,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,0); TopSizerGrid->Add(TitleEdit,1,wxEXPAND,0); diff --git a/aegisub/dialog_selection.cpp b/aegisub/dialog_selection.cpp index 964abab78..f1c405e64 100644 --- a/aegisub/dialog_selection.cpp +++ b/aegisub/dialog_selection.cpp @@ -53,6 +53,11 @@ wxDialog (parent,-1,_("Select"),wxDefaultPosition,wxDefaultSize,wxCAPTION) // Variables grid = _grid; + // Static-box sizers before anything else + wxSizer *MatchSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Match")); + wxSizer *MatchTopSizer = new wxBoxSizer(wxHORIZONTAL); + wxSizer *DialogueSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Match dialogues/comments")); + // Matches box Matches = new wxRadioButton(this,-1,_("Matches"),wxDefaultPosition,wxDefaultSize,wxRB_GROUP); DoesntMatch = new wxRadioButton(this,-1,_("Doesn't Match"),wxDefaultPosition,wxDefaultSize,0); @@ -83,8 +88,6 @@ wxDialog (parent,-1,_("Select"),wxDefaultPosition,wxDefaultSize,wxCAPTION) Action = new wxRadioBox(this,-1,_("Action"),wxDefaultPosition,wxDefaultSize,actions,1); // Matches box sizer - wxSizer *MatchSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Match")); - wxSizer *MatchTopSizer = new wxBoxSizer(wxHORIZONTAL); MatchTopSizer->Add(Matches,0,wxEXPAND|wxRIGHT,5); MatchTopSizer->Add(DoesntMatch,0,wxEXPAND,0); MatchTopSizer->AddStretchSpacer(1); @@ -96,7 +99,6 @@ wxDialog (parent,-1,_("Select"),wxDefaultPosition,wxDefaultSize,wxCAPTION) MatchSizer->Add(RegExp,0,wxTOP|wxEXPAND,5); // Dialogues / Comments box - wxSizer *DialogueSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Match dialogues/comments")); DialogueSizer->Add(MatchDialogues,0, wxRIGHT|wxEXPAND,5); DialogueSizer->Add(MatchComments,0, wxEXPAND); diff --git a/aegisub/dialog_shift_times.cpp b/aegisub/dialog_shift_times.cpp index 04d69da1e..abefe4f26 100644 --- a/aegisub/dialog_shift_times.cpp +++ b/aegisub/dialog_shift_times.cpp @@ -66,12 +66,16 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid) ready = true; grid = _grid; shiftframe = 0; + + // Static-box sizers before anything else + wxSizer *TimesSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Shift by")); + wxSizer *HistorySizer = new wxStaticBoxSizer(wxVERTICAL,this,_("History")); // Times - RadioTime = new wxRadioButton(this,RADIO_TIME,_("Time: "),wxDefaultPosition,wxSize(60,20), wxRB_GROUP); - RadioFrames = new wxRadioButton(this,RADIO_FRAME,_("Frames: "),wxDefaultPosition,wxSize(60,20)); - ShiftTime = new TimeEdit(this,TEXT_SHIFT_TIME,_T(""),wxDefaultPosition,wxSize(60,20)); - ShiftFrame = new wxTextCtrl(this,TEXT_SHIFT_FRAME,wxString::Format(_T("%i"),shiftframe),wxDefaultPosition,wxSize(60,20)); + RadioTime = new wxRadioButton(this,RADIO_TIME,_("Time: "),wxDefaultPosition,wxDefaultSize, wxRB_GROUP); + RadioFrames = new wxRadioButton(this,RADIO_FRAME,_("Frames: "),wxDefaultPosition,wxDefaultSize); + ShiftTime = new TimeEdit(this,TEXT_SHIFT_TIME,_T(""),wxDefaultPosition,wxDefaultSize); + ShiftFrame = new wxTextCtrl(this,TEXT_SHIFT_FRAME,wxString::Format(_T("%i"),shiftframe),wxDefaultPosition,wxDefaultSize); ShiftTime->SetToolTip(_("Enter time in h:mm:ss.cs notation")); RadioTime->SetToolTip(_("Shift by time")); ShiftFrame->Disable(); @@ -80,12 +84,11 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid) ShiftFrame->SetToolTip(_("Enter number of frames to shift by")); RadioFrames->SetToolTip(_("Shift by frames")); } - wxSizer *TimeSizer = new wxBoxSizer(wxHORIZONTAL); - wxSizer *FrameSizer = new wxBoxSizer(wxHORIZONTAL); - TimeSizer->Add(RadioTime,0,wxALIGN_CENTER_VERTICAL,0); - TimeSizer->Add(ShiftTime,1,wxLEFT,5); - FrameSizer->Add(RadioFrames,0,wxALIGN_CENTER_VERTICAL,0); - FrameSizer->Add(ShiftFrame,1,wxLEFT,5); + wxSizer *TimeFrameSizer = new wxFlexGridSizer(2,2,5,5); + TimeFrameSizer->Add(RadioTime,0,wxALIGN_CENTER_VERTICAL,0); + TimeFrameSizer->Add(ShiftTime,1); + TimeFrameSizer->Add(RadioFrames,0,wxALIGN_CENTER_VERTICAL,0); + TimeFrameSizer->Add(ShiftFrame,1); // Direction DirectionForward = new wxRadioButton(this,-1,_("Forward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); @@ -95,9 +98,7 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid) wxSizer *DirectionSizer = new wxBoxSizer(wxHORIZONTAL); DirectionSizer->Add(DirectionForward,1,wxEXPAND,0); DirectionSizer->Add(DirectionBackward,1,wxLEFT | wxEXPAND,5); - wxSizer *TimesSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Shift by")); - TimesSizer->Add(TimeSizer,0,wxEXPAND,0); - TimesSizer->Add(FrameSizer,0,wxEXPAND | wxTOP,5); + TimesSizer->Add(TimeFrameSizer,0,wxEXPAND,0); TimesSizer->Add(DirectionSizer,0,wxEXPAND | wxTOP,5); // Selection @@ -109,7 +110,6 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid) TimesChoice = new wxRadioBox(this,-1,_("Times"), wxDefaultPosition, wxDefaultSize, 3, TimesChoices, 3, wxRA_SPECIFY_ROWS); // History - wxSizer *HistorySizer = new wxStaticBoxSizer(wxVERTICAL,this,_("History")); History = new wxListBox(this,-1,wxDefaultPosition,wxSize(350,100), 0, NULL, wxLB_HSCROLL); HistorySizer->Add(History,1,wxEXPAND,0); diff --git a/aegisub/dialog_timing_processor.cpp b/aegisub/dialog_timing_processor.cpp index 5208007c6..b28f75937 100644 --- a/aegisub/dialog_timing_processor.cpp +++ b/aegisub/dialog_timing_processor.cpp @@ -67,6 +67,7 @@ DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_gr adjsThresTime = Options.AsText(_T("Timing processor adjascent thres")); // Styles box + wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Apply to styles")); wxArrayString styles = grid->ass->GetStyles(); StyleList = new wxCheckListBox(this,TIMING_STYLE_LIST,wxDefaultPosition,wxSize(150,150),styles); StyleList->SetToolTip(_("Select styles to process. Unchecked ones will be ignored.")); @@ -170,7 +171,6 @@ DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_gr StyleButtonsSizer->Add(none,1,0,0); // Left sizer - wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Apply to styles")); size_t len = StyleList->GetCount(); for (size_t i=0;iCheck(i); diff --git a/aegisub/export_framerate.cpp b/aegisub/export_framerate.cpp index b8cac644a..41531b945 100644 --- a/aegisub/export_framerate.cpp +++ b/aegisub/export_framerate.cpp @@ -127,8 +127,7 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) { MainSizer->Add(OutputSizer,0,wxEXPAND,0); // Window - MainSizer->SetSizeHints(base); - base->SetSizer(MainSizer); + base->SetSizerAndFit(MainSizer); return base; }