MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / paste_lines

Function paste_lines

src/command/edit.cpp:116–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115template<typename Paster>
116void paste_lines(agi::Context *c, bool paste_over, Paster&& paste_line) {
117 std::string data = GetClipboard();
118 if (data.empty()) return;
119
120 AssDialogue *first = nullptr;
121 Selection newsel;
122
123 boost::char_separator<char> sep("\r\n");
124 for (auto curdata : boost::tokenizer<boost::char_separator<char>>(data, sep)) {
125 AssDialogue *inserted = paste_line(get_dialogue(curdata));
126 if (!inserted)
127 break;
128
129 newsel.insert(inserted);
130 if (!first)
131 first = inserted;
132 }
133
134 if (first) {
135 c->ass->Commit(_("paste"), paste_over ? AssFile::COMMIT_DIAG_FULL : AssFile::COMMIT_DIAG_ADDREM);
136
137 if (!paste_over)
138 c->selectionController->SetSelectionAndActive(std::move(newsel), first);
139 }
140}
141
142bool paste_over(wxWindow *parent, std::vector<bool>& pasteOverOptions, AssDialogue &new_line, AssDialogue &old_line) {
143 if (pasteOverOptions.empty()) {

Callers 2

operator()Method · 0.85
operator()Function · 0.85

Calls 4

GetClipboardFunction · 0.85
get_dialogueFunction · 0.85
SetSelectionAndActiveMethod · 0.80
CommitMethod · 0.45

Tested by

no test coverage detected