2011-07-27 07:36:09 +02:00
|
|
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2011-07-27 07:36:09 +02:00
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2011-07-27 07:36:09 +02:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file dialog_styling_assistant.cpp
|
|
|
|
/// @brief Styling Assistant dialogue box and logic
|
|
|
|
/// @ingroup tools_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-15 06:04:13 +02:00
|
|
|
#include "dialog_styling_assistant.h"
|
|
|
|
|
2011-01-16 08:17:08 +01:00
|
|
|
#include "include/aegisub/context.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "include/aegisub/hotkey.h"
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_dialogue.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "ass_file.h"
|
2011-07-27 07:36:09 +02:00
|
|
|
#include "command/command.h"
|
2012-12-30 01:32:36 +01:00
|
|
|
#include "compat.h"
|
2008-01-13 22:05:31 +01:00
|
|
|
#include "help_button.h"
|
2009-07-24 02:08:25 +02:00
|
|
|
#include "libresrc/libresrc.h"
|
2011-07-27 07:36:09 +02:00
|
|
|
#include "persist_location.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "project.h"
|
2014-03-25 01:15:14 +01:00
|
|
|
#include "selection_controller.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "video_controller.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2014-04-23 22:53:24 +02:00
|
|
|
#include <libaegisub/make_unique.h>
|
2013-06-10 15:58:13 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/colour.h>
|
2014-05-23 00:40:16 +02:00
|
|
|
#include <wx/event.h>
|
2011-07-27 07:36:09 +02:00
|
|
|
#include <wx/listbox.h>
|
2011-07-27 19:21:39 +02:00
|
|
|
#include <wx/settings.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/stattext.h>
|
2011-07-27 07:36:09 +02:00
|
|
|
#include <wx/textctrl.h>
|
2011-01-16 08:17:36 +01:00
|
|
|
|
2012-03-13 00:35:20 +01:00
|
|
|
static void add_hotkey(wxSizer *sizer, wxWindow *parent, const char *command, wxString const& text) {
|
|
|
|
sizer->Add(new wxStaticText(parent, -1, text));
|
2013-01-04 16:01:50 +01:00
|
|
|
sizer->Add(new wxStaticText(parent, -1, to_wx(hotkey::get_hotkey_str_first("Styling Assistant", command))));
|
2011-07-27 07:36:09 +02:00
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-01-16 08:17:08 +01:00
|
|
|
DialogStyling::DialogStyling(agi::Context *context)
|
2012-01-08 02:05:25 +01:00
|
|
|
: wxDialog(context->parent, -1, _("Styling Assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX)
|
2011-01-16 08:17:36 +01:00
|
|
|
, c(context)
|
2012-10-05 05:22:54 +02:00
|
|
|
, active_line_connection(context->selectionController->AddActiveLineListener(&DialogStyling::OnActiveLineChanged, this))
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2012-04-03 22:40:24 +02:00
|
|
|
SetIcon(GETICON(styling_toolbutton_16));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
wxSizer *bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
{
|
|
|
|
wxSizer *cur_line_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Current line"));
|
|
|
|
current_line_text = new wxTextCtrl(this, -1, _("Current line"), wxDefaultPosition, wxSize(300, 60), wxTE_MULTILINE | wxTE_READONLY);
|
|
|
|
cur_line_box->Add(current_line_text, 1, wxEXPAND, 0);
|
|
|
|
main_sizer->Add(cur_line_box, 0, wxEXPAND | wxALL, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
{
|
|
|
|
wxSizer *styles_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Styles available"));
|
2012-12-30 01:32:36 +01:00
|
|
|
style_list = new wxListBox(this, -1, wxDefaultPosition, wxSize(150, 180), to_wx(context->ass->GetStyles()));
|
2011-07-27 07:36:09 +02:00
|
|
|
styles_box->Add(style_list, 1, wxEXPAND, 0);
|
|
|
|
bottom_sizer->Add(styles_box, 1, wxEXPAND | wxRIGHT, 5);
|
2009-05-14 09:02:01 +02:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
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);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
{
|
|
|
|
wxSizer *hotkey_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Keys"));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
wxSizer *hotkey_grid = new wxGridSizer(2, 0, 5);
|
2012-03-13 00:35:20 +01:00
|
|
|
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"));
|
2012-03-13 00:35:11 +01:00
|
|
|
hotkey_grid->Add(new wxStaticText(this, -1, _("Click on list")));
|
2011-07-27 07:36:09 +02:00
|
|
|
hotkey_grid->Add(new wxStaticText(this, -1, _("Select style")));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
hotkey_box->Add(hotkey_grid, 0, wxEXPAND | wxBOTTOM, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-11-18 19:49:09 +01:00
|
|
|
auto_seek = new wxCheckBox(this, -1, _("&Seek video to line start time"));
|
2011-07-27 07:36:09 +02:00
|
|
|
auto_seek->SetValue(true);
|
|
|
|
hotkey_box->Add(auto_seek, 0, 0, 0);
|
|
|
|
hotkey_box->AddStretchSpacer(1);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
right_sizer->Add(hotkey_box, 0, wxEXPAND | wxBOTTOM, 5);
|
2009-05-14 09:02:01 +02:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
{
|
|
|
|
wxSizer *actions_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Actions"));
|
|
|
|
actions_box->AddStretchSpacer(1);
|
2009-05-14 09:02:01 +02:00
|
|
|
|
2011-11-18 19:49:09 +01:00
|
|
|
play_audio = new wxButton(this, -1, _("Play &Audio"));
|
2014-05-22 01:23:28 +02:00
|
|
|
play_audio->Enable(!!c->project->AudioProvider());
|
2011-07-27 07:36:09 +02:00
|
|
|
actions_box->Add(play_audio, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-11-18 19:49:09 +01:00
|
|
|
play_video = new wxButton(this, -1, _("Play &Video"));
|
2014-05-22 01:23:28 +02:00
|
|
|
play_video->Enable(!!c->project->VideoProvider());
|
2011-07-27 07:36:09 +02:00
|
|
|
actions_box->Add(play_video, 0, wxBOTTOM | wxRIGHT, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
actions_box->AddStretchSpacer(1);
|
|
|
|
right_sizer->Add(actions_box, 0, wxEXPAND, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
2011-07-27 07:36:09 +02:00
|
|
|
bottom_sizer->Add(right_sizer);
|
|
|
|
main_sizer->Add(bottom_sizer, 1, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
{
|
2013-11-21 18:13:36 +01:00
|
|
|
auto button_sizer = new wxStdDialogButtonSizer;
|
2011-07-27 07:36:09 +02:00
|
|
|
button_sizer->AddButton(new wxButton(this, wxID_CANCEL));
|
|
|
|
button_sizer->AddButton(new HelpButton(this, "Styling Assistant"));
|
|
|
|
button_sizer->Realize();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
main_sizer->Add(button_sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-10-05 05:22:54 +02:00
|
|
|
SetSizerAndFit(main_sizer);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2014-04-23 22:53:24 +02:00
|
|
|
persist = agi::make_unique<PersistLocation>(this, "Tool/Styling Assistant");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
Bind(wxEVT_ACTIVATE, &DialogStyling::OnActivate, this);
|
2012-04-27 21:07:49 +02:00
|
|
|
Bind(wxEVT_CHAR_HOOK, &DialogStyling::OnCharHook, this);
|
|
|
|
style_name->Bind(wxEVT_CHAR_HOOK, &DialogStyling::OnCharHook, this);
|
2011-07-27 07:36:09 +02:00
|
|
|
style_name->Bind(wxEVT_KEY_DOWN, &DialogStyling::OnKeyDown, this);
|
2013-12-12 03:25:13 +01:00
|
|
|
play_video->Bind(wxEVT_BUTTON, &DialogStyling::OnPlayVideoButton, this);
|
|
|
|
play_audio->Bind(wxEVT_BUTTON, &DialogStyling::OnPlayAudioButton, this);
|
|
|
|
style_list->Bind(wxEVT_LISTBOX, &DialogStyling::OnListClicked, this);
|
|
|
|
style_list->Bind(wxEVT_LISTBOX_DCLICK, &DialogStyling::OnListDoubleClicked, this);
|
|
|
|
style_name->Bind(wxEVT_TEXT, &DialogStyling::OnStyleBoxModified, this);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
OnActiveLineChanged(c->selectionController->GetActiveLine());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
DialogStyling::~DialogStyling () {
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnActiveLineChanged(AssDialogue *new_line) {
|
|
|
|
if (!new_line) return;
|
|
|
|
active_line = new_line;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
current_line_text->SetValue(to_wx(active_line->Text));
|
|
|
|
style_name->SetValue(to_wx(active_line->Style));
|
2012-12-04 23:35:59 +01:00
|
|
|
style_name->SetSelection(0, active_line->Style.get().size());
|
2011-07-27 07:36:09 +02:00
|
|
|
style_name->SetFocus();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
style_list->SetStringSelection(to_wx(active_line->Style));
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
if (auto_seek->IsChecked() && IsActive())
|
2011-12-22 22:28:51 +01:00
|
|
|
c->videoController->JumpToTime(active_line->Start);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::Commit(bool next) {
|
2012-12-30 01:32:36 +01:00
|
|
|
if (!c->ass->GetStyle(from_wx(style_name->GetValue()))) return;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
active_line->Style = from_wx(style_name->GetValue());
|
2011-09-15 07:16:32 +02:00
|
|
|
c->ass->Commit(_("styling assistant"), AssFile::COMMIT_DIAG_META);
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
if (next) cmd::call("grid/line/next", c);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnActivate(wxActivateEvent &) {
|
|
|
|
if (!IsActive()) return;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
play_video->Enable(!!c->project->VideoProvider());
|
|
|
|
play_audio->Enable(!!c->project->AudioProvider());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2012-12-30 01:32:36 +01:00
|
|
|
style_list->Set(to_wx(c->ass->GetStyles()));
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
if (auto_seek->IsChecked())
|
2011-12-22 22:28:51 +01:00
|
|
|
c->videoController->JumpToTime(active_line->Start);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
style_name->SetFocus();
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-12-22 22:09:31 +01:00
|
|
|
void DialogStyling::OnStyleBoxModified(wxCommandEvent &) {
|
2011-07-27 07:36:09 +02:00
|
|
|
long from, to;
|
|
|
|
style_name->GetSelection(&from, &to);
|
|
|
|
wxString prefix = style_name->GetValue().Left(from).Lower();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
if (prefix.empty()) {
|
|
|
|
style_name->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
2006-01-16 22:02:54 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
// Find the first style name which the contents of the box could be the
|
|
|
|
// beginning of
|
|
|
|
for (size_t i = 0; i < style_list->GetCount(); ++i) {
|
|
|
|
wxString style = style_list->GetString(i);
|
|
|
|
if (style.Lower().StartsWith(prefix)) {
|
|
|
|
style_name->ChangeValue(style);
|
|
|
|
style_name->SetSelection(prefix.size(), style.size());
|
|
|
|
style_name->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
|
|
|
style_name->Refresh();
|
|
|
|
return;
|
2008-05-09 06:27:10 +02:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
style_name->SetBackgroundColour(wxColour(255, 108, 108));
|
|
|
|
style_name->Refresh();
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnListClicked(wxCommandEvent &evt) {
|
|
|
|
style_name->ChangeValue(style_list->GetString(evt.GetInt()));
|
|
|
|
Commit(false);
|
|
|
|
style_name->SetFocus();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnListDoubleClicked(wxCommandEvent &evt) {
|
|
|
|
style_name->ChangeValue(style_list->GetString(evt.GetInt()));
|
|
|
|
Commit(true);
|
|
|
|
style_name->SetFocus();
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnPlayVideoButton(wxCommandEvent &) {
|
|
|
|
c->videoController->PlayLine();
|
|
|
|
style_name->SetFocus();
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnPlayAudioButton(wxCommandEvent &) {
|
|
|
|
cmd::call("audio/play/selection", c);
|
|
|
|
style_name->SetFocus();
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2012-04-27 21:07:49 +02:00
|
|
|
void DialogStyling::OnCharHook(wxKeyEvent &evt) {
|
|
|
|
hotkey::check("Styling Assistant", c, evt);
|
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnKeyDown(wxKeyEvent &evt) {
|
2012-04-27 21:07:49 +02:00
|
|
|
// Move the beginning of the selection back one character so that backspace
|
|
|
|
// actually does something
|
|
|
|
if (evt.GetKeyCode() == WXK_BACK && !evt.GetModifiers()) {
|
|
|
|
long from, to;
|
|
|
|
style_name->GetSelection(&from, &to);
|
|
|
|
if (from > 0)
|
|
|
|
style_name->SetSelection(from - 1, to);
|
2011-07-27 07:36:09 +02:00
|
|
|
}
|
2012-10-16 16:58:10 +02:00
|
|
|
else
|
|
|
|
evt.Skip();
|
2011-07-27 07:36:09 +02:00
|
|
|
}
|