forked from mia/Aegisub
Rewrite the styling assisant as changes to other parts of Aegisub have made almost all of it broken
Originally committed to SVN as r5518.
This commit is contained in:
parent
f906c3dcd2
commit
07b77203f1
7 changed files with 291 additions and 526 deletions
|
@ -61,6 +61,10 @@ namespace cmd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void call(std::string const& name, agi::Context*c) {
|
||||||
|
(*find_command(name)->second)(c);
|
||||||
|
}
|
||||||
|
|
||||||
wxBitmap const& Command::Icon(int size) {
|
wxBitmap const& Command::Icon(int size) {
|
||||||
if (size == 16) {
|
if (size == 16) {
|
||||||
return icon::get(name(), 16);
|
return icon::get(name(), 16);
|
||||||
|
|
|
@ -141,6 +141,11 @@ namespace cmd {
|
||||||
/// @note This is guaranteed to be unique.
|
/// @note This is guaranteed to be unique.
|
||||||
int id(std::string const& name);
|
int id(std::string const& name);
|
||||||
|
|
||||||
|
/// Call a command.
|
||||||
|
/// @param name Name of the command to call.
|
||||||
|
/// @param c Current Context.
|
||||||
|
void call(std::string const& name, agi::Context *c);
|
||||||
|
|
||||||
/// Call a command.
|
/// Call a command.
|
||||||
/// @param c Current Context.
|
/// @param c Current Context.
|
||||||
/// @param id ID for Command to call.
|
/// @param id ID for Command to call.
|
||||||
|
|
|
@ -147,6 +147,37 @@ struct tool_style_assistant : public Command {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct tool_styling_assistant_validator : public Command {
|
||||||
|
CMD_TYPE(COMMAND_VALIDATE)
|
||||||
|
|
||||||
|
bool Validate(agi::Context *c) {
|
||||||
|
return !!c->stylingAssistant;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Commit changes and move to the next line.
|
||||||
|
struct tool_styling_assistant_commit : public tool_styling_assistant_validator {
|
||||||
|
CMD_NAME("tool/styling_assistant/commit")
|
||||||
|
STR_MENU("&Accept changes")
|
||||||
|
STR_DISP("Accept changes")
|
||||||
|
STR_HELP("Commit changes and move to the next line.")
|
||||||
|
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->stylingAssistant->Commit(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Commit changes and stay on the current line.
|
||||||
|
struct tool_styling_assistant_preview : public tool_styling_assistant_validator {
|
||||||
|
CMD_NAME("tool/styling_assistant/preview")
|
||||||
|
STR_MENU("&Preview changes")
|
||||||
|
STR_DISP("Preview changes")
|
||||||
|
STR_HELP("Commit changes and stay on the current line.")
|
||||||
|
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->stylingAssistant->Commit(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// Open styles manager.
|
/// Open styles manager.
|
||||||
struct tool_style_manager : public Command {
|
struct tool_style_manager : public Command {
|
||||||
|
@ -212,6 +243,8 @@ namespace cmd {
|
||||||
reg(new tool_line_select);
|
reg(new tool_line_select);
|
||||||
reg(new tool_resampleres);
|
reg(new tool_resampleres);
|
||||||
reg(new tool_style_assistant);
|
reg(new tool_style_assistant);
|
||||||
|
reg(new tool_styling_assistant_commit);
|
||||||
|
reg(new tool_styling_assistant_preview);
|
||||||
reg(new tool_style_manager);
|
reg(new tool_style_manager);
|
||||||
reg(new tool_time_kanji);
|
reg(new tool_time_kanji);
|
||||||
reg(new tool_time_postprocess);
|
reg(new tool_time_postprocess);
|
||||||
|
|
|
@ -1,29 +1,16 @@
|
||||||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
||||||
// All rights reserved.
|
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Permission to use, copy, modify, and distribute this software for any
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
//
|
//
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
// this list of conditions and the following disclaimer.
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
// and/or other materials provided with the distribution.
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
// may be used to endorse or promote products derived from this software
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
//
|
||||||
// Aegisub Project http://www.aegisub.org/
|
// Aegisub Project http://www.aegisub.org/
|
||||||
//
|
//
|
||||||
|
@ -35,14 +22,8 @@
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
|
||||||
#include <wx/recguard.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "dialog_styling_assistant.h"
|
#include "dialog_styling_assistant.h"
|
||||||
|
|
||||||
#include "include/aegisub/context.h"
|
#include "include/aegisub/context.h"
|
||||||
|
@ -51,444 +32,238 @@
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "audio_box.h"
|
|
||||||
#include "audio_controller.h"
|
#include "audio_controller.h"
|
||||||
#include "frame_main.h"
|
#include "command/command.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "selection_controller.h"
|
#include "persist_location.h"
|
||||||
#include "subs_edit_box.h"
|
|
||||||
#include "subs_grid.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
#include "video_display.h"
|
|
||||||
|
|
||||||
// IDs
|
#ifndef AGI_PRE
|
||||||
enum {
|
#include <wx/checkbox.h>
|
||||||
ENTER_STYLE_BOX,
|
#include <wx/colour.h>
|
||||||
STYLE_LIST,
|
#include <wx/dialog.h>
|
||||||
BUTTON_PLAY_VIDEO,
|
#include <wx/listbox.h>
|
||||||
BUTTON_PLAY_AUDIO
|
#include <wx/textctrl.h>
|
||||||
};
|
#endif
|
||||||
|
|
||||||
|
static void add_hotkey(wxSizer *sizer, wxWindow *parent, const char *command, const char *text) {
|
||||||
|
sizer->Add(new wxStaticText(parent, -1, _(text)));
|
||||||
|
sizer->Add(new wxStaticText(parent, -1, hotkey::get_hotkey_str_first("Styling Assistant", command)));
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Constructor
|
|
||||||
/// @param parent
|
|
||||||
/// @param _grid
|
|
||||||
///
|
|
||||||
DialogStyling::DialogStyling(agi::Context *context)
|
DialogStyling::DialogStyling(agi::Context *context)
|
||||||
: wxDialog(context->parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX)
|
: wxDialog(context->parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX)
|
||||||
, c(context)
|
, c(context)
|
||||||
, needCommit(false)
|
, active_line(0)
|
||||||
, linen(-1)
|
|
||||||
{
|
{
|
||||||
// Set icon
|
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
|
||||||
|
|
||||||
// Top sizer
|
wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Current line"));
|
wxSizer *bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
CurLine = new wxTextCtrl(this,-1,_("Current line"),wxDefaultPosition,wxSize(300,60),wxTE_MULTILINE | wxTE_READONLY);
|
|
||||||
TopSizer->Add(CurLine,1,wxEXPAND,0);
|
|
||||||
|
|
||||||
// Left sizer
|
{
|
||||||
Styles = new wxListBox(this,STYLE_LIST,wxDefaultPosition,wxSize(150,180),context->ass->GetStyles());
|
wxSizer *cur_line_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Current line"));
|
||||||
wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Styles available"));
|
current_line_text = new wxTextCtrl(this, -1, _("Current line"), wxDefaultPosition, wxSize(300, 60), wxTE_MULTILINE | wxTE_READONLY);
|
||||||
LeftSizer->Add(Styles,1,wxEXPAND,0);
|
cur_line_box->Add(current_line_text, 1, wxEXPAND, 0);
|
||||||
|
main_sizer->Add(cur_line_box, 0, wxEXPAND | wxALL, 5);
|
||||||
// Right sizer
|
|
||||||
wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
wxSizer *RightTop = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Set style"));
|
|
||||||
wxSizer *RightMiddle = new wxStaticBoxSizer(wxVERTICAL,this,_("Keys"));
|
|
||||||
wxSizer *RightBottom = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Actions"));
|
|
||||||
TypeBox = new StyleEditBox(this);
|
|
||||||
RightTop->Add(TypeBox,1,wxEXPAND);
|
|
||||||
|
|
||||||
// Shortcuts
|
|
||||||
wxSizer *KeysInnerSizer = new wxGridSizer(2,0,5);
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Accept")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Accept changes")));
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Preview")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Preview changes")));
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Prev")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Previous line")));
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Next")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Next line")));
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Video")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Play Video")));
|
|
||||||
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Audio")) + _T(": ")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Play Audio")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Click on list:")));
|
|
||||||
KeysInnerSizer->Add(new wxStaticText(this,-1,_("Select style")));
|
|
||||||
|
|
||||||
// Right Middle
|
|
||||||
PreviewCheck = new wxCheckBox(this,-1,_("Enable preview (slow)"));
|
|
||||||
PreviewCheck->SetValue(true);
|
|
||||||
RightMiddle->Add(KeysInnerSizer,0,wxEXPAND | wxBOTTOM,5);
|
|
||||||
RightMiddle->Add(PreviewCheck,0,0,0);
|
|
||||||
RightMiddle->AddStretchSpacer(1);
|
|
||||||
|
|
||||||
// Rest of right sizer
|
|
||||||
PlayVideoButton = new wxButton(this,BUTTON_PLAY_VIDEO,_("Play Video"));
|
|
||||||
PlayAudioButton = new wxButton(this,BUTTON_PLAY_AUDIO,_("Play Audio"));
|
|
||||||
RightBottom->AddStretchSpacer(1);
|
|
||||||
RightBottom->Add(PlayAudioButton,0,wxLEFT | wxRIGHT | wxBOTTOM,5);
|
|
||||||
RightBottom->Add(PlayVideoButton,0,wxBOTTOM | wxRIGHT,5);
|
|
||||||
RightBottom->AddStretchSpacer(1);
|
|
||||||
|
|
||||||
RightSizer->Add(RightTop,0,wxEXPAND | wxBOTTOM,5);
|
|
||||||
RightSizer->Add(RightMiddle,0,wxEXPAND | wxBOTTOM,5);
|
|
||||||
RightSizer->Add(RightBottom,0,wxEXPAND,5);
|
|
||||||
|
|
||||||
// Bottom sizer
|
|
||||||
wxSizer *BottomSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
BottomSizer->Add(LeftSizer,1,wxEXPAND | wxRIGHT,5);
|
|
||||||
BottomSizer->Add(RightSizer,1,wxEXPAND,0);
|
|
||||||
|
|
||||||
// Button sizer
|
|
||||||
wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer();
|
|
||||||
ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL));
|
|
||||||
ButtonSizer->AddButton(new HelpButton(this,_T("Styling Assistant")));
|
|
||||||
ButtonSizer->Realize();
|
|
||||||
|
|
||||||
// Main sizer
|
|
||||||
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
MainSizer->Add(TopSizer,0,wxEXPAND | wxALL,5);
|
|
||||||
MainSizer->Add(BottomSizer,1,wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT,5);
|
|
||||||
MainSizer->Add(ButtonSizer,0,wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT,5);
|
|
||||||
MainSizer->SetSizeHints(this);
|
|
||||||
SetSizer(MainSizer);
|
|
||||||
|
|
||||||
// Position window
|
|
||||||
if (lastx == -1 && lasty == -1) {
|
|
||||||
CenterOnParent();
|
|
||||||
} else {
|
|
||||||
Move(lastx, lasty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// h4x
|
{
|
||||||
origColour = TypeBox->GetBackgroundColour();
|
wxSizer *styles_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Styles available"));
|
||||||
|
style_list = new wxListBox(this, -1, wxDefaultPosition, wxSize(150, 180), context->ass->GetStyles());
|
||||||
|
styles_box->Add(style_list, 1, wxEXPAND, 0);
|
||||||
|
bottom_sizer->Add(styles_box, 1, wxEXPAND | wxRIGHT, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSizer *right_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
{
|
||||||
|
wxSizer *style_text_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Set style"));
|
||||||
|
style_name = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(180, -1), wxTE_PROCESS_ENTER);
|
||||||
|
style_text_box->Add(style_name, 1, wxEXPAND);
|
||||||
|
right_sizer->Add(style_text_box, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
wxSizer *hotkey_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Keys"));
|
||||||
|
|
||||||
|
wxSizer *hotkey_grid = new wxGridSizer(2, 0, 5);
|
||||||
|
add_hotkey(hotkey_grid, this, "tool/styling_assistant/commit", "Accept changes:");
|
||||||
|
add_hotkey(hotkey_grid, this, "tool/styling_assistant/preview", "Preview changes:");
|
||||||
|
add_hotkey(hotkey_grid, this, "grid/line/prev", "Previous line:");
|
||||||
|
add_hotkey(hotkey_grid, this, "grid/line/next", "Next line:");
|
||||||
|
add_hotkey(hotkey_grid, this, "video/play/line", "Play Video:");
|
||||||
|
add_hotkey(hotkey_grid, this, "audio/play/selection", "Play Audio:");
|
||||||
|
hotkey_grid->Add(new wxStaticText(this, -1, _("Click on list:")));
|
||||||
|
hotkey_grid->Add(new wxStaticText(this, -1, _("Select style")));
|
||||||
|
|
||||||
|
hotkey_box->Add(hotkey_grid, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
|
||||||
|
auto_seek = new wxCheckBox(this, -1, _("Seek video to line start time"));
|
||||||
|
auto_seek->SetValue(true);
|
||||||
|
hotkey_box->Add(auto_seek, 0, 0, 0);
|
||||||
|
hotkey_box->AddStretchSpacer(1);
|
||||||
|
|
||||||
|
right_sizer->Add(hotkey_box, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
wxSizer *actions_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Actions"));
|
||||||
|
actions_box->AddStretchSpacer(1);
|
||||||
|
|
||||||
|
play_audio = new wxButton(this, -1, _("Play Audio"));
|
||||||
|
play_audio->Enable(c->audioController->IsAudioOpen());
|
||||||
|
actions_box->Add(play_audio, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||||
|
|
||||||
|
play_video = new wxButton(this, -1, _("Play Video"));
|
||||||
|
play_video->Enable(c->videoController->IsLoaded());
|
||||||
|
actions_box->Add(play_video, 0, wxBOTTOM | wxRIGHT, 5);
|
||||||
|
|
||||||
|
actions_box->AddStretchSpacer(1);
|
||||||
|
right_sizer->Add(actions_box, 0, wxEXPAND, 5);
|
||||||
|
}
|
||||||
|
bottom_sizer->Add(right_sizer);
|
||||||
|
main_sizer->Add(bottom_sizer, 1, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 5);
|
||||||
|
|
||||||
|
{
|
||||||
|
wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;
|
||||||
|
button_sizer->AddButton(new wxButton(this, wxID_CANCEL));
|
||||||
|
button_sizer->AddButton(new HelpButton(this, "Styling Assistant"));
|
||||||
|
button_sizer->Realize();
|
||||||
|
|
||||||
|
main_sizer->Add(button_sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
main_sizer->SetSizeHints(this);
|
||||||
|
SetSizer(main_sizer);
|
||||||
|
|
||||||
|
persist.reset(new PersistLocation(this, "Tool/Styling Assistant"));
|
||||||
|
|
||||||
|
c->selectionController->AddSelectionListener(this);
|
||||||
|
Bind(wxEVT_ACTIVATE, &DialogStyling::OnActivate, this);
|
||||||
|
Bind(wxEVT_KEY_DOWN, &DialogStyling::OnKeyDown, this);
|
||||||
|
Bind(wxEVT_SHOW, &DialogStyling::OnShow, this);
|
||||||
|
style_name->Bind(wxEVT_KEY_DOWN, &DialogStyling::OnKeyDown, this);
|
||||||
|
play_video->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogStyling::OnPlayVideoButton, this);
|
||||||
|
play_audio->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogStyling::OnPlayAudioButton, this);
|
||||||
|
style_list->Bind(wxEVT_COMMAND_LISTBOX_SELECTED, &DialogStyling::OnListClicked, this);
|
||||||
|
style_list->Bind(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &DialogStyling::OnListDoubleClicked, this);
|
||||||
|
style_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DialogStyling::OnStyleBoxModified, this);
|
||||||
|
|
||||||
|
OnActiveLineChanged(c->selectionController->GetActiveLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Destructor
|
|
||||||
///
|
|
||||||
DialogStyling::~DialogStyling () {
|
DialogStyling::~DialogStyling () {
|
||||||
GetPosition(&lastx, &lasty);
|
c->stylingAssistant = 0;
|
||||||
if (needCommit) {
|
c->selectionController->RemoveSelectionListener(this);
|
||||||
c->ass->Commit(_("style changes"), AssFile::COMMIT_TEXT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Jump to line
|
void DialogStyling::OnShow(wxShowEvent &evt) {
|
||||||
/// @param n
|
if (evt.IsShown())
|
||||||
/// @return
|
evt.Skip();
|
||||||
///
|
else
|
||||||
void DialogStyling::JumpToLine(int n) {
|
Destroy();
|
||||||
if (n == -1) return;
|
|
||||||
|
|
||||||
// Get line
|
|
||||||
AssDialogue *nextLine = c->subsGrid->GetDialogue(n);
|
|
||||||
if (!nextLine) return;
|
|
||||||
line = nextLine;
|
|
||||||
|
|
||||||
// Set number
|
|
||||||
linen = n;
|
|
||||||
|
|
||||||
// Set text
|
|
||||||
CurLine->SetValue(line->Text);
|
|
||||||
|
|
||||||
// Set focus
|
|
||||||
TypeBox->SetFocus();
|
|
||||||
bool matched = false;
|
|
||||||
for (size_t i = 0; i < Styles->GetCount(); i++) {
|
|
||||||
if (TypeBox->GetValue().IsSameAs(Styles->GetString(i),true)) {
|
|
||||||
matched = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!matched || TypeBox->GetValue().IsEmpty()) TypeBox->SetValue(Styles->GetString(0));
|
|
||||||
TypeBox->SetSelection(0,TypeBox->GetValue().Length());
|
|
||||||
|
|
||||||
// Update grid
|
|
||||||
c->subsGrid->SelectRow(linen,false);
|
|
||||||
c->subsGrid->MakeCellVisible(linen,0);
|
|
||||||
c->subsGrid->SetActiveLine(line);
|
|
||||||
|
|
||||||
// Update display
|
|
||||||
if (PreviewCheck->IsChecked()) c->videoController->JumpToTime(line->Start.GetMS());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Set style of current line
|
void DialogStyling::OnActiveLineChanged(AssDialogue *new_line) {
|
||||||
/// @param curName
|
if (!new_line) return;
|
||||||
/// @param jump
|
active_line = new_line;
|
||||||
///
|
|
||||||
void DialogStyling::SetStyle (wxString curName, bool jump) {
|
|
||||||
AssDialogue *line = c->subsGrid->GetDialogue(linen);
|
|
||||||
line->Style = curName;
|
|
||||||
|
|
||||||
// Update grid/subs
|
current_line_text->SetValue(active_line->Text);
|
||||||
if (PreviewCheck->IsChecked()) {
|
style_name->SetValue(active_line->Style);
|
||||||
|
style_name->SetSelection(0, active_line->Style.size());
|
||||||
|
style_name->SetFocus();
|
||||||
|
|
||||||
|
style_list->SetStringSelection(active_line->Style);
|
||||||
|
|
||||||
|
if (auto_seek->IsChecked() && IsActive())
|
||||||
|
c->videoController->JumpToTime(active_line->Start.GetMS());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogStyling::Commit(bool next) {
|
||||||
|
if (!c->ass->GetStyle(style_name->GetValue())) return;
|
||||||
|
|
||||||
|
active_line->Style = style_name->GetValue();
|
||||||
c->ass->Commit(_("styling assistant"), AssFile::COMMIT_TEXT);
|
c->ass->Commit(_("styling assistant"), AssFile::COMMIT_TEXT);
|
||||||
}
|
|
||||||
else {
|
|
||||||
needCommit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next line
|
if (next) cmd::call("grid/line/next", c);
|
||||||
if (jump) JumpToLine(linen+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnActivate(wxActivateEvent &) {
|
||||||
|
if (!IsActive()) return;
|
||||||
|
|
||||||
///////////////
|
play_video->Enable(c->videoController->IsLoaded());
|
||||||
// Event table
|
play_audio->Enable(c->audioController->IsAudioOpen());
|
||||||
BEGIN_EVENT_TABLE(DialogStyling,wxDialog)
|
|
||||||
EVT_ACTIVATE(DialogStyling::OnActivate)
|
|
||||||
EVT_BUTTON(BUTTON_PLAY_VIDEO, DialogStyling::OnPlayVideoButton)
|
|
||||||
EVT_BUTTON(BUTTON_PLAY_AUDIO, DialogStyling::OnPlayAudioButton)
|
|
||||||
//EVT_TEXT_ENTER(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxEnter)
|
|
||||||
EVT_TEXT(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxModified)
|
|
||||||
EVT_LISTBOX_DCLICK(STYLE_LIST, DialogStyling::OnListClicked)
|
|
||||||
EVT_KEY_DOWN(DialogStyling::OnKeyDown)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
style_list->Set(c->ass->GetStyles());
|
||||||
|
|
||||||
|
if (auto_seek->IsChecked())
|
||||||
|
c->videoController->JumpToTime(active_line->Start.GetMS());
|
||||||
|
|
||||||
/// @brief Dialog was De/Activated
|
style_name->SetFocus();
|
||||||
/// @param event
|
}
|
||||||
/// @return
|
|
||||||
///
|
void DialogStyling::OnStyleBoxModified(wxCommandEvent &event) {
|
||||||
void DialogStyling::OnActivate(wxActivateEvent &event) {
|
long from, to;
|
||||||
// Dialog lost focus
|
style_name->GetSelection(&from, &to);
|
||||||
if (!event.GetActive()) {
|
wxString prefix = style_name->GetValue().Left(from).Lower();
|
||||||
if (needCommit) {
|
|
||||||
c->ass->Commit(_("styling assistant"), AssFile::COMMIT_TEXT);
|
if (prefix.empty()) {
|
||||||
needCommit = false;
|
style_name->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Enable/disable play video/audio buttons
|
|
||||||
PlayVideoButton->Enable(c->videoController->IsLoaded());
|
// Find the first style name which the contents of the box could be the
|
||||||
PlayAudioButton->Enable(c->audioController->IsAudioOpen());
|
// beginning of
|
||||||
// Fix style list
|
for (size_t i = 0; i < style_list->GetCount(); ++i) {
|
||||||
Styles->Set(c->ass->GetStyles());
|
wxString style = style_list->GetString(i);
|
||||||
// Fix line selection
|
if (style.Lower().StartsWith(prefix)) {
|
||||||
JumpToLine(c->subsGrid->GetFirstSelRow());
|
style_name->ChangeValue(style);
|
||||||
|
style_name->SetSelection(prefix.size(), style.size());
|
||||||
|
style_name->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
style_name->Refresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
style_name->SetBackgroundColour(wxColour(255, 108, 108));
|
||||||
|
style_name->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnListClicked(wxCommandEvent &evt) {
|
||||||
|
style_name->ChangeValue(style_list->GetString(evt.GetInt()));
|
||||||
/// @brief Key pressed
|
Commit(false);
|
||||||
/// @param event
|
style_name->SetFocus();
|
||||||
///
|
|
||||||
void DialogStyling::OnKeyDown(wxKeyEvent &event) {
|
|
||||||
int keycode = event.GetKeyCode();
|
|
||||||
|
|
||||||
// Previous line
|
|
||||||
if (keycode == WXK_PAGEUP) {
|
|
||||||
JumpToLine(linen-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next line
|
|
||||||
if (keycode == WXK_PAGEDOWN) {
|
|
||||||
JumpToLine(linen+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnListDoubleClicked(wxCommandEvent &evt) {
|
||||||
|
style_name->ChangeValue(style_list->GetString(evt.GetInt()));
|
||||||
/// @brief Edit box changed
|
Commit(true);
|
||||||
/// @param event
|
style_name->SetFocus();
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void DialogStyling::OnStyleBoxModified (wxCommandEvent &event) {
|
|
||||||
// Recursion guard
|
|
||||||
static wxRecursionGuardFlag s_flag;
|
|
||||||
wxRecursionGuard guard(s_flag);
|
|
||||||
if (guard.IsInside()) return;
|
|
||||||
|
|
||||||
// Find partial style name
|
|
||||||
long from,to;
|
|
||||||
TypeBox->GetSelection(&from,&to);
|
|
||||||
wxString partial = TypeBox->GetValue().Left(from).Lower();
|
|
||||||
int len = partial.Length();
|
|
||||||
|
|
||||||
// Find first style that matches partial name
|
|
||||||
bool match = false;
|
|
||||||
int n = Styles->GetCount();
|
|
||||||
wxString curname;
|
|
||||||
for (int i=0;i<n;i++) {
|
|
||||||
curname = Styles->GetString(i);
|
|
||||||
if (curname.Left(len).Lower() == partial) {
|
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Found
|
|
||||||
if (match) {
|
|
||||||
TypeBox->SetValue(curname);
|
|
||||||
TypeBox->SetSelection(from,curname.Length());
|
|
||||||
TypeBox->SetBackgroundColour(origColour);
|
|
||||||
TypeBox->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not found
|
|
||||||
else {
|
|
||||||
TypeBox->SetBackgroundColour(wxColour(255,108,108));
|
|
||||||
TypeBox->Refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnPlayVideoButton(wxCommandEvent &) {
|
||||||
|
|
||||||
/// @brief Enter pressed
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyling::OnStyleBoxEnter (wxCommandEvent &event) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Style list clicked
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyling::OnListClicked(wxCommandEvent &event) {
|
|
||||||
int n = event.GetInt();
|
|
||||||
SetStyle(Styles->GetString(n));
|
|
||||||
Styles->SetSelection(wxNOT_FOUND);
|
|
||||||
TypeBox->SetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Play video button
|
|
||||||
/// @param event
|
|
||||||
///
|
|
||||||
void DialogStyling::OnPlayVideoButton(wxCommandEvent &event) {
|
|
||||||
c->videoController->PlayLine();
|
c->videoController->PlayLine();
|
||||||
TypeBox->SetFocus();
|
style_name->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnPlayAudioButton(wxCommandEvent &) {
|
||||||
/// @brief Play audio button
|
cmd::call("audio/play/selection", c);
|
||||||
/// @param event
|
style_name->SetFocus();
|
||||||
///
|
|
||||||
void DialogStyling::OnPlayAudioButton(wxCommandEvent &event) {
|
|
||||||
c->audioController->PlayRange(SampleRange(
|
|
||||||
c->audioController->SamplesFromMilliseconds(line->Start.GetMS()),
|
|
||||||
c->audioController->SamplesFromMilliseconds(line->End.GetMS())));
|
|
||||||
TypeBox->SetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogStyling::OnKeyDown(wxKeyEvent &evt) {
|
||||||
|
if (!hotkey::check("Styling Assistant", evt.GetKeyCode(), evt.GetUnicodeKey(), evt.GetModifiers())) {
|
||||||
/// @brief Style edit box constructor
|
// Move the beginning of the selection back one character so that backspace
|
||||||
/// @param parent
|
// actually does something
|
||||||
///
|
if (evt.GetKeyCode() == WXK_BACK && !evt.GetModifiers()) {
|
||||||
StyleEditBox::StyleEditBox(DialogStyling *parent)
|
long from, to;
|
||||||
: wxTextCtrl(parent,ENTER_STYLE_BOX,"",wxDefaultPosition,wxSize(180,-1),wxTE_PROCESS_ENTER)
|
style_name->GetSelection(&from, &to);
|
||||||
, diag(parent)
|
if (from > 0)
|
||||||
{
|
style_name->SetSelection(from - 1, to);
|
||||||
|
}
|
||||||
|
evt.Skip();
|
||||||
|
}
|
||||||
|
evt.StopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
|
||||||
// Event table for edit box
|
|
||||||
BEGIN_EVENT_TABLE(StyleEditBox,wxTextCtrl)
|
|
||||||
EVT_KEY_DOWN(StyleEditBox::OnKeyDown)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Key pressed
|
|
||||||
/// @param event
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
void StyleEditBox::OnKeyDown(wxKeyEvent &event) {
|
|
||||||
if (!hotkey::check("Styling Assistant", event.GetKeyCode(), event.GetUnicodeKey(), event.GetModifiers()))
|
|
||||||
event.Skip();
|
|
||||||
event.StopPropagation();
|
|
||||||
|
|
||||||
//H I think most of this can be removed.
|
|
||||||
//int keycode = event.GetKeyCode();
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
#ifdef __APPLE__
|
|
||||||
Hotkeys.SetPressed(event.GetKeyCode(),event.m_metaDown,event.m_altDown,event.m_shiftDown);
|
|
||||||
#else
|
|
||||||
Hotkeys.SetPressed(event.GetKeyCode(),event.m_controlDown,event.m_altDown,event.m_shiftDown);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Backspace
|
|
||||||
#ifdef __APPLE__
|
|
||||||
if (event.GetKeyCode() == WXK_BACK && !event.m_metaDown && !event.m_altDown && !event.m_shiftDown) {
|
|
||||||
#else
|
|
||||||
if (event.GetKeyCode() == WXK_BACK && !event.m_controlDown && !event.m_altDown && !event.m_shiftDown) {
|
|
||||||
#endif
|
|
||||||
long from,to;
|
|
||||||
GetSelection(&from,&to);
|
|
||||||
if (from > 0) SetSelection(from-1,to);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Previous line
|
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Prev"))) {
|
|
||||||
diag->JumpToLine(diag->linen-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next line
|
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Next"))) {
|
|
||||||
diag->JumpToLine(diag->linen+1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Play video
|
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Play Video"))) {
|
|
||||||
if (diag->video->IsLoaded()) {
|
|
||||||
diag->video->PlayLine();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Play audio
|
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Play Audio"))) {
|
|
||||||
/// @todo Reinstate this when the audio controller is made reachable from here
|
|
||||||
|
|
||||||
//if (diag->audio->loaded) {
|
|
||||||
// diag->audio->Play(diag->line->Start.GetMS(),diag->line->End.GetMS());
|
|
||||||
//}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter key
|
|
||||||
if (Hotkeys.IsPressed(_T("Styling Assistant Accept")) || Hotkeys.IsPressed(_T("Styling Assistant Preview"))) {
|
|
||||||
// Make sure that entered style is valid
|
|
||||||
int n = diag->Styles->GetCount();
|
|
||||||
wxString curName;
|
|
||||||
bool match = false;
|
|
||||||
for (int i=0;i<n;i++) {
|
|
||||||
curName = diag->Styles->GetString(i);
|
|
||||||
if (curName == GetValue()) {
|
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set style name
|
|
||||||
if (match) {
|
|
||||||
diag->SetStyle(curName,Hotkeys.IsPressed(_T("Styling Assistant Accept")));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
int DialogStyling::lastx = -1;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
int DialogStyling::lasty = -1;
|
|
||||||
|
|
|
@ -1,29 +1,16 @@
|
||||||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
||||||
// All rights reserved.
|
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Permission to use, copy, modify, and distribute this software for any
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
//
|
//
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
// this list of conditions and the following disclaimer.
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
// and/or other materials provided with the distribution.
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
// may be used to endorse or promote products derived from this software
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
//
|
||||||
// Aegisub Project http://www.aegisub.org/
|
// Aegisub Project http://www.aegisub.org/
|
||||||
//
|
//
|
||||||
|
@ -34,102 +21,56 @@
|
||||||
/// @ingroup tools_ui
|
/// @ingroup tools_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
#include "selection_controller.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/checkbox.h>
|
#include <wx/event.h>
|
||||||
#include <wx/colour.h>
|
|
||||||
#include <wx/dialog.h>
|
|
||||||
#include <wx/listbox.h>
|
|
||||||
#include <wx/textctrl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <libaegisub/scoped_ptr.h>
|
||||||
|
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
class AssFile;
|
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class AudioController;
|
class PersistLocation;
|
||||||
class DialogStyling;
|
class wxButton;
|
||||||
class SubtitlesGrid;
|
class wxCheckBox;
|
||||||
class VideoContext;
|
class wxListBox;
|
||||||
|
class wxTextCtrl;
|
||||||
/// DOCME
|
|
||||||
/// @class StyleEditBox
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class StyleEditBox : public wxTextCtrl {
|
|
||||||
/// DOCME
|
|
||||||
DialogStyling *diag;
|
|
||||||
void OnKeyDown(wxKeyEvent &event);
|
|
||||||
|
|
||||||
public:
|
|
||||||
StyleEditBox(DialogStyling *parent);
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogStyling
|
/// @class DialogStyling
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class DialogStyling : public wxDialog {
|
class DialogStyling : public wxDialog, public SelectionListener<AssDialogue> {
|
||||||
friend class StyleEditBox;
|
|
||||||
|
|
||||||
agi::Context *c;
|
agi::Context *c;
|
||||||
|
|
||||||
/// DOCME
|
wxButton *play_audio;
|
||||||
wxColour origColour;
|
wxButton *play_video;
|
||||||
|
wxCheckBox *auto_seek;
|
||||||
|
wxListBox *style_list;
|
||||||
|
wxTextCtrl *current_line_text;
|
||||||
|
wxTextCtrl *style_name;
|
||||||
|
|
||||||
/// DOCME
|
void OnActivate(wxActivateEvent &evt);
|
||||||
bool needCommit;
|
void OnKeyDown(wxKeyEvent &evt);
|
||||||
|
void OnListClicked(wxCommandEvent &evt);
|
||||||
|
void OnListDoubleClicked(wxCommandEvent &evt);
|
||||||
|
void OnPlayAudioButton(wxCommandEvent &evt);
|
||||||
|
void OnPlayVideoButton(wxCommandEvent &evt);
|
||||||
|
void OnShow(wxShowEvent &evt);
|
||||||
|
void OnStyleBoxModified(wxCommandEvent &evt);
|
||||||
|
|
||||||
|
void OnActiveLineChanged(AssDialogue *);
|
||||||
|
void OnSelectedSetChanged(Selection const&, Selection const&) { }
|
||||||
|
|
||||||
/// DOCME
|
AssDialogue *active_line;
|
||||||
wxTextCtrl *CurLine;
|
|
||||||
|
|
||||||
/// DOCME
|
agi::scoped_ptr<PersistLocation> persist;
|
||||||
wxListBox *Styles;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
StyleEditBox *TypeBox;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxCheckBox *PreviewCheck;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxButton *PlayVideoButton;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxButton *PlayAudioButton;
|
|
||||||
|
|
||||||
void OnStyleBoxModified (wxCommandEvent &event);
|
|
||||||
void OnStyleBoxEnter (wxCommandEvent &event);
|
|
||||||
void OnListClicked (wxCommandEvent &event);
|
|
||||||
void OnKeyDown(wxKeyEvent &event);
|
|
||||||
void OnPlayVideoButton(wxCommandEvent &event);
|
|
||||||
void OnPlayAudioButton(wxCommandEvent &event);
|
|
||||||
void OnActivate(wxActivateEvent &event);
|
|
||||||
|
|
||||||
void SetStyle (wxString curName,bool jump=true);
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
static int lastx, lasty;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// DOCME
|
void Commit(bool next);
|
||||||
int linen;
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
AssDialogue *line;
|
|
||||||
|
|
||||||
DialogStyling(agi::Context *context);
|
DialogStyling(agi::Context *context);
|
||||||
~DialogStyling ();
|
~DialogStyling();
|
||||||
|
|
||||||
void JumpToLine(int n);
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -345,6 +345,13 @@
|
||||||
"Style Editor" : {
|
"Style Editor" : {
|
||||||
"Preview Text" : "Aegisub\\N0123 月語"
|
"Preview Text" : "Aegisub\\N0123 月語"
|
||||||
},
|
},
|
||||||
|
"Styling Assistant" : {
|
||||||
|
"Last" : {
|
||||||
|
"X" : -1,
|
||||||
|
"Y" : -1
|
||||||
|
},
|
||||||
|
"Maximized" : false
|
||||||
|
},
|
||||||
"Thesaurus" : {
|
"Thesaurus" : {
|
||||||
"Language" : "en_US"
|
"Language" : "en_US"
|
||||||
},
|
},
|
||||||
|
|
|
@ -540,37 +540,37 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"Styling Assistant" : {
|
"Styling Assistant" : {
|
||||||
"audio play" : [
|
"audio/play/selection" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "End"
|
"key" : "End"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styling assistant commit" : [
|
"tool/styling_assistant/commit" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Enter"
|
"key" : "Enter"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styling assistant next item" : [
|
"grid/line/next" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "PageDown"
|
"key" : "PageDown"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styling assistant prev item" : [
|
"grid/line/prev" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "PageUp"
|
"key" : "PageUp"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styling assistant preview" : [
|
"tool/styling_assistant/preview" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "F8"
|
"key" : "F8"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"video/play" : [
|
"video/play/line" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Home"
|
"key" : "Home"
|
||||||
|
|
Loading…
Reference in a new issue