Remove the SubsEditBox from the context in favor of the SubsEditTextCtrl as it was the only public member of SubsEditBox

Originally committed to SVN as r5595.
This commit is contained in:
Thomas Goyne 2011-09-15 05:17:07 +00:00
parent d022d2ae56
commit 1f095b0a01
11 changed files with 20 additions and 27 deletions

View file

@ -57,7 +57,6 @@
#include "compat.h"
#include "frame_main.h"
#include "main.h"
#include "subs_edit_box.h"
#include "utils.h"
#include "video_context.h"
#include "video_slider.h"

View file

@ -50,7 +50,6 @@
#include "../ass_file.h"
#include "../dialog_search_replace.h"
#include "../include/aegisub/context.h"
#include "../subs_edit_box.h"
#include "../subs_edit_ctrl.h"
#include "../subs_grid.h"
#include "../video_context.h"
@ -82,8 +81,8 @@ struct edit_line_copy : public validate_sel_nonempty {
STR_HELP("Copy subtitles.")
void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox->TextEdit) {
c->editBox->TextEdit->Copy();
if (c->parent->FindFocus() == c->editBox) {
c->editBox->Copy();
return;
}
c->subsGrid->CopyLines(c->subsGrid->GetSelection());
@ -99,8 +98,8 @@ struct edit_line_cut: public validate_sel_nonempty {
STR_HELP("Cut subtitles.")
void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox->TextEdit) {
c->editBox->TextEdit->Cut();
if (c->parent->FindFocus() == c->editBox) {
c->editBox->Cut();
return;
}
c->subsGrid->CutLines(c->subsGrid->GetSelection());
@ -251,8 +250,8 @@ struct edit_line_paste : public Command {
}
void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox->TextEdit) {
c->editBox->TextEdit->Paste();
if (c->parent->FindFocus() == c->editBox) {
c->editBox->Paste();
return;
}
c->subsGrid->PasteLines(c->subsGrid->GetFirstSelRow());

View file

@ -45,10 +45,9 @@
#include "command.h"
#include "../include/aegisub/context.h"
#include "../video_context.h"
#include "../main.h"
#include "../compat.h"
#include "../subs_edit_box.h"
#include "../main.h"
#include "../video_context.h"
namespace {
using cmd::Command;

View file

@ -50,7 +50,6 @@
#include "frame_main.h"
#include "main.h"
#include "selection_controller.h"
#include "subs_edit_box.h"
#include "subs_edit_ctrl.h"
#include "subs_grid.h"
#include "video_display.h"
@ -454,7 +453,7 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
context->subsGrid->MakeCellVisible(curLine,0);
if (field == 0) {
context->subsGrid->SetActiveLine(context->subsGrid->GetDialogue(curLine));
context->editBox->TextEdit->SetSelectionU(pos,pos+replaceLen);
context->editBox->SetSelectionU(pos,pos+replaceLen);
}
// Update video

View file

@ -36,11 +36,11 @@
#include "ass_file.h"
#include "compat.h"
#include "help_button.h"
#include "libresrc/libresrc.h"
#include "main.h"
#include "include/aegisub/context.h"
#include "include/aegisub/spellchecker.h"
#include "subs_edit_box.h"
#include "libresrc/libresrc.h"
#include "main.h"
#include "selection_controller.h"
#include "subs_edit_ctrl.h"
#include "utils.h"
@ -191,7 +191,7 @@ void DialogSpellChecker::OnClose(wxCommandEvent&) {
bool DialogSpellChecker::FindNext() {
AssDialogue *active_line = context->selectionController->GetActiveLine();
int start_pos = context->editBox->TextEdit->GetReverseUnicodePosition(context->editBox->TextEdit->GetCurrentPos());
int start_pos = context->editBox->GetReverseUnicodePosition(context->editBox->GetCurrentPos());
int commit_id = -1;
if (CheckLine(active_line, start_pos, &commit_id))
@ -266,7 +266,7 @@ void DialogSpellChecker::Replace() {
if (active_line->Text.Mid(word_start, word_end - word_start) == orig_word->GetValue()) {
active_line->Text = active_line->Text.Left(word_start) + replace_word->GetValue() + active_line->Text.Mid(word_end);
context->ass->Commit(_("spell check replace"), AssFile::COMMIT_DIAG_TEXT);
context->editBox->TextEdit->SetCurrentPos(context->editBox->TextEdit->GetUnicodePosition(word_start + replace_word->GetValue().size()));
context->editBox->SetCurrentPos(context->editBox->GetUnicodePosition(word_start + replace_word->GetValue().size()));
}
}
@ -278,8 +278,8 @@ void DialogSpellChecker::SetWord(wxString const& word) {
suggest_list->Clear();
suggest_list->Append(suggestions);
context->editBox->TextEdit->SetSelectionU(word_start, word_end);
context->editBox->TextEdit->SetCurrentPos(context->editBox->TextEdit->GetUnicodePosition(word_end));
context->editBox->SetSelectionU(word_start, word_end);
context->editBox->SetCurrentPos(context->editBox->GetUnicodePosition(word_end));
add_button->Enable(spellchecker->CanAddWord(word));
}

View file

@ -274,7 +274,8 @@ void FrameMain::InitContents() {
audioSash->SetMinimumSizeY(audioBox->GetSize().GetHeight());
StartupLog("Create subtitle editing box");
context->editBox = EditBox = new SubsEditBox(Panel, context.get());
EditBox = new SubsEditBox(Panel, context.get());
context->editBox = EditBox->TextEdit;
StartupLog("Arrange main sizers");
ToolsSizer = new wxBoxSizer(wxVERTICAL);

View file

@ -6,7 +6,7 @@ class DialogDetachedVideo;
class DialogStyling;
class DialogTranslation;
template<class T> class SelectionController;
class SubsEditBox;
class SubsTextEditCtrl;
class SubtitlesGrid;
class VideoBox;
class VideoContext;
@ -34,7 +34,7 @@ struct Context {
DialogDetachedVideo *detachedVideo;
DialogStyling *stylingAssistant;
DialogTranslation *translationAssistant;
SubsEditBox *editBox;
SubsTextEditCtrl *editBox;
SubtitlesGrid *subsGrid;
VideoBox *videoBox;
};

View file

@ -60,7 +60,6 @@
#include "dialog_paste_over.h"
#include "frame_main.h"
#include "main.h"
#include "subs_edit_box.h"
#include "subs_grid.h"
#include "utils.h"
#include "video_context.h"

View file

@ -53,7 +53,6 @@
#include "libresrc/libresrc.h"
#include "main.h"
#include "selection_controller.h"
#include "subs_edit_box.h"
#include "subs_grid.h"
#include "toggle_bitmap.h"
#include "tooltip_manager.h"

View file

@ -71,7 +71,6 @@
#include "mkv_wrap.h"
#include "selection_controller.h"
#include "standard_paths.h"
#include "subs_edit_box.h"
#include "threaded_frame_source.h"
#include "utils.h"
#include "video_context.h"

View file

@ -47,7 +47,6 @@
#include "ass_time.h"
#include "include/aegisub/context.h"
#include "main.h"
#include "subs_edit_box.h"
#include "subs_grid.h"
#include "utils.h"
#include "video_context.h"