Fonts collector now flags the file as modified if set to attach to file.

Originally committed to SVN as r479.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-08 23:07:24 +00:00
parent b02de858a2
commit caa2dbb01b
2 changed files with 19 additions and 2 deletions

View File

@ -48,6 +48,8 @@
#include "fonts_collector.h" #include "fonts_collector.h"
#include "utils.h" #include "utils.h"
#include "options.h" #include "options.h"
#include "frame_main.h"
#include "subs_grid.h"
/////////////// ///////////////
@ -55,6 +57,9 @@
DialogFontsCollector::DialogFontsCollector(wxWindow *parent) DialogFontsCollector::DialogFontsCollector(wxWindow *parent)
: wxDialog(parent,-1,_("Fonts Collector"),wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) : wxDialog(parent,-1,_("Fonts Collector"),wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{ {
// Parent
main = (FrameMain*) parent;
// Destination box // Destination box
wxString dest = Options.AsText(_T("Fonts Collector Destination")); wxString dest = Options.AsText(_T("Fonts Collector Destination"));
if (dest == _T("?script")) { if (dest == _T("?script")) {
@ -314,6 +319,7 @@ void FontsCollectorThread::Collect() {
wxMutexGuiLeave(); wxMutexGuiLeave();
// Scans file // Scans file
bool fileModified = false;
AssStyle *curStyle; AssStyle *curStyle;
AssDialogue *curDiag; AssDialogue *curDiag;
curLine = 0; curLine = 0;
@ -400,8 +406,11 @@ void FontsCollectorThread::Collect() {
// Copy font // Copy font
bool success; bool success;
if (attaching) { if (attaching) {
success = true; try {
try { subs->InsertAttachment(srcFile); } subs->InsertAttachment(srcFile);
fileModified = true;
success = true;
}
catch (...) { success = false; } catch (...) { success = false; }
} }
else success = Copy(srcFile,dstFile); else success = Copy(srcFile,dstFile);
@ -434,4 +443,10 @@ void FontsCollectorThread::Collect() {
} }
} }
#endif #endif
// Flag file as modified
if (fileModified) {
subs->FlagAsModified();
collector->main->SubsBox->CommitChanges();
}
} }

View File

@ -48,6 +48,7 @@
class AssFile; class AssFile;
class AssOverrideParameter; class AssOverrideParameter;
class DialogFontsCollector; class DialogFontsCollector;
class FrameMain;
//////////// ////////////
@ -94,6 +95,7 @@ private:
wxButton *StartButton; wxButton *StartButton;
wxButton *CloseButton; wxButton *CloseButton;
wxCheckBox *AttachmentCheck; wxCheckBox *AttachmentCheck;
FrameMain *main;
void OnStart(wxCommandEvent &event); void OnStart(wxCommandEvent &event);
void OnClose(wxCommandEvent &event); void OnClose(wxCommandEvent &event);