Aegisub/src/dialog_translation.h

80 lines
2.4 KiB
C
Raw Normal View History

// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
2006-01-16 22:02:54 +01: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
//
// 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
//
// Aegisub Project http://www.aegisub.org/
#include <libaegisub/exception.h>
#include <libaegisub/signal.h>
2013-06-10 15:58:13 +02:00
#include <memory>
#include <vector>
#include <wx/dialog.h>
namespace agi { struct Context; }
2006-01-16 22:02:54 +01:00
class AssDialogue;
class AssDialogueBlock;
class PersistLocation;
class SubsTextEditCtrl;
class wxCheckBox;
class wxStaticText;
class wxStyledTextCtrl;
2006-01-16 22:02:54 +01:00
/// Assistant for translating subtitles in one language to another language
class DialogTranslation final : public wxDialog {
agi::Context *c;
agi::signal::Connection file_change_connection;
agi::signal::Connection active_line_connection;
/// The active line
AssDialogue *active_line;
/// The parsed dialogue blocks for the active line
std::vector<std::unique_ptr<AssDialogueBlock>> blocks;
/// Which dialogue block in the active line is currently being translated
2013-12-12 01:29:48 +01:00
size_t cur_block = 0;
/// Total number of dialogue lines in the file
size_t line_count;
2006-01-16 22:02:54 +01:00
/// Should active line change announcements be ignored?
2013-12-12 01:29:48 +01:00
bool switching_lines = false;
wxStaticText *line_number_display;
wxStyledTextCtrl *original_text;
SubsTextEditCtrl *translated_text;
wxCheckBox *seek_video;
2006-01-16 22:02:54 +01:00
2013-06-10 15:58:13 +02:00
std::unique_ptr<PersistLocation> persist;
2006-01-16 22:02:54 +01:00
void OnPlayAudioButton(wxCommandEvent &);
void OnPlayVideoButton(wxCommandEvent &);
void OnKeyDown(wxKeyEvent &evt);
void OnExternalCommit(int commit_type);
void UpdateDisplay();
2006-01-16 22:02:54 +01:00
void OnActiveLineChanged(AssDialogue *new_line);
2006-01-16 22:02:54 +01:00
public:
DialogTranslation(agi::Context *context);
~DialogTranslation();
2006-01-16 22:02:54 +01:00
bool NextBlock();
bool PrevBlock();
void Commit(bool next);
void InsertOriginal();
struct NothingToTranslate { };
2006-01-16 22:02:54 +01:00
};