Make the subtitle edit box auto-commit all changes
This happens to fix most of the undo issues, as it's now much harder to have uncommitted changes to the file. Closes #355 and #586. Originally committed to SVN as r4699.
This commit is contained in:
parent
51a75cd0fd
commit
fde4a7815d
41 changed files with 1120 additions and 2933 deletions
|
@ -671,14 +671,6 @@
|
|||
RelativePath="..\..\src\help_button.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\hilimod_textctrl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\hilimod_textctrl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\scintilla_text_ctrl.cpp"
|
||||
>
|
||||
|
@ -819,14 +811,6 @@
|
|||
RelativePath="..\..\src\font_file_lister_freetype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\idle_field_event.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\idle_field_event.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\kana_table.cpp"
|
||||
>
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
|
||||
#ifndef LAGI_PRE
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,17 +72,20 @@
|
|||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#ifdef _WIN32
|
||||
#include <memory>
|
||||
#else
|
||||
#include <tr1/memory>
|
||||
#endif
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#else
|
||||
#include <tr1/functional>
|
||||
#include <tr1/memory>
|
||||
#endif
|
||||
|
||||
#include "boost/shared_ptr.hpp"
|
||||
|
||||
// General headers
|
||||
|
|
|
@ -221,6 +221,8 @@ public:
|
|||
/// Do nothing
|
||||
void SetEntryData(wxString) { }
|
||||
|
||||
template<int which>
|
||||
void SetMarginString(const wxString value) { SetMarginString(value, which);}
|
||||
/// @brief Set a margin
|
||||
/// @param value New value of the margin
|
||||
/// @param which 0 = left, 1 = right, 2 = vertical/top, 3 = bottom
|
||||
|
|
|
@ -73,11 +73,12 @@ AssFile::AssFile ()
|
|||
{
|
||||
}
|
||||
|
||||
/// @brief AssFile destructor
|
||||
/// @brief AssFile destructor
|
||||
AssFile::~AssFile() {
|
||||
delete_clear(Line);
|
||||
}
|
||||
|
||||
/// @brief Load generic subs
|
||||
void AssFile::Load (const wxString &_filename,wxString charset,bool addToRecent) {
|
||||
bool ok = false;
|
||||
Clear();
|
||||
|
@ -447,11 +448,11 @@ void AssFile::LoadDefault (bool defline) {
|
|||
AddLine(_T("PlayResX: 640"),_T("[Script Info]"),version);
|
||||
AddLine(_T("PlayResY: 480"),_T("[Script Info]"),version);
|
||||
AddLine(_T("ScaledBorderAndShadow: yes"),_T("[Script Info]"),version);
|
||||
AddLine(_T(""),_T("[Script Info]"),version);
|
||||
AddLine("",_T("[Script Info]"),version);
|
||||
AddLine(_T("[V4+ Styles]"),_T("[V4+ Styles]"),version);
|
||||
AddLine(_T("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"),_T("[V4+ Styles]"),version);
|
||||
AddLine(defstyle.GetEntryData(),_T("[V4+ Styles]"),version);
|
||||
AddLine(_T(""),_T("[V4+ Styles]"),version);
|
||||
AddLine("",_T("[V4+ Styles]"),version);
|
||||
AddLine(_T("[Events]"),_T("[Events]"),version);
|
||||
AddLine(_T("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),_T("[Events]"),version);
|
||||
|
||||
|
@ -506,7 +507,7 @@ void AssFile::InsertStyle (AssStyle *style) {
|
|||
// No styles found, add them
|
||||
if (lastStyle == Line.end()) {
|
||||
// Add space
|
||||
curEntry = new AssEntry(_T(""));
|
||||
curEntry = new AssEntry("");
|
||||
curEntry->group = lastGroup;
|
||||
Line.push_back(curEntry);
|
||||
|
||||
|
@ -559,10 +560,10 @@ void AssFile::InsertAttachment (AssAttachment *attach) {
|
|||
// Otherwise, create the [Fonts] group and insert
|
||||
else {
|
||||
int version=1;
|
||||
AddLine(_T(""),Line.back()->group,version);
|
||||
AddLine("",Line.back()->group,version);
|
||||
AddLine(attach->group,attach->group,version);
|
||||
Line.push_back(attach);
|
||||
AddLine(_T(""),attach->group,version);
|
||||
AddLine("",attach->group,version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,7 +641,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
|
|||
// Found
|
||||
if (curText.StartsWith(key)) {
|
||||
// Set value
|
||||
if (value != _T("")) {
|
||||
if (value != "") {
|
||||
wxString result = _key;
|
||||
result += _T(": ");
|
||||
result += value;
|
||||
|
@ -660,7 +661,7 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) {
|
|||
|
||||
// Add
|
||||
else if (GotIn) {
|
||||
if (value != _T("")) {
|
||||
if (value != "") {
|
||||
wxString result = _key;
|
||||
result += _T(": ");
|
||||
result += value;
|
||||
|
@ -762,7 +763,7 @@ wxString AssFile::GetWildcardList(int mode) {
|
|||
if (mode == 0) return SubtitleFormat::GetWildcards(0);
|
||||
else if (mode == 1) return _T("Advanced Substation Alpha (*.ass)|*.ass");
|
||||
else if (mode == 2) return SubtitleFormat::GetWildcards(1);
|
||||
else return _T("");
|
||||
else return "";
|
||||
}
|
||||
|
||||
int AssFile::Commit(wxString desc, int amendId) {
|
||||
|
@ -844,9 +845,7 @@ void AssFile::Sort(std::list<AssEntry*> &lst, CompFunc comp) {
|
|||
entryIter end = begin;
|
||||
while (end != lst.end() && dynamic_cast<AssDialogue*>(*end)) ++end;
|
||||
|
||||
// std::list::sort doesn't support sorting only part of the list, but
|
||||
// splice is constant-time, so just sort a temp list with only the part we
|
||||
// want sorted
|
||||
// used instead of std::list::sort for partial list sorting
|
||||
std::list<AssEntry*> tmp;
|
||||
tmp.splice(tmp.begin(), lst, begin, end);
|
||||
tmp.sort(compE);
|
||||
|
|
|
@ -322,6 +322,13 @@ bool operator != (const AssTime &t1, const AssTime &t2) {
|
|||
return (t1.GetMS() != t2.GetMS());
|
||||
}
|
||||
|
||||
AssTime operator + (const AssTime &t1, const AssTime &t2) {
|
||||
return AssTime(t1.GetMS() + t2.GetMS());
|
||||
}
|
||||
|
||||
AssTime operator - (const AssTime &t1, const AssTime &t2) {
|
||||
return AssTime(t1.GetMS() - t2.GetMS());
|
||||
}
|
||||
|
||||
|
||||
/// DOCME
|
||||
|
|
|
@ -72,8 +72,8 @@ public:
|
|||
int GetTimeMiliseconds();
|
||||
int GetTimeCentiseconds();
|
||||
|
||||
int GetMS() const; // Returns miliseconds
|
||||
void SetMS(int ms); // Sets values to miliseconds
|
||||
int GetMS() const; // Returns milliseconds
|
||||
void SetMS(int ms); // Sets values to milliseconds
|
||||
void ParseASS(const wxString text); // Sets value to text-form time, in ASS format
|
||||
void ParseSRT(const wxString text); // Sets value to text-form time, in SRT format
|
||||
wxString GetASSFormated(bool ms=false) const; // Returns the ASS representation of time
|
||||
|
@ -87,6 +87,9 @@ bool operator < (const AssTime &t1, const AssTime &t2);
|
|||
bool operator > (const AssTime &t1, const AssTime &t2);
|
||||
bool operator <= (const AssTime &t1, const AssTime &t2);
|
||||
bool operator >= (const AssTime &t1, const AssTime &t2);
|
||||
// Arithmetic operators
|
||||
AssTime operator + (const AssTime &t1, const AssTime &t2);
|
||||
AssTime operator - (const AssTime &t1, const AssTime &t2);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "main.h"
|
||||
#include "standard_paths.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "timeedit_ctrl.h"
|
||||
#include "utils.h"
|
||||
|
@ -2320,8 +2321,8 @@ void AudioDisplay::OnLoseFocus(wxFocusEvent &event) {
|
|||
|
||||
/// @brief Update time edit controls
|
||||
void AudioDisplay::UpdateTimeEditCtrls() {
|
||||
grid->editBox->StartTime->SetTime(curStartMS,true);
|
||||
grid->editBox->EndTime->SetTime(curEndMS,true);
|
||||
grid->editBox->Duration->SetTime(curEndMS-curStartMS,true);
|
||||
grid->editBox->StartTime->SetTime(curStartMS);
|
||||
grid->editBox->EndTime->SetTime(curEndMS);
|
||||
grid->editBox->Duration->SetTime(curEndMS-curStartMS);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,12 @@
|
|||
#include <wx/sizer.h>
|
||||
#endif
|
||||
|
||||
#include "base_grid.h"
|
||||
|
||||
#include "ass_dialogue.h"
|
||||
#include "ass_file.h"
|
||||
#include "ass_style.h"
|
||||
#include "audio_display.h"
|
||||
#include "base_grid.h"
|
||||
#include "compat.h"
|
||||
#include "frame_main.h"
|
||||
#include "main.h"
|
||||
|
@ -1112,10 +1113,10 @@ int BaseGrid::GetDialogueIndex(AssDialogue *diag) const {
|
|||
bool BaseGrid::IsDisplayed(AssDialogue *line) {
|
||||
VideoContext* con = VideoContext::Get();
|
||||
if (!con->IsLoaded()) return false;
|
||||
int f1 = con->FrameAtTime(line->Start.GetMS(),agi::vfr::START);
|
||||
int f2 = con->FrameAtTime(line->End.GetMS(),agi::vfr::END);
|
||||
if (f1 <= con->GetFrameN() && f2 >= con->GetFrameN()) return true;
|
||||
return false;
|
||||
int frame = con->GetFrameN();
|
||||
return
|
||||
con->FrameAtTime(line->Start.GetMS(),agi::vfr::START) <= frame &&
|
||||
con->FrameAtTime(line->End.GetMS(),agi::vfr::END) >= frame;
|
||||
}
|
||||
|
||||
/// @brief Key press
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "dialog_resample.h"
|
||||
#include "help_button.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_grid.h"
|
||||
#include "utils.h"
|
||||
#include "validators.h"
|
||||
|
@ -323,7 +322,6 @@ void DialogResample::OnResample (wxCommandEvent &event) {
|
|||
// Flag as modified
|
||||
subs->Commit(_("resolution resampling"));
|
||||
grid->CommitChanges();
|
||||
grid->editBox->Update();
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "frame_main.h"
|
||||
#include "main.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "video_display.h"
|
||||
|
||||
|
@ -545,7 +546,6 @@ void SearchReplaceEngine::ReplaceAll() {
|
|||
if (count > 0) {
|
||||
grid->ass->Commit(_("replace"));
|
||||
grid->CommitChanges();
|
||||
grid->editBox->Update();
|
||||
wxMessageBox(wxString::Format(_("%i matches were replaced."),count));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "libresrc/libresrc.h"
|
||||
#include "main.h"
|
||||
#include "standard_paths.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_grid.h"
|
||||
#include "utils.h"
|
||||
#include "video_context.h"
|
||||
|
@ -312,7 +311,6 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
|||
// End dialog
|
||||
grid->ass->Commit(_("shifting"));
|
||||
grid->CommitChanges();
|
||||
grid->editBox->Update();
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "main.h"
|
||||
#include "spellchecker_manager.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "hotkeys.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "utils.h"
|
||||
#include "video_context.h"
|
||||
|
|
|
@ -33,26 +33,17 @@
|
|||
/// @see dialog_translation.cpp
|
||||
/// @ingroup tools_ui///
|
||||
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
// Headers
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/stattext.h>
|
||||
#endif
|
||||
|
||||
#include "scintilla_text_ctrl.h"
|
||||
|
||||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class AssFile;
|
||||
class AssDialogue;
|
||||
class SubtitlesGrid;
|
||||
class AudioDisplay;
|
||||
class ScintillaTextCtrl;
|
||||
class SubtitlesGrid;
|
||||
class VideoContext;
|
||||
|
||||
|
||||
|
@ -126,8 +117,6 @@ public:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class DialogTranslationEvent
|
||||
/// @brief DOCME
|
||||
|
@ -147,23 +136,11 @@ public:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
///////
|
||||
// IDs
|
||||
/// Event IDs
|
||||
enum {
|
||||
|
||||
/// DOCME
|
||||
TEXT_ORIGINAL = 1100,
|
||||
|
||||
/// DOCME
|
||||
TEXT_TRANS,
|
||||
|
||||
/// DOCME
|
||||
PREVIEW_CHECK,
|
||||
|
||||
/// DOCME
|
||||
BUTTON_TRANS_PLAY_AUDIO,
|
||||
|
||||
/// DOCME
|
||||
BUTTON_TRANS_PLAY_VIDEO
|
||||
};
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
#include "main.h"
|
||||
#include "standard_paths.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "text_file_reader.h"
|
||||
#include "text_file_writer.h"
|
||||
|
@ -604,8 +605,7 @@ void FrameMain::InitContents() {
|
|||
|
||||
// Top sizer
|
||||
StartupLog(_T("Create subtitle editing box"));
|
||||
EditBox = new SubsEditBox(Panel,SubsGrid);
|
||||
EditBox->audio = audioBox->audioDisplay;
|
||||
EditBox = new SubsEditBox(Panel,SubsGrid, audioBox->audioDisplay);
|
||||
StartupLog(_T("Arrange controls in sizers"));
|
||||
ToolSizer = new wxBoxSizer(wxVERTICAL);
|
||||
ToolSizer->Add(audioBox,0,wxEXPAND | wxBOTTOM,5);
|
||||
|
@ -863,7 +863,6 @@ void FrameMain::SetDisplayMode(int video, int audio) {
|
|||
|
||||
// Update
|
||||
UpdateToolbar();
|
||||
EditBox->SetSplitLineMode();
|
||||
MainSizer->CalcMin();
|
||||
MainSizer->RecalcSizes();
|
||||
MainSizer->Layout();
|
||||
|
@ -1138,7 +1137,7 @@ void FrameMain::LoadVideo(wxString file,bool autoload) {
|
|||
}
|
||||
}
|
||||
|
||||
SubsGrid->CommitChanges(true);
|
||||
SubsGrid->CommitChanges();
|
||||
SetDisplayMode(1,-1);
|
||||
EditBox->UpdateFrameTiming();
|
||||
|
||||
|
@ -1229,7 +1228,6 @@ void FrameMain::SetAccelerators() {
|
|||
entry.push_back(Hotkeys.GetAccelerator(_T("Video global zoom in"),Menu_Video_Zoom_In));
|
||||
entry.push_back(Hotkeys.GetAccelerator(_T("Video global zoom out"),Menu_Video_Zoom_Out));
|
||||
entry.push_back(Hotkeys.GetAccelerator(_T("Video global play"),Video_Frame_Play));
|
||||
entry.push_back(Hotkeys.GetAccelerator(_T("Edit box commit"),Edit_Box_Commit));
|
||||
|
||||
// Medusa
|
||||
bool medusaPlay = OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool();
|
||||
|
|
|
@ -266,7 +266,6 @@ private:
|
|||
void OnSortStart (wxCommandEvent &event);
|
||||
void OnSortEnd (wxCommandEvent &event);
|
||||
void OnSortStyle (wxCommandEvent &event);
|
||||
void OnEditBoxCommit (wxCommandEvent &event);
|
||||
void OnOpenProperties (wxCommandEvent &event);
|
||||
void OnOpenStylesManager (wxCommandEvent &event);
|
||||
void OnOpenAttachments (wxCommandEvent &event);
|
||||
|
@ -508,7 +507,6 @@ enum {
|
|||
Grid_Prev_Line,
|
||||
Grid_Toggle_Tags,
|
||||
|
||||
Edit_Box_Commit,
|
||||
|
||||
Video_Frame_Play,
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
#include "preferences.h"
|
||||
#include "standard_paths.h"
|
||||
#include "subs_edit_box.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
#include "subs_grid.h"
|
||||
#include "toggle_bitmap.h"
|
||||
#include "utils.h"
|
||||
|
@ -223,7 +224,6 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
|
|||
EVT_MENU(Grid_Next_Line,FrameMain::OnNextLine)
|
||||
EVT_MENU(Grid_Prev_Line,FrameMain::OnPrevLine)
|
||||
EVT_MENU(Grid_Toggle_Tags,FrameMain::OnToggleTags)
|
||||
EVT_MENU(Edit_Box_Commit,FrameMain::OnEditBoxCommit)
|
||||
|
||||
EVT_MENU(Medusa_Play, FrameMain::OnMedusaPlay)
|
||||
EVT_MENU(Medusa_Stop, FrameMain::OnMedusaStop)
|
||||
|
@ -574,7 +574,6 @@ void FrameMain::OnLog(wxCommandEvent &) {
|
|||
log->Show(1);
|
||||
}
|
||||
|
||||
|
||||
/// @brief Open check updates
|
||||
void FrameMain::OnCheckUpdates(wxCommandEvent &) {
|
||||
PerformVersionCheck(true);
|
||||
|
@ -1056,7 +1055,7 @@ void FrameMain::OnAutomationMacro (wxCommandEvent &event) {
|
|||
// Have the grid update its maps, this properly refreshes it to reflect the changed subs
|
||||
SubsGrid->UpdateMaps();
|
||||
SubsGrid->SetSelectionFromAbsolute(selected_lines);
|
||||
SubsGrid->CommitChanges(true, false);
|
||||
SubsGrid->CommitChanges();
|
||||
SubsGrid->EndBatch();
|
||||
#endif
|
||||
}
|
||||
|
@ -1155,8 +1154,8 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &) {
|
|||
|
||||
// Commit
|
||||
SubsGrid->ass->Commit(_("shift to frame"));
|
||||
SubsGrid->CommitChanges();
|
||||
SubsGrid->editBox->Update(true,false);
|
||||
SubsGrid->CommitChanges(false);
|
||||
SubsGrid->editBox->Update(true);
|
||||
}
|
||||
|
||||
/// @brief Undo
|
||||
|
@ -1474,32 +1473,6 @@ void FrameMain::OnSetTags(wxCommandEvent &event) {
|
|||
SubsGrid->Refresh(false);
|
||||
}
|
||||
|
||||
/// @brief Commit Edit Box's changes
|
||||
/// @param event
|
||||
void FrameMain::OnEditBoxCommit(wxCommandEvent &event) {
|
||||
// Find focus
|
||||
wxWindow *focus = FindFocus();
|
||||
if (!focus) return;
|
||||
|
||||
// Is the text edit
|
||||
if (focus == EditBox->TextEdit) {
|
||||
EditBox->Commit(true);
|
||||
EditBox->Update(true);
|
||||
}
|
||||
|
||||
// Other window
|
||||
else {
|
||||
//wxKeyEvent keyevent;
|
||||
//keyevent.m_keyCode = WXK_RETURN;
|
||||
//keyevent.m_controlDown = true;
|
||||
//keyevent.SetEventType(wxEVT_KEY_DOWN);
|
||||
wxCommandEvent keyevent(wxEVT_COMMAND_TEXT_ENTER,focus->GetId());
|
||||
focus->GetEventHandler()->AddPendingEvent(keyevent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Choose a different language
|
||||
void FrameMain::OnChooseLanguage (wxCommandEvent &) {
|
||||
// Get language
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from 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/
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file hilimod_textctrl.cpp
|
||||
/// @brief Edit control that changes colour when its contents are modified
|
||||
/// @ingroup custom_control
|
||||
///
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#include "config.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "hilimod_textctrl.h"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
/// @brief Constructor
|
||||
/// @param parent
|
||||
/// @param id
|
||||
/// @param value
|
||||
/// @param pos
|
||||
/// @param size
|
||||
/// @param style
|
||||
/// @param validator
|
||||
/// @param name
|
||||
///
|
||||
HiliModTextCtrl::HiliModTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) :
|
||||
wxTextCtrl(parent,id,value,pos,size,style,validator,name)
|
||||
{
|
||||
UpdateLocked = false;
|
||||
isModified = false;
|
||||
orig = GetValue();
|
||||
|
||||
Connect(wxEVT_COMMAND_TEXT_UPDATED,wxCommandEventHandler(HiliModTextCtrl::OnModified));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Modified event
|
||||
/// @param event
|
||||
/// @return
|
||||
///
|
||||
void HiliModTextCtrl::OnModified(wxCommandEvent &event) {
|
||||
if (UpdateLocked) return;
|
||||
Modified();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Commited event
|
||||
///
|
||||
void HiliModTextCtrl::Commited() {
|
||||
if (isModified) {
|
||||
orig = GetValue();
|
||||
SetBackgroundColour(wxNullColour);
|
||||
Refresh(false);
|
||||
isModified = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Set value
|
||||
/// @param value
|
||||
///
|
||||
void HiliModTextCtrl::SetValue(const wxString& value) {
|
||||
UpdateLocked = true;
|
||||
orig = value;
|
||||
wxTextCtrl::SetValue(value);
|
||||
Commited();
|
||||
UpdateLocked = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Was modified
|
||||
///
|
||||
void HiliModTextCtrl::Modified() {
|
||||
bool match = GetValue() == orig;
|
||||
|
||||
// Different from original
|
||||
if (!isModified && !match) {
|
||||
isModified = true;
|
||||
SetBackgroundColour(lagi_wxColour(OPT_GET("Colour/Background/Modified")->GetColour()));
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
// Same as original
|
||||
if (isModified && match) {
|
||||
SetBackgroundColour(wxNullColour);
|
||||
Refresh(false);
|
||||
isModified = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from 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/
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file hilimod_textctrl.h
|
||||
/// @see hilimod_textctrl.cpp
|
||||
/// @ingroup custom_control
|
||||
///
|
||||
|
||||
|
||||
#ifndef HILIMOD_TEXTCTRL
|
||||
|
||||
/// DOCME
|
||||
#define HILIMOD_TEXTCTRL
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/textctrl.h>
|
||||
#endif
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class HiliModTextCtrl
|
||||
/// @brief DOCME
|
||||
///
|
||||
/// DOCME
|
||||
class HiliModTextCtrl : public wxTextCtrl {
|
||||
private:
|
||||
|
||||
/// DOCME
|
||||
bool UpdateLocked;
|
||||
|
||||
/// DOCME
|
||||
bool isModified;
|
||||
|
||||
|
||||
/// DOCME
|
||||
wxString orig;
|
||||
|
||||
void OnModified(wxCommandEvent &event);
|
||||
void OnKey(wxKeyEvent &event);
|
||||
|
||||
public:
|
||||
HiliModTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
|
||||
|
||||
void Modified();
|
||||
void Commited();
|
||||
void SetValue(const wxString& value);
|
||||
|
||||
/// @brief DOCME
|
||||
///
|
||||
bool HasBeenModified() { return isModified; }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,181 +0,0 @@
|
|||
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from 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/
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file idle_field_event.cpp
|
||||
/// @brief Unused event, intended to be used for automatic update of other controls after some idle time from the user
|
||||
/// @ingroup custom_control
|
||||
///
|
||||
|
||||
|
||||
///////////
|
||||
// Headers
|
||||
#include "config.h"
|
||||
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/event.h>
|
||||
#include <wx/settings.h>
|
||||
#endif
|
||||
|
||||
#include "idle_field_event.h"
|
||||
|
||||
|
||||
/// @brief Constructor
|
||||
/// @param _control
|
||||
/// @param _name
|
||||
///
|
||||
IdleFieldHandler::IdleFieldHandler(wxWindow *_control,wxString _name) {
|
||||
control = _control;
|
||||
name = _name;
|
||||
overriden = false;
|
||||
locked = false;
|
||||
text = NULL;
|
||||
box = NULL;
|
||||
|
||||
// Set colours
|
||||
original = control->GetForegroundColour();
|
||||
grey = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
grey = wxColour((grey.Red() + bg.Red()) / 2,(grey.Green() + bg.Green()) / 2,(grey.Blue() + bg.Blue()) / 2);
|
||||
|
||||
// wxTextCtrl
|
||||
if (control->IsKindOf(CLASSINFO(wxTextCtrl))) {
|
||||
text = (wxTextCtrl*) control;
|
||||
Connect(text->GetId(),wxEVT_COMMAND_TEXT_UPDATED,wxCommandEventHandler(IdleFieldHandler::OnChange));
|
||||
}
|
||||
|
||||
// wxComboBox
|
||||
else if (control->IsKindOf(CLASSINFO(wxComboBox))) {
|
||||
box = (wxComboBox*) control;
|
||||
Connect(box->GetId(),wxEVT_COMMAND_TEXT_UPDATED,wxCommandEventHandler(IdleFieldHandler::OnChange));
|
||||
Connect(box->GetId(),wxEVT_COMMAND_COMBOBOX_SELECTED,wxCommandEventHandler(IdleFieldHandler::OnChange));
|
||||
}
|
||||
|
||||
KillFocus();
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// Event table
|
||||
BEGIN_EVENT_TABLE(IdleFieldHandler,wxEvtHandler)
|
||||
EVT_SET_FOCUS(IdleFieldHandler::OnSetFocus)
|
||||
EVT_KILL_FOCUS(IdleFieldHandler::OnKillFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
/// @brief Get Focus event
|
||||
/// @param event
|
||||
///
|
||||
void IdleFieldHandler::OnSetFocus(wxFocusEvent &event) {
|
||||
SetFocus();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Lose Focus event
|
||||
/// @param event
|
||||
///
|
||||
void IdleFieldHandler::OnKillFocus(wxFocusEvent &event) {
|
||||
KillFocus();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Get focus
|
||||
///
|
||||
void IdleFieldHandler::SetFocus() {
|
||||
if (overriden) {
|
||||
// Prepare
|
||||
locked = true;
|
||||
control->Freeze();
|
||||
control->SetForegroundColour(original);
|
||||
|
||||
// Text
|
||||
if (text) text->SetValue(_T(""));
|
||||
|
||||
// Box
|
||||
if (box) box->SetValue(_T(""));
|
||||
|
||||
// Finish
|
||||
overriden = false;
|
||||
locked = false;
|
||||
control->Thaw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Lose Focus
|
||||
///
|
||||
void IdleFieldHandler::KillFocus() {
|
||||
bool modify = false;
|
||||
if ((text && text->GetValue().IsEmpty()) || (box && box->GetValue().IsEmpty())) modify = true;
|
||||
|
||||
if (modify) {
|
||||
// Prepare
|
||||
locked = true;
|
||||
control->Freeze();
|
||||
control->SetForegroundColour(grey);
|
||||
|
||||
// Text
|
||||
if (text) text->SetValue(name);
|
||||
|
||||
// Box
|
||||
if (box) box->SetValue(name);
|
||||
|
||||
// Finish
|
||||
overriden = true;
|
||||
locked = false;
|
||||
control->Thaw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// @brief Parent control changed
|
||||
/// @param event
|
||||
///
|
||||
void IdleFieldHandler::OnChange(wxCommandEvent &event) {
|
||||
if (locked) return;
|
||||
|
||||
overriden = false;
|
||||
control->SetForegroundColour(original);
|
||||
if (wxWindow::FindFocus() != control) {
|
||||
wxFocusEvent focus(wxEVT_KILL_FOCUS,control->GetId());
|
||||
focus.SetEventObject(control);
|
||||
AddPendingEvent(focus);
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from 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/
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file idle_field_event.h
|
||||
/// @see idle_field_event.cpp
|
||||
/// @ingroup custom_control
|
||||
///
|
||||
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
// Headers
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/textctrl.h>
|
||||
#endif
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class IdleFieldHandler
|
||||
/// @brief DOCME
|
||||
///
|
||||
/// DOCME
|
||||
class IdleFieldHandler : public wxEvtHandler {
|
||||
private:
|
||||
|
||||
/// DOCME
|
||||
wxComboBox *box;
|
||||
|
||||
/// DOCME
|
||||
wxTextCtrl *text;
|
||||
|
||||
/// DOCME
|
||||
bool overriden;
|
||||
|
||||
/// DOCME
|
||||
bool locked;
|
||||
|
||||
/// DOCME
|
||||
wxColour grey;
|
||||
|
||||
/// DOCME
|
||||
wxColour original;
|
||||
|
||||
|
||||
/// DOCME
|
||||
wxWindow *control;
|
||||
|
||||
/// DOCME
|
||||
wxString name;
|
||||
|
||||
void SetFocus();
|
||||
void KillFocus();
|
||||
|
||||
void OnSetFocus(wxFocusEvent &event);
|
||||
void OnKillFocus(wxFocusEvent &event);
|
||||
void OnChange(wxCommandEvent &event);
|
||||
|
||||
public:
|
||||
IdleFieldHandler(wxWindow *control,wxString name);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
@ -34,17 +34,10 @@
|
|||
/// @ingroup custom_control
|
||||
///
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/stc/stc.h>
|
||||
#endif
|
||||
|
||||
|
||||
/// DOCME
|
||||
/// @class ScintillaTextCtrl
|
||||
/// @brief DOCME
|
||||
|
@ -57,10 +50,6 @@ public:
|
|||
int GetUnicodePosition(int pos);
|
||||
int GetReverseUnicodePosition(int pos);
|
||||
|
||||
/// @brief DOCME
|
||||
///
|
||||
wxString GetValue() { return GetText(); }
|
||||
|
||||
void StartUnicodeStyling(int start,int mask=31);
|
||||
void SetUnicodeStyling(int start,int length,int style);
|
||||
void SetSelectionU(int start,int end);
|
||||
|
@ -68,5 +57,3 @@ public:
|
|||
ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
|
||||
virtual ~ScintillaTextCtrl();
|
||||
};
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -34,335 +34,175 @@
|
|||
/// @ingroup main_ui
|
||||
///
|
||||
|
||||
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#ifndef AGI_PRE
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <vector>
|
||||
|
||||
#include <wx/panel.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#endif
|
||||
|
||||
#include "selection_controller.h"
|
||||
#include "subs_edit_ctrl.h"
|
||||
|
||||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class AudioDisplay;
|
||||
class AssDialogue;
|
||||
class SubtitlesGrid;
|
||||
class SubsTextEditCtrl;
|
||||
class TimeEdit;
|
||||
class SubsEditBox;
|
||||
class AudioDisplay;
|
||||
class HiliModTextCtrl;
|
||||
class wxButton;
|
||||
class wxCheckBox;
|
||||
class wxComboBox;
|
||||
class wxRadioButton;
|
||||
class wxSizer;
|
||||
class wxSpinCtrl;
|
||||
class wxStyledTextCtrl;
|
||||
|
||||
|
||||
class wxStyleTextEvent;
|
||||
class wxTextCtrl;
|
||||
|
||||
/// DOCME
|
||||
/// @class SubsEditBox
|
||||
/// @brief DOCME
|
||||
/// @brief Main subtitle edit box
|
||||
///
|
||||
/// DOCME
|
||||
/// Controls the text edit and all surrounding controls
|
||||
class SubsEditBox : public wxPanel, protected SelectionListener<AssDialogue> {
|
||||
friend class SubsTextEditHandler;
|
||||
friend class SubsTextEditCtrl;
|
||||
friend class AudioDisplay;
|
||||
|
||||
private:
|
||||
enum TimeField {
|
||||
TIME_START = 0,
|
||||
TIME_END,
|
||||
TIME_DURATION
|
||||
};
|
||||
|
||||
/// DOCME
|
||||
/// Currently active dialogue line
|
||||
AssDialogue *line;
|
||||
/// Last seen grid selection
|
||||
Selection sel;
|
||||
|
||||
/// Are the buttons currently split into two lines?
|
||||
bool splitLineMode;
|
||||
|
||||
/// DOCME
|
||||
bool setupDone;
|
||||
|
||||
/// DOCME
|
||||
bool enabled;
|
||||
|
||||
/// DOCME
|
||||
bool textEditReady;
|
||||
|
||||
/// DOCME
|
||||
/// Are the controls currently enabled?
|
||||
bool controlState;
|
||||
|
||||
/// DOCME
|
||||
wxColour disabledBgColour;
|
||||
wxColour origBgColour;
|
||||
|
||||
/// DOCME
|
||||
wxColour disabledBgColour;
|
||||
|
||||
|
||||
/// DOCME
|
||||
// Externally supplied controls
|
||||
AudioDisplay *audio;
|
||||
SubtitlesGrid *grid;
|
||||
|
||||
/// DOCME
|
||||
// Box controls
|
||||
wxCheckBox *CommentBox;
|
||||
|
||||
/// DOCME
|
||||
wxComboBox *StyleBox;
|
||||
|
||||
/// DOCME
|
||||
wxComboBox *ActorBox;
|
||||
|
||||
/// DOCME
|
||||
TimeEdit *StartTime;
|
||||
|
||||
/// DOCME
|
||||
TimeEdit *EndTime;
|
||||
|
||||
/// DOCME
|
||||
TimeEdit *Duration;
|
||||
|
||||
/// DOCME
|
||||
wxSpinCtrl *Layer;
|
||||
|
||||
/// DOCME
|
||||
HiliModTextCtrl *MarginL;
|
||||
|
||||
/// DOCME
|
||||
HiliModTextCtrl *MarginR;
|
||||
|
||||
/// DOCME
|
||||
HiliModTextCtrl *MarginV;
|
||||
|
||||
/// DOCME
|
||||
HiliModTextCtrl *Effect;
|
||||
|
||||
/// DOCME
|
||||
wxTextCtrl *MarginL;
|
||||
wxTextCtrl *MarginR;
|
||||
wxTextCtrl *MarginV;
|
||||
wxTextCtrl *Effect;
|
||||
wxRadioButton *ByTime;
|
||||
|
||||
/// DOCME
|
||||
wxRadioButton *ByFrame;
|
||||
|
||||
/// DOCME
|
||||
wxCheckBox *SyntaxHighlight;
|
||||
/// Buttons which turn on or off with the control
|
||||
std::vector<wxButton*> ToggableButtons;
|
||||
|
||||
|
||||
/// DOCME
|
||||
wxButton *Bold;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Italics;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Underline;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Strikeout;
|
||||
|
||||
/// DOCME
|
||||
wxButton *FontName;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Color1;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Color2;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Color3;
|
||||
|
||||
/// DOCME
|
||||
wxButton *Color4;
|
||||
|
||||
/// DOCME
|
||||
wxButton *CommitButton;
|
||||
|
||||
|
||||
/// DOCME
|
||||
wxSizer *TopSizer;
|
||||
|
||||
/// DOCME
|
||||
wxSizer *MiddleBotSizer;
|
||||
|
||||
/// DOCME
|
||||
wxSizer *MiddleSizer;
|
||||
|
||||
/// DOCME
|
||||
wxSizer *MainSizer;
|
||||
|
||||
/// DOCME
|
||||
wxSizer *DummySizer;
|
||||
|
||||
/// DOCME
|
||||
wxSizer *BottomSizer;
|
||||
|
||||
void SetControlsState(bool state);
|
||||
void CommitTimes(bool start,bool end,bool fromStart,bool commit=true);
|
||||
/// @brief Update times of selected lines
|
||||
/// @param field Field which changed
|
||||
void CommitTimes(TimeField field);
|
||||
/// @brief Commits the current edit box contents
|
||||
/// @param desc Undo description to use
|
||||
void CommitText(wxString desc);
|
||||
|
||||
int BlockAtPos(int pos);
|
||||
/// Get block number at text position
|
||||
int BlockAtPos(int pos) const;
|
||||
|
||||
/// @brief Refresh the video display and move to the next line
|
||||
/// @param stay Only refresh the video
|
||||
void Commit(bool stay);
|
||||
|
||||
int timeCommitId[3];
|
||||
int commitId;
|
||||
wxString lastCommitType;
|
||||
|
||||
void OnEditText(wxStyledTextEvent &event);
|
||||
void OnNeedStyle(wxStyledTextEvent &event);
|
||||
void OnCharAdded(wxStyledTextEvent &event);
|
||||
void OnUpdateUI(wxStyledTextEvent &event);
|
||||
void OnChange(wxStyledTextEvent &event);
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
|
||||
void OnButtonColor1(wxCommandEvent &event);
|
||||
void OnButtonColor2(wxCommandEvent &event);
|
||||
void OnButtonColor3(wxCommandEvent &event);
|
||||
void OnButtonColor4(wxCommandEvent &event);
|
||||
void OnButtonFontFace(wxCommandEvent &event);
|
||||
void OnButtonBold(wxCommandEvent &event);
|
||||
void OnButtonItalics(wxCommandEvent &event);
|
||||
void OnButtonUnderline(wxCommandEvent &event);
|
||||
void OnButtonStrikeout(wxCommandEvent &event);
|
||||
void OnButtonCommit(wxCommandEvent &event);
|
||||
void OnActiveLineChanged(AssDialogue *new_line);
|
||||
void OnSelectedSetChanged(const Selection &, const Selection &);
|
||||
|
||||
void OnSyntaxBox(wxCommandEvent &event);
|
||||
void OnFrameRadio(wxCommandEvent &event);
|
||||
void OnTimeRadio(wxCommandEvent &event);
|
||||
void OnKeyDown(wxStyledTextEvent &event);
|
||||
void OnFrameTimeRadio(wxCommandEvent &event);
|
||||
void OnStyleChange(wxCommandEvent &event);
|
||||
void OnActorChange(wxCommandEvent &event);
|
||||
void OnLayerEnter(wxCommandEvent &event);
|
||||
void OnLayerChange(wxSpinEvent &event);
|
||||
void OnStartTimeChange(wxCommandEvent &event);
|
||||
void OnEndTimeChange(wxCommandEvent &event);
|
||||
void OnDurationChange(wxCommandEvent &event);
|
||||
void OnMarginLChange(wxCommandEvent &event);
|
||||
void OnMarginRChange(wxCommandEvent &event);
|
||||
void OnMarginVChange(wxCommandEvent &event);
|
||||
void OnCommentChange(wxCommandEvent &event);
|
||||
void OnEffectChange(wxCommandEvent &event);
|
||||
void OnStartTimeChange(wxCommandEvent &);
|
||||
void OnEndTimeChange(wxCommandEvent &);
|
||||
void OnDurationChange(wxCommandEvent &);
|
||||
void OnMarginLChange(wxCommandEvent &);
|
||||
void OnMarginRChange(wxCommandEvent &);
|
||||
void OnMarginVChange(wxCommandEvent &);
|
||||
void OnCommentChange(wxCommandEvent &);
|
||||
void OnEffectChange(wxCommandEvent &);
|
||||
void OnSize(wxSizeEvent &event);
|
||||
|
||||
protected:
|
||||
// SubtitleSelectionListener implementation
|
||||
virtual void OnActiveLineChanged(AssDialogue *new_line);
|
||||
virtual void OnSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed);
|
||||
void OnFlagButton(wxCommandEvent &event);
|
||||
void OnColorButton(wxCommandEvent &event);
|
||||
void OnFontButton(wxCommandEvent &event);
|
||||
void OnCommitButton(wxCommandEvent &);
|
||||
|
||||
/// @brief Set the value of a tag for the currently selected text
|
||||
/// @param tag Tag to set
|
||||
/// @param value New value of tag
|
||||