Eliminate almost all uses of AssFile::top.
Originally committed to SVN as r4669.
This commit is contained in:
parent
5e22a0f151
commit
c40aa7080a
20 changed files with 137 additions and 224 deletions
|
@ -1014,9 +1014,8 @@ namespace Automation4 {
|
||||||
description = wxString(lua_tostring(L, 1), wxConvUTF8);
|
description = wxString(lua_tostring(L, 1), wxConvUTF8);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
AssFile::top->Commit(description);
|
laf->ass->Commit(description);
|
||||||
|
|
||||||
laf->ass = AssFile::top; // make sure we're still working on the most recent undo point
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -981,18 +981,6 @@ void BaseGrid::SetColumnWidths() {
|
||||||
endLen = fw + 10;
|
endLen = fw + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Style length
|
|
||||||
if (false && AssFile::top) {
|
|
||||||
AssStyle *curStyle;
|
|
||||||
for (entryIter curIter=AssFile::top->Line.begin();curIter!=AssFile::top->Line.end();curIter++) {
|
|
||||||
curStyle = dynamic_cast<AssStyle*>(*curIter);
|
|
||||||
if (curStyle) {
|
|
||||||
dc.GetTextExtent(curStyle->name, &fw, &fh, NULL, NULL, &font);
|
|
||||||
if (fw > styleLen) styleLen = fw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish actor/effect/style
|
// Finish actor/effect/style
|
||||||
if (actorLen) actorLen += 10;
|
if (actorLen) actorLen += 10;
|
||||||
if (effectLen) effectLen += 10;
|
if (effectLen) effectLen += 10;
|
||||||
|
|
|
@ -62,8 +62,9 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
DialogAttachments::DialogAttachments(wxWindow *parent)
|
DialogAttachments::DialogAttachments(wxWindow *parent, AssFile *ass)
|
||||||
: wxDialog(parent,-1,_("Attachment List"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE)
|
: wxDialog(parent,-1,_("Attachment List"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE)
|
||||||
|
, ass(ass)
|
||||||
{
|
{
|
||||||
// Set icon
|
// Set icon
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(attach_button_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(attach_button_24)));
|
||||||
|
@ -111,7 +112,7 @@ void DialogAttachments::UpdateList() {
|
||||||
|
|
||||||
// Fill list
|
// Fill list
|
||||||
AssAttachment *attach;
|
AssAttachment *attach;
|
||||||
for (std::list<AssEntry*>::iterator cur = AssFile::top->Line.begin();cur != AssFile::top->Line.end();cur++) {
|
for (std::list<AssEntry*>::iterator cur = ass->Line.begin();cur != ass->Line.end();cur++) {
|
||||||
attach = dynamic_cast<AssAttachment*>(*cur);
|
attach = dynamic_cast<AssAttachment*>(*cur);
|
||||||
if (attach) {
|
if (attach) {
|
||||||
// Add item
|
// Add item
|
||||||
|
@ -132,14 +133,14 @@ DialogAttachments::~DialogAttachments() {
|
||||||
|
|
||||||
// Remove empty attachments sections from the file
|
// Remove empty attachments sections from the file
|
||||||
|
|
||||||
std::list<AssEntry*>::iterator cur = AssFile::top->Line.end();
|
std::list<AssEntry*>::iterator cur = ass->Line.end();
|
||||||
--cur;
|
--cur;
|
||||||
|
|
||||||
bool found_attachments = false;
|
bool found_attachments = false;
|
||||||
bool removed_any = false;
|
bool removed_any = false;
|
||||||
wxString last_section_name;
|
wxString last_section_name;
|
||||||
|
|
||||||
while (cur != AssFile::top->Line.begin()) {
|
while (cur != ass->Line.begin()) {
|
||||||
if (!((*cur)->group == L"[Fonts]" || (*cur)->group == L"[Graphics]"))
|
if (!((*cur)->group == L"[Fonts]" || (*cur)->group == L"[Graphics]"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -151,15 +152,15 @@ DialogAttachments::~DialogAttachments() {
|
||||||
// found section heading with no attachments in, remove it
|
// found section heading with no attachments in, remove it
|
||||||
wxString delgroup = (*cur)->group;
|
wxString delgroup = (*cur)->group;
|
||||||
std::list<AssEntry*>::iterator di = cur;
|
std::list<AssEntry*>::iterator di = cur;
|
||||||
while (++di != AssFile::top->Line.end() && (*di)->group == delgroup) {
|
while (++di != ass->Line.end() && (*di)->group == delgroup) {
|
||||||
delete *di;
|
delete *di;
|
||||||
AssFile::top->Line.erase(di);
|
ass->Line.erase(di);
|
||||||
di = cur;
|
di = cur;
|
||||||
}
|
}
|
||||||
di = cur;
|
di = cur;
|
||||||
--cur;
|
--cur;
|
||||||
delete *di;
|
delete *di;
|
||||||
AssFile::top->Line.erase(di);
|
ass->Line.erase(di);
|
||||||
removed_any = true;
|
removed_any = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +175,7 @@ DialogAttachments::~DialogAttachments() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removed_any) {
|
if (removed_any) {
|
||||||
AssFile::top->Commit(_("remove empty attachments sections"));
|
ass->Commit(_("remove empty attachments sections"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,10 +221,10 @@ void DialogAttachments::OnAttachFont(wxCommandEvent &event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newAttach->group = _T("[Fonts]");
|
newAttach->group = _T("[Fonts]");
|
||||||
AssFile::top->InsertAttachment(newAttach);
|
ass->InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssFile::top->Commit(_("attach font file"));
|
ass->Commit(_("attach font file"));
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
UpdateList();
|
UpdateList();
|
||||||
|
@ -258,10 +259,10 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newAttach->group = _T("[Graphics]");
|
newAttach->group = _T("[Graphics]");
|
||||||
AssFile::top->InsertAttachment(newAttach);
|
ass->InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssFile::top->Commit(_("attach graphics file"));
|
ass->Commit(_("attach graphics file"));
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
UpdateList();
|
UpdateList();
|
||||||
|
@ -312,11 +313,11 @@ void DialogAttachments::OnDelete(wxCommandEvent &event) {
|
||||||
// Loop through items in list
|
// Loop through items in list
|
||||||
int i = listView->GetFirstSelected();
|
int i = listView->GetFirstSelected();
|
||||||
while (i != -1) {
|
while (i != -1) {
|
||||||
AssFile::top->Line.remove((AssEntry*)wxUIntToPtr(listView->GetItemData(i)));
|
ass->Line.remove((AssEntry*)wxUIntToPtr(listView->GetItemData(i)));
|
||||||
i = listView->GetNextSelected(i);
|
i = listView->GetNextSelected(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssFile::top->Commit(_("remove attachment"));
|
ass->Commit(_("remove attachment"));
|
||||||
|
|
||||||
// Update list
|
// Update list
|
||||||
UpdateList();
|
UpdateList();
|
||||||
|
|
|
@ -34,27 +34,17 @@
|
||||||
/// @ingroup tools_ui
|
/// @ingroup tools_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
class AssFile;
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class wxListView;
|
class wxListView;
|
||||||
class wxListEvent;
|
class wxListEvent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogAttachments
|
/// @class DialogAttachments
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class DialogAttachments : public wxDialog {
|
class DialogAttachments : public wxDialog {
|
||||||
private:
|
AssFile *ass;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxListView *listView;
|
wxListView *listView;
|
||||||
|
@ -74,31 +64,17 @@ private:
|
||||||
void UpdateList();
|
void UpdateList();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogAttachments(wxWindow *parent);
|
DialogAttachments(wxWindow *parent, AssFile *ass);
|
||||||
~DialogAttachments();
|
~DialogAttachments();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Event IDs
|
||||||
///////
|
|
||||||
// IDs
|
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
BUTTON_ATTACH_FONT = 1300,
|
BUTTON_ATTACH_FONT = 1300,
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
BUTTON_ATTACH_GRAPHICS,
|
BUTTON_ATTACH_GRAPHICS,
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
BUTTON_EXTRACT,
|
BUTTON_EXTRACT,
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
BUTTON_DELETE,
|
BUTTON_DELETE,
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
ATTACHMENT_LIST
|
ATTACHMENT_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,12 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
DialogExport::DialogExport (wxWindow *parent)
|
DialogExport::DialogExport (wxWindow *parent, AssFile *subs)
|
||||||
: wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, _T("Export"))
|
: wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, _T("Export"))
|
||||||
{
|
{
|
||||||
// Filter list
|
// Filter list
|
||||||
wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters"));
|
wxSizer *TopSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Filters"));
|
||||||
Export = new AssExporter(AssFile::top);
|
Export = new AssExporter(subs);
|
||||||
wxArrayString filters = Export->GetAllFilterNames();
|
wxArrayString filters = Export->GetAllFilterNames();
|
||||||
FilterList = new wxCheckListBox(this, Filter_List_Box, wxDefaultPosition, wxSize(200,100), filters);
|
FilterList = new wxCheckListBox(this, Filter_List_Box, wxDefaultPosition, wxSize(200,100), filters);
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ private:
|
||||||
void RefreshOptions();
|
void RefreshOptions();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogExport(wxWindow *parent);
|
DialogExport(wxWindow *parent, AssFile *subs);
|
||||||
~DialogExport();
|
~DialogExport();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
|
@ -88,8 +88,9 @@ DEFINE_EVENT_TYPE(EVT_ADD_TEXT)
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
DialogFontsCollector::DialogFontsCollector(wxWindow *parent)
|
DialogFontsCollector::DialogFontsCollector(wxWindow *parent, AssFile *ass)
|
||||||
: wxDialog(parent,-1,_("Fonts Collector"),wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
: wxDialog(parent,-1,_("Fonts Collector"),wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
|
, subs(ass)
|
||||||
{
|
{
|
||||||
// Set icon
|
// Set icon
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(font_collector_button_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(font_collector_button_24)));
|
||||||
|
@ -100,7 +101,7 @@ DialogFontsCollector::DialogFontsCollector(wxWindow *parent)
|
||||||
// Destination box
|
// Destination box
|
||||||
wxString dest = lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString());
|
wxString dest = lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString());
|
||||||
if (dest == _T("?script")) {
|
if (dest == _T("?script")) {
|
||||||
wxFileName filename(AssFile::top->filename);
|
wxFileName filename(subs->filename);
|
||||||
dest = filename.GetPath();
|
dest = filename.GetPath();
|
||||||
}
|
}
|
||||||
while (dest.Right(1) == _T("/")) dest = dest.Left(dest.Length()-1);
|
while (dest.Right(1) == _T("/")) dest = dest.Left(dest.Length()-1);
|
||||||
|
@ -232,14 +233,14 @@ void DialogFontsCollector::OnStart(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start thread
|
// Start thread
|
||||||
wxThread *worker = new FontsCollectorThread(AssFile::top,foldername,this);
|
wxThread *worker = new FontsCollectorThread(subs,foldername,this);
|
||||||
worker->Create();
|
worker->Create();
|
||||||
worker->Run();
|
worker->Run();
|
||||||
|
|
||||||
// Set options
|
// Set options
|
||||||
if (action == 1 || action == 2) {
|
if (action == 1 || action == 2) {
|
||||||
wxString dest = foldername;
|
wxString dest = foldername;
|
||||||
wxFileName filename(AssFile::top->filename);
|
wxFileName filename(subs->filename);
|
||||||
if (filename.GetPath() == dest) {
|
if (filename.GetPath() == dest) {
|
||||||
dest = _T("?script");
|
dest = _T("?script");
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,6 @@
|
||||||
/// @ingroup tools_ui font_collector
|
/// @ingroup tools_ui font_collector
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Includes
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
|
@ -48,9 +43,6 @@
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class AssFile;
|
class AssFile;
|
||||||
class AssOverrideParameter;
|
class AssOverrideParameter;
|
||||||
class DialogFontsCollector;
|
class DialogFontsCollector;
|
||||||
|
@ -58,16 +50,12 @@ class FrameMain;
|
||||||
class wxZipOutputStream;
|
class wxZipOutputStream;
|
||||||
class ScintillaTextCtrl;
|
class ScintillaTextCtrl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class FontsCollectorThread
|
/// @class FontsCollectorThread
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class FontsCollectorThread : public wxThread {
|
class FontsCollectorThread : public wxThread {
|
||||||
private:
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
AssFile *subs;
|
AssFile *subs;
|
||||||
|
|
||||||
|
@ -114,8 +102,6 @@ public:
|
||||||
static void GetFonts (wxString tagName,int par_n,AssOverrideParameter *param,void *usr);
|
static void GetFonts (wxString tagName,int par_n,AssOverrideParameter *param,void *usr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogFontsCollector
|
/// @class DialogFontsCollector
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -124,7 +110,7 @@ public:
|
||||||
class DialogFontsCollector : public wxDialog {
|
class DialogFontsCollector : public wxDialog {
|
||||||
friend class FontsCollectorThread;
|
friend class FontsCollectorThread;
|
||||||
|
|
||||||
private:
|
AssFile *subs;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxTextCtrl *DestBox;
|
wxTextCtrl *DestBox;
|
||||||
|
@ -158,7 +144,7 @@ private:
|
||||||
void Update(int value=-1);
|
void Update(int value=-1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogFontsCollector(wxWindow *parent);
|
DialogFontsCollector(wxWindow *parent, AssFile *subs);
|
||||||
~DialogFontsCollector();
|
~DialogFontsCollector();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
|
@ -829,7 +829,7 @@ DialogKanjiTimer::DialogKanjiTimer(wxWindow *parent, SubtitlesGrid *_grid)
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(kara_timing_copier_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(kara_timing_copier_24)));
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
subs = AssFile::top;
|
subs = _grid->ass;
|
||||||
grid = _grid;
|
grid = _grid;
|
||||||
currentSourceLine = subs->Line.begin();
|
currentSourceLine = subs->Line.begin();
|
||||||
currentDestinationLine = subs->Line.begin();
|
currentDestinationLine = subs->Line.begin();
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup secondary_ui
|
/// @ingroup secondary_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -61,15 +58,13 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param parent
|
/// @param parent
|
||||||
///
|
///
|
||||||
DialogProperties::DialogProperties (wxWindow *parent)
|
DialogProperties::DialogProperties (wxWindow *parent, AssFile *subs)
|
||||||
: wxDialog(parent, -1, _("Script Properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
: wxDialog(parent, -1, _("Script Properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
|
, subs(subs)
|
||||||
{
|
{
|
||||||
// Set icon
|
// Set icon
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(properties_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(properties_toolbutton_24)));
|
||||||
|
|
||||||
// Setup
|
|
||||||
AssFile *subs = AssFile::top;
|
|
||||||
|
|
||||||
// Script details crap
|
// Script details crap
|
||||||
wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Script"));
|
wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Script"));
|
||||||
wxStaticText *TitleLabel = new wxStaticText(this,-1,_("Title:"));
|
wxStaticText *TitleLabel = new wxStaticText(this,-1,_("Title:"));
|
||||||
|
@ -173,23 +168,16 @@ DialogProperties::DialogProperties (wxWindow *parent)
|
||||||
CenterOnParent();
|
CenterOnParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
DialogProperties::~DialogProperties () {
|
DialogProperties::~DialogProperties () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
|
||||||
// Event table
|
|
||||||
BEGIN_EVENT_TABLE(DialogProperties,wxDialog)
|
BEGIN_EVENT_TABLE(DialogProperties,wxDialog)
|
||||||
EVT_BUTTON(wxID_OK,DialogProperties::OnOK)
|
EVT_BUTTON(wxID_OK,DialogProperties::OnOK)
|
||||||
EVT_BUTTON(BUTTON_FROM_VIDEO,DialogProperties::OnSetFromVideo)
|
EVT_BUTTON(BUTTON_FROM_VIDEO,DialogProperties::OnSetFromVideo)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Apply changes
|
/// @brief Apply changes
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
///
|
||||||
|
@ -211,23 +199,17 @@ void DialogProperties::OnOK(wxCommandEvent &event) {
|
||||||
count += SetInfoIfDifferent(_T("Collisions"),col[collision->GetSelection()]);
|
count += SetInfoIfDifferent(_T("Collisions"),col[collision->GetSelection()]);
|
||||||
count += SetInfoIfDifferent(_T("ScaledBorderAndShadow"),ScaleBorder->GetValue()? _T("yes") : _T("no"));
|
count += SetInfoIfDifferent(_T("ScaledBorderAndShadow"),ScaleBorder->GetValue()? _T("yes") : _T("no"));
|
||||||
|
|
||||||
if (count) AssFile::top->Commit(_("property changes"));
|
if (count) subs->Commit(_("property changes"));
|
||||||
|
|
||||||
EndModal(count?1:0);
|
EndModal(count?1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Only set script info if it changed
|
/// @brief Only set script info if it changed
|
||||||
/// @param key
|
/// @param key
|
||||||
/// @param value
|
/// @param value
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) {
|
int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) {
|
||||||
// Get script
|
|
||||||
AssFile *subs = AssFile::top;
|
|
||||||
|
|
||||||
// Compare
|
|
||||||
if (subs->GetScriptInfo(key) != value) {
|
if (subs->GetScriptInfo(key) != value) {
|
||||||
subs->SetScriptInfo(key,value);
|
subs->SetScriptInfo(key,value);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -235,8 +217,6 @@ int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) {
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set res to match video
|
/// @brief Set res to match video
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
///
|
||||||
|
@ -245,5 +225,3 @@ void DialogProperties::OnSetFromVideo(wxCommandEvent &event) {
|
||||||
ResY->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetHeight()));
|
ResY->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetHeight()));
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,17 +34,13 @@
|
||||||
/// @ingroup secondary_ui
|
/// @ingroup secondary_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class AssFile;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DialogProperties
|
/// @class DialogProperties
|
||||||
|
@ -52,7 +48,7 @@
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class DialogProperties : public wxDialog {
|
class DialogProperties : public wxDialog {
|
||||||
private:
|
AssFile *subs;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxTextCtrl *TitleEdit;
|
wxTextCtrl *TitleEdit;
|
||||||
|
@ -106,19 +102,13 @@ private:
|
||||||
int SetInfoIfDifferent(wxString key,wxString value);
|
int SetInfoIfDifferent(wxString key,wxString value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogProperties(wxWindow *parent);
|
DialogProperties(wxWindow *parent, AssFile *subs);
|
||||||
~DialogProperties();
|
~DialogProperties();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///////
|
|
||||||
// IDs
|
// IDs
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
BUTTON_FROM_VIDEO = 1100
|
BUTTON_FROM_VIDEO = 1100
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ DialogResample::DialogResample(wxWindow *parent, SubtitlesGrid *_grid)
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(resample_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(resample_toolbutton_24)));
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
AssFile *subs = AssFile::top;
|
AssFile *subs = _grid->ass;
|
||||||
grid = _grid;
|
grid = _grid;
|
||||||
|
|
||||||
// Margins
|
// Margins
|
||||||
|
@ -224,7 +224,7 @@ void DialogResample::DoResampleTags (wxString name,int n,AssOverrideParameter *c
|
||||||
///
|
///
|
||||||
void DialogResample::OnResample (wxCommandEvent &event) {
|
void DialogResample::OnResample (wxCommandEvent &event) {
|
||||||
// Resolutions
|
// Resolutions
|
||||||
AssFile *subs = AssFile::top;
|
AssFile *subs = grid->ass;
|
||||||
int x1,y1;
|
int x1,y1;
|
||||||
subs->GetResolution(x1,y1);
|
subs->GetResolution(x1,y1);
|
||||||
long x2 = 0;
|
long x2 = 0;
|
||||||
|
|
|
@ -260,7 +260,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
if (didSomething) {
|
if (didSomething) {
|
||||||
if (backward) len = -len;
|
if (backward) len = -len;
|
||||||
wxString message = _T("");
|
wxString message = _T("");
|
||||||
wxFileName assfile(AssFile::top->filename);
|
wxFileName assfile(grid->ass->filename);
|
||||||
wxString filename = assfile.GetFullName();
|
wxString filename = assfile.GetFullName();
|
||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
|
@ -581,7 +581,7 @@ void DialogStyleEditor::Apply (bool apply,bool close) {
|
||||||
*style = *work;
|
*style = *work;
|
||||||
style->UpdateData();
|
style->UpdateData();
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
AssFile::top->Commit(_("style change"));
|
grid->ass->Commit(_("style change"));
|
||||||
grid->CommitChanges();
|
grid->CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
|
|
||||||
// Populate lists
|
// Populate lists
|
||||||
LoadCatalog();
|
LoadCatalog();
|
||||||
LoadCurrentStyles(AssFile::top);
|
LoadCurrentStyles(grid->ass);
|
||||||
|
|
||||||
//Set key handlers for lists
|
//Set key handlers for lists
|
||||||
CatalogList->PushEventHandler(new DialogStyleManagerEvent(this));
|
CatalogList->PushEventHandler(new DialogStyleManagerEvent(this));
|
||||||
|
@ -227,7 +227,7 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
DialogStyleManager::~DialogStyleManager() {
|
DialogStyleManager::~DialogStyleManager() {
|
||||||
int sel = CatalogList->GetSelection();
|
int sel = CatalogList->GetSelection();
|
||||||
if (sel != wxNOT_FOUND) {
|
if (sel != wxNOT_FOUND) {
|
||||||
AssFile::top->SetScriptInfo(_T("Last Style Storage"),CatalogList->GetString(sel));
|
grid->ass->SetScriptInfo(_T("Last Style Storage"),CatalogList->GetString(sel));
|
||||||
}
|
}
|
||||||
CatalogList->PopEventHandler(true);
|
CatalogList->PopEventHandler(true);
|
||||||
StorageList->PopEventHandler(true);
|
StorageList->PopEventHandler(true);
|
||||||
|
@ -268,7 +268,7 @@ void DialogStyleManager::LoadCatalog () {
|
||||||
|
|
||||||
// Set to default if available
|
// Set to default if available
|
||||||
StorageActions(false);
|
StorageActions(false);
|
||||||
wxString pickStyle = AssFile::top->GetScriptInfo(_T("Last Style Storage"));
|
wxString pickStyle = grid->ass->GetScriptInfo(_T("Last Style Storage"));
|
||||||
if (pickStyle.IsEmpty()) pickStyle = _T("Default");
|
if (pickStyle.IsEmpty()) pickStyle = _T("Default");
|
||||||
int opt = CatalogList->FindString(pickStyle, false);
|
int opt = CatalogList->FindString(pickStyle, false);
|
||||||
if (opt != wxNOT_FOUND) {
|
if (opt != wxNOT_FOUND) {
|
||||||
|
@ -568,11 +568,11 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &) {
|
||||||
}
|
}
|
||||||
if (addStyle) {
|
if (addStyle) {
|
||||||
AssStyle *temp = new AssStyle(*styleStorageMap.at(selections[i]));
|
AssStyle *temp = new AssStyle(*styleStorageMap.at(selections[i]));
|
||||||
AssFile::top->InsertStyle(temp);
|
grid->ass->InsertStyle(temp);
|
||||||
copied.push_back(styleName);
|
copied.push_back(styleName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LoadCurrentStyles(AssFile::top);
|
LoadCurrentStyles(grid->ass);
|
||||||
for (list<wxString>::iterator name = copied.begin(); name != copied.end(); ++name) {
|
for (list<wxString>::iterator name = copied.begin(); name != copied.end(); ++name) {
|
||||||
CurrentList->SetStringSelection(*name, true);
|
CurrentList->SetStringSelection(*name, true);
|
||||||
}
|
}
|
||||||
|
@ -619,8 +619,8 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &) {
|
||||||
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
||||||
int modified = editor.ShowModal();
|
int modified = editor.ShowModal();
|
||||||
if (modified) {
|
if (modified) {
|
||||||
AssFile::top->InsertStyle(temp);
|
grid->ass->InsertStyle(temp);
|
||||||
LoadCurrentStyles(AssFile::top);
|
LoadCurrentStyles(grid->ass);
|
||||||
CurrentList->SetStringSelection(temp->name); // but even without this, the copy/delete/copy-to-storage buttons stay enabled?
|
CurrentList->SetStringSelection(temp->name); // but even without this, the copy/delete/copy-to-storage buttons stay enabled?
|
||||||
}
|
}
|
||||||
else delete temp;
|
else delete temp;
|
||||||
|
@ -671,12 +671,12 @@ void DialogStyleManager::PasteToCurrent() {
|
||||||
try {
|
try {
|
||||||
s = new AssStyle(st.GetNextToken().Trim(true));
|
s = new AssStyle(st.GetNextToken().Trim(true));
|
||||||
if (s->Valid) {
|
if (s->Valid) {
|
||||||
while (AssFile::top->GetStyle(s->name) != NULL)
|
while (grid->ass->GetStyle(s->name) != NULL)
|
||||||
s->name = _T("Copy of ") + s->name;
|
s->name = _T("Copy of ") + s->name;
|
||||||
|
|
||||||
s->UpdateData();
|
s->UpdateData();
|
||||||
AssFile::top->InsertStyle(s);
|
grid->ass->InsertStyle(s);
|
||||||
LoadCurrentStyles(AssFile::top);
|
LoadCurrentStyles(grid->ass);
|
||||||
|
|
||||||
grid->ass->Commit(_("style paste"));
|
grid->ass->Commit(_("style paste"));
|
||||||
grid->CommitChanges();
|
grid->CommitChanges();
|
||||||
|
@ -753,8 +753,8 @@ void DialogStyleManager::OnCurrentNew (wxCommandEvent &) {
|
||||||
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
DialogStyleEditor editor(this,temp,grid,true,&Store,true);
|
||||||
int modified = editor.ShowModal();
|
int modified = editor.ShowModal();
|
||||||
if (modified) {
|
if (modified) {
|
||||||
AssFile::top->InsertStyle(temp);
|
grid->ass->InsertStyle(temp);
|
||||||
LoadCurrentStyles(AssFile::top);
|
LoadCurrentStyles(grid->ass);
|
||||||
}
|
}
|
||||||
else delete temp;
|
else delete temp;
|
||||||
UpdateMoveButtons();
|
UpdateMoveButtons();
|
||||||
|
@ -869,7 +869,7 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
||||||
// The GetString->FindString mess is a silly workaround for the fact that to vsfilter
|
// The GetString->FindString mess is a silly workaround for the fact that to vsfilter
|
||||||
// (and the duplicate check a few lines above), style names aren't case sensitive, but to the
|
// (and the duplicate check a few lines above), style names aren't case sensitive, but to the
|
||||||
// rest of Aegisub they are.
|
// rest of Aegisub they are.
|
||||||
*(AssFile::top->GetStyle(CurrentList->GetString(CurrentList->FindString(styles[selections[i]], false)))) = *temp.GetStyle(styles[selections[i]]);
|
*(grid->ass->GetStyle(CurrentList->GetString(CurrentList->FindString(styles[selections[i]], false)))) = *temp.GetStyle(styles[selections[i]]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -878,7 +878,7 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
|
||||||
modified = true;
|
modified = true;
|
||||||
AssStyle *tempStyle = new AssStyle;
|
AssStyle *tempStyle = new AssStyle;
|
||||||
*tempStyle = *temp.GetStyle(styles[selections[i]]);
|
*tempStyle = *temp.GetStyle(styles[selections[i]]);
|
||||||
AssFile::top->InsertStyle(tempStyle);
|
grid->ass->InsertStyle(tempStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
@ -963,7 +963,7 @@ void DialogStyleManager::OnCurrentSort (wxCommandEvent &) { MoveStyles(false,4);
|
||||||
/// @param type
|
/// @param type
|
||||||
void DialogStyleManager::MoveStyles(bool storage, int type) {
|
void DialogStyleManager::MoveStyles(bool storage, int type) {
|
||||||
// Variables
|
// Variables
|
||||||
AssFile *subs = AssFile::top;
|
AssFile *subs = grid->ass;
|
||||||
wxListBox *list;
|
wxListBox *list;
|
||||||
if (storage) list = StorageList;
|
if (storage) list = StorageList;
|
||||||
else list = CurrentList;
|
else list = CurrentList;
|
||||||
|
|
|
@ -570,7 +570,7 @@ void FrameMain::InitMenu() {
|
||||||
|
|
||||||
/// @brief Initialize contents
|
/// @brief Initialize contents
|
||||||
void FrameMain::InitContents() {
|
void FrameMain::InitContents() {
|
||||||
AssFile::top = new AssFile;
|
AssFile::top = ass = new AssFile;
|
||||||
// Set a background panel
|
// Set a background panel
|
||||||
StartupLog(_T("Create background panel"));
|
StartupLog(_T("Create background panel"));
|
||||||
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
Panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);
|
||||||
|
@ -589,7 +589,7 @@ void FrameMain::InitContents() {
|
||||||
|
|
||||||
// Subtitles area
|
// Subtitles area
|
||||||
StartupLog(_T("Create subtitles grid"));
|
StartupLog(_T("Create subtitles grid"));
|
||||||
SubsGrid = new SubtitlesGrid(this,Panel,-1,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
|
SubsGrid = new SubtitlesGrid(this,Panel,-1,ass,wxDefaultPosition,wxSize(600,100),wxWANTS_CHARS | wxSUNKEN_BORDER,_T("Subs grid"));
|
||||||
BottomSizer->Add(SubsGrid,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0);
|
BottomSizer->Add(SubsGrid,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,0);
|
||||||
videoBox->videoSlider->grid = SubsGrid;
|
videoBox->videoSlider->grid = SubsGrid;
|
||||||
VideoContext::Get()->grid = SubsGrid;
|
VideoContext::Get()->grid = SubsGrid;
|
||||||
|
@ -637,7 +637,7 @@ void FrameMain::DeInitContents() {
|
||||||
SubsGrid->ClearMaps();
|
SubsGrid->ClearMaps();
|
||||||
delete EditBox;
|
delete EditBox;
|
||||||
delete videoBox;
|
delete videoBox;
|
||||||
delete AssFile::top;
|
delete ass;
|
||||||
HelpButton::ClearPages();
|
HelpButton::ClearPages();
|
||||||
VideoContext::Get()->audio = NULL;
|
VideoContext::Get()->audio = NULL;
|
||||||
}
|
}
|
||||||
|
@ -670,7 +670,7 @@ void FrameMain::UpdateToolbar() {
|
||||||
/// @param charset
|
/// @param charset
|
||||||
void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
// First check if there is some loaded
|
// First check if there is some loaded
|
||||||
if (AssFile::top && AssFile::top->loaded) {
|
if (ass && ass->loaded) {
|
||||||
if (TryToCloseSubs() == wxCANCEL) return;
|
if (TryToCloseSubs() == wxCANCEL) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
// Proceed into loading
|
// Proceed into loading
|
||||||
SubsGrid->ClearMaps();
|
SubsGrid->ClearMaps();
|
||||||
if (isFile) {
|
if (isFile) {
|
||||||
AssFile::top->Load(filename,charset);
|
ass->Load(filename,charset);
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
if (SubsGrid->GetRows()) {
|
if (SubsGrid->GetRows()) {
|
||||||
SubsGrid->SetActiveLine(SubsGrid->GetDialogue(0));
|
SubsGrid->SetActiveLine(SubsGrid->GetDialogue(0));
|
||||||
|
@ -768,13 +768,13 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
|
||||||
bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
// Try to get filename from file
|
// Try to get filename from file
|
||||||
wxString filename;
|
wxString filename;
|
||||||
if (saveas == false && AssFile::top->CanSave()) filename = AssFile::top->filename;
|
if (saveas == false && ass->CanSave()) filename = ass->filename;
|
||||||
|
|
||||||
// Failed, ask user
|
// Failed, ask user
|
||||||
if (filename.IsEmpty()) {
|
if (filename.IsEmpty()) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||||
wxFileName origPath(AssFile::top->filename);
|
wxFileName origPath(ass->filename);
|
||||||
filename = wxFileSelector(_("Save subtitles file"),path,origPath.GetName() + _T(".ass"),_T("ass"),AssFile::GetWildcardList(1),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
|
filename = wxFileSelector(_("Save subtitles file"),path,origPath.GetName() + _T(".ass"),_T("ass"),AssFile::GetWildcardList(1),wxFD_SAVE | wxFD_OVERWRITE_PROMPT,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath()));
|
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath()));
|
||||||
|
|
||||||
// Fix me, ghetto hack for correct relative path generation in SynchronizeProject()
|
// Fix me, ghetto hack for correct relative path generation in SynchronizeProject()
|
||||||
AssFile::top->filename = filename;
|
ass->filename = filename;
|
||||||
|
|
||||||
// Synchronize
|
// Synchronize
|
||||||
SynchronizeProject();
|
SynchronizeProject();
|
||||||
|
@ -799,7 +799,7 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
try {
|
try {
|
||||||
AssFile::top->Save(filename,true,true,charset);
|
ass->Save(filename,true,true,charset);
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
catch (const wchar_t *err) {
|
catch (const wchar_t *err) {
|
||||||
|
@ -819,7 +819,6 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) {
|
||||||
/// @param enableCancel
|
/// @param enableCancel
|
||||||
/// @return
|
/// @return
|
||||||
int FrameMain::TryToCloseSubs(bool enableCancel) {
|
int FrameMain::TryToCloseSubs(bool enableCancel) {
|
||||||
AssFile *ass = AssFile::top;
|
|
||||||
if (ass->IsModified()) {
|
if (ass->IsModified()) {
|
||||||
int flags = wxYES_NO;
|
int flags = wxYES_NO;
|
||||||
if (enableCancel) flags |= wxCANCEL;
|
if (enableCancel) flags |= wxCANCEL;
|
||||||
|
@ -878,14 +877,14 @@ void FrameMain::SetDisplayMode(int video, int audio) {
|
||||||
/// @brief Update title bar
|
/// @brief Update title bar
|
||||||
void FrameMain::UpdateTitle() {
|
void FrameMain::UpdateTitle() {
|
||||||
// Determine if current subs are modified
|
// Determine if current subs are modified
|
||||||
bool subsMod = AssFile::top->IsModified();
|
bool subsMod = ass->IsModified();
|
||||||
|
|
||||||
// Create ideal title
|
// Create ideal title
|
||||||
wxString newTitle = _T("");
|
wxString newTitle = _T("");
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
if (subsMod) newTitle << _T("* ");
|
if (subsMod) newTitle << _T("* ");
|
||||||
if (AssFile::top->filename != _T("")) {
|
if (ass->filename != _T("")) {
|
||||||
wxFileName file (AssFile::top->filename);
|
wxFileName file (ass->filename);
|
||||||
newTitle << file.GetFullName();
|
newTitle << file.GetFullName();
|
||||||
}
|
}
|
||||||
else newTitle << _("Untitled");
|
else newTitle << _("Untitled");
|
||||||
|
@ -894,8 +893,8 @@ void FrameMain::UpdateTitle() {
|
||||||
// Apple HIG says "untitled" should not be capitalised
|
// Apple HIG says "untitled" should not be capitalised
|
||||||
// and the window is a document window, it shouldn't contain the app name
|
// and the window is a document window, it shouldn't contain the app name
|
||||||
// (The app name is already present in the menu bar)
|
// (The app name is already present in the menu bar)
|
||||||
if (AssFile::top->filename != _T("")) {
|
if (ass->filename != _T("")) {
|
||||||
wxFileName file (AssFile::top->filename);
|
wxFileName file (ass->filename);
|
||||||
newTitle << file.GetFullName();
|
newTitle << file.GetFullName();
|
||||||
}
|
}
|
||||||
else newTitle << _("untitled");
|
else newTitle << _("untitled");
|
||||||
|
@ -915,9 +914,6 @@ void FrameMain::UpdateTitle() {
|
||||||
/// @brief Updates subs with video/whatever data
|
/// @brief Updates subs with video/whatever data
|
||||||
/// @param fromSubs
|
/// @param fromSubs
|
||||||
void FrameMain::SynchronizeProject(bool fromSubs) {
|
void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
// Gather current data
|
|
||||||
AssFile *subs = AssFile::top;
|
|
||||||
|
|
||||||
// Retrieve data from subs
|
// Retrieve data from subs
|
||||||
if (fromSubs) {
|
if (fromSubs) {
|
||||||
// Reset the state
|
// Reset the state
|
||||||
|
@ -927,7 +923,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
double videoZoom = 0.;
|
double videoZoom = 0.;
|
||||||
|
|
||||||
// Get AR
|
// Get AR
|
||||||
wxString arString = subs->GetScriptInfo(_T("Video Aspect Ratio"));
|
wxString arString = ass->GetScriptInfo(_T("Video Aspect Ratio"));
|
||||||
if (arString.Left(1) == _T("c")) {
|
if (arString.Left(1) == _T("c")) {
|
||||||
videoAr = 4;
|
videoAr = 4;
|
||||||
arString = arString.Mid(1);
|
arString = arString.Mid(1);
|
||||||
|
@ -936,21 +932,21 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
else if (arString.IsNumber()) arString.ToLong(&videoAr);
|
else if (arString.IsNumber()) arString.ToLong(&videoAr);
|
||||||
|
|
||||||
// Get new state info
|
// Get new state info
|
||||||
subs->GetScriptInfo(_T("Video Position")).ToLong(&videoPos);
|
ass->GetScriptInfo(_T("Video Position")).ToLong(&videoPos);
|
||||||
subs->GetScriptInfo(_T("Video Zoom Percent")).ToDouble(&videoZoom);
|
ass->GetScriptInfo(_T("Video Zoom Percent")).ToDouble(&videoZoom);
|
||||||
wxString curSubsVideo = DecodeRelativePath(subs->GetScriptInfo(_T("Video File")),AssFile::top->filename);
|
wxString curassVideo = DecodeRelativePath(ass->GetScriptInfo(_T("Video File")),ass->filename);
|
||||||
wxString curSubsVFR = DecodeRelativePath(subs->GetScriptInfo(_T("VFR File")),AssFile::top->filename);
|
wxString curassVFR = DecodeRelativePath(ass->GetScriptInfo(_T("VFR File")),ass->filename);
|
||||||
wxString curSubsKeyframes = DecodeRelativePath(subs->GetScriptInfo(_T("Keyframes File")),AssFile::top->filename);
|
wxString curassKeyframes = DecodeRelativePath(ass->GetScriptInfo(_T("Keyframes File")),ass->filename);
|
||||||
wxString curSubsAudio = DecodeRelativePath(subs->GetScriptInfo(_T("Audio File")),AssFile::top->filename);
|
wxString curassAudio = DecodeRelativePath(ass->GetScriptInfo(_T("Audio File")),ass->filename);
|
||||||
wxString AutoScriptString = subs->GetScriptInfo(_T("Automation Scripts"));
|
wxString AutoScriptString = ass->GetScriptInfo(_T("Automation Scripts"));
|
||||||
|
|
||||||
// Check if there is anything to change
|
// Check if there is anything to change
|
||||||
int autoLoadMode = OPT_GET("App/Auto/Load Linked Files")->GetInt();
|
int autoLoadMode = OPT_GET("App/Auto/Load Linked Files")->GetInt();
|
||||||
bool hasToLoad = false;
|
bool hasToLoad = false;
|
||||||
if (curSubsAudio != audioBox->audioName ||
|
if (curassAudio != audioBox->audioName ||
|
||||||
curSubsVFR != VideoContext::Get()->GetTimecodesName() ||
|
curassVFR != VideoContext::Get()->GetTimecodesName() ||
|
||||||
curSubsVideo != VideoContext::Get()->videoName ||
|
curassVideo != VideoContext::Get()->videoName ||
|
||||||
curSubsKeyframes != VideoContext::Get()->GetKeyFramesName()
|
curassKeyframes != VideoContext::Get()->GetKeyFramesName()
|
||||||
#ifdef WITH_AUTOMATION
|
#ifdef WITH_AUTOMATION
|
||||||
|| !AutoScriptString.IsEmpty() || local_scripts->GetScripts().size() > 0
|
|| !AutoScriptString.IsEmpty() || local_scripts->GetScripts().size() > 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -970,8 +966,8 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
|
|
||||||
if (doLoad) {
|
if (doLoad) {
|
||||||
// Video
|
// Video
|
||||||
if (curSubsVideo != VideoContext::Get()->videoName) {
|
if (curassVideo != VideoContext::Get()->videoName) {
|
||||||
LoadVideo(curSubsVideo);
|
LoadVideo(curassVideo);
|
||||||
if (VideoContext::Get()->IsLoaded()) {
|
if (VideoContext::Get()->IsLoaded()) {
|
||||||
VideoContext::Get()->SetAspectRatio(videoAr,videoArValue);
|
VideoContext::Get()->SetAspectRatio(videoAr,videoArValue);
|
||||||
videoBox->videoDisplay->SetZoom(videoZoom);
|
videoBox->videoDisplay->SetZoom(videoZoom);
|
||||||
|
@ -979,20 +975,20 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoContext::Get()->LoadTimecodes(curSubsVFR);
|
VideoContext::Get()->LoadTimecodes(curassVFR);
|
||||||
VideoContext::Get()->LoadKeyframes(curSubsKeyframes);
|
VideoContext::Get()->LoadKeyframes(curassKeyframes);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
if (curSubsAudio != audioBox->audioName) {
|
if (curassAudio != audioBox->audioName) {
|
||||||
if (curSubsAudio == _T("?video")) LoadAudio(_T(""),true);
|
if (curassAudio == _T("?video")) LoadAudio(_T(""),true);
|
||||||
else LoadAudio(curSubsAudio);
|
else LoadAudio(curassAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automation scripts
|
// Automation scripts
|
||||||
#ifdef WITH_AUTOMATION
|
#ifdef WITH_AUTOMATION
|
||||||
local_scripts->RemoveAll();
|
local_scripts->RemoveAll();
|
||||||
wxStringTokenizer tok(AutoScriptString, _T("|"), wxTOKEN_STRTOK);
|
wxStringTokenizer tok(AutoScriptString, _T("|"), wxTOKEN_STRTOK);
|
||||||
wxFileName subsfn(subs->filename);
|
wxFileName assfn(ass->filename);
|
||||||
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
||||||
while (tok.HasMoreTokens()) {
|
while (tok.HasMoreTokens()) {
|
||||||
wxString sfnames = tok.GetNextToken().Trim(true).Trim(false);
|
wxString sfnames = tok.GetNextToken().Trim(true).Trim(false);
|
||||||
|
@ -1000,7 +996,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
sfnames.Remove(0, 1);
|
sfnames.Remove(0, 1);
|
||||||
wxString basepath;
|
wxString basepath;
|
||||||
if (sfnamel == _T("~")) {
|
if (sfnamel == _T("~")) {
|
||||||
basepath = subsfn.GetPath();
|
basepath = assfn.GetPath();
|
||||||
} else if (sfnamel == _T("$")) {
|
} else if (sfnamel == _T("$")) {
|
||||||
basepath = autobasefn;
|
basepath = autobasefn;
|
||||||
} else if (sfnamel == _T("/")) {
|
} else if (sfnamel == _T("/")) {
|
||||||
|
@ -1027,7 +1023,7 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
SetDisplayMode(1,1);
|
SetDisplayMode(1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store data on subs
|
// Store data on ass
|
||||||
else {
|
else {
|
||||||
// Setup
|
// Setup
|
||||||
wxString seekpos = _T("0");
|
wxString seekpos = _T("0");
|
||||||
|
@ -1043,22 +1039,22 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store audio data
|
// Store audio data
|
||||||
subs->SetScriptInfo(_T("Audio File"),MakeRelativePath(audioBox->audioName,AssFile::top->filename));
|
ass->SetScriptInfo(_T("Audio File"),MakeRelativePath(audioBox->audioName,ass->filename));
|
||||||
|
|
||||||
// Store video data
|
// Store video data
|
||||||
subs->SetScriptInfo(_T("Video File"),MakeRelativePath(VideoContext::Get()->videoName,AssFile::top->filename));
|
ass->SetScriptInfo(_T("Video File"),MakeRelativePath(VideoContext::Get()->videoName,ass->filename));
|
||||||
subs->SetScriptInfo(_T("Video Aspect Ratio"),ar);
|
ass->SetScriptInfo(_T("Video Aspect Ratio"),ar);
|
||||||
subs->SetScriptInfo(_T("Video Zoom Percent"),zoom);
|
ass->SetScriptInfo(_T("Video Zoom Percent"),zoom);
|
||||||
subs->SetScriptInfo(_T("Video Position"),seekpos);
|
ass->SetScriptInfo(_T("Video Position"),seekpos);
|
||||||
subs->SetScriptInfo(_T("VFR File"),MakeRelativePath(VideoContext::Get()->GetTimecodesName(),AssFile::top->filename));
|
ass->SetScriptInfo(_T("VFR File"),MakeRelativePath(VideoContext::Get()->GetTimecodesName(),ass->filename));
|
||||||
subs->SetScriptInfo(_T("Keyframes File"),MakeRelativePath(VideoContext::Get()->GetKeyFramesName(),AssFile::top->filename));
|
ass->SetScriptInfo(_T("Keyframes File"),MakeRelativePath(VideoContext::Get()->GetKeyFramesName(),ass->filename));
|
||||||
|
|
||||||
// Store Automation script data
|
// Store Automation script data
|
||||||
// Algorithm:
|
// Algorithm:
|
||||||
// 1. If script filename has Automation Base Path as a prefix, the path is relative to that (ie. "$")
|
// 1. If script filename has Automation Base Path as a prefix, the path is relative to that (ie. "$")
|
||||||
// 2. Otherwise try making it relative to the subs filename
|
// 2. Otherwise try making it relative to the ass filename
|
||||||
// 3. If step 2 failed, or absolut path is shorter than path relative to subs, use absolute path ("/")
|
// 3. If step 2 failed, or absolut path is shorter than path relative to ass, use absolute path ("/")
|
||||||
// 4. Otherwise, use path relative to subs ("~")
|
// 4. Otherwise, use path relative to ass ("~")
|
||||||
#ifdef WITH_AUTOMATION
|
#ifdef WITH_AUTOMATION
|
||||||
wxString scripts_string;
|
wxString scripts_string;
|
||||||
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
||||||
|
@ -1070,22 +1066,22 @@ void FrameMain::SynchronizeProject(bool fromSubs) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
scripts_string += _T("|");
|
scripts_string += _T("|");
|
||||||
|
|
||||||
wxString autobase_rel, subsfile_rel;
|
wxString autobase_rel, assfile_rel;
|
||||||
wxString scriptfn(script->GetFilename());
|
wxString scriptfn(script->GetFilename());
|
||||||
autobase_rel = MakeRelativePath(scriptfn, autobasefn);
|
autobase_rel = MakeRelativePath(scriptfn, autobasefn);
|
||||||
subsfile_rel = MakeRelativePath(scriptfn, AssFile::top->filename);
|
assfile_rel = MakeRelativePath(scriptfn, ass->filename);
|
||||||
|
|
||||||
if (autobase_rel.size() <= scriptfn.size() && autobase_rel.size() <= subsfile_rel.size()) {
|
if (autobase_rel.size() <= scriptfn.size() && autobase_rel.size() <= assfile_rel.size()) {
|
||||||
scriptfn = _T("$") + autobase_rel;
|
scriptfn = _T("$") + autobase_rel;
|
||||||
} else if (subsfile_rel.size() <= scriptfn.size() && subsfile_rel.size() <= autobase_rel.size()) {
|
} else if (assfile_rel.size() <= scriptfn.size() && assfile_rel.size() <= autobase_rel.size()) {
|
||||||
scriptfn = _T("~") + subsfile_rel;
|
scriptfn = _T("~") + assfile_rel;
|
||||||
} else {
|
} else {
|
||||||
scriptfn = _T("/") + wxFileName(scriptfn).GetFullPath(wxPATH_UNIX);
|
scriptfn = _T("/") + wxFileName(scriptfn).GetFullPath(wxPATH_UNIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
scripts_string += scriptfn;
|
scripts_string += scriptfn;
|
||||||
}
|
}
|
||||||
subs->SetScriptInfo(_T("Automation Scripts"), scripts_string);
|
ass->SetScriptInfo(_T("Automation Scripts"), scripts_string);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1347,8 +1343,8 @@ bool FrameMain::LoadList(wxArrayString list) {
|
||||||
|
|
||||||
/// @brief Sets the descriptions for undo/redo
|
/// @brief Sets the descriptions for undo/redo
|
||||||
void FrameMain::SetUndoRedoDesc() {
|
void FrameMain::SetUndoRedoDesc() {
|
||||||
editMenu->SetHelpString(0,_T("Undo ")+AssFile::top->GetUndoDescription());
|
editMenu->SetHelpString(0,_T("Undo ")+ass->GetUndoDescription());
|
||||||
editMenu->SetHelpString(1,_T("Redo ")+AssFile::top->GetRedoDescription());
|
editMenu->SetHelpString(1,_T("Redo ")+ass->GetRedoDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Check if ASSDraw is available
|
/// @brief Check if ASSDraw is available
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class AssFile;
|
||||||
class VideoDisplay;
|
class VideoDisplay;
|
||||||
class VideoSlider;
|
class VideoSlider;
|
||||||
class VideoZoomSlider;
|
class VideoZoomSlider;
|
||||||
|
@ -73,6 +73,7 @@ class FrameMain: public wxFrame {
|
||||||
friend class SubtitlesGrid;
|
friend class SubtitlesGrid;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AssFile *ass;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
|
||||||
|
|
|
@ -435,16 +435,16 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) {
|
||||||
else if (curMenu == editMenu) {
|
else if (curMenu == editMenu) {
|
||||||
// Undo state
|
// Undo state
|
||||||
wxMenuItem *item;
|
wxMenuItem *item;
|
||||||
wxString undo_text = _("&Undo") + wxString(_T(" ")) + AssFile::top->GetUndoDescription() + wxString(_T("\t")) + Hotkeys.GetText(_T("Undo"));
|
wxString undo_text = _("&Undo") + wxString(_T(" ")) + ass->GetUndoDescription() + wxString(_T("\t")) + Hotkeys.GetText(_T("Undo"));
|
||||||
item = editMenu->FindItem(Menu_Edit_Undo);
|
item = editMenu->FindItem(Menu_Edit_Undo);
|
||||||
item->SetItemLabel(undo_text);
|
item->SetItemLabel(undo_text);
|
||||||
item->Enable(!AssFile::top->IsUndoStackEmpty());
|
item->Enable(!ass->IsUndoStackEmpty());
|
||||||
|
|
||||||
// Redo state
|
// Redo state
|
||||||
wxString redo_text = _("&Redo") + wxString(_T(" ")) + AssFile::top->GetRedoDescription() + wxString(_T("\t")) + Hotkeys.GetText(_T("Redo"));
|
wxString redo_text = _("&Redo") + wxString(_T(" ")) + ass->GetRedoDescription() + wxString(_T("\t")) + Hotkeys.GetText(_T("Redo"));
|
||||||
item = editMenu->FindItem(Menu_Edit_Redo);
|
item = editMenu->FindItem(Menu_Edit_Redo);
|
||||||
item->SetItemLabel(redo_text);
|
item->SetItemLabel(redo_text);
|
||||||
item->Enable(!AssFile::top->IsRedoStackEmpty());
|
item->Enable(!ass->IsRedoStackEmpty());
|
||||||
|
|
||||||
// Copy/cut/paste
|
// Copy/cut/paste
|
||||||
wxArrayInt sels = SubsGrid->GetSelection();
|
wxArrayInt sels = SubsGrid->GetSelection();
|
||||||
|
@ -765,7 +765,7 @@ void FrameMain::OnExportSubtitles(wxCommandEvent &) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DialogExport exporter(this);
|
DialogExport exporter(this, ass);
|
||||||
exporter.ShowModal();
|
exporter.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ void FrameMain::OnShift(wxCommandEvent&) {
|
||||||
/// @brief Open properties
|
/// @brief Open properties
|
||||||
void FrameMain::OnOpenProperties (wxCommandEvent &) {
|
void FrameMain::OnOpenProperties (wxCommandEvent &) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
DialogProperties Properties(this);
|
DialogProperties Properties(this, ass);
|
||||||
int res = Properties.ShowModal();
|
int res = Properties.ShowModal();
|
||||||
if (res) {
|
if (res) {
|
||||||
SubsGrid->CommitChanges();
|
SubsGrid->CommitChanges();
|
||||||
|
@ -946,7 +946,7 @@ void FrameMain::OnOpenStylesManager(wxCommandEvent&) {
|
||||||
/// @brief Open attachments
|
/// @brief Open attachments
|
||||||
void FrameMain::OnOpenAttachments(wxCommandEvent&) {
|
void FrameMain::OnOpenAttachments(wxCommandEvent&) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
DialogAttachments attachments(this);
|
DialogAttachments attachments(this, ass);
|
||||||
attachments.ShowModal();
|
attachments.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ void FrameMain::OnOpenTranslation(wxCommandEvent&) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
int start = SubsGrid->GetFirstSelRow();
|
int start = SubsGrid->GetFirstSelRow();
|
||||||
if (start == -1) start = 0;
|
if (start == -1) start = 0;
|
||||||
DialogTranslation Trans(this,AssFile::top,SubsGrid,start,true);
|
DialogTranslation Trans(this,ass,SubsGrid,start,true);
|
||||||
Trans.ShowModal();
|
Trans.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,7 +968,7 @@ void FrameMain::OnOpenSpellCheck (wxCommandEvent &) {
|
||||||
/// @brief Open Fonts Collector
|
/// @brief Open Fonts Collector
|
||||||
void FrameMain::OnOpenFontsCollector (wxCommandEvent &) {
|
void FrameMain::OnOpenFontsCollector (wxCommandEvent &) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
DialogFontsCollector Collector(this);
|
DialogFontsCollector Collector(this, ass);
|
||||||
Collector.ShowModal();
|
Collector.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ void FrameMain::OnUndo(wxCommandEvent&) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
|
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
|
||||||
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
|
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
|
||||||
AssFile::top->Undo();
|
ass->Undo();
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
SubsGrid->SetSelectionFromAbsolute(selected_lines);
|
SubsGrid->SetSelectionFromAbsolute(selected_lines);
|
||||||
|
@ -1182,7 +1182,7 @@ void FrameMain::OnRedo(wxCommandEvent&) {
|
||||||
VideoContext::Get()->Stop();
|
VideoContext::Get()->Stop();
|
||||||
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
|
std::vector<int> selected_lines = SubsGrid->GetAbsoluteSelection();
|
||||||
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
|
int active_line = SubsGrid->GetDialogueIndex(SubsGrid->GetActiveLine());
|
||||||
AssFile::top->Redo();
|
ass->Redo();
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
SubsGrid->SetSelectionFromAbsolute(selected_lines);
|
SubsGrid->SetSelectionFromAbsolute(selected_lines);
|
||||||
|
@ -1354,22 +1354,22 @@ void FrameMain::OnSelect (wxCommandEvent &) {
|
||||||
|
|
||||||
/// @brief Sort subtitles by start time
|
/// @brief Sort subtitles by start time
|
||||||
void FrameMain::OnSortStart (wxCommandEvent &) {
|
void FrameMain::OnSortStart (wxCommandEvent &) {
|
||||||
AssFile::top->Sort();
|
ass->Sort();
|
||||||
AssFile::top->Commit(_("sort"));
|
ass->Commit(_("sort"));
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
SubsGrid->CommitChanges();
|
SubsGrid->CommitChanges();
|
||||||
}
|
}
|
||||||
/// @brief Sort subtitles by end time
|
/// @brief Sort subtitles by end time
|
||||||
void FrameMain::OnSortEnd (wxCommandEvent &) {
|
void FrameMain::OnSortEnd (wxCommandEvent &) {
|
||||||
AssFile::top->Sort(AssFile::CompEnd);
|
ass->Sort(AssFile::CompEnd);
|
||||||
AssFile::top->Commit(_("sort"));
|
ass->Commit(_("sort"));
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
SubsGrid->CommitChanges();
|
SubsGrid->CommitChanges();
|
||||||
}
|
}
|
||||||
/// @brief Sort subtitles by style name
|
/// @brief Sort subtitles by style name
|
||||||
void FrameMain::OnSortStyle (wxCommandEvent &) {
|
void FrameMain::OnSortStyle (wxCommandEvent &) {
|
||||||
AssFile::top->Sort(AssFile::CompStyle);
|
ass->Sort(AssFile::CompStyle);
|
||||||
AssFile::top->Commit(_("sort"));
|
ass->Commit(_("sort"));
|
||||||
SubsGrid->UpdateMaps();
|
SubsGrid->UpdateMaps();
|
||||||
SubsGrid->CommitChanges();
|
SubsGrid->CommitChanges();
|
||||||
}
|
}
|
||||||
|
@ -1385,9 +1385,9 @@ void FrameMain::OnOpenStylingAssistant (wxCommandEvent &) {
|
||||||
void FrameMain::OnAutoSave(wxTimerEvent &) {
|
void FrameMain::OnAutoSave(wxTimerEvent &) {
|
||||||
// Auto Save
|
// Auto Save
|
||||||
try {
|
try {
|
||||||
if (AssFile::top->loaded) {
|
if (ass->loaded) {
|
||||||
// Set path
|
// Set path
|
||||||
wxFileName origfile(AssFile::top->filename);
|
wxFileName origfile(ass->filename);
|
||||||
wxString path = lagi_wxString(OPT_GET("Path/Auto/Save")->GetString());
|
wxString path = lagi_wxString(OPT_GET("Path/Auto/Save")->GetString());
|
||||||
if (path.IsEmpty()) path = origfile.GetPath();
|
if (path.IsEmpty()) path = origfile.GetPath();
|
||||||
wxFileName dstpath(path);
|
wxFileName dstpath(path);
|
||||||
|
@ -1406,7 +1406,7 @@ void FrameMain::OnAutoSave(wxTimerEvent &) {
|
||||||
wxFileName temp = dstpath;
|
wxFileName temp = dstpath;
|
||||||
temp.SetName(dstpath.GetName() + ".temp");
|
temp.SetName(dstpath.GetName() + ".temp");
|
||||||
|
|
||||||
AssFile::top->Save(temp.GetFullPath(),false,false);
|
ass->Save(temp.GetFullPath(),false,false);
|
||||||
wxRenameFile(temp.GetFullPath(), dstpath.GetFullPath());
|
wxRenameFile(temp.GetFullPath(), dstpath.GetFullPath());
|
||||||
|
|
||||||
// Set status bar
|
// Set status bar
|
||||||
|
|
|
@ -100,12 +100,12 @@ END_EVENT_TABLE()
|
||||||
/// @param style
|
/// @param style
|
||||||
/// @param name
|
/// @param name
|
||||||
///
|
///
|
||||||
SubtitlesGrid::SubtitlesGrid(FrameMain* parentFr, wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
SubtitlesGrid::SubtitlesGrid(FrameMain* parentFr, wxWindow *parent, wxWindowID id, AssFile *subs, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
||||||
: BaseGrid(parent,id,pos,size,style,name)
|
: BaseGrid(parent,id,pos,size,style,name)
|
||||||
|
, ass(subs)
|
||||||
{
|
{
|
||||||
// Vars
|
// Vars
|
||||||
byFrame = false;
|
byFrame = false;
|
||||||
ass = NULL;
|
|
||||||
editBox = NULL;
|
editBox = NULL;
|
||||||
parentFrame = parentFr;
|
parentFrame = parentFr;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +789,6 @@ void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) {
|
||||||
/// @param _ass
|
/// @param _ass
|
||||||
///
|
///
|
||||||
void SubtitlesGrid::LoadDefault () {
|
void SubtitlesGrid::LoadDefault () {
|
||||||
ass = AssFile::top;
|
|
||||||
ass->LoadDefault();
|
ass->LoadDefault();
|
||||||
UpdateMaps();
|
UpdateMaps();
|
||||||
|
|
||||||
|
@ -815,8 +814,6 @@ void SubtitlesGrid::UpdateMaps() {
|
||||||
line_iter_map.clear();
|
line_iter_map.clear();
|
||||||
BaseGrid::ClearMaps();
|
BaseGrid::ClearMaps();
|
||||||
|
|
||||||
ass = AssFile::top;
|
|
||||||
|
|
||||||
BaseGrid::UpdateMaps();
|
BaseGrid::UpdateMaps();
|
||||||
|
|
||||||
for (entryIter it = ass->Line.begin(); it != ass->Line.end(); ++it) {
|
for (entryIter it = ass->Line.begin(); it != ass->Line.end(); ++it) {
|
||||||
|
@ -1160,7 +1157,7 @@ void SubtitlesGrid::AdjoinLines(int n1,int n2,bool setStart) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit
|
// Commit
|
||||||
AssFile::top->Commit(_("adjoin"));
|
ass->Commit(_("adjoin"));
|
||||||
CommitChanges();
|
CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
AssFile *ass;
|
AssFile *ass;
|
||||||
|
|
||||||
SubtitlesGrid(FrameMain* parentFrame,wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr);
|
SubtitlesGrid(FrameMain* parentFrame,wxWindow *parent, wxWindowID id, AssFile *subs, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr);
|
||||||
~SubtitlesGrid();
|
~SubtitlesGrid();
|
||||||
|
|
||||||
void LoadDefault();
|
void LoadDefault();
|
||||||
|
|
Loading…
Reference in a new issue