forked from mia/Aegisub
Silence a bunch of PREFast warnings
Originally committed to SVN as r6162.
This commit is contained in:
parent
bddd4fc714
commit
7adbe07b4e
23 changed files with 101 additions and 117 deletions
|
@ -65,9 +65,8 @@ namespace {
|
||||||
void put_array(json::Object &obj, const std::string &path, const char *element_key, std::vector<T> const& value) {
|
void put_array(json::Object &obj, const std::string &path, const char *element_key, std::vector<T> const& value) {
|
||||||
json::Array array;
|
json::Array array;
|
||||||
for (typename std::vector<T>::const_iterator it = value.begin(); it != value.end(); ++it) {
|
for (typename std::vector<T>::const_iterator it = value.begin(); it != value.end(); ++it) {
|
||||||
json::Object obj;
|
array.push_back(json::Object());
|
||||||
obj[element_key] = *it;
|
static_cast<json::Object&>(array.back())[element_key] = *it;
|
||||||
array.push_back(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
put_option(obj, path, array);
|
put_option(obj, path, array);
|
||||||
|
|
|
@ -303,10 +303,9 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
if (data.empty()) return;
|
if (data.empty()) return;
|
||||||
|
|
||||||
// Group
|
// Group
|
||||||
AssEntry *entry = NULL;
|
|
||||||
wxString origGroup = group;
|
wxString origGroup = group;
|
||||||
static wxString keepGroup;
|
static wxString keepGroup;
|
||||||
if (!keepGroup.IsEmpty()) group = keepGroup;
|
if (!keepGroup.empty()) group = keepGroup;
|
||||||
if (outGroup) *outGroup = group;
|
if (outGroup) *outGroup = group;
|
||||||
wxString lowGroup = group.Lower();
|
wxString lowGroup = group.Lower();
|
||||||
|
|
||||||
|
@ -355,7 +354,7 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
keepGroup.Clear();
|
keepGroup.Clear();
|
||||||
group = origGroup;
|
group = origGroup;
|
||||||
lowGroup = group.Lower();
|
lowGroup = group.Lower();
|
||||||
entry = attach;
|
Line.push_back(attach);
|
||||||
attach = NULL;
|
attach = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,34 +364,24 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialogue
|
// Dialogue
|
||||||
else if (lowGroup == "[events]") {
|
else if (lowGroup == "[events]") {
|
||||||
if (data.StartsWith("Dialogue:") || data.StartsWith("Comment:")) {
|
if (data.StartsWith("Dialogue:") || data.StartsWith("Comment:"))
|
||||||
AssDialogue *diag = new AssDialogue(data,version);
|
Line.push_back(new AssDialogue(data,version));
|
||||||
//diag->ParseASSTags();
|
else if (data.StartsWith("Format:"))
|
||||||
entry = diag;
|
Line.push_back(new AssEntry("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text", group));
|
||||||
entry->group = group;
|
else
|
||||||
}
|
Line.push_back(new AssEntry(data, group));
|
||||||
else if (data.StartsWith("Format:")) {
|
|
||||||
entry = new AssEntry("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text");
|
|
||||||
entry->group = group;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
else if (lowGroup == "[v4+ styles]") {
|
else if (lowGroup == "[v4+ styles]") {
|
||||||
if (data.StartsWith("Style:")) {
|
if (data.StartsWith("Style:"))
|
||||||
AssStyle *style = new AssStyle(data,version);
|
Line.push_back(new AssStyle(data,version));
|
||||||
entry = style;
|
else if (data.StartsWith("Format:"))
|
||||||
entry->group = group;
|
Line.push_back(new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding", group));
|
||||||
}
|
else
|
||||||
if (data.StartsWith("Format:")) {
|
Line.push_back(new AssEntry(data, group));
|
||||||
entry = new AssEntry("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding");
|
|
||||||
entry->group = group;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Script info
|
// Script info
|
||||||
else if (lowGroup == "[script info]") {
|
else if (lowGroup == "[script info]") {
|
||||||
// Comment
|
// Comment
|
||||||
|
@ -420,19 +409,12 @@ void AssFile::AddLine(wxString data,wxString group,int &version,wxString *outGro
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything
|
// Everything
|
||||||
entry = new AssEntry(data);
|
Line.push_back(new AssEntry(data, group));
|
||||||
entry->group = group;
|
|
||||||
}
|
}
|
||||||
|
// Unrecognized group
|
||||||
// Common entry
|
else {
|
||||||
if (entry == NULL) {
|
Line.push_back(new AssEntry(data, group));
|
||||||
entry = new AssEntry(data);
|
|
||||||
entry->group = group;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert the line
|
|
||||||
Line.push_back(entry);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssFile::Clear() {
|
void AssFile::Clear() {
|
||||||
|
|
|
@ -363,7 +363,7 @@ std::vector<wxString> tokenize(const wxString &text) {
|
||||||
return paramList;
|
return paramList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto) {
|
void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::iterator proto_it) {
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
// Tokenize text, attempting to find all parameters
|
// Tokenize text, attempting to find all parameters
|
||||||
|
@ -371,14 +371,14 @@ void AssOverrideTag::ParseParameters(const wxString &text, AssOverrideTagProto::
|
||||||
size_t totalPars = paramList.size();
|
size_t totalPars = paramList.size();
|
||||||
|
|
||||||
int parsFlag = 1 << (totalPars - 1); // Get optional parameters flag
|
int parsFlag = 1 << (totalPars - 1); // Get optional parameters flag
|
||||||
// vector (i)clip is the second clip prototype in the list
|
// vector (i)clip is the second clip proto_ittype in the list
|
||||||
if ((Name == "\\clip" || Name == "\\iclip") && totalPars != 4) {
|
if ((Name == "\\clip" || Name == "\\iclip") && totalPars != 4) {
|
||||||
++proto;
|
++proto_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned curPar = 0;
|
unsigned curPar = 0;
|
||||||
for (size_t n = 0; n < proto->params.size(); n++) {
|
for (size_t n = 0; n < proto_it->params.size(); n++) {
|
||||||
AssOverrideParamProto *curproto = &proto->params[n];
|
AssOverrideParamProto *curproto = &proto_it->params[n];
|
||||||
|
|
||||||
// Create parameter
|
// Create parameter
|
||||||
AssOverrideParameter *newparam = new AssOverrideParameter;
|
AssOverrideParameter *newparam = new AssOverrideParameter;
|
||||||
|
|
|
@ -66,36 +66,36 @@ AssColor::AssColor (const wxColour &color) {
|
||||||
|
|
||||||
/// @brief Parse from SSA/ASS
|
/// @brief Parse from SSA/ASS
|
||||||
/// @param value
|
/// @param value
|
||||||
void AssColor::Parse(const wxString value) {
|
void AssColor::Parse(wxString const& value) {
|
||||||
if (value.Len() > 0 && value[0] == '#') {
|
if (value.size() > 0 && value[0] == '#') {
|
||||||
// HTML colour
|
// HTML colour
|
||||||
SetWXColor(wxColor(value));
|
SetWXColor(wxColor(value));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
char c,ostr[12];
|
char ostr[12];
|
||||||
unsigned long outval;
|
int oindex = 11;
|
||||||
int oindex=11;
|
bool ishex = false;
|
||||||
bool ishex=false;
|
|
||||||
|
|
||||||
ostr[11]=0;
|
ostr[11] = 0;
|
||||||
|
|
||||||
for(unsigned char i = value.Len(); i > 0 && oindex >= 0; i--) {
|
for(size_t i = value.size(); i > 0 && oindex >= 0; i--) {
|
||||||
c=value[i - 1];
|
unsigned char c = value[i - 1];
|
||||||
if (isxdigit(c) || c=='-') {
|
if (isxdigit(c) || c == '-') {
|
||||||
ostr[--oindex] = c;
|
ostr[--oindex] = c;
|
||||||
if (c>='A') ishex = true;
|
if (c >= 'A')
|
||||||
|
ishex = true;
|
||||||
}
|
}
|
||||||
else if (c == 'H' || c == 'h') ishex = true;
|
else if (c == 'H' || c == 'h')
|
||||||
|
ishex = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
outval=strtoul(ostr+oindex,0,ishex?16:10);
|
unsigned long outval = strtoul(ostr + oindex, 0, ishex ? 16 : 10);
|
||||||
|
r = outval & 0xFF;
|
||||||
r = outval & 0xFF;
|
g = (outval>>8) & 0xFF;
|
||||||
g = (outval>>8) & 0xFF;
|
b = (outval>>16) & 0xFF;
|
||||||
b = (outval>>16)& 0xFF;
|
a = (outval>>24) & 0xFF;
|
||||||
a = (outval>>24)& 0xFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Gets a wxColour
|
/// @brief Gets a wxColour
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct AssColor {
|
||||||
|
|
||||||
wxColor GetWXColor(); // Return as a wxColor
|
wxColor GetWXColor(); // Return as a wxColor
|
||||||
void SetWXColor(const wxColor &color); // Sets from a wxColor
|
void SetWXColor(const wxColor &color); // Sets from a wxColor
|
||||||
void Parse(const wxString value); // Parse SSA or ASS-style color
|
void Parse(wxString const& value); // Parse SSA or ASS-style color
|
||||||
wxString GetASSFormatted(bool alpha,bool stripped=false,bool isStyle=false) const; // Gets color formated in ASS format
|
wxString GetASSFormatted(bool alpha,bool stripped=false,bool isStyle=false) const; // Gets color formated in ASS format
|
||||||
wxString GetSSAFormatted() const;
|
wxString GetSSAFormatted() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,21 +73,21 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c)
|
||||||
{
|
{
|
||||||
using std::tr1::bind;
|
using std::tr1::bind;
|
||||||
|
|
||||||
wxSizer *main_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
cancel_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_cancel_16));
|
cancel_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_cancel_16));
|
||||||
cancel_button->SetToolTip(_("Discard all uncommitted splits"));
|
cancel_button->SetToolTip(_("Discard all uncommitted splits"));
|
||||||
cancel_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::CancelSplit, this));
|
cancel_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::CancelSplit, this));
|
||||||
main_sizer->Add(cancel_button);
|
|
||||||
|
|
||||||
accept_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_accept_16));
|
accept_button = new wxBitmapButton(this, -1, GETIMAGE(kara_split_accept_16));
|
||||||
accept_button->SetToolTip(_("Commit splits"));
|
accept_button->SetToolTip(_("Commit splits"));
|
||||||
accept_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::AcceptSplit, this));
|
accept_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&AudioKaraoke::AcceptSplit, this));
|
||||||
main_sizer->Add(accept_button);
|
|
||||||
|
|
||||||
split_area = new wxPanel(this);
|
split_area = new wxPanel(this);
|
||||||
main_sizer->Add(split_area, wxSizerFlags(1).Expand());
|
|
||||||
|
|
||||||
|
wxSizer *main_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
main_sizer->Add(cancel_button);
|
||||||
|
main_sizer->Add(accept_button);
|
||||||
|
main_sizer->Add(split_area, wxSizerFlags(1).Expand());
|
||||||
SetSizerAndFit(main_sizer);
|
SetSizerAndFit(main_sizer);
|
||||||
|
|
||||||
/// @todo subscribe
|
/// @todo subscribe
|
||||||
|
|
|
@ -150,7 +150,7 @@ public:
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count) const {
|
void GetAudio(void *buf, int64_t start, int64_t count) const {
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
|
|
||||||
bool not_end = start + count < num_samples;
|
int not_end = start + count < num_samples;
|
||||||
int64_t src_count = count / 2;
|
int64_t src_count = count / 2;
|
||||||
source->GetAudio(buf, start / 2, src_count + not_end);
|
source->GetAudio(buf, start / 2, src_count + not_end);
|
||||||
|
|
||||||
|
|
|
@ -306,16 +306,8 @@ class RiffWavPCMAudioProvider : public PCMAudioProvider {
|
||||||
// either way, as the fields can depend on the compression.
|
// either way, as the fields can depend on the compression.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool CheckFourcc(const char (&str1)[4], const char (&str2)[5])
|
||||||
/// @brief DOCME
|
|
||||||
/// @param str1[]
|
|
||||||
/// @param str2[]
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
static bool CheckFourcc(const char str1[], const char str2[])
|
|
||||||
{
|
{
|
||||||
assert(str1);
|
|
||||||
assert(str2);
|
|
||||||
return
|
return
|
||||||
(str1[0] == str2[0]) &&
|
(str1[0] == str2[0]) &&
|
||||||
(str1[1] == str2[1]) &&
|
(str1[1] == str2[1]) &&
|
||||||
|
@ -519,7 +511,7 @@ public:
|
||||||
/// @param _filename
|
/// @param _filename
|
||||||
///
|
///
|
||||||
Wave64AudioProvider(const wxString &_filename)
|
Wave64AudioProvider(const wxString &_filename)
|
||||||
: PCMAudioProvider(_filename)
|
: PCMAudioProvider(_filename)
|
||||||
{
|
{
|
||||||
filename = _filename;
|
filename = _filename;
|
||||||
|
|
||||||
|
|
|
@ -362,8 +362,10 @@ namespace Automation4 {
|
||||||
dia->Effect = get_string_field(L, "effect", "dialogue");
|
dia->Effect = get_string_field(L, "effect", "dialogue");
|
||||||
dia->Text = get_string_field(L, "text", "dialogue");
|
dia->Text = get_string_field(L, "text", "dialogue");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
luaL_error(L, "Found line with unknown class: %s", lclass.utf8_str().data());
|
luaL_error(L, "Found line with unknown class: %s", lclass.utf8_str().data());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (result->group.empty())
|
if (result->group.empty())
|
||||||
result->group = section;
|
result->group = section;
|
||||||
|
|
|
@ -135,7 +135,7 @@ static void insert_subtitle_at_video(agi::Context *c, bool after) {
|
||||||
// Insert it
|
// Insert it
|
||||||
c->subsGrid->BeginBatch();
|
c->subsGrid->BeginBatch();
|
||||||
c->subsGrid->InsertLine(def, n, after);
|
c->subsGrid->InsertLine(def, n, after);
|
||||||
c->subsGrid->SelectRow(n + after);
|
c->subsGrid->SelectRow(n + (int)after);
|
||||||
c->subsGrid->SetActiveLine(def);
|
c->subsGrid->SetActiveLine(def);
|
||||||
c->subsGrid->EndBatch();
|
c->subsGrid->EndBatch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1034,6 +1034,8 @@ wxBitmap *DialogColorPicker::MakeGBSpectrum()
|
||||||
unsigned char *ospec, *spec;
|
unsigned char *ospec, *spec;
|
||||||
|
|
||||||
ospec = spec = (unsigned char *)malloc(256*256*3);
|
ospec = spec = (unsigned char *)malloc(256*256*3);
|
||||||
|
if (!spec) throw std::bad_alloc();
|
||||||
|
|
||||||
for (int g = 0; g < 256; g++) {
|
for (int g = 0; g < 256; g++) {
|
||||||
for (int b = 0; b < 256; b++) {
|
for (int b = 0; b < 256; b++) {
|
||||||
*spec++ = cur_color.Red();
|
*spec++ = cur_color.Red();
|
||||||
|
@ -1052,6 +1054,8 @@ wxBitmap *DialogColorPicker::MakeRBSpectrum()
|
||||||
|
|
||||||
unsigned char *ospec, *spec;
|
unsigned char *ospec, *spec;
|
||||||
ospec = spec = (unsigned char *)malloc(256*256*3);
|
ospec = spec = (unsigned char *)malloc(256*256*3);
|
||||||
|
if (!spec) throw std::bad_alloc();
|
||||||
|
|
||||||
for (int r = 0; r < 256; r++) {
|
for (int r = 0; r < 256; r++) {
|
||||||
for (int b = 0; b < 256; b++) {
|
for (int b = 0; b < 256; b++) {
|
||||||
*spec++ = r;
|
*spec++ = r;
|
||||||
|
@ -1070,6 +1074,8 @@ wxBitmap *DialogColorPicker::MakeRGSpectrum()
|
||||||
|
|
||||||
unsigned char *ospec, *spec;
|
unsigned char *ospec, *spec;
|
||||||
ospec = spec = (unsigned char *)malloc(256*256*3);
|
ospec = spec = (unsigned char *)malloc(256*256*3);
|
||||||
|
if (!spec) throw std::bad_alloc();
|
||||||
|
|
||||||
for (int r = 0; r < 256; r++) {
|
for (int r = 0; r < 256; r++) {
|
||||||
for (int g = 0; g < 256; g++) {
|
for (int g = 0; g < 256; g++) {
|
||||||
*spec++ = r;
|
*spec++ = r;
|
||||||
|
@ -1088,6 +1094,8 @@ wxBitmap *DialogColorPicker::MakeHSSpectrum()
|
||||||
|
|
||||||
unsigned char *ospec, *spec;
|
unsigned char *ospec, *spec;
|
||||||
ospec = spec = (unsigned char *)malloc(256*256*3);
|
ospec = spec = (unsigned char *)malloc(256*256*3);
|
||||||
|
if (!spec) throw std::bad_alloc();
|
||||||
|
|
||||||
int l = hsl_input[2]->GetValue();
|
int l = hsl_input[2]->GetValue();
|
||||||
|
|
||||||
for (int h = 0; h < 256; h++) {
|
for (int h = 0; h < 256; h++) {
|
||||||
|
@ -1111,6 +1119,7 @@ wxBitmap *DialogColorPicker::MakeSVSpectrum()
|
||||||
|
|
||||||
unsigned char *ospec, *spec;
|
unsigned char *ospec, *spec;
|
||||||
ospec = spec = (unsigned char *)malloc(256*256*3);
|
ospec = spec = (unsigned char *)malloc(256*256*3);
|
||||||
|
if (!spec) throw std::bad_alloc();
|
||||||
|
|
||||||
int h = hsv_input[0]->GetValue();
|
int h = hsv_input[0]->GetValue();
|
||||||
unsigned char maxr, maxg, maxb;
|
unsigned char maxr, maxg, maxb;
|
||||||
|
|
|
@ -278,12 +278,11 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
|
||||||
|
|
||||||
// Normal
|
// Normal
|
||||||
else {
|
else {
|
||||||
int textPos = tempPos;
|
|
||||||
wxString src = Text->Mid(tempPos);
|
wxString src = Text->Mid(tempPos);
|
||||||
if (!matchCase) src.MakeLower();
|
if (!matchCase) src.MakeLower();
|
||||||
int tempPos = src.Find(LookFor);
|
int textPos = src.Find(LookFor);
|
||||||
if (tempPos != -1) {
|
if (textPos != -1) {
|
||||||
pos = textPos+tempPos;
|
pos = tempPos+textPos;
|
||||||
found = true;
|
found = true;
|
||||||
matchLen = LookFor.Length();
|
matchLen = LookFor.Length();
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,8 @@ static wxString GetSystemLanguage()
|
||||||
|
|
||||||
// Try using Win 6+ functions if available
|
// Try using Win 6+ functions if available
|
||||||
HMODULE kernel32 = LoadLibraryW(L"kernel32.dll");
|
HMODULE kernel32 = LoadLibraryW(L"kernel32.dll");
|
||||||
|
if (!kernel32)
|
||||||
|
goto getsyslang_fallback;
|
||||||
PGetUserPreferredUILanguages gupuil = (PGetUserPreferredUILanguages)GetProcAddress(kernel32, "GetUserPreferredUILanguages");
|
PGetUserPreferredUILanguages gupuil = (PGetUserPreferredUILanguages)GetProcAddress(kernel32, "GetUserPreferredUILanguages");
|
||||||
if (gupuil)
|
if (gupuil)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +311,8 @@ getsyslang_fallback:
|
||||||
res = wxString::Format("x-win%04x", langid);
|
res = wxString::Format("x-win%04x", langid);
|
||||||
|
|
||||||
}
|
}
|
||||||
FreeModule(kernel32);
|
if (kernel32)
|
||||||
|
FreeModule(kernel32);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,7 +411,7 @@ namespace menu {
|
||||||
void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) {
|
void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) {
|
||||||
menu_items const& items = get_menu(name);
|
menu_items const& items = get_menu(name);
|
||||||
|
|
||||||
CommandMenuBar *menu = new CommandMenuBar(c);
|
std::auto_ptr<CommandMenuBar> menu(new CommandMenuBar(c));
|
||||||
for (menu_items::const_iterator it = items.begin(); it != items.end(); ++it) {
|
for (menu_items::const_iterator it = items.begin(); it != items.end(); ++it) {
|
||||||
std::string submenu, disp;
|
std::string submenu, disp;
|
||||||
read_entry(*it, "submenu", &submenu);
|
read_entry(*it, "submenu", &submenu);
|
||||||
|
@ -426,9 +426,9 @@ namespace menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window->SetMenuBar(menu);
|
|
||||||
window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
|
window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm);
|
||||||
window->Bind(wxEVT_COMMAND_MENU_SELECTED, &CommandManager::OnMenuClick, &menu->cm);
|
window->Bind(wxEVT_COMMAND_MENU_SELECTED, &CommandManager::OnMenuClick, &menu->cm);
|
||||||
|
window->SetMenuBar(menu.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenu *GetMenu(std::string const& name, agi::Context *c) {
|
wxMenu *GetMenu(std::string const& name, agi::Context *c) {
|
||||||
|
|
|
@ -85,10 +85,12 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO *
|
||||||
|
|
||||||
// Read to temp
|
// Read to temp
|
||||||
if (frameSize > readBufSize) {
|
if (frameSize > readBufSize) {
|
||||||
delete readBuf;
|
delete[] readBuf;
|
||||||
readBufSize = frameSize * 2;
|
readBufSize = frameSize * 2;
|
||||||
readBuf = new char[readBufSize];
|
readBuf = new char[readBufSize];
|
||||||
}
|
}
|
||||||
|
else if (frameSize == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
fseek(input->fp, filePos, SEEK_SET);
|
fseek(input->fp, filePos, SEEK_SET);
|
||||||
fread(readBuf, 1, frameSize, input->fp);
|
fread(readBuf, 1, frameSize, input->fp);
|
||||||
|
@ -121,7 +123,7 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO *
|
||||||
ps->SetProgress(startTime / timecodeScaleLow, totalTime);
|
ps->SetProgress(startTime / timecodeScaleLow, totalTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete readBuf;
|
delete[] readBuf;
|
||||||
|
|
||||||
// Insert into file
|
// Insert into file
|
||||||
wxString group = "[Events]";
|
wxString group = "[Events]";
|
||||||
|
|
|
@ -101,6 +101,7 @@ static void font_button(Preferences *parent, wxTextCtrl *name, wxSpinCtrl *size)
|
||||||
|
|
||||||
OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int style)
|
OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int style)
|
||||||
: wxScrolled<wxPanel>(book, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
: wxScrolled<wxPanel>(book, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
||||||
|
, sizer(new wxBoxSizer(wxVERTICAL))
|
||||||
, parent(parent)
|
, parent(parent)
|
||||||
{
|
{
|
||||||
if (style & PAGE_SUB)
|
if (style & PAGE_SUB)
|
||||||
|
@ -112,8 +113,6 @@ OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int
|
||||||
SetScrollbars(0, 20, 0, 50);
|
SetScrollbars(0, 20, 0, 50);
|
||||||
else
|
else
|
||||||
SetScrollbars(0, 0, 0, 0);
|
SetScrollbars(0, 0, 0, 0);
|
||||||
|
|
||||||
sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
|
@ -742,7 +742,7 @@ void SubsEditBox::SetTag(wxString tag, wxString value, bool atEnd) {
|
||||||
shift += 2;
|
shift += 2;
|
||||||
line->ParseASSTags();
|
line->ParseASSTags();
|
||||||
}
|
}
|
||||||
else {
|
else if(ovr) {
|
||||||
wxString alt;
|
wxString alt;
|
||||||
if (tag == "\\c") alt = "\\1c";
|
if (tag == "\\c") alt = "\\1c";
|
||||||
// Remove old of same
|
// Remove old of same
|
||||||
|
@ -769,6 +769,9 @@ void SubsEditBox::SetTag(wxString tag, wxString value, bool atEnd) {
|
||||||
|
|
||||||
line->UpdateText();
|
line->UpdateText();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
assert(false);
|
||||||
|
|
||||||
TextEdit->SetTextTo(line->Text);
|
TextEdit->SetTextTo(line->Text);
|
||||||
if (!atEnd) TextEdit->SetSelectionU(selstart+shift,selend+shift);
|
if (!atEnd) TextEdit->SetSelectionU(selstart+shift,selend+shift);
|
||||||
TextEdit->SetFocus();
|
TextEdit->SetFocus();
|
||||||
|
|
|
@ -429,16 +429,13 @@ void SubsTextEditCtrl::UpdateCallTip(wxStyledTextEvent &) {
|
||||||
wxString text = GetText();
|
wxString text = GetText();
|
||||||
|
|
||||||
// Find the start and end of current tag
|
// Find the start and end of current tag
|
||||||
wxChar curChar = 0;
|
|
||||||
wxChar prevChar = 0;
|
wxChar prevChar = 0;
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
int inDepth = 0;
|
int inDepth = 0;
|
||||||
int tagStart = -1;
|
int tagStart = -1;
|
||||||
int tagEnd = -1;
|
int tagEnd = -1;
|
||||||
for (unsigned int i=0;i<text.Length()+1;i++) {
|
for (unsigned int i=0;i<text.Length()+1;i++) {
|
||||||
// Get character
|
wxChar curChar = i < text.size() ? text[i] : 0;
|
||||||
if (i<text.Length()) curChar = text[i];
|
|
||||||
else curChar = 0;
|
|
||||||
|
|
||||||
// Change depth
|
// Change depth
|
||||||
if (curChar == '{') {
|
if (curChar == '{') {
|
||||||
|
|
|
@ -113,13 +113,11 @@ void MicroDVDSubtitleFormat::ReadFile(wxString const& filename, wxString const&
|
||||||
|
|
||||||
text.Replace("|", "\\N");
|
text.Replace("|", "\\N");
|
||||||
|
|
||||||
AssDialogue *line = new AssDialogue;
|
AssDialogue *diag = new AssDialogue;
|
||||||
line->group = "[Events]";
|
diag->Start = fps.TimeAtFrame(f1, agi::vfr::START);
|
||||||
line->Style = "Default";
|
diag->End = fps.TimeAtFrame(f2, agi::vfr::END);
|
||||||
line->Start = fps.TimeAtFrame(f1, agi::vfr::START);
|
diag->Text = text;
|
||||||
line->End = fps.TimeAtFrame(f2, agi::vfr::END);
|
Line->push_back(diag);
|
||||||
line->Text = text;
|
|
||||||
Line->push_back(line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,12 +229,14 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
||||||
root = node;
|
root = node;
|
||||||
|
|
||||||
// Write font table
|
// Write font table
|
||||||
|
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTable");
|
node = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTable");
|
||||||
|
root->AddChild(node);
|
||||||
|
|
||||||
wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTableEntry");
|
wxXmlNode *subNode = new wxXmlNode(wxXML_ELEMENT_NODE, "FontTableEntry");
|
||||||
subNode->AddAttribute("fontName", "Sans");
|
subNode->AddAttribute("fontName", "Sans");
|
||||||
subNode->AddAttribute("fontID", "1");
|
subNode->AddAttribute("fontID", "1");
|
||||||
node->AddChild(subNode);
|
node->AddChild(subNode);
|
||||||
root->AddChild(node);
|
|
||||||
|
|
||||||
// Write text box
|
// Write text box
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextBox");
|
node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextBox");
|
||||||
|
@ -255,23 +257,20 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) {
|
||||||
|
|
||||||
void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) {
|
void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) {
|
||||||
// If it doesn't start at the end of previous, add blank
|
// If it doesn't start at the end of previous, add blank
|
||||||
wxXmlNode *node, *subNode;
|
|
||||||
if (prev && prev->End != line->Start) {
|
if (prev && prev->End != line->Start) {
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
||||||
node->AddAttribute("sampleTime", "0" + prev->End.GetASSFormated(true));
|
node->AddAttribute("sampleTime", "0" + prev->End.GetASSFormated(true));
|
||||||
node->AddAttribute("xml:space", "preserve");
|
node->AddAttribute("xml:space", "preserve");
|
||||||
subNode = new wxXmlNode(wxXML_TEXT_NODE, "", "");
|
|
||||||
node->AddChild(subNode);
|
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
|
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate and insert node
|
// Generate and insert node
|
||||||
node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
||||||
node->AddAttribute("sampleTime", "0" + line->Start.GetASSFormated(true));
|
node->AddAttribute("sampleTime", "0" + line->Start.GetASSFormated(true));
|
||||||
node->AddAttribute("xml:space", "preserve");
|
node->AddAttribute("xml:space", "preserve");
|
||||||
subNode = new wxXmlNode(wxXML_TEXT_NODE, "", line->Text);
|
|
||||||
node->AddChild(subNode);
|
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
|
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", line->Text));
|
||||||
|
|
||||||
// Set as previous
|
// Set as previous
|
||||||
prev = line;
|
prev = line;
|
||||||
|
|
|
@ -97,15 +97,15 @@ namespace {
|
||||||
/// Populate the toolbar with buttons
|
/// Populate the toolbar with buttons
|
||||||
void Populate() {
|
void Populate() {
|
||||||
json::Object const& root = get_root();
|
json::Object const& root = get_root();
|
||||||
json::Object::const_iterator it = root.find(name);
|
json::Object::const_iterator root_it = root.find(name);
|
||||||
if (it == root.end()) {
|
if (root_it == root.end()) {
|
||||||
// Toolbar names are all hardcoded so this should never happen
|
// Toolbar names are all hardcoded so this should never happen
|
||||||
throw agi::InternalError("Toolbar named " + name + " not found.", 0);
|
throw agi::InternalError("Toolbar named " + name + " not found.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt();
|
int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt();
|
||||||
|
|
||||||
json::Array const& arr = it->second;
|
json::Array const& arr = root_it->second;
|
||||||
commands.reserve(arr.size());
|
commands.reserve(arr.size());
|
||||||
bool needs_onidle = false;
|
bool needs_onidle = false;
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ AvisynthVideoProvider::AvisynthVideoProvider(wxString filename) try
|
||||||
}
|
}
|
||||||
|
|
||||||
AVISTREAMINFO avis;
|
AVISTREAMINFO avis;
|
||||||
if (AVIStreamInfo(ppavi,&avis,sizeof(avis))) {
|
if (FAILED(AVIStreamInfo(ppavi,&avis,sizeof(avis)))) {
|
||||||
warning = "Unable to read keyframes from AVI file:\nCould not get stream information.";
|
warning = "Unable to read keyframes from AVI file:\nCould not get stream information.";
|
||||||
goto stream_release;
|
goto stream_release;
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ void VisualToolBase::GetLineRotation(AssDialogue *diag, float &rx, float &ry, fl
|
||||||
ry = tag->front()->Get<float>(ry);
|
ry = tag->front()->Get<float>(ry);
|
||||||
if (param_vec tag = find_tag(diag, "\\frz"))
|
if (param_vec tag = find_tag(diag, "\\frz"))
|
||||||
rz = tag->front()->Get<float>(rz);
|
rz = tag->front()->Get<float>(rz);
|
||||||
else if (param_vec tag = find_tag(diag, "\\fr"))
|
else if (tag = find_tag(diag, "\\fr"))
|
||||||
rz = tag->front()->Get<float>(rz);
|
rz = tag->front()->Get<float>(rz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue