From fa4e158805caa26a9fc89fdeaf9d3651352fa6c8 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Fri, 30 Jun 2006 20:56:16 +0000 Subject: [PATCH] Added AssAttachment class to deal with attached files Originally committed to SVN as r437. --- core/ass_attachment.cpp | 59 +++++++++++++++++++++++++++++++++++++++++ core/ass_attachment.h | 54 +++++++++++++++++++++++++++++++++++++ core/ass_entry.h | 5 +++- core/audio_karaoke.cpp | 7 ++--- 4 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 core/ass_attachment.cpp create mode 100644 core/ass_attachment.h diff --git a/core/ass_attachment.cpp b/core/ass_attachment.cpp new file mode 100644 index 000000000..9157ca256 --- /dev/null +++ b/core/ass_attachment.cpp @@ -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; +} diff --git a/core/ass_attachment.h b/core/ass_attachment.h new file mode 100644 index 000000000..a53c59aa0 --- /dev/null +++ b/core/ass_attachment.h @@ -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(); +}; diff --git a/core/ass_entry.h b/core/ass_entry.h index 6f496bdd7..7d7efbe59 100644 --- a/core/ass_entry.h +++ b/core/ass_entry.h @@ -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 diff --git a/core/audio_karaoke.cpp b/core/audio_karaoke.cpp index 5860ef00a..5d05881d1 100644 --- a/core/audio_karaoke.cpp +++ b/core/audio_karaoke.cpp @@ -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;