diff --git a/src/subs_edit_box.cpp b/src/subs_edit_box.cpp index d854b0eb5..6bde5d8de 100644 --- a/src/subs_edit_box.cpp +++ b/src/subs_edit_box.cpp @@ -39,6 +39,7 @@ #include "base_grid.h" #include "command/command.h" #include "compat.h" +#include "dialog_style_editor.h" #include "include/aegisub/context.h" #include "include/aegisub/hotkey.h" #include "initial_line_state.h" @@ -62,7 +63,7 @@ #include #include #include -#include +#include #include #include #include @@ -117,6 +118,16 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context) style_box = MakeComboBox("Default", wxCB_READONLY, &SubsEditBox::OnStyleChange, _("Style for this line")); + style_edit_button = new wxButton(this, -1, _("Edit"), wxDefaultPosition, wxSize(50, -1)); + style_edit_button->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) { + if (active_style) { + wxArrayString font_list = wxFontEnumerator::GetFacenames(); + font_list.Sort(); + DialogStyleEditor(this, active_style, c, nullptr, "", font_list).ShowModal(); + } + }); + top_sizer->Add(style_edit_button, wxSizerFlags().Center().Border(wxRIGHT)); + actor_box = new Placeholder(this, _("Actor"), wxSize(110, -1), wxCB_DROPDOWN | wxTE_PROCESS_ENTER, _("Actor name for this speech. This is only for reference, and is mainly useless.")); Bind(wxEVT_TEXT, &SubsEditBox::OnActorChange, this, actor_box->GetId()); Bind(wxEVT_COMBOBOX, &SubsEditBox::OnActorChange, this, actor_box->GetId()); @@ -334,6 +345,8 @@ void SubsEditBox::UpdateFields(int type, bool repopulate_lists) { change_value(margin[i], std::to_wstring(line->Margin[i])); comment_box->SetValue(line->Comment); style_box->Select(style_box->FindString(to_wx(line->Style))); + active_style = c->ass->GetStyle(line->Style); + style_edit_button->Enable(active_style != nullptr); if (repopulate_lists) PopulateList(effect_box, &AssDialogue::Effect); effect_box->ChangeValue(to_wx(line->Effect)); diff --git a/src/subs_edit_box.h b/src/subs_edit_box.h index c660ff65a..b51141f2c 100644 --- a/src/subs_edit_box.h +++ b/src/subs_edit_box.h @@ -48,6 +48,7 @@ namespace agi { namespace vfr { class Framerate; } } namespace agi { struct Context; } class AssDialogue; +class AssStyle; class AssTime; class SubsTextEditCtrl; class TimeEdit; @@ -77,6 +78,7 @@ class SubsEditBox final : public wxPanel { /// Currently active dialogue line AssDialogue *line = nullptr; + AssStyle *active_style = nullptr; /// Are the buttons currently split into two lines? bool button_bar_split = true; @@ -90,6 +92,7 @@ class SubsEditBox final : public wxPanel { // Box controls wxCheckBox *comment_box; wxComboBox *style_box; + wxButton *style_edit_button; Placeholder *actor_box; TimeEdit *start_time; TimeEdit *end_time;