Forward Cut/Copy/Paste to all text areas, not just the main subs edit box

Originally committed to SVN as r6576.
This commit is contained in:
Thomas Goyne 2012-03-12 23:34:25 +00:00
parent 42b1d4d4eb
commit 14274a7672

View file

@ -95,11 +95,17 @@ struct edit_line_copy : public validate_sel_nonempty {
STR_HELP("Copy subtitles") STR_HELP("Copy subtitles")
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox) { // Ideally we'd let the control's keydown handler run and only deal
c->editBox->Copy(); // with the events not processed by it, but that doesn't seem to be
return; // possible with how wx implements key event handling - the native
} // platform processing is evoked only if the wx event is unprocessed,
c->subsGrid->CopyLines(c->subsGrid->GetSelection()); // and there's no way to do something if the native platform code leaves
// it unprocessed
if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus()))
ctrl->Copy();
else
c->subsGrid->CopyLines(c->subsGrid->GetSelection());
} }
}; };
@ -112,11 +118,10 @@ struct edit_line_cut: public validate_sel_nonempty {
STR_HELP("Cut subtitles") STR_HELP("Cut subtitles")
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox) { if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus()))
c->editBox->Cut(); ctrl->Cut();
return; else
} c->subsGrid->CutLines(c->subsGrid->GetSelection());
c->subsGrid->CutLines(c->subsGrid->GetSelection());
} }
}; };
@ -316,11 +321,10 @@ struct edit_line_paste : public Command {
} }
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
if (c->parent->FindFocus() == c->editBox) { if (wxTextEntryBase *ctrl = dynamic_cast<wxTextEntryBase*>(c->parent->FindFocus()))
c->editBox->Paste(); ctrl->Paste();
return; else
} c->subsGrid->PasteLines(c->subsGrid->GetFirstSelRow());
c->subsGrid->PasteLines(c->subsGrid->GetFirstSelRow());
} }
}; };