Added AssAttachment class to deal with attached files

Originally committed to SVN as r437.
This commit is contained in:
Rodrigo Braz Monteiro 2006-06-30 20:56:16 +00:00
parent 4a2c0dbbfa
commit fa4e158805
4 changed files with 121 additions and 4 deletions

59
core/ass_attachment.cpp Normal file
View File

@ -0,0 +1,59 @@
// Copyright (c) 2006, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// -----------------------------------------------------------------------------
//
// AEGISUB
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
////////////
// Includes
#include "ass_attachment.h"
///////////////
// Constructor
AssAttachment::AssAttachment() {
}
//////////////
// Destructor
AssAttachment::~AssAttachment() {
}
/////////
// Clone
AssEntry *AssAttachment::Clone() {
AssAttachment *clone = new AssAttachment;
return clone;
}

54
core/ass_attachment.h Normal file
View File

@ -0,0 +1,54 @@
// Copyright (c) 2006, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// -----------------------------------------------------------------------------
//
// AEGISUB
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
#pragma once
///////////
// Headers
#include "ass_entry.h"
//////////////////////////////
// Class to store attachments
class AssAttachment : public AssEntry {
public:
ASS_EntryType GetType() { return ENTRY_ATTACHMENT; }
AssEntry *Clone();
AssAttachment();
~AssAttachment();
};

View File

@ -46,6 +46,7 @@
// Prototypes
class AssDialogue;
class AssStyle;
class AssAttachment;
///////////////////
@ -53,7 +54,8 @@ class AssStyle;
enum ASS_EntryType {
ENTRY_BASE,
ENTRY_DIALOGUE,
ENTRY_STYLE
ENTRY_STYLE,
ENTRY_ATTACHMENT
};
@ -81,6 +83,7 @@ public:
virtual wxString GetSSAText();
static AssDialogue *GetAsDialogue(AssEntry *base); // Returns an entry base as a dialogue if it is valid, null otherwise
static AssStyle *GetAsStyle(AssEntry *base); // Returns an entry base as a style if it is valid, null otherwise
static AssAttachment *GetAsAttachment(AssEntry *base);// Returns an entry base as an attachment if it is valid, null otherwise
};
// This operator is for sorting

View File

@ -768,7 +768,7 @@ AudioKaraokeTagMenu::AudioKaraokeTagMenu(AudioKaraoke *_kara)
AppendCheckItem(10003, _T("\\ko"), _("Change karaoke tag to \\ko"));
// Find out what kinds of tags are in use atm
for (int i = 0; i < kara->syllables.size(); i++) {
for (size_t i = 0; i < kara->syllables.size(); i++) {
KaraokeSyllable &syl = kara->syllables[i];
if (syl.selected) {
if (syl.tag == _T("\\k")) {
@ -809,8 +809,9 @@ void AudioKaraokeTagMenu::OnSelectItem(wxCommandEvent &event) {
}
// Apply it
int firstsel = kara->syllables.size(), lastsel = -1;
for (int i = 0; i < kara->syllables.size(); i++) {
size_t firstsel = kara->syllables.size();
int lastsel = -1;
for (size_t i = 0; i < kara->syllables.size(); i++) {
KaraokeSyllable &syl = kara->syllables[i];
if (syl.selected) {
if (firstsel > i) firstsel = i;