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/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_styling_assistant.cpp
|
|
|
|
/// @brief Styling Assistant dialogue box and logic
|
|
|
|
/// @ingroup tools_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
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"
|
|
|
|
#include "ass_style.h"
|
2011-07-15 06:04:13 +02:00
|
|
|
#include "audio_controller.h"
|
2011-07-27 07:36:09 +02:00
|
|
|
#include "command/command.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"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "utils.h"
|
|
|
|
#include "video_context.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
#ifndef AGI_PRE
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/colour.h>
|
|
|
|
#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>
|
|
|
|
#endif
|
2011-01-16 08:17:36 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
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)));
|
|
|
|
}
|
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)
|
2011-07-27 07:36:09 +02:00
|
|
|
, active_line(0)
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
|
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"));
|
|
|
|
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);
|
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);
|
|
|
|
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")));
|
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"));
|
2011-07-27 07:36:09 +02:00
|
|
|
play_audio->Enable(c->audioController->IsAudioOpen());
|
|
|
|
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"));
|
2011-07-27 07:36:09 +02:00
|
|
|
play_video->Enable(c->videoController->IsLoaded());
|
|
|
|
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
|
|
|
{
|
|
|
|
wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
main_sizer->SetSizeHints(this);
|
|
|
|
SetSizer(main_sizer);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
persist.reset(new PersistLocation(this, "Tool/Styling Assistant"));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
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);
|
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 () {
|
|
|
|
c->stylingAssistant = 0;
|
|
|
|
c->selectionController->RemoveSelectionListener(this);
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnShow(wxShowEvent &evt) {
|
|
|
|
if (evt.IsShown())
|
|
|
|
evt.Skip();
|
|
|
|
else
|
|
|
|
Destroy();
|
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
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
current_line_text->SetValue(active_line->Text);
|
|
|
|
style_name->SetValue(active_line->Style);
|
|
|
|
style_name->SetSelection(0, active_line->Style.size());
|
|
|
|
style_name->SetFocus();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
style_list->SetStringSelection(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) {
|
|
|
|
if (!c->ass->GetStyle(style_name->GetValue())) return;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
active_line->Style = 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
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
play_video->Enable(c->videoController->IsLoaded());
|
|
|
|
play_audio->Enable(c->audioController->IsAudioOpen());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
style_list->Set(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
|
|
|
|
2011-07-27 07:36:09 +02:00
|
|
|
void DialogStyling::OnKeyDown(wxKeyEvent &evt) {
|
2011-07-30 01:16:55 +02:00
|
|
|
if (!hotkey::check("Styling Assistant", c, evt.GetKeyCode(), evt.GetUnicodeKey(), evt.GetModifiers())) {
|
2011-07-27 07:36:09 +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);
|
|
|
|
}
|
|
|
|
evt.Skip();
|
|
|
|
}
|
|
|
|
}
|