mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Added copy+paste to style manager, ctrl+c/v only (so far, anyway)
Originally committed to SVN as r925.
This commit is contained in:
parent
56c7891baf
commit
caea5872b4
@ -101,7 +101,7 @@ Please visit http://aegisub.net to download latest version
|
|||||||
- Made the video display detachable. (AMZ)
|
- Made the video display detachable. (AMZ)
|
||||||
- Undo and redo now have descriptions. (Dansolo)
|
- Undo and redo now have descriptions. (Dansolo)
|
||||||
- The three different "Recombine Lines" were merged into one that autodetects needed changes, and also supports two new cases. (AMZ)
|
- The three different "Recombine Lines" were merged into one that autodetects needed changes, and also supports two new cases. (AMZ)
|
||||||
|
- Added shortcut keys (escape to close and delete to delete a style, plus ctrl+c/v for copy/paste) to style manager. (Dansolo)
|
||||||
|
|
||||||
= 1.10 beta - 2006.08.07 ===========================
|
= 1.10 beta - 2006.08.07 ===========================
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ Please visit http://aegisub.net to download latest version
|
|||||||
- Implemented sorting of subtitles by start time. (AMZ)
|
- Implemented sorting of subtitles by start time. (AMZ)
|
||||||
- Recovered subtitle files are now saved in their own subfolder (customizeable in config.dat). (AMZ)
|
- Recovered subtitle files are now saved in their own subfolder (customizeable in config.dat). (AMZ)
|
||||||
- Fixed crash with changing font properties via the subtitle edit box when there was a \fs override tag earlier in the line. (AMZ)
|
- Fixed crash with changing font properties via the subtitle edit box when there was a \fs override tag earlier in the line. (AMZ)
|
||||||
- Added shortcut keys (escape to close and delete to delete a style) to style manager. (Dansolo)
|
|
||||||
|
|
||||||
= 1.09 beta - 2006.01.16 ===========================
|
= 1.09 beta - 2006.01.16 ===========================
|
||||||
|
|
||||||
|
@ -619,6 +619,74 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////
|
||||||
|
// Copy to clipboard
|
||||||
|
void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector<AssStyle*> v) {
|
||||||
|
wxString data = _T("");
|
||||||
|
AssStyle *s;
|
||||||
|
wxArrayInt selections;
|
||||||
|
list->GetSelections(selections);
|
||||||
|
|
||||||
|
for(int unsigned i=0;i<selections.size();i++) {
|
||||||
|
if (i!=0) data += _T("\r\n");
|
||||||
|
s = v.at(selections[i]);
|
||||||
|
s->UpdateData();
|
||||||
|
data += s->GetEntryData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wxTheClipboard->Open()) {
|
||||||
|
wxTheClipboard->SetData(new wxTextDataObject(data));
|
||||||
|
wxTheClipboard->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////////////////////////
|
||||||
|
// Paste from clipboard
|
||||||
|
void DialogStyleManager::PasteToCurrent() {
|
||||||
|
wxString data = _T("");
|
||||||
|
|
||||||
|
if (wxTheClipboard->Open()) {
|
||||||
|
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
||||||
|
wxTextDataObject rawdata;
|
||||||
|
wxTheClipboard->GetData(rawdata);
|
||||||
|
data = rawdata.GetText();
|
||||||
|
}
|
||||||
|
wxTheClipboard->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxStringTokenizer st(data,_T('\n'));
|
||||||
|
while (st.HasMoreTokens()) {
|
||||||
|
AssStyle *s = new AssStyle(st.GetNextToken().Trim(true));
|
||||||
|
if (s->Valid) {
|
||||||
|
AssFile::top->InsertStyle(s);
|
||||||
|
LoadCurrentStyles(AssFile::top);
|
||||||
|
}
|
||||||
|
grid->ass->FlagAsModified(_("style paste"));
|
||||||
|
grid->CommitChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void DialogStyleManager::PasteToStorage() {
|
||||||
|
wxString data = _T("");
|
||||||
|
|
||||||
|
if (wxTheClipboard->Open()) {
|
||||||
|
if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
||||||
|
wxTextDataObject rawdata;
|
||||||
|
wxTheClipboard->GetData(rawdata);
|
||||||
|
data = rawdata.GetText();
|
||||||
|
}
|
||||||
|
wxTheClipboard->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxStringTokenizer st(data,_T('\n'));
|
||||||
|
while (st.HasMoreTokens()) {
|
||||||
|
AssStyle *s = new AssStyle(st.GetNextToken().Trim(true));
|
||||||
|
if (s->Valid) {
|
||||||
|
Store.style.push_back(s);
|
||||||
|
Store.Save(CatalogList->GetString(CatalogList->GetSelection()));
|
||||||
|
}
|
||||||
|
LoadStorageStyles();
|
||||||
|
StorageList->SetStringSelection(s->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
///////////////
|
///////////////
|
||||||
// Storage new
|
// Storage new
|
||||||
void DialogStyleManager::OnStorageNew (wxCommandEvent &event) {
|
void DialogStyleManager::OnStorageNew (wxCommandEvent &event) {
|
||||||
@ -1017,6 +1085,32 @@ void DialogStyleManager::OnKeyDown(wxKeyEvent &event) {
|
|||||||
OnCurrentDelete(evt);
|
OnCurrentDelete(evt);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'C' :
|
||||||
|
case 'c' :
|
||||||
|
if (event.ControlDown()) {
|
||||||
|
if (wxWindow::FindFocus()==CurrentList) {
|
||||||
|
CopyToClipboard(CurrentList,styleMap);
|
||||||
|
}
|
||||||
|
else if (wxWindow::FindFocus()==StorageList) {
|
||||||
|
CopyToClipboard(StorageList,styleStorageMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'V' :
|
||||||
|
case 'v' :
|
||||||
|
if (event.ControlDown()) {
|
||||||
|
if (wxWindow::FindFocus()==CurrentList) {
|
||||||
|
PasteToCurrent();
|
||||||
|
}
|
||||||
|
else if (wxWindow::FindFocus()==StorageList) {
|
||||||
|
PasteToStorage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//////////////////
|
//////////////////
|
||||||
|
@ -130,6 +130,10 @@ public:
|
|||||||
void OnCurrentDelete (wxCommandEvent &event);
|
void OnCurrentDelete (wxCommandEvent &event);
|
||||||
void OnCurrentImport (wxCommandEvent &event);
|
void OnCurrentImport (wxCommandEvent &event);
|
||||||
void OnKeyDown (wxKeyEvent &event);
|
void OnKeyDown (wxKeyEvent &event);
|
||||||
|
void CopyToClipboard (wxListBox *list, std::vector<AssStyle*> v);
|
||||||
|
void PasteToCurrent();
|
||||||
|
void PasteToStorage();
|
||||||
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user