diff --git a/aegisub/src/aegisub_endian.h b/aegisub/src/aegisub_endian.h index 657e7ba18..bc9087be2 100644 --- a/aegisub/src/aegisub_endian.h +++ b/aegisub/src/aegisub_endian.h @@ -36,6 +36,8 @@ #pragma once #ifndef _AEGISUB_ENDIAN_H + +/// DOCME #define _AEGISUB_ENDIAN_H @@ -48,15 +50,23 @@ // But this is an OS X system building a universal binary // Apple's GCC defines _BIG_ENDIAN when building for PPC # ifdef _BIG_ENDIAN + +/// DOCME # define HAVE_BIG_ENDIAN # else + +/// DOCME # define HAVE_LITTLE_ENDIAN # endif + +/// DOCME # undef HAVE_DYNAMIC_ENDIAN # else // !HAVE_UNIVERSAL_ENDIAN // We aren't building an OS X universal binary // Use the dynamic endian code # ifndef HAVE_DYNAMIC_ENDIAN + +/// DOCME # define HAVE_DYNAMIC_ENDIAN # endif # endif //HAVE_UNIVERSAL_ENDIAN @@ -73,6 +83,8 @@ #include + +/// DOCME namespace Endian { // Unconditionally reverse endianness @@ -80,6 +92,11 @@ namespace Endian { // These are only defined for unsigned ints, // Use reinterpret_cast on the values if you need signed values. + + /// @brief DOCME + /// @param val + /// @return + /// inline uint16_t Reverse(uint16_t val) { return @@ -87,6 +104,11 @@ namespace Endian { ((val & 0xFF00) >> 8); } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint32_t Reverse(uint32_t val) { return @@ -96,6 +118,11 @@ namespace Endian { ((val & 0xFF000000) >> 24); } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint64_t Reverse(uint64_t val) { return @@ -116,6 +143,11 @@ namespace Endian { // Regular, fast, templatized conditional reversing template + + /// @brief DOCME + /// @param val + /// @return + /// inline T LittleToMachine(T val) { #ifdef HAVE_BIG_ENDIAN @@ -128,6 +160,11 @@ namespace Endian { } template + + /// @brief DOCME + /// @param val + /// @return + /// inline T BigToMachine(T val) { #ifdef HAVE_LITTLE_ENDIAN @@ -140,6 +177,11 @@ namespace Endian { } template + + /// @brief DOCME + /// @param val + /// @return + /// inline T MachineToLittle(T val) { #ifdef HAVE_BIG_ENDIAN @@ -152,6 +194,11 @@ namespace Endian { } template + + /// @brief DOCME + /// @param val + /// @return + /// inline T MachineToBig(T val) { #ifdef HAVE_LITTLE_ENDIAN @@ -179,22 +226,45 @@ namespace Endian { // Unions to pack together ints and get their physical bytes + + /// DOCME union bytes16 { + + /// DOCME uint8_t byte[2]; + + /// DOCME uint16_t word; }; + + /// DOCME union bytes32 { + + /// DOCME uint8_t byte[4]; + + /// DOCME uint32_t word; }; + + /// DOCME union bytes64 { + + /// DOCME uint8_t byte[8]; + + /// DOCME uint64_t word; }; // 16 bit words + + /// @brief DOCME + /// @param val + /// @return + /// inline uint16_t MachineToBig(uint16_t val) { bytes16 pack; @@ -205,6 +275,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint16_t MachineToLittle(uint16_t val) { bytes16 pack; @@ -215,6 +290,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint16_t BigToMachine(uint16_t val) { bytes16 pack; @@ -224,6 +304,11 @@ namespace Endian { return uint16_t(pack.byte[1]) | (uint16_t(pack.byte[0]) << 8); } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint16_t LittleToMachine(uint16_t val) { bytes16 pack; @@ -236,6 +321,11 @@ namespace Endian { // 32 bit words + + /// @brief DOCME + /// @param val + /// @return + /// inline uint32_t MachineToBig(uint32_t val) { bytes32 pack; @@ -246,6 +336,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint32_t MachineToLittle(uint32_t val) { bytes32 pack; @@ -256,6 +351,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint32_t BigToMachine(uint32_t val) { bytes32 pack; @@ -267,6 +367,11 @@ namespace Endian { uint32_t(pack.byte[3]); } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint32_t LittleToMachine(uint32_t val) { bytes32 pack; @@ -281,6 +386,11 @@ namespace Endian { // 64 bit words + + /// @brief DOCME + /// @param val + /// @return + /// inline uint64_t MachineToBig(uint64_t val) { bytes64 pack; @@ -295,6 +405,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint64_t MachineToLittle(uint64_t val) { bytes64 pack; @@ -309,6 +424,11 @@ namespace Endian { return pack.word; } + + /// @brief DOCME + /// @param val + /// @return + /// inline uint64_t BigToMachine(uint64_t val) { bytes64 pack; @@ -324,6 +444,10 @@ namespace Endian { uint64_t(pack.byte[7]); } + + /// @brief DOCME + /// @param val + /// inline uint64_t LittleToMachine(uint64_t val) { bytes64 pack; @@ -346,3 +470,4 @@ namespace Endian { #endif + diff --git a/aegisub/src/aegisublocale.cpp b/aegisub/src/aegisublocale.cpp index 38f5ef386..c68a0a807 100644 --- a/aegisub/src/aegisublocale.cpp +++ b/aegisub/src/aegisublocale.cpp @@ -49,19 +49,25 @@ #include "standard_paths.h" #include -/////////////// -// Constructor + +/// @brief Constructor +/// AegisubLocale::AegisubLocale () { locale = NULL; curCode = -1; } + +/// @brief DOCME +/// AegisubLocale::~AegisubLocale() { delete locale; } -////////////// -// Initialize + +/// @brief Initialize +/// @param language +/// void AegisubLocale::Init(int language) { if (language == -1) language = wxLANGUAGE_ENGLISH; if (locale) delete locale; @@ -86,8 +92,10 @@ void AegisubLocale::Init(int language) { } -/////////////////// -// Pick a language + +/// @brief Pick a language +/// @return +/// int AegisubLocale::PickLanguage() { // Get list wxArrayInt langs = GetAvailableLanguages(); @@ -120,8 +128,9 @@ int AegisubLocale::PickLanguage() { } -/////////////////////////////////// -// Get list of available languages + +/// @brief Get list of available languages +/// wxArrayInt AegisubLocale::GetAvailableLanguages() { wxArrayInt final; @@ -177,3 +186,4 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() { return final; } + diff --git a/aegisub/src/aegisublocale.h b/aegisub/src/aegisublocale.h index e8f6da939..909954d7a 100644 --- a/aegisub/src/aegisublocale.h +++ b/aegisub/src/aegisublocale.h @@ -35,6 +35,8 @@ /// #ifndef LOCALE_H + +/// DOCME #define LOCALE_H @@ -43,14 +45,22 @@ class wxLocale; -//////////////////////// -// Aegisub locale class + +/// DOCME +/// @class AegisubLocale +/// @brief DOCME +/// +/// DOCME class AegisubLocale { private: + + /// DOCME wxLocale *locale; wxArrayInt GetAvailableLanguages(); public: + + /// DOCME int curCode; AegisubLocale(); @@ -62,3 +72,4 @@ public: #endif + diff --git a/aegisub/src/ass_attachment.cpp b/aegisub/src/ass_attachment.cpp index 7ef235e3b..e8b74f768 100644 --- a/aegisub/src/ass_attachment.cpp +++ b/aegisub/src/ass_attachment.cpp @@ -44,8 +44,10 @@ #include "ass_attachment.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _name +/// AssAttachment::AssAttachment(wxString _name) { // Parse name filename = _name; @@ -63,14 +65,17 @@ AssAttachment::AssAttachment(wxString _name) { } -////////////// -// Destructor + +/// @brief Destructor +/// AssAttachment::~AssAttachment() { } -///////// -// Clone + +/// @brief Clone +/// @return +/// AssEntry *AssAttachment::Clone() { // New object AssAttachment *clone = new AssAttachment(filename); @@ -83,29 +88,36 @@ AssEntry *AssAttachment::Clone() { } -//////////// -// Get data + +/// @brief Get data +/// @return +/// const DataVec &AssAttachment::GetData() { return data->GetData(); } -///////////////// -// Add more data + +/// @brief Add more data +/// @param _data +/// void AssAttachment::AddData(wxString _data) { data->AddData(_data); } -////////////////////// -// Finish adding data + +/// @brief Finish adding data +/// void AssAttachment::Finish() { data->Finish(); } -///////////////////////////////////// -// Get encoded data to write on file + +/// @brief Get encoded data to write on file +/// @return +/// const wxString AssAttachment::GetEntryData() { // Get data const DataVec &dat = data->GetData(); @@ -162,8 +174,11 @@ const wxString AssAttachment::GetEntryData() { } -///////////////////// -// Extract as a file + +/// @brief Extract as a file +/// @param filename +/// @return +/// void AssAttachment::Extract(wxString filename) { // Open file wxFileOutputStream fp(filename); @@ -172,8 +187,10 @@ void AssAttachment::Extract(wxString filename) { } -///////////////////////////// -// Read a file as attachment + +/// @brief Read a file as attachment +/// @param filename +/// void AssAttachment::Import(wxString filename) { // Data DataVec &datavec = data->GetData(); @@ -190,8 +207,11 @@ void AssAttachment::Import(wxString filename) { } -//////////////// -// Get filename + +/// @brief Get filename +/// @param raw +/// @return +/// wxString AssAttachment::GetFileName(bool raw) { // Raw if (raw || filename.Right(4).Lower() != _T(".ttf")) return filename; @@ -212,35 +232,41 @@ wxString AssAttachment::GetFileName(bool raw) { -/////////////////// Attachment ////////////////// -/////////////// -// Constructor + +/// @brief Constructor Attachment ////////////////// +/// AttachData::AttachData() { } -////////////// -// Destructor + +/// @brief Destructor +/// AttachData::~AttachData() { } -//////////// -// Get data + +/// @brief Get data +/// @return +/// DataVec &AttachData::GetData() { return data; } -//////////// -// Add data + +/// @brief Add data +/// @param data +/// void AttachData::AddData(wxString data) { buffer += data; } -////////// -// Finish + +/// @brief Finish +/// void AttachData::Finish() { // Source and dest buffers unsigned char src[4]; @@ -289,3 +315,4 @@ void AttachData::Finish() { buffer.Shrink(); } + diff --git a/aegisub/src/ass_attachment.h b/aegisub/src/ass_attachment.h index 44926345a..d4c05fa9c 100644 --- a/aegisub/src/ass_attachment.h +++ b/aegisub/src/ass_attachment.h @@ -45,16 +45,24 @@ #include -/////////// -// Typedef + +/// DOCME typedef std::vector DataVec; -/////////////////// -// Attachment data + +/// DOCME +/// @class AttachData +/// @brief DOCME +/// +/// DOCME class AttachData { private: + + /// DOCME DataVec data; + + /// DOCME wxString buffer; public: @@ -67,11 +75,19 @@ public: }; -////////////////////////////// -// Class to store attachments + +/// DOCME +/// @class AssAttachment +/// @brief DOCME +/// +/// DOCME class AssAttachment : public AssEntry { private: + + /// DOCME boost::shared_ptr data; + + /// DOCME wxString filename; public: @@ -85,6 +101,9 @@ public: wxString GetFileName(bool raw=false); const wxString GetEntryData(); + + /// @brief DOCME + /// ASS_EntryType GetType() { return ENTRY_ATTACHMENT; } AssEntry *Clone(); @@ -92,3 +111,4 @@ public: ~AssAttachment(); }; + diff --git a/aegisub/src/ass_dialogue.cpp b/aegisub/src/ass_dialogue.cpp index 3d74c3619..df22c786c 100644 --- a/aegisub/src/ass_dialogue.cpp +++ b/aegisub/src/ass_dialogue.cpp @@ -48,8 +48,9 @@ #include "utils.h" -////////////////////// AssDialogue ////////////////////// -// Constructs AssDialogue + +/// @brief Constructs AssDialogue AssDialogue ////////////////////// +/// AssDialogue::AssDialogue() { group = _T("[Events]"); @@ -68,6 +69,11 @@ AssDialogue::AssDialogue() { } + +/// @brief DOCME +/// @param _data +/// @param version +/// AssDialogue::AssDialogue(wxString _data,int version) { // Set group group = _T("[Events]"); @@ -92,22 +98,25 @@ AssDialogue::AssDialogue(wxString _data,int version) { } -////////////// -// Destructor + +/// @brief Destructor +/// AssDialogue::~AssDialogue () { Clear(); } -///////// -// Clear + +/// @brief Clear +/// void AssDialogue::Clear () { ClearBlocks(); } -//////////////// -// Clear blocks + +/// @brief Clear blocks +/// void AssDialogue::ClearBlocks() { using std::vector; for (vector::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) { @@ -117,8 +126,12 @@ void AssDialogue::ClearBlocks() { } -////////////////// -// Parse ASS Data + +/// @brief Parse ASS Data +/// @param rawData +/// @param version +/// @return +/// bool AssDialogue::Parse(wxString rawData, int version) { size_t pos = 0; wxString temp; @@ -213,8 +226,10 @@ bool AssDialogue::Parse(wxString rawData, int version) { } -///////////// -// Make data + +/// @brief Make data +/// @return +/// wxString AssDialogue::MakeData() { // Prepare static wxString final = _T(""); @@ -254,27 +269,34 @@ wxString AssDialogue::MakeData() { } -////////////////////////////////// -// Update AssDialogue's data line + +/// @brief Update AssDialogue's data line +/// void AssDialogue::UpdateData () { } -////////////////// -// Get entry data + +/// @brief Get entry data +/// @return +/// const wxString AssDialogue::GetEntryData() { return MakeData(); } -////////////////// -// Set entry data + +/// @brief Set entry data +/// @param newData +/// void AssDialogue::SetEntryData(wxString newData) { } -/////////////////////////////// -// Get SSA version of Dialogue + +/// @brief Get SSA version of Dialogue +/// @return +/// wxString AssDialogue::GetSSAText () { // Prepare wxString work = _T(""); @@ -308,10 +330,9 @@ wxString AssDialogue::GetSSAText () { } -////////////////// -// Parse SRT tags -// -------------- -// Yea, I convert to ASS tags, then parse that. So sue me. + +/// @brief Yea, I convert to ASS tags, then parse that. So sue me. -------------- Parse SRT tags +/// void AssDialogue::ParseSRTTags () { // Search and replace size_t total = 0; @@ -448,8 +469,9 @@ void AssDialogue::ParseSRTTags () { } -////////////////// -// Parse ASS tags + +/// @brief Parse ASS tags +/// void AssDialogue::ParseASSTags () { // Clear blocks ClearBlocks(); @@ -544,16 +566,19 @@ void AssDialogue::ParseASSTags () { } -////////////// -// Strip tags + +/// @brief Strip tags +/// void AssDialogue::StripTags () { static wxRegEx reg(_T("\\{[^\\{]*\\}"),wxRE_ADVANCED); reg.Replace(&Text,_T("")); } -//////////////////////// -// Strip a specific tag + +/// @brief Strip a specific tag +/// @param tagName +/// void AssDialogue::StripTag (wxString tagName) { // Parse using std::list; @@ -583,11 +608,9 @@ void AssDialogue::StripTag (wxString tagName) { } -/////////////////////// -// Convert tags to SRT -// ------------------- -// TODO: Improve this code -// + +/// @brief TODO: Improve this code ------------------- Convert tags to SRT +/// void AssDialogue::ConvertTagsToSRT () { // Setup using std::list; @@ -688,8 +711,9 @@ void AssDialogue::ConvertTagsToSRT () { } -////////////////////////// -// Updates text from tags + +/// @brief Updates text from tags +/// void AssDialogue::UpdateText () { using std::vector; Text = _T(""); @@ -704,8 +728,11 @@ void AssDialogue::UpdateText () { } -///////////////////////////// -// Sets margin from a string + +/// @brief Sets margin from a string +/// @param origvalue +/// @param which +/// void AssDialogue::SetMarginString(const wxString origvalue,int which) { // Make it numeric wxString strvalue = origvalue; @@ -732,8 +759,12 @@ void AssDialogue::SetMarginString(const wxString origvalue,int which) { } -////////////////////////// -// Gets string for margin + +/// @brief Gets string for margin +/// @param which +/// @param pad +/// @return +/// wxString AssDialogue::GetMarginString(int which,bool pad) { if (which < 0 || which >= 4) throw new Aegisub::InvalidMarginIdError; int value = Margin[which]; @@ -742,8 +773,14 @@ wxString AssDialogue::GetMarginString(int which,bool pad) { } -/////////////////////////////////// -// Process parameters via callback + +/// @brief Process parameters via callback +/// @param tagName +/// @param par_n +/// @param param +/// @param userData) +/// @param userData +/// void AssDialogue::ProcessParameters(void (*callback)(wxString tagName,int par_n,AssOverrideParameter *param,void *userData),void *userData) { // Apply for all override blocks AssDialogueBlockOverride *curBlock; @@ -758,8 +795,11 @@ void AssDialogue::ProcessParameters(void (*callback)(wxString tagName,int par_n, } -/////////////////////////////// -// Checks if two lines collide + +/// @brief Checks if two lines collide +/// @param target +/// @return +/// bool AssDialogue::CollidesWith(AssDialogue *target) { if (!target) return false; int a = Start.GetMS(); @@ -770,8 +810,10 @@ bool AssDialogue::CollidesWith(AssDialogue *target) { } -//////////////////////// -// Return just the text without any overrides + +/// @brief Return just the text without any overrides +/// @return +/// wxString AssDialogue::GetStrippedText() const { wxString justtext = wxString(_T("")); bool inCode = false; @@ -783,8 +825,10 @@ wxString AssDialogue::GetStrippedText() const { } return justtext; } -///////// -// Clone + +/// @brief Clone +/// @return +/// AssEntry *AssDialogue::Clone() const { // Create clone AssDialogue *final = new AssDialogue(); @@ -808,23 +852,26 @@ AssEntry *AssDialogue::Clone() const { } -////////////////////// AssDialogueBlock ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssDialogueBlock ////////////////////// +/// AssDialogueBlock::AssDialogueBlock () { } -////////////// -// Destructor + +/// @brief Destructor +/// @return +/// AssDialogueBlock::~AssDialogueBlock () { } -//////////////////////////// -// Returns as a plain block -// ---------------------- -// If it isn't a plain block, returns NULL + +/// @brief If it isn't a plain block, returns NULL ---------------------- Returns as a plain block +/// @param base +/// @return +/// AssDialogueBlockPlain *AssDialogueBlock::GetAsPlain(AssDialogueBlock *base) { if (!base) return NULL; if (base->GetType() == BLOCK_PLAIN) { @@ -834,10 +881,11 @@ AssDialogueBlockPlain *AssDialogueBlock::GetAsPlain(AssDialogueBlock *base) { } -//////////////////////////////// -// Returns as an override block -// ---------------------------- -// If it isn't an override block, returns NULL + +/// @brief If it isn't an override block, returns NULL ---------------------------- Returns as an override block +/// @param base +/// @return +/// AssDialogueBlockOverride *AssDialogueBlock::GetAsOverride(AssDialogueBlock *base) { if (!base) return NULL; if (base->GetType() == BLOCK_OVERRIDE) { @@ -847,10 +895,11 @@ AssDialogueBlockOverride *AssDialogueBlock::GetAsOverride(AssDialogueBlock *base } -////////////////////////////// -// Returns as a drawing block -// ---------------------------- -// If it isn't an drawing block, returns NULL + +/// @brief If it isn't an drawing block, returns NULL ---------------------------- Returns as a drawing block +/// @param base +/// @return +/// AssDialogueBlockDrawing *AssDialogueBlock::GetAsDrawing(AssDialogueBlock *base) { if (!base) return NULL; if (base->GetType() == BLOCK_DRAWING) { @@ -860,22 +909,27 @@ AssDialogueBlockDrawing *AssDialogueBlock::GetAsDrawing(AssDialogueBlock *base) } -////////////////////// AssDialogueBlockPlain ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssDialogueBlockPlain ////////////////////// +/// AssDialogueBlockPlain::AssDialogueBlockPlain () { } -////////////////////// AssDialogueBlockDrawing ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssDialogueBlockDrawing ////////////////////// +/// AssDialogueBlockDrawing::AssDialogueBlockDrawing () { } -//////////////////////// -// Multiply coordinates + +/// @brief Multiply coordinates +/// @param mx +/// @param my +/// @param x +/// @param y +/// void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) { // HACK: Implement a proper parser ffs!! wxStringTokenizer tkn(GetText(),_T(" "),wxTOKEN_DEFAULT); @@ -917,3 +971,4 @@ void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) { + diff --git a/aegisub/src/ass_dialogue.h b/aegisub/src/ass_dialogue.h index 1c368df16..6877aeed9 100644 --- a/aegisub/src/ass_dialogue.h +++ b/aegisub/src/ass_dialogue.h @@ -54,45 +54,63 @@ class AssDialogueBlockOverride; class AssDialogueBlockDrawing; -/////////////////// -// Block type enum + +/// DOCME enum ASS_BlockType { + + /// DOCME BLOCK_BASE, + + /// DOCME BLOCK_PLAIN, + + /// DOCME BLOCK_OVERRIDE, + + /// DOCME BLOCK_DRAWING }; -////////////////////// -// AssDialogue Blocks -// ------------------ -// A block is each group in the text field of an AssDialogue -// For example: -// Yes, I {\i1}am{\i0} here. -// -// Gets split in five blocks: -// "Yes, I " (Plain) -// "\i1" (Override) -// "am" (Plain) -// "\i0" (Override) -// " here." (Plain) -// -// Also note how {}s are discarded. -// Override blocks are further divided in AssOverrideTag's. -// -// The GetText() method generates a new value for the "text" field from -// the other fields in the specific class, and returns the new value. -// +/// DOCME +/// @class AssDialogueBlock + +/// @brief AssDialogue Blocks +/// +/// A block is each group in the text field of an AssDialogue +/// @verbatium +/// Yes, I {\i1}am{\i0} here. +/// +/// Gets split in five blocks: +/// "Yes, I " (Plain) +/// "\i1" (Override) +/// "am" (Plain) +/// "\i0" (Override) +/// " here." (Plain) +/// +/// Also note how {}s are discarded. +/// Override blocks are further divided in AssOverrideTag's. +/// +/// The GetText() method generates a new value for the "text" field from +/// the other fields in the specific class, and returns the new value. +/// @endverbatium class AssDialogueBlock { public: + + /// DOCME wxString text; + + /// DOCME AssDialogue *parent; AssDialogueBlock(); virtual ~AssDialogueBlock(); virtual ASS_BlockType GetType() = 0; + + /// @brief DOCME + /// @return + /// virtual wxString GetText() { return text; } static AssDialogueBlockPlain *GetAsPlain(AssDialogueBlock *base); // Returns a block base as a plain block if it is valid, null otherwise static AssDialogueBlockOverride *GetAsOverride(AssDialogueBlock *base); // Returns a block base as an override block if it is valid, null otherwise @@ -100,47 +118,64 @@ public: }; -///////////////////////////// -// Plain dialogue block text -// ------------------------- -// This is used for standard text -// type = BLOCK_PLAIN -// + +/// DOCME +/// @class AssDialogueBlockPlain + +/// @brief DOCME +/// +/// DOCME class AssDialogueBlockPlain : public AssDialogueBlock { public: + + /// @brief DOCME + /// @return + /// ASS_BlockType GetType() { return BLOCK_PLAIN; } AssDialogueBlockPlain(); }; -///////////////////////////// -// Plain dialogue block text -// ------------------------- -// This is used for drawing commands -// type = BLOCK_DRAWING -// + +/// DOCME +/// @class AssDialogueBlockDrawing +/// @brief DOCME +/// +/// DOCME class AssDialogueBlockDrawing : public AssDialogueBlock { public: + + /// DOCME int Scale; + + /// @brief DOCME + /// @return + /// ASS_BlockType GetType() { return BLOCK_DRAWING; } AssDialogueBlockDrawing(); void TransformCoords(int trans_x,int trans_y,double mult_x,double mult_y); }; -////////////////////// -// Override tag block -// ------------------ -// Used to store ASS overrides -// Type = BLOCK_OVERRIDE -// + +/// DOCME +/// @class AssDialogueBlockOverride +/// @brief DOCME +/// +/// DOCME class AssDialogueBlockOverride : public AssDialogueBlock { public: AssDialogueBlockOverride(); ~AssDialogueBlockOverride(); + + /// DOCME std::vector Tags; + + /// @brief DOCME + /// @return + /// ASS_BlockType GetType() { return BLOCK_OVERRIDE; } wxString GetText(); void ParseTags(); // Parses tags @@ -148,25 +183,53 @@ public: }; -//////////////////////////////////////// -// Class for Dialogue and Comment lines + +/// DOCME +/// @class AssDialogue +/// @brief DOCME +/// +/// DOCME class AssDialogue : public AssEntry { private: wxString MakeData(); public: + + /// DOCME std::vector Blocks; // Contains information about each block of text + + /// DOCME bool Comment; // Is this a comment line? + + /// DOCME int Layer; // Layer number + + /// DOCME int Margin[4]; // Margins: 0 = Left, 1 = Right, 2 = Top (Vertical), 3 = Bottom + + /// DOCME AssTime Start; // Starting time + + /// DOCME AssTime End; // Ending time + + /// DOCME wxString Style; // Style name + + /// DOCME wxString Actor; // Actor name + + /// DOCME wxString Effect; // Effect name + + /// DOCME wxString Text; // Raw text data + + /// @brief DOCME + /// @return + /// ASS_EntryType GetType() { return ENTRY_DIALOGUE; } bool Parse(wxString data,int version=1); // Parses raw ASS data into everything else @@ -186,10 +249,29 @@ public: void SetEntryData(wxString newData); void Clear(); // Wipes all data + + /// @brief DOCME + /// @return + /// virtual int GetStartMS() const { return Start.GetMS(); } + + /// @brief DOCME + /// @return + /// virtual int GetEndMS() const { return End.GetMS(); } + + /// @brief DOCME + /// @param newStart + /// virtual void SetStartMS(const int newStart) { AssEntry::SetStartMS(newStart); Start.SetMS(newStart); } + + /// @brief DOCME + /// @param newEnd + /// virtual void SetEndMS(const int newEnd) { End.SetMS(newEnd); } + + /// @brief DOCME + /// void FixStartMS() { AssEntry::SetStartMS(Start.GetMS()); } // Update StartMS in AssEntry from the Start value here void SetMarginString(const wxString value,int which); // Set string to a margin value (0 = left, 1 = right, 2 = vertical/top, 3 = bottom) @@ -204,3 +286,4 @@ public: ~AssDialogue(); }; + diff --git a/aegisub/src/ass_entry.cpp b/aegisub/src/ass_entry.cpp index 26eb4fd39..bc384d3ae 100644 --- a/aegisub/src/ass_entry.cpp +++ b/aegisub/src/ass_entry.cpp @@ -45,34 +45,46 @@ #include "ass_entry.h" -////////////////////// AssEntry ////////////////////// -/////////////////////// -// Constructs AssEntry + +/// @brief Constructs AssEntry AssEntry ////////////////////// +/// AssEntry::AssEntry() { Valid = true; } + +/// @brief DOCME +/// @param _data +/// AssEntry::AssEntry(wxString _data) { data = _data; Valid = true; } -/////////////////////////// -// Destructor for AssEntry + +/// @brief Destructor for AssEntry +/// AssEntry::~AssEntry() { } -/////////////////////////// -// Comparison for STL Sort + +/// @brief Comparison for STL Sort +/// @param t1 +/// @param t2 +/// @return +/// bool operator < (const AssEntry &t1, const AssEntry &t2) { return (t1.GetStartMS() < t2.GetStartMS()); } -//////////////////////////////////////////////////////////////// -// Returns an entry as dialogue if possible, else, returns NULL + +/// @brief Returns an entry as dialogue if possible, else, returns NULL +/// @param base +/// @return +/// AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) { if (!base) return NULL; if (base->GetType() == ENTRY_DIALOGUE) { @@ -82,8 +94,11 @@ AssDialogue *AssEntry::GetAsDialogue(AssEntry *base) { } -///////////////////////////////////////////////////////////// -// Returns an entry as style if possible, else, returns NULL + +/// @brief Returns an entry as style if possible, else, returns NULL +/// @param base +/// @return +/// AssStyle *AssEntry::GetAsStyle(AssEntry *base) { if (!base) return NULL; if (base->GetType() == ENTRY_STYLE) { @@ -93,8 +108,11 @@ AssStyle *AssEntry::GetAsStyle(AssEntry *base) { } -/////////////////////////////////////////////////////////////////// -// Returns an entry as attachment if possible, else, returns NULL + +/// @brief Returns an entry as attachment if possible, else, returns NULL +/// @param base +/// @return +/// AssAttachment *AssEntry::GetAsAttachment(AssEntry *base) { if (!base) return NULL; if (base->GetType() == ENTRY_ATTACHMENT) { @@ -104,8 +122,10 @@ AssAttachment *AssEntry::GetAsAttachment(AssEntry *base) { } -////////////////////// -// Get SSA conversion + +/// @brief Get SSA conversion +/// @return +/// wxString AssEntry::GetSSAText() { // Special cases if (data.Lower() == _T("[v4+ styles]")) return wxString(_T("[V4 Styles]")); @@ -118,8 +138,9 @@ wxString AssEntry::GetSSAText() { } -///////// -// Clone + +/// @brief Clone +/// AssEntry *AssEntry::Clone() const { // Create clone AssEntry *final = new AssEntry(); @@ -134,3 +155,4 @@ AssEntry *AssEntry::Clone() const { return final; } + diff --git a/aegisub/src/ass_entry.h b/aegisub/src/ass_entry.h index 2b6cab1a2..e4508372d 100644 --- a/aegisub/src/ass_entry.h +++ b/aegisub/src/ass_entry.h @@ -52,36 +52,70 @@ class AssStyle; class AssAttachment; -/////////////////// -// Entry type enum + +/// DOCME enum ASS_EntryType { + + /// DOCME ENTRY_BASE, + + /// DOCME ENTRY_DIALOGUE, + + /// DOCME ENTRY_STYLE, + + /// DOCME ENTRY_ATTACHMENT }; + +/// DOCME namespace Aegisub { - // Thrown when someone supplies an invalid margin ID to a function expecting one - // (Usually limited to range 0..3.) + + /// DOCME + /// @class InvalidMarginIdError + /// @brief DOCME + /// + /// DOCME class InvalidMarginIdError : public InternalError { public: + + /// @brief DOCME + /// @return + /// InvalidMarginIdError() : InternalError(_T("Invalid margin id"), 0) { } + + /// @brief DOCME + /// @return + /// const wxChar *GetName() { return _T("internal_error/invalid_margin_id"); } }; }; -//////////////////////////////////// -// Base class for each line in file + +/// DOCME +/// @class AssEntry +/// @brief DOCME +/// +/// DOCME class AssEntry { private: + + /// DOCME wxString data; // Raw data, exactly the same line that appears on the .ass (note that this will be in ass even if source wasn't) + + /// DOCME int StartMS; // This is only stored for sorting issues, in order to keep non-dialogue lines aligned public: + + /// DOCME bool Valid; // Flags as valid or not + + /// DOCME wxString group; // Group it belongs to, e.g. "[Events]" AssEntry(); @@ -90,13 +124,42 @@ public: virtual AssEntry *Clone() const; + + /// @brief DOCME + /// @return + /// virtual int GetStartMS() const { return StartMS; } + + /// @brief DOCME + /// @return + /// virtual int GetEndMS() const { return StartMS; } + + /// @brief DOCME + /// @param newStart + /// virtual void SetStartMS(const int newStart) { StartMS = newStart; } + + /// @brief DOCME + /// @param newEnd + /// @return + /// virtual void SetEndMS(const int newEnd) { /* do nothing */ (void)newEnd; } + + /// @brief DOCME + /// @return + /// virtual ASS_EntryType GetType() { return ENTRY_BASE; } + + /// @brief DOCME + /// @return + /// virtual const wxString GetEntryData() { return data; } + + /// @brief DOCME + /// @param newData + /// virtual void SetEntryData(wxString newData) { if (newData.IsEmpty()) data.Clear(); else data = newData; } virtual wxString GetSSAText(); @@ -108,3 +171,4 @@ public: // This operator is for sorting bool operator < (const AssEntry &t1, const AssEntry &t2); + diff --git a/aegisub/src/ass_export_filter.cpp b/aegisub/src/ass_export_filter.cpp index 84fd73fc7..6da82eefb 100644 --- a/aegisub/src/ass_export_filter.cpp +++ b/aegisub/src/ass_export_filter.cpp @@ -43,8 +43,9 @@ #include "ass_file.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AssExportFilter::AssExportFilter() { hidden = false; autoExporter = false; @@ -54,8 +55,9 @@ AssExportFilter::AssExportFilter() { } -////////////// -// Destructor + +/// @brief Destructor +/// AssExportFilter::~AssExportFilter() { try { Unregister(); @@ -66,8 +68,11 @@ AssExportFilter::~AssExportFilter() { } -//////////// -// Register + +/// @brief Register +/// @param name +/// @param priority +/// void AssExportFilter::Register (wxString name,int priority) { // Check if it's registered // Changed this to an assert, since this kind of error should really only happen during dev. -jfs @@ -114,8 +119,9 @@ try_new_name: } -////////////// -// Unregister + +/// @brief Unregister +/// void AssExportFilter::Unregister () { // Check if it's registered if (!IsRegistered()) throw wxString::Format(_T("Unregister export filter: name \"%s\" is not registered."), RegisterName.c_str()); @@ -126,8 +132,10 @@ void AssExportFilter::Unregister () { } -///////////////////////////// -// Checks if it's registered + +/// @brief Checks if it's registered +/// @return +/// bool AssExportFilter::IsRegistered() { // Check name if (RegisterName.IsEmpty()) { @@ -148,49 +156,61 @@ bool AssExportFilter::IsRegistered() { } -///////////// -// Get sizer + +/// @brief Get sizer +/// @param parent +/// @return +/// wxWindow *AssExportFilter::GetConfigDialogWindow(wxWindow *parent) { return NULL; } -//////////////////// -// Config dialog OK + +/// @brief Config dialog OK +/// @param IsDefault +/// void AssExportFilter::LoadSettings(bool IsDefault) { } -////////////////////// -// Description reader + +/// @brief Description reader +/// @return +/// const wxString& AssExportFilter::GetDescription() const { return description; } -/////////////// -// Static list + +/// DOCME AssExportFilterChain *AssExportFilterChain::instance=NULL; -//////////// -// Get list + +/// @brief Get list +/// @return +/// FilterList *AssExportFilterChain::GetFilterList() { if (instance == NULL) instance = new AssExportFilterChain(); return &(instance->Filters); } -/////////////////////// -// Get unprepared list + +/// @brief Get unprepared list +/// @return +/// FilterList *AssExportFilterChain::GetUnpreparedFilterList() { if (instance == NULL) instance = new AssExportFilterChain(); return &(instance->Unprepared); } -/////////////////// -// Prepare filters + +/// @brief Prepare filters +/// void AssExportFilterChain::PrepareFilters() { for (FilterList::iterator cur=instance->Unprepared.begin();cur!=instance->Unprepared.end();cur++) { (*cur)->Init(); @@ -198,3 +218,4 @@ void AssExportFilterChain::PrepareFilters() { instance->Unprepared.clear(); } + diff --git a/aegisub/src/ass_export_filter.h b/aegisub/src/ass_export_filter.h index 099d66008..441260b5d 100644 --- a/aegisub/src/ass_export_filter.h +++ b/aegisub/src/ass_export_filter.h @@ -54,21 +54,31 @@ class DialogExport; class AssExporter; -//////////// -// Typedefs + +/// DOCME typedef std::list FilterList; -////////////////////////////////////// -// Singleton for storing filter chain + +/// DOCME +/// @class AssExportFilterChain +/// @brief DOCME +/// +/// DOCME class AssExportFilterChain { friend class AssExportFilter; friend class AssExporter; private: + + /// DOCME FilterList Filters; + + /// DOCME FilterList Unprepared; + + /// DOCME static AssExportFilterChain *instance; static FilterList *GetFilterList(); static FilterList *GetUnpreparedFilterList(); @@ -78,20 +88,36 @@ public: }; -//////////////////////////// -// Base export filter class + +/// DOCME +/// @class AssExportFilter +/// @brief DOCME +/// +/// DOCME class AssExportFilter { friend class AssExporter; friend class AssExportFilterChain; private: + + /// DOCME wxString RegisterName; + + /// DOCME int Priority; protected: + + /// DOCME bool autoExporter; + + /// DOCME bool hidden; + + /// DOCME bool initialized; + + /// DOCME wxString description; void Register(wxString name,int priority=0); // Register the filter with specific name. Higher priority filters get the file to process first. @@ -110,3 +136,4 @@ public: virtual void LoadSettings(bool IsDefault); // Config dialog is done - extract data now. }; + diff --git a/aegisub/src/ass_exporter.cpp b/aegisub/src/ass_exporter.cpp index ef4d30694..f13883a92 100644 --- a/aegisub/src/ass_exporter.cpp +++ b/aegisub/src/ass_exporter.cpp @@ -45,22 +45,28 @@ #include "frame_main.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param subs +/// AssExporter::AssExporter (AssFile *subs) { OriginalSubs = subs; IsDefault = true; } -////////////// -// Destructor + +/// @brief Destructor +/// AssExporter::~AssExporter () { } -///////////////////////// -// Draw control settings + +/// @brief Draw control settings +/// @param parent +/// @param AddTo +/// void AssExporter::DrawSettings(wxWindow *parent,wxSizer *AddTo) { IsDefault = false; wxWindow *window; @@ -85,8 +91,10 @@ void AssExporter::DrawSettings(wxWindow *parent,wxSizer *AddTo) { } -/////////////////////// -// Add filter to chain + +/// @brief Add filter to chain +/// @param name +/// void AssExporter::AddFilter(wxString name) { // Get filter AssExportFilter *filter = NULL; @@ -106,8 +114,9 @@ void AssExporter::AddFilter(wxString name) { } -/////////////////////////////////////////// -// Adds all autoexporting filters to chain + +/// @brief Adds all autoexporting filters to chain +/// void AssExporter::AddAutoFilters() { FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin(); FilterList::iterator end = AssExportFilterChain::GetFilterList()->end(); @@ -119,8 +128,10 @@ void AssExporter::AddAutoFilters() { } -/////////////////////////// -// Get name of all filters + +/// @brief Get name of all filters +/// @return +/// wxArrayString AssExporter::GetAllFilterNames() { wxArrayString names; FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin(); @@ -132,8 +143,11 @@ wxArrayString AssExporter::GetAllFilterNames() { } -//////////////////////// -// Transform for export + +/// @brief Transform for export +/// @param export_dialog +/// @return +/// AssFile *AssExporter::ExportTransform(wxWindow *export_dialog) { // Copy AssFile *Subs = new AssFile(*OriginalSubs); @@ -149,8 +163,12 @@ AssFile *AssExporter::ExportTransform(wxWindow *export_dialog) { } -////////// -// Export + +/// @brief Export +/// @param filename +/// @param charset +/// @param export_dialog +/// void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_dialog) { // Get transformation AssFile *Subs = ExportTransform(export_dialog); @@ -161,8 +179,11 @@ void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_d } -/////////////////////////////////// -// Get window associated with name + +/// @brief Get window associated with name +/// @param name +/// @return +/// wxSizer *AssExporter::GetSettingsSizer(wxString name) { SizerMap::iterator pos = Sizers.find(name); if (pos == Sizers.end()) return NULL; @@ -170,8 +191,10 @@ wxSizer *AssExporter::GetSettingsSizer(wxString name) { } -///////////////////////////// -// Get description of filter + +/// @brief Get description of filter +/// @param name +/// wxString AssExporter::GetDescription(wxString name) { FilterList::iterator begin = AssExportFilterChain::GetFilterList()->begin(); FilterList::iterator end = AssExportFilterChain::GetFilterList()->end(); @@ -183,3 +206,4 @@ wxString AssExporter::GetDescription(wxString name) { throw wxString::Format(_T("Filter not found: %s"), name.c_str()); } + diff --git a/aegisub/src/ass_exporter.h b/aegisub/src/ass_exporter.h index 94ab316de..ecde295d5 100644 --- a/aegisub/src/ass_exporter.h +++ b/aegisub/src/ass_exporter.h @@ -54,19 +54,33 @@ class AssExportFilter; class AssFile; -//////////// -// Typedefs + +/// DOCME typedef std::list FilterList; + +/// DOCME typedef std::map SizerMap; -////////////////// -// Exporter class + +/// DOCME +/// @class AssExporter +/// @brief DOCME +/// +/// DOCME class AssExporter { private: + + /// DOCME SizerMap Sizers; + + /// DOCME FilterList Filters; + + /// DOCME AssFile *OriginalSubs; + + /// DOCME bool IsDefault; public: @@ -80,7 +94,11 @@ public: void Export(wxString file, wxString charset, wxWindow *export_dialog=NULL); AssFile *ExportTransform(wxWindow *export_dialog=NULL); wxSizer *GetSettingsSizer(wxString name); + + /// @brief DOCME + /// AssFile *GetOriginalSubs() { return OriginalSubs; } wxString GetDescription(wxString name); }; + diff --git a/aegisub/src/ass_file.cpp b/aegisub/src/ass_file.cpp index 2d985a881..a2e69be32 100644 --- a/aegisub/src/ass_file.cpp +++ b/aegisub/src/ass_file.cpp @@ -58,24 +58,29 @@ #include "subtitle_format.h" -////////////////////// AssFile ////////////////////// -/////////////////////// -// AssFile constructor + +/// @brief AssFile constructor AssFile ////////////////////// +/// AssFile::AssFile () { AssOverrideTagProto::LoadProtos(); Clear(); } -////////////////////// -// AssFile destructor + +/// @brief AssFile destructor +/// AssFile::~AssFile() { Clear(); } -///////////////////// -// Load generic subs + +/// @brief Load generic subs +/// @param _filename +/// @param charset +/// @param addToRecent +/// void AssFile::Load (const wxString _filename,const wxString charset,bool addToRecent) { bool ok = true; @@ -148,8 +153,13 @@ void AssFile::Load (const wxString _filename,const wxString charset,bool addToRe } -//////////////////////////// -// Save a file to Hard Disk + +/// @brief Save a file to Hard Disk +/// @param _filename +/// @param setfilename +/// @param addToRecent +/// @param encoding +/// void AssFile::Save(wxString _filename,bool setfilename,bool addToRecent,const wxString encoding) { // Finds last dot int i = 0; @@ -182,8 +192,11 @@ void AssFile::Save(wxString _filename,bool setfilename,bool addToRecent,const wx } -//////////////////////////////// -// Saves a file to a ram vector + +/// @brief Saves a file to a ram vector +/// @param dst +/// @param encoding +/// void AssFile::SaveMemory(std::vector &dst,const wxString encoding) { // Set encoding wxString enc = encoding; @@ -227,8 +240,10 @@ void AssFile::SaveMemory(std::vector &dst,const wxString encoding) { } -//////////////////////////////////////////// -// Exports file with proper transformations + +/// @brief Exports file with proper transformations +/// @param _filename +/// void AssFile::Export(wxString _filename) { AssExporter exporter(this); exporter.AddAutoFilters(); @@ -236,8 +251,10 @@ void AssFile::Export(wxString _filename) { } -////////////////// -// Can save file? + +/// @brief Can save file? +/// @return +/// bool AssFile::CanSave() { // ASS format? wxString ext = filename.Lower().Right(4); @@ -307,12 +324,15 @@ bool AssFile::CanSave() { //} -/////////////////////// -// Appends line to Ass -// ------------------- -// I strongly advice you against touching this function unless you know what you're doing; -// even moving things out of order might break ASS parsing - AMZ. -// + +/// @brief even moving things out of order might break ASS parsing - AMZ. I strongly advice you against touching this function unless you know what you're doing; ------------------- Appends line to Ass +/// @param data +/// @param group +/// @param lasttime +/// @param version +/// @param outGroup +/// @return +/// int AssFile::AddLine (wxString data,wxString group,int lasttime,int &version,wxString *outGroup) { // Group AssEntry *entry = NULL; @@ -456,8 +476,9 @@ int AssFile::AddLine (wxString data,wxString group,int lasttime,int &version,wxS } -////////////////////////////// -// Clears contents of assfile + +/// @brief Clears contents of assfile +/// void AssFile::Clear () { for (std::list::iterator cur=Line.begin();cur != Line.end();cur++) { if (*cur) delete *cur; @@ -470,8 +491,10 @@ void AssFile::Clear () { } -////////////////////// -// Loads default subs + +/// @brief Loads default subs +/// @param defline +/// void AssFile::LoadDefault (bool defline) { // Clear first Clear(); @@ -503,8 +526,10 @@ void AssFile::LoadDefault (bool defline) { } -//////////////////// -// Copy constructor + +/// @brief Copy constructor +/// @param from +/// AssFile::AssFile (AssFile &from) { using std::list; @@ -520,8 +545,10 @@ AssFile::AssFile (AssFile &from) { } -////////////////////// -// Insert a new style + +/// @brief Insert a new style +/// @param style +/// void AssFile::InsertStyle (AssStyle *style) { // Variables using std::list; @@ -577,8 +604,10 @@ void AssFile::InsertStyle (AssStyle *style) { } -//////////////////// -// Insert attachment + +/// @brief Insert attachment +/// @param attach +/// void AssFile::InsertAttachment (AssAttachment *attach) { // Search for insertion point std::list::iterator insPoint=Line.end(),cur; @@ -616,8 +645,10 @@ void AssFile::InsertAttachment (AssAttachment *attach) { } -/////////////////////////////// -// Insert attachment from file + +/// @brief Insert attachment from file +/// @param filename +/// void AssFile::InsertAttachment (wxString filename) { // Get name wxFileName fname(filename); @@ -642,8 +673,11 @@ void AssFile::InsertAttachment (wxString filename) { } -//////////////////// -// Gets script info + +/// @brief Gets script info +/// @param _key +/// @return +/// wxString AssFile::GetScriptInfo(const wxString _key) { // Prepare wxString key = _key;; @@ -675,8 +709,11 @@ wxString AssFile::GetScriptInfo(const wxString _key) { } -////////////////////////// -// Get script info as int + +/// @brief Get script info as int +/// @param key +/// @return +/// int AssFile::GetScriptInfoAsInt(const wxString key) { long temp = 0; try { @@ -689,8 +726,12 @@ int AssFile::GetScriptInfoAsInt(const wxString key) { } -////////////////////////// -// Set a script info line + +/// @brief Set a script info line +/// @param _key +/// @param value +/// @return +/// void AssFile::SetScriptInfo(const wxString _key,const wxString value) { // Prepare wxString key = _key;; @@ -745,8 +786,11 @@ void AssFile::SetScriptInfo(const wxString _key,const wxString value) { } -////////////////// -// Get resolution + +/// @brief Get resolution +/// @param sw +/// @param sh +/// void AssFile::GetResolution(int &sw,int &sh) { // Height wxString temp = GetScriptInfo(_T("PlayResY")); @@ -788,8 +832,10 @@ void AssFile::GetResolution(int &sw,int &sh) { } -/////////////////////////////////// -// Adds a comment to [Script Info] + +/// @brief Adds a comment to [Script Info] +/// @param _comment +/// void AssFile::AddComment(const wxString _comment) { wxString comment = _T("; "); comment += _comment; @@ -814,8 +860,10 @@ void AssFile::AddComment(const wxString _comment) { } -////////////////////// -// Get list of styles + +/// @brief Get list of styles +/// @return +/// wxArrayString AssFile::GetStyles() { wxArrayString styles; AssStyle *curstyle; @@ -829,8 +877,11 @@ wxArrayString AssFile::GetStyles() { } -/////////////////////////////// -// Gets style of specific name + +/// @brief Gets style of specific name +/// @param name +/// @return +/// AssStyle *AssFile::GetStyle(wxString name) { AssStyle *curstyle; for (entryIter cur=Line.begin();cur!=Line.end();cur++) { @@ -843,15 +894,20 @@ AssStyle *AssFile::GetStyle(wxString name) { } -//////////////////////////////////// -// Adds file name to list of recent + +/// @brief Adds file name to list of recent +/// @param file +/// void AssFile::AddToRecent(wxString file) { Options.AddToRecentList(file,_T("Recent sub")); } -/////////////////////////////// -// List of supported wildcards + +/// @brief List of supported wildcards +/// @param mode +/// @return +/// wxString AssFile::GetWildcardList(int mode) { //if (mode == 0) return _T("All Supported Types (*.ass,*.ssa,*.srt,*.txt,*.mkv,*.mks,*.mka)|*.ass;*.ssa;*.srt;*.txt;*.mkv;*.mks;*.mka|Advanced Substation Alpha (*.ass)|*.ass|Substation Alpha (*.ssa)|*.ssa|SubRip (*.srt)|*.srt|Plain-text (*.txt)|*.txt|Matroska (*.mkv,*.mks,*.mka)|*.mkv;*.mks;*.mka"); //else if (mode == 1) return _T("Advanced Substation Alpha (*.ass)|*.ass"); @@ -865,8 +921,10 @@ wxString AssFile::GetWildcardList(int mode) { } -//////////////////////////////////////////// -// Compress/decompress for storage on stack + +/// @brief Compress/decompress for storage on stack +/// @param compress +/// void AssFile::CompressForStack(bool compress) { AssDialogue *diag; for (entryIter cur=Line.begin();cur!=Line.end();cur++) { @@ -882,15 +940,19 @@ void AssFile::CompressForStack(bool compress) { } -////////////////////////////// -// Checks if file is modified + +/// @brief Checks if file is modified +/// @return +/// bool AssFile::IsModified() { return Modified; } -///////////////////////// -// Flag file as modified + +/// @brief Flag file as modified +/// @param desc +/// void AssFile::FlagAsModified(wxString desc) { // Clear redo if (!RedoStack.empty()) { @@ -907,8 +969,10 @@ void AssFile::FlagAsModified(wxString desc) { } -////////////// -// Stack push + +/// @brief Stack push +/// @param desc +/// void AssFile::StackPush(wxString desc) { // Places copy on stack AssFile *curcopy = new AssFile(*top); @@ -931,8 +995,9 @@ void AssFile::StackPush(wxString desc) { } -///////////// -// Stack pop + +/// @brief Stack pop +/// void AssFile::StackPop() { bool addcopy = false; wxString undodesc=_T(""); @@ -964,8 +1029,9 @@ void AssFile::StackPop() { } -////////////// -// Stack redo + +/// @brief Stack redo +/// void AssFile::StackRedo() { bool addcopy = false; @@ -992,8 +1058,9 @@ void AssFile::StackRedo() { } -/////////////// -// Stack clear + +/// @brief Stack clear +/// void AssFile::StackClear() { // Clear undo for (std::list::iterator cur=UndoStack.begin();cur!=UndoStack.end();cur++) { @@ -1011,8 +1078,10 @@ void AssFile::StackClear() { } -/////////////// -// Stack reset + +/// @brief Stack reset +/// @return +/// void AssFile::StackReset() { StackClear(); delete top; @@ -1021,38 +1090,59 @@ void AssFile::StackReset() { } -////////////////////////////////// -// Returns if undo stack is empty + +/// @brief Returns if undo stack is empty +/// @return +/// bool AssFile::IsUndoStackEmpty() { if (StackModified) return (UndoStack.size() <= 1); else return UndoStack.empty(); } -////////////////////////////////// -// Returns if redo stack is empty + +/// @brief Returns if redo stack is empty +/// @return +/// bool AssFile::IsRedoStackEmpty() { return RedoStack.empty(); } + +/// @brief DOCME +/// @return +/// wxString AssFile::GetUndoDescription() { return (IsUndoStackEmpty())?_T(""):(UndoStack.back())->undodescription; } + +/// @brief DOCME +/// @return +/// wxString AssFile::GetRedoDescription() { return (IsRedoStackEmpty())?_T(""):(RedoStack.back())->undodescription; } -////////// -// Global + +/// DOCME AssFile *AssFile::top; + +/// DOCME std::list AssFile::UndoStack; + +/// DOCME std::list AssFile::RedoStack; + +/// DOCME bool AssFile::Popping; + +/// DOCME bool AssFile::StackModified; + diff --git a/aegisub/src/ass_file.h b/aegisub/src/ass_file.h index 037a0ca77..be6c03419 100644 --- a/aegisub/src/ass_file.h +++ b/aegisub/src/ass_file.h @@ -58,23 +58,42 @@ class AssDialogueBlockPlain; class AssEntry; -////////////////////////////////////// -// Class to store the actual ass file + +/// DOCME +/// @class AssFile +/// @brief DOCME +/// +/// DOCME class AssFile { private: + + /// DOCME bool Modified; - // Stack operations + + /// DOCME static std::list UndoStack; + + /// DOCME static std::list RedoStack; + + /// DOCME static bool StackModified; static void StackClear(); public: + + /// DOCME std::list Line; + + /// DOCME wxString filename; + + /// DOCME wxString undodescription; + + /// DOCME bool loaded; AssFile(); @@ -116,23 +135,39 @@ public: static bool IsRedoStackEmpty(); // Checks if undo stack is empty static wxString GetUndoDescription(); // Gets field undodescription from back of UndoStack static wxString GetRedoDescription(); // Gets field undodescription from back of RedoStack + + /// DOCME static bool Popping; // Flags the stack as popping. You must unset this after popping + + /// DOCME static AssFile *top; // Current script file. It is "above" the stack. }; -//////////// -// Typedefs + +/// DOCME typedef std::list::iterator entryIter; ////////////////////////////////////////////////////// // Hack to get STL sort to work on a list of pointers template + +/// DOCME +/// @class LessByPointedToValue +/// @brief DOCME +/// +/// DOCME class LessByPointedToValue : std::binary_function { public: + + /// @brief DOCME + /// @param x + /// @param y + /// bool operator()(T const * x, T const * y) const { return std::less()(*x, *y); } }; + diff --git a/aegisub/src/ass_karaoke.cpp b/aegisub/src/ass_karaoke.cpp index e0f5b3821..6d1f3d71d 100644 --- a/aegisub/src/ass_karaoke.cpp +++ b/aegisub/src/ass_karaoke.cpp @@ -40,6 +40,9 @@ #include "ass_karaoke.h" #include "ass_override.h" + +/// @brief DOCME +/// AssKaraokeSyllable::AssKaraokeSyllable() { duration = 0; @@ -49,6 +52,11 @@ AssKaraokeSyllable::AssKaraokeSyllable() tag = 0; } + +/// @brief DOCME +/// @param line +/// @param syls +/// void ParseAssKaraokeTags(const AssDialogue *line, AssKaraokeVector &syls) { // Assume line already has tags parsed @@ -120,3 +128,4 @@ void ParseAssKaraokeTags(const AssDialogue *line, AssKaraokeVector &syls) } + diff --git a/aegisub/src/ass_karaoke.h b/aegisub/src/ass_karaoke.h index 59ec98440..a3da87580 100644 --- a/aegisub/src/ass_karaoke.h +++ b/aegisub/src/ass_karaoke.h @@ -39,17 +39,32 @@ #include "ass_dialogue.h" #include + +/// DOCME struct AssKaraokeSyllable { + + /// DOCME int duration; // centiseconds + + /// DOCME wxString text; // stripped text of syllable + + /// DOCME wxString unstripped_text; // including misc. tags + + /// DOCME wxString type; // highlight type, \k \K \kf \ko (backslash included) + + /// DOCME AssOverrideTag *tag; // parsed override tag for direct modification AssKaraokeSyllable(); }; + +/// DOCME typedef std::vector AssKaraokeVector; void ParseAssKaraokeTags(const AssDialogue *line, AssKaraokeVector &syls); + diff --git a/aegisub/src/ass_override.cpp b/aegisub/src/ass_override.cpp index f8b0a28f7..7c2a40943 100644 --- a/aegisub/src/ass_override.cpp +++ b/aegisub/src/ass_override.cpp @@ -45,24 +45,27 @@ #include -////////////////////// AssOverrideParameter ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssOverrideParameter ////////////////////// +/// AssOverrideParameter::AssOverrideParameter () { classification = PARCLASS_NORMAL; ommited = false; } -////////////// -// Destructor + +/// @brief Destructor +/// AssOverrideParameter::~AssOverrideParameter () { DeleteValue(); } -//////// -// Copy + +/// @brief Copy +/// @param param +/// void AssOverrideParameter::CopyFrom (const AssOverrideParameter ¶m) { switch(param.GetType()) { case VARDATA_INT: SetInt(param.AsInt()); break; @@ -77,20 +80,25 @@ void AssOverrideParameter::CopyFrom (const AssOverrideParameter ¶m) { ommited = param.ommited; } + +/// @brief DOCME +/// @param param +/// void AssOverrideParameter::operator= (const AssOverrideParameter ¶m) { CopyFrom(param); } -////////////////////// AssDialogueBlockOverride ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssDialogueBlockOverride ////////////////////// +/// AssDialogueBlockOverride::AssDialogueBlockOverride () { } -////////////// -// Destructor + +/// @brief Destructor +/// AssDialogueBlockOverride::~AssDialogueBlockOverride () { for (size_t i=0;i::iterator cur=Tags.begin();cur!=Tags.end();cur++) { @@ -152,8 +163,13 @@ wxString AssDialogueBlockOverride::GetText () { } -/////////////////////////////////// -// Process parameters via callback + +/// @brief Process parameters via callback +/// @param (callback)(wxString +/// @param int +/// @param ) +/// @param userData +/// void AssDialogueBlockOverride::ProcessParameters(void (*callback)(wxString,int,AssOverrideParameter *,void *),void *userData) { AssOverrideTag *curTag; AssOverrideParameter *curPar; @@ -184,9 +200,12 @@ void AssDialogueBlockOverride::ProcessParameters(void (*callback)(wxString,int,A } -///////////////////////// AssOverrideParamProto ////////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssOverrideParamProto ////////////////////////// +/// @param _type +/// @param opt +/// @param classi +/// AssOverrideParamProto::AssOverrideParamProto (VariableDataType _type,int opt,ASS_ParameterClass classi) { type = _type; optional = opt; @@ -194,33 +213,39 @@ AssOverrideParamProto::AssOverrideParamProto (VariableDataType _type,int opt,ASS } -////////////// -// Destructor + +/// @brief Destructor +/// AssOverrideParamProto::~AssOverrideParamProto() { } -///////////////////////// AssOverrideTagProto ////////////////////////// -/////////////// -// Static vars + +/// DOCME std::list AssOverrideTagProto::proto; + +/// DOCME bool AssOverrideTagProto::loaded = false; -/////////////// -// Constructor + +/// @brief Constructor +/// AssOverrideTagProto::AssOverrideTagProto() { } -////////////// -// Destructor + +/// @brief Destructor +/// AssOverrideTagProto::~AssOverrideTagProto() { } -/////////////////// -// Load prototypes + +/// @brief Load prototypes +/// @return +/// void AssOverrideTagProto::LoadProtos () { if (loaded) return; loaded = true; @@ -526,23 +551,25 @@ void AssOverrideTagProto::LoadProtos () { } -//////////////////////// AssOverrideTag ////////////////////////// -/////////////// -// Constructor + +/// @brief Constructor AssOverrideTag ////////////////////////// +/// AssOverrideTag::AssOverrideTag () { valid = false; } -////////////// -// Destructor + +/// @brief Destructor +/// AssOverrideTag::~AssOverrideTag () { Clear(); } -///////// -// Clear + +/// @brief Clear +/// void AssOverrideTag::Clear() { for (std::vector::iterator cur=Params.begin();cur!=Params.end();cur++) { delete *cur; @@ -552,8 +579,10 @@ void AssOverrideTag::Clear() { } -//////////////////////////// -// Parses text and sets tag + +/// @brief Parses text and sets tag +/// @param text +/// void AssOverrideTag::SetText (const wxString &text) { // Determine name Name = _T(""); @@ -580,15 +609,19 @@ void AssOverrideTag::SetText (const wxString &text) { } -///////////////////////// -// Checks if it is valid + +/// @brief Checks if it is valid +/// @return +/// bool AssOverrideTag::IsValid() { return valid; } -///////////////////// -// Parses parameters + +/// @brief Parses parameters +/// @param text +/// void AssOverrideTag::ParseParameters(const wxString &text) { // Clear first Clear(); @@ -780,8 +813,9 @@ end_tokenizing: } -////////////// -// Get string + +/// @brief Get string +/// wxString AssOverrideTag::ToString() { // Start with name wxString result = Name; @@ -814,3 +848,4 @@ wxString AssOverrideTag::ToString() { return result; } + diff --git a/aegisub/src/ass_override.h b/aegisub/src/ass_override.h index ca6fe3f7e..42da8efa6 100644 --- a/aegisub/src/ass_override.h +++ b/aegisub/src/ass_override.h @@ -50,27 +50,54 @@ class AssDialogueBlockOverride; -// Enum of parameter classification -// This is used for things like checking which tags VFR needs to update + +/// DOCME enum ASS_ParameterClass { + + /// DOCME PARCLASS_NORMAL, + + /// DOCME PARCLASS_ABSOLUTE_SIZE, + + /// DOCME PARCLASS_ABSOLUTE_POS_X, + + /// DOCME PARCLASS_ABSOLUTE_POS_Y, + + /// DOCME PARCLASS_RELATIVE_SIZE_X, + + /// DOCME PARCLASS_RELATIVE_SIZE_Y, + + /// DOCME PARCLASS_RELATIVE_TIME_START, + + /// DOCME PARCLASS_RELATIVE_TIME_END, - //PARCLASS_RELATIVE_TIME_START_CENTI, - //PARCLASS_RELATIVE_TIME_END_CENTI, + + /// DOCME PARCLASS_KARAOKE, + + /// DOCME PARCLASS_DRAWING }; -// Actual class + +/// DOCME +/// @class AssOverrideParameter +/// @brief DOCME +/// +/// DOCME class AssOverrideParameter : public VariableData { public: + + /// DOCME ASS_ParameterClass classification; + + /// DOCME bool ommited; AssOverrideParameter(); @@ -81,18 +108,24 @@ public: }; -/////////////////////////// -// Class for override tags -// ----------------------- -// -// GetText() returns the text representation of the tag -// + +/// DOCME +/// @class AssOverrideTag +/// @brief DOCME +/// +/// DOCME class AssOverrideTag { private: + + /// DOCME bool valid; public: + + /// DOCME wxString Name; + + /// DOCME std::vector Params; AssOverrideTag(); @@ -106,36 +139,82 @@ public: }; -/////////////////////////// -// Override tags prototype + +/// DOCME enum ASS_ParameterOptional { + + /// DOCME NOT_OPTIONAL = 0xFF, + + /// DOCME OPTIONAL_0 = 0x00, + + /// DOCME OPTIONAL_1 = 0x01, + + /// DOCME OPTIONAL_2 = 0x02, + + /// DOCME OPTIONAL_3 = 0x04, + + /// DOCME OPTIONAL_4 = 0x08, + + /// DOCME OPTIONAL_5 = 0x10, + + /// DOCME OPTIONAL_6 = 0x20, + + /// DOCME OPTIONAL_7 = 0x40 }; + +/// DOCME +/// @class AssOverrideParamProto +/// @brief DOCME +/// +/// DOCME class AssOverrideParamProto { public: + + /// DOCME int optional; + + /// DOCME VariableDataType type; + + /// DOCME AssOverrideParameter defaultValue; + + /// DOCME ASS_ParameterClass classification; AssOverrideParamProto (VariableDataType _type,int opt=NOT_OPTIONAL,ASS_ParameterClass classi=PARCLASS_NORMAL); ~AssOverrideParamProto(); }; + +/// DOCME +/// @class AssOverrideTagProto +/// @brief DOCME +/// +/// DOCME class AssOverrideTagProto { public: + + /// DOCME wxString name; + + /// DOCME std::vector params; + + /// DOCME static std::list proto; + + /// DOCME static bool loaded; static void LoadProtos(); @@ -143,3 +222,4 @@ public: ~AssOverrideTagProto(); }; + diff --git a/aegisub/src/ass_style.cpp b/aegisub/src/ass_style.cpp index b38d9d7a1..035235a61 100644 --- a/aegisub/src/ass_style.cpp +++ b/aegisub/src/ass_style.cpp @@ -44,20 +44,27 @@ #include "utils.h" #include -///////////////////////// AssColor ////////////////////////// -//////////////// -// Constructors + +/// @brief Constructors AssColor ////////////////////////// +/// AssColor::AssColor () { r=g=b=a=0; } + +/// @brief DOCME +/// @param color +/// AssColor::AssColor (wxColour &color) { SetWXColor(color); } -////////////////// -// Parse from SSA/ASS + +/// @brief Parse from SSA/ASS +/// @param value +/// @return +/// void AssColor::Parse(const wxString value) { if (value.Len() > 0 && value[0] == _T('#')) { // HTML colour @@ -91,15 +98,19 @@ void AssColor::Parse(const wxString value) { } -/////////////////// -// Gets a wxColour + +/// @brief Gets a wxColour +/// @return +/// wxColour AssColor::GetWXColor() { return wxColour(r,g,b,255-a); } -////////////////////// -// Sets color from wx + +/// @brief Sets color from wx +/// @param color +/// void AssColor::SetWXColor(const wxColor &color) { r = color.Red(); g = color.Green(); @@ -108,8 +119,13 @@ void AssColor::SetWXColor(const wxColor &color) { } -/////////////////////////////// -// Get formatted in ASS format + +/// @brief Get formatted in ASS format +/// @param alpha +/// @param stripped +/// @param isStyle +/// @return +/// wxString AssColor::GetASSFormatted (bool alpha,bool stripped,bool isStyle) { wxString work; if (!stripped) work += _T("&H"); @@ -120,8 +136,10 @@ wxString AssColor::GetASSFormatted (bool alpha,bool stripped,bool isStyle) { } -///////////////////////// -// Get decimal formatted + +/// @brief Get decimal formatted +/// @return +/// wxString AssColor::GetSSAFormatted () { long color = (a<<24)+(b<<16)+(g<<8)+r; wxString output=wxString::Format(_T("%i"),(long)color); @@ -129,20 +147,28 @@ wxString AssColor::GetSSAFormatted () { } -///////////// -// Operators + +/// @brief Operators +/// @param col +/// @return +/// bool AssColor::operator==(AssColor &col) const { return r==col.r && g==col.g && b==col.b && a==col.a; } + +/// @brief DOCME +/// @param col +/// @return +/// bool AssColor::operator!=(AssColor &col) const { return r!=col.r || g!=col.g || b!=col.b || a!=col.a; } -///////////////////////// AssStyle ///////////////////////// -/////////////////////// -// Default Constructor + +/// @brief Default Constructor AssStyle ///////////////////////// +/// AssStyle::AssStyle() { group = _T("[V4+ Styles]"); @@ -191,8 +217,11 @@ AssStyle::AssStyle() { } -/////////////// -// Constructor + +/// @brief Constructor +/// @param _data +/// @param version +/// AssStyle::AssStyle(wxString _data,int version) { Valid = Parse(_data,version); if (!Valid) { @@ -202,14 +231,19 @@ AssStyle::AssStyle(wxString _data,int version) { } -////////////// -// Destructor + +/// @brief Destructor +/// AssStyle::~AssStyle() { } -////////////////////////////// -// Parses value from ASS data + +/// @brief Parses value from ASS data +/// @param rawData +/// @param version +/// @return +/// bool AssStyle::Parse(wxString rawData,int version) { // Tokenize wxString temp; @@ -412,8 +446,9 @@ bool AssStyle::Parse(wxString rawData,int version) { } -/////////////////////////////////////// -// Writes data back to ASS (v4+) format + +/// @brief Writes data back to ASS (v4+) format +/// void AssStyle::UpdateData() { wxString final; @@ -437,8 +472,11 @@ void AssStyle::UpdateData() { } -///////////////////////////// -// Sets margin from a string + +/// @brief Sets margin from a string +/// @param str +/// @param which +/// void AssStyle::SetMarginString(const wxString str,int which) { if (which < 0 || which >= 4) throw new Aegisub::InvalidMarginIdError; if (!str.IsNumber()) throw _T("Invalid margin value"); @@ -451,8 +489,11 @@ void AssStyle::SetMarginString(const wxString str,int which) { } -////////////////////////// -// Gets string for margin + +/// @brief Gets string for margin +/// @param which +/// @return +/// wxString AssStyle::GetMarginString(int which) { if (which < 0 || which >= 4) throw new Aegisub::InvalidMarginIdError; wxString result = wxString::Format(_T("%04i"),Margin[which]); @@ -460,8 +501,10 @@ wxString AssStyle::GetMarginString(int which) { } -/////////////////////////////// -// Convert style to SSA string + +/// @brief Convert style to SSA string +/// @return +/// wxString AssStyle::GetSSAText() { wxString output; int align = 0; @@ -492,8 +535,10 @@ wxString AssStyle::GetSSAText() { } -///////// -// Clone + +/// @brief Clone +/// @return +/// AssEntry *AssStyle::Clone() const { // Create clone AssStyle *final = new AssStyle(); @@ -534,8 +579,11 @@ AssEntry *AssStyle::Clone() const { } -/////////////////////////// -// Equal to another style? + +/// @brief Equal to another style? +/// @param style +/// @return +/// bool AssStyle::IsEqualTo(AssStyle *style) { // memcmp won't work because strings won't match if (style->alignment != alignment || @@ -569,8 +617,10 @@ bool AssStyle::IsEqualTo(AssStyle *style) { } -///////////////////////////////////// -// Get a list of valid ASS encodings + +/// @brief Get a list of valid ASS encodings +/// @param encodingStrings +/// void AssStyle::GetEncodings(wxArrayString &encodingStrings) { encodingStrings.Clear(); encodingStrings.Add(wxString(_T("0 - ")) + _("ANSI")); @@ -594,3 +644,4 @@ void AssStyle::GetEncodings(wxArrayString &encodingStrings) { encodingStrings.Add(wxString(_T("255 - ")) + _("OEM")); } + diff --git a/aegisub/src/ass_style.h b/aegisub/src/ass_style.h index 043c0aa05..b8738a137 100644 --- a/aegisub/src/ass_style.h +++ b/aegisub/src/ass_style.h @@ -43,13 +43,25 @@ #include "ass_entry.h" -///////////////////////// -// Class to store colors + +/// DOCME +/// @class AssColor +/// @brief DOCME +/// +/// DOCME class AssColor { public: + + /// DOCME int r; // Red component + + /// DOCME int g; // Green component + + /// DOCME int b; // Blue component + + /// DOCME int a; // Alpha component AssColor(); @@ -66,36 +78,87 @@ public: }; -///////////////////////// -// Class to store styles + +/// DOCME +/// @class AssStyle +/// @brief DOCME +/// +/// DOCME class AssStyle : public AssEntry { public: + + /// DOCME wxString name; + + /// DOCME wxString font; + + /// DOCME double fontsize; + + /// DOCME AssColor primary; + + /// DOCME AssColor secondary; + + /// DOCME AssColor outline; + + /// DOCME AssColor shadow; + + /// DOCME bool bold; + + /// DOCME bool italic; + + /// DOCME bool underline; + + /// DOCME bool strikeout; + + /// DOCME double scalex; + + /// DOCME double scaley; + + /// DOCME double spacing; + + /// DOCME double angle; + + /// DOCME int borderstyle; + + /// DOCME double outline_w; + + /// DOCME double shadow_w; + + /// DOCME int alignment; + + /// DOCME int Margin[4]; + + /// DOCME int encoding; + + /// DOCME int relativeTo; + + /// @brief DOCME + /// ASS_EntryType GetType() { return ENTRY_STYLE; } bool Parse(wxString data,int version=1); // Parses raw ASS/SSA data into everything else @@ -114,3 +177,4 @@ public: ~AssStyle(); }; + diff --git a/aegisub/src/ass_style_storage.cpp b/aegisub/src/ass_style_storage.cpp index 8a3d3915d..90ea4473a 100644 --- a/aegisub/src/ass_style_storage.cpp +++ b/aegisub/src/ass_style_storage.cpp @@ -48,8 +48,11 @@ #include "standard_paths.h" -/////////////////////// -// Save styles to disk + +/// @brief Save styles to disk +/// @param name +/// @return +/// void AssStyleStorage::Save(wxString name) { if (name.IsEmpty()) return; @@ -61,8 +64,11 @@ void AssStyleStorage::Save(wxString name) { } -///////////////////////// -// Load styles from disk + +/// @brief Load styles from disk +/// @param name +/// @return +/// void AssStyleStorage::Load(wxString name) { if (name.IsEmpty()) return; Clear(); @@ -84,8 +90,9 @@ void AssStyleStorage::Load(wxString name) { } -///////// -// Clear + +/// @brief Clear +/// void AssStyleStorage::Clear () { using std::list; for (list::iterator cur=style.begin();cur!=style.end();cur++) { @@ -95,8 +102,10 @@ void AssStyleStorage::Clear () { } -///////////// -// Get names + +/// @brief Get names +/// @return +/// wxArrayString AssStyleStorage::GetNames() { wxArrayString names; for (std::list::iterator cur=style.begin();cur!=style.end();cur++) { @@ -106,8 +115,10 @@ wxArrayString AssStyleStorage::GetNames() { } -/////////////////////// -// Get a style by name + +/// @brief Get a style by name +/// @param name +/// AssStyle *AssStyleStorage::GetStyle(wxString name) { for (std::list::iterator cur=style.begin();cur!=style.end();cur++) { if ((*cur)->name == name) return *cur; @@ -115,3 +126,4 @@ AssStyle *AssStyleStorage::GetStyle(wxString name) { return NULL; } + diff --git a/aegisub/src/ass_style_storage.h b/aegisub/src/ass_style_storage.h index 1df0e12d5..3442299c4 100644 --- a/aegisub/src/ass_style_storage.h +++ b/aegisub/src/ass_style_storage.h @@ -36,6 +36,8 @@ #ifndef ASS_STYLE_STORAGE_H + +/// DOCME #define ASS_STYLE_STORAGE_H @@ -51,10 +53,16 @@ class AssStyle; -///////////////// -// Storage class + +/// DOCME +/// @class AssStyleStorage +/// @brief DOCME +/// +/// DOCME class AssStyleStorage { public: + + /// DOCME std::list style; wxArrayString GetNames(); @@ -67,3 +75,4 @@ public: #endif + diff --git a/aegisub/src/ass_time.cpp b/aegisub/src/ass_time.cpp index be07b1f6a..c2d412546 100644 --- a/aegisub/src/ass_time.cpp +++ b/aegisub/src/ass_time.cpp @@ -49,17 +49,19 @@ -////////////////////// AssTime ////////////////////// -// AssTime constructors + +/// @brief AssTime constructors AssTime ////////////////////// +/// AssTime::AssTime () { time = 0; } -//////////////////// -// Parses from ASS -// --------------- -// Note that this function is atomic, it won't touch the values if it's invalid. + +/// @brief Note that this function is atomic, it won't touch the values if it's invalid. --------------- Parses from ASS +/// @param text +/// @return +/// void AssTime::ParseASS (const wxString text) { // Prepare size_t pos = 0; @@ -114,8 +116,10 @@ void AssTime::ParseASS (const wxString text) { } -/////////////////// -// Parses from SRT + +/// @brief Parses from SRT +/// @param _text +/// void AssTime::ParseSRT (const wxString _text) { // Prepare wxString text = _text; @@ -144,20 +148,29 @@ void AssTime::ParseSRT (const wxString _text) { } -////////////////////////////////////////// -// AssTime conversion to/from miliseconds + +/// @brief AssTime conversion to/from miliseconds +/// @return +/// int AssTime::GetMS () const { if (!UseMSPrecision) return time/10*10; else return time; } + +/// @brief DOCME +/// @param _ms +/// void AssTime::SetMS (int _ms) { time = _ms; } -//////////////// -// ASS Formated + +/// @brief ASS Formated +/// @param msPrecision +/// @return +/// wxString AssTime::GetASSFormated (bool msPrecision) { int h,m,s,ms; int _ms = time; @@ -202,8 +215,10 @@ wxString AssTime::GetASSFormated (bool msPrecision) { } -//////////////// -// SRT Formated + +/// @brief SRT Formated +/// @return +/// wxString AssTime::GetSRTFormated () { int h,m,s,ms; int _ms = time; @@ -247,51 +262,108 @@ wxString AssTime::GetSRTFormated () { } -////////////////////// -// AssTime comparison + +/// @brief AssTime comparison +/// @param t1 +/// @param t2 +/// @return +/// bool operator < (AssTime &t1, AssTime &t2) { return (t1.GetMS() < t2.GetMS()); } + +/// @brief DOCME +/// @param t1 +/// @param t2 +/// @return +/// bool operator > (AssTime &t1, AssTime &t2) { return (t1.GetMS() > t2.GetMS()); } + +/// @brief DOCME +/// @param t1 +/// @param t2 +/// @return +/// bool operator <= (AssTime &t1, AssTime &t2) { return (t1.GetMS() <= t2.GetMS()); } + +/// @brief DOCME +/// @param t1 +/// @param t2 +/// @return +/// bool operator >= (AssTime &t1, AssTime &t2) { return (t1.GetMS() >= t2.GetMS()); } + +/// @brief DOCME +/// @param t1 +/// @param t2 +/// @return +/// bool operator == (AssTime &t1, AssTime &t2) { return (t1.GetMS() == t2.GetMS()); } + +/// @brief DOCME +/// @param t1 +/// @param t2 +/// @return +/// bool operator != (AssTime &t1, AssTime &t2) { return (t1.GetMS() != t2.GetMS()); } -///////////////// -// Static option + +/// DOCME bool AssTime::UseMSPrecision = false; -/////// -// Get + +/// @brief Get +/// @return +/// int AssTime::GetTimeHours() { return time / 3600000; } + +/// @brief DOCME +/// @return +/// int AssTime::GetTimeMinutes() { return (time % 3600000)/60000; } + +/// @brief DOCME +/// @return +/// int AssTime::GetTimeSeconds() { return (time % 60000)/1000; } + +/// @brief DOCME +/// @return +/// int AssTime::GetTimeMiliseconds() { return (time % 1000); } + +/// @brief DOCME +/// @return +/// int AssTime::GetTimeCentiseconds() { return (time % 1000)/10; } -/////// -// Constructor + +/// @brief Constructor +/// @param separator +/// @param numerator +/// @param denominator +/// @param dropframe +/// FractionalTime::FractionalTime (wxString separator, int numerator, int denominator, bool dropframe) { drop = dropframe; if (drop) { @@ -311,14 +383,18 @@ FractionalTime::FractionalTime (wxString separator, int numerator, int denominat throw _T("FractionalTime: no separator specified"); } -/////// -// Destructor + +/// @brief Destructor +/// FractionalTime::~FractionalTime () { sep.Clear(); } -/////// -// SMPTE text string to milliseconds conversion + +/// @brief SMPTE text string to milliseconds conversion +/// @param _text +/// @return +/// int FractionalTime::ToMillisecs (wxString _text) { wxString text = _text; wxString re_str = _T(""); @@ -376,22 +452,30 @@ int FractionalTime::ToMillisecs (wxString _text) { return msecs_f; } -/////// -// SMPTE text string to AssTime conversion + +/// @brief SMPTE text string to AssTime conversion +/// @param _text +/// @return +/// AssTime FractionalTime::ToAssTime (wxString _text) { AssTime time; time.SetMS((int)ToMillisecs(_text)); return time; } -/////// -// AssTime to SMPTE text string conversion + +/// @brief AssTime to SMPTE text string conversion +/// @param time +/// @return +/// wxString FractionalTime::FromAssTime(AssTime time) { return FromMillisecs(time.GetMS()); } -/////// -// Milliseconds to SMPTE text string conversion + +/// @brief Milliseconds to SMPTE text string conversion +/// @param msec +/// wxString FractionalTime::FromMillisecs(int64_t msec) { int h=0, m=0, s=0, f=0; // hours, minutes, seconds, fractions int fn = (msec*(int64_t)num) / (1000*den); // frame number @@ -444,3 +528,4 @@ RETURN: return wxString::Format(_T("%02i") + sep + _T("%02i") + sep + _T("%02i") + sep + _T("%02i"),h,m,s,f); } + diff --git a/aegisub/src/ass_time.h b/aegisub/src/ass_time.h index 858bfa4a7..801a09ee4 100644 --- a/aegisub/src/ass_time.h +++ b/aegisub/src/ass_time.h @@ -45,13 +45,21 @@ #include -///////////////////////////// -// Class for Ass format time + +/// DOCME +/// @class AssTime +/// @brief DOCME +/// +/// DOCME class AssTime { private: + + /// DOCME int time; // Miliseconds public: + + /// DOCME static bool UseMSPrecision; AssTime(); @@ -80,17 +88,31 @@ bool operator >= (AssTime &t1, AssTime &t2); -///////////////////////////// -// Class for that annoying SMPTE format timecodes stuff + +/// DOCME +/// @class FractionalTime +/// @brief DOCME +/// +/// DOCME class FractionalTime { private: + + /// DOCME int time; // milliseconds, like in AssTime + + /// DOCME + + /// DOCME int num, den; // numerator/denominator + + /// DOCME bool drop; // EVIL + + /// DOCME wxString sep; // separator; someone might have separators of more than one character :V - // A period is roughly 10 minutes and is used for the dropframe stuff; - // SMPTE dropframe timecodes drops 18 timestamps per 18000, hence the number 17982. + + /// DOCME static const int frames_per_period = 17982; public: @@ -106,3 +128,4 @@ public: wxString FromMillisecs(int64_t msec); }; + diff --git a/aegisub/src/audio_box.cpp b/aegisub/src/audio_box.cpp index 2b9bd336d..1faa172d5 100644 --- a/aegisub/src/audio_box.cpp +++ b/aegisub/src/audio_box.cpp @@ -60,8 +60,10 @@ //#include "bevelButton.h" //#endif -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// AudioBox::AudioBox(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISED) { @@ -229,8 +231,9 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE } -////////////// -// Destructor + +/// @brief Destructor +/// AudioBox::~AudioBox() { audioScroll->PopEventHandler(true); HorizontalZoom->PopEventHandler(true); @@ -239,8 +242,12 @@ AudioBox::~AudioBox() { } -//////////// -// Set file + +/// @brief Set file +/// @param file +/// @param FromVideo +/// @return +/// void AudioBox::SetFile(wxString file,bool FromVideo) { wxLogDebug(_T("AudioBox::SetFile(file=%s, FromVideo=%d)"), file.c_str(), FromVideo?1:0); loaded = false; @@ -299,22 +306,28 @@ BEGIN_EVENT_TABLE(AudioBox,wxPanel) END_EVENT_TABLE() -///////////////////// -// Scrollbar changed + +/// @brief Scrollbar changed +/// @param event +/// void AudioBox::OnScrollbar(wxScrollEvent &event) { audioDisplay->SetPosition(event.GetPosition()*12); } -/////////////////////////////// -// Horizontal zoom bar changed + +/// @brief Horizontal zoom bar changed +/// @param event +/// void AudioBox::OnHorizontalZoom(wxScrollEvent &event) { audioDisplay->SetSamplesPercent(event.GetPosition()); } -///////////////////////////// -// Vertical zoom bar changed + +/// @brief Vertical zoom bar changed +/// @param event +/// void AudioBox::OnVerticalZoom(wxScrollEvent &event) { int pos = event.GetPosition(); if (pos < 1) pos = 1; @@ -328,8 +341,10 @@ void AudioBox::OnVerticalZoom(wxScrollEvent &event) { } -////////////////////// -// Volume bar changed + +/// @brief Volume bar changed +/// @param event +/// void AudioBox::OnVolume(wxScrollEvent &event) { if (!VerticalLink->GetValue()) { int pos = event.GetPosition(); @@ -340,8 +355,10 @@ void AudioBox::OnVolume(wxScrollEvent &event) { } -//////////////////////// -// Bars linked/unlinked + +/// @brief Bars linked/unlinked +/// @param event +/// void AudioBox::OnVerticalLink(wxCommandEvent &event) { int pos = VerticalZoom->GetValue(); if (pos < 1) pos = 1; @@ -358,8 +375,11 @@ void AudioBox::OnVerticalLink(wxCommandEvent &event) { } -//////// -// Sash + +/// @brief Sash +/// @param event +/// @return +/// void AudioBox::OnSash(wxSashEvent& event) { // OK? if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE) return; @@ -405,8 +425,10 @@ void AudioBox::OnSash(wxSashEvent& event) { } -////////////////// -// Play selection + +/// @brief Play selection +/// @param event +/// void AudioBox::OnPlaySelection(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -415,8 +437,10 @@ void AudioBox::OnPlaySelection(wxCommandEvent &event) { } -///////////////// -// Play dialogue + +/// @brief Play dialogue +/// @param event +/// void AudioBox::OnPlayDialogue(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -426,16 +450,20 @@ void AudioBox::OnPlayDialogue(wxCommandEvent &event) { } -//////////////// -// Stop Playing + +/// @brief Stop Playing +/// @param event +/// void AudioBox::OnStop(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->Stop(); } -//////// -// Next + +/// @brief Next +/// @param event +/// void AudioBox::OnNext(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->Stop(); @@ -443,8 +471,10 @@ void AudioBox::OnNext(wxCommandEvent &event) { } -//////////// -// Previous + +/// @brief Previous +/// @param event +/// void AudioBox::OnPrev(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->Stop(); @@ -452,8 +482,10 @@ void AudioBox::OnPrev(wxCommandEvent &event) { } -///////////////// -// 500 ms before + +/// @brief 500 ms before +/// @param event +/// void AudioBox::OnPlay500Before(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -462,8 +494,10 @@ void AudioBox::OnPlay500Before(wxCommandEvent &event) { } -//////////////// -// 500 ms after + +/// @brief 500 ms after +/// @param event +/// void AudioBox::OnPlay500After(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -472,8 +506,10 @@ void AudioBox::OnPlay500After(wxCommandEvent &event) { } -//////////////// -// First 500 ms + +/// @brief First 500 ms +/// @param event +/// void AudioBox::OnPlay500First(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -484,8 +520,10 @@ void AudioBox::OnPlay500First(wxCommandEvent &event) { } -/////////////// -// Last 500 ms + +/// @brief Last 500 ms +/// @param event +/// void AudioBox::OnPlay500Last(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -496,8 +534,10 @@ void AudioBox::OnPlay500Last(wxCommandEvent &event) { } -//////////////////////// -// Start to end of file + +/// @brief Start to end of file +/// @param event +/// void AudioBox::OnPlayToEnd(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); @@ -506,8 +546,11 @@ void AudioBox::OnPlayToEnd(wxCommandEvent &event) { } -////////////////// -// Commit changes + +/// @brief Commit changes +/// @param event +/// @return +/// void AudioBox::OnCommit(wxCommandEvent &event) { wxLogDebug(_T("AudioBox::OnCommit")); audioDisplay->SetFocus(); @@ -517,8 +560,11 @@ void AudioBox::OnCommit(wxCommandEvent &event) { } -////////////////// -// Toggle karaoke + +/// @brief Toggle karaoke +/// @param event +/// @return +/// void AudioBox::OnKaraoke(wxCommandEvent &event) { wxLogDebug(_T("AudioBox::OnKaraoke")); audioDisplay->SetFocus(); @@ -545,8 +591,9 @@ void AudioBox::OnKaraoke(wxCommandEvent &event) { } -//////////////////////// -// Sets karaoke buttons + +/// @brief Sets karaoke buttons +/// void AudioBox::SetKaraokeButtons() { // What to enable bool join,split; @@ -573,8 +620,10 @@ void AudioBox::SetKaraokeButtons() { } -/////////////// -// Join button + +/// @brief Join button +/// @param event +/// void AudioBox::OnJoin(wxCommandEvent &event) { wxLogDebug(_T("AudioBox::OnJoin")); audioDisplay->SetFocus(); @@ -586,8 +635,10 @@ void AudioBox::OnJoin(wxCommandEvent &event) { } -//////////////// -// Split button + +/// @brief Split button +/// @param event +/// void AudioBox::OnSplit(wxCommandEvent &event) { wxLogDebug(_T("AudioBox::OnSplit")); audioDisplay->SetFocus(); @@ -599,16 +650,20 @@ void AudioBox::OnSplit(wxCommandEvent &event) { } -/////////////// -// Goto button + +/// @brief Goto button +/// @param event +/// void AudioBox::OnGoto(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->MakeDialogueVisible(true); } -///////////// -// Auto Goto + +/// @brief Auto Goto +/// @param event +/// void AudioBox::OnAutoGoto(wxCommandEvent &event) { audioDisplay->SetFocus(); Options.SetBool(_T("Audio Autoscroll"),AutoScroll->GetValue()); @@ -616,8 +671,10 @@ void AudioBox::OnAutoGoto(wxCommandEvent &event) { } -/////////////// -// Auto Commit + +/// @brief Auto Commit +/// @param event +/// void AudioBox::OnAutoCommit(wxCommandEvent &event) { audioDisplay->SetFocus(); Options.SetBool(_T("Audio Autocommit"),AutoCommit->GetValue()); @@ -625,8 +682,10 @@ void AudioBox::OnAutoCommit(wxCommandEvent &event) { } -////////////////////// -// Next line on Commit + +/// @brief Next line on Commit +/// @param event +/// void AudioBox::OnNextLineCommit(wxCommandEvent &event) { audioDisplay->SetFocus(); Options.SetBool(_T("Audio Next Line on Commit"),NextCommit->GetValue()); @@ -634,8 +693,10 @@ void AudioBox::OnNextLineCommit(wxCommandEvent &event) { } -/////////////// -// Medusa Mode + +/// @brief Medusa Mode +/// @param event +/// void AudioBox::OnMedusaMode(wxCommandEvent &event) { audioDisplay->SetFocus(); Options.SetBool(_T("Audio Medusa Timing Hotkeys"),MedusaMode->GetValue()); @@ -644,8 +705,10 @@ void AudioBox::OnMedusaMode(wxCommandEvent &event) { } -////////////////////////// -// Spectrum Analyzer Mode + +/// @brief Spectrum Analyzer Mode +/// @param event +/// void AudioBox::OnSpectrumMode(wxCommandEvent &event) { Options.SetBool(_T("Audio Spectrum"),SpectrumMode->GetValue()); Options.Save(); @@ -655,13 +718,19 @@ void AudioBox::OnSpectrumMode(wxCommandEvent &event) { } -/////////////// -// Lead in/out + +/// @brief Lead in/out +/// @param event +/// void AudioBox::OnLeadIn(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->AddLead(true,false); } + +/// @brief DOCME +/// @param event +/// void AudioBox::OnLeadOut(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->AddLead(false,true); @@ -674,6 +743,10 @@ BEGIN_EVENT_TABLE(FocusEvent,wxEvtHandler) EVT_SET_FOCUS(FocusEvent::OnSetFocus) END_EVENT_TABLE() + +/// @brief DOCME +/// @param event +/// void FocusEvent::OnSetFocus(wxFocusEvent &event) { wxWindow *previous = event.GetWindow(); if (previous) previous->SetFocus(); @@ -681,3 +754,4 @@ void FocusEvent::OnSetFocus(wxFocusEvent &event) { + diff --git a/aegisub/src/audio_box.h b/aegisub/src/audio_box.h index cb57faac9..e0b263625 100644 --- a/aegisub/src/audio_box.h +++ b/aegisub/src/audio_box.h @@ -36,6 +36,8 @@ #ifndef AUDIO_BOX_H + +/// DOCME #define AUDIO_BOX_H @@ -63,29 +65,67 @@ class wxToggleButton; class ToggleBitmap; -/////////////////// -// Audio box class + +/// DOCME +/// @class AudioBox +/// @brief DOCME +/// +/// DOCME class AudioBox : public wxPanel { friend class AudioDisplay; private: + + /// DOCME wxScrollBar *audioScroll; + + /// DOCME wxSlider *HorizontalZoom; + + /// DOCME wxSlider *VerticalZoom; + + /// DOCME wxSlider *VolumeBar; + + /// DOCME wxSizer *MainSizer; + + /// DOCME wxSizer *TopSizer; + + /// DOCME wxSizer *sashSizer; + + /// DOCME wxSizer *DisplaySizer; + + /// DOCME wxSashWindow *Sash; + + /// DOCME ToggleBitmap *VerticalLink; + + /// DOCME wxButton *SplitButton; + + /// DOCME wxButton *JoinButton; + + /// DOCME ToggleBitmap *AutoScroll; + + /// DOCME ToggleBitmap *NextCommit; + + /// DOCME ToggleBitmap *MedusaMode; + + /// DOCME ToggleBitmap *AutoCommit; + + /// DOCME ToggleBitmap *SpectrumMode; void OnScrollbar(wxScrollEvent &event); @@ -120,12 +160,26 @@ private: void OnNextLineCommit(wxCommandEvent &event); public: + + /// DOCME AudioDisplay *audioDisplay; + + /// DOCME AudioKaraoke *audioKaraoke; + + /// DOCME wxToggleButton *KaraokeButton; + + /// DOCME FrameMain *frameMain; + + /// DOCME wxString audioName; + + /// DOCME bool loaded; + + /// DOCME bool karaokeMode; AudioBox(wxWindow *parent); @@ -138,6 +192,12 @@ public: }; + +/// DOCME +/// @class FocusEvent +/// @brief DOCME +/// +/// DOCME class FocusEvent : public wxEvtHandler { private: @@ -149,38 +209,95 @@ private: /////// // IDs enum { + + /// DOCME Audio_Scrollbar = 1600, + + /// DOCME Audio_Horizontal_Zoom, + + /// DOCME Audio_Vertical_Zoom, + + /// DOCME Audio_Volume, + + /// DOCME Audio_Sash, + + /// DOCME Audio_Vertical_Link, + + /// DOCME Audio_Button_Play, + + /// DOCME Audio_Button_Stop, + + /// DOCME Audio_Button_Prev, + + /// DOCME Audio_Button_Next, + + /// DOCME Audio_Button_Play_500ms_Before, + + /// DOCME Audio_Button_Play_500ms_After, + + /// DOCME Audio_Button_Play_500ms_First, + + /// DOCME Audio_Button_Play_500ms_Last, + + /// DOCME Audio_Button_Play_Row, + + /// DOCME Audio_Button_Play_To_End, + + /// DOCME Audio_Button_Commit, + + /// DOCME Audio_Button_Karaoke, + + /// DOCME Audio_Button_Goto, + + /// DOCME Audio_Button_Join, + + /// DOCME Audio_Button_Split, + + /// DOCME Audio_Button_Leadin, + + /// DOCME Audio_Button_Leadout, + + /// DOCME Audio_Check_AutoCommit, + + /// DOCME Audio_Check_NextCommit, + + /// DOCME Audio_Check_AutoGoto, + + /// DOCME Audio_Check_Medusa, + + /// DOCME Audio_Check_Spectrum }; #endif + diff --git a/aegisub/src/audio_display.cpp b/aegisub/src/audio_display.cpp index 3698ae489..f4c56bc59 100644 --- a/aegisub/src/audio_display.cpp +++ b/aegisub/src/audio_display.cpp @@ -67,13 +67,19 @@ #ifdef __WXMAC__ + +/// DOCME # define AudioDisplayWindowStyle wxWANTS_CHARS #else + +/// DOCME # define AudioDisplayWindowStyle wxSUNKEN_BORDER | wxWANTS_CHARS #endif -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// AudioDisplay::AudioDisplay(wxWindow *parent) : wxWindow (parent, -1, wxDefaultPosition, wxSize(200,Options.AsInt(_T("Audio Display Height"))), AudioDisplayWindowStyle , _T("Audio Display")) { @@ -125,8 +131,9 @@ AudioDisplay::AudioDisplay(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// AudioDisplay::~AudioDisplay() { if (player) player->CloseStream(); delete provider; @@ -148,8 +155,9 @@ AudioDisplay::~AudioDisplay() { } -///////// -// Reset + +/// @brief Reset +/// void AudioDisplay::Reset() { wxLogDebug(_T("AudioDisplay::Reset")); hasSel = false; @@ -163,8 +171,10 @@ void AudioDisplay::Reset() { } -//////////////// -// Update image + +/// @brief Update image +/// @param weak +/// void AudioDisplay::UpdateImage(bool weak) { // Update samples UpdateSamples(); @@ -177,6 +187,10 @@ void AudioDisplay::UpdateImage(bool weak) { Refresh(false); } + +/// @brief DOCME +/// @return +/// void AudioDisplay::DoUpdateImage() { // Loaded? if (!loaded || !provider) return; @@ -397,8 +411,11 @@ void AudioDisplay::DoUpdateImage() { } -/////////////////////// -// Draw Inactive Lines + +/// @brief Draw Inactive Lines +/// @param dc +/// @return +/// void AudioDisplay::DrawInactiveLines(wxDC &dc) { // Check if there is anything to do int shadeType = Options.AsInt(_T("Audio Inactive Lines Display Mode")); @@ -471,8 +488,10 @@ void AudioDisplay::DrawInactiveLines(wxDC &dc) { } -////////////////// -// Draw keyframes + +/// @brief Draw keyframes +/// @param dc +/// void AudioDisplay::DrawKeyframes(wxDC &dc) { wxArrayInt KeyFrames = VideoContext::Get()->GetKeyFrames(); int nKeys = (int)KeyFrames.Count(); @@ -494,8 +513,10 @@ void AudioDisplay::DrawKeyframes(wxDC &dc) { } -////////////////// -// Draw timescale + +/// @brief Draw timescale +/// @param dc +/// void AudioDisplay::DrawTimescale(wxDC &dc) { // Set size int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0; @@ -559,8 +580,11 @@ void AudioDisplay::DrawTimescale(wxDC &dc) { } -//////////// -// Waveform + +/// @brief Waveform +/// @param dc +/// @param weak +/// void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) { // Prepare Waveform if (!weak || peak == NULL || min == NULL) { @@ -601,8 +625,11 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) { } -////////////////////////// -// Draw spectrum analyzer + +/// @brief Draw spectrum analyzer +/// @param finaldc +/// @param weak +/// void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) { if (!weak || !spectrumDisplay || spectrumDisplay->GetWidth() != w || spectrumDisplay->GetHeight() != h) { if (spectrumDisplay) { @@ -653,8 +680,12 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) { } } -////////////////////////// -// Get selection position + +/// @brief Get selection position +/// @param selStart +/// @param selEnd +/// @param cap +/// void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) { selStart = GetXAtMS(curStartMS); selEnd = GetXAtMS(curEndMS); @@ -668,8 +699,12 @@ void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) { } -//////////////////////// -// Get karaoke position + +/// @brief Get karaoke position +/// @param karStart +/// @param karEnd +/// @param cap +/// void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) { try { // Wrap around @@ -698,8 +733,10 @@ void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) { } -////////// -// Update + +/// @brief Update +/// @return +/// void AudioDisplay::Update() { if (blockUpdate) return; if (loaded) { @@ -711,8 +748,9 @@ void AudioDisplay::Update() { } -////////////////////// -// Recreate the image + +/// @brief Recreate the image +/// void AudioDisplay::RecreateImage() { GetClientSize(&w,&h); h -= Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0; @@ -722,8 +760,10 @@ void AudioDisplay::RecreateImage() { } -///////////////////////// -// Make dialogue visible + +/// @brief Make dialogue visible +/// @param force +/// void AudioDisplay::MakeDialogueVisible(bool force) { wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0); // Variables @@ -756,8 +796,10 @@ void AudioDisplay::MakeDialogueVisible(bool force) { } -//////////////// -// Set position + +/// @brief Set position +/// @param pos +/// void AudioDisplay::SetPosition(int pos) { wxLogDebug(_T("AudioDisplay::SetPosition(pos=%d)"), pos); Position = pos; @@ -766,8 +808,12 @@ void AudioDisplay::SetPosition(int pos) { } -/////////////////// -// Update position + +/// @brief Update position +/// @param pos +/// @param IsSample +/// @return +/// void AudioDisplay::UpdatePosition (int pos,bool IsSample) { // Safeguards if (!provider) return; @@ -783,9 +829,13 @@ void AudioDisplay::UpdatePosition (int pos,bool IsSample) { } -///////////////////////////// -// Set samples in percentage -// Note: aka Horizontal Zoom + +/// @brief Note: aka Horizontal Zoom Set samples in percentage +/// @param percent +/// @param update +/// @param pivot +/// @return +/// void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) { // Calculate if (percent < 1) percent = 1; @@ -810,8 +860,10 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) { } -////////////////// -// Update samples + +/// @brief Update samples +/// @return +/// void AudioDisplay::UpdateSamples() { // Set samples if (!provider) return; @@ -836,8 +888,11 @@ void AudioDisplay::UpdateSamples() { } -///////////// -// Set scale + +/// @brief Set scale +/// @param _scale +/// @return +/// void AudioDisplay::SetScale(float _scale) { if (scale == _scale) return; scale = _scale; @@ -845,8 +900,11 @@ void AudioDisplay::SetScale(float _scale) { } -////////////////// -// Load from file + +/// @brief Load from file +/// @param file +/// @return +/// void AudioDisplay::SetFile(wxString file) { wxLogDebug(_T("AudioDisplay::SetFile(file=%s)"), file.c_str()); // Unload @@ -956,8 +1014,9 @@ void AudioDisplay::SetFile(wxString file) { } -/////////////////// -// Load from video + +/// @brief Load from video +/// void AudioDisplay::SetFromVideo() { wxLogDebug(_T("AudioDisplay::SetFromVideo")); if (VideoContext::Get()->IsLoaded()) { @@ -969,16 +1028,19 @@ void AudioDisplay::SetFromVideo() { } -//////////////// -// Reload audio + +/// @brief Reload audio +/// void AudioDisplay::Reload() { wxLogDebug(_T("AudioDisplay::Reload")); if (provider) SetFile(provider->GetFilename()); } -//////////////////// -// Update scrollbar + +/// @brief Update scrollbar +/// @return +/// void AudioDisplay::UpdateScrollbar() { if (!provider) return; int page = w/12; @@ -988,50 +1050,72 @@ void AudioDisplay::UpdateScrollbar() { } -////////////////////////////////////////////// -// Gets the sample number at the x coordinate + +/// @brief Gets the sample number at the x coordinate +/// @param x +/// @return +/// int64_t AudioDisplay::GetSampleAtX(int x) { return (x+Position)*samples; } -///////////////////////////////////////////////// -// Gets the x coordinate corresponding to sample + +/// @brief Gets the x coordinate corresponding to sample +/// @param n +/// @return +/// int AudioDisplay::GetXAtSample(int64_t n) { return samples ? (n/samples)-Position : 0; } -///////////////// -// Get MS from X + +/// @brief Get MS from X +/// @param x +/// @return +/// int AudioDisplay::GetMSAtX(int64_t x) { return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate(); } -///////////////// -// Get X from MS + +/// @brief Get X from MS +/// @param ms +/// @return +/// int AudioDisplay::GetXAtMS(int64_t ms) { return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples; } -//////////////////// -// Get MS At sample + +/// @brief Get MS At sample +/// @param x +/// @return +/// int AudioDisplay::GetMSAtSample(int64_t x) { return x * 1000 / provider->GetSampleRate(); } -//////////////////// -// Get Sample at MS + +/// @brief Get Sample at MS +/// @param ms +/// @return +/// int64_t AudioDisplay::GetSampleAtMS(int64_t ms) { return ms * provider->GetSampleRate() / 1000; } -//////// -// Play + +/// @brief Play +/// @param start +/// @param end +/// @return +/// void AudioDisplay::Play(int start,int end) { wxLogDebug(_T("AudioDisplay::Play")); Stop(); @@ -1092,8 +1176,9 @@ void AudioDisplay::Play(int start,int end) { } -//////// -// Stop + +/// @brief Stop +/// void AudioDisplay::Stop() { wxLogDebug(_T("AudioDisplay::Stop")); if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop(); @@ -1101,8 +1186,12 @@ void AudioDisplay::Stop() { } -/////////////////////////// -// Get samples of dialogue + +/// @brief Get samples of dialogue +/// @param start +/// @param end +/// @return +/// void AudioDisplay::GetTimesDialogue(int &start,int &end) { wxLogDebug(_T("AudioDisplay::GetTimesDialogue")); if (!dialogue) { @@ -1116,8 +1205,12 @@ void AudioDisplay::GetTimesDialogue(int &start,int &end) { } -//////////////////////////// -// Get samples of selection + +/// @brief Get samples of selection +/// @param start +/// @param end +/// @return +/// void AudioDisplay::GetTimesSelection(int &start,int &end) { wxLogDebug(_T("AudioDisplay::GetTimesSelection")); start = 0; @@ -1140,8 +1233,11 @@ void AudioDisplay::GetTimesSelection(int &start,int &end) { } -///////////////////////////// -// Set the current selection + +/// @brief Set the current selection +/// @param start +/// @param end +/// void AudioDisplay::SetSelection(int start, int end) { wxLogDebug(_T("AudioDisplay::SetSelection(start=%d, end=%d)"), start, end); curStartMS = start; @@ -1150,8 +1246,13 @@ void AudioDisplay::SetSelection(int start, int end) { } -//////////////// -// Set dialogue + +/// @brief Set dialogue +/// @param _grid +/// @param diag +/// @param n +/// @return +/// void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) { wxLogDebug(_T("AudioDisplay::SetDialogue")); // Actual parameters @@ -1197,8 +1298,11 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) { } -////////////////// -// Commit changes + +/// @brief Commit changes +/// @param nextLine +/// @return +/// void AudioDisplay::CommitChanges (bool nextLine) { wxLogDebug(_T("AudioDisplay::CommitChanges(nextLine=%d)"), nextLine?1:0); // Loaded? @@ -1311,8 +1415,11 @@ void AudioDisplay::CommitChanges (bool nextLine) { } -//////////// -// Add lead + +/// @brief Add lead +/// @param in +/// @param out +/// void AudioDisplay::AddLead(bool in,bool out) { // Lead in if (in) { @@ -1346,8 +1453,11 @@ BEGIN_EVENT_TABLE(AudioDisplay, wxWindow) END_EVENT_TABLE() -///////// -// Paint + +/// @brief Paint +/// @param event +/// @return +/// void AudioDisplay::OnPaint(wxPaintEvent& event) { if (w == 0 || h == 0) return; DoUpdateImage(); @@ -1357,8 +1467,11 @@ void AudioDisplay::OnPaint(wxPaintEvent& event) { } -/////////////// -// Mouse event + +/// @brief Mouse event +/// @param event +/// @return +/// void AudioDisplay::OnMouseEvent(wxMouseEvent& event) { // Get x,y int64_t x = event.GetX(); @@ -1764,8 +1877,14 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) { } -//////////////////////// -// Get snap to boundary + +/// @brief Get snap to boundary +/// @param ms +/// @param rangeX +/// @param shiftHeld +/// @param start +/// @return +/// int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) { // Range? if (rangeX <= 0) return ms; @@ -1954,8 +2073,10 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) { */ -////////////// -// Size event + +/// @brief Size event +/// @param event +/// void AudioDisplay::OnSize(wxSizeEvent &event) { // Set size GetClientSize(&w,&h); @@ -1973,8 +2094,11 @@ void AudioDisplay::OnSize(wxSizeEvent &event) { } -/////////////// -// Timer event + +/// @brief Timer event +/// @param event +/// @return +/// void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) { if (!origImage) return; @@ -2060,8 +2184,10 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) { } -//////////// -// Key down + +/// @brief Key down +/// @param event +/// void AudioDisplay::OnKeyDown(wxKeyEvent &event) { int key = event.GetKeyCode(); #ifdef __APPLE__ @@ -2229,8 +2355,12 @@ void AudioDisplay::OnKeyDown(wxKeyEvent &event) { } -/////////////// -// Change line + +/// @brief Change line +/// @param delta +/// @param block +/// @return +/// void AudioDisplay::ChangeLine(int delta, bool block) { wxLogDebug(_T("AudioDisplay::ChangeLine(delta=%d)"), delta); if (dialogue) { @@ -2258,8 +2388,11 @@ void AudioDisplay::ChangeLine(int delta, bool block) { } -//////// -// Next + +/// @brief Next +/// @param play +/// @return +/// void AudioDisplay::Next(bool play) { wxLogDebug(_T("AudioDisplay::Next")); // Karaoke @@ -2313,8 +2446,11 @@ void AudioDisplay::Next(bool play) { } -//////////// -// Previous + +/// @brief Previous +/// @param play +/// @return +/// void AudioDisplay::Prev(bool play) { wxLogDebug(_T("AudioDisplay::Prev")); // Karaoke @@ -2366,8 +2502,11 @@ void AudioDisplay::Prev(bool play) { } -/////////////////////////////// -// Gets syllable at x position + +/// @brief Gets syllable at x position +/// @param x +/// @return +/// int AudioDisplay::GetSyllableAtX(int x) { if (!karaoke->enabled) return -1; int ms = GetMSAtX(x); @@ -2386,8 +2525,10 @@ int AudioDisplay::GetSyllableAtX(int x) { } -//////////////// -// Focus events + +/// @brief Focus events +/// @param event +/// void AudioDisplay::OnGetFocus(wxFocusEvent &event) { if (!hasFocus) { hasFocus = true; @@ -2395,6 +2536,10 @@ void AudioDisplay::OnGetFocus(wxFocusEvent &event) { } } + +/// @brief DOCME +/// @param event +/// void AudioDisplay::OnLoseFocus(wxFocusEvent &event) { if (hasFocus && loaded) { hasFocus = false; @@ -2404,11 +2549,13 @@ void AudioDisplay::OnLoseFocus(wxFocusEvent &event) { } -////////////////////////////// -// Update time edit controls + +/// @brief Update time edit controls +/// void AudioDisplay::UpdateTimeEditCtrls() { grid->editBox->StartTime->SetTime(curStartMS,true); grid->editBox->EndTime->SetTime(curEndMS,true); grid->editBox->Duration->SetTime(curEndMS-curStartMS,true); } + diff --git a/aegisub/src/audio_display.h b/aegisub/src/audio_display.h index 6f8a2d473..f29394910 100644 --- a/aegisub/src/audio_display.h +++ b/aegisub/src/audio_display.h @@ -36,6 +36,8 @@ #ifndef AUDIO_DISPLAY_H + +/// DOCME #define AUDIO_DISPLAY_H @@ -61,58 +63,146 @@ class VideoProvider; class FrameMain; -///////////////// -// Display class + +/// DOCME +/// @class AudioDisplay +/// @brief DOCME +/// +/// DOCME class AudioDisplay: public wxWindow { friend class FrameMain; private: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME int line_n; + + /// DOCME AssDialogue *dialogue; + + /// DOCME AudioSpectrum *spectrumRenderer; + + /// DOCME wxBitmap *origImage; + + /// DOCME wxBitmap *spectrumDisplay; + + /// DOCME wxBitmap *spectrumDisplaySelected; + + /// DOCME int64_t PositionSample; + + /// DOCME float scale; + + /// DOCME int samples; + + /// DOCME int64_t Position; + + /// DOCME int samplesPercent; + + /// DOCME int oldCurPos; + + /// DOCME bool hasFocus; + + /// DOCME bool blockUpdate; + + /// DOCME bool dontReadTimes; + + /// DOCME bool playingToEnd; + + /// DOCME bool needImageUpdate; + + /// DOCME bool needImageUpdateWeak; + + /// DOCME bool hasSel; + + /// DOCME bool hasKaraoke; + + /// DOCME bool diagUpdated; + + /// DOCME bool holding; + + /// DOCME bool draggingScale; + + /// DOCME int64_t selStart; + + /// DOCME int64_t selEnd; + + /// DOCME int64_t lineStart; + + /// DOCME int64_t lineEnd; + + /// DOCME int64_t selStartCap; + + /// DOCME int64_t selEndCap; + + /// DOCME int hold; + + /// DOCME int lastX; + + /// DOCME int lastDragX; + + /// DOCME int curStartMS; + + /// DOCME int curEndMS; + + /// DOCME int holdSyl; + + /// DOCME int *peak; + + /// DOCME int *min; + + /// DOCME int scrubTime; + + /// DOCME int64_t scrubLastPos; + + /// DOCME bool scrubbing; + + /// DOCME int scrubLastRate; void OnPaint(wxPaintEvent &event); @@ -138,17 +228,41 @@ private: void DoUpdateImage(); public: + + /// DOCME AudioProvider *provider; + + /// DOCME StreamAudioProvider *scrubProvider; + + /// DOCME AudioPlayer *player; + + /// DOCME bool NeedCommit; + + /// DOCME bool loaded; + + /// DOCME bool temporary; + + /// DOCME + + /// DOCME int w,h; + + /// DOCME AudioBox *box; + + /// DOCME AudioKaraoke *karaoke; + + /// DOCME wxScrollBar *ScrollBar; + + /// DOCME wxTimer UpdateTimer; AudioDisplay(wxWindow *parent); @@ -197,9 +311,12 @@ public: /////// // IDs enum { + + /// DOCME Audio_Update_Timer = 1700 }; #endif + diff --git a/aegisub/src/audio_karaoke.cpp b/aegisub/src/audio_karaoke.cpp index 3bb2f221d..1750dd8b1 100644 --- a/aegisub/src/audio_karaoke.cpp +++ b/aegisub/src/audio_karaoke.cpp @@ -52,8 +52,9 @@ #include -///////////////////// -// Empty constructor + +/// @brief Empty constructor +/// AudioKaraokeSyllable::AudioKaraokeSyllable() : AssKaraokeSyllable() , start_time(0), selected(false) @@ -61,8 +62,10 @@ AudioKaraokeSyllable::AudioKaraokeSyllable() { } -////////////////////////////// -// Copy-from-base constructor + +/// @brief Copy-from-base constructor +/// @param base +/// AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base) : AssKaraokeSyllable(base) , start_time(0), selected(false) @@ -72,8 +75,10 @@ AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base) -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// AudioKaraoke::AudioKaraoke(wxWindow *parent) : wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN) { @@ -87,15 +92,19 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// AudioKaraoke::~AudioKaraoke() { delete workDiag; } -////////////////////// -// Load from dialogue + +/// @brief Load from dialogue +/// @param _diag +/// @return +/// bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) { wxLogDebug(_T("AudioKaraoke::LoadFromDialogue(diag=%p)"), _diag); // Make sure we're not in splitting-mode @@ -137,8 +146,10 @@ bool AudioKaraoke::LoadFromDialogue(AssDialogue *_diag) { } -//////////////////// -// Writes line back + +/// @brief Writes line back +/// @return +/// void AudioKaraoke::Commit() { wxLogDebug(_T("AudioKaraoke::Commit")); if (splitting) { @@ -182,8 +193,10 @@ void AudioKaraoke::Commit() { } -////////////////// -// Autosplit line + +/// @brief Autosplit line +/// @return +/// void AudioKaraoke::AutoSplit() { wxLogDebug(_T("AudioKaraoke::AutoSplit")); @@ -237,8 +250,11 @@ void AudioKaraoke::AutoSplit() { } -////////////////////////////////// -// Parses text to extract karaoke + +/// @brief Parses text to extract karaoke +/// @param curDiag +/// @return +/// bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) { // parse the tagdata AssKaraokeVector tempsyls; @@ -268,8 +284,11 @@ bool AudioKaraoke::ParseDialogue(AssDialogue *curDiag) { } -//////////////// -// Set syllable + +/// @brief Set syllable +/// @param n +/// @return +/// void AudioKaraoke::SetSyllable(int n) { wxLogDebug(_T("AudioKaraoke::SetSyllable(n=%d)"), n); if (n == -1) n = syllables.size()-1; @@ -291,8 +310,10 @@ BEGIN_EVENT_TABLE(AudioKaraoke,wxWindow) END_EVENT_TABLE() -/////////////// -// Paint event + +/// @brief Paint event +/// @param event +/// void AudioKaraoke::OnPaint(wxPaintEvent &event) { // Get dimensions int w,h; @@ -401,15 +422,20 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) { } -////////////// -// Size event + +/// @brief Size event +/// @param event +/// void AudioKaraoke::OnSize(wxSizeEvent &event) { Refresh(false); } -/////////////// -// Mouse event + +/// @brief Mouse event +/// @param event +/// @return +/// void AudioKaraoke::OnMouse(wxMouseEvent &event) { // Get coordinates int x = event.GetX(); @@ -542,8 +568,11 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) { } -////////////////////////////// -// Get Syllable at position X + +/// @brief Get Syllable at position X +/// @param x +/// @return +/// int AudioKaraoke::GetSylAtX(int x) { int dx,dw; size_t syln = syllables.size(); @@ -558,8 +587,11 @@ int AudioKaraoke::GetSylAtX(int x) { } -///////////////// -// Set selection + +/// @brief Set selection +/// @param start +/// @param end +/// void AudioKaraoke::SetSelection(int start,int end) { wxLogDebug(_T("AudioKaraoke::SetSelection(start=%d, end=%d)"), start, end); // Default end @@ -593,8 +625,10 @@ void AudioKaraoke::SetSelection(int start,int end) { } -////////////////// -// Join syllables + +/// @brief Join syllables +/// @return +/// void AudioKaraoke::Join() { wxLogDebug(_T("AudioKaraoke::Join")); // Variables @@ -638,8 +672,9 @@ void AudioKaraoke::Join() { } -//////////////////////// -// Enter splitting-mode + +/// @brief Enter splitting-mode +/// void AudioKaraoke::BeginSplit() { wxLogDebug(_T("AudioKaraoke::BeginSplit")); splitting = true; @@ -650,8 +685,11 @@ void AudioKaraoke::BeginSplit() { } -//////////////////////////////////////////// -// Leave splitting-mode, committing changes + +/// @brief Leave splitting-mode, committing changes +/// @param commit +/// @return +/// void AudioKaraoke::EndSplit(bool commit) { wxLogDebug(_T("AudioKaraoke::EndSplit(commit=%d)"), commit?1:0); splitting = false; @@ -686,8 +724,11 @@ void AudioKaraoke::EndSplit(bool commit) { } -///////////////////////////////////////////////// -// Split a syllable using the pending_slits data + +/// @brief Split a syllable using the pending_slits data +/// @param n +/// @return +/// int AudioKaraoke::SplitSyl (unsigned int n) { wxLogDebug(_T("AudioKaraoke::SplitSyl(n=%u)"), n); @@ -755,8 +796,13 @@ int AudioKaraoke::SplitSyl (unsigned int n) { } -////////////////////////////////// -// Apply delta length to syllable + +/// @brief Apply delta length to syllable +/// @param n +/// @param delta +/// @param mode +/// @return +/// bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) { wxLogDebug(_T("AudioKaraoke::SyllableDelta(n=%d, delta=%d, mode=%d)"), n, delta, mode); // Get syllable and next @@ -806,8 +852,10 @@ bool AudioKaraoke::SyllableDelta(int n,int delta,int mode) { } -//////////////////////////////// -// Karaoke tag menu constructor + +/// @brief Karaoke tag menu constructor +/// @param _kara +/// AudioKaraokeTagMenu::AudioKaraokeTagMenu(AudioKaraoke *_kara) : wxMenu(_("Karaoke tag")) , kara(_kara) @@ -833,8 +881,9 @@ AudioKaraokeTagMenu::AudioKaraokeTagMenu(AudioKaraoke *_kara) } -/////////////////////////////// -// Karaoke tag menu destructor + +/// @brief Karaoke tag menu destructor +/// AudioKaraokeTagMenu::~AudioKaraokeTagMenu() { } @@ -846,8 +895,10 @@ BEGIN_EVENT_TABLE(AudioKaraokeTagMenu,wxMenu) END_EVENT_TABLE() -////////////////////////////////// -// Karaoke tag menu event handler + +/// @brief Karaoke tag menu event handler +/// @param event +/// void AudioKaraokeTagMenu::OnSelectItem(wxCommandEvent &event) { // Select the new tag for the syllables wxString newtag; @@ -881,3 +932,4 @@ void AudioKaraokeTagMenu::OnSelectItem(wxCommandEvent &event) { + diff --git a/aegisub/src/audio_karaoke.h b/aegisub/src/audio_karaoke.h index 906fb33af..c280ba55f 100644 --- a/aegisub/src/audio_karaoke.h +++ b/aegisub/src/audio_karaoke.h @@ -36,6 +36,8 @@ #ifndef AUDIO_KARAOKE_H + +/// DOCME #define AUDIO_KARAOKE_H @@ -59,32 +61,60 @@ class AudioDisplay; class AudioBox; class AudioKaraokeTagMenu; -/////////////////////////////////// -// Karaoke syllable with more info + +/// DOCME struct AudioKaraokeSyllable : AssKaraokeSyllable { + + /// DOCME int start_time; // centiseconds + + /// DOCME bool selected; + + /// DOCME std::vector pending_splits; + + /// DOCME int display_w; + + /// DOCME int display_x; AudioKaraokeSyllable(); AudioKaraokeSyllable(const AssKaraokeSyllable &base); }; + +/// DOCME typedef std::vector AudioKaraokeVector; -///////// -// Class + +/// DOCME +/// @class AudioKaraoke +/// @brief DOCME +/// +/// DOCME class AudioKaraoke : public wxWindow { friend class AudioKaraokeTagMenu; private: + + /// DOCME AssDialogue *diag; + + /// DOCME AssDialogue *workDiag; + + /// DOCME int startClickSyl; + + /// DOCME bool must_rebuild; + + /// DOCME int split_cursor_syl; + + /// DOCME int split_cursor_x; void AutoSplit(); @@ -98,13 +128,27 @@ private: void OnMouse(wxMouseEvent &event); public: + + /// DOCME AudioDisplay *display; + + /// DOCME AudioBox *box; + + /// DOCME int curSyllable; + + /// DOCME int selectionCount; + + /// DOCME bool enabled; + + /// DOCME bool splitting; + + /// DOCME AudioKaraokeVector syllables; AudioKaraoke(wxWindow *parent); @@ -124,10 +168,16 @@ public: }; -/////////////// -// Helper menu + +/// DOCME +/// @class AudioKaraokeTagMenu +/// @brief DOCME +/// +/// DOCME class AudioKaraokeTagMenu : public wxMenu { private: + + /// DOCME AudioKaraoke *kara; void OnSelectItem(wxCommandEvent &event); @@ -141,3 +191,4 @@ public: #endif + diff --git a/aegisub/src/audio_player.cpp b/aegisub/src/audio_player.cpp index bb648a44d..7cc35e0e2 100644 --- a/aegisub/src/audio_player.cpp +++ b/aegisub/src/audio_player.cpp @@ -60,16 +60,18 @@ #endif -/////////////// -// Constructor + +/// @brief Constructor +/// AudioPlayer::AudioPlayer() { provider = NULL; displayTimer = NULL; } -////////////// -// Destructor + +/// @brief Destructor +/// AudioPlayer::~AudioPlayer() { if (displayTimer) { displayTimer->Stop(); @@ -78,36 +80,45 @@ AudioPlayer::~AudioPlayer() { } -//////////////// -// Set provider + +/// @brief Set provider +/// @param _provider +/// void AudioPlayer::SetProvider(AudioProvider *_provider) { provider = _provider; } -//////////////// -// Get provider + +/// @brief Get provider +/// @return +/// AudioProvider *AudioPlayer::GetProvider() { return provider; } -///////////// -// Get mutex + +/// @brief Get mutex +/// @return +/// wxMutex *AudioPlayer::GetMutex() { return NULL; } -///////////// -// Set timer + +/// @brief Set timer +/// @param timer +/// void AudioPlayer::SetDisplayTimer(wxTimer *timer) { displayTimer = timer; } -///////////////////// -// Ask to stop later + +/// @brief Ask to stop later +/// void AudioPlayer::RequestStop() { wxCommandEvent event(wxEVT_STOP_AUDIO, 1000); event.SetEventObject(this); @@ -123,13 +134,19 @@ BEGIN_EVENT_TABLE(AudioPlayer, wxEvtHandler) EVT_COMMAND (1000, wxEVT_STOP_AUDIO, AudioPlayer::OnStopAudio) END_EVENT_TABLE() + +/// @brief DOCME +/// @param event +/// void AudioPlayer::OnStopAudio(wxCommandEvent &event) { Stop(false); } -////////////// -// Get player + +/// @brief Get player +/// @return +/// AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() { // List of providers wxArrayString list = GetFactoryList(Options.AsText(_T("Audio player"))); @@ -154,8 +171,9 @@ AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() { } -////////////////////////// -// Register all factories + +/// @brief Register all factories +/// void AudioPlayerFactoryManager::RegisterProviders() { #ifdef WITH_ALSA RegisterFactory(new AlsaPlayerFactory(),_T("ALSA")); @@ -176,15 +194,17 @@ void AudioPlayerFactoryManager::RegisterProviders() { } -/////////////////////// -// Clear all factories + +/// @brief Clear all factories +/// void AudioPlayerFactoryManager::ClearProviders() { ClearFactories(); } -////////// -// Static + +/// DOCME template std::map* FactoryManager::factories=NULL; + diff --git a/aegisub/src/audio_player_alsa.cpp b/aegisub/src/audio_player_alsa.cpp index abe671f7c..a434aa095 100644 --- a/aegisub/src/audio_player_alsa.cpp +++ b/aegisub/src/audio_player_alsa.cpp @@ -52,8 +52,9 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AlsaPlayer::AlsaPlayer() { volume = 1.0f; @@ -64,16 +65,18 @@ AlsaPlayer::AlsaPlayer() } -////////////// -// Destructor + +/// @brief Destructor +/// AlsaPlayer::~AlsaPlayer() { CloseStream(); } -/////////////// -// Open stream + +/// @brief Open stream +/// void AlsaPlayer::OpenStream() { CloseStream(); @@ -102,6 +105,9 @@ void AlsaPlayer::OpenStream() } + +/// @brief DOCME +/// void AlsaPlayer::SetUpHardware() { int dir; @@ -195,6 +201,9 @@ void AlsaPlayer::SetUpHardware() } + +/// @brief DOCME +/// void AlsaPlayer::SetUpAsync() { // Prepare software params struct @@ -231,8 +240,10 @@ void AlsaPlayer::SetUpAsync() } -//////////////// -// Close stream + +/// @brief Close stream +/// @return +/// void AlsaPlayer::CloseStream() { if (!open) return; @@ -250,8 +261,11 @@ void AlsaPlayer::CloseStream() } -//////// -// Play + +/// @brief Play +/// @param start +/// @param count +/// void AlsaPlayer::Play(int64_t start,int64_t count) { if (playing) { @@ -278,8 +292,11 @@ void AlsaPlayer::Play(int64_t start,int64_t count) } -//////// -// Stop + +/// @brief Stop +/// @param timerToo +/// @return +/// void AlsaPlayer::Stop(bool timerToo) { if (!open) return; @@ -300,42 +317,60 @@ void AlsaPlayer::Stop(bool timerToo) } + +/// @brief DOCME +/// @return +/// bool AlsaPlayer::IsPlaying() { return playing; } -/////////// -// Set end + +/// @brief Set end +/// @param pos +/// void AlsaPlayer::SetEndPosition(int64_t pos) { end_frame = pos; } -//////////////////////// -// Set current position + +/// @brief Set current position +/// @param pos +/// void AlsaPlayer::SetCurrentPosition(int64_t pos) { cur_frame = pos; } + +/// @brief DOCME +/// @return +/// int64_t AlsaPlayer::GetStartPosition() { return start_frame; } + +/// @brief DOCME +/// @return +/// int64_t AlsaPlayer::GetEndPosition() { return end_frame; } -//////////////////////// -// Get current position + +/// @brief Get current position +/// @return +/// int64_t AlsaPlayer::GetCurrentPosition() { // FIXME: this should be based on not duration played but actual sample being heard @@ -346,6 +381,10 @@ int64_t AlsaPlayer::GetCurrentPosition() } + +/// @brief DOCME +/// @param pcm_callback +/// void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback) { // TODO: check for broken pipes in here and restore as needed @@ -393,3 +432,4 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback) #endif // WITH_ALSA + diff --git a/aegisub/src/audio_player_alsa.h b/aegisub/src/audio_player_alsa.h index 07c5f94f3..7c57b0a0b 100644 --- a/aegisub/src/audio_player_alsa.h +++ b/aegisub/src/audio_player_alsa.h @@ -50,30 +50,70 @@ #include "options.h" -/////////////// -// Alsa player + +/// DOCME +/// @class AlsaPlayer +/// @brief DOCME +/// +/// DOCME class AlsaPlayer : public AudioPlayer { private: + + /// DOCME bool open; + + /// DOCME volatile bool playing; + + /// DOCME volatile float volume; + + /// DOCME volatile unsigned long start_frame; // first frame of playback + + /// DOCME volatile unsigned long cur_frame; // last written frame + 1 + + /// DOCME volatile unsigned long end_frame; // last frame to play + + /// DOCME unsigned long bpf; // bytes per frame + + /// DOCME AudioProvider *provider; + + /// DOCME snd_pcm_t *pcm_handle; // device handle + + /// DOCME snd_pcm_stream_t stream; // stream direction + + /// DOCME snd_async_handler_t *pcm_callback; + + /// DOCME snd_pcm_format_t sample_format; + + /// DOCME unsigned int rate; // sample rate of audio + + /// DOCME unsigned int real_rate; // actual sample rate played back + + /// DOCME unsigned int period_len; // length of period in microseconds + + /// DOCME unsigned int buflen; // length of buffer in microseconds + + /// DOCME snd_pcm_uframes_t period; // size of period in frames + + /// DOCME snd_pcm_uframes_t bufsize; // size of buffer in frames void SetUpHardware(); @@ -98,18 +138,35 @@ public: void SetEndPosition(int64_t pos); void SetCurrentPosition(int64_t pos); + + /// @brief DOCME + /// @param vol + /// @return + /// void SetVolume(double vol) { volume = vol; } + + /// @brief DOCME + /// @return + /// double GetVolume() { return volume; } }; -/////////// -// Factory + +/// DOCME +/// @class AlsaPlayerFactory +/// @brief DOCME +/// +/// DOCME class AlsaPlayerFactory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new AlsaPlayer(); } }; #endif + diff --git a/aegisub/src/audio_player_dsound.cpp b/aegisub/src/audio_player_dsound.cpp index 164c74ad1..f38547ba0 100644 --- a/aegisub/src/audio_player_dsound.cpp +++ b/aegisub/src/audio_player_dsound.cpp @@ -48,8 +48,9 @@ #include "audio_player_dsound.h" -/////////////// -// Constructor + +/// @brief Constructor +/// DirectSoundPlayer::DirectSoundPlayer() { playing = false; volume = 1.0f; @@ -64,15 +65,17 @@ DirectSoundPlayer::DirectSoundPlayer() { } -////////////// -// Destructor + +/// @brief Destructor +/// DirectSoundPlayer::~DirectSoundPlayer() { CloseStream(); } -/////////////// -// Open stream + +/// @brief Open stream +/// void DirectSoundPlayer::OpenStream() { // Get provider AudioProvider *provider = GetProvider(); @@ -123,8 +126,9 @@ void DirectSoundPlayer::OpenStream() { } -//////////////// -// Close stream + +/// @brief Close stream +/// void DirectSoundPlayer::CloseStream() { // Stop it Stop(); @@ -143,8 +147,11 @@ void DirectSoundPlayer::CloseStream() { } -/////////////// -// Fill buffer + +/// @brief Fill buffer +/// @param fill +/// @return +/// bool DirectSoundPlayer::FillBuffer(bool fill) { if (playPos >= endPos) return false; @@ -231,8 +238,11 @@ RetryLock: } -//////// -// Play + +/// @brief Play +/// @param start +/// @param count +/// void DirectSoundPlayer::Play(int64_t start,int64_t count) { // Make sure that it's stopped Stop(); @@ -272,8 +282,10 @@ void DirectSoundPlayer::Play(int64_t start,int64_t count) { } -//////// -// Stop + +/// @brief Stop +/// @param timerToo +/// void DirectSoundPlayer::Stop(bool timerToo) { // Stop the thread if (thread) { @@ -302,23 +314,29 @@ void DirectSoundPlayer::Stop(bool timerToo) { } -/////////// -// Set end + +/// @brief Set end +/// @param pos +/// void DirectSoundPlayer::SetEndPosition(int64_t pos) { if (playing) endPos = pos; } -//////////////////////// -// Set current position + +/// @brief Set current position +/// @param pos +/// void DirectSoundPlayer::SetCurrentPosition(int64_t pos) { startPos = playPos = pos; startTime = GetTickCount(); } -//////////////////////// -// Get current position + +/// @brief Get current position +/// @return +/// int64_t DirectSoundPlayer::GetCurrentPosition() { // Check if buffer is loaded if (!buffer || !playing) return 0; @@ -331,23 +349,28 @@ int64_t DirectSoundPlayer::GetCurrentPosition() { } -////////////////////// -// Thread constructor + +/// @brief Thread constructor +/// @param par +/// DirectSoundPlayerThread::DirectSoundPlayerThread(DirectSoundPlayer *par) : wxThread(wxTHREAD_JOINABLE) { parent = par; stopnotify = CreateEvent(NULL, true, false, NULL); } -///////////////////// -// Thread destructor + +/// @brief Thread destructor +/// DirectSoundPlayerThread::~DirectSoundPlayerThread() { CloseHandle(stopnotify); } -////////////////////// -// Thread entry point + +/// @brief Thread entry point +/// @return +/// wxThread::ExitCode DirectSoundPlayerThread::Entry() { CoInitialize(0); @@ -396,8 +419,9 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() { } -//////////////////////// -// Stop playback thread + +/// @brief Stop playback thread +/// void DirectSoundPlayerThread::Stop() { // Increase the stopnotify by one, causing a wait for it to succeed SetEvent(stopnotify); @@ -405,3 +429,4 @@ void DirectSoundPlayerThread::Stop() { #endif // WITH_DIRECTSOUND + diff --git a/aegisub/src/audio_player_dsound.h b/aegisub/src/audio_player_dsound.h index e1bc9cea7..72084abda 100644 --- a/aegisub/src/audio_player_dsound.h +++ b/aegisub/src/audio_player_dsound.h @@ -54,11 +54,19 @@ class DirectSoundPlayer; -////////// -// Thread + +/// DOCME +/// @class DirectSoundPlayerThread +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayerThread : public wxThread { private: + + /// DOCME DirectSoundPlayer *parent; + + /// DOCME HANDLE stopnotify; public: @@ -85,27 +93,53 @@ All but GetPosition() set appropriate fields and then raise the parameters chang */ -//////////////////// -// Portaudio player + +/// DOCME +/// @class DirectSoundPlayer +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayer : public AudioPlayer { friend class DirectSoundPlayerThread; private: + + /// DOCME volatile bool playing; + + /// DOCME float volume; + + /// DOCME int offset; + + /// DOCME DWORD bufSize; + + /// DOCME volatile int64_t playPos; + + /// DOCME int64_t startPos; + + /// DOCME volatile int64_t endPos; + + /// DOCME DWORD startTime; + + /// DOCME IDirectSound8 *directSound; + + /// DOCME IDirectSoundBuffer8 *buffer; bool FillBuffer(bool fill); + + /// DOCME DirectSoundPlayerThread *thread; public: @@ -117,27 +151,56 @@ public: void Play(int64_t start,int64_t count); void Stop(bool timerToo=true); + + /// @brief DOCME + /// @return + /// bool IsPlaying() { return playing; } + + /// @brief DOCME + /// @return + /// int64_t GetStartPosition() { return startPos; } + + /// @brief DOCME + /// @return + /// int64_t GetEndPosition() { return endPos; } int64_t GetCurrentPosition(); void SetEndPosition(int64_t pos); void SetCurrentPosition(int64_t pos); + + /// @brief DOCME + /// @param vol + /// @return + /// void SetVolume(double vol) { volume = vol; } + + /// @brief DOCME + /// @return + /// double GetVolume() { return volume; } //wxMutex *GetMutex() { return &DSMutex; } }; -/////////// -// Factory + +/// DOCME +/// @class DirectSoundPlayerFactory +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayerFactory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new DirectSoundPlayer(); } }; #endif + diff --git a/aegisub/src/audio_player_dsound2.cpp b/aegisub/src/audio_player_dsound2.cpp index b5b876556..8d81ffe3d 100644 --- a/aegisub/src/audio_player_dsound2.cpp +++ b/aegisub/src/audio_player_dsound2.cpp @@ -53,19 +53,32 @@ #include "audio_player_dsound2.h" + +/// DOCME struct COMInitialization { + + /// DOCME bool inited; + + /// @brief DOCME + /// COMInitialization() { inited = false; } + + /// @brief DOCME + /// ~COMInitialization() { if (inited) CoUninitialize(); } + + /// @brief DOCME + /// void Init() { if (!inited) @@ -79,24 +92,42 @@ struct COMInitialization { template + +/// DOCME struct COMObjectRetainer { + + /// DOCME T *obj; + + /// @brief DOCME + /// COMObjectRetainer() { obj = 0; } + + /// @brief DOCME + /// @param _obj + /// COMObjectRetainer(T *_obj) { obj = _obj; } + + /// @brief DOCME + /// ~COMObjectRetainer() { if (obj) obj->Release(); } + + /// @brief DOCME + /// @return + /// T * operator -> () { return obj; @@ -104,6 +135,12 @@ struct COMObjectRetainer { }; + +/// DOCME +/// @class DirectSoundPlayer2Thread +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayer2Thread { static unsigned int __stdcall ThreadProc(void *parameter); void Run(); @@ -112,32 +149,66 @@ class DirectSoundPlayer2Thread { void CheckError(); + + /// DOCME HANDLE thread_handle; // Used to signal state-changes to thread HANDLE + + /// DOCME event_start_playback, + + /// DOCME event_stop_playback, + + /// DOCME event_update_end_time, + + /// DOCME event_set_volume, + + /// DOCME event_kill_self; // Thread communicating back HANDLE + + /// DOCME thread_running, + + /// DOCME is_playing, + + /// DOCME error_happened; + + /// DOCME wxChar *error_message; + + /// DOCME double volume; + + /// DOCME int64_t start_frame; + + /// DOCME int64_t end_frame; + + /// DOCME int wanted_latency; + + /// DOCME int buffer_length; + + /// DOCME DWORD last_playback_restart; + + /// DOCME AudioProvider *provider; public: @@ -158,6 +229,11 @@ public: }; + +/// @brief DOCME +/// @param parameter +/// @return +/// unsigned int __stdcall DirectSoundPlayer2Thread::ThreadProc(void *parameter) { static_cast(parameter)->Run(); @@ -165,8 +241,14 @@ unsigned int __stdcall DirectSoundPlayer2Thread::ThreadProc(void *parameter) } + +/// @brief DOCME +/// @return +/// void DirectSoundPlayer2Thread::Run() { + +/// DOCME #define REPORT_ERROR(msg) { error_message = _T("DirectSoundPlayer2Thread: ") _T(msg); SetEvent(error_happened); return; } COMInitialization COM_library; @@ -433,10 +515,22 @@ void DirectSoundPlayer2Thread::Run() } } + +/// DOCME #undef REPORT_ERROR } + +/// @brief DOCME +/// @param buf1 +/// @param buf1sz +/// @param buf2 +/// @param buf2sz +/// @param input_frame +/// @param bfr +/// @return +/// DWORD DirectSoundPlayer2Thread::FillAndUnlockBuffers(void *buf1, DWORD buf1sz, void *buf2, DWORD buf2sz, int64_t &input_frame, IDirectSoundBuffer8 *bfr) { // Assume buffers have been locked and are ready to be filled @@ -496,6 +590,10 @@ DWORD DirectSoundPlayer2Thread::FillAndUnlockBuffers(void *buf1, DWORD buf1sz, v } + +/// @brief DOCME +/// @return +/// void DirectSoundPlayer2Thread::CheckError() { try @@ -525,6 +623,12 @@ void DirectSoundPlayer2Thread::CheckError() } + +/// @brief DOCME +/// @param provider +/// @param _WantedLatency +/// @param _BufferLength +/// DirectSoundPlayer2Thread::DirectSoundPlayer2Thread(AudioProvider *provider, int _WantedLatency, int _BufferLength) { event_start_playback = CreateEvent(0, FALSE, FALSE, 0); @@ -558,6 +662,9 @@ DirectSoundPlayer2Thread::DirectSoundPlayer2Thread(AudioProvider *provider, int } + +/// @brief DOCME +/// DirectSoundPlayer2Thread::~DirectSoundPlayer2Thread() { SetEvent(event_kill_self); @@ -565,6 +672,11 @@ DirectSoundPlayer2Thread::~DirectSoundPlayer2Thread() } + +/// @brief DOCME +/// @param start +/// @param count +/// void DirectSoundPlayer2Thread::Play(int64_t start, int64_t count) { CheckError(); @@ -577,6 +689,9 @@ void DirectSoundPlayer2Thread::Play(int64_t start, int64_t count) } + +/// @brief DOCME +/// void DirectSoundPlayer2Thread::Stop() { CheckError(); @@ -585,6 +700,10 @@ void DirectSoundPlayer2Thread::Stop() } + +/// @brief DOCME +/// @param new_end_frame +/// void DirectSoundPlayer2Thread::SetEndFrame(int64_t new_end_frame) { CheckError(); @@ -594,6 +713,10 @@ void DirectSoundPlayer2Thread::SetEndFrame(int64_t new_end_frame) } + +/// @brief DOCME +/// @param new_volume +/// void DirectSoundPlayer2Thread::SetVolume(double new_volume) { CheckError(); @@ -603,6 +726,10 @@ void DirectSoundPlayer2Thread::SetVolume(double new_volume) } + +/// @brief DOCME +/// @return +/// bool DirectSoundPlayer2Thread::IsPlaying() { CheckError(); @@ -625,6 +752,10 @@ bool DirectSoundPlayer2Thread::IsPlaying() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2Thread::GetStartFrame() { CheckError(); @@ -633,6 +764,10 @@ int64_t DirectSoundPlayer2Thread::GetStartFrame() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2Thread::GetCurrentFrame() { CheckError(); @@ -645,6 +780,10 @@ int64_t DirectSoundPlayer2Thread::GetCurrentFrame() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2Thread::GetEndFrame() { CheckError(); @@ -653,6 +792,10 @@ int64_t DirectSoundPlayer2Thread::GetEndFrame() } + +/// @brief DOCME +/// @return +/// double DirectSoundPlayer2Thread::GetVolume() { CheckError(); @@ -661,6 +804,10 @@ double DirectSoundPlayer2Thread::GetVolume() } + +/// @brief DOCME +/// @return +/// bool DirectSoundPlayer2Thread::IsDead() { switch (WaitForSingleObject(thread_running, 0)) @@ -676,6 +823,9 @@ bool DirectSoundPlayer2Thread::IsDead() + +/// @brief DOCME +/// DirectSoundPlayer2::DirectSoundPlayer2() { thread = 0; @@ -692,12 +842,19 @@ DirectSoundPlayer2::DirectSoundPlayer2() } + +/// @brief DOCME +/// DirectSoundPlayer2::~DirectSoundPlayer2() { CloseStream(); } + +/// @brief DOCME +/// @return +/// bool DirectSoundPlayer2::IsThreadAlive() { if (!thread) return false; @@ -713,6 +870,10 @@ bool DirectSoundPlayer2::IsThreadAlive() } + +/// @brief DOCME +/// @return +/// void DirectSoundPlayer2::OpenStream() { if (IsThreadAlive()) return; @@ -729,6 +890,10 @@ void DirectSoundPlayer2::OpenStream() } + +/// @brief DOCME +/// @return +/// void DirectSoundPlayer2::CloseStream() { if (!IsThreadAlive()) return; @@ -745,6 +910,10 @@ void DirectSoundPlayer2::CloseStream() } + +/// @brief DOCME +/// @param provider +/// void DirectSoundPlayer2::SetProvider(AudioProvider *provider) { try @@ -764,6 +933,11 @@ void DirectSoundPlayer2::SetProvider(AudioProvider *provider) } + +/// @brief DOCME +/// @param start +/// @param count +/// void DirectSoundPlayer2::Play(int64_t start,int64_t count) { try @@ -780,6 +954,10 @@ void DirectSoundPlayer2::Play(int64_t start,int64_t count) } + +/// @brief DOCME +/// @param timerToo +/// void DirectSoundPlayer2::Stop(bool timerToo) { try @@ -797,6 +975,10 @@ void DirectSoundPlayer2::Stop(bool timerToo) } + +/// @brief DOCME +/// @return +/// bool DirectSoundPlayer2::IsPlaying() { try @@ -812,6 +994,10 @@ bool DirectSoundPlayer2::IsPlaying() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2::GetStartPosition() { try @@ -827,6 +1013,10 @@ int64_t DirectSoundPlayer2::GetStartPosition() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2::GetEndPosition() { try @@ -842,6 +1032,10 @@ int64_t DirectSoundPlayer2::GetEndPosition() } + +/// @brief DOCME +/// @return +/// int64_t DirectSoundPlayer2::GetCurrentPosition() { try @@ -857,6 +1051,10 @@ int64_t DirectSoundPlayer2::GetCurrentPosition() } + +/// @brief DOCME +/// @param pos +/// void DirectSoundPlayer2::SetEndPosition(int64_t pos) { try @@ -870,6 +1068,10 @@ void DirectSoundPlayer2::SetEndPosition(int64_t pos) } + +/// @brief DOCME +/// @param pos +/// void DirectSoundPlayer2::SetCurrentPosition(int64_t pos) { try @@ -883,6 +1085,10 @@ void DirectSoundPlayer2::SetCurrentPosition(int64_t pos) } + +/// @brief DOCME +/// @param vol +/// void DirectSoundPlayer2::SetVolume(double vol) { try @@ -896,6 +1102,9 @@ void DirectSoundPlayer2::SetVolume(double vol) } + +/// @brief DOCME +/// double DirectSoundPlayer2::GetVolume() { try @@ -913,3 +1122,4 @@ double DirectSoundPlayer2::GetVolume() #endif // WITH_DIRECTSOUND + diff --git a/aegisub/src/audio_player_dsound2.h b/aegisub/src/audio_player_dsound2.h index 668743b28..d8185d272 100644 --- a/aegisub/src/audio_player_dsound2.h +++ b/aegisub/src/audio_player_dsound2.h @@ -43,11 +43,23 @@ class DirectSoundPlayer2Thread; + +/// DOCME +/// @class DirectSoundPlayer2 +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayer2 : public AudioPlayer { + + /// DOCME DirectSoundPlayer2Thread *thread; protected: + + /// DOCME int WantedLatency; + + /// DOCME int BufferLength; bool IsThreadAlive(); @@ -76,10 +88,20 @@ public: }; + +/// DOCME +/// @class DirectSoundPlayer2Factory +/// @brief DOCME +/// +/// DOCME class DirectSoundPlayer2Factory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new DirectSoundPlayer2(); } }; #endif + diff --git a/aegisub/src/audio_player_manager.h b/aegisub/src/audio_player_manager.h index 6a651324b..304bb0ea7 100644 --- a/aegisub/src/audio_player_manager.h +++ b/aegisub/src/audio_player_manager.h @@ -54,8 +54,12 @@ class AudioProvider; -/////////////////// -// Factory Manager + +/// DOCME +/// @class AudioPlayerFactoryManager +/// @brief DOCME +/// +/// DOCME class AudioPlayerFactoryManager : public FactoryManager { public: static AudioPlayer *GetAudioPlayer(); @@ -71,3 +75,4 @@ DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1) + diff --git a/aegisub/src/audio_player_openal.cpp b/aegisub/src/audio_player_openal.cpp index 624efd931..fac7ec432 100644 --- a/aegisub/src/audio_player_openal.cpp +++ b/aegisub/src/audio_player_openal.cpp @@ -69,8 +69,9 @@ #endif -/////////////// -// Constructor + +/// @brief Constructor +/// OpenALPlayer::OpenALPlayer() { volume = 1.0f; @@ -81,16 +82,18 @@ OpenALPlayer::OpenALPlayer() } -////////////// -// Destructor + +/// @brief Destructor +/// OpenALPlayer::~OpenALPlayer() { CloseStream(); } -/////////////// -// Open stream + +/// @brief Open stream +/// void OpenALPlayer::OpenStream() { CloseStream(); @@ -145,8 +148,10 @@ void OpenALPlayer::OpenStream() } -//////////////// -// Close stream + +/// @brief Close stream +/// @return +/// void OpenALPlayer::CloseStream() { if (!open) return; @@ -163,8 +168,11 @@ void OpenALPlayer::CloseStream() } -//////// -// Play + +/// @brief Play +/// @param start +/// @param count +/// void OpenALPlayer::Play(int64_t start,int64_t count) { if (playing) { @@ -197,8 +205,11 @@ void OpenALPlayer::Play(int64_t start,int64_t count) } -//////// -// Stop + +/// @brief Stop +/// @param timerToo +/// @return +/// void OpenALPlayer::Stop(bool timerToo) { if (!open) return; @@ -221,6 +232,10 @@ void OpenALPlayer::Stop(bool timerToo) } + +/// @brief DOCME +/// @param count +/// void OpenALPlayer::FillBuffers(ALsizei count) { wxLogDebug(_T("FillBuffers: count=%d, buffers_free=%d"), count, buffers_free); @@ -259,6 +274,9 @@ void OpenALPlayer::FillBuffers(ALsizei count) } + +/// @brief DOCME +/// void OpenALPlayer::Notify() { ALsizei newplayed; @@ -295,42 +313,59 @@ void OpenALPlayer::Notify() } + +/// @brief DOCME +/// @return +/// bool OpenALPlayer::IsPlaying() { return playing; } -/////////// -// Set end + +/// @brief Set end +/// @param pos +/// void OpenALPlayer::SetEndPosition(int64_t pos) { end_frame = pos; } -//////////////////////// -// Set current position + +/// @brief Set current position +/// @param pos +/// void OpenALPlayer::SetCurrentPosition(int64_t pos) { cur_frame = pos; } + +/// @brief DOCME +/// @return +/// int64_t OpenALPlayer::GetStartPosition() { return start_frame; } + +/// @brief DOCME +/// @return +/// int64_t OpenALPlayer::GetEndPosition() { return end_frame; } -//////////////////////// -// Get current position + +/// @brief Get current position +/// int64_t OpenALPlayer::GetCurrentPosition() { // FIXME: this should be based on not duration played but actual sample being heard @@ -343,3 +378,4 @@ int64_t OpenALPlayer::GetCurrentPosition() #endif // WITH_OPENAL + diff --git a/aegisub/src/audio_player_openal.h b/aegisub/src/audio_player_openal.h index 6e52a3cf4..c7284cf61 100644 --- a/aegisub/src/audio_player_openal.h +++ b/aegisub/src/audio_player_openal.h @@ -61,33 +61,77 @@ #endif -///////////////// -// OpenAL player + +/// DOCME +/// @class OpenALPlayer +/// @brief DOCME +/// +/// DOCME class OpenALPlayer : public AudioPlayer, wxTimer { private: + + /// DOCME bool open; + + /// DOCME volatile bool playing; + + /// DOCME volatile float volume; + + /// DOCME static const ALsizei num_buffers = 8; + + /// DOCME ALsizei buffer_length; + + /// DOCME ALsizei samplerate; + + /// DOCME volatile unsigned long start_frame; // first frame of playback + + /// DOCME volatile unsigned long cur_frame; // last written frame + 1 + + /// DOCME volatile unsigned long end_frame; // last frame to play + + /// DOCME unsigned long bpf; // bytes per frame + + /// DOCME AudioProvider *provider; + + /// DOCME ALCdevice *device; // device handle + + /// DOCME ALCcontext *context; // sound context + + /// DOCME ALuint buffers[num_buffers]; // sound buffers + + /// DOCME ALuint source; // playback source + + /// DOCME ALsizei buf_first_free; // index into buffers, first free (unqueued) buffer + + /// DOCME ALsizei buf_first_queued; // index into buffers, first queued (non-free) buffer + + /// DOCME ALsizei buffers_free; // number of free buffers + + /// DOCME ALsizei buffers_played; + + /// DOCME wxStopWatch playback_segment_timer; void FillBuffers(ALsizei count); @@ -112,18 +156,35 @@ public: void SetEndPosition(int64_t pos); void SetCurrentPosition(int64_t pos); + + /// @brief DOCME + /// @param vol + /// @return + /// void SetVolume(double vol) { volume = vol; } + + /// @brief DOCME + /// @return + /// double GetVolume() { return volume; } }; -/////////// -// Factory + +/// DOCME +/// @class OpenALPlayerFactory +/// @brief DOCME +/// +/// DOCME class OpenALPlayerFactory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new OpenALPlayer(); } }; #endif + diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index 9a7214db6..bd146e93f 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -51,13 +51,14 @@ // Uncomment to enable debug features. //#define PORTAUDIO_DEBUG -///////////////////// -// Reference counter + +/// DOCME int PortAudioPlayer::pa_refcount = 0; -/////////////// -// Constructor + +/// @brief Constructor +/// PortAudioPlayer::PortAudioPlayer() { // Initialize portaudio if (!pa_refcount) { @@ -80,16 +81,18 @@ PortAudioPlayer::PortAudioPlayer() { } -////////////// -// Destructor + +/// @brief Destructor +/// PortAudioPlayer::~PortAudioPlayer() { // Deinit portaudio if (!--pa_refcount) Pa_Terminate(); } -/////////////// -// Open stream + +/// @brief Open stream +/// void PortAudioPlayer::OpenStream() { // Open stream PaStreamParameters pa_output_p; @@ -127,8 +130,9 @@ void PortAudioPlayer::OpenStream() { } -/////////////// -// Close stream + +/// @brief Close stream +/// void PortAudioPlayer::CloseStream() { try { Stop(false); @@ -136,7 +140,10 @@ void PortAudioPlayer::CloseStream() { } catch (...) {} } -// Called when the callback has finished. + +/// @brief Called when the callback has finished. +/// @param userData +/// void PortAudioPlayer::paStreamFinishedCallback(void *userData) { PortAudioPlayer *player = (PortAudioPlayer *) userData; @@ -150,8 +157,12 @@ void PortAudioPlayer::paStreamFinishedCallback(void *userData) { } -//////// -// Play + +/// @brief Play +/// @param start +/// @param count +/// @return +/// void PortAudioPlayer::Play(int64_t start,int64_t count) { PaError err; @@ -187,8 +198,10 @@ void PortAudioPlayer::Play(int64_t start,int64_t count) { } -//////// -// Stop + +/// @brief Stop +/// @param timerToo +/// void PortAudioPlayer::Stop(bool timerToo) { //wxMutexLocker locker(PAMutex); //softStop = false; @@ -204,8 +217,16 @@ void PortAudioPlayer::Stop(bool timerToo) { } -////////////////////// -/// PortAudio callback + +/// @brief PortAudio callback +/// @param inputBuffer +/// @param outputBuffer +/// @param framesPerBuffer +/// @param timeInfo +/// @param statusFlags +/// @param userData +/// @return +/// int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData) { // Get provider @@ -238,8 +259,10 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer, uns } -//////////////////////// -/// Get current stream position. + +/// @brief Get current stream position. +/// @return +/// int64_t PortAudioPlayer::GetCurrentPosition() { @@ -261,9 +284,10 @@ int64_t PortAudioPlayer::GetCurrentPosition() } -/////////////// -/// Return a list of available output devices. -/// @param Setting from config file. + +/// @brief @param Setting from config file. Return a list of available output devices. +/// @param favorite +/// wxArrayString PortAudioPlayer::GetOutputDevices(wxString favorite) { wxArrayString list; int devices = Pa_GetDeviceCount(); @@ -284,3 +308,4 @@ wxArrayString PortAudioPlayer::GetOutputDevices(wxString favorite) { #endif // WITH_PORTAUDIO + diff --git a/aegisub/src/audio_player_portaudio.h b/aegisub/src/audio_player_portaudio.h index 5a3174166..dd817a91b 100644 --- a/aegisub/src/audio_player_portaudio.h +++ b/aegisub/src/audio_player_portaudio.h @@ -49,21 +49,44 @@ extern "C" { -//////////////////// -// Portaudio player + +/// DOCME +/// @class PortAudioPlayer +/// @brief DOCME +/// +/// DOCME class PortAudioPlayer : public AudioPlayer { private: + + /// DOCME static int pa_refcount; + + /// DOCME wxMutex PAMutex; + + /// DOCME volatile bool stopping; - //bool softStop; + + /// DOCME bool playing; + + /// DOCME float volume; + + /// DOCME volatile int64_t playPos; + + /// DOCME volatile int64_t startPos; + + /// DOCME volatile int64_t endPos; + + /// DOCME void *stream; + + /// DOCME PaTime paStart; static int paCallback( @@ -87,28 +110,69 @@ public: void Play(int64_t start,int64_t count); void Stop(bool timerToo=true); + + /// @brief DOCME + /// @return + /// bool IsPlaying() { return playing; } + + /// @brief DOCME + /// @return + /// int64_t GetStartPosition() { return startPos; } + + /// @brief DOCME + /// @return + /// int64_t GetEndPosition() { return endPos; } int64_t GetCurrentPosition(); + + /// @brief DOCME + /// @param pos + /// void SetEndPosition(int64_t pos) { endPos = pos; } + + /// @brief DOCME + /// @param pos + /// void SetCurrentPosition(int64_t pos) { playPos = pos; } + + /// @brief DOCME + /// @param vol + /// @return + /// void SetVolume(double vol) { volume = vol; } + + /// @brief DOCME + /// @return + /// double GetVolume() { return volume; } wxArrayString GetOutputDevices(wxString favorite); + + /// @brief DOCME + /// @return + /// wxMutex *GetMutex() { return &PAMutex; } }; -/////////// -// Factory + +/// DOCME +/// @class PortAudioPlayerFactory +/// @brief DOCME +/// +/// DOCME class PortAudioPlayerFactory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new PortAudioPlayer(); } }; #endif //ifdef WITH_PORTAUDIO + diff --git a/aegisub/src/audio_player_pulse.cpp b/aegisub/src/audio_player_pulse.cpp index 30b7e68cf..c76f32893 100644 --- a/aegisub/src/audio_player_pulse.cpp +++ b/aegisub/src/audio_player_pulse.cpp @@ -50,8 +50,9 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// PulseAudioPlayer::PulseAudioPlayer() : context_notify(0, 1) , context_success(0, 1) @@ -65,16 +66,18 @@ PulseAudioPlayer::PulseAudioPlayer() } -////////////// -// Destructor + +/// @brief Destructor +/// PulseAudioPlayer::~PulseAudioPlayer() { if (open) CloseStream(); } -/////////////// -// Open stream + +/// @brief Open stream +/// void PulseAudioPlayer::OpenStream() { //printf("Opening PulseAudio stream\n"); @@ -171,8 +174,10 @@ void PulseAudioPlayer::OpenStream() } -//////////////// -// Close stream + +/// @brief Close stream +/// @return +/// void PulseAudioPlayer::CloseStream() { if (!open) return; @@ -193,8 +198,11 @@ void PulseAudioPlayer::CloseStream() } -//////// -// Play + +/// @brief Play +/// @param start +/// @param count +/// void PulseAudioPlayer::Play(int64_t start,int64_t count) { //printf("Starting PulseAudio playback\n"); @@ -247,8 +255,11 @@ void PulseAudioPlayer::Play(int64_t start,int64_t count) } -//////// -// Stop + +/// @brief Stop +/// @param timerToo +/// @return +/// void PulseAudioPlayer::Stop(bool timerToo) { if (!is_playing) return; @@ -281,42 +292,60 @@ void PulseAudioPlayer::Stop(bool timerToo) } + +/// @brief DOCME +/// @return +/// bool PulseAudioPlayer::IsPlaying() { return is_playing; } -/////////// -// Set end + +/// @brief Set end +/// @param pos +/// void PulseAudioPlayer::SetEndPosition(int64_t pos) { end_frame = pos; } -//////////////////////// -// Set current position + +/// @brief Set current position +/// @param pos +/// void PulseAudioPlayer::SetCurrentPosition(int64_t pos) { cur_frame = pos; } + +/// @brief DOCME +/// @return +/// int64_t PulseAudioPlayer::GetStartPosition() { return start_frame; } + +/// @brief DOCME +/// @return +/// int64_t PulseAudioPlayer::GetEndPosition() { return end_frame; } -//////////////////////// -// Get current position + +/// @brief Get current position +/// @return +/// int64_t PulseAudioPlayer::GetCurrentPosition() { if (!is_playing) return 0; @@ -333,7 +362,12 @@ int64_t PulseAudioPlayer::GetCurrentPosition() } -// Called by PA to notify about contetxt operation completion + +/// @brief Called by PA to notify about contetxt operation completion +/// @param c +/// @param success +/// @param thread +/// void PulseAudioPlayer::pa_context_success(pa_context *c, int success, PulseAudioPlayer *thread) { thread->context_success_val = success; @@ -341,7 +375,11 @@ void PulseAudioPlayer::pa_context_success(pa_context *c, int success, PulseAudio } -// Called by PA to notify about other context-related stuff + +/// @brief Called by PA to notify about other context-related stuff +/// @param c +/// @param thread +/// void PulseAudioPlayer::pa_context_notify(pa_context *c, PulseAudioPlayer *thread) { thread->cstate = pa_context_get_state(thread->context); @@ -349,7 +387,12 @@ void PulseAudioPlayer::pa_context_notify(pa_context *c, PulseAudioPlayer *thread } -// Called by PA when an operation completes + +/// @brief Called by PA when an operation completes +/// @param p +/// @param success +/// @param thread +/// void PulseAudioPlayer::pa_stream_success(pa_stream *p, int success, PulseAudioPlayer *thread) { thread->stream_success_val = success; @@ -357,7 +400,13 @@ void PulseAudioPlayer::pa_stream_success(pa_stream *p, int success, PulseAudioPl } -// Called by PA to request more data (and other things?) + +/// @brief Called by PA to request more data (and other things?) +/// @param p +/// @param length +/// @param thread +/// @return +/// void PulseAudioPlayer::pa_stream_write(pa_stream *p, size_t length, PulseAudioPlayer *thread) { if (!thread->is_playing) return; @@ -391,7 +440,11 @@ void PulseAudioPlayer::pa_stream_write(pa_stream *p, size_t length, PulseAudioPl } -// Called by PA to notify about other stuff + +/// @brief Called by PA to notify about other stuff +/// @param p +/// @param thread +/// void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread) { thread->sstate = pa_stream_get_state(thread->stream); @@ -401,3 +454,4 @@ void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread) #endif // WITH_PULSEAUDIO + diff --git a/aegisub/src/audio_player_pulse.h b/aegisub/src/audio_player_pulse.h index 9ecbc7c53..b51f4b5ca 100644 --- a/aegisub/src/audio_player_pulse.h +++ b/aegisub/src/audio_player_pulse.h @@ -55,35 +55,76 @@ class PulseAudioPlayer; -////////////////////// -// Pulse Audio player + +/// DOCME +/// @class PulseAudioPlayer +/// @brief DOCME +/// +/// DOCME class PulseAudioPlayer : public AudioPlayer { private: + + /// DOCME float volume; + + /// DOCME bool open; + + /// DOCME bool is_playing; - // Audio data info + + /// DOCME volatile unsigned long start_frame; + + /// DOCME volatile unsigned long cur_frame; + + /// DOCME volatile unsigned long end_frame; + + /// DOCME unsigned long bpf; // bytes per frame - // Used for synchronising with async events + + /// DOCME wxSemaphore context_notify; + + /// DOCME wxSemaphore context_success; + + /// DOCME volatile int context_success_val; + + /// DOCME wxSemaphore stream_notify; + + /// DOCME wxSemaphore stream_success; + + /// DOCME volatile int stream_success_val; - // PulseAudio data + + /// DOCME pa_threaded_mainloop *mainloop; // pulseaudio mainloop handle + + /// DOCME pa_context *context; // connection context + + /// DOCME volatile pa_context_state_t cstate; + + /// DOCME pa_stream *stream; + + /// DOCME volatile pa_stream_state_t sstate; + + /// DOCME volatile pa_usec_t play_start_time; // timestamp when playback was started + + /// DOCME int paerror; // Called by PA to notify about contetxt operation completion @@ -114,18 +155,35 @@ public: void SetEndPosition(int64_t pos); void SetCurrentPosition(int64_t pos); + + /// @brief DOCME + /// @param vol + /// @return + /// void SetVolume(double vol) { volume = vol; } + + /// @brief DOCME + /// @return + /// double GetVolume() { return volume; } }; -/////////// -// Factory + +/// DOCME +/// @class PulseAudioPlayerFactory +/// @brief DOCME +/// +/// DOCME class PulseAudioPlayerFactory : public AudioPlayerFactory { public: + + /// @brief DOCME + /// AudioPlayer *CreatePlayer() { return new PulseAudioPlayer(); } }; #endif + diff --git a/aegisub/src/audio_provider.cpp b/aegisub/src/audio_provider.cpp index ea687948a..05833571d 100644 --- a/aegisub/src/audio_provider.cpp +++ b/aegisub/src/audio_provider.cpp @@ -58,58 +58,78 @@ #include "audio_display.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AudioProvider::AudioProvider() { raw = NULL; } -////////////// -// Destructor + +/// @brief Destructor +/// AudioProvider::~AudioProvider() { // Clear buffers delete[] raw; } -////////////////////////// -// Get number of channels + +/// @brief Get number of channels +/// @return +/// int AudioProvider::GetChannels() { return channels; } -////////////////////////// -// Get number of samples + +/// @brief Get number of samples +/// @return +/// int64_t AudioProvider::GetNumSamples() { return num_samples; } -/////////////////// -// Get sample rate + +/// @brief Get sample rate +/// @return +/// int AudioProvider::GetSampleRate() { return sample_rate; } -//////////////////////// -// Get bytes per sample + +/// @brief Get bytes per sample +/// @return +/// int AudioProvider::GetBytesPerSample() { return bytes_per_sample; } -//////////////// -// Get filename + +/// @brief Get filename +/// @return +/// wxString AudioProvider::GetFilename() { return filename; } -//////////////// -// Get waveform + +/// @brief Get waveform +/// @param min +/// @param peak +/// @param start +/// @param w +/// @param h +/// @param samples +/// @param scale +/// void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale) { // Setup int channels = GetChannels(); @@ -173,8 +193,14 @@ void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int } -///////////////////////// -// Get audio with volume + +/// @brief Get audio with volume +/// @param buf +/// @param start +/// @param count +/// @param volume +/// @return +/// void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) { try { GetAudio(buf,start,count); @@ -204,8 +230,12 @@ void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, } -//////////////// -// Get provider + +/// @brief Get provider +/// @param filename +/// @param cache +/// @return +/// AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename, int cache) { // Prepare provider AudioProvider *provider = NULL; @@ -274,8 +304,9 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename, } -/////////////////////////// -// Register all providers + +/// @brief Register all providers +/// void AudioProviderFactoryManager::RegisterProviders() { #ifdef WITH_AVISYNTH RegisterFactory(new AvisynthAudioProviderFactory(),_T("Avisynth")); @@ -289,14 +320,16 @@ void AudioProviderFactoryManager::RegisterProviders() { } -/////////////////////// -// Clear all providers + +/// @brief Clear all providers +/// void AudioProviderFactoryManager::ClearProviders() { ClearFactories(); } -////////// -// Static + +/// DOCME template std::map* FactoryManager::factories=NULL; + diff --git a/aegisub/src/audio_provider_avs.cpp b/aegisub/src/audio_provider_avs.cpp index f3fdc273a..6df5c8056 100644 --- a/aegisub/src/audio_provider_avs.cpp +++ b/aegisub/src/audio_provider_avs.cpp @@ -51,8 +51,10 @@ #include "charset_conv.h" -////////////// -// Constructor + +/// @brief Constructor +/// @param _filename +/// AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) { filename = _filename; @@ -66,23 +68,26 @@ AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) { } -////////////// -// Destructor + +/// @brief Destructor +/// AvisynthAudioProvider::~AvisynthAudioProvider() { Unload(); } -//////////////// -// Unload audio + +/// @brief Unload audio +/// void AvisynthAudioProvider::Unload() { // Clean up avisynth clip = NULL; } -//////////////////////////// -// Load audio from avisynth + +/// @brief Load audio from avisynth +/// void AvisynthAudioProvider::OpenAVSAudio() { // Set variables AVSValue script; @@ -129,8 +134,10 @@ void AvisynthAudioProvider::OpenAVSAudio() { } -///////////////////////// -// Read from environment + +/// @brief Read from environment +/// @param _clip +/// void AvisynthAudioProvider::LoadFromClip(AVSValue _clip) { // Prepare avisynth AVSValue script; @@ -171,14 +178,20 @@ void AvisynthAudioProvider::LoadFromClip(AVSValue _clip) { } -//////////////// -// Get filename + +/// @brief Get filename +/// @return +/// wxString AvisynthAudioProvider::GetFilename() { return filename; } -///////////// -// Get audio + +/// @brief Get audio +/// @param buf +/// @param start +/// @param count +/// void AvisynthAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { // Requested beyond the length of audio if (start+count > num_samples) { @@ -208,3 +221,4 @@ void AvisynthAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { #endif + diff --git a/aegisub/src/audio_provider_avs.h b/aegisub/src/audio_provider_avs.h index 9d2aeb554..f056e95f5 100644 --- a/aegisub/src/audio_provider_avs.h +++ b/aegisub/src/audio_provider_avs.h @@ -44,11 +44,19 @@ #include "avisynth_wrap.h" -//////////////////////// -// Audio provider class + +/// DOCME +/// @class AvisynthAudioProvider +/// @brief DOCME +/// +/// DOCME class AvisynthAudioProvider : public AudioProvider, public AviSynthWrapper { private: + + /// DOCME wxString filename; + + /// DOCME PClip clip; void LoadFromClip(AVSValue clip); @@ -62,7 +70,10 @@ public: wxString GetFilename(); - // Only exists for x86 Windows, always delivers machine (little) endian + + /// @brief // Only exists for x86 Windows, always delivers machine (little) endian + /// @return + /// bool AreSamplesNativeEndian() { return true; } void GetAudio(void *buf, int64_t start, int64_t count); @@ -70,12 +81,21 @@ public: }; -/////////// -// Factory + +/// DOCME +/// @class AvisynthAudioProviderFactory +/// @brief DOCME +/// +/// DOCME class AvisynthAudioProviderFactory : public AudioProviderFactory { public: + + /// @brief DOCME + /// @param file + /// AudioProvider *CreateProvider(wxString file) { return new AvisynthAudioProvider(file); } }; #endif + diff --git a/aegisub/src/audio_provider_convert.cpp b/aegisub/src/audio_provider_convert.cpp index e525813e9..59a982006 100644 --- a/aegisub/src/audio_provider_convert.cpp +++ b/aegisub/src/audio_provider_convert.cpp @@ -44,8 +44,10 @@ #include "aegisub_endian.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param src +/// ConvertAudioProvider::ConvertAudioProvider(AudioProvider *src) { source = src; channels = source->GetChannels(); @@ -61,15 +63,20 @@ ConvertAudioProvider::ConvertAudioProvider(AudioProvider *src) { } -////////////// -// Destructor + +/// @brief Destructor +/// ConvertAudioProvider::~ConvertAudioProvider() { delete source; } -///////////////////// -// Convert to 16-bit + +/// @brief Convert to 16-bit +/// @param src +/// @param dst +/// @param count +/// void ConvertAudioProvider::Make16Bit(const char *src, short *dst, int64_t count) { for (int64_t i=0;i + +/// @brief DOCME +/// @param src +/// @param dst +/// @param count +/// @param converter +/// void ConvertAudioProvider::ChangeSampleRate(const short *src, short *dst, int64_t count, const SampleConverter &converter) { // Upsample by 2 if (sampleMult == 2) { @@ -122,23 +136,39 @@ void ConvertAudioProvider::ChangeSampleRate(const short *src, short *dst, int64_ } -// Do-nothing sample converter for ChangeSampleRate + +/// DOCME struct NullSampleConverter { + + /// @brief DOCME + /// @param val + /// @return + /// inline short operator()(const short val) const { return val; } }; -// Endian-swapping sample converter for ChangeSampleRate + +/// DOCME struct EndianSwapSampleConverter { + + /// @brief DOCME + /// @param val + /// @return + /// inline short operator()(const short val) const { return (short)Endian::Reverse((uint16_t)val); }; }; -///////////// -// Get audio + +/// @brief Get audio +/// @param destination +/// @param start +/// @param count +/// void ConvertAudioProvider::GetAudio(void *destination, int64_t start, int64_t count) { // Bits per sample int srcBps = source->GetBytesPerSample(); @@ -189,7 +219,10 @@ void ConvertAudioProvider::GetAudio(void *destination, int64_t start, int64_t co } } -// See if we need to downmix the number of channels + +/// @brief See if we need to downmix the number of channels +/// @param source_provider +/// AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider) { AudioProvider *provider = source_provider; @@ -212,3 +245,4 @@ AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider) { return provider; } + diff --git a/aegisub/src/audio_provider_convert.h b/aegisub/src/audio_provider_convert.h index 3fcc454a3..59b290c23 100644 --- a/aegisub/src/audio_provider_convert.h +++ b/aegisub/src/audio_provider_convert.h @@ -43,12 +43,20 @@ #include "include/aegisub/audio_provider.h" -//////////////////////// -// Audio provider class + +/// DOCME +/// @class ConvertAudioProvider +/// @brief DOCME +/// +/// DOCME class ConvertAudioProvider : public AudioProvider { private: + + /// DOCME int sampleMult; + + /// DOCME AudioProvider *source; void Make16Bit(const char *src, short *dst, int64_t count); template @@ -58,14 +66,20 @@ public: ConvertAudioProvider(AudioProvider *source); ~ConvertAudioProvider(); - // By its nature, the ConvertAudioProvider always delivers machine endian: - // That's one of the points of it! + + /// @brief // That's one of the points of it! // By its nature, the ConvertAudioProvider always delivers machine endian: + /// @return + /// bool AreSamplesNativeEndian() { return true; } void GetAudio(void *buf, int64_t start, int64_t count); + + /// @brief DOCME + /// wxString GetFilename() { return source->GetFilename(); } }; AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider); + diff --git a/aegisub/src/audio_provider_downmix.cpp b/aegisub/src/audio_provider_downmix.cpp index 6aafd7931..05d681a69 100644 --- a/aegisub/src/audio_provider_downmix.cpp +++ b/aegisub/src/audio_provider_downmix.cpp @@ -42,8 +42,10 @@ #include "audio_provider_downmix.h" -////////////////// -// Constructor + +/// @brief Constructor +/// @param source +/// DownmixingAudioProvider::DownmixingAudioProvider(AudioProvider *source) { filename = source->GetFilename(); channels = 1; // target @@ -61,14 +63,19 @@ DownmixingAudioProvider::DownmixingAudioProvider(AudioProvider *source) { throw _T("Downmixing Audio Provider: Source must have machine endian samples"); } -///////////////// -// Destructor + +/// @brief Destructor +/// DownmixingAudioProvider::~DownmixingAudioProvider() { delete provider; } -//////////////// -// Actual work happens here + +/// @brief Actual work happens here +/// @param buf +/// @param start +/// @param count +/// void DownmixingAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { if (count == 0) return; @@ -123,3 +130,4 @@ void DownmixingAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) delete[] tmp; } + diff --git a/aegisub/src/audio_provider_downmix.h b/aegisub/src/audio_provider_downmix.h index 14255d050..51a975179 100644 --- a/aegisub/src/audio_provider_downmix.h +++ b/aegisub/src/audio_provider_downmix.h @@ -36,16 +36,28 @@ #include "include/aegisub/audio_provider.h" + +/// DOCME +/// @class DownmixingAudioProvider +/// @brief DOCME +/// +/// DOCME class DownmixingAudioProvider : public AudioProvider { private: + + /// DOCME AudioProvider *provider; + + /// DOCME int src_channels; public: DownmixingAudioProvider(AudioProvider *source); ~DownmixingAudioProvider(); - // Downmixing requires samples to be native endian beforehand + + /// @brief // Downmixing requires samples to be native endian beforehand + /// bool AreSamplesNativeEndian() { return true; } void GetAudio(void *buf, int64_t start, int64_t count); @@ -53,3 +65,4 @@ public: }; + diff --git a/aegisub/src/audio_provider_dummy.cpp b/aegisub/src/audio_provider_dummy.cpp index ada04f8bb..1be56195a 100644 --- a/aegisub/src/audio_provider_dummy.cpp +++ b/aegisub/src/audio_provider_dummy.cpp @@ -43,8 +43,11 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param dur_ms +/// @param _noise +/// DummyAudioProvider::DummyAudioProvider(unsigned long dur_ms, bool _noise) { noise = _noise; channels = 1; @@ -54,14 +57,19 @@ DummyAudioProvider::DummyAudioProvider(unsigned long dur_ms, bool _noise) { } -////////////// -// Destructor + +/// @brief Destructor +/// DummyAudioProvider::~DummyAudioProvider() { } -///////////// -// Get audio + +/// @brief Get audio +/// @param buf +/// @param start +/// @param count +/// void DummyAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { short *workbuf = (short*)buf; @@ -75,3 +83,4 @@ void DummyAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { } } + diff --git a/aegisub/src/audio_provider_dummy.h b/aegisub/src/audio_provider_dummy.h index 51c24dee3..0bb6d40f3 100644 --- a/aegisub/src/audio_provider_dummy.h +++ b/aegisub/src/audio_provider_dummy.h @@ -43,18 +43,28 @@ #include "include/aegisub/audio_provider.h" -//////////////////////// -// Audio provider class + +/// DOCME +/// @class DummyAudioProvider +/// @brief DOCME +/// +/// DOCME class DummyAudioProvider : public AudioProvider { private: + + /// DOCME bool noise; public: DummyAudioProvider(unsigned long dur_ms, bool _noise); ~DummyAudioProvider(); + + /// @brief DOCME + /// bool AreSamplesNativeEndian() { return true; } void GetAudio(void *buf, int64_t start, int64_t count); }; + diff --git a/aegisub/src/audio_provider_ffmpegsource.cpp b/aegisub/src/audio_provider_ffmpegsource.cpp index 157863ee2..0f5f37279 100644 --- a/aegisub/src/audio_provider_ffmpegsource.cpp +++ b/aegisub/src/audio_provider_ffmpegsource.cpp @@ -49,8 +49,10 @@ #endif -/////////// -// Constructor + +/// @brief Constructor +/// @param filename +/// FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) { COMInited = false; #ifdef WIN32 @@ -79,8 +81,10 @@ FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) { } -/////////// -// Load audio file + +/// @brief Load audio file +/// @param filename +/// void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { // clean up Close(); @@ -198,8 +202,9 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { } -/////////// -// Destructor + +/// @brief Destructor +/// FFmpegSourceAudioProvider::~FFmpegSourceAudioProvider() { Close(); #ifdef WIN32 @@ -209,16 +214,21 @@ FFmpegSourceAudioProvider::~FFmpegSourceAudioProvider() { } -/////////// -// Clean up + +/// @brief Clean up +/// void FFmpegSourceAudioProvider::Close() { FFMS_DestroyAudioSource(AudioSource); AudioSource = NULL; } -/////////// -// Get audio + +/// @brief Get audio +/// @param Buf +/// @param Start +/// @param Count +/// void FFmpegSourceAudioProvider::GetAudio(void *Buf, int64_t Start, int64_t Count) { if (FFMS_GetAudio(AudioSource, Buf, Start, Count, FFMSErrMsg, MsgSize)) { ErrorMsg.Append(wxString::Format(_T("Failed to get audio samples: %s"), FFMSErrMsg)); @@ -229,3 +239,4 @@ void FFmpegSourceAudioProvider::GetAudio(void *Buf, int64_t Start, int64_t Count #endif /* WITH_FFMPEGSOURCE */ + diff --git a/aegisub/src/audio_provider_ffmpegsource.h b/aegisub/src/audio_provider_ffmpegsource.h index 9f3053f94..004e3db73 100644 --- a/aegisub/src/audio_provider_ffmpegsource.h +++ b/aegisub/src/audio_provider_ffmpegsource.h @@ -42,16 +42,30 @@ #include "ffmpegsource_common.h" -/////////////////////// -// FFmpegSource audio provider + +/// DOCME +/// @class FFmpegSourceAudioProvider +/// @brief DOCME +/// +/// DOCME class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider { private: + + /// DOCME FFAudio *AudioSource; + + /// DOCME char FFMSErrMsg[1024]; + + /// DOCME unsigned MsgSize; + + /// DOCME wxString ErrorMsg; + + /// DOCME bool COMInited; void Close(); @@ -61,7 +75,10 @@ public: FFmpegSourceAudioProvider(wxString filename); virtual ~FFmpegSourceAudioProvider(); - // FFMS always delivers samples in machine endian + + /// @brief // FFMS always delivers samples in machine endian + /// @return + /// bool AreSamplesNativeEndian() { return true; } virtual void GetAudio(void *buf, int64_t start, int64_t count); @@ -69,13 +86,22 @@ public: }; -/////////////////////// -// Factory + +/// DOCME +/// @class FFmpegSourceAudioProviderFactory +/// @brief DOCME +/// +/// DOCME class FFmpegSourceAudioProviderFactory : public AudioProviderFactory { public: + + /// @brief DOCME + /// @param file + /// AudioProvider *CreateProvider(wxString file) { return new FFmpegSourceAudioProvider(file); } }; #endif /* WITH_FFMPEGSOURCE */ + diff --git a/aegisub/src/audio_provider_hd.cpp b/aegisub/src/audio_provider_hd.cpp index 4fa01d839..2ac191643 100644 --- a/aegisub/src/audio_provider_hd.cpp +++ b/aegisub/src/audio_provider_hd.cpp @@ -51,8 +51,10 @@ #include "main.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param source +/// HDAudioProvider::HDAudioProvider(AudioProvider *source) { // Copy parameters bytes_per_sample = source->GetBytesPerSample(); @@ -104,8 +106,9 @@ HDAudioProvider::HDAudioProvider(AudioProvider *source) { } -////////////// -// Destructor + +/// @brief Destructor +/// HDAudioProvider::~HDAudioProvider() { file_cache.Close(); wxRemoveFile(diskCacheFilename); @@ -113,8 +116,12 @@ HDAudioProvider::~HDAudioProvider() { } -///////////// -// Get audio + +/// @brief Get audio +/// @param buf +/// @param start +/// @param count +/// void HDAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { // Requested beyond the length of audio if (start+count > num_samples) { @@ -145,8 +152,10 @@ void HDAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { } -/////////////////////////// -// Get disk cache path + +/// @brief Get disk cache path +/// @return +/// wxString HDAudioProvider::DiskCachePath() { // Default wxString path = Options.AsText(_T("Audio HD Cache Location")); @@ -157,8 +166,9 @@ wxString HDAudioProvider::DiskCachePath() { } -/////////////////////////// -// Get disk cache filename + +/// @brief Get disk cache filename +/// wxString HDAudioProvider::DiskCacheName() { // Get pattern wxString pattern = Options.AsText(_T("Audio HD Cache Name")); @@ -182,3 +192,4 @@ wxString HDAudioProvider::DiskCacheName() { return _T(""); } + diff --git a/aegisub/src/audio_provider_hd.h b/aegisub/src/audio_provider_hd.h index 4e656ab93..a5b373d84 100644 --- a/aegisub/src/audio_provider_hd.h +++ b/aegisub/src/audio_provider_hd.h @@ -44,14 +44,28 @@ #include -//////////////////////// -// Audio provider class + +/// DOCME +/// @class HDAudioProvider +/// @brief DOCME +/// +/// DOCME class HDAudioProvider : public AudioProvider { private: + + /// DOCME wxMutex diskmutex; + + /// DOCME wxFile file_cache; + + /// DOCME wxString diskCacheFilename; + + /// DOCME bool samples_native_endian; + + /// DOCME char *data; static wxString DiskCachePath(); @@ -61,8 +75,12 @@ public: HDAudioProvider(AudioProvider *source); ~HDAudioProvider(); + + /// @brief DOCME + /// bool AreSamplesNativeEndian() { return samples_native_endian; } void GetAudio(void *buf, int64_t start, int64_t count); }; + diff --git a/aegisub/src/audio_provider_manager.h b/aegisub/src/audio_provider_manager.h index f6867e34e..64a38e659 100644 --- a/aegisub/src/audio_provider_manager.h +++ b/aegisub/src/audio_provider_manager.h @@ -46,8 +46,12 @@ #include "include/aegisub/audio_provider.h" -/////////////////// -// Factory Manager + +/// DOCME +/// @class AudioProviderFactoryManager +/// @brief DOCME +/// +/// DOCME class AudioProviderFactoryManager : public FactoryManager { public: static void RegisterProviders(); @@ -55,3 +59,4 @@ public: static void ClearProviders(); }; + diff --git a/aegisub/src/audio_provider_pcm.cpp b/aegisub/src/audio_provider_pcm.cpp index 44d1b0ed2..3e1353749 100644 --- a/aegisub/src/audio_provider_pcm.cpp +++ b/aegisub/src/audio_provider_pcm.cpp @@ -53,6 +53,10 @@ + +/// @brief DOCME +/// @param filename +/// PCMAudioProvider::PCMAudioProvider(const wxString &filename) { #ifdef _WINDOWS @@ -114,6 +118,9 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename) } + +/// @brief DOCME +/// PCMAudioProvider::~PCMAudioProvider() { #ifdef _WINDOWS @@ -137,6 +144,12 @@ PCMAudioProvider::~PCMAudioProvider() } + +/// @brief DOCME +/// @param range_start +/// @param range_length +/// @return +/// char * PCMAudioProvider::EnsureRangeAccessible(int64_t range_start, int64_t range_length) { if (range_start + range_length > file_size) { @@ -210,6 +223,12 @@ char * PCMAudioProvider::EnsureRangeAccessible(int64_t range_start, int64_t rang } + +/// @brief DOCME +/// @param buf +/// @param start +/// @param count +/// void PCMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { // Read blocks from the file @@ -254,29 +273,66 @@ void PCMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) // RIFF WAV PCM provider // Overview of RIFF WAV: + +/// DOCME +/// @class RiffWavPCMAudioProvider +/// @brief DOCME +/// +/// DOCME class RiffWavPCMAudioProvider : public PCMAudioProvider { private: + + /// DOCME struct ChunkHeader { + + /// DOCME char type[4]; + + /// DOCME uint32_t size; }; + + /// DOCME struct RIFFChunk { + + /// DOCME ChunkHeader ch; + + /// DOCME char format[4]; }; + + /// DOCME struct fmtChunk { - // Skip the chunk header here, it's processed separately + + /// DOCME uint16_t compression; // compression format used -- 0x0001 = PCM + + /// DOCME uint16_t channels; + + /// DOCME uint32_t samplerate; + + /// DOCME uint32_t avg_bytes_sec; // can't always be trusted + + /// DOCME uint16_t block_align; + + /// DOCME uint16_t significant_bits_sample; // Here was supposed to be some more fields but we don't need them // and just skipping by the size of the struct wouldn't be safe // either way, as the fields can depend on the compression. }; + + /// @brief DOCME + /// @param str1[] + /// @param str2[] + /// @return + /// static bool CheckFourcc(const char str1[], const char str2[]) { assert(str1); @@ -289,6 +345,10 @@ private: } public: + + /// @brief DOCME + /// @param _filename + /// RiffWavPCMAudioProvider(const wxString &_filename) : PCMAudioProvider(_filename) { @@ -368,6 +428,10 @@ public: } + + /// @brief DOCME + /// @return + /// bool AreSamplesNativeEndian() { // 8 bit samples don't consider endianness @@ -383,64 +447,128 @@ public: // Sony Wave64 audio provider // Specs obtained at: + +/// DOCME static const uint8_t w64GuidRIFF[16] = { // {66666972-912E-11CF-A5D6-28DB04C10000} 0x72, 0x69, 0x66, 0x66, 0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 }; + +/// DOCME static const uint8_t w64GuidWAVE[16] = { // {65766177-ACF3-11D3-8CD1-00C04F8EDB8A} 0x77, 0x61, 0x76, 0x65, 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A }; + +/// DOCME static const uint8_t w64Guidfmt[16] = { // {20746D66-ACF3-11D3-8CD1-00C04F8EDB8A} 0x66, 0x6D, 0x74, 0x20, 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A }; + +/// DOCME static const uint8_t w64Guiddata[16] = { // {61746164-ACF3-11D3-8CD1-00C04F8EDB8A} 0x64, 0x61, 0x74, 0x61, 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A }; + +/// DOCME +/// @class Wave64AudioProvider +/// @brief DOCME +/// +/// DOCME class Wave64AudioProvider : public PCMAudioProvider { private: // Here's some copy-paste from the FFmpegSource2 code + + /// DOCME struct WaveFormatEx { + + /// DOCME uint16_t wFormatTag; + + /// DOCME uint16_t nChannels; + + /// DOCME uint32_t nSamplesPerSec; + + /// DOCME uint32_t nAvgBytesPerSec; + + /// DOCME uint16_t nBlockAlign; + + /// DOCME uint16_t wBitsPerSample; + + /// DOCME uint16_t cbSize; }; + + /// DOCME struct RiffChunk { + + /// DOCME uint8_t riff_guid[16]; + + /// DOCME uint64_t file_size; + + /// DOCME uint8_t format_guid[16]; }; + + /// DOCME struct FormatChunk { + + /// DOCME uint8_t chunk_guid[16]; + + /// DOCME uint64_t chunk_size; + + /// DOCME WaveFormatEx format; + + /// DOCME uint8_t padding[6]; }; + + /// DOCME struct DataChunk { + + /// DOCME uint8_t chunk_guid[16]; + + /// DOCME uint64_t chunk_size; }; + + /// @brief DOCME + /// @param guid1 + /// @param guid2 + /// @return + /// inline bool CheckGuid(const uint8_t *guid1, const uint8_t *guid2) { return memcmp(guid1, guid2, 16) == 0; } public: + + /// @brief DOCME + /// @param _filename + /// Wave64AudioProvider(const wxString &_filename) : PCMAudioProvider(_filename) { @@ -521,6 +649,10 @@ public: } + + /// @brief DOCME + /// @return + /// bool AreSamplesNativeEndian() { // 8 bit samples don't consider endianness @@ -532,6 +664,10 @@ public: }; + +/// @brief DOCME +/// @param filename +/// AudioProvider *CreatePCMAudioProvider(const wxString &filename) { AudioProvider *provider = 0; @@ -561,3 +697,4 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename) return NULL; } + diff --git a/aegisub/src/audio_provider_pcm.h b/aegisub/src/audio_provider_pcm.h index 196a39a03..b7d506886 100644 --- a/aegisub/src/audio_provider_pcm.h +++ b/aegisub/src/audio_provider_pcm.h @@ -50,18 +50,29 @@ #endif -///////////////////////////// -// Audio provider base class + +/// DOCME +/// @class PCMAudioProvider +/// @brief DOCME +/// +/// DOCME class PCMAudioProvider : public AudioProvider { private: #ifdef _WINDOWS - // File handle and file mapping handle from Win32 + + /// DOCME HANDLE file_handle; + + /// DOCME HANDLE file_mapping; - // Pointer to current area mapped into memory + + /// DOCME void *current_mapping; - // Byte indices in the file that the current mapping covers + + /// DOCME int64_t mapping_start; + + /// DOCME size_t mapping_length; #else int file_handle; @@ -75,19 +86,28 @@ protected: virtual ~PCMAudioProvider(); // Closes the file mapping char * EnsureRangeAccessible(int64_t range_start, int64_t range_length); // Ensure that the given range of bytes are accessible in the file mapping and return a pointer to the first byte of the requested range + + /// DOCME int64_t file_size; // Size of the opened file - // Hold data for an index point, - // to support files where audio data are - // split into multiple blocks. - // Using int64_t's should be safe on most compilers, - // wx defines wxFileOffset as int64 when possible + + /// DOCME struct IndexPoint { + + /// DOCME int64_t start_byte; + + /// DOCME int64_t start_sample; + + /// DOCME int64_t num_samples; }; + + /// DOCME typedef std::vector IndexVector; + + /// DOCME IndexVector index_points; public: @@ -99,3 +119,4 @@ AudioProvider *CreatePCMAudioProvider(const wxString &filename); + diff --git a/aegisub/src/audio_provider_quicktime.cpp b/aegisub/src/audio_provider_quicktime.cpp index b0026cea2..7df196b85 100644 --- a/aegisub/src/audio_provider_quicktime.cpp +++ b/aegisub/src/audio_provider_quicktime.cpp @@ -39,6 +39,10 @@ #ifdef WITH_QUICKTIME + +/// @brief DOCME +/// @param filename +/// QuickTimeAudioProvider::QuickTimeAudioProvider(wxString filename) { movie = NULL; in_dataref = NULL; @@ -74,12 +78,18 @@ QuickTimeAudioProvider::QuickTimeAudioProvider(wxString filename) { } + +/// @brief DOCME +/// QuickTimeAudioProvider::~QuickTimeAudioProvider() { Close(); DeInitQuickTime(); } + +/// @brief DOCME +/// void QuickTimeAudioProvider::Close() { if (movie) DisposeMovie(movie); @@ -93,6 +103,10 @@ void QuickTimeAudioProvider::Close() { } + +/// @brief DOCME +/// @param filename +/// void QuickTimeAudioProvider::LoadAudio(wxString filename) { OSType in_dataref_type; wxStringToDataRef(filename, &in_dataref, &in_dataref_type); @@ -148,6 +162,12 @@ void QuickTimeAudioProvider::LoadAudio(wxString filename) { } + +/// @brief DOCME +/// @param buf +/// @param start +/// @param count +/// void QuickTimeAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { TimeRecord trec; trec.scale = GetMovieTimeScale(movie); @@ -180,3 +200,4 @@ void QuickTimeAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/audio_provider_quicktime.h b/aegisub/src/audio_provider_quicktime.h index cb91c241e..843e0fad8 100644 --- a/aegisub/src/audio_provider_quicktime.h +++ b/aegisub/src/audio_provider_quicktime.h @@ -45,16 +45,36 @@ #include "include/aegisub/audio_provider.h" + +/// DOCME +/// @class QuickTimeAudioProvider +/// @brief DOCME +/// +/// DOCME class QuickTimeAudioProvider : public AudioProvider, QuickTimeProvider { private: + + /// DOCME Movie movie; // input file + + /// DOCME Handle in_dataref; // input file handle + + /// DOCME MovieAudioExtractionRef extract_ref; // extraction session object + + /// DOCME bool inited; + + /// DOCME OSErr qt_err; // quicktime error code + + /// DOCME OSStatus qt_status; // another quicktime error code + + /// DOCME wxString errmsg; // aegisub error messages void Close(); @@ -64,17 +84,32 @@ public: QuickTimeAudioProvider(wxString filename); virtual ~QuickTimeAudioProvider(); + + /// @brief DOCME + /// @return + /// bool AreSamplesNativeEndian() { return true; } virtual void GetAudio(void *buf, int64_t start, int64_t count); }; + +/// DOCME +/// @class QuickTimeAudioProviderFactory +/// @brief DOCME +/// +/// DOCME class QuickTimeAudioProviderFactory : public AudioProviderFactory { public: + + /// @brief DOCME + /// @param file + /// AudioProvider *CreateProvider(wxString file) { return new QuickTimeAudioProvider(file); } }; #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/audio_provider_ram.cpp b/aegisub/src/audio_provider_ram.cpp index 01377d4c7..0830760f4 100644 --- a/aegisub/src/audio_provider_ram.cpp +++ b/aegisub/src/audio_provider_ram.cpp @@ -46,14 +46,18 @@ #include "main.h" -/////////// -// Defines + +/// DOCME #define CacheBits ((22)) + +/// DOCME #define CacheBlockSize ((1 << CacheBits)) -/////////////// -// Constructor + +/// @brief Constructor +/// @param source +/// RAMAudioProvider::RAMAudioProvider(AudioProvider *source) { // Init blockcache = NULL; @@ -109,15 +113,17 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *source) { } -////////////// -// Destructor + +/// @brief Destructor +/// RAMAudioProvider::~RAMAudioProvider() { Clear(); } -///////// -// Clear + +/// @brief Clear +/// void RAMAudioProvider::Clear() { // Free ram cache if (blockcache) { @@ -131,8 +137,12 @@ void RAMAudioProvider::Clear() { } -///////////// -// Get audio + +/// @brief Get audio +/// @param buf +/// @param start +/// @param count +/// void RAMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { // Requested beyond the length of audio if (start+count > num_samples) { @@ -177,3 +187,4 @@ void RAMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { } } + diff --git a/aegisub/src/audio_provider_ram.h b/aegisub/src/audio_provider_ram.h index 052fc75cd..6378e8014 100644 --- a/aegisub/src/audio_provider_ram.h +++ b/aegisub/src/audio_provider_ram.h @@ -43,12 +43,22 @@ #include "include/aegisub/audio_provider.h" -//////////////////////// -// Audio provider class + +/// DOCME +/// @class RAMAudioProvider +/// @brief DOCME +/// +/// DOCME class RAMAudioProvider : public AudioProvider { private: + + /// DOCME char** blockcache; + + /// DOCME int blockcount; + + /// DOCME bool samples_native_endian; void Clear(); @@ -57,8 +67,12 @@ public: RAMAudioProvider(AudioProvider *source); ~RAMAudioProvider(); + + /// @brief DOCME + /// bool AreSamplesNativeEndian() { return samples_native_endian; } void GetAudio(void *buf, int64_t start, int64_t count); }; + diff --git a/aegisub/src/audio_provider_stream.cpp b/aegisub/src/audio_provider_stream.cpp index ebbcffe9e..b605f1c7c 100644 --- a/aegisub/src/audio_provider_stream.cpp +++ b/aegisub/src/audio_provider_stream.cpp @@ -43,11 +43,14 @@ #include "utils.h" + +/// DOCME #define BUFSIZE 65536 -/////////////// -// Constructor + +/// @brief Constructor +/// StreamAudioProvider::StreamAudioProvider() { bufLen = 8192; startPos = 0; @@ -58,8 +61,9 @@ StreamAudioProvider::StreamAudioProvider() { } -////////////// -// Destructor + +/// @brief Destructor +/// StreamAudioProvider::~StreamAudioProvider() { for (std::list::iterator cur=buffer.begin();cur!=buffer.end();cur++) { delete *cur; @@ -68,8 +72,12 @@ StreamAudioProvider::~StreamAudioProvider() { } -///////////// -// Get audio + +/// @brief Get audio +/// @param buf +/// @param start +/// @param count +/// void StreamAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { // Write int64_t left = count; @@ -111,8 +119,11 @@ void StreamAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) { } -////////////////////////// -// Append audio to stream + +/// @brief Append audio to stream +/// @param voidptr +/// @param count +/// void StreamAudioProvider::Append(void *voidptr, int64_t count) { // Read int64_t left = count; @@ -140,8 +151,12 @@ void StreamAudioProvider::Append(void *voidptr, int64_t count) { } -////////////////// -// Set parameters + +/// @brief Set parameters +/// @param chan +/// @param rate +/// @param bps +/// void StreamAudioProvider::SetParams(int chan,int rate,int bps) { channels = chan; sample_rate = rate; @@ -149,10 +164,12 @@ void StreamAudioProvider::SetParams(int chan,int rate,int bps) { } -//////////////////////////// -// Buffer chunk constructor + +/// @brief Buffer chunk constructor +/// StreamAudioProvider::BufferChunk::BufferChunk() { buf.resize(BUFSIZE); isFree = true; } + diff --git a/aegisub/src/audio_provider_stream.h b/aegisub/src/audio_provider_stream.h index d4b2aeb69..77d9a5823 100644 --- a/aegisub/src/audio_provider_stream.h +++ b/aegisub/src/audio_provider_stream.h @@ -45,24 +45,49 @@ #include "include/aegisub/audio_provider.h" -//////////////////////// -// Audio provider class + +/// DOCME +/// @class StreamAudioProvider +/// @brief DOCME +/// +/// DOCME class StreamAudioProvider : public AudioProvider { private: - // Buffer chunk subclass + + /// DOCME + /// @class BufferChunk + /// @brief DOCME + /// + /// DOCME class BufferChunk { public: + + /// DOCME std::vector buf; + + /// DOCME bool isFree; BufferChunk(); }; + + /// DOCME std::list buffer; + + /// DOCME int startPos; + + /// DOCME int endPos; + + /// DOCME int bufLen; + + /// DOCME int buffered; + + /// DOCME bool hasBuf; public: @@ -80,3 +105,4 @@ public: void SetParams(int channels,int rate,int bps); }; + diff --git a/aegisub/src/audio_spectrum.cpp b/aegisub/src/audio_spectrum.cpp index 4b49762a3..203146dc4 100644 --- a/aegisub/src/audio_spectrum.cpp +++ b/aegisub/src/audio_spectrum.cpp @@ -55,21 +55,49 @@ // Audio spectrum FFT data cache -// Spectrum cache basically caches the raw result of FFT + +/// DOCME +/// @class AudioSpectrumCache +/// @brief DOCME +/// +/// DOCME class AudioSpectrumCache { public: - // Type of a single FFT result line + + /// DOCME typedef std::vector CacheLine; - // Types for cache aging + + /// DOCME typedef unsigned int CacheAccessTime; + + /// DOCME struct CacheAgeData { + + /// DOCME CacheAccessTime access_time; + + /// DOCME unsigned long first_line; + + /// DOCME unsigned long num_lines; // includes overlap-lines + + /// @brief DOCME + /// @param second + /// @return + /// bool operator< (const CacheAgeData& second) const { return access_time < second.access_time; } + + /// @brief DOCME + /// @param t + /// @param first + /// @param num + /// CacheAgeData(CacheAccessTime t, unsigned long first, unsigned long num) : access_time(t), first_line(first), num_lines(num) { } }; + + /// DOCME typedef std::vector CacheAgeList; // Get the overlap'th overlapping FFT in FFT group i, generating it if needed @@ -85,37 +113,73 @@ public: // Return true if the object called on is empty and can safely be deleted too virtual bool KillLine(unsigned long line_id) = 0; - // Set the FFT size used + + /// @brief // Set the FFT size used + /// @param new_length + /// static void SetLineLength(unsigned long new_length) { line_length = new_length; null_line.resize(new_length, 0); } + + /// @brief DOCME + /// virtual ~AudioSpectrumCache() {}; protected: - // A cache line containing only zero-values + + /// DOCME static CacheLine null_line; - // The FFT size + + /// DOCME static unsigned long line_length; }; + +/// DOCME AudioSpectrumCache::CacheLine AudioSpectrumCache::null_line; + +/// DOCME unsigned long AudioSpectrumCache::line_length; // Bottom level FFT cache, holds actual power data itself + +/// DOCME +/// @class FinalSpectrumCache +/// @brief DOCME +/// +/// DOCME class FinalSpectrumCache : public AudioSpectrumCache { private: + + /// DOCME std::vector data; + + /// DOCME + + /// DOCME unsigned long start, length; // start and end of range + + /// DOCME unsigned int overlaps; + + /// DOCME CacheAccessTime last_access; public: + + /// @brief DOCME + /// @param i + /// @param overlap + /// @param created + /// @param access_time + /// @return + /// CacheLine& GetLine(unsigned long i, unsigned int overlap, bool &created, CacheAccessTime access_time) { last_access = access_time; @@ -127,21 +191,41 @@ public: return null_line; } + + /// @brief DOCME + /// @return + /// size_t GetManagedLineCount() { return data.size(); } + + /// @brief DOCME + /// @param ages + /// void GetLineAccessTimes(CacheAgeList &ages) { ages.push_back(CacheAgeData(last_access, start, data.size())); } + + /// @brief DOCME + /// @param line_id + /// @return + /// bool KillLine(unsigned long line_id) { return start == line_id; } + + /// @brief DOCME + /// @param provider + /// @param _start + /// @param _length + /// @param _overlaps + /// FinalSpectrumCache(AudioProvider *provider, unsigned long _start, unsigned long _length, unsigned int _overlaps) { start = _start; @@ -210,6 +294,9 @@ public: } } + + /// @brief DOCME + /// virtual ~FinalSpectrumCache() { } @@ -219,16 +306,46 @@ public: // Non-bottom-level cache, refers to other caches to do the work + +/// DOCME +/// @class IntermediateSpectrumCache +/// @brief DOCME +/// +/// DOCME class IntermediateSpectrumCache : public AudioSpectrumCache { private: + + /// DOCME std::vector sub_caches; + + /// DOCME + + /// DOCME + + /// DOCME unsigned long start, length, subcache_length; + + /// DOCME unsigned int overlaps; + + /// DOCME bool subcaches_are_final; + + /// DOCME int depth; + + /// DOCME AudioProvider *provider; public: + + /// @brief DOCME + /// @param i + /// @param overlap + /// @param created + /// @param access_time + /// @return + /// CacheLine &GetLine(unsigned long i, unsigned int overlap, bool &created, CacheAccessTime access_time) { if (i >= start && i-start <= length) { @@ -251,6 +368,10 @@ public: } } + + /// @brief DOCME + /// @return + /// size_t GetManagedLineCount() { size_t res = 0; @@ -261,6 +382,10 @@ public: return res; } + + /// @brief DOCME + /// @param ages + /// void GetLineAccessTimes(CacheAgeList &ages) { for (size_t i = 0; i < sub_caches.size(); ++i) { @@ -269,6 +394,11 @@ public: } } + + /// @brief DOCME + /// @param line_id + /// @return + /// bool KillLine(unsigned long line_id) { int sub_caches_left = 0; @@ -285,6 +415,14 @@ public: return sub_caches_left == 0; } + + /// @brief DOCME + /// @param _provider + /// @param _start + /// @param _length + /// @param _overlaps + /// @param _depth + /// IntermediateSpectrumCache(AudioProvider *_provider, unsigned long _start, unsigned long _length, unsigned int _overlaps, int _depth) { provider = _provider; @@ -307,6 +445,9 @@ public: sub_caches.resize(num_subcaches, 0); } + + /// @brief DOCME + /// virtual ~IntermediateSpectrumCache() { for (size_t i = 0; i < sub_caches.size(); ++i) @@ -318,15 +459,37 @@ public: + +/// DOCME +/// @class AudioSpectrumCacheManager +/// @brief DOCME +/// +/// DOCME class AudioSpectrumCacheManager { private: + + /// DOCME IntermediateSpectrumCache *cache_root; + + /// DOCME + + /// DOCME unsigned long cache_hits, cache_misses; + + /// DOCME AudioSpectrumCache::CacheAccessTime cur_time; + + /// DOCME unsigned long max_lines_cached; public: + + /// @brief DOCME + /// @param i + /// @param overlap + /// @return + /// AudioSpectrumCache::CacheLine &GetLine(unsigned long i, unsigned int overlap) { bool created = false; @@ -338,6 +501,10 @@ public: return res; } + + /// @brief DOCME + /// @return + /// void Age() { wxLogDebug(_T("AudioSpectrumCacheManager stats: hits=%u, misses=%u, misses%%=%f, managed lines=%u (max=%u)"), cache_hits, cache_misses, cache_misses/float(cache_hits+cache_misses)*100, cache_root->GetManagedLineCount(), max_lines_cached); @@ -383,6 +550,13 @@ public: assert(cache_root->GetManagedLineCount() < max_lines_cached); } + + /// @brief DOCME + /// @param provider + /// @param line_length + /// @param num_lines + /// @param num_overlaps + /// AudioSpectrumCacheManager(AudioProvider *provider, unsigned long line_length, unsigned long num_lines, unsigned int num_overlaps) { cache_hits = cache_misses = 0; @@ -398,6 +572,9 @@ public: max_lines_cached = max_cache_size / line_size; } + + /// @brief DOCME + /// ~AudioSpectrumCacheManager() { delete cache_root; @@ -407,6 +584,10 @@ public: // AudioSpectrum + +/// @brief DOCME +/// @param _provider +/// AudioSpectrum::AudioSpectrum(AudioProvider *_provider) { provider = _provider; @@ -496,12 +677,26 @@ AudioSpectrum::AudioSpectrum(AudioProvider *_provider) } + +/// @brief DOCME +/// AudioSpectrum::~AudioSpectrum() { delete cache; } + +/// @brief DOCME +/// @param range_start +/// @param range_end +/// @param selected +/// @param img +/// @param imgleft +/// @param imgwidth +/// @param imgpitch +/// @param imgheight +/// void AudioSpectrum::RenderRange(int64_t range_start, int64_t range_end, bool selected, unsigned char *img, int imgleft, int imgwidth, int imgpitch, int imgheight) { unsigned long first_line = (unsigned long)(fft_overlaps * range_start / line_length / 2); @@ -551,6 +746,8 @@ void AudioSpectrum::RenderRange(int64_t range_start, int64_t range_end, bool sel } } + +/// DOCME #define WRITE_PIXEL \ if (intensity < 0) intensity = 0; \ if (intensity > 255) intensity = 255; \ @@ -599,6 +796,8 @@ void AudioSpectrum::RenderRange(int64_t range_start, int64_t range_end, bool sel } } + +/// DOCME #undef WRITE_PIXEL } @@ -609,6 +808,10 @@ void AudioSpectrum::RenderRange(int64_t range_start, int64_t range_end, bool sel } + +/// @brief DOCME +/// @param _power_scale +/// void AudioSpectrum::SetScaling(float _power_scale) { power_scale = _power_scale; @@ -616,3 +819,4 @@ void AudioSpectrum::SetScaling(float _power_scale) + diff --git a/aegisub/src/audio_spectrum.h b/aegisub/src/audio_spectrum.h index 05a6bc7c0..290c60356 100644 --- a/aegisub/src/audio_spectrum.h +++ b/aegisub/src/audio_spectrum.h @@ -36,6 +36,8 @@ /// #ifndef AUDIO_SPECTRUM_H + +/// DOCME #define AUDIO_SPECTRUM_H #include @@ -47,22 +49,46 @@ class AudioSpectrumCacheManager; + +/// DOCME +/// @class AudioSpectrum +/// @brief DOCME +/// +/// DOCME class AudioSpectrum { private: - // Data provider + + /// DOCME AudioSpectrumCacheManager *cache; - // Colour pallettes + + /// DOCME unsigned char colours_normal[256*3]; + + /// DOCME unsigned char colours_selected[256*3]; + + /// DOCME AudioProvider *provider; + + /// DOCME unsigned long line_length; // number of frequency components per line (half of number of samples) + + /// DOCME unsigned long num_lines; // number of lines needed for the audio + + /// DOCME unsigned int fft_overlaps; // number of overlaps used in FFT + + /// DOCME float power_scale; // amplification of displayed power + + /// DOCME int minband; // smallest frequency band displayed + + /// DOCME int maxband; // largest frequency band displayed public: @@ -77,3 +103,4 @@ public: #endif + diff --git a/aegisub/src/auto4_base.cpp b/aegisub/src/auto4_base.cpp index aa24818bc..a3b45cdc0 100644 --- a/aegisub/src/auto4_base.cpp +++ b/aegisub/src/auto4_base.cpp @@ -68,8 +68,20 @@ #include FT_FREETYPE_H #endif + +/// DOCME namespace Automation4 { + + /// @brief DOCME + /// @param style + /// @param text + /// @param width + /// @param height + /// @param descent + /// @param extlead + /// @return + /// bool CalculateTextExtents(AssStyle *style, wxString &text, double &width, double &height, double &descent, double &extlead) { width = height = descent = extlead = 0; @@ -183,6 +195,11 @@ namespace Automation4 { // Feature + + /// @brief DOCME + /// @param _featureclass + /// @param _name + /// Feature::Feature(ScriptFeatureClass _featureclass, const wxString &_name) : featureclass(_featureclass) , name(_name) @@ -190,11 +207,19 @@ namespace Automation4 { // nothing to do } + + /// @brief DOCME + /// @return + /// ScriptFeatureClass Feature::GetClass() const { return featureclass; } + + /// @brief DOCME + /// @return + /// FeatureMacro* Feature::AsMacro() { if (featureclass == SCRIPTFEATURE_MACRO) @@ -203,6 +228,10 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @return + /// FeatureFilter* Feature::AsFilter() { if (featureclass == SCRIPTFEATURE_FILTER) @@ -210,6 +239,10 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @return + /// FeatureSubtitleFormat* Feature::AsSubFormat() { if (featureclass == SCRIPTFEATURE_SUBFORMAT) @@ -217,6 +250,10 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @return + /// const wxString& Feature::GetName() const { return name; @@ -225,6 +262,11 @@ namespace Automation4 { // FeatureMacro + + /// @brief DOCME + /// @param _name + /// @param _description + /// FeatureMacro::FeatureMacro(const wxString &_name, const wxString &_description) : Feature(SCRIPTFEATURE_MACRO, _name) , description(_description) @@ -232,6 +274,10 @@ namespace Automation4 { // nothing to do } + + /// @brief DOCME + /// @return + /// const wxString& FeatureMacro::GetDescription() const { return description; @@ -240,6 +286,12 @@ namespace Automation4 { // FeatureFilter + + /// @brief DOCME + /// @param _name + /// @param _description + /// @param _priority + /// FeatureFilter::FeatureFilter(const wxString &_name, const wxString &_description, int _priority) : Feature(SCRIPTFEATURE_FILTER, _name) , AssExportFilter() @@ -249,16 +301,28 @@ namespace Automation4 { Register(_name, _priority); } + + /// @brief DOCME + /// FeatureFilter::~FeatureFilter() { Unregister(); } + + /// @brief DOCME + /// @return + /// wxString FeatureFilter::GetScriptSettingsIdentifier() { return inline_string_encode(wxString::Format(_T("Automation Settings %s"), GetName().c_str())); } + + /// @brief DOCME + /// @param parent + /// @return + /// wxWindow* FeatureFilter::GetConfigDialogWindow(wxWindow *parent) { if (config_dialog) { delete config_dialog; @@ -275,6 +339,10 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param IsDefault + /// void FeatureFilter::LoadSettings(bool IsDefault) { if (config_dialog) { config_dialog->ReadBack(); @@ -289,6 +357,11 @@ namespace Automation4 { // FeatureSubtitleFormat + + /// @brief DOCME + /// @param _name + /// @param _extension + /// FeatureSubtitleFormat::FeatureSubtitleFormat(const wxString &_name, const wxString &_extension) : Feature(SCRIPTFEATURE_SUBFORMAT, _name) , extension(_extension) @@ -296,16 +369,30 @@ namespace Automation4 { // nothing to do } + + /// @brief DOCME + /// @return + /// const wxString& FeatureSubtitleFormat::GetExtension() const { return extension; } + + /// @brief DOCME + /// @param filename + /// @return + /// bool FeatureSubtitleFormat::CanWriteFile(wxString filename) { return !filename.Right(extension.Length()).CmpNoCase(extension); } + + /// @brief DOCME + /// @param filename + /// @return + /// bool FeatureSubtitleFormat::CanReadFile(wxString filename) { return !filename.Right(extension.Length()).CmpNoCase(extension); @@ -314,23 +401,37 @@ namespace Automation4 { // ShowConfigDialogEvent + + /// DOCME const wxEventType EVT_SHOW_CONFIG_DIALOG_t = wxNewEventType(); // ScriptConfigDialog + + /// @brief DOCME + /// @param parent + /// @return + /// wxWindow* ScriptConfigDialog::GetWindow(wxWindow *parent) { if (win) return win; return win = CreateWindow(parent); } + + /// @brief DOCME + /// void ScriptConfigDialog::DeleteWindow() { if (win) delete win; win = 0; } + + /// @brief DOCME + /// @return + /// wxString ScriptConfigDialog::Serialise() { return _T(""); @@ -339,6 +440,10 @@ namespace Automation4 { // ProgressSink + + /// @brief DOCME + /// @param parent + /// ProgressSink::ProgressSink(wxWindow *parent) : wxDialog(parent, -1, _T("Automation"), wxDefaultPosition, wxDefaultSize, wxBORDER_RAISED) , debug_visible(false) @@ -384,11 +489,18 @@ namespace Automation4 { trace_level = Options.AsInt(_T("Automation Trace Level")); } + + /// @brief DOCME + /// ProgressSink::~ProgressSink() { delete update_timer; } + + /// @brief DOCME + /// @param evt + /// void ProgressSink::OnIdle(wxIdleEvent &evt) { // The big glossy "update display" event @@ -406,6 +518,10 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @return + /// void ProgressSink::DoUpdateDisplay() { // If debug output isn't handled before the test for script_finished later, @@ -434,6 +550,10 @@ namespace Automation4 { data_updated = false; } + + /// @brief DOCME + /// @param _progress + /// void ProgressSink::SetProgress(float _progress) { wxMutexLocker lock(data_mutex); @@ -441,6 +561,10 @@ namespace Automation4 { data_updated = true; } + + /// @brief DOCME + /// @param _task + /// void ProgressSink::SetTask(const wxString &_task) { wxMutexLocker lock(data_mutex); @@ -448,6 +572,10 @@ namespace Automation4 { data_updated = true; } + + /// @brief DOCME + /// @param _title + /// void ProgressSink::SetTitle(const wxString &_title) { wxMutexLocker lock(data_mutex); @@ -455,6 +583,10 @@ namespace Automation4 { data_updated = true; } + + /// @brief DOCME + /// @param msg + /// void ProgressSink::AddDebugOutput(const wxString &msg) { wxMutexLocker lock(data_mutex); @@ -469,11 +601,19 @@ namespace Automation4 { EVT_SHOW_CONFIG_DIALOG(ProgressSink::OnConfigDialog) END_EVENT_TABLE() + + /// @brief DOCME + /// @param evt + /// void ProgressSink::OnInit(wxInitDialogEvent &evt) { has_inited = true; } + + /// @brief DOCME + /// @param evt + /// void ProgressSink::OnCancel(wxCommandEvent &evt) { if (!script_finished) { @@ -484,6 +624,10 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param evt + /// void ProgressSink::OnConfigDialog(ShowConfigDialogEvent &evt) { // assume we're in the GUI thread here @@ -514,6 +658,10 @@ namespace Automation4 { // Script + + /// @brief DOCME + /// @param _filename + /// Script::Script(const wxString &_filename) : filename(_filename) , name(_T("")) @@ -536,6 +684,9 @@ namespace Automation4 { } } + + /// @brief DOCME + /// Script::~Script() { for (std::vector::iterator f = features.begin(); f != features.end(); ++f) { @@ -543,42 +694,74 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @return + /// wxString Script::GetPrettyFilename() const { wxFileName fn(filename); return fn.GetFullName(); } + + /// @brief DOCME + /// @return + /// const wxString& Script::GetFilename() const { return filename; } + + /// @brief DOCME + /// @return + /// const wxString& Script::GetName() const { return name; } + + /// @brief DOCME + /// @return + /// const wxString& Script::GetDescription() const { return description; } + + /// @brief DOCME + /// @return + /// const wxString& Script::GetAuthor() const { return author; } + + /// @brief DOCME + /// @return + /// const wxString& Script::GetVersion() const { return version; } + + /// @brief DOCME + /// @return + /// bool Script::GetLoadedState() const { return loaded; } + + /// @brief DOCME + /// @return + /// std::vector& Script::GetFeatures() { return features; @@ -587,16 +770,27 @@ namespace Automation4 { // ScriptManager + + /// @brief DOCME + /// ScriptManager::ScriptManager() { // do nothing...? } + + /// @brief DOCME + /// ScriptManager::~ScriptManager() { RemoveAll(); } + + /// @brief DOCME + /// @param script + /// @return + /// void ScriptManager::Add(Script *script) { for (std::vector::iterator i = scripts.begin(); i != scripts.end(); ++i) { @@ -605,6 +799,11 @@ namespace Automation4 { scripts.push_back(script); } + + /// @brief DOCME + /// @param script + /// @return + /// void ScriptManager::Remove(Script *script) { for (std::vector::iterator i = scripts.begin(); i != scripts.end(); ++i) { @@ -616,6 +815,9 @@ namespace Automation4 { } } + + /// @brief DOCME + /// void ScriptManager::RemoveAll() { for (std::vector::iterator i = scripts.begin(); i != scripts.end(); ++i) { @@ -624,11 +826,19 @@ namespace Automation4 { scripts.clear(); } + + /// @brief DOCME + /// @return + /// const std::vector& ScriptManager::GetScripts() const { return scripts; } + + /// @brief DOCME + /// @return + /// const std::vector& ScriptManager::GetMacros() { macros.clear(); @@ -646,12 +856,19 @@ namespace Automation4 { // AutoloadScriptManager + + /// @brief DOCME + /// @param _path + /// AutoloadScriptManager::AutoloadScriptManager(const wxString &_path) : path(_path) { Reload(); } + + /// @brief DOCME + /// void AutoloadScriptManager::Reload() { RemoveAll(); @@ -704,18 +921,32 @@ namespace Automation4 { // ScriptFactory + + /// DOCME std::vector *ScriptFactory::factories = 0; + + /// @brief DOCME + /// @return + /// const wxString& ScriptFactory::GetEngineName() const { return engine_name; } + + /// @brief DOCME + /// @return + /// const wxString& ScriptFactory::GetFilenamePattern() const { return filename_pattern; } + + /// @brief DOCME + /// @param factory + /// void ScriptFactory::Register(ScriptFactory *factory) { if (!factories) @@ -729,6 +960,11 @@ namespace Automation4 { factories->push_back(factory); } + + /// @brief DOCME + /// @param factory + /// @return + /// void ScriptFactory::Unregister(ScriptFactory *factory) { if (!factories) @@ -743,6 +979,12 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param filename + /// @param log_errors + /// @return + /// Script* ScriptFactory::CreateFromFile(const wxString &filename, bool log_errors) { if (!factories) @@ -771,6 +1013,11 @@ namespace Automation4 { return new UnknownScript(filename); } + + /// @brief DOCME + /// @param filename + /// @return + /// bool ScriptFactory::CanHandleScriptFormat(const wxString &filename) { // Just make this always return true to bitch about unknown script formats in autoload @@ -786,6 +1033,10 @@ namespace Automation4 { return false; } + + /// @brief DOCME + /// @return + /// const std::vector& ScriptFactory::GetFactories() { if (!factories) @@ -797,6 +1048,10 @@ namespace Automation4 { // UnknownScript + + /// @brief DOCME + /// @param filename + /// UnknownScript::UnknownScript(const wxString &filename) : Script(filename) { @@ -810,3 +1065,4 @@ namespace Automation4 { #endif // WITH_AUTOMATION + diff --git a/aegisub/src/auto4_base.h b/aegisub/src/auto4_base.h index b12461db1..f863d1258 100644 --- a/aegisub/src/auto4_base.h +++ b/aegisub/src/auto4_base.h @@ -37,6 +37,8 @@ #pragma once #ifndef _AUTO4_BASE_H + +/// DOCME #define _AUTO4_BASE_H #include @@ -62,18 +64,29 @@ class wxPathList; DECLARE_EVENT_TYPE(wxEVT_AUTOMATION_SCRIPT_COMPLETED, -1) + +/// DOCME namespace Automation4 { // Calculate the extents of a text string given a style bool CalculateTextExtents(AssStyle *style, wxString &text, double &width, double &height, double &descent, double &extlead); - // The class of a Feature... + + /// DOCME enum ScriptFeatureClass { + + /// DOCME SCRIPTFEATURE_MACRO = 0, + + /// DOCME SCRIPTFEATURE_FILTER, + + /// DOCME SCRIPTFEATURE_SUBFORMAT, + + /// DOCME SCRIPTFEATURE_MAX // must be last }; @@ -83,15 +96,28 @@ namespace Automation4 { class FeatureMacro; class FeatureFilter; class FeatureSubtitleFormat; + + /// DOCME + /// @class Feature + /// @brief DOCME + /// + /// DOCME class Feature { private: + + /// DOCME ScriptFeatureClass featureclass; + + /// DOCME wxString name; protected: Feature(ScriptFeatureClass _featureclass, const wxString &_name); public: + + /// @brief DOCME + /// virtual ~Feature() { } ScriptFeatureClass GetClass() const; @@ -103,15 +129,25 @@ namespace Automation4 { }; - // The Macro feature; adds a menu item that runs script code + + /// DOCME + /// @class FeatureMacro + /// @brief DOCME + /// + /// DOCME class FeatureMacro : public virtual Feature { private: + + /// DOCME wxString description; protected: FeatureMacro(const wxString &_name, const wxString &_description); public: + + /// @brief DOCME + /// virtual ~FeatureMacro() { } const wxString& GetDescription() const; @@ -122,9 +158,16 @@ namespace Automation4 { class ScriptConfigDialog; - // The Export Filter feature; adds a new export filter + + /// DOCME + /// @class FeatureFilter + /// @brief DOCME + /// + /// DOCME class FeatureFilter : public virtual Feature, public AssExportFilter { private: + + /// DOCME ScriptConfigDialog *config_dialog; protected: @@ -146,15 +189,26 @@ namespace Automation4 { }; - // The Subtitle Format feature; adds new subtitle format readers/writers + + /// DOCME + /// @class FeatureSubtitleFormat + /// @brief DOCME + /// + /// DOCME class FeatureSubtitleFormat : public virtual Feature, public SubtitleFormat { private: + + /// DOCME wxString extension; protected: FeatureSubtitleFormat(const wxString &_name, const wxString &_extension); public: + + /// @brief DOCME + /// @return + /// virtual ~FeatureSubtitleFormat() { } const wxString& GetExtension() const; @@ -169,22 +223,39 @@ namespace Automation4 { }; - // Base class for script-provided config dialogs + + /// DOCME + /// @class ScriptConfigDialog + /// @brief DOCME + /// + /// DOCME class ScriptConfigDialog { private: + + /// DOCME wxWindow *win; protected: virtual wxWindow* CreateWindow(wxWindow *parent) = 0; public: + + /// @brief DOCME + /// ScriptConfigDialog() : win(0) { } + + /// @brief DOCME + /// virtual ~ScriptConfigDialog() { } wxWindow* GetWindow(wxWindow *parent); void DeleteWindow(); virtual void ReadBack() = 0; virtual wxString Serialise(); + + /// @brief DOCME + /// @param serialised + /// virtual void Unserialise(const wxString &serialised) { } }; @@ -192,51 +263,99 @@ namespace Automation4 { // Config dialog event class and related stuff (wx features; Script(const wxString &_filename); @@ -301,13 +449,20 @@ namespace Automation4 { }; - // Manages loaded scripts; for whatever reason, multiple managers might be instantiated. In truth, this is more - // like a macro manager at the moment, since Export Filter and Subtitle Format are already managed by other - // classes. + + /// DOCME + /// @class ScriptManager + /// @brief DOCME + /// + /// DOCME class ScriptManager { private: + + /// DOCME std::vector scripts; + + /// DOCME std::vector macros; public: @@ -325,9 +480,16 @@ namespace Automation4 { }; - // Scans a directory for scripts and attempts to load all of them + + /// DOCME + /// @class AutoloadScriptManager + /// @brief DOCME + /// + /// DOCME class AutoloadScriptManager : public ScriptManager { private: + + /// DOCME wxString path; public: AutoloadScriptManager(const wxString &_path); @@ -335,15 +497,31 @@ namespace Automation4 { }; - // Script factory; each scripting engine should create exactly one instance of this object and register it. - // This is used to create Script objects from a file. + + /// DOCME + /// @class ScriptFactory + /// @brief DOCME + /// + /// DOCME class ScriptFactory { private: + + /// DOCME static std::vector *factories; protected: + + /// @brief DOCME + /// ScriptFactory() { } + + /// @brief DOCME + /// virtual ~ScriptFactory() { } + + /// DOCME wxString engine_name; + + /// DOCME wxString filename_pattern; public: virtual Script* Produce(const wxString &filename) const = 0; @@ -357,10 +535,18 @@ namespace Automation4 { static const std::vector& GetFactories(); }; - // Dummy class for scripts that could not be loaded by the ScriptFactory + + /// DOCME + /// @class UnknownScript + /// @brief DOCME + /// + /// DOCME class UnknownScript : public Script { public: UnknownScript(const wxString &filename); + + /// @brief DOCME + /// void Reload() { }; }; @@ -368,3 +554,4 @@ namespace Automation4 { #endif + diff --git a/aegisub/src/auto4_lua.cpp b/aegisub/src/auto4_lua.cpp index 86c330f6b..a0e77af66 100644 --- a/aegisub/src/auto4_lua.cpp +++ b/aegisub/src/auto4_lua.cpp @@ -66,6 +66,8 @@ #include #include + +/// DOCME namespace Automation4 { // LuaStackcheck @@ -104,10 +106,26 @@ namespace Automation4 { ~LuaStackcheck() { check_stack(0); } }; #else + + /// DOCME struct LuaStackcheck { + + /// @brief DOCME + /// @param additional + /// void check_stack(int additional) { } + + /// @brief DOCME + /// void dump() { } + + /// @brief DOCME + /// @param L + /// LuaStackcheck(lua_State *L) { } + + /// @brief DOCME + /// ~LuaStackcheck() { } }; #endif @@ -115,6 +133,10 @@ namespace Automation4 { // LuaScript + + /// @brief DOCME + /// @param filename + /// LuaScript::LuaScript(const wxString &filename) : Script(filename) , L(0) @@ -122,11 +144,17 @@ namespace Automation4 { Create(); } + + /// @brief DOCME + /// LuaScript::~LuaScript() { if (L) Destroy(); } + + /// @brief DOCME + /// void LuaScript::Create() { Destroy(); @@ -265,6 +293,10 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @return + /// void LuaScript::Destroy() { // Assume the script object is clean if there's no Lua state @@ -284,12 +316,20 @@ namespace Automation4 { loaded = false; } + + /// @brief DOCME + /// void LuaScript::Reload() { Destroy(); Create(); } + + /// @brief DOCME + /// @param L + /// @return + /// LuaScript* LuaScript::GetScriptObject(lua_State *L) { lua_getfield(L, LUA_REGISTRYINDEX, "aegisub"); @@ -298,6 +338,11 @@ namespace Automation4 { return (LuaScript*)ptr; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaScript::LuaTextExtents(lua_State *L) { if (!lua_istable(L, 1)) { @@ -336,6 +381,11 @@ namespace Automation4 { return 4; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaScript::LuaInclude(lua_State *L) { LuaScript *s = GetScriptObject(L); @@ -374,6 +424,11 @@ namespace Automation4 { return lua_gettop(L) - pretop; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaScript::LuaFrameFromMs(lua_State *L) { int ms = (int)lua_tonumber(L, -1); @@ -387,6 +442,11 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaScript::LuaMsFromFrame(lua_State *L) { int frame = (int)lua_tonumber(L, -1); @@ -400,6 +460,11 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaScript::LuaVideoSize(lua_State *L) { VideoContext *ctx = VideoContext::Get(); @@ -418,6 +483,12 @@ namespace Automation4 { // LuaThreadedCall + + /// @brief DOCME + /// @param _L + /// @param _nargs + /// @param _nresults + /// LuaThreadedCall::LuaThreadedCall(lua_State *_L, int _nargs, int _nresults) : wxThread(wxTHREAD_JOINABLE) , L(_L) @@ -434,6 +505,10 @@ namespace Automation4 { Run(); } + + /// @brief DOCME + /// @return + /// wxThread::ExitCode LuaThreadedCall::Entry() { int result = lua_pcall(L, nargs, nresults, 0); @@ -466,12 +541,21 @@ namespace Automation4 { // LuaFeature + + /// @brief DOCME + /// @param _L + /// @param _featureclass + /// @param _name + /// LuaFeature::LuaFeature(lua_State *_L, ScriptFeatureClass _featureclass, const wxString &_name) : Feature(_featureclass, _name) , L(_L) { } + + /// @brief DOCME + /// void LuaFeature::RegisterFeature() { // get the LuaScript objects @@ -493,6 +577,10 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// @param functionid + /// void LuaFeature::GetFeatureFunction(int functionid) { // get feature table @@ -505,6 +593,10 @@ namespace Automation4 { lua_remove(L, -2); } + + /// @brief DOCME + /// @param ints + /// void LuaFeature::CreateIntegerArray(const std::vector &ints) { // create an array-style table with an integer vector in it @@ -516,6 +608,9 @@ namespace Automation4 { } } + + /// @brief DOCME + /// void LuaFeature::ThrowError() { wxString err(lua_tostring(L, -1), wxConvUTF8); @@ -526,6 +621,11 @@ namespace Automation4 { // LuaFeatureMacro + + /// @brief DOCME + /// @param L + /// @return + /// int LuaFeatureMacro::LuaRegister(lua_State *L) { wxString _name(lua_tostring(L, 1), wxConvUTF8); @@ -537,6 +637,12 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param _name + /// @param _description + /// @param _L + /// LuaFeatureMacro::LuaFeatureMacro(const wxString &_name, const wxString &_description, lua_State *_L) : Feature(SCRIPTFEATURE_MACRO, _name) , FeatureMacro(_name, _description) @@ -561,6 +667,13 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// @param subs + /// @param selected + /// @param active + /// @return + /// bool LuaFeatureMacro::Validate(AssFile *subs, const std::vector &selected, int active) { if (no_validate) @@ -591,6 +704,14 @@ namespace Automation4 { return result; } + + /// @brief DOCME + /// @param subs + /// @param selected + /// @param active + /// @param progress_parent + /// @return + /// void LuaFeatureMacro::Process(AssFile *subs, std::vector &selected, int active, wxWindow * const progress_parent) { GetFeatureFunction(1); // 1 = processing function @@ -636,6 +757,13 @@ namespace Automation4 { // LuaFeatureFilter + + /// @brief DOCME + /// @param _name + /// @param _description + /// @param merit + /// @param _L + /// LuaFeatureFilter::LuaFeatureFilter(const wxString &_name, const wxString &_description, int merit, lua_State *_L) : Feature(SCRIPTFEATURE_FILTER, _name) , FeatureFilter(_name, _description, merit) @@ -656,11 +784,19 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// void LuaFeatureFilter::Init() { // Don't think there's anything to do here... (empty in auto3) } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaFeatureFilter::LuaRegister(lua_State *L) { wxString _name(lua_tostring(L, 1), wxConvUTF8); @@ -673,6 +809,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param subs + /// @param export_dialog + /// void LuaFeatureFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { LuaStackcheck stackcheck(L); @@ -719,6 +860,11 @@ namespace Automation4 { delete ps; } + + /// @brief DOCME + /// @param parent + /// @return + /// ScriptConfigDialog* LuaFeatureFilter::GenerateConfigDialog(wxWindow *parent) { if (!has_config) @@ -749,6 +895,12 @@ namespace Automation4 { // LuaProgressSink + + /// @brief DOCME + /// @param _L + /// @param parent + /// @param allow_config_dialog + /// LuaProgressSink::LuaProgressSink(lua_State *_L, wxWindow *parent, bool allow_config_dialog) : ProgressSink(parent) , L(_L) @@ -802,6 +954,9 @@ namespace Automation4 { lua_pop(L, 2); } + + /// @brief DOCME + /// LuaProgressSink::~LuaProgressSink() { // remove progress reporting stuff @@ -815,6 +970,12 @@ namespace Automation4 { lua_setfield(L, LUA_REGISTRYINDEX, "progress_sink"); } + + /// @brief DOCME + /// @param L + /// @param idx + /// @return + /// LuaProgressSink* LuaProgressSink::GetObjPointer(lua_State *L, int idx) { assert(lua_type(L, idx) == LUA_TUSERDATA); @@ -822,6 +983,11 @@ namespace Automation4 { return *((LuaProgressSink**)ud); } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaSetProgress(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -830,6 +996,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaSetTask(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -838,6 +1009,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaSetTitle(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -846,6 +1022,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaGetCancelled(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -853,6 +1034,11 @@ namespace Automation4 { return 1; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaDebugOut(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -887,6 +1073,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaProgressSink::LuaDisplayDialog(lua_State *L) { LuaProgressSink *ps = GetObjPointer(L, lua_upvalueindex(1)); @@ -919,10 +1110,18 @@ namespace Automation4 { return dlg.LuaReadBack(L); } - // Factory methods + + /// @brief // Factory methods + /// LuaScriptFactory::LuaScriptFactory() {} + + /// @brief DOCME + /// LuaScriptFactory::~LuaScriptFactory() {} + + /// @brief DOCME + /// void LuaScriptFactory::RegisterFactory () { engine_name = _T("Lua"); @@ -930,6 +1129,10 @@ namespace Automation4 { Register(this); } + + /// @brief DOCME + /// @param filename + /// Script* LuaScriptFactory::Produce(const wxString &filename) const { // Just check if file extension is .lua @@ -945,3 +1148,4 @@ namespace Automation4 { #endif // WITH_AUTO4_LUA + diff --git a/aegisub/src/auto4_lua.h b/aegisub/src/auto4_lua.h index a18cddda1..86486c78b 100644 --- a/aegisub/src/auto4_lua.h +++ b/aegisub/src/auto4_lua.h @@ -37,6 +37,8 @@ #pragma once #ifndef _AUTO4_LUA_H + +/// DOCME #define _AUTO4_LUA_H #include "auto4_base.h" @@ -52,20 +54,38 @@ class wxWindow; + +/// DOCME namespace Automation4 { - // Provides access to an AssFile object (and all lines contained) for a Lua script + + /// DOCME + /// @class LuaAssFile + /// @brief DOCME + /// + /// DOCME class LuaAssFile { private: + + /// DOCME AssFile *ass; + + /// DOCME lua_State *L; + + /// DOCME bool can_modify; + + /// DOCME bool can_set_undo; void CheckAllowModify(); // throws an error if modification is disallowed - // keep a cursor of last accessed item to avoid walking over the entire file on every access + + /// DOCME std::list::iterator last_entry_ptr; + + /// DOCME int last_entry_id; void GetAssEntry(int n); // set last_entry_ptr to point to item n @@ -94,9 +114,16 @@ namespace Automation4 { }; - // Provides progress UI and control functions for a Lua script + + /// DOCME + /// @class LuaProgressSink + /// @brief DOCME + /// + /// DOCME class LuaProgressSink : public ProgressSink { private: + + /// DOCME lua_State *L; static int LuaSetProgress(lua_State *L); @@ -114,38 +141,96 @@ namespace Automation4 { }; - // Provides Config UI functions for a Lua script + + /// DOCME + /// @class LuaConfigDialogControl + /// @brief DOCME + /// + /// DOCME class LuaConfigDialogControl { public: + + /// DOCME wxControl *cw; // control window + + /// DOCME + + /// DOCME wxString name, hint; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int x, y, width, height; virtual wxControl *Create(wxWindow *parent) = 0; virtual void ControlReadBack() = 0; virtual void LuaReadBack(lua_State *L) = 0; + + /// @brief DOCME + /// @return + /// virtual bool CanSerialiseValue() { return false; } + + /// @brief DOCME + /// @return + /// virtual wxString SerialiseValue() { return _T(""); } + + /// @brief DOCME + /// @param serialised + /// virtual void UnserialiseValue(const wxString &serialised) { } LuaConfigDialogControl(lua_State *L); + + /// @brief DOCME + /// virtual ~LuaConfigDialogControl() { } }; + + /// DOCME + /// @class LuaConfigDialog + /// @brief DOCME + /// + /// DOCME class LuaConfigDialog : public ScriptConfigDialog { private: + + /// DOCME std::vector controls; + + /// DOCME std::vector buttons; + + /// DOCME bool use_buttons; + + /// DOCME + /// @class ButtonEventHandler + /// @brief DOCME + /// + /// DOCME class ButtonEventHandler : public wxEvtHandler { public: + + /// DOCME int *button_pushed; void OnButtonPush(wxCommandEvent &evt); }; + + /// DOCME ButtonEventHandler *button_event; + + /// DOCME int button_pushed; protected: @@ -163,10 +248,19 @@ namespace Automation4 { }; - // Second base-class for Lua implemented Features + + /// DOCME + /// @class LuaFeature + /// @brief DOCME + /// + /// DOCME class LuaFeature : public virtual Feature { protected: + + /// DOCME lua_State *L; + + /// DOCME int myid; LuaFeature(lua_State *_L, ScriptFeatureClass _featureclass, const wxString &_name); @@ -179,11 +273,18 @@ namespace Automation4 { }; - // Class of Lua scripts + + /// DOCME + /// @class LuaScript + /// @brief DOCME + /// + /// DOCME class LuaScript : public Script { friend class LuaFeature; private: + + /// DOCME lua_State *L; void Create(); // load script and create internal structures etc. @@ -205,12 +306,22 @@ namespace Automation4 { }; - // A single call to a Lua function, run inside a separate thread. - // This object should be created on the stack in the function that does the call. + + /// DOCME + /// @class LuaThreadedCall + /// @brief DOCME + /// + /// DOCME class LuaThreadedCall : public wxThread { private: + + /// DOCME lua_State *L; + + /// DOCME int nargs; + + /// DOCME int nresults; public: LuaThreadedCall(lua_State *_L, int _nargs, int _nresults); @@ -218,14 +329,24 @@ namespace Automation4 { }; - // Implementation of the Macro Feature for Lua scripts + + /// DOCME + /// @class LuaFeatureMacro + /// @brief DOCME + /// + /// DOCME class LuaFeatureMacro : public FeatureMacro, LuaFeature { private: + + /// DOCME bool no_validate; protected: LuaFeatureMacro(const wxString &_name, const wxString &_description, lua_State *_L); public: static int LuaRegister(lua_State *L); + + /// @brief DOCME + /// virtual ~LuaFeatureMacro() { } virtual bool Validate(AssFile *subs, const std::vector &selected, int active); @@ -233,10 +354,19 @@ namespace Automation4 { }; - // Implementation of the Export Filter Feature for Lua scripts + + /// DOCME + /// @class LuaFeatureFilter + /// @brief DOCME + /// + /// DOCME class LuaFeatureFilter : public FeatureFilter, LuaFeature { private: + + /// DOCME bool has_config; + + /// DOCME LuaConfigDialog *config_dialog; protected: @@ -248,6 +378,9 @@ namespace Automation4 { public: static int LuaRegister(lua_State *L); + + /// @brief DOCME + /// virtual ~LuaFeatureFilter() { } void ProcessSubs(AssFile *subs, wxWindow *export_dialog); @@ -257,3 +390,4 @@ namespace Automation4 { #endif + diff --git a/aegisub/src/auto4_lua_assfile.cpp b/aegisub/src/auto4_lua_assfile.cpp index 4e5363828..d5d45fa97 100644 --- a/aegisub/src/auto4_lua_assfile.cpp +++ b/aegisub/src/auto4_lua_assfile.cpp @@ -56,10 +56,16 @@ #include #include + +/// DOCME namespace Automation4 { // LuaAssFile + + /// @brief DOCME + /// @return + /// void LuaAssFile::CheckAllowModify() { if (can_modify) @@ -68,6 +74,11 @@ namespace Automation4 { lua_error(L); } + + /// @brief DOCME + /// @param L + /// @param e + /// void LuaAssFile::AssEntryToLua(lua_State *L, AssEntry *e) { lua_newtable(L); @@ -231,6 +242,11 @@ namespace Automation4 { lua_setfield(L, -2, "class"); } + + /// @brief DOCME + /// @param L + /// @return + /// AssEntry *LuaAssFile::LuaToAssEntry(lua_State *L) { // assume an assentry table is on the top of the stack @@ -254,6 +270,8 @@ namespace Automation4 { AssEntry *result; + +/// DOCME #define GETSTRING(varname, fieldname, lineclass) \ lua_getfield(L, -1, fieldname); \ if (!lua_isstring(L, -1)) { \ @@ -263,6 +281,8 @@ namespace Automation4 { } \ wxString varname (lua_tostring(L, -1), wxConvUTF8); \ lua_pop(L, 1); + +/// DOCME #define GETFLOAT(varname, fieldname, lineclass) \ lua_getfield(L, -1, fieldname); \ if (!lua_isnumber(L, -1)) { \ @@ -272,6 +292,8 @@ namespace Automation4 { } \ float varname = lua_tonumber(L, -1); \ lua_pop(L, 1); + +/// DOCME #define GETINT(varname, fieldname, lineclass) \ lua_getfield(L, -1, fieldname); \ if (!lua_isnumber(L, -1)) { \ @@ -281,6 +303,8 @@ namespace Automation4 { } \ int varname = lua_tointeger(L, -1); \ lua_pop(L, 1); + +/// DOCME #define GETBOOL(varname, fieldname, lineclass) \ lua_getfield(L, -1, fieldname); \ if (!lua_isboolean(L, -1)) { \ @@ -418,15 +442,27 @@ namespace Automation4 { return 0; } + +/// DOCME #undef GETSTRING + +/// DOCME #undef GETFLOAT + +/// DOCME #undef GETINT + +/// DOCME #undef GETBOOL //lua_pop(L, 1); // the function shouldn't eat the table it converted return result; } + + /// @brief DOCME + /// @param n + /// void LuaAssFile::GetAssEntry(int n) { entryIter e; @@ -460,6 +496,11 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectIndexRead(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, 1); @@ -538,6 +579,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectIndexWrite(lua_State *L) { // instead of implementing everything twice, just call the other modification-functions from here @@ -593,6 +639,11 @@ namespace Automation4 { } } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectGetLen(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, 1); @@ -600,6 +651,11 @@ namespace Automation4 { return 1; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectDelete(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, lua_upvalueindex(1)); @@ -648,6 +704,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectDeleteRange(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, lua_upvalueindex(1)); @@ -687,6 +748,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectAppend(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, lua_upvalueindex(1)); @@ -709,6 +775,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectInsert(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, lua_upvalueindex(1)); @@ -736,6 +807,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::ObjectGarbageCollect(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, 1); @@ -744,6 +820,11 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::LuaParseTagData(lua_State *L) { lua_newtable(L); @@ -751,6 +832,11 @@ namespace Automation4 { return 1; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::LuaUnparseTagData(lua_State *L) { lua_pushstring(L, ""); @@ -758,6 +844,11 @@ namespace Automation4 { return 1; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::LuaParseKaraokeData(lua_State *L) { AssEntry *e = LuaToAssEntry(L); @@ -887,6 +978,11 @@ namespace Automation4 { return 1; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaAssFile::LuaSetUndoPoint(lua_State *L) { LuaAssFile *laf = GetObjPointer(L, lua_upvalueindex(1)); @@ -907,6 +1003,12 @@ namespace Automation4 { return 0; } + + /// @brief DOCME + /// @param L + /// @param idx + /// @return + /// LuaAssFile *LuaAssFile::GetObjPointer(lua_State *L, int idx) { assert(lua_type(L, idx) == LUA_TUSERDATA); @@ -914,10 +1016,20 @@ namespace Automation4 { return *((LuaAssFile**)ud); } + + /// @brief DOCME + /// LuaAssFile::~LuaAssFile() { } + + /// @brief DOCME + /// @param _L + /// @param _ass + /// @param _can_modify + /// @param _can_set_undo + /// LuaAssFile::LuaAssFile(lua_State *_L, AssFile *_ass, bool _can_modify, bool _can_set_undo) : ass(_ass) , L(_L) @@ -971,3 +1083,4 @@ namespace Automation4 { #endif // WITH_AUTO4_LUA + diff --git a/aegisub/src/auto4_lua_dialog.cpp b/aegisub/src/auto4_lua_dialog.cpp index 6d1c17d69..fe98ff5a1 100644 --- a/aegisub/src/auto4_lua_dialog.cpp +++ b/aegisub/src/auto4_lua_dialog.cpp @@ -61,11 +61,17 @@ #include "colour_button.h" #include "ass_style.h" + +/// DOCME namespace Automation4 { // LuaConfigDialogControl + + /// @brief DOCME + /// @param L + /// LuaConfigDialogControl::LuaConfigDialogControl(lua_State *L) { // Assume top of stack is a control table (don't do checking) @@ -125,14 +131,28 @@ namespace Automation4 { wxLogDebug(_T("created control: '%s', (%d,%d)(%d,%d), '%s'"), name.c_str(), x, y, width, height, hint.c_str()); } + + /// DOCME namespace LuaControl { // Label + + /// DOCME + /// @class Label + /// @brief DOCME + /// + /// DOCME class Label : public LuaConfigDialogControl { public: + + /// DOCME wxString label; + + /// @brief DOCME + /// @param L + /// Label(lua_State *L) : LuaConfigDialogControl(L) { @@ -141,20 +161,35 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// virtual ~Label() { } // Doesn't have a serialisable value so don't implement that sub-interface + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { return cw = new wxStaticText(parent, -1, label); } + + /// @brief DOCME + /// void ControlReadBack() { // Nothing here } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { // Label doesn't produce output, so let it be nil @@ -165,10 +200,22 @@ namespace Automation4 { // Basic edit + + /// DOCME + /// @class Edit + /// @brief DOCME + /// + /// DOCME class Edit : public LuaConfigDialogControl { public: + + /// DOCME wxString text; + + /// @brief DOCME + /// @param L + /// Edit(lua_State *L) : LuaConfigDialogControl(L) { @@ -185,23 +232,43 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// virtual ~Edit() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return inline_string_encode(text); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { text = inline_string_decode(serialised); } + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { cw = new wxTextCtrl(parent, -1, text, wxDefaultPosition, wxDefaultSize, 0); @@ -209,11 +276,18 @@ namespace Automation4 { return cw; } + + /// @brief DOCME + /// void ControlReadBack() { text = ((wxTextCtrl*)cw)->GetValue(); } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushstring(L, text.mb_str(wxConvUTF8)); @@ -222,10 +296,22 @@ namespace Automation4 { }; + + /// DOCME + /// @class Color + /// @brief DOCME + /// + /// DOCME class Color : public LuaConfigDialogControl { public: + + /// DOCME wxString text; + + /// @brief DOCME + /// @param L + /// Color(lua_State *L) : LuaConfigDialogControl(L) { @@ -234,23 +320,43 @@ namespace Automation4 { lua_pop(L, 1); } + + /// @brief DOCME + /// virtual ~Color() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return inline_string_encode(text); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { text = inline_string_decode(serialised); } + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { AssColor colour; @@ -260,11 +366,18 @@ namespace Automation4 { return cw; } + + /// @brief DOCME + /// void ControlReadBack() { text = ((ColourButton*)cw)->GetColour().GetAsString(wxC2S_HTML_SYNTAX); } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushstring(L, text.mb_str(wxConvUTF8)); @@ -276,19 +389,37 @@ namespace Automation4 { // Multiline edit + + /// DOCME + /// @class Textbox + /// @brief DOCME + /// + /// DOCME class Textbox : public Edit { public: + + /// @brief DOCME + /// @param L + /// Textbox(lua_State *L) : Edit(L) { // Nothing more } + + /// @brief DOCME + /// virtual ~Textbox() { } // Same serialisation interface as single-line edit + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { cw = new wxTextCtrl(parent, -1, text, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); @@ -302,12 +433,30 @@ namespace Automation4 { // Integer only edit + + /// DOCME + /// @class IntEdit + /// @brief DOCME + /// + /// DOCME class IntEdit : public Edit { public: + + /// DOCME int value; + + /// DOCME bool hasspin; + + /// DOCME + + /// DOCME int min, max; + + /// @brief DOCME + /// @param L + /// IntEdit(lua_State *L) : Edit(L) { @@ -341,18 +490,33 @@ nospin: } } + + /// @brief DOCME + /// virtual ~IntEdit() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return wxString::Format(_T("%d"), value); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { long tmp; @@ -360,6 +524,11 @@ nospin: value = tmp; } + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { wxSpinCtrl *scw = new wxSpinCtrl(parent, -1, wxString::Format(_T("%d"), value), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value); @@ -368,11 +537,18 @@ nospin: return cw; } + + /// @brief DOCME + /// void ControlReadBack() { value = ((wxSpinCtrl*)cw)->GetValue(); } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushinteger(L, value); @@ -383,13 +559,31 @@ nospin: // Float only edit + + /// DOCME + /// @class FloatEdit + /// @brief DOCME + /// + /// DOCME class FloatEdit : public Edit { public: + + /// DOCME float value; + + /// DOCME bool hasspin; + + /// DOCME + + /// DOCME float min, max; // FIXME: Can't support spin button atm + + /// @brief DOCME + /// @param L + /// FloatEdit(lua_State *L) : Edit(L) { @@ -400,18 +594,33 @@ nospin: // TODO: spin button support } + + /// @brief DOCME + /// virtual ~FloatEdit() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return PrettyFloatF(value); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { double tmp; @@ -419,7 +628,14 @@ nospin: value = (float)tmp; } + + /// DOCME typedef wxValidator FloatTextValidator; + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { cw = new wxTextCtrl(parent, -1, PrettyFloatF(value), wxDefaultPosition, wxDefaultSize, 0); //, FloatTextValidator()); @@ -427,6 +643,9 @@ nospin: return cw; } + + /// @brief DOCME + /// void ControlReadBack() { double newval; @@ -436,6 +655,10 @@ nospin: } } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushnumber(L, value); @@ -446,11 +669,25 @@ nospin: // Dropdown + + /// DOCME + /// @class Dropdown + /// @brief DOCME + /// + /// DOCME class Dropdown : public LuaConfigDialogControl { public: + + /// DOCME wxArrayString items; + + /// DOCME wxString value; + + /// @brief DOCME + /// @param L + /// Dropdown(lua_State *L) : LuaConfigDialogControl(L) { @@ -469,23 +706,43 @@ nospin: lua_pop(L, 1); } + + /// @brief DOCME + /// virtual ~Dropdown() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return inline_string_encode(value); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { value = inline_string_decode(serialised); } + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { cw = new wxComboBox(parent, -1, value, wxDefaultPosition, wxDefaultSize, items, wxCB_READONLY); @@ -493,11 +750,18 @@ nospin: return cw; } + + /// @brief DOCME + /// void ControlReadBack() { value = ((wxComboBox*)cw)->GetValue(); } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushstring(L, value.mb_str(wxConvUTF8)); @@ -508,11 +772,25 @@ nospin: // Checkbox + + /// DOCME + /// @class Checkbox + /// @brief DOCME + /// + /// DOCME class Checkbox : public LuaConfigDialogControl { public: + + /// DOCME wxString label; + + /// DOCME bool value; + + /// @brief DOCME + /// @param L + /// Checkbox(lua_State *L) : LuaConfigDialogControl(L) { @@ -525,24 +803,44 @@ nospin: lua_pop(L, 1); } + + /// @brief DOCME + /// virtual ~Checkbox() { } + + /// @brief DOCME + /// @return + /// bool CanSerialiseValue() { return true; } + + /// @brief DOCME + /// @return + /// wxString SerialiseValue() { return value ? _T("1") : _T("0"); } + + /// @brief DOCME + /// @param serialised + /// void UnserialiseValue(const wxString &serialised) { // fixme? should this allow more different "false" values? value = (serialised == _T("0")) ? false : true; } + + /// @brief DOCME + /// @param parent + /// @return + /// wxControl *Create(wxWindow *parent) { cw = new wxCheckBox(parent, -1, label); @@ -551,11 +849,18 @@ nospin: return cw; } + + /// @brief DOCME + /// void ControlReadBack() { value = ((wxCheckBox*)cw)->GetValue(); } + + /// @brief DOCME + /// @param L + /// void LuaReadBack(lua_State *L) { lua_pushboolean(L, value); @@ -568,6 +873,11 @@ nospin: // LuaConfigDialog + + /// @brief DOCME + /// @param L + /// @param include_buttons + /// LuaConfigDialog::LuaConfigDialog(lua_State *L, bool include_buttons) : use_buttons(include_buttons) { @@ -653,12 +963,20 @@ badcontrol: } } + + /// @brief DOCME + /// LuaConfigDialog::~LuaConfigDialog() { for (size_t i = 0; i < controls.size(); ++i) delete controls[i]; } + + /// @brief DOCME + /// @param parent + /// @return + /// wxWindow* LuaConfigDialog::CreateWindow(wxWindow *parent) { wxWindow *w = new wxPanel(parent); @@ -706,6 +1024,11 @@ badcontrol: return w; } + + /// @brief DOCME + /// @param L + /// @return + /// int LuaConfigDialog::LuaReadBack(lua_State *L) { // First read back which button was pressed, if any @@ -740,6 +1063,10 @@ badcontrol: } } + + /// @brief DOCME + /// @return + /// wxString LuaConfigDialog::Serialise() { if (controls.size() == 0) @@ -763,6 +1090,10 @@ badcontrol: return res; } + + /// @brief DOCME + /// @param serialised + /// void LuaConfigDialog::Unserialise(const wxString &serialised) { // Split by pipe @@ -782,6 +1113,9 @@ badcontrol: } } + + /// @brief DOCME + /// void LuaConfigDialog::ReadBack() { for (size_t i = 0; i < controls.size(); ++i) { @@ -789,6 +1123,10 @@ badcontrol: } } + + /// @brief DOCME + /// @param evt + /// void LuaConfigDialog::ButtonEventHandler::OnButtonPush(wxCommandEvent &evt) { // Let button_pushed == 0 mean "cancelled", such that pushing Cancel or closing the dialog @@ -818,3 +1156,4 @@ badcontrol: #endif // WITH_AUTO4_LUA + diff --git a/aegisub/src/auto4_lua_factory.h b/aegisub/src/auto4_lua_factory.h index 0904c29c2..27766acfb 100644 --- a/aegisub/src/auto4_lua_factory.h +++ b/aegisub/src/auto4_lua_factory.h @@ -37,13 +37,22 @@ #pragma once #ifndef _AUTO4_LUA_FACTORY_H + +/// DOCME #define _AUTO4_LUA_FACTORY_H #include "auto4_base.h" + +/// DOCME namespace Automation4 { - // Factory class for Lua scripts + + /// DOCME + /// @class LuaScriptFactory + /// @brief DOCME + /// + /// DOCME class LuaScriptFactory : public ScriptFactory { public: LuaScriptFactory(); @@ -56,3 +65,4 @@ namespace Automation4 { #endif + diff --git a/aegisub/src/auto4_lua_scriptreader.cpp b/aegisub/src/auto4_lua_scriptreader.cpp index 534481a06..9bc765bff 100644 --- a/aegisub/src/auto4_lua_scriptreader.cpp +++ b/aegisub/src/auto4_lua_scriptreader.cpp @@ -40,9 +40,14 @@ #include "auto4_lua_scriptreader.h" + +/// DOCME namespace Automation4 { - // LuaScriptReader + + /// @brief // LuaScriptReader + /// @param filename + /// LuaScriptReader::LuaScriptReader(const wxString &filename) { #ifdef WIN32 @@ -56,6 +61,9 @@ namespace Automation4 { databuf = new char[bufsize]; } + + /// @brief DOCME + /// LuaScriptReader::~LuaScriptReader() { if (databuf) @@ -63,6 +71,12 @@ namespace Automation4 { fclose(f); } + + /// @brief DOCME + /// @param L + /// @param data + /// @param size + /// const char* LuaScriptReader::reader_func(lua_State *L, void *data, size_t *size) { LuaScriptReader *self = (LuaScriptReader*)(data); @@ -113,3 +127,4 @@ namespace Automation4 { #endif // WITH_AUTO4_LUA + diff --git a/aegisub/src/auto4_lua_scriptreader.h b/aegisub/src/auto4_lua_scriptreader.h index 87d575fd4..782ddb3a6 100644 --- a/aegisub/src/auto4_lua_scriptreader.h +++ b/aegisub/src/auto4_lua_scriptreader.h @@ -43,13 +43,24 @@ #include "lua.hpp" #endif + +/// DOCME namespace Automation4 { - // Manage reading in a Lua script file + + /// DOCME struct LuaScriptReader { + + /// DOCME FILE *f; + + /// DOCME bool first; + + /// DOCME char *databuf; + + /// DOCME static const size_t bufsize = 512; LuaScriptReader(const wxString &filename); ~LuaScriptReader(); @@ -61,3 +72,4 @@ namespace Automation4 { + diff --git a/aegisub/src/avisynth_wrap.cpp b/aegisub/src/avisynth_wrap.cpp index e38c74bbf..853b863e6 100644 --- a/aegisub/src/avisynth_wrap.cpp +++ b/aegisub/src/avisynth_wrap.cpp @@ -47,7 +47,13 @@ #ifdef DEBUG_AVISYNTH_CODE #include "main.h" #include "wx/textfile.h" + +/// DOCME wxTextFile avs_trace_file; + +/// @brief DOCME +/// @param s +/// void DoAvsTrace(const wxString &s) { if (!avs_trace_file.IsOpened()) { @@ -63,16 +69,23 @@ void DoAvsTrace(const wxString &s) #endif -/////////////////////////////// -// Static field initialization + +/// DOCME int AviSynthWrapper::avs_refcount = 0; + +/// DOCME HINSTANCE AviSynthWrapper::hLib = NULL; + +/// DOCME IScriptEnvironment *AviSynthWrapper::env = NULL; + +/// DOCME wxMutex AviSynthWrapper::AviSynthMutex; -//////////////////////// -// AviSynth constructor + +/// @brief AviSynth constructor +/// AviSynthWrapper::AviSynthWrapper() { if (!avs_refcount) { AVSTRACE(_T("Avisynth not loaded, trying to load it now...")); @@ -116,8 +129,9 @@ AviSynthWrapper::AviSynthWrapper() { } -/////////////////////// -// AviSynth destructor + +/// @brief AviSynth destructor +/// AviSynthWrapper::~AviSynthWrapper() { AVSTRACE(_T("Decreasing reference count")); if (!--avs_refcount) { @@ -130,11 +144,13 @@ AviSynthWrapper::~AviSynthWrapper() { } -/////////////////// -// Get environment + +/// @brief Get environment +/// IScriptEnvironment *AviSynthWrapper::GetEnv() { return env; } #endif + diff --git a/aegisub/src/avisynth_wrap.h b/aegisub/src/avisynth_wrap.h index 8a6a6646a..1e7c489d4 100644 --- a/aegisub/src/avisynth_wrap.h +++ b/aegisub/src/avisynth_wrap.h @@ -36,6 +36,8 @@ #ifndef AVISYNTH_WRAP_H + +/// DOCME #define AVISYNTH_WRAP_H @@ -48,8 +50,8 @@ #include "avisynth.h" -////////////////////////////////// -// Typedef to make my life easier + +/// DOCME typedef IScriptEnvironment* __stdcall FUNC(int); @@ -57,21 +59,37 @@ typedef IScriptEnvironment* __stdcall FUNC(int); // Avisynth debugging stuff #ifdef DEBUG_AVISYNTH_CODE void DoAvsTrace(const wxString &s); + +/// DOCME #define AVSTRACE(s) DoAvsTrace(s) #else + +/// DOCME #define AVSTRACE(s) #endif -/////////////////////////// -// AviSynth wrapping class + +/// DOCME +/// @class AviSynthWrapper +/// @brief DOCME +/// +/// DOCME class AviSynthWrapper { private: + + /// DOCME static int avs_refcount; + + /// DOCME static HINSTANCE hLib; protected: + + /// DOCME static IScriptEnvironment *env; public: + + /// DOCME static wxMutex AviSynthMutex; IScriptEnvironment *GetEnv(); @@ -82,3 +100,4 @@ public: #endif #endif + diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index b5560b642..d741a1a0b 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -55,8 +55,15 @@ #include "audio_display.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param pos +/// @param size +/// @param style +/// @param name +/// BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxWindow(parent, id, pos, size, style, name) { @@ -84,15 +91,17 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx } -////////////// -// Destructor + +/// @brief Destructor +/// BaseGrid::~BaseGrid() { delete bmp; } -//////////////// -// Update style + +/// @brief Update style +/// void BaseGrid::UpdateStyle() { // Set font wxString fontname = Options.AsText(_T("Grid Font Face")); @@ -120,8 +129,9 @@ void BaseGrid::UpdateStyle() { } -/////////////// -// Clears grid + +/// @brief Clears grid +/// void BaseGrid::Clear () { diagMap.clear(); diagPtrMap.clear(); @@ -131,23 +141,29 @@ void BaseGrid::Clear () { } -/////////////// -// Begin batch + +/// @brief Begin batch +/// void BaseGrid::BeginBatch() { //Freeze(); } -///////////// -// End batch + +/// @brief End batch +/// void BaseGrid::EndBatch() { //Thaw(); AdjustScrollbar(); } -////////////////////// -// Makes cell visible + +/// @brief Makes cell visible +/// @param row +/// @param col +/// @param center +/// void BaseGrid::MakeCellVisible(int row, int col,bool center) { // Update last row selection lastRow = row; @@ -176,8 +192,12 @@ void BaseGrid::MakeCellVisible(int row, int col,bool center) { } -//////////////// -// Select a row + +/// @brief Select a row +/// @param row +/// @param addToSelected +/// @param select +/// void BaseGrid::SelectRow(int row, bool addToSelected, bool select) { // Sanity checking if (row >= GetRows()) row = GetRows()-1; @@ -203,8 +223,9 @@ void BaseGrid::SelectRow(int row, bool addToSelected, bool select) { } -///////////////////////// -// Selects visible lines + +/// @brief Selects visible lines +/// void BaseGrid::SelectVisible() { int rows = GetRows(); bool selectedOne = false; @@ -223,8 +244,9 @@ void BaseGrid::SelectVisible() { } -/////////////////////// -// Unselects all cells + +/// @brief Unselects all cells +/// void BaseGrid::ClearSelection() { int rows = selMap.size(); for (int i=0;i= GetRows() || row < 0) return false; (void) col; @@ -248,8 +274,10 @@ bool BaseGrid::IsInSelection(int row, int col) const { } -/////////////////////////// -// Number of selected rows + +/// @brief Number of selected rows +/// @return +/// int BaseGrid::GetNumberSelection() { int count = 0; int rows = selMap.size(); @@ -260,8 +288,10 @@ int BaseGrid::GetNumberSelection() { } -/////////////////////////// -// Gets first selected row + +/// @brief Gets first selected row +/// @return +/// int BaseGrid::GetFirstSelRow() { int nrows = GetRows(); for (int i=0;iIsLoaded()) return false; int f1 = VFR_Output.GetFrameAtTime(line->Start.GetMS(),true); @@ -935,8 +994,9 @@ bool BaseGrid::IsDisplayed(AssDialogue *line) { } -/////////////// -// Update maps + +/// @brief Update maps +/// void BaseGrid::UpdateMaps() { // Store old int len = diagMap.size(); @@ -981,8 +1041,11 @@ void BaseGrid::UpdateMaps() { } -///////////// -// Key press + +/// @brief Key press +/// @param event +/// @return +/// void BaseGrid::OnKeyPress(wxKeyEvent &event) { // Get size int w,h; @@ -1099,8 +1162,11 @@ void BaseGrid::OnKeyPress(wxKeyEvent &event) { } -//////////////////////////////// -// Sets display by frame or not + +/// @brief Sets display by frame or not +/// @param state +/// @return +/// void BaseGrid::SetByFrame (bool state) { // Check if it's already the same if (byFrame == state) return; @@ -1110,8 +1176,11 @@ void BaseGrid::SetByFrame (bool state) { } -/////////////////////////////////////////////// -// Generates an array covering inclusive range + +/// @brief Generates an array covering inclusive range +/// @param n1 +/// @param n2 +/// wxArrayInt BaseGrid::GetRangeArray(int n1,int n2) { // Swap if in wrong order if (n2 < n1) { @@ -1128,3 +1197,4 @@ wxArrayInt BaseGrid::GetRangeArray(int n1,int n2) { return target; } + diff --git a/aegisub/src/base_grid.h b/aegisub/src/base_grid.h index 68d50d2ea..f8fcfdcf1 100644 --- a/aegisub/src/base_grid.h +++ b/aegisub/src/base_grid.h @@ -52,20 +52,42 @@ class AssEntry; class AssDialogue; class SubsEditBox; class FrameMain; + +/// DOCME typedef std::list::iterator entryIter; -/////////////////// -// Base grid class + +/// DOCME +/// @class BaseGrid +/// @brief DOCME +/// +/// DOCME class BaseGrid : public wxWindow { private: + + /// DOCME int lineHeight; + + /// DOCME int colWidth[16]; + + /// DOCME int lastRow; + + /// DOCME int extendRow; + + /// DOCME bool holding; + + /// DOCME wxFont font; + + /// DOCME wxScrollBar *scrollBar; + + /// DOCME wxBitmap *bmp; void OnPaint(wxPaintEvent &event); @@ -77,19 +99,39 @@ private: void DrawImage(wxDC &dc); protected: + + /// DOCME FrameMain *parentFrame; + + /// DOCME bool showCol[16]; + + /// @brief DOCME + /// @param alternate=false + /// virtual void OnPopupMenu(bool alternate=false) {} void ScrollTo(int y); + + /// DOCME int yPos; public: + + /// DOCME SubsEditBox *editBox; + + /// DOCME bool byFrame; + + /// DOCME std::vector diagMap; + + /// DOCME std::vector diagPtrMap; + + /// DOCME std::vector selMap; void AdjustScrollbar(); @@ -128,6 +170,9 @@ public: /////// // IDs enum { + + /// DOCME GRID_SCROLLBAR = 1730 }; + diff --git a/aegisub/src/browse_button.cpp b/aegisub/src/browse_button.cpp index 9aab64877..fa900d18e 100644 --- a/aegisub/src/browse_button.cpp +++ b/aegisub/src/browse_button.cpp @@ -47,8 +47,15 @@ #include "standard_paths.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param text +/// @param _type +/// @param position +/// @param size +/// BrowseButton::BrowseButton(wxWindow *parent,int id,wxString text,BrowseType _type,wxPoint position,wxSize size) : wxButton (parent,id,text == wxString(_T("")) ? wxString(_("Browse...")) : text,position,size) { @@ -59,15 +66,20 @@ BrowseButton::BrowseButton(wxWindow *parent,int id,wxString text,BrowseType _typ } -//////// -// Bind + +/// @brief Bind +/// @param control +/// @param pos +/// void BrowseButton::Bind(wxTextCtrl *control,int pos) { ctrl[pos] = control; } -/////////// -// Pressed + +/// @brief Pressed +/// @param event +/// void BrowseButton::OnPressed(wxCommandEvent &event) { // Folder if (type == BROWSE_FOLDER) { @@ -103,3 +115,4 @@ void BrowseButton::OnPressed(wxCommandEvent &event) { + diff --git a/aegisub/src/browse_button.h b/aegisub/src/browse_button.h index 59b00b387..7b11e3275 100644 --- a/aegisub/src/browse_button.h +++ b/aegisub/src/browse_button.h @@ -45,20 +45,34 @@ #include -/////////////// -// Browse type + +/// DOCME enum BrowseType { + + /// DOCME BROWSE_FILE, + + /// DOCME BROWSE_FOLDER, + + /// DOCME BROWSE_FONT }; -/////////////////////// -// Browse button class + +/// DOCME +/// @class BrowseButton +/// @brief DOCME +/// +/// DOCME class BrowseButton : public wxButton { private: + + /// DOCME wxTextCtrl *ctrl[2]; + + /// DOCME BrowseType type; void OnPressed(wxCommandEvent &event); @@ -68,3 +82,4 @@ public: void Bind(wxTextCtrl *control,int pos=0); }; + diff --git a/aegisub/src/charset_conv.cpp b/aegisub/src/charset_conv.cpp index 6f84e358e..f7e6ec724 100644 --- a/aegisub/src/charset_conv.cpp +++ b/aegisub/src/charset_conv.cpp @@ -44,20 +44,39 @@ WX_DECLARE_STRING_HASH_MAP(wxString, PrettyNamesHash); #if wxUSE_THREADS + +/// DOCME static wxMutex encodingListMutex; #endif + +/// DOCME static const iconv_t iconv_invalid = (iconv_t)-1; + +/// DOCME static const size_t iconv_failed = (size_t)-1; + +/// DOCME #define ICONV_CONST_CAST(a) const_cast(a) #ifndef ICONV_POSIX static int addEncoding(unsigned int namescount, const char * const * names, void* data); #endif + +/// DOCME static wxArrayString *supportedEncodings = NULL; + +/// DOCME static wxArrayString *prettyEncodingList = NULL; + +/// DOCME static PrettyNamesHash *prettyEncodingHash = NULL; + +/// @brief DOCME +/// @param mbEncName +/// @param enableSubst +/// AegisubCSConv::AegisubCSConv(const wxChar *mbEncName, bool enableSubst) : mbCharsetName(GetRealEncodingName(mbEncName)), mbNulLen(0), enableSubst(enableSubst) { @@ -85,17 +104,27 @@ AegisubCSConv::AegisubCSConv(const wxChar *mbEncName, bool enableSubst) #endif } } + +/// @brief DOCME +/// AegisubCSConv::~AegisubCSConv() { if (m2w != iconv_invalid) iconv_close(m2w); if (w2m != iconv_invalid) iconv_close(w2m); } + +/// @brief DOCME +/// @return +/// wxMBConv * AegisubCSConv::Clone() const { AegisubCSConv *c = new AegisubCSConv(mbCharsetName); c->mbNulLen = mbNulLen; return c; } -// Calculate the size of NUL in the target encoding via iconv + +/// @brief Calculate the size of NUL in the target encoding via iconv +/// @return +/// size_t AegisubCSConv::GetMBNulLen() const { if (mbNulLen == 0) { const wchar_t nulStr[] = L""; @@ -115,7 +144,11 @@ size_t AegisubCSConv::GetMBNulLen() const { return mbNulLen; } -// Calculate the length (in bytes) of a MB string, not including the terminator + +/// @brief Calculate the length (in bytes) of a MB string, not including the terminator +/// @param str +/// @return +/// size_t AegisubCSConv::MBBuffLen(const char * str) const { size_t nulLen = GetMBNulLen(); const char *ptr; @@ -133,6 +166,14 @@ size_t AegisubCSConv::MBBuffLen(const char * str) const { } } + +/// @brief DOCME +/// @param dst +/// @param dstSize +/// @param src +/// @param srcLen +/// @return +/// size_t AegisubCSConv::ToWChar(wchar_t *dst, size_t dstSize, const char *src, size_t srcLen) const { return doConversion( m2w, @@ -143,6 +184,14 @@ size_t AegisubCSConv::ToWChar(wchar_t *dst, size_t dstSize, const char *src, siz ) / sizeof(wchar_t); } + +/// @brief DOCME +/// @param dst +/// @param dstSize +/// @param src +/// @param srcLen +/// @return +/// size_t AegisubCSConv::FromWChar(char *dst, size_t dstSize, const wchar_t *src, size_t srcLen) const { return doConversion( w2m, @@ -153,6 +202,15 @@ size_t AegisubCSConv::FromWChar(char *dst, size_t dstSize, const wchar_t *src, s ); } + +/// @brief DOCME +/// @param cd +/// @param dst +/// @param dstSize +/// @param src +/// @param srcSize +/// @return +/// size_t AegisubCSConv::doConversion(iconv_t cd, char *dst, size_t dstSize, char *src, size_t srcSize) const { if (dstSize > 0) { return iconvWrapper(cd, &src, &srcSize, &dst, &dstSize); @@ -176,6 +234,15 @@ size_t AegisubCSConv::doConversion(iconv_t cd, char *dst, size_t dstSize, char * return charsWritten; } + +/// @brief DOCME +/// @param cd +/// @param inbuf +/// @param inbytesleft +/// @param outbuf +/// @param outbytesleft +/// @return +/// size_t AegisubCSConv::iconvWrapper(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) const { @@ -236,6 +303,16 @@ size_t AegisubCSConv::iconvWrapper(iconv_t cd, char **inbuf, size_t *inbytesleft #endif } + +/// @brief DOCME +/// @param code +/// @param buf +/// @param buflen +/// @param callback_arg) +/// @param callback_arg +/// @param convPtr +/// @return +/// void AegisubCSConv::ucToMbFallback( unsigned int code, void (*callback) (const char *buf, size_t buflen, void* callback_arg), @@ -253,6 +330,13 @@ void AegisubCSConv::ucToMbFallback( } #ifndef ICONV_POSIX + +/// @brief DOCME +/// @param namescount +/// @param names +/// @param data +/// @return +/// int addEncoding(unsigned int namescount, const char * const * names, void* data) { for (unsigned int i = 0; i < namescount; i++) { supportedEncodings->Add(wxString::FromAscii(names[i])); @@ -261,6 +345,10 @@ int addEncoding(unsigned int namescount, const char * const * names, void* data) } #endif + +/// @brief DOCME +/// @return +/// wxArrayString AegisubCSConv::GetAllSupportedEncodings() { #if wxUSE_THREADS wxMutexLocker lock(encodingListMutex); @@ -275,7 +363,11 @@ wxArrayString AegisubCSConv::GetAllSupportedEncodings() { return *supportedEncodings; } -// Map pretty names to the real encoding names + +/// @brief Map pretty names to the real encoding names +/// @param name +/// @return +/// wxString AegisubCSConv::GetRealEncodingName(wxString name) { if (name.Lower() == _T("local")) return wxLocale::GetSystemEncodingName(); if (prettyEncodingList == NULL) return name; @@ -287,6 +379,9 @@ wxString AegisubCSConv::GetRealEncodingName(wxString name) { return name; } + +/// @brief DOCME +/// wxArrayString AegisubCSConv::GetEncodingsList() { #if wxUSE_THREADS wxMutexLocker lock(encodingListMutex); @@ -438,3 +533,4 @@ wxArrayString AegisubCSConv::GetEncodingsList() { static AegisubCSConv localConv(_T("Local"), false); AegisubCSConv& csConvLocal(localConv); + diff --git a/aegisub/src/charset_conv.h b/aegisub/src/charset_conv.h index c8c626347..bacaa9e52 100644 --- a/aegisub/src/charset_conv.h +++ b/aegisub/src/charset_conv.h @@ -35,6 +35,8 @@ /// #ifndef AEGISUB_CHARSET_CONV_H + +/// DOCME #define AEGISUB_CHARSET_CONV_H #include @@ -47,9 +49,17 @@ #include "aegisub_endian.h" #if !defined(_LIBICONV_VERSION) || _LIBICONV_VERSION < 0x010A || defined(LIBICONV_PLUG) + +/// DOCME #define ICONV_POSIX #endif + +/// DOCME +/// @class AegisubCSConv +/// @brief DOCME +/// +/// DOCME class AegisubCSConv : public wxMBConv { public: // By default, any conversion that would be lossy will fail @@ -76,12 +86,24 @@ public: static wxString GetRealEncodingName(wxString name); protected: + + /// DOCME + + /// DOCME iconv_t m2w, w2m; private: + + /// DOCME wxString wcCharsetName; + + /// DOCME wxString mbCharsetName; + + /// DOCME size_t mbNulLen; + + /// DOCME bool enableSubst; size_t doConversion(iconv_t cd, char *dst, size_t dstSize, char *src, size_t srcSize) const; @@ -92,15 +114,22 @@ private: void (*callback) (const char *buf, size_t buflen, void* callback_arg), void *callback_arg, void *convPtr); + + /// DOCME char invalidRep[8]; + + /// DOCME size_t invalidRepSize; #ifndef ICONV_POSIX + + /// DOCME iconv_fallbacks fallbacks; #endif #if wxUSE_THREADS - // While iconv itself is thread-safe, using the same iconv_t on multiple threads is not + + /// DOCME wxMutex iconvMutex; #endif }; @@ -110,23 +139,36 @@ extern AegisubCSConv& csConvLocal; #ifdef HAVE_BIG_ENDIAN # if SIZEOF_WCHAR_T == 4 + +/// DOCME # define WCHAR_T_ENCODING "UTF-32BE" # elif SIZEOF_WCHAR_T == 2 + +/// DOCME # define WCHAR_T_ENCODING "UTF-16BE" # endif #elif defined(HAVE_LITTLE_ENDIAN) # if SIZEOF_WCHAR_T == 4 + +/// DOCME # define WCHAR_T_ENCODING "UTF-32LE" # elif SIZEOF_WCHAR_T == 2 + +/// DOCME # define WCHAR_T_ENCODING "UTF-16LE" # endif #else # if SIZEOF_WCHAR_T == 4 + +/// DOCME # define WCHAR_T_ENCODING ((Endian::MachineToBig((uint32_t)1) == 1) ? "UTF-32BE" : "UTF-32LE") # elif SIZEOF_WCHAR_T == 2 + +/// DOCME # define WCHAR_T_ENCODING ((Endian::MachineToBig((uint32_t)1) == 1) ? "UTF-16BE" : "UTF-16LE") # endif #endif #endif + diff --git a/aegisub/src/charset_detect.cpp b/aegisub/src/charset_detect.cpp index 7547e421c..9c93da34f 100644 --- a/aegisub/src/charset_detect.cpp +++ b/aegisub/src/charset_detect.cpp @@ -48,15 +48,29 @@ #include + +/// DOCME struct CharDetResult { + + /// DOCME float confidence; + + /// DOCME wxString name; + + /// @brief DOCME + /// @param par + /// @return + /// bool operator < (CharDetResult &par) { return confidence > par.confidence; } }; -//////////////// -// Get encoding + +/// @brief Get encoding +/// @param filename +/// @return +/// wxString CharSetDetect::GetEncoding(wxString filename) { std::ifstream file; #ifdef __WINDOWS__ @@ -148,8 +162,10 @@ wxString CharSetDetect::GetEncoding(wxString filename) { return result; } -////////// -// Report + +/// @brief Report +/// @param aCharset +/// void CharSetDetect::Report(const char* aCharset) { // Store the result reported result = wxString(aCharset,wxConvUTF8); @@ -157,3 +173,4 @@ void CharSetDetect::Report(const char* aCharset) { #endif // WITH_UNIVCHARDET + diff --git a/aegisub/src/charset_detect.h b/aegisub/src/charset_detect.h index bd79ec8ee..74640e467 100644 --- a/aegisub/src/charset_detect.h +++ b/aegisub/src/charset_detect.h @@ -43,15 +43,25 @@ #include "../universalchardet/nsUniversalDetector.h" -///////////////////////////////// -// Character set detection class + +/// DOCME +/// @class CharSetDetect +/// @brief DOCME +/// +/// DOCME class CharSetDetect : public nsUniversalDetector { private: + + /// DOCME wxString result; void Report(const char* aCharset); public: wxString GetEncoding(wxString filename); + + /// @brief DOCME + /// PRBool done() const { return mDone; } }; + diff --git a/aegisub/src/colorspace.cpp b/aegisub/src/colorspace.cpp index 4b695714a..b78e02b0f 100644 --- a/aegisub/src/colorspace.cpp +++ b/aegisub/src/colorspace.cpp @@ -40,7 +40,15 @@ #include "utils.h" -// matrix from http://forum.doom9.org/showthread.php?p=684080#post684080 + +/// @brief matrix from http://forum.doom9.org/showthread.php?p=684080#post684080 +/// @param Y +/// @param U +/// @param V +/// @param R +/// @param G +/// @param B +/// void yuv_to_rgb(int Y, int U, int V, unsigned char *R, unsigned char *G, unsigned char *B) { U = U - 128; @@ -51,8 +59,16 @@ void yuv_to_rgb(int Y, int U, int V, unsigned char *R, unsigned char *G, unsigne } -// algorithm from http://130.113.54.154/~monger/hsl-rgb.html -// making every value into 0..255 range though + +/// @brief making every value into 0..255 range though algorithm from http://130.113.54.154/~monger/hsl-rgb.html +/// @param H +/// @param S +/// @param L +/// @param R +/// @param G +/// @param B +/// @return +/// void hsl_to_rgb(int H, int S, int L, unsigned char *R, unsigned char *G, unsigned char *B) { if (S == 0) { @@ -153,8 +169,16 @@ void hsl_to_rgb(int H, int S, int L, unsigned char *R, unsigned char *G, unsigne } -// formulas taken from wikipedia: http://en.wikipedia.org/wiki/HSV_color_space -// the range for H is 0..255 instead of 0..359, so 60 degrees has been translated to 256/6 here + +/// @brief the range for H is 0..255 instead of 0..359, so 60 degrees has been translated to 256/6 here formulas taken from wikipedia: http://en.wikipedia.org/wiki/HSV_color_space +/// @param H +/// @param S +/// @param V +/// @param R +/// @param G +/// @param B +/// @return +/// void hsv_to_rgb(int H, int S, int V, unsigned char *R, unsigned char *G, unsigned char *B) { *R = *G = *B = 0; @@ -257,7 +281,15 @@ void hsv_to_rgb(int H, int S, int V, unsigned char *R, unsigned char *G, unsigne } -// matrix from http://forum.doom9.org/showthread.php?p=684080#post684080 + +/// @brief matrix from http://forum.doom9.org/showthread.php?p=684080#post684080 +/// @param R +/// @param G +/// @param B +/// @param Y +/// @param U +/// @param V +/// void rgb_to_yuv(int R, int G, int B, unsigned char *Y, unsigned char *U, unsigned char *V) { *Y = clip_colorval(( int(0.299*65536) * R + int(0.587*65536) * G + int(0.114*65536) * B) / 65536); @@ -266,8 +298,15 @@ void rgb_to_yuv(int R, int G, int B, unsigned char *Y, unsigned char *U, unsigne } -// also from http://130.113.54.154/~monger/hsl-rgb.html -// still keeping everything integer + +/// @brief still keeping everything integer also from http://130.113.54.154/~monger/hsl-rgb.html +/// @param R +/// @param G +/// @param B +/// @param H +/// @param S +/// @param L +/// void rgb_to_hsl(int R, int G, int B, unsigned char *H, unsigned char *S, unsigned char *L) { float r = R/255.f, g = G/255.f, b = B/255.f; @@ -304,7 +343,15 @@ void rgb_to_hsl(int R, int G, int B, unsigned char *H, unsigned char *S, unsigne } -// formulas from http://en.wikipedia.org/wiki/HSV_color_space + +/// @brief formulas from http://en.wikipedia.org/wiki/HSV_color_space +/// @param R +/// @param G +/// @param B +/// @param H +/// @param S +/// @param V +/// void rgb_to_hsv(int R, int G, int B, unsigned char *H, unsigned char *S, unsigned char *V) { float r = R/255.f, g = G/255.f, b = B/255.f; @@ -339,6 +386,15 @@ void rgb_to_hsv(int R, int G, int B, unsigned char *H, unsigned char *S, unsigne } + +/// @brief DOCME +/// @param iH +/// @param iS +/// @param iV +/// @param oH +/// @param oS +/// @param oL +/// void hsv_to_hsl(int iH, int iS, int iV, unsigned char *oH, unsigned char *oS, unsigned char *oL) { int p = iV * (255 - iS); @@ -354,6 +410,16 @@ void hsv_to_hsl(int iH, int iS, int iV, unsigned char *oH, unsigned char *oS, un } + +/// @brief DOCME +/// @param iH +/// @param iS +/// @param iL +/// @param oH +/// @param oS +/// @param oV +/// @return +/// void hsl_to_hsv(int iH, int iS, int iL, unsigned char *oH, unsigned char *oS, unsigned char *oV) { *oH = iH; @@ -374,12 +440,21 @@ void hsl_to_hsv(int iH, int iS, int iL, unsigned char *oH, unsigned char *oS, un } + +/// @brief DOCME +/// @param color +/// @return +/// wxString color_to_html(wxColour color) { return wxString::Format(_T("#%02X%02X%02X"), color.Red(), color.Green(), color.Blue()); } + +/// @brief DOCME +/// @param html +/// wxColour html_to_color(wxString html) { html.Trim(true); @@ -418,3 +493,4 @@ wxColour html_to_color(wxString html) } + diff --git a/aegisub/src/colorspace.h b/aegisub/src/colorspace.h index a39b9d776..578526945 100644 --- a/aegisub/src/colorspace.h +++ b/aegisub/src/colorspace.h @@ -35,6 +35,8 @@ /// #ifndef COLORSPACE_H + +/// DOCME #define COLORSPACE_H #include @@ -42,6 +44,10 @@ #include + +/// @brief DOCME +/// @param val +/// inline unsigned int clip_colorval(int val) { if (val < 0) return 0; @@ -82,3 +88,4 @@ wxColour html_to_color(wxString html); #endif + diff --git a/aegisub/src/colour_button.cpp b/aegisub/src/colour_button.cpp index d98693700..fdc7f86f8 100644 --- a/aegisub/src/colour_button.cpp +++ b/aegisub/src/colour_button.cpp @@ -44,8 +44,13 @@ #include "dialog_colorpicker.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param size +/// @param col +/// ColourButton::ColourButton(wxWindow* parent, wxWindowID id, const wxSize& size, wxColour col) { // Variables linkColour = NULL; @@ -62,14 +67,17 @@ ColourButton::ColourButton(wxWindow* parent, wxWindowID id, const wxSize& size, } -////////////// -// Destructor + +/// @brief Destructor +/// ColourButton::~ColourButton() { } -////////////// -// Set colour + +/// @brief Set colour +/// @param col +/// void ColourButton::SetColour(wxColour col) { // Set colour colour = col; @@ -90,15 +98,19 @@ void ColourButton::SetColour(wxColour col) { } -////////////// -// Get Colour + +/// @brief Get Colour +/// @return +/// wxColour ColourButton::GetColour() { return colour; } -///////// -// Click + +/// @brief Click +/// @param event +/// void ColourButton::OnClick(wxCommandEvent &event) { DialogColorPicker dlg(GetParent(), colour); if (dlg.ShowModal() == wxID_OK) { @@ -108,10 +120,13 @@ void ColourButton::OnClick(wxCommandEvent &event) { } -/////////////////// -// Set Link Colour + +/// @brief Set Link Colour +/// @param col +/// void ColourButton::SetLinkColour(wxColour *col) { linkColour = col; if (linkColour) SetColour(*linkColour); } + diff --git a/aegisub/src/colour_button.h b/aegisub/src/colour_button.h index b1a548a7a..b78bea953 100644 --- a/aegisub/src/colour_button.h +++ b/aegisub/src/colour_button.h @@ -44,12 +44,22 @@ #include -/////////////////////// -// Colour Button class + +/// DOCME +/// @class ColourButton +/// @brief DOCME +/// +/// DOCME class ColourButton: public wxBitmapButton { private: + + /// DOCME wxBitmap bmp; + + /// DOCME wxColour colour; + + /// DOCME wxColour *linkColour; void OnClick(wxCommandEvent &event); @@ -63,3 +73,4 @@ public: void SetLinkColour(wxColour *colour); }; + diff --git a/aegisub/src/dialog_about.cpp b/aegisub/src/dialog_about.cpp index 90aadd1c8..e7c38f270 100644 --- a/aegisub/src/dialog_about.cpp +++ b/aegisub/src/dialog_about.cpp @@ -50,8 +50,10 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// AboutScreen::AboutScreen(wxWindow *parent) : wxDialog (parent, -1, _("About Aegisub"), wxDefaultPosition, wxSize(300,240), wxCAPTION | wxCLOSE_BOX , _("About Aegisub")) { @@ -185,8 +187,10 @@ AboutScreen::AboutScreen(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// AboutScreen::~AboutScreen () { } + diff --git a/aegisub/src/dialog_about.h b/aegisub/src/dialog_about.h index 33c4471fa..535bef272 100644 --- a/aegisub/src/dialog_about.h +++ b/aegisub/src/dialog_about.h @@ -45,11 +45,16 @@ #include "static_bmp.h" -/////////////////////// -// Splash screen class + +/// DOCME +/// @class AboutScreen +/// @brief DOCME +/// +/// DOCME class AboutScreen: public wxDialog { public: AboutScreen(wxWindow *parent); ~AboutScreen(); }; + diff --git a/aegisub/src/dialog_associations.cpp b/aegisub/src/dialog_associations.cpp index 1d04c7730..33abd2720 100644 --- a/aegisub/src/dialog_associations.cpp +++ b/aegisub/src/dialog_associations.cpp @@ -45,8 +45,10 @@ #include "dialog_associations.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogAssociations::DialogAssociations (wxWindow *parent) : wxDialog (parent,-1,_("Associate extensions"),wxDefaultPosition,wxDefaultSize) { @@ -86,14 +88,17 @@ DialogAssociations::DialogAssociations (wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogAssociations::~DialogAssociations() { } -///////////////////////////////////// -// Associates a type with Aegisub + +/// @brief Associates a type with Aegisub +/// @param type +/// void DialogAssociations::AssociateType(wxString type) { type.Lower(); wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type); @@ -103,8 +108,11 @@ void DialogAssociations::AssociateType(wxString type) { } -////////////////////////////////////////////////// -// Checks if a type is associated with Aegisub + +/// @brief Checks if a type is associated with Aegisub +/// @param type +/// @return +/// bool DialogAssociations::CheckAssociation(wxString type) { type.Lower(); wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type); @@ -128,8 +136,10 @@ BEGIN_EVENT_TABLE(DialogAssociations, wxDialog) END_EVENT_TABLE() -////////////// -// OK pressed + +/// @brief OK pressed +/// @param event +/// void DialogAssociations::OnOK(wxCommandEvent &event) { if (ListBox->IsChecked(0)) AssociateType(_T("ass")); if (ListBox->IsChecked(1)) AssociateType(_T("ssa")); @@ -139,3 +149,4 @@ void DialogAssociations::OnOK(wxCommandEvent &event) { event.Skip(); } + diff --git a/aegisub/src/dialog_associations.h b/aegisub/src/dialog_associations.h index 4234f4a84..ae3ba0453 100644 --- a/aegisub/src/dialog_associations.h +++ b/aegisub/src/dialog_associations.h @@ -46,10 +46,16 @@ #include -////////////////////////////////// -// File associations dialog class + +/// DOCME +/// @class DialogAssociations +/// @brief DOCME +/// +/// DOCME class DialogAssociations : public wxDialog { private: + + /// DOCME wxCheckListBox *ListBox; void OnOK(wxCommandEvent &event); @@ -63,3 +69,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/dialog_attachments.cpp b/aegisub/src/dialog_attachments.cpp index 3019eb496..dfc8c135a 100644 --- a/aegisub/src/dialog_attachments.cpp +++ b/aegisub/src/dialog_attachments.cpp @@ -55,8 +55,10 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogAttachments::DialogAttachments(wxWindow *parent) : wxDialog(parent,-1,_("Attachment List"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE) { @@ -92,8 +94,9 @@ DialogAttachments::DialogAttachments(wxWindow *parent) } -/////////////// -// Update list + +/// @brief Update list +/// void DialogAttachments::UpdateList() { // Clear list listView->ClearAll(); @@ -119,8 +122,9 @@ void DialogAttachments::UpdateList() { } -////////////// -// Destructor + +/// @brief Destructor +/// DialogAttachments::~DialogAttachments() { } @@ -138,8 +142,11 @@ BEGIN_EVENT_TABLE(DialogAttachments,wxDialog) END_EVENT_TABLE() -/////////////// -// Attach font + +/// @brief Attach font +/// @param event +/// @return +/// void DialogAttachments::OnAttachFont(wxCommandEvent &event) { // Pick files wxArrayString filenames; @@ -171,8 +178,11 @@ void DialogAttachments::OnAttachFont(wxCommandEvent &event) { } -/////////////////// -// Attach graphics + +/// @brief Attach graphics +/// @param event +/// @return +/// void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) { // Pick files wxArrayString filenames; @@ -204,8 +214,11 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &event) { } -/////////// -// Extract + +/// @brief Extract +/// @param event +/// @return +/// void DialogAttachments::OnExtract(wxCommandEvent &event) { // Check if there's a selection int i = listView->GetFirstSelected(); @@ -237,8 +250,10 @@ void DialogAttachments::OnExtract(wxCommandEvent &event) { } -////////// -// Delete + +/// @brief Delete +/// @param event +/// void DialogAttachments::OnDelete(wxCommandEvent &event) { // Loop through items in list int i = listView->GetFirstSelected(); @@ -252,8 +267,10 @@ void DialogAttachments::OnDelete(wxCommandEvent &event) { } -////////////////////////// -// List selection changed + +/// @brief List selection changed +/// @param event +/// void DialogAttachments::OnListClick(wxListEvent &event) { // Check if any is selected bool hasSel = listView->GetFirstSelected() != -1; @@ -263,3 +280,4 @@ void DialogAttachments::OnListClick(wxListEvent &event) { deleteButton->Enable(hasSel); } + diff --git a/aegisub/src/dialog_attachments.h b/aegisub/src/dialog_attachments.h index 076e5da38..ba90080a2 100644 --- a/aegisub/src/dialog_attachments.h +++ b/aegisub/src/dialog_attachments.h @@ -49,12 +49,22 @@ class wxListView; class wxListEvent; -////////////////////// -// Attachments window + +/// DOCME +/// @class DialogAttachments +/// @brief DOCME +/// +/// DOCME class DialogAttachments : public wxDialog { private: + + /// DOCME wxListView *listView; + + /// DOCME wxButton *extractButton; + + /// DOCME wxButton *deleteButton; void OnAttachFont(wxCommandEvent &event); @@ -76,10 +86,21 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_ATTACH_FONT = 1300, + + /// DOCME BUTTON_ATTACH_GRAPHICS, + + /// DOCME BUTTON_EXTRACT, + + /// DOCME BUTTON_DELETE, + + /// DOCME ATTACHMENT_LIST }; + diff --git a/aegisub/src/dialog_automation.cpp b/aegisub/src/dialog_automation.cpp index ac7232867..77a17ce15 100644 --- a/aegisub/src/dialog_automation.cpp +++ b/aegisub/src/dialog_automation.cpp @@ -53,6 +53,11 @@ + +/// @brief DOCME +/// @param parent +/// @param _local_manager +/// DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager *_local_manager) : wxDialog(parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize) { @@ -111,6 +116,9 @@ DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager } + +/// @brief DOCME +/// void DialogAutomation::RebuildList() { script_info.clear(); @@ -135,6 +143,10 @@ void DialogAutomation::RebuildList() } + +/// @brief DOCME +/// @param ei +/// void DialogAutomation::AddScript(ExtraScriptInfo &ei) { script_info.push_back(ei); @@ -157,6 +169,9 @@ void DialogAutomation::AddScript(ExtraScriptInfo &ei) } + +/// @brief DOCME +/// void DialogAutomation::UpdateDisplay() { int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -186,6 +201,10 @@ BEGIN_EVENT_TABLE(DialogAutomation, wxDialog) END_EVENT_TABLE() + +/// @brief DOCME +/// @param evt +/// void DialogAutomation::OnAdd(wxCommandEvent &evt) { // build filename filter list @@ -237,6 +256,11 @@ void DialogAutomation::OnAdd(wxCommandEvent &evt) } } + +/// @brief DOCME +/// @param evt +/// @return +/// void DialogAutomation::OnRemove(wxCommandEvent &evt) { int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -249,6 +273,11 @@ void DialogAutomation::OnRemove(wxCommandEvent &evt) list->Select(i); } + +/// @brief DOCME +/// @param evt +/// @return +/// void DialogAutomation::OnReload(wxCommandEvent &evt) { int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -273,6 +302,10 @@ void DialogAutomation::OnReload(wxCommandEvent &evt) } } + +/// @brief DOCME +/// @param evt +/// void DialogAutomation::OnInfo(wxCommandEvent &evt) { int i = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -318,6 +351,10 @@ void DialogAutomation::OnInfo(wxCommandEvent &evt) wxMessageBox(info, _("Automation Script Info")); } + +/// @brief DOCME +/// @param evt +/// void DialogAutomation::OnReloadAutoload(wxCommandEvent &evt) { global_manager->Reload(); @@ -325,6 +362,10 @@ void DialogAutomation::OnReloadAutoload(wxCommandEvent &evt) UpdateDisplay(); } + +/// @brief DOCME +/// @param evt +/// void DialogAutomation::OnSelectionChange(wxListEvent &evt) { UpdateDisplay(); @@ -332,3 +373,4 @@ void DialogAutomation::OnSelectionChange(wxListEvent &evt) #endif // WITH_AUTOMATION + diff --git a/aegisub/src/dialog_automation.h b/aegisub/src/dialog_automation.h index 42acf38da..d6dc00de1 100644 --- a/aegisub/src/dialog_automation.h +++ b/aegisub/src/dialog_automation.h @@ -37,6 +37,8 @@ #pragma once #ifndef DIALOG_AUTOMATION_H + +/// DOCME #define DIALOG_AUTOMATION_H #include @@ -44,25 +46,59 @@ #include #include + +/// DOCME namespace Automation4 { class ScriptManager; class Script; }; + +/// DOCME +/// @class DialogAutomation +/// @brief DOCME +/// +/// DOCME class DialogAutomation : public wxDialog { private: + + /// DOCME struct ExtraScriptInfo { + + /// DOCME Automation4::Script *script; + + /// DOCME bool is_global; }; + + /// DOCME std::vector script_info; + + /// DOCME Automation4::ScriptManager *local_manager; + + /// DOCME Automation4::AutoloadScriptManager *global_manager; + + /// DOCME wxListView *list; + + /// DOCME wxButton *add_button; + + /// DOCME wxButton *remove_button; + + /// DOCME wxButton *reload_button; + + /// DOCME wxButton *info_button; + + /// DOCME wxButton *reload_autoload_button; + + /// DOCME wxButton *close_button; void RebuildList(); @@ -83,13 +119,26 @@ public: }; enum { + + /// DOCME Automation_List_Box = 1000, + + /// DOCME Automation_Add_Script, + + /// DOCME Automation_Remove_Script, + + /// DOCME Automation_Reload_Script, + + /// DOCME Automation_Show_Info, + + /// DOCME Automation_Reload_Autoload }; #endif + diff --git a/aegisub/src/dialog_colorpicker.cpp b/aegisub/src/dialog_colorpicker.cpp index 4269f25e5..c3ca8e84e 100644 --- a/aegisub/src/dialog_colorpicker.cpp +++ b/aegisub/src/dialog_colorpicker.cpp @@ -61,14 +61,30 @@ #ifdef WIN32 + +/// DOCME #define STATIC_BORDER_FLAG wxSTATIC_BORDER #else + +/// DOCME #define STATIC_BORDER_FLAG wxSIMPLE_BORDER #endif + +/// DOCME static const int spectrum_horz_vert_arrow_size = 4; + +/// @brief DOCME +/// @param parent +/// @param id +/// @param _background +/// @param xx +/// @param yy +/// @param _direction +/// @param _size +/// ColorPickerSpectrum::ColorPickerSpectrum(wxWindow *parent, wxWindowID id, wxBitmap *_background, int xx, int yy, PickerDirection _direction, wxSize _size) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE), x(xx), y(yy), background(_background), direction(_direction) { @@ -82,12 +98,22 @@ ColorPickerSpectrum::ColorPickerSpectrum(wxWindow *parent, wxWindowID id, wxBitm SetMinSize(GetSize()); } + +/// @brief DOCME +/// @param xx +/// @param yy +/// void ColorPickerSpectrum::GetXY(int &xx, int &yy) { xx = x; yy = y; } + +/// @brief DOCME +/// @param xx +/// @param yy +/// void ColorPickerSpectrum::SetXY(int xx, int yy) { x = xx; @@ -95,6 +121,11 @@ void ColorPickerSpectrum::SetXY(int xx, int yy) Refresh(true); } + +/// @brief DOCME +/// @param new_background +/// @return +/// void ColorPickerSpectrum::SetBackground(wxBitmap *new_background) { if (background == new_background) return; @@ -109,6 +140,11 @@ END_EVENT_TABLE() DEFINE_EVENT_TYPE(wxSPECTRUM_CHANGE) + +/// @brief DOCME +/// @param evt +/// @return +/// void ColorPickerSpectrum::OnPaint(wxPaintEvent &evt) { if (!background) return; @@ -167,6 +203,11 @@ void ColorPickerSpectrum::OnPaint(wxPaintEvent &evt) dc.DrawRectangle(0, 0, background->GetWidth()+2, background->GetHeight()+2); } + +/// @brief DOCME +/// @param evt +/// @return +/// void ColorPickerSpectrum::OnMouse(wxMouseEvent &evt) { evt.Skip(); @@ -201,6 +242,14 @@ void ColorPickerSpectrum::OnMouse(wxMouseEvent &evt) + +/// @brief DOCME +/// @param parent +/// @param id +/// @param _cols +/// @param _rows +/// @param _cellsize +/// ColorPickerRecent::ColorPickerRecent(wxWindow *parent, wxWindowID id, int _cols, int _rows, int _cellsize) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, STATIC_BORDER_FLAG) , rows(_rows) @@ -217,6 +266,10 @@ ColorPickerRecent::ColorPickerRecent(wxWindow *parent, wxWindowID id, int _cols, SetCursor(*wxCROSS_CURSOR); } + +/// @brief DOCME +/// @param recent_string +/// void ColorPickerRecent::LoadFromString(const wxString &recent_string) { colors.clear(); @@ -234,6 +287,10 @@ void ColorPickerRecent::LoadFromString(const wxString &recent_string) background_valid = false; } + +/// @brief DOCME +/// @return +/// wxString ColorPickerRecent::StoreToString() { wxString res; @@ -245,6 +302,10 @@ wxString ColorPickerRecent::StoreToString() return res; } + +/// @brief DOCME +/// @param color +/// void ColorPickerRecent::AddColor(wxColour color) { for (std::vector::iterator i = colors.begin(); i != colors.end(); ++i) { @@ -269,6 +330,11 @@ END_EVENT_TABLE() DEFINE_EVENT_TYPE(wxRECENT_SELECT) + +/// @brief DOCME +/// @param evt +/// @return +/// void ColorPickerRecent::OnClick(wxMouseEvent &evt) { int cx, cy, i; @@ -285,6 +351,10 @@ void ColorPickerRecent::OnClick(wxMouseEvent &evt) } } + +/// @brief DOCME +/// @param evt +/// void ColorPickerRecent::OnPaint(wxPaintEvent &evt) { wxPaintDC pdc(this); @@ -318,6 +388,10 @@ void ColorPickerRecent::OnPaint(wxPaintEvent &evt) pdc.DrawBitmap(background, 0, 0, false); } + +/// @brief DOCME +/// @param evt +/// void ColorPickerRecent::OnSize(wxSizeEvent &evt) { wxSize size = GetClientSize(); @@ -329,6 +403,15 @@ void ColorPickerRecent::OnSize(wxSizeEvent &evt) + +/// @brief DOCME +/// @param parent +/// @param id +/// @param _resx +/// @param _resy +/// @param _magnification +/// @param _integrated_dropper +/// ColorPickerScreenDropper::ColorPickerScreenDropper(wxWindow *parent, wxWindowID id, int _resx, int _resy, int _magnification, bool _integrated_dropper) : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, STATIC_BORDER_FLAG), resx(_resx), resy(_resy), magnification(_magnification), integrated_dropper(_integrated_dropper) { @@ -352,6 +435,10 @@ END_EVENT_TABLE() DEFINE_EVENT_TYPE(wxDROPPER_SELECT) + +/// @brief DOCME +/// @param evt +/// void ColorPickerScreenDropper::OnMouse(wxMouseEvent &evt) { int x, y; @@ -386,6 +473,10 @@ void ColorPickerScreenDropper::OnMouse(wxMouseEvent &evt) } } + +/// @brief DOCME +/// @param evt +/// void ColorPickerScreenDropper::OnPaint(wxPaintEvent &evt) { wxPaintDC pdc(this); @@ -418,6 +509,11 @@ void ColorPickerScreenDropper::OnPaint(wxPaintEvent &evt) } + +/// @brief DOCME +/// @param x +/// @param y +/// void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) { wxMemoryDC capdc; @@ -433,6 +529,12 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) + +/// @brief DOCME +/// @param parent +/// @param original +/// @return +/// wxColour GetColorFromUser(wxWindow *parent, wxColour original) { DialogColorPicker dialog(parent, original); @@ -444,7 +546,11 @@ wxColour GetColorFromUser(wxWindow *parent, wxColour original) } -// Constructor + +/// @brief Constructor +/// @param parent +/// @param initial_color +/// DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color) : wxDialog(parent, -1, _("Select Colour"), wxDefaultPosition, wxDefaultSize) { @@ -675,7 +781,9 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color) } -// Destructor + +/// @brief Destructor +/// DialogColorPicker::~DialogColorPicker() { GetPosition(&lastx, &lasty); @@ -693,7 +801,10 @@ DialogColorPicker::~DialogColorPicker() } -// Sets the currently selected color, and updates all controls + +/// @brief Sets the currently selected color, and updates all controls +/// @param new_color +/// void DialogColorPicker::SetColor(wxColour new_color) { cur_color = new_color; @@ -704,7 +815,10 @@ void DialogColorPicker::SetColor(wxColour new_color) } -// Get the currently selected color + +/// @brief Get the currently selected color +/// @return +/// wxColour DialogColorPicker::GetColor() { recent_box->AddColor(cur_color); @@ -714,7 +828,10 @@ wxColour DialogColorPicker::GetColor() } -// Use the values entered in the RGB controls to update the other controls + +/// @brief Use the values entered in the RGB controls to update the other controls +/// @return +/// void DialogColorPicker::UpdateFromRGB() { if (updating_controls) return; @@ -741,7 +858,10 @@ void DialogColorPicker::UpdateFromRGB() } -// Use the values entered in the HSL controls to update the other controls + +/// @brief Use the values entered in the HSL controls to update the other controls +/// @return +/// void DialogColorPicker::UpdateFromHSL() { if (updating_controls) return; @@ -768,6 +888,10 @@ void DialogColorPicker::UpdateFromHSL() } + +/// @brief DOCME +/// @return +/// void DialogColorPicker::UpdateFromHSV() { if (updating_controls) return; @@ -795,7 +919,10 @@ void DialogColorPicker::UpdateFromHSV() } -// Use the value entered in the ASS hex control to update the other controls + +/// @brief Use the value entered in the ASS hex control to update the other controls +/// @return +/// void DialogColorPicker::UpdateFromASS() { if (updating_controls) return; @@ -826,6 +953,10 @@ void DialogColorPicker::UpdateFromASS() } + +/// @brief DOCME +/// @return +/// void DialogColorPicker::UpdateFromHTML() { if (updating_controls) return; @@ -855,6 +986,9 @@ void DialogColorPicker::UpdateFromHTML() } + +/// @brief DOCME +/// void DialogColorPicker::UpdateSpectrumDisplay() { int i = colorspace_choice->GetSelection(); @@ -909,6 +1043,10 @@ void DialogColorPicker::UpdateSpectrumDisplay() } + +/// @brief DOCME +/// @return +/// wxBitmap *DialogColorPicker::MakeGBSpectrum() { if (rgb_spectrum[0]) delete rgb_spectrum[0]; @@ -931,6 +1069,10 @@ wxBitmap *DialogColorPicker::MakeGBSpectrum() } + +/// @brief DOCME +/// @return +/// wxBitmap *DialogColorPicker::MakeRBSpectrum() { if (rgb_spectrum[1]) delete rgb_spectrum[1]; @@ -953,6 +1095,10 @@ wxBitmap *DialogColorPicker::MakeRBSpectrum() } + +/// @brief DOCME +/// @return +/// wxBitmap *DialogColorPicker::MakeRGSpectrum() { if (rgb_spectrum[2]) delete rgb_spectrum[2]; @@ -975,6 +1121,10 @@ wxBitmap *DialogColorPicker::MakeRGSpectrum() } + +/// @brief DOCME +/// @return +/// wxBitmap *DialogColorPicker::MakeHSSpectrum() { if (hsl_spectrum) delete hsl_spectrum; @@ -1002,6 +1152,10 @@ wxBitmap *DialogColorPicker::MakeHSSpectrum() } + +/// @brief DOCME +/// @return +/// wxBitmap *DialogColorPicker::MakeSVSpectrum() { if (hsv_spectrum) delete hsv_spectrum; @@ -1068,6 +1222,10 @@ BEGIN_EVENT_TABLE(DialogColorPicker, wxDialog) END_EVENT_TABLE() + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnSpinRGB(wxSpinEvent &evt) { if (!updating_controls) @@ -1076,6 +1234,10 @@ void DialogColorPicker::OnSpinRGB(wxSpinEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnSpinHSL(wxSpinEvent &evt) { if (!updating_controls) @@ -1084,6 +1246,10 @@ void DialogColorPicker::OnSpinHSL(wxSpinEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnSpinHSV(wxSpinEvent &evt) { if (!updating_controls) @@ -1092,6 +1258,10 @@ void DialogColorPicker::OnSpinHSV(wxSpinEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeRGB(wxCommandEvent &evt) { if (!updating_controls) @@ -1100,6 +1270,10 @@ void DialogColorPicker::OnChangeRGB(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeHSL(wxCommandEvent &evt) { if (!updating_controls) @@ -1108,6 +1282,10 @@ void DialogColorPicker::OnChangeHSL(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeHSV(wxCommandEvent &evt) { if (!updating_controls) @@ -1116,6 +1294,10 @@ void DialogColorPicker::OnChangeHSV(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeASS(wxCommandEvent &evt) { if (!updating_controls) @@ -1124,6 +1306,10 @@ void DialogColorPicker::OnChangeASS(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeHTML(wxCommandEvent &evt) { if (!updating_controls) @@ -1132,6 +1318,10 @@ void DialogColorPicker::OnChangeHTML(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnChangeMode(wxCommandEvent &evt) { if (!updating_controls) @@ -1141,6 +1331,10 @@ void DialogColorPicker::OnChangeMode(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnSpectrumChange(wxCommandEvent &evt) { updating_controls = true; @@ -1184,6 +1378,10 @@ void DialogColorPicker::OnSpectrumChange(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnSliderChange(wxCommandEvent &evt) { spectrum_dirty = true; @@ -1227,6 +1425,10 @@ void DialogColorPicker::OnSliderChange(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnRecentSelect(wxCommandEvent &evt) { // The colour picked is stored in the event string @@ -1238,6 +1440,10 @@ void DialogColorPicker::OnRecentSelect(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogColorPicker::OnDropperMouse(wxMouseEvent &evt) { if (evt.LeftDown() && !screen_dropper_icon->HasCapture()) { @@ -1253,6 +1459,8 @@ void DialogColorPicker::OnDropperMouse(wxMouseEvent &evt) } if (evt.LeftUp()) { + +/// DOCME #define ABS(x) (x < 0 ? -x : x) wxPoint ptdiff = evt.GetPosition() - eyedropper_grab_point; bool release_now = eyedropper_is_grabbed || ABS(ptdiff.x) + ABS(ptdiff.y) > 7; @@ -1273,7 +1481,10 @@ void DialogColorPicker::OnDropperMouse(wxMouseEvent &evt) } -// rgbadjust() tool + +/// @brief rgbadjust() tool +/// @param evt +/// void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt) { wxColour cur = cur_color; @@ -1290,7 +1501,11 @@ void DialogColorPicker::OnRGBAdjust(wxCommandEvent &evt) } -// Static values for last position of the dialog in this Aegisub session + +/// DOCME int DialogColorPicker::lastx = -1; + +/// DOCME int DialogColorPicker::lasty = -1; + diff --git a/aegisub/src/dialog_colorpicker.h b/aegisub/src/dialog_colorpicker.h index 45aa231f1..87e634713 100644 --- a/aegisub/src/dialog_colorpicker.h +++ b/aegisub/src/dialog_colorpicker.h @@ -35,6 +35,8 @@ /// #ifndef DIALOG_COLORPICKER_H + +/// DOCME #define DIALOG_COLORPICKER_H @@ -49,16 +51,38 @@ #include + +/// DOCME +/// @class ColorPickerSpectrum +/// @brief DOCME +/// +/// DOCME class ColorPickerSpectrum : public wxControl { public: + + /// DOCME enum PickerDirection { + + /// DOCME HorzVert, + + /// DOCME Horz, + + /// DOCME Vert }; private: + + /// DOCME + + /// DOCME int x, y; + + /// DOCME wxBitmap *background; + + /// DOCME PickerDirection direction; void OnPaint(wxPaintEvent &evt); @@ -77,15 +101,35 @@ public: DECLARE_EVENT_TYPE(wxSPECTRUM_CHANGE, -1) + +/// DOCME +/// @class ColorPickerRecent +/// @brief DOCME +/// +/// DOCME class ColorPickerRecent : public wxControl { private: + + /// DOCME + + /// DOCME int rows, cols; + + /// DOCME int cellsize; + + /// DOCME wxPoint internal_control_offset; + + /// DOCME std::vector colors; + + /// DOCME bool background_valid; + + /// DOCME wxBitmap background; void OnClick(wxMouseEvent &evt); @@ -98,6 +142,11 @@ public: void LoadFromString(const wxString &recent_string); wxString StoreToString(); void AddColor(wxColour color); + + /// @brief DOCME + /// @param n + /// @return + /// wxColour GetColor(int n) { return colors.at(n); } DECLARE_EVENT_TABLE() @@ -106,11 +155,27 @@ public: DECLARE_EVENT_TYPE(wxRECENT_SELECT, -1) + +/// DOCME +/// @class ColorPickerScreenDropper +/// @brief DOCME +/// +/// DOCME class ColorPickerScreenDropper : public wxControl { private: + + /// DOCME wxBitmap capture; + + /// DOCME + + /// DOCME int resx, resy; + + /// DOCME int magnification; + + /// DOCME bool integrated_dropper; void OnMouse(wxMouseEvent &evt); @@ -129,44 +194,98 @@ DECLARE_EVENT_TYPE(wxDROPPER_SELECT, -1) wxColour GetColorFromUser(wxWindow *parent, wxColour original); + +/// DOCME +/// @class DialogColorPicker +/// @brief DOCME +/// +/// DOCME class DialogColorPicker : public wxDialog { private: + + /// DOCME wxColour cur_color; + + /// DOCME bool updating_controls; + + /// DOCME bool spectrum_dirty; + + /// DOCME ColorPickerSpectrum *spectrum; + + /// DOCME ColorPickerSpectrum *slider; + + /// DOCME wxChoice *colorspace_choice; + + /// DOCME static const int slider_width = 10; // width in pixels of the color slider control - // 0 = red, 1 = green, 2 = blue + + /// DOCME wxSpinCtrl *rgb_input[3]; + + /// DOCME wxBitmap *rgb_spectrum[3]; // x/y spectrum bitmap where color "i" is excluded from + + /// DOCME wxBitmap *rgb_slider[3]; // z spectrum for color "i" - // 0 = hue, 1 = saturation, 2 = luminance + + /// DOCME wxSpinCtrl *hsl_input[3]; + + /// DOCME wxBitmap *hsl_spectrum; // h/s spectrum + + /// DOCME wxBitmap *hsl_slider; // l spectrum - // 0 = hue, 1 = saturation, 2 = value + + /// DOCME wxSpinCtrl *hsv_input[3]; + + /// DOCME wxBitmap *hsv_spectrum; // s/v spectrum + + /// DOCME wxBitmap *hsv_slider; // h spectrum + + /// DOCME wxBitmap eyedropper_bitmap; + + /// DOCME wxPoint eyedropper_grab_point; + + /// DOCME bool eyedropper_is_grabbed; + + /// DOCME wxTextCtrl *ass_input; // ASS hex format input + + /// DOCME wxTextCtrl *html_input; // HTML hex format input - //wxWindow *preview_box; + + /// DOCME wxStaticBitmap *preview_box; + + /// DOCME wxBitmap preview_bitmap; + + /// DOCME ColorPickerRecent *recent_box; + + /// DOCME ColorPickerScreenDropper *screen_dropper; + + /// DOCME wxStaticBitmap *screen_dropper_icon; void UpdateFromRGB(); // Update all other controls as a result of modifying an RGB control @@ -197,6 +316,10 @@ private: void OnRGBAdjust(wxCommandEvent &evt); void OnDropperMouse(wxMouseEvent &evt); + + /// DOCME + + /// DOCME static int lastx, lasty; public: @@ -211,26 +334,63 @@ public: enum { + + /// DOCME SELECTOR_SPECTRUM = 4000, + + /// DOCME SELECTOR_SLIDER, + + /// DOCME SELECTOR_MODE, + + /// DOCME SELECTOR_RGB_R, + + /// DOCME SELECTOR_RGB_G, + + /// DOCME SELECTOR_RGB_B, + + /// DOCME SELECTOR_HSL_H, + + /// DOCME SELECTOR_HSL_S, + + /// DOCME SELECTOR_HSL_L, + + /// DOCME SELECTOR_HSV_H, + + /// DOCME SELECTOR_HSV_S, + + /// DOCME SELECTOR_HSV_V, + + /// DOCME SELECTOR_ASS_INPUT, + + /// DOCME SELECTOR_HTML_INPUT, + + /// DOCME SELECTOR_RECENT, + + /// DOCME SELECTOR_DROPPER, + + /// DOCME SELECTOR_DROPPER_PICK, + + /// DOCME BUTTON_RGBADJUST }; #endif + diff --git a/aegisub/src/dialog_detached_video.cpp b/aegisub/src/dialog_detached_video.cpp index 4ffb287cf..068d9188f 100644 --- a/aegisub/src/dialog_detached_video.cpp +++ b/aegisub/src/dialog_detached_video.cpp @@ -50,8 +50,11 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param par +/// @param initialDisplaySize +/// DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDisplaySize) //: wxFrame(par,-1,_("Detached Video")) : wxDialog(par,-1,_T("Detached Video"),wxDefaultPosition,wxSize(400,300),wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxWANTS_CHARS) @@ -99,8 +102,9 @@ DialogDetachedVideo::DialogDetachedVideo(FrameMain *par, const wxSize &initialDi } -///////////// -// Destructor + +/// @brief Destructor +/// DialogDetachedVideo::~DialogDetachedVideo() { Options.SetBool(_T("Detached video maximized"),IsMaximized()); Options.Save(); @@ -116,8 +120,10 @@ BEGIN_EVENT_TABLE(DialogDetachedVideo,wxDialog) END_EVENT_TABLE() -//////////// -// Key down + +/// @brief Key down +/// @param event +/// void DialogDetachedVideo::OnKey(wxKeyEvent &event) { // Send to parent... except that it doesn't work event.Skip(); @@ -125,8 +131,10 @@ void DialogDetachedVideo::OnKey(wxKeyEvent &event) { } -//////////////// -// Close window + +/// @brief Close window +/// @param event +/// void DialogDetachedVideo::OnClose(wxCloseEvent &event) { FrameMain *par = parent; Options.SetBool(_T("Detached video"),false); @@ -136,11 +144,14 @@ void DialogDetachedVideo::OnClose(wxCloseEvent &event) { } -/////////////// -// Move window + +/// @brief Move window +/// @param event +/// void DialogDetachedVideo::OnMove(wxMoveEvent &event) { wxPoint pos = event.GetPosition(); Options.SetInt(_T("Detached video last x"),pos.x); Options.SetInt(_T("Detached video last y"),pos.y); } + diff --git a/aegisub/src/dialog_detached_video.h b/aegisub/src/dialog_detached_video.h index 0d18b50ce..d18647407 100644 --- a/aegisub/src/dialog_detached_video.h +++ b/aegisub/src/dialog_detached_video.h @@ -47,11 +47,19 @@ class VideoBox; class FrameMain; -////////////////////////////// -// Detached video frame class + +/// DOCME +/// @class DialogDetachedVideo +/// @brief DOCME +/// +/// DOCME class DialogDetachedVideo : public wxDialog { private: + + /// DOCME VideoBox *videoBox; + + /// DOCME FrameMain *parent; void OnKey(wxKeyEvent &event); @@ -65,3 +73,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/dialog_dummy_video.cpp b/aegisub/src/dialog_dummy_video.cpp index 001f89391..2a17ac16d 100644 --- a/aegisub/src/dialog_dummy_video.cpp +++ b/aegisub/src/dialog_dummy_video.cpp @@ -45,11 +45,21 @@ #include "help_button.h" + +/// DOCME struct ResolutionShortcut { + + /// DOCME const wxChar *name; + + /// DOCME int width; + + /// DOCME int height; }; + +/// DOCME static ResolutionShortcut resolutions[] = { {_T("640x480 (SD fullscreen)"), 640, 480}, {_T("704x480 (SD anamorphic)"), 704, 480}, @@ -64,6 +74,12 @@ static ResolutionShortcut resolutions[] = { }; + +/// @brief DOCME +/// @param parent +/// @param out_filename +/// @return +/// bool DialogDummyVideo::CreateDummyVideo(wxWindow *parent, wxString &out_filename) { DialogDummyVideo dlg(parent); @@ -119,6 +135,10 @@ bool DialogDummyVideo::CreateDummyVideo(wxWindow *parent, wxString &out_filename } + +/// @brief DOCME +/// @param parent +/// DialogDummyVideo::DialogDummyVideo(wxWindow *parent) : wxDialog(parent, -1, _("Dummy video options"),wxDefaultPosition,wxDefaultSize) { @@ -199,6 +219,9 @@ DialogDummyVideo::DialogDummyVideo(wxWindow *parent) } + +/// @brief DOCME +/// DialogDummyVideo::~DialogDummyVideo() { } @@ -212,6 +235,10 @@ BEGIN_EVENT_TABLE(DialogDummyVideo,wxDialog) END_EVENT_TABLE() + +/// @brief DOCME +/// @param evt +/// void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &evt) { int rs = resolution_shortcuts->GetSelection(); @@ -220,24 +247,39 @@ void DialogDummyVideo::OnResolutionShortcut(wxCommandEvent &evt) } + +/// @brief DOCME +/// @param evt +/// void DialogDummyVideo::OnFpsChange(wxCommandEvent &evt) { UpdateLengthDisplay(); } + +/// @brief DOCME +/// @param evt +/// void DialogDummyVideo::OnLengthSpin(wxSpinEvent &evt) { UpdateLengthDisplay(); } + +/// @brief DOCME +/// @param evt +/// void DialogDummyVideo::OnLengthChange(wxCommandEvent &evt) { UpdateLengthDisplay(); } + +/// @brief DOCME +/// void DialogDummyVideo::UpdateLengthDisplay() { double fpsval; @@ -266,3 +308,4 @@ void DialogDummyVideo::UpdateLengthDisplay() } } + diff --git a/aegisub/src/dialog_dummy_video.h b/aegisub/src/dialog_dummy_video.h index 7d1c639d8..0b5b2f884 100644 --- a/aegisub/src/dialog_dummy_video.h +++ b/aegisub/src/dialog_dummy_video.h @@ -35,6 +35,8 @@ /// #ifndef _DIALOG_DUMMY_VIDEO_H + +/// DOCME #define _DIALOG_DUMMY_VIDEO_H #include @@ -46,21 +48,46 @@ #include "video_provider_dummy.h" #include "colour_button.h" + +/// DOCME +/// @class DialogDummyVideo +/// @brief DOCME +/// +/// DOCME class DialogDummyVideo : public wxDialog { private: DialogDummyVideo(wxWindow *parent); virtual ~DialogDummyVideo(); + + /// DOCME wxComboBox *resolution_shortcuts; + + /// DOCME wxTextCtrl *width; + + /// DOCME wxTextCtrl *height; + + /// DOCME ColourButton *colour; + + /// DOCME wxCheckBox *pattern; - //wxComboBox *fps; + + /// DOCME wxTextCtrl *fps; + + /// DOCME wxSpinCtrl *length; + + /// DOCME wxStaticText *length_display; + + /// DOCME wxButton *ok_button; + + /// DOCME wxButton *cancel_button; void OnResolutionShortcut(wxCommandEvent &evt); @@ -77,11 +104,18 @@ public: }; enum { + + /// DOCME Dummy_Video_Resolution_Shortcut = 1700, + + /// DOCME Dummy_Video_FPS, + + /// DOCME Dummy_Video_Length, }; #endif + diff --git a/aegisub/src/dialog_export.cpp b/aegisub/src/dialog_export.cpp index 4b820d139..7d600c564 100644 --- a/aegisub/src/dialog_export.cpp +++ b/aegisub/src/dialog_export.cpp @@ -51,8 +51,10 @@ #include "help_button.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogExport::DialogExport (wxWindow *parent) : wxDialog (parent, -1, _("Export"), wxDefaultPosition, wxSize(200,100), wxCAPTION | wxCLOSE_BOX, _T("Export")) { @@ -139,8 +141,9 @@ DialogExport::DialogExport (wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogExport::~DialogExport() { // Set script info data int n = 0; @@ -160,8 +163,9 @@ DialogExport::~DialogExport() { } -///////////////////////////////// -// Refresh displaying of options + +/// @brief Refresh displaying of options +/// void DialogExport::RefreshOptions() { int num = FilterList->GetCount(); for (int i=0;iGetSettingsSizer(FilterList->GetString(n)); @@ -230,8 +239,10 @@ void DialogExport::OnCheck(wxCommandEvent &event) { } -//////////////// -// Changed item + +/// @brief Changed item +/// @param event +/// void DialogExport::OnChange(wxCommandEvent &event) { int n = FilterList->GetSelection(); if (n != wxNOT_FOUND) { @@ -242,8 +253,11 @@ void DialogExport::OnChange(wxCommandEvent &event) { } -/////////// -// Move up + +/// @brief Move up +/// @param event +/// @return +/// void DialogExport::OnMoveUp(wxCommandEvent &event) { int pos = FilterList->GetSelection(); if (pos <= 0) return; @@ -259,8 +273,11 @@ void DialogExport::OnMoveUp(wxCommandEvent &event) { } -///////////// -// Move down + +/// @brief Move down +/// @param event +/// @return +/// void DialogExport::OnMoveDown(wxCommandEvent &event) { int pos = FilterList->GetSelection(); int n = FilterList->GetCount(); @@ -277,8 +294,10 @@ void DialogExport::OnMoveDown(wxCommandEvent &event) { } -////////////// -// Select all + +/// @brief Select all +/// @param event +/// void DialogExport::OnSelectAll(wxCommandEvent &event) { Freeze(); FilterList->Freeze(); @@ -296,8 +315,10 @@ void DialogExport::OnSelectAll(wxCommandEvent &event) { } -/////////////// -// Select none + +/// @brief Select none +/// @param event +/// void DialogExport::OnSelectNone(wxCommandEvent &event) { Freeze(); FilterList->Freeze(); @@ -314,3 +335,4 @@ void DialogExport::OnSelectNone(wxCommandEvent &event) { MainSizer->Fit(this); } + diff --git a/aegisub/src/dialog_export.h b/aegisub/src/dialog_export.h index 4e06ddd41..cb96d2ed8 100644 --- a/aegisub/src/dialog_export.h +++ b/aegisub/src/dialog_export.h @@ -51,8 +51,8 @@ #include -//////////// -// Typedefs + +/// DOCME typedef std::map SizerMap; @@ -61,17 +61,37 @@ typedef std::map SizerMap; class AssExporter; -/////////////////////// -// Export dialog Class + +/// DOCME +/// @class DialogExport +/// @brief DOCME +/// +/// DOCME class DialogExport : public wxDialog { private: + + /// DOCME AssExporter *Export; + + /// DOCME SizerMap SetupMap; + + /// DOCME wxTextCtrl *Description; + + /// DOCME wxCheckListBox *FilterList; + + /// DOCME wxChoice *CharsetList; + + /// DOCME wxSizer *MainSizer; + + /// DOCME wxSizer *HorizSizer; + + /// DOCME wxSizer *OptionsSizer; void OnProcess(wxCommandEvent &event); @@ -94,12 +114,27 @@ public: /////// // IDs enum { + + /// DOCME Button_Process = 1400, + + /// DOCME Button_Move_Up, + + /// DOCME Button_Move_Down, + + /// DOCME Button_Select_All, + + /// DOCME Button_Select_None, + + /// DOCME Filter_List_Box, + + /// DOCME Charset_List_Box }; + diff --git a/aegisub/src/dialog_fonts_collector.cpp b/aegisub/src/dialog_fonts_collector.cpp index 0d8479a3d..02c070bdb 100644 --- a/aegisub/src/dialog_fonts_collector.cpp +++ b/aegisub/src/dialog_fonts_collector.cpp @@ -62,11 +62,17 @@ -/////// -// IDs + +/// DOCME enum IDs { + + /// DOCME START_BUTTON = 1150, + + /// DOCME BROWSE_BUTTON, + + /// DOCME RADIO_BOX }; @@ -77,8 +83,10 @@ DECLARE_EVENT_TYPE(EVT_ADD_TEXT, -1) DEFINE_EVENT_TYPE(EVT_ADD_TEXT) -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogFontsCollector::DialogFontsCollector(wxWindow *parent) : wxDialog(parent,-1,_("Fonts Collector"),wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) { @@ -158,8 +166,9 @@ DialogFontsCollector::DialogFontsCollector(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogFontsCollector::~DialogFontsCollector() { FontFileLister::ClearData(); } @@ -176,8 +185,11 @@ BEGIN_EVENT_TABLE(DialogFontsCollector, wxDialog) END_EVENT_TABLE() -//////////////////// -// Start processing + +/// @brief Start processing +/// @param event +/// @return +/// void DialogFontsCollector::OnStart(wxCommandEvent &event) { // Clear LogBox->SetReadOnly(false); @@ -246,15 +258,19 @@ void DialogFontsCollector::OnStart(wxCommandEvent &event) { } -//////////////// -// Close dialog + +/// @brief Close dialog +/// @param event +/// void DialogFontsCollector::OnClose(wxCommandEvent &event) { EndModal(0); } -/////////////////// -// Browse location + +/// @brief Browse location +/// @param event +/// void DialogFontsCollector::OnBrowse(wxCommandEvent &event) { // Chose file name if (CollectAction->GetSelection()==2) { @@ -275,15 +291,19 @@ void DialogFontsCollector::OnBrowse(wxCommandEvent &event) { } -///////////////////// -// Radio box changed + +/// @brief Radio box changed +/// @param event +/// void DialogFontsCollector::OnRadio(wxCommandEvent &event) { Update(event.GetInt()); } -/////////////////// -// Update controls + +/// @brief Update controls +/// @param value +/// void DialogFontsCollector::Update(int value) { // Enable buttons CloseButton->Enable(true); @@ -335,8 +355,10 @@ void DialogFontsCollector::Update(int value) { } -//////////// -// Add text + +/// @brief Add text +/// @param event +/// void DialogFontsCollector::OnAddText(wxCommandEvent &event) { ColourString *str = (ColourString*) event.GetClientData(); LogBox->SetReadOnly(false); @@ -352,15 +374,20 @@ void DialogFontsCollector::OnAddText(wxCommandEvent &event) { } -/////////////////////// -// Collect font files + +/// @brief Collect font files +/// void FontsCollectorThread::CollectFontData () { FontFileLister::Initialize(); } -//////////////////// -// Collector thread + +/// @brief Collector thread +/// @param _subs +/// @param _destination +/// @param _collector +/// FontsCollectorThread::FontsCollectorThread(AssFile *_subs,wxString _destination,DialogFontsCollector *_collector) : wxThread(wxTHREAD_DETACHED) { @@ -371,8 +398,10 @@ FontsCollectorThread::FontsCollectorThread(AssFile *_subs,wxString _destination, } -//////////////// -// Thread entry + +/// @brief Thread entry +/// @return +/// wxThread::ExitCode FontsCollectorThread::Entry() { // Collect Collect(); @@ -386,8 +415,10 @@ wxThread::ExitCode FontsCollectorThread::Entry() { } -/////////// -// Collect + +/// @brief Collect +/// @return +/// void FontsCollectorThread::Collect() { // Set destination folder int oper = collector->CollectAction->GetSelection(); @@ -490,8 +521,11 @@ void FontsCollectorThread::Collect() { } -//////////////// -// Process font + +/// @brief Process font +/// @param name +/// @return +/// bool FontsCollectorThread::ProcessFont(wxString name) { // Action int action = collector->CollectAction->GetSelection(); @@ -543,8 +577,11 @@ bool FontsCollectorThread::ProcessFont(wxString name) { } -///////////// -// Copy font + +/// @brief Copy font +/// @param filename +/// @return +/// int FontsCollectorThread::CopyFont(wxString filename) { wxFileName fn(filename); wxString dstName = destFolder + _T("//") + fn.GetFullName(); @@ -553,8 +590,11 @@ int FontsCollectorThread::CopyFont(wxString filename) { } -//////////////// -// Archive font + +/// @brief Archive font +/// @param filename +/// @return +/// bool FontsCollectorThread::ArchiveFont(wxString filename) { // Open file wxFFileInputStream in(filename); @@ -574,8 +614,11 @@ bool FontsCollectorThread::ArchiveFont(wxString filename) { } -/////////////// -// Attach font + +/// @brief Attach font +/// @param filename +/// @return +/// bool FontsCollectorThread::AttachFont(wxString filename) { try { subs->InsertAttachment(filename); @@ -587,8 +630,13 @@ bool FontsCollectorThread::AttachFont(wxString filename) { } -//////////////////////////////// -// Get fonts from ass overrides + +/// @brief Get fonts from ass overrides +/// @param tagName +/// @param par_n +/// @param param +/// @param usr +/// void FontsCollectorThread::GetFonts (wxString tagName,int par_n,AssOverrideParameter *param,void *usr) { if (tagName == _T("\\fn")) { if (instance) instance->AddFont(param->AsText(),1); @@ -596,8 +644,11 @@ void FontsCollectorThread::GetFonts (wxString tagName,int par_n,AssOverrideParam } -/////////////// -// Adds a font + +/// @brief Adds a font +/// @param fontname +/// @param mode +/// void FontsCollectorThread::AddFont(wxString fontname,int mode) { // @-fonts (CJK vertical layout variations) should be listed as the non-@ name if (fontname.StartsWith(_T("@"), 0)) @@ -613,8 +664,11 @@ void FontsCollectorThread::AddFont(wxString fontname,int mode) { } -/////////////// -// Append text + +/// @brief Append text +/// @param text +/// @param colour +/// void FontsCollectorThread::AppendText(wxString text,int colour) { ColourString *str = new ColourString; str->text = text; @@ -625,7 +679,8 @@ void FontsCollectorThread::AppendText(wxString text,int colour) { } -/////////////////// -// Static instance + +/// DOCME FontsCollectorThread *FontsCollectorThread::instance; + diff --git a/aegisub/src/dialog_fonts_collector.h b/aegisub/src/dialog_fonts_collector.h index 416c90e54..527bfb76f 100644 --- a/aegisub/src/dialog_fonts_collector.h +++ b/aegisub/src/dialog_fonts_collector.h @@ -54,20 +54,42 @@ class wxZipOutputStream; class ScintillaTextCtrl; -///////////////// -// Worker thread + +/// DOCME +/// @class FontsCollectorThread +/// @brief DOCME +/// +/// DOCME class FontsCollectorThread : public wxThread { private: + + /// DOCME AssFile *subs; + + /// DOCME AssStyle *curStyle; + + /// DOCME wxString destination; + + /// DOCME DialogFontsCollector *collector; + + /// DOCME wxZipOutputStream *zip; + + /// DOCME int curLine; + + /// DOCME wxString destFolder; + + /// DOCME static FontsCollectorThread *instance; + + /// DOCME wxArrayString fonts; bool ProcessFont(wxString fontname); @@ -88,19 +110,39 @@ public: }; -//////////////////// -// Class definition + +/// DOCME +/// @class DialogFontsCollector +/// @brief DOCME +/// +/// DOCME class DialogFontsCollector : public wxDialog { friend class FontsCollectorThread; private: + + /// DOCME wxTextCtrl *DestBox; + + /// DOCME ScintillaTextCtrl *LogBox; + + /// DOCME wxButton *BrowseButton; + + /// DOCME wxButton *StartButton; + + /// DOCME wxButton *CloseButton; + + /// DOCME wxStaticText *DestLabel; + + /// DOCME wxRadioBox *CollectAction; + + /// DOCME FrameMain *main; void OnStart(wxCommandEvent &event); @@ -118,10 +160,15 @@ public: }; -////////////////////////////////////// -// Helper class to pass strings along + +/// DOCME struct ColourString { + + /// DOCME wxString text; + + /// DOCME int colour; }; + diff --git a/aegisub/src/dialog_jumpto.cpp b/aegisub/src/dialog_jumpto.cpp index d8219fcc0..c1778442e 100644 --- a/aegisub/src/dialog_jumpto.cpp +++ b/aegisub/src/dialog_jumpto.cpp @@ -55,13 +55,19 @@ /////// // IDs enum { + + /// DOCME TEXT_JUMP_TIME = 1100, + + /// DOCME TEXT_JUMP_FRAME }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogJumpTo::DialogJumpTo (wxWindow *parent) : wxDialog(parent, -1, _("Jump to"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS , _T("JumpTo")) { @@ -122,14 +128,22 @@ BEGIN_EVENT_TABLE(DialogJumpTo, wxDialog) END_EVENT_TABLE() -///////// -// Close + +/// @brief Close +/// @param event +/// void DialogJumpTo::OnCloseButton (wxCommandEvent &event) { OnClose(false); } + +/// @brief DOCME +/// @param event +/// void DialogJumpTo::OnOK (wxCommandEvent &event) { OnClose(true); } -////////////////// -// On Key pressed + +/// @brief On Key pressed +/// @param event +/// void DialogJumpTo::OnKey(wxCommandEvent &event) { EndModal(0); if (jumpframe > VideoContext::Get()->GetLength()-1) jumpframe = VideoContext::Get()->GetLength()-1; @@ -137,8 +151,10 @@ void DialogJumpTo::OnKey(wxCommandEvent &event) { } -//////////////////////// -// On OK button pressed + +/// @brief On OK button pressed +/// @param ok +/// void DialogJumpTo::OnClose(bool ok) { EndModal(0); if (jumpframe > VideoContext::Get()->GetLength()-1) jumpframe = VideoContext::Get()->GetLength()-1; @@ -146,8 +162,10 @@ void DialogJumpTo::OnClose(bool ok) { } -//////////////////////// -// Time editbox changed + +/// @brief Time editbox changed +/// @param event +/// void DialogJumpTo::OnEditTime (wxCommandEvent &event) { if (ready) { ready = false; @@ -165,8 +183,10 @@ void DialogJumpTo::OnEditTime (wxCommandEvent &event) { } -///////////////////////// -// Frame editbox changed + +/// @brief Frame editbox changed +/// @param event +/// void DialogJumpTo::OnEditFrame (wxCommandEvent &event) { if (ready) { ready = false; @@ -188,3 +208,4 @@ void DialogJumpTo::OnEditFrame (wxCommandEvent &event) { else event.Skip(); } + diff --git a/aegisub/src/dialog_jumpto.h b/aegisub/src/dialog_jumpto.h index 830d7a8dd..a240e52d2 100644 --- a/aegisub/src/dialog_jumpto.h +++ b/aegisub/src/dialog_jumpto.h @@ -36,6 +36,8 @@ #ifndef DIALOG_JUMPTO_H + +/// DOCME #define DIALOG_JUMPTO_H @@ -46,15 +48,29 @@ #include "timeedit_ctrl.h" -///////// -// Class + +/// DOCME +/// @class DialogJumpTo +/// @brief DOCME +/// +/// DOCME class DialogJumpTo : public wxDialog { private: + + /// DOCME bool ready; + + /// DOCME long jumpframe; + + /// DOCME AssTime jumptime; + + /// DOCME TimeEdit *JumpTime; + + /// DOCME wxTextCtrl *JumpFrame; void OnKey(wxCommandEvent &event); @@ -73,3 +89,4 @@ public: #endif + diff --git a/aegisub/src/dialog_kanji_timer.cpp b/aegisub/src/dialog_kanji_timer.cpp index 7678db03e..4a6f2560c 100644 --- a/aegisub/src/dialog_kanji_timer.cpp +++ b/aegisub/src/dialog_kanji_timer.cpp @@ -59,48 +59,100 @@ -// These are made with #define in the hope gettext can pick it up for translation then + +/// DOCME #define TEXT_LABEL_SOURCE _("Source: ") + +/// DOCME #define TEXT_LABEL_DEST _("Dest: ") + +/// DOCME +/// @class KaraokeLineMatchDisplay +/// @brief DOCME +/// +/// DOCME class KaraokeLineMatchDisplay : public wxControl { + + /// DOCME struct MatchSyllable { + + /// DOCME int dur; + + /// DOCME wxString text; + + /// @brief DOCME + /// @param _dur + /// @param _text + /// MatchSyllable(int _dur, const wxString &_text) : dur(_dur), text(_text) { } }; + + /// DOCME struct MatchGroup { + + /// DOCME std::vector src; + + /// DOCME typedef std::vector::iterator SrcIterator; + + /// DOCME wxString dst; + + /// DOCME int duration; + + /// DOCME int last_render_width; + + /// @brief DOCME + /// MatchGroup() : duration(0), last_render_width(0) { } }; - // Groups matched on current line so far + + /// DOCME std::vector matched_groups; + + /// DOCME typedef std::vector::iterator MatchedGroupIterator; - // Unmatched source syllables + + /// DOCME std::deque unmatched_source; + + /// DOCME typedef std::deque::iterator UnmatchedSourceIterator; - // Unmatched destination text + + /// DOCME wxString unmatched_destination; + + /// DOCME int last_total_matchgroup_render_width; - // Length of current selection in the unmatched source and destination + + /// DOCME int source_sel_length; + + /// DOCME int destination_sel_length; - // Whether source and destination lines are set + + /// DOCME bool has_source, has_destination; void OnPaint(wxPaintEvent &event); void OnKeyboard(wxKeyEvent &event); void OnFocusEvent(wxFocusEvent &event); + + /// DOCME + + /// DOCME const wxString label_source, label_destination; public: @@ -137,6 +189,10 @@ public: }; + +/// @brief DOCME +/// @param parent +/// KaraokeLineMatchDisplay::KaraokeLineMatchDisplay(DialogKanjiTimer *parent) : wxControl(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxWANTS_CHARS) , label_source(TEXT_LABEL_SOURCE) @@ -150,11 +206,18 @@ KaraokeLineMatchDisplay::KaraokeLineMatchDisplay(DialogKanjiTimer *parent) SetMinSize(best_size); } + +/// @brief DOCME +/// KaraokeLineMatchDisplay::~KaraokeLineMatchDisplay() { // Nothing to do } + +/// @brief DOCME +/// @return +/// wxSize KaraokeLineMatchDisplay::GetBestSize() { int w_src, h_src, w_dst, h_dst; @@ -178,6 +241,14 @@ BEGIN_EVENT_TABLE(KaraokeLineMatchDisplay,wxControl) END_EVENT_TABLE() + +/// @brief DOCME +/// @param dc +/// @param txt +/// @param x +/// @param y +/// @return +/// int DrawBoxedText(wxDC &dc, const wxString &txt, int x, int y) { int tw, th; @@ -202,6 +273,10 @@ int DrawBoxedText(wxDC &dc, const wxString &txt, int x, int y) } } + +/// @brief DOCME +/// @param event +/// void KaraokeLineMatchDisplay::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); @@ -347,17 +422,30 @@ void KaraokeLineMatchDisplay::OnPaint(wxPaintEvent &event) DrawBoxedText(dc, txt, next_x, y_line2); } + +/// @brief DOCME +/// @param event +/// void KaraokeLineMatchDisplay::OnKeyboard(wxKeyEvent &event) { ((DialogKanjiTimer*)GetParent())->OnKeyDown(event); } + +/// @brief DOCME +/// @param event +/// void KaraokeLineMatchDisplay::OnFocusEvent(wxFocusEvent &event) { Refresh(true); } + +/// @brief DOCME +/// @param src +/// @param dst +/// void KaraokeLineMatchDisplay::SetInputData(const AssDialogue *src, const AssDialogue *dst) { has_source = src != 0; @@ -396,6 +484,10 @@ void KaraokeLineMatchDisplay::SetInputData(const AssDialogue *src, const AssDial } + +/// @brief DOCME +/// @return +/// wxString KaraokeLineMatchDisplay::GetOutputLine() { wxString res; @@ -410,17 +502,28 @@ wxString KaraokeLineMatchDisplay::GetOutputLine() } + +/// @brief DOCME +/// @return +/// int KaraokeLineMatchDisplay::GetRemainingSource() { return unmatched_source.size(); } + +/// @brief DOCME +/// @return +/// int KaraokeLineMatchDisplay::GetRemainingDestination() { return unmatched_destination.size(); } + +/// @brief DOCME +/// void KaraokeLineMatchDisplay::IncreaseSourceMatch() { source_sel_length += 1; @@ -429,6 +532,9 @@ void KaraokeLineMatchDisplay::IncreaseSourceMatch() Refresh(true); } + +/// @brief DOCME +/// void KaraokeLineMatchDisplay::DecreaseSourceMatch() { source_sel_length -= 1; @@ -437,6 +543,9 @@ void KaraokeLineMatchDisplay::DecreaseSourceMatch() Refresh(true); } + +/// @brief DOCME +/// void KaraokeLineMatchDisplay::IncreseDestinationMatch() { destination_sel_length += 1; @@ -445,6 +554,9 @@ void KaraokeLineMatchDisplay::IncreseDestinationMatch() Refresh(true); } + +/// @brief DOCME +/// void KaraokeLineMatchDisplay::DecreaseDestinationMatch() { destination_sel_length -= 1; @@ -454,9 +566,17 @@ void KaraokeLineMatchDisplay::DecreaseDestinationMatch() } + +/// DOCME #define KANA_SEARCH_DISTANCE 3 //Kana interpolation, in characters, unset to disable + +/// DOCME #define ROMAJI_SEARCH_DISTANCE 4 //Romaji interpolation, in karaoke groups, unset to disable + +/// @brief DOCME +/// @return +/// void KaraokeLineMatchDisplay::AutoMatchJapanese() { if (unmatched_source.size() < 1) return; @@ -629,6 +749,10 @@ trycatchingmorespaces: } + +/// @brief DOCME +/// @return +/// bool KaraokeLineMatchDisplay::AcceptMatch() { MatchGroup match; @@ -665,6 +789,10 @@ bool KaraokeLineMatchDisplay::AcceptMatch() return true; } + +/// @brief DOCME +/// @return +/// bool KaraokeLineMatchDisplay::UndoMatch() { if (matched_groups.empty()) @@ -693,8 +821,11 @@ bool KaraokeLineMatchDisplay::UndoMatch() -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogKanjiTimer::DialogKanjiTimer(wxWindow *parent, SubtitlesGrid *_grid) : wxDialog (parent,-1,_("Kanji timing"),wxDefaultPosition) { @@ -797,6 +928,10 @@ BEGIN_EVENT_TABLE(DialogKanjiTimer,wxDialog) EVT_TEXT_ENTER(TEXT_DEST,DialogKanjiTimer::OnKeyEnter) END_EVENT_TABLE() + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnClose(wxCommandEvent &event) { Options.SetBool(_T("kanji timer interpolation"),Interpolate->IsChecked()); Options.Save(); @@ -817,6 +952,10 @@ void DialogKanjiTimer::OnClose(wxCommandEvent &event) { Close(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnStart(wxCommandEvent &event) { if (SourceStyle->GetValue().Len() == 0 || DestStyle->GetValue().Len() == 0) wxMessageBox(_("Select source and destination styles first."),_("Error"),wxICON_EXCLAMATION | wxOK); @@ -830,6 +969,10 @@ void DialogKanjiTimer::OnStart(wxCommandEvent &event) { LinesToChange.clear(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnLink(wxCommandEvent &event) { if (display->AcceptMatch()) TryAutoMatch(); @@ -837,22 +980,38 @@ void DialogKanjiTimer::OnLink(wxCommandEvent &event) { wxBell(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnUnlink(wxCommandEvent &event) { if (!display->UndoMatch()) wxBell(); // Don't auto-match here, undoing sets the selection to the undone match } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnSkipSource(wxCommandEvent &event) { currentSourceLine = FindNextStyleMatch(currentSourceLine, SourceStyle->GetValue()); ResetForNewLine(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnSkipDest(wxCommandEvent &event) { currentDestinationLine = FindNextStyleMatch(currentDestinationLine, DestStyle->GetValue()); ResetForNewLine(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnGoBack(wxCommandEvent &event) { if (LinesToChange.empty()==false) LinesToChange.pop_back(); //If we go back, then take out the modified line we saved. @@ -862,6 +1021,10 @@ void DialogKanjiTimer::OnGoBack(wxCommandEvent &event) { ResetForNewLine(); } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnAccept(wxCommandEvent &event) { if (display->GetRemainingSource() > 0) wxMessageBox(_("Group all of the source text."),_("Error"),wxICON_EXCLAMATION | wxOK); @@ -876,6 +1039,11 @@ void DialogKanjiTimer::OnAccept(wxCommandEvent &event) { } } + +/// @brief DOCME +/// @param event +/// @return +/// void DialogKanjiTimer::OnKeyDown(wxKeyEvent &event) { wxCommandEvent evt; switch(event.GetKeyCode()) { @@ -905,6 +1073,10 @@ void DialogKanjiTimer::OnKeyDown(wxKeyEvent &event) { } } + +/// @brief DOCME +/// @param event +/// void DialogKanjiTimer::OnKeyEnter(wxCommandEvent &event) { wxCommandEvent evt; @@ -919,6 +1091,9 @@ void DialogKanjiTimer::OnKeyEnter(wxCommandEvent &event) { } + +/// @brief DOCME +/// void DialogKanjiTimer::ResetForNewLine() { AssDialogue *src = 0; @@ -942,12 +1117,21 @@ void DialogKanjiTimer::ResetForNewLine() display->SetFocus(); } + +/// @brief DOCME +/// void DialogKanjiTimer::TryAutoMatch() { if (Interpolate->GetValue()) display->AutoMatchJapanese(); } + +/// @brief DOCME +/// @param search_from +/// @param search_style +/// @return +/// entryIter DialogKanjiTimer::FindNextStyleMatch(entryIter search_from, const wxString &search_style) { if (search_from == subs->Line.end()) return search_from; @@ -962,6 +1146,11 @@ entryIter DialogKanjiTimer::FindNextStyleMatch(entryIter search_from, const wxSt return search_from; } + +/// @brief DOCME +/// @param search_from +/// @param search_style +/// entryIter DialogKanjiTimer::FindPrevStyleMatch(entryIter search_from, const wxString &search_style) { if (search_from == subs->Line.begin()) return search_from; @@ -977,3 +1166,4 @@ entryIter DialogKanjiTimer::FindPrevStyleMatch(entryIter search_from, const wxSt } + diff --git a/aegisub/src/dialog_kanji_timer.h b/aegisub/src/dialog_kanji_timer.h index 20e1603d5..8508faa97 100644 --- a/aegisub/src/dialog_kanji_timer.h +++ b/aegisub/src/dialog_kanji_timer.h @@ -36,6 +36,8 @@ #ifndef DIALOG_KANJITIMER_H + +/// DOCME #define DIALOG_KANJITIMER_H @@ -61,18 +63,40 @@ class AssOverrideParameter; class KaraokeLineMatchDisplay; -///////// -// Class + +/// DOCME +/// @class DialogKanjiTimer +/// @brief DOCME +/// +/// DOCME class DialogKanjiTimer : public wxDialog { + + /// DOCME SubtitlesGrid *grid; + + /// DOCME AssFile *subs; + + /// DOCME KaraokeLineMatchDisplay *display; + + /// DOCME + + /// DOCME wxComboBox *SourceStyle, *DestStyle; + + /// DOCME wxCheckBox *Interpolate; + + /// DOCME std::vector > LinesToChange; + + /// DOCME entryIter currentSourceLine; + + /// DOCME entryIter currentDestinationLine; void OnClose(wxCommandEvent &event); @@ -101,17 +125,36 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_KTSTART = 2500, + + /// DOCME BUTTON_KTLINK, + + /// DOCME BUTTON_KTUNLINK, + + /// DOCME BUTTON_KTSKIPSOURCE, + + /// DOCME BUTTON_KTSKIPDEST, + + /// DOCME BUTTON_KTGOBACK, + + /// DOCME BUTTON_KTACCEPT, + + /// DOCME TEXT_SOURCE, + + /// DOCME TEXT_DEST }; #endif + diff --git a/aegisub/src/dialog_options.cpp b/aegisub/src/dialog_options.cpp index 82f5691cc..2f934fc4c 100644 --- a/aegisub/src/dialog_options.cpp +++ b/aegisub/src/dialog_options.cpp @@ -43,6 +43,8 @@ #if wxUSE_TREEBOOK && !__WXMAC__ #include #else + +/// DOCME #define AddSubPage(page,text,select) AddPage(page,wxString::Format(_T("\t%s"),text),select) #endif #include "options.h" @@ -74,17 +76,31 @@ /////// // IDs enum { + + /// DOCME BUTTON_DEFAULTS = 2500, + + /// DOCME HOTKEY_LIST, + + /// DOCME BUTTON_HOTKEY_SET, + + /// DOCME BUTTON_HOTKEY_CLEAR, + + /// DOCME BUTTON_HOTKEY_DEFAULT, + + /// DOCME BUTTON_HOTKEY_DEFAULT_ALL }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogOptions::DialogOptions(wxWindow *parent) : wxDialog(parent, -1, _("Options"), wxDefaultPosition, wxDefaultSize) { @@ -663,14 +679,19 @@ DialogOptions::DialogOptions(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogOptions::~DialogOptions() { } -////////////////////////// -// Bind control to option + +/// @brief Bind control to option +/// @param ctrl +/// @param option +/// @param param +/// void DialogOptions::Bind(wxControl *ctrl, wxString option,int param) { OptionsBind bind; bind.ctrl = ctrl; @@ -680,8 +701,14 @@ void DialogOptions::Bind(wxControl *ctrl, wxString option,int param) { } -//////////////////// -// Add a wxTextCtrl + +/// @brief Add a wxTextCtrl +/// @param parent +/// @param sizer +/// @param label +/// @param option +/// @param type +/// void DialogOptions::AddTextControl(wxWindow *parent,wxSizer *sizer,wxString label,wxString option,TextType type) { sizer->Add(new wxStaticText(parent,-1,label + wxString(_T(": "))),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10); wxTextCtrl *control; @@ -692,8 +719,16 @@ void DialogOptions::AddTextControl(wxWindow *parent,wxSizer *sizer,wxString labe } -//////////////////// -// Add a wxComboBox + +/// @brief Add a wxComboBox +/// @param parent +/// @param sizer +/// @param label +/// @param option +/// @param choices +/// @param readOnly +/// @param bindParam +/// void DialogOptions::AddComboControl(wxWindow *parent,wxSizer *sizer,wxString label,wxString option,wxArrayString choices,bool readOnly,int bindParam) { sizer->Add(new wxStaticText(parent,-1,label + wxString(_T(": "))),0,wxALIGN_CENTER_VERTICAL | wxRIGHT,10); int flags = wxCB_DROPDOWN; @@ -704,8 +739,13 @@ void DialogOptions::AddComboControl(wxWindow *parent,wxSizer *sizer,wxString lab } -////////////////// -// Add a checkbox + +/// @brief Add a checkbox +/// @param parent +/// @param sizer +/// @param label +/// @param option +/// void DialogOptions::AddCheckBox(wxWindow *parent,wxSizer *sizer,wxString label,wxString option) { wxControl *control = new wxCheckBox(parent,-1,label); Bind(control,option); @@ -727,8 +767,10 @@ BEGIN_EVENT_TABLE(DialogOptions,wxDialog) END_EVENT_TABLE() -////// -// OK + +/// @brief OK +/// @param event +/// void DialogOptions::OnOK(wxCommandEvent &event) { Options.SetInt(_T("Options page"),book->GetSelection()); WriteToOptions(); @@ -749,16 +791,20 @@ void DialogOptions::OnOK(wxCommandEvent &event) { } -///////// -// Apply + +/// @brief Apply +/// @param event +/// void DialogOptions::OnApply(wxCommandEvent &event) { Options.SetInt(_T("Options page"),book->GetSelection()); WriteToOptions(true); } -////////// -// Cancel + +/// @brief Cancel +/// @param event +/// void DialogOptions::OnCancel(wxCommandEvent &event) { // Undo hotkeys if (hotkeysModified) Hotkeys.key = origKeys; @@ -783,8 +829,10 @@ void DialogOptions::OnCancel(wxCommandEvent &event) { } -//////////////////// -// Restore defaults + +/// @brief Restore defaults +/// @param event +/// void DialogOptions::OnDefaults(wxCommandEvent &event) { int result = wxMessageBox(_("Are you sure that you want to restore the defaults? All your settings will be overriden."),_("Restore defaults?"),wxYES_NO); if (result == wxYES) { @@ -795,8 +843,10 @@ void DialogOptions::OnDefaults(wxCommandEvent &event) { } -//////////////////// -// Write to options + +/// @brief Write to options +/// @param justApply +/// void DialogOptions::WriteToOptions(bool justApply) { // Flags bool mustRestart = false; @@ -960,8 +1010,9 @@ void DialogOptions::WriteToOptions(bool justApply) { } -///////////////////// -// Read form options + +/// @brief Read form options +/// void DialogOptions::ReadFromOptions() { for (unsigned int i=0;iGetFirstSelected(); @@ -1033,8 +1087,10 @@ void DialogOptions::OnEditHotkey(wxCommandEvent &event) { } -////////////////// -// Clear a hotkey + +/// @brief Clear a hotkey +/// @param event +/// void DialogOptions::OnClearHotkey(wxCommandEvent &event) { for (int item=-1;true;) { item = Shortcuts->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED); @@ -1051,8 +1107,10 @@ void DialogOptions::OnClearHotkey(wxCommandEvent &event) { } -/////////////////////////// -// Reset hotkey to default + +/// @brief Reset hotkey to default +/// @param event +/// void DialogOptions::OnDefaultHotkey(wxCommandEvent &event) { // Load defaults HotkeyManager defs; @@ -1084,8 +1142,10 @@ void DialogOptions::OnDefaultHotkey(wxCommandEvent &event) { } -//////////////////////////////// -// Reset all hotkeys to default + +/// @brief Reset all hotkeys to default +/// @param event +/// void DialogOptions::OnDefaultAllHotkey(wxCommandEvent &event) { Hotkeys.LoadDefaults(); Shortcuts->Freeze(); @@ -1107,8 +1167,12 @@ void DialogOptions::OnDefaultAllHotkey(wxCommandEvent &event) { } -///////////////////// -// Input constructor + +/// @brief Input constructor +/// @param _key +/// @param name +/// @param shorts +/// DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name,wxListView *shorts) : wxDialog(NULL, -1, _("Press Key"), wxDefaultPosition, wxSize(200,50), wxCAPTION | wxWANTS_CHARS , _T("Press key")) { @@ -1130,8 +1194,10 @@ DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name,wxListView * } -//////////////////////// -// Capturer constructor + +/// @brief Capturer constructor +/// @param _parent +/// CaptureKey::CaptureKey(DialogInputHotkey *_parent) : wxTextCtrl(_parent,-1,_T(""),wxDefaultPosition,wxSize(0,0),wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB) { @@ -1148,8 +1214,11 @@ BEGIN_EVENT_TABLE(CaptureKey,wxTextCtrl) END_EVENT_TABLE() -/////////////// -// On key down + +/// @brief On key down +/// @param event +/// @return +/// void CaptureKey::OnKeyDown(wxKeyEvent &event) { // Get key int keycode = event.GetKeyCode(); @@ -1190,9 +1259,12 @@ void CaptureKey::OnKeyDown(wxKeyEvent &event) { } -////////////// -// Keep focus + +/// @brief Keep focus +/// @param event +/// void CaptureKey::OnLoseFocus(wxFocusEvent &event) { SetFocus(); } + diff --git a/aegisub/src/dialog_options.h b/aegisub/src/dialog_options.h index 6e863b64d..a9ac69a7b 100644 --- a/aegisub/src/dialog_options.h +++ b/aegisub/src/dialog_options.h @@ -57,42 +57,79 @@ class DialogInputHotkey; class wxTreebook; #else #include + +/// DOCME typedef wxChoicebook wxTreebook; #endif -///////////// -// Bind pair + +/// DOCME +/// @class OptionsBind +/// @brief DOCME +/// +/// DOCME class OptionsBind { public: + + /// DOCME wxControl *ctrl; + + /// DOCME wxString option; + + /// DOCME int param; }; -////////////////// -// TextCtrl types + +/// DOCME enum TextType { + + /// DOCME TEXT_TYPE_PLAIN, + + /// DOCME TEXT_TYPE_NUMBER, + + /// DOCME TEXT_TYPE_FILE, + + /// DOCME TEXT_TYPE_FOLDER, + + /// DOCME TEXT_TYPE_FONT }; -//////////////////////// -// Options screen class + +/// DOCME +/// @class DialogOptions +/// @brief DOCME +/// +/// DOCME class DialogOptions: public wxDialog { private: + + /// DOCME bool needsRestart; + + /// DOCME wxTreebook *book; + + /// DOCME std::vector binds; - // Hotkeys + + /// DOCME std::map origKeys; + + /// DOCME wxListView *Shortcuts; + + /// DOCME bool hotkeysModified; void Bind(wxControl *ctrl,wxString option,int param=0); @@ -121,10 +158,16 @@ public: }; -///////////////////// -// Capture key class + +/// DOCME +/// @class CaptureKey +/// @brief DOCME +/// +/// DOCME class CaptureKey : public wxTextCtrl { private: + + /// DOCME DialogInputHotkey *parent; void OnKeyDown(wxKeyEvent &event); void OnLoseFocus(wxFocusEvent &event); @@ -136,17 +179,28 @@ public: }; -////////////////////// -// Input dialog class + +/// DOCME +/// @class DialogInputHotkey +/// @brief DOCME +/// +/// DOCME class DialogInputHotkey : public wxDialog { friend class CaptureKey; private: + + /// DOCME CaptureKey *capture; + + /// DOCME HotkeyType *key; + + /// DOCME wxListView *shortcuts; public: DialogInputHotkey(HotkeyType *key,wxString name,wxListView *Shortcuts); }; + diff --git a/aegisub/src/dialog_paste_over.cpp b/aegisub/src/dialog_paste_over.cpp index 53a070696..8934aa74a 100644 --- a/aegisub/src/dialog_paste_over.cpp +++ b/aegisub/src/dialog_paste_over.cpp @@ -48,8 +48,10 @@ #include "help_button.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogPasteOver::DialogPasteOver (wxWindow *parent) : wxDialog (parent,-1,_("Select Fields to Paste Over"),wxDefaultPosition,wxDefaultSize) { @@ -110,8 +112,9 @@ DialogPasteOver::DialogPasteOver (wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogPasteOver::~DialogPasteOver() { } @@ -128,8 +131,10 @@ BEGIN_EVENT_TABLE(DialogPasteOver, wxDialog) END_EVENT_TABLE() -////////////// -// OK pressed + +/// @brief OK pressed +/// @param event +/// void DialogPasteOver::OnOK(wxCommandEvent &event) { // Set options options.SetCount(10); @@ -144,23 +149,29 @@ void DialogPasteOver::OnOK(wxCommandEvent &event) { } -////////////////// -// Cancel pressed + +/// @brief Cancel pressed +/// @param event +/// void DialogPasteOver::OnCancel(wxCommandEvent &event) { EndModal(0); } -/////////////// -// Select Text + +/// @brief Select Text +/// @param event +/// void DialogPasteOver::OnText(wxCommandEvent &event) { for (int i=0;i<9;i++) ListBox->Check(i,false); ListBox->Check(9,true); } -//////////////// -// Select Times + +/// @brief Select Times +/// @param event +/// void DialogPasteOver::OnTimes(wxCommandEvent &event) { for (int i=0;i<10;i++) ListBox->Check(i,false); ListBox->Check(1,true); @@ -168,23 +179,29 @@ void DialogPasteOver::OnTimes(wxCommandEvent &event) { } -////////////// -// Select All + +/// @brief Select All +/// @param event +/// void DialogPasteOver::OnAll(wxCommandEvent &event) { for (int i=0;i<10;i++) ListBox->Check(i,true); } -/////////////// -// Select None + +/// @brief Select None +/// @param event +/// void DialogPasteOver::OnNone(wxCommandEvent &event) { for (int i=0;i<10;i++) ListBox->Check(i,false); } -//////////////// -// Get options + +/// @brief Get options +/// wxArrayInt DialogPasteOver::GetOptions() { return options; } + diff --git a/aegisub/src/dialog_paste_over.h b/aegisub/src/dialog_paste_over.h index 18dcb0e50..c987897e1 100644 --- a/aegisub/src/dialog_paste_over.h +++ b/aegisub/src/dialog_paste_over.h @@ -45,11 +45,19 @@ #include -////////////////////////////////// -// File associations dialog class + +/// DOCME +/// @class DialogPasteOver +/// @brief DOCME +/// +/// DOCME class DialogPasteOver : public wxDialog { private: + + /// DOCME wxCheckListBox *ListBox; + + /// DOCME wxArrayInt options; void OnOK(wxCommandEvent &event); @@ -72,9 +80,18 @@ public: /////// // IDs enum { + + /// DOCME Paste_Over_Times = 1620, + + /// DOCME Paste_Over_Text, + + /// DOCME Paste_Over_All, + + /// DOCME Paste_Over_None }; + diff --git a/aegisub/src/dialog_progress.cpp b/aegisub/src/dialog_progress.cpp index ef08dc60c..ce715cd2e 100644 --- a/aegisub/src/dialog_progress.cpp +++ b/aegisub/src/dialog_progress.cpp @@ -48,8 +48,15 @@ DEFINE_EVENT_TYPE(wxEVT_PROGRESS_UPDATE) -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param title +/// @param cancel +/// @param message +/// @param cur +/// @param max +/// DialogProgress::DialogProgress(wxWindow *parent,wxString title,volatile bool *cancel,wxString message,int cur,int max) : wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxBORDER_RAISED/* | wxSTAY_ON_TOP*/) { @@ -76,8 +83,12 @@ DialogProgress::DialogProgress(wxWindow *parent,wxString title,volatile bool *ca } -//////////////// -// Set progress + +/// @brief Set progress +/// @param cur +/// @param max +/// @return +/// void DialogProgress::SetProgress(int cur,int max) { // Return if there's nothing to do int value = cur*100/virtualMax; @@ -104,8 +115,10 @@ void DialogProgress::SetProgress(int cur,int max) { } -/////////////////// -// Update progress + +/// @brief Update progress +/// @param event +/// void DialogProgress::OnUpdateProgress(wxCommandEvent &event) { int value = event.GetInt(); @@ -115,8 +128,10 @@ void DialogProgress::OnUpdateProgress(wxCommandEvent &event) } -//////////////// -// Set progress + +/// @brief Set progress +/// @param setto +/// void DialogProgress::SetText(wxString setto) { // Lock bool isMain = wxIsMainThread(); @@ -138,8 +153,10 @@ BEGIN_EVENT_TABLE(DialogProgress,wxDialog) END_EVENT_TABLE() -////////// -// Cancel + +/// @brief Cancel +/// @param event +/// void DialogProgress::OnCancel(wxCommandEvent &event) { if (canceled) *canceled = true; bool isMain = wxIsMainThread(); @@ -148,8 +165,15 @@ void DialogProgress::OnCancel(wxCommandEvent &event) { if (!isMain) wxMutexGuiLeave(); } -////////////////////// -// Thread constructor + +/// @brief Thread constructor +/// @param parent +/// @param title +/// @param canceled +/// @param message +/// @param cur +/// @param max +/// DialogProgressThread::DialogProgressThread(wxWindow *parent,wxString title,volatile bool *canceled,wxString message,int cur,int max) : wxThread(wxTHREAD_DETACHED) { @@ -157,14 +181,17 @@ DialogProgressThread::DialogProgressThread(wxWindow *parent,wxString title,volat } -///////////////////// -// Thread destructor + +/// @brief Thread destructor +/// DialogProgressThread::~DialogProgressThread() { } -////////////////////// -// Thread entry point + +/// @brief Thread entry point +/// @return +/// wxThread::ExitCode DialogProgressThread::Entry() { dialog->ShowModal(); dialog = NULL; @@ -173,11 +200,13 @@ wxThread::ExitCode DialogProgressThread::Entry() { } -///////// -// Close + +/// @brief Close +/// void DialogProgressThread::Close() { wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL); dialog->canceled = NULL; dialog->GetEventHandler()->ProcessEvent(event); } + diff --git a/aegisub/src/dialog_progress.h b/aegisub/src/dialog_progress.h index 6b6948dc2..d8095942a 100644 --- a/aegisub/src/dialog_progress.h +++ b/aegisub/src/dialog_progress.h @@ -36,6 +36,8 @@ #ifndef DIALOG_PROGRESS_H + +/// DOCME #define DIALOG_PROGRESS_H @@ -47,20 +49,36 @@ #include -///////////////////////// -// Progress dialog class + +/// DOCME +/// @class DialogProgress +/// @brief DOCME +/// +/// DOCME class DialogProgress : public wxDialog { private: + + /// DOCME volatile int count; + + /// DOCME int virtualMax; + + /// DOCME wxMutex mutex; + + /// DOCME wxGauge *gauge; + + /// DOCME wxStaticText *text; void OnCancel(wxCommandEvent &event); void OnUpdateProgress(wxCommandEvent &event); public: + + /// DOCME volatile bool *canceled; DialogProgress(wxWindow *parent,wxString title,volatile bool *cancel,wxString message,int cur,int max); @@ -72,15 +90,18 @@ public: }; -////////////////////////// -// Progress dialog thread -// ---------------------- -// IGNORE THIS : Probably won't ever be used -// Probably, that is. Which is why it's still here. + +/// DOCME +/// @class DialogProgressThread +/// @brief DOCME +/// +/// DOCME class DialogProgressThread : public wxThread { DialogProgressThread(wxWindow *parent,wxString title,volatile bool *canceled,wxString message,int cur,int max); public: + + /// DOCME DialogProgress *dialog; ~DialogProgressThread(); @@ -91,3 +112,4 @@ public: #endif + diff --git a/aegisub/src/dialog_properties.cpp b/aegisub/src/dialog_properties.cpp index 28b120ff3..bc31c1809 100644 --- a/aegisub/src/dialog_properties.cpp +++ b/aegisub/src/dialog_properties.cpp @@ -55,8 +55,10 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogProperties::DialogProperties (wxWindow *parent) : wxDialog(parent, -1, _("Script Properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) { @@ -170,8 +172,9 @@ DialogProperties::DialogProperties (wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogProperties::~DialogProperties () { } @@ -184,8 +187,10 @@ BEGIN_EVENT_TABLE(DialogProperties,wxDialog) END_EVENT_TABLE() -///////////////// -// Apply changes + +/// @brief Apply changes +/// @param event +/// void DialogProperties::OnOK(wxCommandEvent &event) { // Update details int count = 0; @@ -210,8 +215,12 @@ void DialogProperties::OnOK(wxCommandEvent &event) { } -////////////////////////////////////// -// Only set script info if it changed + +/// @brief Only set script info if it changed +/// @param key +/// @param value +/// @return +/// int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) { // Get script AssFile *subs = AssFile::top; @@ -225,11 +234,14 @@ int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) { } -////////////////////////// -// Set res to match video + +/// @brief Set res to match video +/// @param event +/// void DialogProperties::OnSetFromVideo(wxCommandEvent &event) { ResX->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetWidth())); ResY->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetHeight())); event.Skip(); } + diff --git a/aegisub/src/dialog_properties.h b/aegisub/src/dialog_properties.h index 228f957e8..967764608 100644 --- a/aegisub/src/dialog_properties.h +++ b/aegisub/src/dialog_properties.h @@ -46,26 +46,60 @@ #include -//////////////////// -// Properties class + +/// DOCME +/// @class DialogProperties +/// @brief DOCME +/// +/// DOCME class DialogProperties : public wxDialog { private: + + /// DOCME wxTextCtrl *TitleEdit; + + /// DOCME wxTextCtrl *OrigScriptEdit; + + /// DOCME wxTextCtrl *TranslationEdit; + + /// DOCME wxTextCtrl *EditingEdit; + + /// DOCME wxTextCtrl *TimingEdit; + + /// DOCME wxTextCtrl *SyncEdit; + + /// DOCME wxTextCtrl *UpdatedEdit; + + /// DOCME wxTextCtrl *UpdateDetailsEdit; + + /// DOCME wxComboBox *WrapStyle; + + /// DOCME wxComboBox *collision; + + /// DOCME wxTextCtrl *ResX; + + /// DOCME wxTextCtrl *ResY; + + /// DOCME wxCheckBox *ScaleBorder; + + /// DOCME wxString ResXValue; + + /// DOCME wxString ResYValue; void OnOK(wxCommandEvent &event); @@ -83,6 +117,9 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_FROM_VIDEO = 1100 }; + diff --git a/aegisub/src/dialog_resample.cpp b/aegisub/src/dialog_resample.cpp index eb426a7a0..23a4ee449 100644 --- a/aegisub/src/dialog_resample.cpp +++ b/aegisub/src/dialog_resample.cpp @@ -54,8 +54,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogResample::DialogResample(wxWindow *parent, SubtitlesGrid *_grid) : wxDialog (parent,-1,_("Resample resolution"),wxDefaultPosition) { @@ -141,11 +144,24 @@ BEGIN_EVENT_TABLE(DialogResample,wxDialog) END_EVENT_TABLE() -///////////////// -// Resample tags + +/// @brief Resample tags +/// @param name +/// @param n +/// @param curParam +/// @param _curDiag +/// void DialogResample::ResampleTags (wxString name,int n,AssOverrideParameter *curParam,void *_curDiag) { instance->DoResampleTags(name,n,curParam,_curDiag); } + +/// @brief DOCME +/// @param name +/// @param n +/// @param curParam +/// @param _curDiag +/// @return +/// void DialogResample::DoResampleTags (wxString name,int n,AssOverrideParameter *curParam,void *_curDiag) { double resizer = 1.0; bool isX = false; @@ -203,8 +219,11 @@ void DialogResample::DoResampleTags (wxString name,int n,AssOverrideParameter *c } -//////////// -// Resample + +/// @brief Resample +/// @param event +/// @return +/// void DialogResample::OnResample (wxCommandEvent &event) { // Resolutions AssFile *subs = AssFile::top; @@ -312,16 +331,20 @@ void DialogResample::OnResample (wxCommandEvent &event) { } -///////////////////////////////////////// -// Get destination resolution from video + +/// @brief Get destination resolution from video +/// @param event +/// void DialogResample::OnGetDestRes (wxCommandEvent &event) { ResX->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetWidth())); ResY->SetValue(wxString::Format(_T("%i"),VideoContext::Get()->GetHeight())); } -//////////////////////////////// -// Symmetrical checkbox clicked + +/// @brief Symmetrical checkbox clicked +/// @param event +/// void DialogResample::OnSymmetrical (wxCommandEvent &event) { bool state = !MarginSymmetrical->IsChecked(); MarginRight->Enable(state); @@ -333,8 +356,11 @@ void DialogResample::OnSymmetrical (wxCommandEvent &event) { } -//////////////////////// -// Margin value changed + +/// @brief Margin value changed +/// @param event +/// @return +/// void DialogResample::OnMarginChange (wxCommandEvent &event) { if (!MarginSymmetrical) return; bool state = !MarginSymmetrical->IsChecked(); @@ -345,7 +371,8 @@ void DialogResample::OnMarginChange (wxCommandEvent &event) { } -//////////////////// -// Static variables + +/// DOCME DialogResample *DialogResample::instance = NULL; + diff --git a/aegisub/src/dialog_resample.h b/aegisub/src/dialog_resample.h index 4352b1cd0..76f6501c0 100644 --- a/aegisub/src/dialog_resample.h +++ b/aegisub/src/dialog_resample.h @@ -36,6 +36,8 @@ #ifndef DIALOG_RESAMPLE_H + +/// DOCME #define DIALOG_RESAMPLE_H @@ -54,23 +56,61 @@ class SubtitlesGrid; class AssOverrideParameter; -///////// -// Class + +/// DOCME +/// @class DialogResample +/// @brief DOCME +/// +/// DOCME class DialogResample : public wxDialog { private: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME + + /// DOCME wxString ResXValue,ResYValue; + + /// DOCME wxTextCtrl *ResX; + + /// DOCME wxTextCtrl *ResY; + + /// DOCME wxTextCtrl *MarginLeft; + + /// DOCME wxTextCtrl *MarginRight; + + /// DOCME wxTextCtrl *MarginTop; + + /// DOCME wxTextCtrl *MarginBottom; + + /// DOCME wxCheckBox *Anamorphic; + + /// DOCME wxCheckBox *MarginSymmetrical; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME double rx,ry,r,ar; + + /// DOCME long m[4]; + + /// DOCME static DialogResample *instance; void OnResample (wxCommandEvent &event); @@ -91,15 +131,30 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_DEST_FROM_VIDEO = 1520, + + /// DOCME CHECK_ANAMORPHIC, + + /// DOCME CHECK_SYMMETRICAL, + + /// DOCME TEXT_MARGIN_T, + + /// DOCME TEXT_MARGIN_L, + + /// DOCME TEXT_MARGIN_R, + + /// DOCME TEXT_MARGIN_B }; #endif + diff --git a/aegisub/src/dialog_search_replace.cpp b/aegisub/src/dialog_search_replace.cpp index 7e50f3799..f3fec807e 100644 --- a/aegisub/src/dialog_search_replace.cpp +++ b/aegisub/src/dialog_search_replace.cpp @@ -53,8 +53,12 @@ #include "main.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _hasReplace +/// @param name +/// DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxString name) : wxDialog(parent, -1, name, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("SearchReplace")) { @@ -139,16 +143,18 @@ DialogSearchReplace::DialogSearchReplace (wxWindow *parent,bool _hasReplace,wxSt } -////////////// -// Destructor + +/// @brief Destructor +/// DialogSearchReplace::~DialogSearchReplace() { // Save options UpdateSettings(); } -///////////////// -// Update search + +/// @brief Update search +/// void DialogSearchReplace::UpdateSettings() { Search.isReg = CheckRegExp->IsChecked() && CheckRegExp->IsEnabled(); Search.matchCase = CheckMatchCase->IsChecked(); @@ -174,8 +180,10 @@ BEGIN_EVENT_TABLE(DialogSearchReplace,wxDialog) END_EVENT_TABLE() -///////// -// Close + +/// @brief Close +/// @param event +/// void DialogSearchReplace::OnClose (wxCommandEvent &event) { Search.OnDialogClose(); // Just hide @@ -183,8 +191,10 @@ void DialogSearchReplace::OnClose (wxCommandEvent &event) { } -/////// -// Key + +/// @brief Key +/// @param event +/// void DialogSearchReplace::OnKeyDown (wxKeyEvent &event) { //if (event.GetKeyCode() == WXK_ESCAPE) { // Search.OnDialogClose(); @@ -195,8 +205,11 @@ void DialogSearchReplace::OnKeyDown (wxKeyEvent &event) { } -/////////////////// -// Find or replace + +/// @brief Find or replace +/// @param mode +/// @return +/// void DialogSearchReplace::FindReplace(int mode) { // Check mode if (mode < 0 || mode > 2) return; @@ -239,29 +252,36 @@ void DialogSearchReplace::FindReplace(int mode) { } -///////////// -// Find next + +/// @brief Find next +/// @param event +/// void DialogSearchReplace::OnFindNext (wxCommandEvent &event) { FindReplace(0); } -//////////////// -// Replace next + +/// @brief Replace next +/// @param event +/// void DialogSearchReplace::OnReplaceNext (wxCommandEvent &event) { FindReplace(1); } -/////////////// -// Replace all + +/// @brief Replace all +/// @param event +/// void DialogSearchReplace::OnReplaceAll (wxCommandEvent &event) { FindReplace(2); } -////////////////////////// -// Update drop down boxes + +/// @brief Update drop down boxes +/// void DialogSearchReplace::UpdateDropDowns() { // Find FindEdit->Freeze(); @@ -281,32 +301,44 @@ void DialogSearchReplace::UpdateDropDowns() { } + +/// @brief DOCME +/// @param event +/// void DialogSearchReplace::OnSetFocus (wxFocusEvent &event) { Search.hasFocus = true; } + +/// @brief DOCME +/// @param event +/// void DialogSearchReplace::OnKillFocus (wxFocusEvent &event) { Search.hasFocus = false; } -/////////////////////// SearchReplaceEngine /////////////////////// -/////////////// -// Constructor + +/// @brief Constructor SearchReplaceEngine /////////////////////// +/// SearchReplaceEngine::SearchReplaceEngine () { CanContinue = false; } -////////////////////// -// Find next instance + +/// @brief Find next instance +/// void SearchReplaceEngine::FindNext() { ReplaceNext(false); } -//////////////////////////////// -// Find & Replace next instance + +/// @brief Find & Replace next instance +/// @param DoReplace +/// @return +/// void SearchReplaceEngine::ReplaceNext(bool DoReplace) { // Check if it's OK to go on if (!CanContinue) { @@ -440,8 +472,9 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) { } -///////////////////////// -// Replace all instances + +/// @brief Replace all instances +/// void SearchReplaceEngine::ReplaceAll() { // Setup wxString *Text; @@ -536,8 +569,9 @@ void SearchReplaceEngine::ReplaceAll() { } -//////////////////////// -// Search dialog opened + +/// @brief Search dialog opened +/// void SearchReplaceEngine::OnDialogOpen() { // Set curline wxArrayInt sels = grid->GetSelection(); @@ -553,15 +587,19 @@ void SearchReplaceEngine::OnDialogOpen() { } -//////////////////////// -// Search dialog closed + +/// @brief Search dialog closed +/// void SearchReplaceEngine::OnDialogClose() { if (Modified) grid->CommitChanges(); } -/////////////// -// Open dialog + +/// @brief Open dialog +/// @param replace +/// @return +/// void SearchReplaceEngine::OpenDialog (bool replace) { static DialogSearchReplace *diag = NULL; wxString title = replace? _("Replace") : _("Find"); @@ -586,8 +624,12 @@ void SearchReplaceEngine::OpenDialog (bool replace) { } -//////////////////// -// Get text pointer + +/// @brief Get text pointer +/// @param n +/// @param field +/// @return +/// wxString *SearchReplaceEngine::GetText(int n,int field) { AssDialogue *cur = grid->GetDialogue(n); if (field == 0) return &cur->Text; @@ -598,7 +640,8 @@ wxString *SearchReplaceEngine::GetText(int n,int field) { } -/////////////////// -// Global instance + +/// DOCME SearchReplaceEngine Search; + diff --git a/aegisub/src/dialog_search_replace.h b/aegisub/src/dialog_search_replace.h index 40398cd27..487c26b81 100644 --- a/aegisub/src/dialog_search_replace.h +++ b/aegisub/src/dialog_search_replace.h @@ -54,30 +54,68 @@ class SubtitlesGrid; -//////////////////// -// Search & Replace singleton + +/// DOCME +/// @class SearchReplaceEngine +/// @brief DOCME +/// +/// DOCME class SearchReplaceEngine { private: + + /// DOCME int curLine; + + /// DOCME size_t pos; + + /// DOCME size_t matchLen; + + /// DOCME size_t replaceLen; + + /// DOCME bool Modified; + + /// DOCME bool LastWasFind; + + /// DOCME bool hasReplace; wxString *GetText(int n,int field); public: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME bool isReg; + + /// DOCME bool matchCase; + + /// DOCME bool updateVideo; + + /// DOCME bool CanContinue; + + /// DOCME bool hasFocus; + + /// DOCME int field; + + /// DOCME int affect; + + /// DOCME wxString LookFor; + + /// DOCME wxString ReplaceWith; void FindNext(); @@ -95,20 +133,40 @@ public: extern SearchReplaceEngine Search; -////////////////////////// -// Search & Replace class + +/// DOCME +/// @class DialogSearchReplace +/// @brief DOCME +/// +/// DOCME class DialogSearchReplace : public wxDialog { friend class SearchReplaceEngine; private: + + /// DOCME bool hasReplace; + + /// DOCME wxComboBox *FindEdit; + + /// DOCME wxComboBox *ReplaceEdit; + + /// DOCME wxCheckBox *CheckMatchCase; + + /// DOCME wxCheckBox *CheckRegExp; + + /// DOCME wxCheckBox *CheckUpdateVideo; + + /// DOCME wxRadioBox *Affect; + + /// DOCME wxRadioBox *Field; void UpdateDropDowns(); @@ -134,11 +192,24 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_FIND_NEXT, + + /// DOCME BUTTON_REPLACE_NEXT, + + /// DOCME BUTTON_REPLACE_ALL, + + /// DOCME CHECK_MATCH_CASE, + + /// DOCME CHECK_REGEXP, + + /// DOCME CHECK_UPDATE_VIDEO }; + diff --git a/aegisub/src/dialog_selection.cpp b/aegisub/src/dialog_selection.cpp index 58205eb5c..78ca85060 100644 --- a/aegisub/src/dialog_selection.cpp +++ b/aegisub/src/dialog_selection.cpp @@ -49,8 +49,11 @@ #include "help_button.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogSelection::DialogSelection(wxWindow *parent, SubtitlesGrid *_grid) : wxDialog (parent,-1,_("Select"),wxDefaultPosition,wxDefaultSize,wxCAPTION) { @@ -138,8 +141,11 @@ wxDialog (parent,-1,_("Select"),wxDefaultPosition,wxDefaultSize,wxCAPTION) } -///////////////////// -// Matching function + +/// @brief Matching function +/// @param diag +/// @return +/// bool DialogSelection::StringMatches(AssDialogue *diag) { // Variables wxString text; @@ -208,8 +214,9 @@ bool DialogSelection::StringMatches(AssDialogue *diag) { } -/////////// -// Process + +/// @brief Process +/// void DialogSelection::Process() { // Prepare AssDialogue *current; @@ -271,8 +278,9 @@ void DialogSelection::Process() { } -///////////////// -// Save settings + +/// @brief Save settings +/// void DialogSelection::SaveSettings() { // Prepare settings int action = Action->GetSelection(); @@ -308,20 +316,28 @@ END_EVENT_TABLE() -////////////////////////////// -// Dialogue/Comment checkboxes + +/// @brief Dialogue/Comment checkboxes +/// @param event +/// void DialogSelection::OnDialogueCheckbox(wxCommandEvent &event) { if(!event.IsChecked() && !MatchComments->GetValue()) MatchComments->SetValue(true); } + +/// @brief DOCME +/// @param event +/// void DialogSelection::OnCommentCheckbox(wxCommandEvent &event) { if(!event.IsChecked() && !MatchDialogues->GetValue()) MatchDialogues->SetValue(true); } -////////////// -// OK pressed + +/// @brief OK pressed +/// @param event +/// void DialogSelection::OnOK(wxCommandEvent &event) { Process(); SaveSettings(); @@ -329,10 +345,13 @@ void DialogSelection::OnOK(wxCommandEvent &event) { } -////////////////// -// Cancel pressed + +/// @brief Cancel pressed +/// @param event +/// void DialogSelection::OnCancel(wxCommandEvent &event) { SaveSettings(); EndModal(0); } + diff --git a/aegisub/src/dialog_selection.h b/aegisub/src/dialog_selection.h index 266f16462..8ede8fb47 100644 --- a/aegisub/src/dialog_selection.h +++ b/aegisub/src/dialog_selection.h @@ -36,6 +36,8 @@ #ifndef DIALOG_SELECTION_H + +/// DOCME #define DIALOG_SELECTION_H @@ -55,21 +57,49 @@ class SubtitlesGrid; class AssDialogue; -////////////////////////// -// Selection dialog class + +/// DOCME +/// @class DialogSelection +/// @brief DOCME +/// +/// DOCME class DialogSelection : public wxDialog { private: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxTextCtrl *Match; + + /// DOCME wxCheckBox *MatchCase; + + /// DOCME wxCheckBox *MatchDialogues; + + /// DOCME wxCheckBox *MatchComments; + + /// DOCME wxRadioButton *Matches; + + /// DOCME wxRadioButton *DoesntMatch; + + /// DOCME wxRadioBox *Action; + + /// DOCME wxRadioBox *Field; + + /// DOCME wxRadioButton *Exact; + + /// DOCME wxRadioButton *Contains; + + /// DOCME wxRadioButton *RegExp; void Process(); @@ -91,9 +121,14 @@ public: /////// // IDs enum { + + /// DOCME MATCH_DIALOGUES_CHECKBOX = 3000, + + /// DOCME MATCH_COMMENTS_CHECKBOX }; #endif + diff --git a/aegisub/src/dialog_shift_times.cpp b/aegisub/src/dialog_shift_times.cpp index fe5cddd4c..f3b6a7878 100644 --- a/aegisub/src/dialog_shift_times.cpp +++ b/aegisub/src/dialog_shift_times.cpp @@ -61,8 +61,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid) : wxDialog(parent, -1, _("Shift Times"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("JumpTo")) { @@ -188,22 +191,29 @@ BEGIN_EVENT_TABLE(DialogShiftTimes, wxDialog) END_EVENT_TABLE() -///////////////// -// Clear History + +/// @brief Clear History +/// @param event +/// void DialogShiftTimes::OnClear(wxCommandEvent &event) { wxRemoveFile(StandardPaths::DecodePath(_T("?user/shift_history.txt"))); History->Clear(); } -////////// -// Cancel + +/// @brief Cancel +/// @param event +/// void DialogShiftTimes::OnClose(wxCommandEvent &event) { EndModal(0); } -///////// -// Apply + +/// @brief Apply +/// @param event +/// @return +/// void DialogShiftTimes::OnOK(wxCommandEvent &event) { // General values int type = TimesChoice->GetSelection(); @@ -308,8 +318,10 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) { } -/////////////// -// Set to time + +/// @brief Set to time +/// @param event +/// void DialogShiftTimes::OnRadioTime(wxCommandEvent &event) { ShiftTime->Enable(true); ShiftFrame->Enable(false); @@ -317,8 +329,10 @@ void DialogShiftTimes::OnRadioTime(wxCommandEvent &event) { } -//////////////// -// Set to frame + +/// @brief Set to frame +/// @param event +/// void DialogShiftTimes::OnRadioFrame(wxCommandEvent &event) { ShiftTime->Enable(false); ShiftFrame->Enable(true); @@ -326,8 +340,11 @@ void DialogShiftTimes::OnRadioFrame(wxCommandEvent &event) { } -///////////////////////////// -// Appends a line to history + +/// @brief Appends a line to history +/// @param text +/// @return +/// void DialogShiftTimes::AppendToHistory(wxString text) { // Open file if (HistoryFile.IsEmpty()) return; @@ -346,8 +363,10 @@ void DialogShiftTimes::AppendToHistory(wxString text) { } -/////////////////////////// -// Loads history from disk + +/// @brief Loads history from disk +/// @param filename +/// void DialogShiftTimes::LoadHistory(wxString filename) { // Open file using namespace std; @@ -378,3 +397,4 @@ void DialogShiftTimes::LoadHistory(wxString filename) { file.close(); } + diff --git a/aegisub/src/dialog_shift_times.h b/aegisub/src/dialog_shift_times.h index 7c2b636b1..0ce4f18aa 100644 --- a/aegisub/src/dialog_shift_times.h +++ b/aegisub/src/dialog_shift_times.h @@ -36,6 +36,8 @@ #ifndef DIALOG_SHIFT_TIMES_H + +/// DOCME #define DIALOG_SHIFT_TIMES_H @@ -53,23 +55,53 @@ class SubtitlesGrid; -///////// -// Class + +/// DOCME +/// @class DialogShiftTimes +/// @brief DOCME +/// +/// DOCME class DialogShiftTimes : public wxDialog { private: + + /// DOCME bool ready; + + /// DOCME SubtitlesGrid *grid; + + /// DOCME int shiftframe; + + /// DOCME wxString HistoryFile; + + /// DOCME TimeEdit *ShiftTime; + + /// DOCME wxTextCtrl *ShiftFrame; + + /// DOCME wxRadioButton *RadioTime; + + /// DOCME wxRadioButton *RadioFrames; + + /// DOCME wxRadioButton *DirectionForward; + + /// DOCME wxRadioButton *DirectionBackward; + + /// DOCME wxRadioBox *SelChoice; + + /// DOCME wxRadioBox *TimesChoice; + + /// DOCME wxListBox *History; void AppendToHistory(wxString text); @@ -94,15 +126,30 @@ public: /////// // IDs enum { + + /// DOCME TEXT_SHIFT_TIME = 1100, + + /// DOCME TEXT_SHIFT_FRAME, + + /// DOCME RADIO_BACKWARD, + + /// DOCME RADIO_FORWARD, + + /// DOCME RADIO_TIME, + + /// DOCME RADIO_FRAME, + + /// DOCME SHIFT_CLEAR_HISTORY }; #endif + diff --git a/aegisub/src/dialog_spellchecker.cpp b/aegisub/src/dialog_spellchecker.cpp index b5b959bf2..a47b2a987 100644 --- a/aegisub/src/dialog_spellchecker.cpp +++ b/aegisub/src/dialog_spellchecker.cpp @@ -56,18 +56,35 @@ /////// // IDs enum { + + /// DOCME BUTTON_REPLACE = 1720, + + /// DOCME BUTTON_IGNORE, + + /// DOCME BUTTON_REPLACE_ALL, + + /// DOCME BUTTON_IGNORE_ALL, + + /// DOCME BUTTON_ADD, + + /// DOCME LIST_SUGGESTIONS, + + /// DOCME LIST_LANGUAGES }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @return +/// DialogSpellChecker::DialogSpellChecker(wxFrame *parent) : wxDialog(parent, -1, _("Spell Checker"), wxDefaultPosition, wxDefaultSize) { @@ -155,15 +172,20 @@ DialogSpellChecker::DialogSpellChecker(wxFrame *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogSpellChecker::~DialogSpellChecker() { if (spellchecker) delete spellchecker; } -/////////////////// -// Find next match + +/// @brief Find next match +/// @param startLine +/// @param startPos +/// @return +/// bool DialogSpellChecker::FindNext(int startLine,int startPos) { // Set start if (startLine != -1) lastLine = startLine; @@ -226,8 +248,10 @@ bool DialogSpellChecker::FindNext(int startLine,int startPos) { } -//////////// -// Set word + +/// @brief Set word +/// @param word +/// void DialogSpellChecker::SetWord(wxString word) { // Get list of suggestions wxArrayString sugs = spellchecker->GetSuggestions(word); @@ -267,23 +291,29 @@ BEGIN_EVENT_TABLE(DialogSpellChecker,wxDialog) END_EVENT_TABLE() -///////// -// Close + +/// @brief Close +/// @param event +/// void DialogSpellChecker::OnClose(wxCommandEvent &event) { Destroy(); } -/////////// -// Replace + +/// @brief Replace +/// @param event +/// void DialogSpellChecker::OnReplace(wxCommandEvent &event) { Replace(); FindOrDie(); } -////////////////////// -// Replace all errors + +/// @brief Replace all errors +/// @param event +/// void DialogSpellChecker::OnReplaceAll(wxCommandEvent &event) { // Add word to autoreplace list autoReplace[origWord->GetValue()] = replaceWord->GetValue(); @@ -294,16 +324,20 @@ void DialogSpellChecker::OnReplaceAll(wxCommandEvent &event) { } -///////////////////// -// Ignore this error + +/// @brief Ignore this error +/// @param event +/// void DialogSpellChecker::OnIgnore(wxCommandEvent &event) { // Next FindOrDie(); } -///////////////////// -// Ignore all errors + +/// @brief Ignore all errors +/// @param event +/// void DialogSpellChecker::OnIgnoreAll(wxCommandEvent &event) { // Add word to autoignore list autoIgnore.Add(origWord->GetValue()); @@ -313,16 +347,20 @@ void DialogSpellChecker::OnIgnoreAll(wxCommandEvent &event) { } -///////////////////// -// Add to dictionary + +/// @brief Add to dictionary +/// @param event +/// void DialogSpellChecker::OnAdd(wxCommandEvent &event) { spellchecker->AddWord(origWord->GetValue()); FindOrDie(); } -/////////////////////////////////////////////// -// Goes to next... if it can't find one, close + +/// @brief Goes to next... if it can't find one, close +/// @return +/// bool DialogSpellChecker::FindOrDie() { if (!FindNext()) { wxMessageBox(_("Aegisub has finished checking spelling of this script."),_("Spell checking complete.")); @@ -333,8 +371,9 @@ bool DialogSpellChecker::FindOrDie() { } -/////////// -// Replace + +/// @brief Replace +/// void DialogSpellChecker::Replace() { // Get dialog SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; @@ -350,8 +389,10 @@ void DialogSpellChecker::Replace() { } -/////////////////// -// Change language + +/// @brief Change language +/// @param event +/// void DialogSpellChecker::OnChangeLanguage(wxCommandEvent &event) { // Change language code wxString code = langCodes[language->GetSelection()]; @@ -364,15 +405,19 @@ void DialogSpellChecker::OnChangeLanguage(wxCommandEvent &event) { } -///////////////////// -// Change suggestion + +/// @brief Change suggestion +/// @param event +/// void DialogSpellChecker::OnChangeSuggestion(wxCommandEvent &event) { replaceWord->SetValue(suggestList->GetStringSelection()); } -///////////////////////////////// -// Suggestion box double clicked + +/// @brief Suggestion box double clicked +/// @param event +/// void DialogSpellChecker::OnTakeSuggestion(wxCommandEvent &event) { // First line should be unnecessary due to event above, but you never know... replaceWord->SetValue(suggestList->GetStringSelection()); @@ -381,8 +426,9 @@ void DialogSpellChecker::OnTakeSuggestion(wxCommandEvent &event) { } -/////////////// -// First match + +/// @brief First match +/// bool DialogSpellChecker::GetFirstMatch() { // Get selection SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsBox; @@ -401,3 +447,4 @@ bool DialogSpellChecker::GetFirstMatch() { return true; } + diff --git a/aegisub/src/dialog_spellchecker.h b/aegisub/src/dialog_spellchecker.h index 2c3bb6827..26f07ada3 100644 --- a/aegisub/src/dialog_spellchecker.h +++ b/aegisub/src/dialog_spellchecker.h @@ -51,24 +51,54 @@ class SpellChecker; -////////////////////////////// -// Spell checker dialog class + +/// DOCME +/// @class DialogSpellChecker +/// @brief DOCME +/// +/// DOCME class DialogSpellChecker : public wxDialog { private: + + /// DOCME SpellChecker *spellchecker; + + /// DOCME std::map autoReplace; + + /// DOCME wxArrayString autoIgnore; + + /// DOCME wxArrayString langCodes; + + /// DOCME + + /// DOCME int wordStart,wordEnd; + + /// DOCME int lastLine; + + /// DOCME int lastPos; + + /// DOCME int firstLine; + + /// DOCME wxTextCtrl *origWord; + + /// DOCME wxTextCtrl *replaceWord; + + /// DOCME wxListBox *suggestList; + + /// DOCME wxComboBox *language; bool FindOrDie(); @@ -95,3 +125,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/dialog_splash.cpp b/aegisub/src/dialog_splash.cpp index 51690064e..e04df9f14 100644 --- a/aegisub/src/dialog_splash.cpp +++ b/aegisub/src/dialog_splash.cpp @@ -49,8 +49,10 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// SplashScreen::SplashScreen(wxWindow *parent) : wxFrame (parent, -1, _T(""), wxDefaultPosition, wxSize(420,240), wxSTAY_ON_TOP | wxFRAME_NO_TASKBAR , _T("Splash")) { @@ -94,8 +96,9 @@ SplashScreen::SplashScreen(wxWindow *parent) } -////////////// -// Destructor + +/// @brief Destructor +/// SplashScreen::~SplashScreen () { // Kill timer delete autoClose; @@ -111,16 +114,20 @@ BEGIN_EVENT_TABLE(SplashScreen, wxFrame) END_EVENT_TABLE() -/////////// -// OnPaint + +/// @brief OnPaint +/// @param event +/// void SplashScreen::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); dc.DrawBitmap(splash,0,0); } -//////////////// -// Mouse events + +/// @brief Mouse events +/// @param event +/// void SplashScreen::OnMouseEvent(wxMouseEvent& event) { if (event.ButtonDown()) { // Show tip of the day @@ -130,11 +137,14 @@ void SplashScreen::OnMouseEvent(wxMouseEvent& event) { } -///////// -// Timer + +/// @brief Timer +/// @param event +/// void SplashScreen::OnTimer(wxTimerEvent &event) { // Show tip of the day Destroy(); TipOfTheDay::Show(par); } + diff --git a/aegisub/src/dialog_splash.h b/aegisub/src/dialog_splash.h index 5ddbab750..e67666cb0 100644 --- a/aegisub/src/dialog_splash.h +++ b/aegisub/src/dialog_splash.h @@ -36,6 +36,8 @@ #ifndef SPLASH_H + +/// DOCME #define SPLASH_H @@ -46,16 +48,26 @@ #include -/////////////////////// -// Splash screen class + +/// DOCME +/// @class SplashScreen +/// @brief DOCME +/// +/// DOCME class SplashScreen: public wxFrame { private: + + /// DOCME wxWindow *par; + + /// DOCME wxBitmap splash; public: SplashScreen(wxWindow *parent); ~SplashScreen(); + + /// DOCME wxTimer *autoClose; void OnPaint(wxPaintEvent& event); @@ -68,3 +80,4 @@ public: #endif + diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index 5efc2e413..da01c4898 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -64,40 +64,104 @@ /////// // IDs enum { + + /// DOCME BUTTON_STYLE_FONT = 1050, + + /// DOCME CHECKBOX_STYLE_BOLD, + + /// DOCME CHECKBOX_STYLE_ITALIC, + + /// DOCME CHECKBOX_STYLE_UNDERLINE, + + /// DOCME CHECKBOX_STYLE_STRIKEOUT, + + /// DOCME CHECKBOX_OUTLINE, + + /// DOCME BUTTON_COLOR_1, + + /// DOCME BUTTON_COLOR_2, + + /// DOCME BUTTON_COLOR_3, + + /// DOCME BUTTON_COLOR_4, + + /// DOCME BUTTON_PREVIEW_COLOR, + + /// DOCME RADIO_ALIGNMENT, + + /// DOCME TEXT_FONT_NAME, + + /// DOCME TEXT_FONT_SIZE, + + /// DOCME TEXT_ALPHA_1, + + /// DOCME TEXT_ALPHA_2, + + /// DOCME TEXT_ALPHA_3, + + /// DOCME TEXT_ALPHA_4, + + /// DOCME TEXT_MARGIN_L, + + /// DOCME TEXT_MARGIN_R, + + /// DOCME TEXT_MARGIN_V, + + /// DOCME TEXT_OUTLINE, + + /// DOCME TEXT_SHADOW, + + /// DOCME TEXT_SCALE_X, + + /// DOCME TEXT_SCALE_Y, + + /// DOCME TEXT_ANGLE, + + /// DOCME TEXT_SPACING, + + /// DOCME TEXT_PREVIEW, + + /// DOCME COMBO_ENCODING }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _style +/// @param _grid +/// @param local +/// @param _store +/// DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, SubtitlesGrid *_grid,bool local,AssStyleStorage *_store) : wxDialog (parent,-1,_("Style Editor"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,_T("DialogStyleEditor")) { @@ -363,8 +427,9 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit } -////////////// -// Destructor + +/// @brief Destructor +/// DialogStyleEditor::~DialogStyleEditor () { delete work; } @@ -399,19 +464,50 @@ BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog) END_EVENT_TABLE() -///////////////////// -// Event redirectors + +/// @brief Event redirectors +/// @param event +/// void DialogStyleEditor::OnApply (wxCommandEvent &event) { Apply(true,false); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnOK (wxCommandEvent &event) { SavePosition(); Apply(true,true); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnCancel (wxCommandEvent &event) { SavePosition(); Apply(false,true); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnSetColor1 (wxCommandEvent &event) { OnSetColor(1); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnSetColor2 (wxCommandEvent &event) { OnSetColor(2); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnSetColor3 (wxCommandEvent &event) { OnSetColor(3); } + +/// @brief DOCME +/// @param event +/// void DialogStyleEditor::OnSetColor4 (wxCommandEvent &event) { OnSetColor(4); } -///////////////// -// Replace Style + +/// @brief Replace Style +/// @param tag +/// @param n +/// @param param +/// @param userData +/// void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData) { wxArrayString strings = *((wxArrayString*)userData); if (tag == _T("\\r")) { @@ -424,8 +520,12 @@ void ReplaceStyle(wxString tag,int n,AssOverrideParameter* param,void *userData) } -////////// -// Events + +/// @brief Events +/// @param apply +/// @param close +/// @return +/// void DialogStyleEditor::Apply (bool apply,bool close) { // Apply if (apply) { @@ -512,8 +612,9 @@ void DialogStyleEditor::Apply (bool apply,bool close) { } -///////////////////// -// Update work style + +/// @brief Update work style +/// void DialogStyleEditor::UpdateWorkStyle() { // Font and its size work->font = FontName->GetValue(); @@ -562,8 +663,10 @@ void DialogStyleEditor::UpdateWorkStyle() { } -/////////////////// -// Choose font box + +/// @brief Choose font box +/// @param event +/// void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) { wxFont oldfont (int(work->fontsize), wxFONTFAMILY_DEFAULT, (work->italic?wxFONTSTYLE_ITALIC:wxFONTSTYLE_NORMAL), (work->bold?wxFONTWEIGHT_BOLD:wxFONTWEIGHT_NORMAL), work->underline, work->font, wxFONTENCODING_DEFAULT); wxFont newfont = wxGetFontFromUser(this,oldfont); @@ -589,8 +692,10 @@ void DialogStyleEditor::OnChooseFont (wxCommandEvent &event) { } -//////////////////////////////////////////////// -// Sets color for one of the four color buttons + +/// @brief Sets color for one of the four color buttons +/// @param n +/// void DialogStyleEditor::OnSetColor (int n) { AssColor *modify; switch (n) { @@ -605,8 +710,10 @@ void DialogStyleEditor::OnSetColor (int n) { } -////////////////////// -// Child focus change + +/// @brief Child focus change +/// @param event +/// void DialogStyleEditor::OnChildFocus (wxChildFocusEvent &event) { UpdateWorkStyle(); if (SubsPreview) SubsPreview->SetStyle(work); @@ -614,8 +721,10 @@ void DialogStyleEditor::OnChildFocus (wxChildFocusEvent &event) { } -//////////////////////// -// Preview text changed + +/// @brief Preview text changed +/// @param event +/// void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) { if (PreviewText) { if (SubsPreview) SubsPreview->SetText(PreviewText->GetValue()); @@ -624,8 +733,10 @@ void DialogStyleEditor::OnPreviewTextChange (wxCommandEvent &event) { } -///////////////////////////////////////// -// Change colour of preview's background + +/// @brief Change colour of preview's background +/// @param event +/// void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &event) { if (SubsPreview) SubsPreview->SetColour(previewButton->GetColour()); Options.SetColour(_T("Style editor preview background"),previewButton->GetColour()); @@ -633,8 +744,11 @@ void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &event) { } -/////////////////////////////////// -// Command event to update preview + +/// @brief Command event to update preview +/// @param event +/// @return +/// void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) { if (!IsShownOnScreen()) return; UpdateWorkStyle(); @@ -643,8 +757,11 @@ void DialogStyleEditor::OnCommandPreviewUpdate (wxCommandEvent &event) { } -/////////////////////////////////////// -// Converts control value to alignment + +/// @brief Converts control value to alignment +/// @param n +/// @return +/// int DialogStyleEditor::ControlToAlign (int n) { switch (n) { case 0: return 7; @@ -661,8 +778,11 @@ int DialogStyleEditor::ControlToAlign (int n) { } -/////////////////////////////////////// -// Converts alignment value to control + +/// @brief Converts alignment value to control +/// @param n +/// @return +/// int DialogStyleEditor::AlignToControl (int n) { switch (n) { case 7: return 0; @@ -679,12 +799,16 @@ int DialogStyleEditor::AlignToControl (int n) { } -///////////////////////////////////////////////// -// Load and save window position for the session + +/// @brief Load and save window position for the session +/// void DialogStyleEditor::SavePosition() { use_saved_position = true; saved_position = GetRect(); } + +/// @brief DOCME +/// void DialogStyleEditor::LoadPosition() { if (use_saved_position) SetSize(saved_position); @@ -693,8 +817,11 @@ void DialogStyleEditor::LoadPosition() { } -///////////////////////////////////// -// Static class data saving position + +/// DOCME wxRect DialogStyleEditor::saved_position; + +/// DOCME bool DialogStyleEditor::use_saved_position = false; + diff --git a/aegisub/src/dialog_style_editor.h b/aegisub/src/dialog_style_editor.h index 6111dd58d..417e7379b 100644 --- a/aegisub/src/dialog_style_editor.h +++ b/aegisub/src/dialog_style_editor.h @@ -36,6 +36,8 @@ #ifndef DIALOG_STYLE_EDITOR_H + +/// DOCME #define DIALOG_STYLE_EDITOR_H @@ -57,51 +59,133 @@ class SubtitlesPreview; class AssStyleStorage; -///////// -// Class + +/// DOCME +/// @class DialogStyleEditor +/// @brief DOCME +/// +/// DOCME class DialogStyleEditor : public wxDialog { private: + + /// DOCME bool isLocal; + + /// DOCME AssStyle *style; + + /// DOCME AssStyle *work; + + /// DOCME SubtitlesGrid *grid; + + /// DOCME AssStyleStorage *store; + + /// DOCME wxString FontSizeValue; + + /// DOCME wxString AlignmentValue; + + /// DOCME wxString OutlineValue; + + /// DOCME wxString ShadowValue; + + /// DOCME wxString ScaleXValue; + + /// DOCME wxString ScaleYValue; + + /// DOCME wxString AngleValue; + + /// DOCME wxString EncodingValue; + + /// DOCME wxString SpacingValue; + + /// DOCME wxTextCtrl *StyleName; + + /// DOCME wxComboBox *FontName; + + /// DOCME wxTextCtrl *FontSize; + + /// DOCME wxCheckBox *BoxBold; + + /// DOCME wxCheckBox *BoxItalic; + + /// DOCME wxCheckBox *BoxUnderline; + + /// DOCME wxCheckBox *BoxStrikeout; + + /// DOCME ColourButton *colorButton[4]; + + /// DOCME wxSpinCtrl *colorAlpha[4]; + + /// DOCME wxSpinCtrl *margin[4]; + + /// DOCME wxRadioBox *Alignment; + + /// DOCME wxTextCtrl *Outline; + + /// DOCME wxTextCtrl *Shadow; + + /// DOCME wxCheckBox *OutlineType; + + /// DOCME wxTextCtrl *ScaleX; + + /// DOCME wxTextCtrl *ScaleY; + + /// DOCME wxTextCtrl *Angle; + + /// DOCME wxComboBox *Encoding; + + /// DOCME wxTextCtrl *Spacing; + + /// DOCME wxTextCtrl *PreviewText; + + /// DOCME SubtitlesPreview *SubsPreview; + + /// DOCME ColourButton *previewButton; + + /// DOCME wxSizer *MainSizer; + + /// DOCME static wxRect saved_position; + + /// DOCME static bool use_saved_position; void SavePosition(); void LoadPosition(); @@ -121,6 +205,10 @@ private: void OnSetColor4 (wxCommandEvent &event); void OnChildFocus (wxChildFocusEvent &event); void OnCommandPreviewUpdate (wxCommandEvent &event); + + /// @brief DOCME + /// @param event + /// void OnSpinPreviewUpdate (wxSpinEvent &event) { OnCommandPreviewUpdate(event); } void OnPreviewTextChange (wxCommandEvent &event); void OnPreviewColourChange (wxCommandEvent &event); @@ -138,3 +226,4 @@ public: #endif + diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 8141c5d4b..42b21150d 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -59,8 +59,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid) : wxDialog (parent,-1,_("Styles Manager"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,_T("DialogStylesManager")) { @@ -224,8 +227,9 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogStyleManager::~DialogStyleManager() { int sel = CatalogList->GetSelection(); if (sel != wxNOT_FOUND) { @@ -238,8 +242,9 @@ DialogStyleManager::~DialogStyleManager() { } -///////////////////// -// Loads the catalog + +/// @brief Loads the catalog +/// void DialogStyleManager::LoadCatalog () { // Clear CatalogList->Clear(); @@ -284,8 +289,10 @@ void DialogStyleManager::LoadCatalog () { } -//////////////////// -// Loads style list + +/// @brief Loads style list +/// @param subs +/// void DialogStyleManager::LoadCurrentStyles (AssFile *subs) { using std::list; AssStyle *style; @@ -307,6 +314,9 @@ void DialogStyleManager::LoadCurrentStyles (AssFile *subs) { UpdateMoveButtons(); } + +/// @brief DOCME +/// void DialogStyleManager::LoadStorageStyles () { using std::list; AssStyle *style; @@ -333,8 +343,10 @@ void DialogStyleManager::LoadStorageStyles () { } -/////////////////////////////////////// -// Enables or disables storage actions + +/// @brief Enables or disables storage actions +/// @param state +/// void DialogStyleManager::StorageActions (bool state) { StorageList->Enable(state); MoveToLocal->Enable(state); @@ -389,16 +401,20 @@ END_EVENT_TABLE() ////////// // Events -///////// -// Close + +/// @brief Close +/// @param event +/// void DialogStyleManager::OnClose (wxCommandEvent &event) { GetPosition(&lastx, &lasty); Close(); } -//////////////////////// -// Change catalog entry + +/// @brief Change catalog entry +/// @param event +/// void DialogStyleManager::OnChangeCatalog (wxCommandEvent &event) { int sel = CatalogList->GetSelection(); if (sel != wxNOT_FOUND) { @@ -415,8 +431,11 @@ void DialogStyleManager::OnChangeCatalog (wxCommandEvent &event) { } -///////////////////// -// New catalog entry + +/// @brief New catalog entry +/// @param event +/// @return +/// void DialogStyleManager::OnCatalogNew (wxCommandEvent &event) { wxString name = wxGetTextFromUser(_("New storage name:"), _("New catalog entry"), _T(""), this); if (!name.empty()) { @@ -463,8 +482,10 @@ void DialogStyleManager::OnCatalogNew (wxCommandEvent &event) { } -////////////////// -// Catalog delete + +/// @brief Catalog delete +/// @param event +/// void DialogStyleManager::OnCatalogDelete (wxCommandEvent &event) { int sel = CatalogList->GetSelection(); if (sel != wxNOT_FOUND) { @@ -482,8 +503,10 @@ void DialogStyleManager::OnCatalogDelete (wxCommandEvent &event) { } -///////////////////////// -// Edit style on storage + +/// @brief Edit style on storage +/// @param event +/// void DialogStyleManager::OnStorageEdit (wxCommandEvent &event) { wxArrayInt selections; int n = StorageList->GetSelections(selections); @@ -504,8 +527,10 @@ void DialogStyleManager::OnStorageEdit (wxCommandEvent &event) { } -//////////////////////////////// -// Edit style on current script + +/// @brief Edit style on current script +/// @param event +/// void DialogStyleManager::OnCurrentEdit (wxCommandEvent &event) { wxArrayInt selections; int n = CurrentList->GetSelections(selections); @@ -524,8 +549,10 @@ void DialogStyleManager::OnCurrentEdit (wxCommandEvent &event) { } -/////////////////////////////////////// -// Selection on current script changed + +/// @brief Selection on current script changed +/// @param event +/// void DialogStyleManager::OnCurrentChange (wxCommandEvent &event) { wxArrayInt selections; int n = CurrentList->GetSelections(selections); @@ -538,8 +565,10 @@ void DialogStyleManager::OnCurrentChange (wxCommandEvent &event) { } -//////////////////////////////// -// Selection on storage changed + +/// @brief Selection on storage changed +/// @param event +/// void DialogStyleManager::OnStorageChange (wxCommandEvent &event) { wxArrayInt selections; int n = StorageList->GetSelections(selections); @@ -552,8 +581,11 @@ void DialogStyleManager::OnStorageChange (wxCommandEvent &event) { } -/////////////////// -// Copy to Storage + +/// @brief Copy to Storage +/// @param event +/// @return +/// void DialogStyleManager::OnCopyToStorage (wxCommandEvent &event) { // Check if there is actually a storage if (!StorageNew->IsEnabled()) { @@ -586,8 +618,10 @@ void DialogStyleManager::OnCopyToStorage (wxCommandEvent &event) { } -/////////////////// -// Copy to Current + +/// @brief Copy to Current +/// @param event +/// void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &event) { wxArrayInt selections; int n = StorageList->GetSelections(selections); @@ -616,8 +650,10 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &event) { } -///////////////////// -// Storage make copy + +/// @brief Storage make copy +/// @param event +/// void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) { wxArrayInt selections; StorageList->GetSelections(selections); @@ -640,8 +676,10 @@ void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) { } -///////////////////// -// Current make copy + +/// @brief Current make copy +/// @param event +/// void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) { wxArrayInt selections; CurrentList->GetSelections(selections); @@ -666,8 +704,11 @@ void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) { } -////////////////////// -// Copy to clipboard + +/// @brief Copy to clipboard +/// @param list +/// @param v +/// void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vector v) { wxString data = _T(""); AssStyle *s; @@ -686,8 +727,9 @@ void DialogStyleManager::CopyToClipboard (wxListBox *list, std::vectorClose(); } } -//////////////////////// -// Paste from clipboard + +/// @brief Paste from clipboard +/// void DialogStyleManager::PasteToCurrent() { wxString data = _T(""); @@ -724,6 +766,9 @@ void DialogStyleManager::PasteToCurrent() { } } + +/// @brief DOCME +/// void DialogStyleManager::PasteToStorage() { wxString data = _T(""); @@ -760,8 +805,10 @@ void DialogStyleManager::PasteToStorage() { } } -/////////////// -// Storage new + +/// @brief Storage new +/// @param event +/// void DialogStyleManager::OnStorageNew (wxCommandEvent &event) { AssStyle *temp = new AssStyle; @@ -777,8 +824,10 @@ void DialogStyleManager::OnStorageNew (wxCommandEvent &event) { } -/////////////// -// Current new + +/// @brief Current new +/// @param event +/// void DialogStyleManager::OnCurrentNew (wxCommandEvent &event) { AssStyle *temp = new AssStyle; @@ -793,8 +842,10 @@ void DialogStyleManager::OnCurrentNew (wxCommandEvent &event) { } -////////////////// -// Storage delete + +/// @brief Storage delete +/// @param event +/// void DialogStyleManager::OnStorageDelete (wxCommandEvent &event) { wxArrayInt selections; int n = StorageList->GetSelections(selections); @@ -827,8 +878,10 @@ void DialogStyleManager::OnStorageDelete (wxCommandEvent &event) { } -////////////////// -// Current delete + +/// @brief Current delete +/// @param event +/// void DialogStyleManager::OnCurrentDelete (wxCommandEvent &event) { wxArrayInt selections; int n = CurrentList->GetSelections(selections); @@ -863,8 +916,11 @@ void DialogStyleManager::OnCurrentDelete (wxCommandEvent &event) { } -///////////////////////////////////// -// Import styles from another script + +/// @brief Import styles from another script +/// @param event +/// @return +/// void DialogStyleManager::OnCurrentImport(wxCommandEvent &event) { // Get file name wxString path = Options.AsText(_T("Last open subtitles path")); @@ -931,8 +987,9 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &event) { } -/////////////////////// -// Update move buttons + +/// @brief Update move buttons +/// void DialogStyleManager::UpdateMoveButtons() { // Get storage selection wxArrayInt sels; @@ -995,21 +1052,63 @@ void DialogStyleManager::UpdateMoveButtons() { } -/////////////// -// Move events + +/// @brief Move events +/// @param event +/// void DialogStyleManager::OnStorageMoveUp (wxCommandEvent &event) { MoveStyles(true,0); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnStorageMoveTop (wxCommandEvent &event) { MoveStyles(true,1); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnStorageMoveDown (wxCommandEvent &event) { MoveStyles(true,2); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnStorageMoveBottom (wxCommandEvent &event) { MoveStyles(true,3); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnStorageSort (wxCommandEvent &event) { MoveStyles(true,4); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnCurrentMoveUp (wxCommandEvent &event) { MoveStyles(false,0); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnCurrentMoveTop (wxCommandEvent &event) { MoveStyles(false,1); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnCurrentMoveDown (wxCommandEvent &event) { MoveStyles(false,2); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnCurrentMoveBottom (wxCommandEvent &event) { MoveStyles(false,3); } + +/// @brief DOCME +/// @param event +/// void DialogStyleManager::OnCurrentSort (wxCommandEvent &event) { MoveStyles(false,4); } -///////////////// -// Move function + +/// @brief Move function +/// @param storage +/// @param type +/// @return +/// void DialogStyleManager::MoveStyles(bool storage, int type) { // Variables AssFile *subs = AssFile::top; @@ -1149,8 +1248,10 @@ void DialogStyleManager::MoveStyles(bool storage, int type) { } -////////////////// -// Keydown event + +/// @brief Keydown event +/// @param event +/// void DialogStyleManager::OnKeyDown(wxKeyEvent &event) { wxCommandEvent evt; switch(event.GetKeyCode()) { @@ -1202,20 +1303,28 @@ void DialogStyleManager::OnKeyDown(wxKeyEvent &event) { } } -////////////////// -// I have no clue + +/// DOCME int DialogStyleManager::lastx = -1; + +/// DOCME int DialogStyleManager::lasty = -1; -///////////////////////////////// -// DialogStyleManagerEvent stuff + +/// @brief DialogStyleManagerEvent stuff +/// @param ctrl +/// DialogStyleManagerEvent::DialogStyleManagerEvent(DialogStyleManager *ctrl) { control = ctrl; } BEGIN_EVENT_TABLE(DialogStyleManagerEvent, wxEvtHandler) EVT_KEY_DOWN(DialogStyleManagerEvent::OnKeyDown) END_EVENT_TABLE() + +/// @brief DOCME +/// @param event +/// void DialogStyleManagerEvent::OnKeyDown(wxKeyEvent &event) { control->OnKeyDown(event); //we need to access controls, so rather than make the controls public... } @@ -1223,3 +1332,4 @@ void DialogStyleManagerEvent::OnKeyDown(wxKeyEvent &event) { + diff --git a/aegisub/src/dialog_style_manager.h b/aegisub/src/dialog_style_manager.h index 927b770b4..46aec7e23 100644 --- a/aegisub/src/dialog_style_manager.h +++ b/aegisub/src/dialog_style_manager.h @@ -36,6 +36,8 @@ #ifndef DIALOG_STYLE_MANAGER_H + +/// DOCME #define DIALOG_STYLE_MANAGER_H @@ -57,39 +59,97 @@ class AssStyle; class SubtitlesGrid; -///////////////// -// Manager Class + +/// DOCME +/// @class DialogStyleManager +/// @brief DOCME +/// +/// DOCME class DialogStyleManager : public wxDialog { private: + + /// DOCME std::vector styleMap; + + /// DOCME std::vector styleStorageMap; + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxComboBox *CatalogList; + + /// DOCME wxListBox *StorageList; + + /// DOCME wxListBox *CurrentList; + + /// DOCME wxButton *MoveToLocal; + + /// DOCME wxButton *StorageNew; + + /// DOCME wxButton *StorageEdit; + + /// DOCME wxButton *StorageCopy; + + /// DOCME wxButton *StorageDelete; + + /// DOCME wxButton *StorageMoveUp; + + /// DOCME wxButton *StorageMoveDown; + + /// DOCME wxButton *StorageMoveTop; + + /// DOCME wxButton *StorageMoveBottom; + + /// DOCME wxButton *StorageSort; + + /// DOCME wxButton *MoveToStorage; + + /// DOCME wxButton *CurrentNew; + + /// DOCME wxButton *CurrentEdit; + + /// DOCME wxButton *CurrentCopy; + + /// DOCME wxButton *CurrentDelete; + + /// DOCME wxButton *CurrentMoveUp; + + /// DOCME wxButton *CurrentMoveDown; + + /// DOCME wxButton *CurrentMoveTop; + + /// DOCME wxButton *CurrentMoveBottom; + + /// DOCME wxButton *CurrentSort; + + /// DOCME AssStyleStorage Store; void StorageActions (bool state); @@ -99,9 +159,15 @@ private: void UpdateMoveButtons(); void MoveStyles(bool storage,int type); + + /// DOCME + + /// DOCME static int lastx, lasty; public: + + /// DOCME wxSizer *MainSizer; DialogStyleManager(wxWindow *parent,SubtitlesGrid *grid); @@ -147,39 +213,97 @@ public: /////// // IDs enum { + + /// DOCME BUTTON_CATALOG_NEW = 1000, + + /// DOCME BUTTON_CATALOG_DELETE, + + /// DOCME BUTTON_STORAGE_COPYTO, + + /// DOCME BUTTON_STORAGE_NEW, + + /// DOCME BUTTON_STORAGE_EDIT, + + /// DOCME BUTTON_STORAGE_COPY, + + /// DOCME BUTTON_STORAGE_DELETE, + + /// DOCME BUTTON_STORAGE_UP, + + /// DOCME BUTTON_STORAGE_DOWN, + + /// DOCME BUTTON_STORAGE_TOP, + + /// DOCME BUTTON_STORAGE_BOTTOM, + + /// DOCME BUTTON_STORAGE_SORT, + + /// DOCME BUTTON_CURRENT_COPYTO, + + /// DOCME BUTTON_CURRENT_NEW, + + /// DOCME BUTTON_CURRENT_EDIT, + + /// DOCME BUTTON_CURRENT_COPY, + + /// DOCME BUTTON_CURRENT_DELETE, + + /// DOCME BUTTON_CURRENT_IMPORT, + + /// DOCME BUTTON_CURRENT_UP, + + /// DOCME BUTTON_CURRENT_DOWN, + + /// DOCME BUTTON_CURRENT_TOP, + + /// DOCME BUTTON_CURRENT_BOTTOM, + + /// DOCME BUTTON_CURRENT_SORT, + + /// DOCME LIST_CATALOG, + + /// DOCME LIST_STORAGE, + + /// DOCME LIST_CURRENT }; -///////////////// -// Event handler + +/// DOCME +/// @class DialogStyleManagerEvent +/// @brief DOCME +/// +/// DOCME class DialogStyleManagerEvent : public wxEvtHandler { private: + + /// DOCME DialogStyleManager *control; void OnKeyDown(wxKeyEvent &event); @@ -191,3 +315,4 @@ public: #endif + diff --git a/aegisub/src/dialog_styling_assistant.cpp b/aegisub/src/dialog_styling_assistant.cpp index c85cd0393..547ade627 100644 --- a/aegisub/src/dialog_styling_assistant.cpp +++ b/aegisub/src/dialog_styling_assistant.cpp @@ -59,8 +59,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogStyling::DialogStyling (wxWindow *parent,SubtitlesGrid *_grid) : wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX) { @@ -160,8 +163,9 @@ wxDialog (parent, -1, _("Styling assistant"), wxDefaultPosition, wxDefaultSize, } -////////////// -// Destructor + +/// @brief Destructor +/// DialogStyling::~DialogStyling () { GetPosition(&lastx, &lasty); if (needCommit) { @@ -171,8 +175,11 @@ DialogStyling::~DialogStyling () { } -//////////////// -// Jump to line + +/// @brief Jump to line +/// @param n +/// @return +/// void DialogStyling::JumpToLine(int n) { // Check stuff if (n == -1) return; @@ -210,8 +217,11 @@ void DialogStyling::JumpToLine(int n) { } -///////////////////////////// -// Set style of current line + +/// @brief Set style of current line +/// @param curName +/// @param jump +/// void DialogStyling::SetStyle (wxString curName, bool jump) { // Get line AssDialogue *line = grid->GetDialogue(linen); @@ -246,8 +256,11 @@ BEGIN_EVENT_TABLE(DialogStyling,wxDialog) END_EVENT_TABLE() -/////////////////////////// -// Dialog was De/Activated + +/// @brief Dialog was De/Activated +/// @param event +/// @return +/// void DialogStyling::OnActivate(wxActivateEvent &event) { // Dialog lost focus if (!event.GetActive()) { @@ -271,8 +284,10 @@ void DialogStyling::OnActivate(wxActivateEvent &event) { } -/////////////// -// Key pressed + +/// @brief Key pressed +/// @param event +/// void DialogStyling::OnKeyDown(wxKeyEvent &event) { int keycode = event.GetKeyCode(); @@ -290,8 +305,11 @@ void DialogStyling::OnKeyDown(wxKeyEvent &event) { } -//////////////////// -// Edit box changed + +/// @brief Edit box changed +/// @param event +/// @return +/// void DialogStyling::OnStyleBoxModified (wxCommandEvent &event) { // Recursion guard static wxRecursionGuardFlag s_flag; @@ -332,15 +350,19 @@ void DialogStyling::OnStyleBoxModified (wxCommandEvent &event) { } -///////////////// -// Enter pressed + +/// @brief Enter pressed +/// @param event +/// void DialogStyling::OnStyleBoxEnter (wxCommandEvent &event) { } -////////////////////// -// Style list clicked + +/// @brief Style list clicked +/// @param event +/// void DialogStyling::OnListClicked(wxCommandEvent &event) { int n = event.GetInt(); SetStyle(Styles->GetString(n)); @@ -348,23 +370,29 @@ void DialogStyling::OnListClicked(wxCommandEvent &event) { TypeBox->SetFocus(); } -///////////////////// -// Play video button + +/// @brief Play video button +/// @param event +/// void DialogStyling::OnPlayVideoButton(wxCommandEvent &event) { video->PlayLine(); TypeBox->SetFocus(); } -///////////////////// -// Play audio button + +/// @brief Play audio button +/// @param event +/// void DialogStyling::OnPlayAudioButton(wxCommandEvent &event) { audio->Play(line->Start.GetMS(),line->End.GetMS()); TypeBox->SetFocus(); } -////////////////////////////// -// Style edit box constructor + +/// @brief Style edit box constructor +/// @param parent +/// StyleEditBox::StyleEditBox(DialogStyling *parent) : wxTextCtrl(parent,ENTER_STYLE_BOX,_T(""),wxDefaultPosition,wxSize(180,-1),wxTE_PROCESS_ENTER) { @@ -379,8 +407,11 @@ BEGIN_EVENT_TABLE(StyleEditBox,wxTextCtrl) END_EVENT_TABLE() -/////////////// -// Key pressed + +/// @brief Key pressed +/// @param event +/// @return +/// void StyleEditBox::OnKeyDown(wxKeyEvent &event) { //int keycode = event.GetKeyCode(); #ifdef __APPLE__ @@ -453,6 +484,11 @@ void StyleEditBox::OnKeyDown(wxKeyEvent &event) { } + +/// DOCME int DialogStyling::lastx = -1; + +/// DOCME int DialogStyling::lasty = -1; + diff --git a/aegisub/src/dialog_styling_assistant.h b/aegisub/src/dialog_styling_assistant.h index bdb4a31fb..6724b3c84 100644 --- a/aegisub/src/dialog_styling_assistant.h +++ b/aegisub/src/dialog_styling_assistant.h @@ -36,6 +36,8 @@ #ifndef DIALOG_STYLING_ASSISTANT_H + +/// DOCME #define DIALOG_STYLING_ASSISTANT_H @@ -59,10 +61,16 @@ class AudioDisplay; class VideoContext; -///////////////// -// Editbox class + +/// DOCME +/// @class StyleEditBox +/// @brief DOCME +/// +/// DOCME class StyleEditBox : public wxTextCtrl { private: + + /// DOCME DialogStyling *diag; void OnKeyDown(wxKeyEvent &event); @@ -73,21 +81,43 @@ public: }; -///////// -// Class + +/// DOCME +/// @class DialogStyling +/// @brief DOCME +/// +/// DOCME class DialogStyling : public wxDialog { friend class StyleEditBox; private: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxColour origColour; + + /// DOCME bool needCommit; + + /// DOCME wxTextCtrl *CurLine; + + /// DOCME wxListBox *Styles; + + /// DOCME StyleEditBox *TypeBox; + + /// DOCME wxCheckBox *PreviewCheck; + + /// DOCME wxButton *PlayVideoButton; + + /// DOCME wxButton *PlayAudioButton; void OnStyleBoxModified (wxCommandEvent &event); @@ -100,12 +130,24 @@ private: void SetStyle (wxString curName,bool jump=true); + + /// DOCME + + /// DOCME static int lastx, lasty; public: + + /// DOCME int linen; + + /// DOCME AssDialogue *line; + + /// DOCME AudioDisplay *audio; + + /// DOCME VideoContext *video; DialogStyling (wxWindow *parent,SubtitlesGrid *grid); @@ -120,12 +162,21 @@ public: /////// // IDs enum { + + /// DOCME ENTER_STYLE_BOX, + + /// DOCME STYLE_LIST, + + /// DOCME BUTTON_PLAY_VIDEO, + + /// DOCME BUTTON_PLAY_AUDIO }; #endif + diff --git a/aegisub/src/dialog_text_import.cpp b/aegisub/src/dialog_text_import.cpp index 2bd351159..92ae65bce 100644 --- a/aegisub/src/dialog_text_import.cpp +++ b/aegisub/src/dialog_text_import.cpp @@ -45,8 +45,9 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// DialogTextImport::DialogTextImport() : wxDialog(NULL , -1, _("Text import options"),wxDefaultPosition,wxDefaultSize) { @@ -68,12 +69,17 @@ DialogTextImport::DialogTextImport() SetSizer(main_sizer); } -////////////// -// Destructor + +/// @brief Destructor +/// DialogTextImport::~DialogTextImport() { } + +/// @brief DOCME +/// @param event +/// void DialogTextImport::OnOK(wxCommandEvent &event) { // Set options @@ -84,6 +90,10 @@ void DialogTextImport::OnOK(wxCommandEvent &event) EndModal(wxID_OK); } + +/// @brief DOCME +/// @param event +/// void DialogTextImport::OnCancel(wxCommandEvent &event) { EndModal(wxID_CANCEL); @@ -96,3 +106,4 @@ BEGIN_EVENT_TABLE(DialogTextImport,wxDialog) EVT_BUTTON(wxID_CANCEL,DialogTextImport::OnCancel) END_EVENT_TABLE() + diff --git a/aegisub/src/dialog_text_import.h b/aegisub/src/dialog_text_import.h index 9bb71cc1a..6850d4d05 100644 --- a/aegisub/src/dialog_text_import.h +++ b/aegisub/src/dialog_text_import.h @@ -35,6 +35,8 @@ /// #ifndef _DIALOG_TEXT_IMPORT_H + +/// DOCME #define _DIALOG_TEXT_IMPORT_H /////////// @@ -43,9 +45,19 @@ #include + +/// DOCME +/// @class DialogTextImport +/// @brief DOCME +/// +/// DOCME class DialogTextImport : public wxDialog { private: + + /// DOCME wxTextCtrl *edit_separator; + + /// DOCME wxTextCtrl *edit_comment; void OnOK(wxCommandEvent &event); @@ -62,8 +74,13 @@ public: /////// // IDs enum { + + /// DOCME EDIT_ACTOR_SEPARATOR = 1480, + + /// DOCME EDIT_COMMENT_STARTER, }; #endif + diff --git a/aegisub/src/dialog_timing_processor.cpp b/aegisub/src/dialog_timing_processor.cpp index ddc7e8964..67c65a8fd 100644 --- a/aegisub/src/dialog_timing_processor.cpp +++ b/aegisub/src/dialog_timing_processor.cpp @@ -54,8 +54,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _grid +/// DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_grid) : wxDialog(parent,-1,_("Timing Post-Processor"),wxDefaultPosition,wxSize(400,250),wxDEFAULT_DIALOG_STYLE) { @@ -202,8 +205,9 @@ DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_gr } -/////////////////// -// Update controls + +/// @brief Update controls +/// void DialogTimingProcessor::UpdateControls() { // Boxes leadIn->Enable(hasLeadIn->IsChecked()); @@ -247,15 +251,19 @@ BEGIN_EVENT_TABLE(DialogTimingProcessor,wxDialog) END_EVENT_TABLE() -//////////////////// -// Checkbox clicked + +/// @brief Checkbox clicked +/// @param event +/// void DialogTimingProcessor::OnCheckBox(wxCommandEvent &event) { UpdateControls(); } -///////////////////// -// Select all styles + +/// @brief Select all styles +/// @param event +/// void DialogTimingProcessor::OnSelectAll(wxCommandEvent &event) { size_t len = StyleList->GetCount(); for (size_t i=0;iGetCount(); for (size_t i=0;iGetCount(); for (size_t i=0;i temp; @@ -383,8 +402,11 @@ void DialogTimingProcessor::SortDialogues() { } -//////////////////////// -// Gets sorted dialogue + +/// @brief Gets sorted dialogue +/// @param n +/// @return +/// AssDialogue *DialogTimingProcessor::GetSortedDialogue(int n) { try { return Sorted.at(n); @@ -395,8 +417,9 @@ AssDialogue *DialogTimingProcessor::GetSortedDialogue(int n) { } -////////////////////////////// -// Actually process subtitles + +/// @brief Actually process subtitles +/// void DialogTimingProcessor::Process() { // Sort rows SortDialogues(); @@ -575,3 +598,4 @@ void DialogTimingProcessor::Process() { grid->CommitChanges(); } + diff --git a/aegisub/src/dialog_timing_processor.h b/aegisub/src/dialog_timing_processor.h index 5c628920a..5417510a9 100644 --- a/aegisub/src/dialog_timing_processor.h +++ b/aegisub/src/dialog_timing_processor.h @@ -35,6 +35,8 @@ /// #ifndef DIALOG_TIMING_PROCESSOR + +/// DOCME #define DIALOG_TIMING_PROCESSOR @@ -57,34 +59,88 @@ class SubtitlesGrid; class AssDialogue; -//////////////// -// Dialog Class + +/// DOCME +/// @class DialogTimingProcessor +/// @brief DOCME +/// +/// DOCME class DialogTimingProcessor : public wxDialog { private: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxStaticBoxSizer *KeyframesSizer; + + /// DOCME wxCheckBox *onlySelection; + + /// DOCME wxTextCtrl *leadIn; + + /// DOCME wxTextCtrl *leadOut; + + /// DOCME wxCheckBox *hasLeadIn; + + /// DOCME wxCheckBox *hasLeadOut; + + /// DOCME wxCheckBox *keysEnable; + + /// DOCME wxTextCtrl *keysStartBefore; + + /// DOCME wxTextCtrl *keysStartAfter; + + /// DOCME wxTextCtrl *keysEndBefore; + + /// DOCME wxTextCtrl *keysEndAfter; + + /// DOCME wxCheckBox *adjsEnable; + + /// DOCME wxTextCtrl *adjacentThres; + + /// DOCME wxSlider *adjacentBias; + + /// DOCME wxCheckListBox *StyleList; + + /// DOCME wxButton *ApplyButton; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME wxString leadInTime,leadOutTime,thresStartBefore,thresStartAfter,thresEndBefore,thresEndAfter,adjsThresTime; + + /// DOCME wxArrayInt KeyFrames; void OnCheckBox(wxCommandEvent &event); @@ -97,6 +153,8 @@ private: int GetClosestKeyFrame(int frame); bool StyleOK(wxString styleName); + + /// DOCME std::vector Sorted; AssDialogue *GetSortedDialogue(int n); void SortDialogues(); @@ -111,15 +169,30 @@ public: /////// // IDs enum { + + /// DOCME CHECK_ENABLE_LEADIN = 1850, + + /// DOCME CHECK_ENABLE_LEADOUT, + + /// DOCME CHECK_ENABLE_KEYFRAME, + + /// DOCME CHECK_ENABLE_ADJASCENT, + + /// DOCME BUTTON_SELECT_ALL, + + /// DOCME BUTTON_SELECT_NONE, + + /// DOCME TIMING_STYLE_LIST }; #endif + diff --git a/aegisub/src/dialog_tip.cpp b/aegisub/src/dialog_tip.cpp index 13d25069e..cde71194e 100644 --- a/aegisub/src/dialog_tip.cpp +++ b/aegisub/src/dialog_tip.cpp @@ -46,8 +46,10 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param currentTip +/// TipOfTheDay::TipOfTheDay (size_t currentTip): wxTipProvider(currentTip) { curTip = currentTip; tips.push_back(_("Aegisub can export subtitles to many different formats, character encodings, and even compensate Variable Frame Rate so you can hardsub them - it's all in the Export option in File menu.")); @@ -70,15 +72,18 @@ TipOfTheDay::TipOfTheDay (size_t currentTip): wxTipProvider(currentTip) { } -////////////// -// Destructor + +/// @brief Destructor +/// TipOfTheDay::~TipOfTheDay() { tips.clear(); } -//////////////// -// Get next tip + +/// @brief Get next tip +/// @return +/// wxString TipOfTheDay::GetTip() { curTip = curTip % tips.size(); wxString result = tips.at(curTip); @@ -87,8 +92,10 @@ wxString TipOfTheDay::GetTip() { } -////////////////////////////// -// Show tip of the day dialog + +/// @brief Show tip of the day dialog +/// @param parent +/// void TipOfTheDay::Show(wxWindow *parent) { try { if (Options.AsBool(_T("Tips enabled"))) { @@ -109,7 +116,8 @@ void TipOfTheDay::Show(wxWindow *parent) { } -////////// -// Static + +/// DOCME size_t TipOfTheDay::curTip; + diff --git a/aegisub/src/dialog_tip.h b/aegisub/src/dialog_tip.h index 3394ae7ba..51df09dd1 100644 --- a/aegisub/src/dialog_tip.h +++ b/aegisub/src/dialog_tip.h @@ -44,13 +44,21 @@ #include -//////////////// -// Tip provider + +/// DOCME +/// @class TipOfTheDay +/// @brief DOCME +/// +/// DOCME class TipOfTheDay: public wxTipProvider { private: + + /// DOCME std::vector tips; public: + + /// DOCME static size_t curTip; TipOfTheDay(size_t currentTip); @@ -60,3 +68,4 @@ public: static void Show(wxWindow *parent); }; + diff --git a/aegisub/src/dialog_translation.cpp b/aegisub/src/dialog_translation.cpp index bf542b15d..575dbd63a 100644 --- a/aegisub/src/dialog_translation.cpp +++ b/aegisub/src/dialog_translation.cpp @@ -58,8 +58,14 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _subs +/// @param _grid +/// @param startrow +/// @param preview +/// DialogTranslation::DialogTranslation (wxWindow *parent,AssFile *_subs,SubtitlesGrid *_grid,int startrow,bool preview) : wxDialog(parent, -1, _("Translation Assistant"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX, _T("TranslationAssistant")) { @@ -164,8 +170,12 @@ DialogTranslation::DialogTranslation (wxWindow *parent,AssFile *_subs,SubtitlesG } -////////////////////////// -// Jumps to line at block + +/// @brief Jumps to line at block +/// @param n +/// @param block +/// @return +/// bool DialogTranslation::JumpToLine(int n,int block) { using std::vector; AssDialogue *nextLine; @@ -238,8 +248,10 @@ bool DialogTranslation::JumpToLine(int n,int block) { } -///////////////////////// -// Updates video preview + +/// @brief Updates video preview +/// @return +/// void DialogTranslation::UpdatePreview () { if (enablePreview) { try { @@ -266,7 +278,10 @@ END_EVENT_TABLE() ///////////////// // Event handler -// Constructor + +/// @brief Constructor +/// @param ctrl +/// DialogTranslationEvent::DialogTranslationEvent(DialogTranslation *ctrl) { control = ctrl; } @@ -277,13 +292,23 @@ BEGIN_EVENT_TABLE(DialogTranslationEvent, wxEvtHandler) EVT_CHECKBOX(PREVIEW_CHECK, DialogTranslationEvent::OnPreviewCheck) END_EVENT_TABLE() -// Redirects + +/// @brief Redirects +/// @param event +/// void DialogTranslationEvent::OnPreviewCheck(wxCommandEvent &event) { control->enablePreview = event.IsChecked(); } + +/// @brief DOCME +/// @param event +/// void DialogTranslationEvent::OnTransBoxKey(wxKeyEvent &event) { control->OnTransBoxKey(event); } -///////////////////// -// Key pressed event + +/// @brief Key pressed event +/// @param event +/// @return +/// void DialogTranslation::OnTransBoxKey(wxKeyEvent &event) { #ifdef __APPLE__ Hotkeys.SetPressed(event.GetKeyCode(),event.m_metaDown,event.m_altDown,event.m_shiftDown); @@ -402,24 +427,30 @@ void DialogTranslation::OnTransBoxKey(wxKeyEvent &event) { } -///////////////////// -// Play video button + +/// @brief Play video button +/// @param event +/// void DialogTranslation::OnPlayVideoButton(wxCommandEvent &event) { video->PlayLine(); TransText->SetFocus(); } -///////////////////// -// Play audio button + +/// @brief Play audio button +/// @param event +/// void DialogTranslation::OnPlayAudioButton(wxCommandEvent &event) { audio->Play(current->Start.GetMS(),current->End.GetMS()); TransText->SetFocus(); } -///////// -// Close + +/// @brief Close +/// @param event +/// void DialogTranslation::OnClose (wxCommandEvent &event) { GetPosition(&lastx, &lasty); TransText->PopEventHandler(true); @@ -428,8 +459,10 @@ void DialogTranslation::OnClose (wxCommandEvent &event) { } -//////////// -// Minimize + +/// @brief Minimize +/// @param event +/// void DialogTranslation::OnMinimize (wxIconizeEvent &event) { //Iconize(true); if (main) ((wxFrame*)main)->Iconize(true); @@ -437,6 +470,11 @@ void DialogTranslation::OnMinimize (wxIconizeEvent &event) { } + +/// DOCME int DialogTranslation::lastx = -1; + +/// DOCME int DialogTranslation::lasty = -1; + diff --git a/aegisub/src/dialog_translation.h b/aegisub/src/dialog_translation.h index de58b63ed..5b6ba4d54 100644 --- a/aegisub/src/dialog_translation.h +++ b/aegisub/src/dialog_translation.h @@ -36,6 +36,8 @@ #ifndef DIALOG_TRANSLATION_H + +/// DOCME #define DIALOG_TRANSLATION_H @@ -53,22 +55,50 @@ class SubtitlesGrid; class AudioDisplay; class VideoContext; -///////// -// Class + +/// DOCME +/// @class DialogTranslation +/// @brief DOCME +/// +/// DOCME class DialogTranslation : public wxDialog { private: + + /// DOCME AudioDisplay *audio; + + /// DOCME VideoContext *video; + + /// DOCME AssFile *subs; + + /// DOCME SubtitlesGrid *grid; + + /// DOCME AssDialogue *current; + + /// DOCME wxWindow *main; + + /// DOCME int curline; + + /// DOCME int curblock; + + /// DOCME wxStaticText *LineCount; + + /// DOCME ScintillaTextCtrl *OrigText; + + /// DOCME ScintillaTextCtrl *TransText; + + /// DOCME wxCheckBox *PreviewCheck; void OnMinimize(wxIconizeEvent &event); @@ -79,9 +109,15 @@ private: bool JumpToLine(int n,int block); void UpdatePreview(); + + /// DOCME + + /// DOCME static int lastx, lasty; public: + + /// DOCME bool enablePreview; DialogTranslation (wxWindow *parent,AssFile *subs,SubtitlesGrid *grid,int startrow=0,bool preview=false); @@ -91,10 +127,16 @@ public: }; -///////////////// -// Event handler + +/// DOCME +/// @class DialogTranslationEvent +/// @brief DOCME +/// +/// DOCME class DialogTranslationEvent : public wxEvtHandler { private: + + /// DOCME DialogTranslation *control; void OnPreviewCheck(wxCommandEvent &event); @@ -109,13 +151,24 @@ public: /////// // IDs enum { + + /// DOCME TEXT_ORIGINAL = 1100, + + /// DOCME TEXT_TRANS, + + /// DOCME PREVIEW_CHECK, + + /// DOCME BUTTON_TRANS_PLAY_AUDIO, + + /// DOCME BUTTON_TRANS_PLAY_VIDEO }; #endif + diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index 5d96b8d83..bbe34e499 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -50,13 +50,17 @@ #include "main.h" -////////// -// Static + +/// DOCME bool DialogVersionCheck::dialogRunning = false; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param hidden +/// @return +/// DialogVersionCheck::DialogVersionCheck(wxWindow *parent,bool hidden) : wxDialog(parent,-1,_("Version Checker"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE) { @@ -97,15 +101,17 @@ DialogVersionCheck::DialogVersionCheck(wxWindow *parent,bool hidden) } -////////////// -// Destructor + +/// @brief Destructor +/// DialogVersionCheck::~DialogVersionCheck() { dialogRunning = false; } -///////////////// -// Check Version + +/// @brief Check Version +/// void DialogVersionCheck::CheckVersion() { if (!wxFileSystem::HasHandlerForPath(_T("http://www.aegisub.net/"))) wxFileSystem::AddHandler(new wxInternetFSHandler); thread = new VersionCheckThread(this); @@ -123,13 +129,19 @@ BEGIN_EVENT_TABLE(DialogVersionCheck,wxDialog) END_EVENT_TABLE() -//////////// -// On close + +/// @brief On close +/// @param event +/// void DialogVersionCheck::OnClose(wxCloseEvent &event) { dialogRunning = false; if (thread) thread->alive = false; Destroy(); } + +/// @brief DOCME +/// @param event +/// void DialogVersionCheck::OnOK(wxCommandEvent &event) { dialogRunning = false; if (thread) thread->alive = false; @@ -137,8 +149,10 @@ void DialogVersionCheck::OnOK(wxCommandEvent &event) { } -//////////////// -// On Click URL + +/// @brief On Click URL +/// @param event +/// void DialogVersionCheck::OnURL(wxTextUrlEvent &event) { wxMouseEvent mEvent = event.GetMouseEvent(); if (mEvent.LeftDown()) { @@ -148,8 +162,10 @@ void DialogVersionCheck::OnURL(wxTextUrlEvent &event) { } -///////////////////////////// -// Worker thread constructor + +/// @brief Worker thread constructor +/// @param par +/// VersionCheckThread::VersionCheckThread(DialogVersionCheck *par) : wxThread(wxTHREAD_DETACHED) { @@ -158,8 +174,9 @@ VersionCheckThread::VersionCheckThread(DialogVersionCheck *par) } -///////////////// -// Worker thread + +/// @brief Worker thread +/// wxThread::ExitCode VersionCheckThread::Entry() { // List of paths wxArrayString paths; @@ -298,3 +315,4 @@ endThread: return 0; } + diff --git a/aegisub/src/dialog_version_check.h b/aegisub/src/dialog_version_check.h index 219511569..ee34b655e 100644 --- a/aegisub/src/dialog_version_check.h +++ b/aegisub/src/dialog_version_check.h @@ -51,13 +51,21 @@ class DialogVersionCheck; -///////////////// -// Worker thread + +/// DOCME +/// @class VersionCheckThread +/// @brief DOCME +/// +/// DOCME class VersionCheckThread : public wxThread { private: + + /// DOCME DialogVersionCheck *parent; public: + + /// DOCME bool alive; VersionCheckThread(DialogVersionCheck *parent); @@ -65,16 +73,28 @@ public: }; -////////////////////////// -// Version checker dialog + +/// DOCME +/// @class DialogVersionCheck +/// @brief DOCME +/// +/// DOCME class DialogVersionCheck : public wxDialog { friend class VersionCheckThread; private: + + /// DOCME static bool dialogRunning; + + /// DOCME wxTextCtrl *logBox; + + /// DOCME VersionCheckThread *thread; + + /// DOCME bool visible; void CheckVersion(); @@ -93,6 +113,9 @@ public: /////// // IDs enum { + + /// DOCME Log_Box = 1000 }; + diff --git a/aegisub/src/dialog_video_details.cpp b/aegisub/src/dialog_video_details.cpp index 6e4d2dbee..53df5de87 100644 --- a/aegisub/src/dialog_video_details.cpp +++ b/aegisub/src/dialog_video_details.cpp @@ -47,8 +47,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// DialogVideoDetails::DialogVideoDetails(wxWindow *parent) : wxDialog(parent , -1, _("Video Details"),wxDefaultPosition,wxDefaultSize) { @@ -91,8 +93,12 @@ DialogVideoDetails::DialogVideoDetails(wxWindow *parent) } -//////////// -// PrettyAR + +/// @brief PrettyAR +/// @param width +/// @param height +/// @return +/// wxString DialogVideoDetails::PrettyAR(int width, int height) { int limit = (int)ceil(sqrt(double(MIN(width, height)))); @@ -106,8 +112,11 @@ wxString DialogVideoDetails::PrettyAR(int width, int height) } -/////////////////// -// PrettyTimeStamp + +/// @brief PrettyTimeStamp +/// @param frames +/// @param fps +/// wxString DialogVideoDetails::PrettyTimeStamp(int frames, double fps) { int tt = int(frames / fps * 1000); @@ -118,3 +127,4 @@ wxString DialogVideoDetails::PrettyTimeStamp(int frames, double fps) return wxString::Format(_T("%d:%02d:%02d.%03d"), h, m, s, cs); } + diff --git a/aegisub/src/dialog_video_details.h b/aegisub/src/dialog_video_details.h index 28fe6a73e..fb1e992b7 100644 --- a/aegisub/src/dialog_video_details.h +++ b/aegisub/src/dialog_video_details.h @@ -35,18 +35,34 @@ /// #ifndef _DIALOG_VIDEO_DETAILS_H + +/// DOCME #define _DIALOG_VIDEO_DETAILS_H /////////// // Headers #include + +/// DOCME +/// @class DialogVideoDetails +/// @brief DOCME +/// +/// DOCME class DialogVideoDetails : public wxDialog { private: wxString PrettyTimeStamp(int frames, double fps); wxString PrettyAR(int width, int height); + + /// DOCME + + /// DOCME int width, height; + + /// DOCME + + /// DOCME int framecount, fps; public: @@ -55,3 +71,4 @@ public: #endif + diff --git a/aegisub/src/drop.cpp b/aegisub/src/drop.cpp index 1ae63bbef..eb6ffc66f 100644 --- a/aegisub/src/drop.cpp +++ b/aegisub/src/drop.cpp @@ -44,17 +44,24 @@ #include -/////////////// -// Constructor + +/// @brief Constructor +/// @param par +/// AegisubFileDropTarget::AegisubFileDropTarget(FrameMain *par) { parent = par; } -////////////// -// Drop files + +/// @brief Drop files +/// @param x +/// @param y +/// @param filenames +/// bool AegisubFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { return parent->LoadList(filenames); } + diff --git a/aegisub/src/drop.h b/aegisub/src/drop.h index beb6e7bea..7fd95908c 100644 --- a/aegisub/src/drop.h +++ b/aegisub/src/drop.h @@ -36,6 +36,8 @@ #ifndef DROP_H + +/// DOCME #define DROP_H @@ -50,10 +52,16 @@ class FrameMain; -/////////////// -// Drop source + +/// DOCME +/// @class AegisubFileDropTarget +/// @brief DOCME +/// +/// DOCME class AegisubFileDropTarget : public wxFileDropTarget { private: + + /// DOCME FrameMain *parent; public: @@ -65,3 +73,4 @@ public: #endif + diff --git a/aegisub/src/export_clean_info.cpp b/aegisub/src/export_clean_info.cpp index 39b881c2a..00bb4c062 100644 --- a/aegisub/src/export_clean_info.cpp +++ b/aegisub/src/export_clean_info.cpp @@ -45,15 +45,18 @@ #include "ass_override.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AssTransformCleanInfoFilter::AssTransformCleanInfoFilter() { initialized = false; } -//////// -// Init + +/// @brief Init +/// @return +/// void AssTransformCleanInfoFilter::Init() { if (initialized) return; initialized = true; @@ -63,8 +66,11 @@ void AssTransformCleanInfoFilter::Init() { } -/////////// -// Process + +/// @brief Process +/// @param subs +/// @param export_dialog +/// void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { using std::list; AssEntry *curEntry; @@ -100,20 +106,26 @@ void AssTransformCleanInfoFilter::ProcessSubs(AssFile *subs, wxWindow *export_di } -////////////// -// Get dialog + +/// @brief Get dialog +/// @param parent +/// @return +/// wxWindow *AssTransformCleanInfoFilter::GetConfigDialogWindow(wxWindow *parent) { return 0; } -///////////////// -// Load settings + +/// @brief Load settings +/// @param IsDefault +/// void AssTransformCleanInfoFilter::LoadSettings(bool IsDefault) { } -/////////////////// -// Global instance + +/// DOCME AssTransformCleanInfoFilter AssTransformCleanInfoFilter::instance; + diff --git a/aegisub/src/export_clean_info.h b/aegisub/src/export_clean_info.h index 245d4e633..4beee249e 100644 --- a/aegisub/src/export_clean_info.h +++ b/aegisub/src/export_clean_info.h @@ -43,10 +43,16 @@ #include "ass_export_filter.h" -////////////////////////////// -// Transform Framerate filter + +/// DOCME +/// @class AssTransformCleanInfoFilter +/// @brief DOCME +/// +/// DOCME class AssTransformCleanInfoFilter : public AssExportFilter { private: + + /// DOCME static AssTransformCleanInfoFilter instance; AssTransformCleanInfoFilter(); @@ -58,3 +64,4 @@ public: void LoadSettings(bool IsDefault); }; + diff --git a/aegisub/src/export_fixstyle.cpp b/aegisub/src/export_fixstyle.cpp index 45781d98a..95683f077 100644 --- a/aegisub/src/export_fixstyle.cpp +++ b/aegisub/src/export_fixstyle.cpp @@ -45,15 +45,18 @@ #include "ass_style.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AssFixStylesFilter::AssFixStylesFilter() { initialized = false; } -//////// -// Init + +/// @brief Init +/// @return +/// void AssFixStylesFilter::Init() { if (initialized) return; initialized = true; @@ -63,8 +66,11 @@ void AssFixStylesFilter::Init() { } -/////////// -// Process + +/// @brief Process +/// @param subs +/// @param export_dialog +/// void AssFixStylesFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { // Build styles list wxArrayString styles = subs->GetStyles(); @@ -93,7 +99,8 @@ void AssFixStylesFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { } -/////////////////// -// Global instance + +/// DOCME AssFixStylesFilter AssFixStylesFilter::instance; + diff --git a/aegisub/src/export_fixstyle.h b/aegisub/src/export_fixstyle.h index e16f4e53e..5059b57b8 100644 --- a/aegisub/src/export_fixstyle.h +++ b/aegisub/src/export_fixstyle.h @@ -43,10 +43,16 @@ #include "ass_export_filter.h" -////////////////////////////// -// Transform Framerate filter + +/// DOCME +/// @class AssFixStylesFilter +/// @brief DOCME +/// +/// DOCME class AssFixStylesFilter : public AssExportFilter { private: + + /// DOCME static AssFixStylesFilter instance; AssFixStylesFilter(); void Init(); @@ -55,3 +61,4 @@ public: void ProcessSubs(AssFile *subs, wxWindow *export_dialog); }; + diff --git a/aegisub/src/export_framerate.cpp b/aegisub/src/export_framerate.cpp index e7532c18d..f187129ec 100644 --- a/aegisub/src/export_framerate.cpp +++ b/aegisub/src/export_framerate.cpp @@ -46,15 +46,18 @@ #include "ass_override.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AssTransformFramerateFilter::AssTransformFramerateFilter() { initialized = false; } -//////// -// Init + +/// @brief Init +/// @return +/// void AssTransformFramerateFilter::Init() { if (initialized) return; initialized = true; @@ -66,8 +69,11 @@ void AssTransformFramerateFilter::Init() { } -/////////// -// Process + +/// @brief Process +/// @param subs +/// @param export_dialog +/// void AssTransformFramerateFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { // Transform frame rate if (Input->IsLoaded() && Output->IsLoaded()) { @@ -78,8 +84,11 @@ void AssTransformFramerateFilter::ProcessSubs(AssFile *subs, wxWindow *export_di } -////////////// -// Get dialog + +/// @brief Get dialog +/// @param parent +/// @return +/// wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) { wxWindow *base = new wxPanel(parent, -1); @@ -139,8 +148,10 @@ wxWindow *AssTransformFramerateFilter::GetConfigDialogWindow(wxWindow *parent) { } -///////////////// -// Load settings + +/// @brief Load settings +/// @param IsDefault +/// void AssTransformFramerateFilter::LoadSettings(bool IsDefault) { if (IsDefault) { Input = &VFR_Input; @@ -168,8 +179,14 @@ void AssTransformFramerateFilter::LoadSettings(bool IsDefault) { } -/////////////////////////////// -// Transform framerate in tags + +/// @brief Transform framerate in tags +/// @param name +/// @param n +/// @param curParam +/// @param curData +/// @return +/// void AssTransformFramerateFilter::TransformTimeTags (wxString name,int n,AssOverrideParameter *curParam,void *curData) { // Only modify anything if this is a number VariableDataType type = curParam->GetType(); @@ -249,8 +266,10 @@ void AssTransformFramerateFilter::TransformTimeTags (wxString name,int n,AssOver } -/////////////////////// -// Transform framerate + +/// @brief Transform framerate +/// @param subs +/// void AssTransformFramerateFilter::TransformFrameRate(AssFile *subs) { int n=0; @@ -286,7 +305,8 @@ void AssTransformFramerateFilter::TransformFrameRate(AssFile *subs) { } -/////////////////// -// Global instance + +/// DOCME AssTransformFramerateFilter AssTransformFramerateFilter::instance; + diff --git a/aegisub/src/export_framerate.h b/aegisub/src/export_framerate.h index 684b8d77c..3a86d0edd 100644 --- a/aegisub/src/export_framerate.h +++ b/aegisub/src/export_framerate.h @@ -56,18 +56,42 @@ class AssOverrideParameter; class AssDialogue; -////////////////////////////// -// Transform Framerate filter + +/// DOCME +/// @class AssTransformFramerateFilter +/// @brief DOCME +/// +/// DOCME class AssTransformFramerateFilter : public AssExportFilter { private: + + /// DOCME static AssTransformFramerateFilter instance; + + /// DOCME + + /// DOCME FrameRate *Input,*Output; + + /// DOCME + + /// DOCME FrameRate t1,t2; + + /// DOCME wxTextCtrl *InputFramerate; + + /// DOCME wxTextCtrl *OutputFramerate; + + /// DOCME wxRadioButton *RadioOutputCFR; + + /// DOCME wxRadioButton *RadioOutputVFR; + + /// DOCME wxCheckBox *Reverse; AssTransformFramerateFilter(); @@ -82,13 +106,25 @@ public: }; -////////////////// -// Linedata class + +/// DOCME +/// @class LineData +/// @brief DOCME +/// +/// DOCME class LineData { public: + + /// DOCME AssDialogue *line; + + /// DOCME int k; + + /// DOCME int kf; + + /// DOCME int ko; }; @@ -96,6 +132,9 @@ public: /////// // IDs enum { + + /// DOCME Get_Input_From_Video = 2000 }; + diff --git a/aegisub/src/export_visible_lines.cpp b/aegisub/src/export_visible_lines.cpp index 9a0c90e1b..ab4577571 100644 --- a/aegisub/src/export_visible_lines.cpp +++ b/aegisub/src/export_visible_lines.cpp @@ -46,16 +46,19 @@ #include "vfr.h" -/////////////// -// Constructor + +/// @brief Constructor +/// AssLimitToVisibleFilter::AssLimitToVisibleFilter() { initialized = false; frame = -1; } -//////// -// Init + +/// @brief Init +/// @return +/// void AssLimitToVisibleFilter::Init() { if (initialized) return; initialized = true; @@ -66,8 +69,12 @@ void AssLimitToVisibleFilter::Init() { } -/////////// -// Process + +/// @brief Process +/// @param subs +/// @param export_dialog +/// @return +/// void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { // Nothing to do if (frame == -1) return; @@ -95,14 +102,17 @@ void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog } -/////////////////////// -// Set limitation time + +/// @brief Set limitation time +/// @param _frame +/// void AssLimitToVisibleFilter::SetFrame(int _frame) { instance.frame = _frame; } -/////////////////// -// Global instance + +/// DOCME AssLimitToVisibleFilter AssLimitToVisibleFilter::instance; + diff --git a/aegisub/src/export_visible_lines.h b/aegisub/src/export_visible_lines.h index 71fb8d432..740f2f996 100644 --- a/aegisub/src/export_visible_lines.h +++ b/aegisub/src/export_visible_lines.h @@ -43,11 +43,19 @@ #include "ass_export_filter.h" -///////////////////////////////// -// Limit to visible lines filter + +/// DOCME +/// @class AssLimitToVisibleFilter +/// @brief DOCME +/// +/// DOCME class AssLimitToVisibleFilter : public AssExportFilter { private: + + /// DOCME static AssLimitToVisibleFilter instance; + + /// DOCME int frame; AssLimitToVisibleFilter(); @@ -59,3 +67,4 @@ public: void ProcessSubs(AssFile *subs, wxWindow *export_dialog); }; + diff --git a/aegisub/src/factory_manager.h b/aegisub/src/factory_manager.h index 244af26b2..700bc9dee 100644 --- a/aegisub/src/factory_manager.h +++ b/aegisub/src/factory_manager.h @@ -48,11 +48,21 @@ ///////////////// // Factory class template + +/// DOCME +/// @class FactoryManager +/// @brief DOCME +/// +/// DOCME class FactoryManager { protected: - // Static map of all factories + + /// DOCME static std::map *factories; + + /// @brief DOCME + /// static void ClearFactories() { if (factories && !factories->empty()) { typename std::map::iterator iter; @@ -64,7 +74,12 @@ protected: delete factories; } - // Register one factory type (with possible subtypes) + + /// @brief // Register one factory type (with possible subtypes) + /// @param factory + /// @param name + /// @param subTypes=wxArrayString() + /// static void RegisterFactory(T* factory,wxString name, wxArrayString subTypes=wxArrayString()) { // Create factories if it doesn't exist if (factories == NULL) factories = new std::map; @@ -83,7 +98,11 @@ protected: } } - // Get a factory with name + + /// @brief // Get a factory with name + /// @param name + /// @return + /// static T *GetFactory(wxString name) { // No factories if (factories == NULL) { @@ -102,12 +121,17 @@ protected: } public: - // Virtual destructor + + /// @brief // Virtual destructor + /// virtual ~FactoryManager() { ClearFactories(); }; - // Get list of all factories, with favourite as first + + /// @brief // Get list of all factories, with favourite as first + /// @param favourite=_T(Ó) + /// static wxArrayString GetFactoryList(wxString favourite=_T("")) { if (factories == NULL) factories = new std::map; wxArrayString list; @@ -120,3 +144,4 @@ public: } }; + diff --git a/aegisub/src/ffmpegsource_common.cpp b/aegisub/src/ffmpegsource_common.cpp index f47fc1cd8..fc5f5f661 100644 --- a/aegisub/src/ffmpegsource_common.cpp +++ b/aegisub/src/ffmpegsource_common.cpp @@ -51,12 +51,18 @@ #include -// lookit dis here static storage + +/// DOCME wxMutex FFmpegSourceProvider::CleaningInProgress; -/////////////// -// Update indexing progress + +/// @brief Update indexing progress +/// @param Current +/// @param Total +/// @param Private +/// @return +/// int FFMS_CC FFmpegSourceProvider::UpdateIndexingProgress(int64_t Current, int64_t Total, void *Private) { IndexingProgressDialog *Progress = (IndexingProgressDialog *)Private; @@ -70,8 +76,14 @@ int FFMS_CC FFmpegSourceProvider::UpdateIndexingProgress(int64_t Current, int64_ } -/////////// -// Do indexing + +/// @brief Do indexing +/// @param Indexer +/// @param CacheName +/// @param Trackmask +/// @param IgnoreDecodeErrors +/// @return +/// FFIndex *FFmpegSourceProvider::DoIndexing(FFIndexer *Indexer, const wxString &CacheName, int Trackmask, bool IgnoreDecodeErrors) { char FFMSErrMsg[1024]; unsigned MsgSize = sizeof(FFMSErrMsg); @@ -108,8 +120,12 @@ FFIndex *FFmpegSourceProvider::DoIndexing(FFIndexer *Indexer, const wxString &Ca } -/////////// -// Find all tracks of the given typo and return their track numbers and respective codec names + +/// @brief Find all tracks of the given typo and return their track numbers and respective codec names +/// @param Indexer +/// @param Type +/// @return +/// std::map FFmpegSourceProvider::GetTracksOfType(FFIndexer *Indexer, FFMS_TrackType Type) { std::map TrackList; int NumTracks = FFMS_GetNumTracksI(Indexer); @@ -125,8 +141,13 @@ std::map FFmpegSourceProvider::GetTracksOfType(FFIndexer *Indexer, } -/////////// -// Ask user for which track he wants to load + +/// @brief Ask user for which track he wants to load +/// @param std::map &TrackList, FFMS_TrackType Type) { std::vector TrackNumbers; wxArrayString Choices; @@ -151,8 +172,9 @@ int FFmpegSourceProvider::AskForTrackSelection(const std::map &Tra } -/////////// -// Set ffms2 log level according to setting in config.dat + +/// @brief Set ffms2 log level according to setting in config.dat +/// void FFmpegSourceProvider::SetLogLevel() { wxString LogLevel = Options.AsText(_T("FFmpegSource log level")); @@ -175,9 +197,11 @@ void FFmpegSourceProvider::SetLogLevel() { } -///////////////////// -// Creates a name for the ffmpegsource2 index and prepares the folder if it doesn't exist -// method by amz + +/// @brief method by amz Creates a name for the ffmpegsource2 index and prepares the folder if it doesn't exist +/// @param filename +/// @return +/// wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename) { // Get the size of the file to be hashed @@ -214,8 +238,10 @@ wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename) return dirfn.GetShortPath() + _T("/") + fn.GetFullName(); } -///////////////////// -// fire and forget cleaning thread (well, almost) + +/// @brief fire and forget cleaning thread (well, almost) +/// @return +/// bool FFmpegSourceProvider::CleanCache() { wxLogDebug(_T("FFmpegSourceCacheCleaner: attempting to start thread")); @@ -239,14 +265,17 @@ bool FFmpegSourceProvider::CleanCache() { } -///////////////////// -// constructor + +/// @brief constructor +/// @param par +/// FFmpegSourceCacheCleaner::FFmpegSourceCacheCleaner(FFmpegSourceProvider *par) : wxThread(wxTHREAD_DETACHED) { parent = par; } -///////////////////// -// all actual work happens here because I was too lazy to write more functions + +/// @brief all actual work happens here because I was too lazy to write more functions +/// wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() { wxMutexLocker lock(FFmpegSourceProvider::CleaningInProgress); if (!lock.IsOk()) { @@ -336,3 +365,4 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() { #endif // WITH_FFMPEGSOURCE + diff --git a/aegisub/src/ffmpegsource_common.h b/aegisub/src/ffmpegsource_common.h index 67abc5ce6..235bafa9e 100644 --- a/aegisub/src/ffmpegsource_common.h +++ b/aegisub/src/ffmpegsource_common.h @@ -42,36 +42,72 @@ #include #include #include "include/aegisub/aegisub.h" + +/// DOCME #define FFMS_BETA_10_COMPAT #include #include "dialog_progress.h" + +/// DOCME #define FFMS_TRACKMASK_ALL -1 + +/// DOCME #define FFMS_TRACKMASK_NONE 0 + +/// DOCME +/// @class FFmpegSourceProvider +/// @brief DOCME +/// +/// DOCME class FFmpegSourceProvider { friend class FFmpegSourceCacheCleaner; public: - // constants stolen from avutil/log.h - // hope the ffmpeg devs don't change them around too much + + /// DOCME enum FFMS_LogLevel { + + /// DOCME FFMS_LOG_QUIET = -8, + + /// DOCME FFMS_LOG_PANIC = 0, + + /// DOCME FFMS_LOG_FATAL = 8, + + /// DOCME FFMS_LOG_ERROR = 16, + + /// DOCME FFMS_LOG_WARNING = 24, + + /// DOCME FFMS_LOG_INFO = 32, + + /// DOCME FFMS_LOG_VERBOSE = 40, + + /// DOCME FFMS_LOG_DEBUG = 48, }; + + /// DOCME struct IndexingProgressDialog { + + /// DOCME volatile bool IndexingCanceled; + + /// DOCME DialogProgress *ProgressDialog; }; + + /// DOCME static wxMutex CleaningInProgress; bool CleanCache(); @@ -83,16 +119,30 @@ public: wxString GetCacheFilename(const wxString& filename); void SetLogLevel(); + + /// @brief DOCME + /// virtual ~FFmpegSourceProvider() {} }; + +/// DOCME +/// @class FFmpegSourceCacheCleaner +/// @brief DOCME +/// +/// DOCME class FFmpegSourceCacheCleaner : public wxThread { private: + + /// DOCME FFmpegSourceProvider *parent; public: FFmpegSourceCacheCleaner(FFmpegSourceProvider *par); + + /// @brief DOCME + /// ~FFmpegSourceCacheCleaner() {}; wxThread::ExitCode Entry(); }; @@ -101,3 +151,4 @@ public: #endif /* WITH_FFMPEGSOURCE */ + diff --git a/aegisub/src/fft.cpp b/aegisub/src/fft.cpp index f68085268..f70ed866c 100644 --- a/aegisub/src/fft.cpp +++ b/aegisub/src/fft.cpp @@ -45,8 +45,14 @@ #include -///////////// -// Transform + +/// @brief Transform +/// @param n_samples +/// @param input +/// @param output_r +/// @param output_i +/// @param inverse +/// void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *output_i,bool inverse) { // Check if it's power of two if (!IsPowerOfTwo(n_samples)) { @@ -127,19 +133,34 @@ void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *outp } -////////////////////// -// Transform wrappers + +/// @brief Transform wrappers +/// @param n_samples +/// @param input +/// @param output_r +/// @param output_i +/// void FFT::Transform(size_t n_samples,float *input,float *output_r,float *output_i) { DoTransform(n_samples,input,output_r,output_i,false); } + +/// @brief DOCME +/// @param n_samples +/// @param input +/// @param output_r +/// @param output_i +/// void FFT::InverseTransform(size_t n_samples,float *input,float *output_r,float *output_i) { DoTransform(n_samples,input,output_r,output_i,true); } -////////////////////////////////////// -// Checks if number is a power of two + +/// @brief Checks if number is a power of two +/// @param x +/// @return +/// bool FFT::IsPowerOfTwo (unsigned int x) { if (x < 2) return false; if (x & (x-1)) return false; @@ -147,8 +168,11 @@ bool FFT::IsPowerOfTwo (unsigned int x) { } -////////////////////////// -// Bits needed by the FFT + +/// @brief Bits needed by the FFT +/// @param n_samples +/// @return +/// unsigned int FFT::NumberOfBitsNeeded (unsigned int n_samples) { int i; @@ -162,8 +186,12 @@ unsigned int FFT::NumberOfBitsNeeded (unsigned int n_samples) { } -///////////////////////////// -// Get reversed bit position + +/// @brief Get reversed bit position +/// @param index +/// @param bits +/// @return +/// unsigned int FFT::ReverseBits (unsigned int index, unsigned int bits) { unsigned int i, rev; @@ -176,8 +204,12 @@ unsigned int FFT::ReverseBits (unsigned int index, unsigned int bits) { } -////////////////////////// -// Get frequency at index + +/// @brief Get frequency at index +/// @param baseFreq +/// @param n_samples +/// @param index +/// float FFT::FrequencyAtIndex (unsigned int baseFreq, unsigned int n_samples, unsigned int index) { if (index >= n_samples) return 0.0; else if (index <= n_samples/2) { @@ -188,3 +220,4 @@ float FFT::FrequencyAtIndex (unsigned int baseFreq, unsigned int n_samples, unsi } } + diff --git a/aegisub/src/fft.h b/aegisub/src/fft.h index 0ecf9f8ad..b3e7984b7 100644 --- a/aegisub/src/fft.h +++ b/aegisub/src/fft.h @@ -36,13 +36,19 @@ #ifndef FFT_H + +/// DOCME #define FFT_H #include // size_t -///////////// -// FFT class + +/// DOCME +/// @class FFT +/// @brief DOCME +/// +/// DOCME class FFT { private: void DoTransform(size_t n_samples,float *input,float *output_r,float *output_i,bool inverse); @@ -59,3 +65,4 @@ public: #endif + diff --git a/aegisub/src/font_file_lister.cpp b/aegisub/src/font_file_lister.cpp index c3f71b7c8..81960903a 100644 --- a/aegisub/src/font_file_lister.cpp +++ b/aegisub/src/font_file_lister.cpp @@ -48,33 +48,40 @@ #if defined(__WINDOWS__) || defined(__APPLE__) #ifdef WITH_FREETYPE2 #include "font_file_lister_freetype.h" + +/// DOCME #define FontListerClass FreetypeFontFileLister #endif #else #include "font_file_lister_fontconfig.h" + +/// DOCME #define FontListerClass FontConfigFontFileLister #endif -//////////////////// -// Static instances + +/// DOCME FontFileLister *FontFileLister::instance = NULL; -/////////////// -// Constructor + +/// @brief Constructor +/// FontFileLister::FontFileLister() { } -////////////// -// Destructor + +/// @brief Destructor +/// FontFileLister::~FontFileLister() { } -//////////////// -// Get instance + +/// @brief Get instance +/// void FontFileLister::GetInstance() { #ifdef FontListerClass if (!instance) instance = new FontListerClass(); @@ -82,8 +89,11 @@ void FontFileLister::GetInstance() { } -//////////////////////////////////// -// Redirect statics to the instance + +/// @brief Redirect statics to the instance +/// @param facename +/// @return +/// wxArrayString FontFileLister::GetFilesWithFace(wxString facename) { GetInstance(); if (instance) @@ -93,18 +103,27 @@ wxArrayString FontFileLister::GetFilesWithFace(wxString facename) { return ret; } } + +/// @brief DOCME +/// void FontFileLister::Initialize() { GetInstance(); if (instance) instance->DoInitialize(); } + +/// @brief DOCME +/// void FontFileLister::ClearData() { GetInstance(); if (instance) instance->DoClearData(); } -//////////////////////////////////////////////// -// Get list of files that match a specific face + +/// @brief Get list of files that match a specific face +/// @param facename +/// @return +/// wxArrayString FontFileLister::CacheGetFilesWithFace(wxString facename) { FontMap::iterator iter = fontTable.find(facename); if (iter != fontTable.end()) return iter->second; @@ -116,16 +135,21 @@ wxArrayString FontFileLister::CacheGetFilesWithFace(wxString facename) { } -////////////// -// Clear data + +/// @brief Clear data +/// void FontFileLister::ClearCache() { fontFiles.clear(); fontTable.clear(); } -//////////// -// Add font + +/// @brief Add font +/// @param filename +/// @param facename +/// @return +/// void FontFileLister::AddFont(wxString filename,wxString facename) { // See if it's a valid facename facename.Trim(true).Trim(false); @@ -143,15 +167,19 @@ void FontFileLister::AddFont(wxString filename,wxString facename) { } -///////////////////////////////// -// Check if a filename is cached + +/// @brief Check if a filename is cached +/// @param filename +/// @return +/// bool FontFileLister::IsFilenameCached(wxString filename) { return fontFiles.Index(filename) != wxNOT_FOUND; } -////////////// -// Save cache + +/// @brief Save cache +/// void FontFileLister::SaveCache() { try { // Open file @@ -178,8 +206,9 @@ void FontFileLister::SaveCache() { } -////////////// -// Load cache + +/// @brief Load cache +/// void FontFileLister::LoadCache() { try { // Load cache @@ -209,3 +238,4 @@ void FontFileLister::LoadCache() { } } + diff --git a/aegisub/src/font_file_lister.h b/aegisub/src/font_file_lister.h index 403634d50..499ba43c5 100644 --- a/aegisub/src/font_file_lister.h +++ b/aegisub/src/font_file_lister.h @@ -49,23 +49,45 @@ //////////// // Typedefs #if defined(__WINDOWS__) || defined(__APPLE__) + +/// DOCME typedef struct FT_LibraryRec_ *FT_Library; #endif + +/// DOCME typedef std::map FontMap; -//////////////////// -// Font file lister + +/// DOCME +/// @class FontFileLister +/// @brief DOCME +/// +/// DOCME class FontFileLister { private: + + /// DOCME static FontFileLister *instance; static void GetInstance(); + + /// DOCME FontMap fontTable; + + /// DOCME wxArrayString fontFiles; protected: + + /// @brief DOCME + /// @param facename + /// @return + /// virtual wxArrayString DoGetFilesWithFace(wxString facename) { return CacheGetFilesWithFace(facename); } virtual void DoInitialize()=0; + + /// @brief DOCME + /// virtual void DoClearData() { ClearCache(); } FontFileLister(); @@ -84,3 +106,4 @@ public: static void ClearData(); }; + diff --git a/aegisub/src/font_file_lister_fontconfig.cpp b/aegisub/src/font_file_lister_fontconfig.cpp index f11473a09..7a0f8aa45 100644 --- a/aegisub/src/font_file_lister_fontconfig.cpp +++ b/aegisub/src/font_file_lister_fontconfig.cpp @@ -45,8 +45,11 @@ #include "charset_conv.h" -/////////////////////////////////// -// Get files that contain the face + +/// @brief Get files that contain the face +/// @param facename +/// @return +/// wxArrayString FontConfigFontFileLister::DoGetFilesWithFace(wxString facename) { wxArrayString results; @@ -80,24 +83,27 @@ wxArrayString FontConfigFontFileLister::DoGetFilesWithFace(wxString facename) { } -/////////////// -// Constructor + +/// @brief Constructor +/// FontConfigFontFileLister::FontConfigFontFileLister() : fontconf(0), aux(0) { } -////////////// -// Initialize + +/// @brief Initialize +/// void FontConfigFontFileLister::DoInitialize() { fontconf = FcInitLoadConfigAndFonts(); aux = FcPatternCreate(); } -//////////// -// Clean up + +/// @brief Clean up +/// void FontConfigFontFileLister::DoClearData() { if (aux) FcPatternDestroy(aux); #ifdef HAVE_FCFINI @@ -107,3 +113,4 @@ void FontConfigFontFileLister::DoClearData() { #endif + diff --git a/aegisub/src/font_file_lister_fontconfig.h b/aegisub/src/font_file_lister_fontconfig.h index 33ed45d5b..1830d89f1 100644 --- a/aegisub/src/font_file_lister_fontconfig.h +++ b/aegisub/src/font_file_lister_fontconfig.h @@ -45,12 +45,20 @@ #include "font_file_lister.h" -///////////////////////////// -// Freetype Font file lister + +/// DOCME +/// @class FontConfigFontFileLister +/// @brief DOCME +/// +/// DOCME class FontConfigFontFileLister : public FontFileLister { friend class FontFileLister; private: + + /// DOCME FcConfig *fontconf; + + /// DOCME FcPattern *aux; FontConfigFontFileLister(); @@ -60,3 +68,4 @@ private: void DoClearData(); }; + diff --git a/aegisub/src/font_file_lister_freetype.cpp b/aegisub/src/font_file_lister_freetype.cpp index dcace7fd5..0202c9414 100644 --- a/aegisub/src/font_file_lister_freetype.cpp +++ b/aegisub/src/font_file_lister_freetype.cpp @@ -53,22 +53,28 @@ #include "charset_conv.h" -/////////////// -// Constructor + +/// @brief Constructor +/// FreetypeFontFileLister::FreetypeFontFileLister() { // Initialize freetype2 FT_Init_FreeType(&ft2lib); } -////////////// -// Destructor + +/// @brief Destructor +/// FreetypeFontFileLister::~FreetypeFontFileLister() { } -////////////////////// -// Get name from face + +/// @brief Get name from face +/// @param face +/// @param id +/// @return +/// wxArrayString GetName(FT_Face &face,int id) { // Get name wxArrayString final; @@ -96,8 +102,9 @@ wxArrayString GetName(FT_Face &face,int id) { } -/////////////////////////// -// Gather data from system + +/// @brief Gather data from system +/// void FreetypeFontFileLister::DoInitialize() { // Load cache LoadCache(); @@ -172,3 +179,4 @@ void FreetypeFontFileLister::DoInitialize() { #endif WITH_FREETYPE2 + diff --git a/aegisub/src/font_file_lister_freetype.h b/aegisub/src/font_file_lister_freetype.h index 8e744192f..40874849a 100644 --- a/aegisub/src/font_file_lister_freetype.h +++ b/aegisub/src/font_file_lister_freetype.h @@ -43,16 +43,22 @@ #include "font_file_lister.h" -//////////// -// Typedefs + +/// DOCME typedef struct FT_LibraryRec_ *FT_Library; -///////////////////////////// -// Freetype Font file lister + +/// DOCME +/// @class FreetypeFontFileLister +/// @brief DOCME +/// +/// DOCME class FreetypeFontFileLister : public FontFileLister { friend class FontFileLister; private: + + /// DOCME FT_Library ft2lib; void DoInitialize(); @@ -61,3 +67,4 @@ private: ~FreetypeFontFileLister(); }; + diff --git a/aegisub/src/frame_main.cpp b/aegisub/src/frame_main.cpp index 08aa95792..e93d380bc 100644 --- a/aegisub/src/frame_main.cpp +++ b/aegisub/src/frame_main.cpp @@ -91,14 +91,22 @@ #ifdef WITH_STARTUPLOG + +/// DOCME #define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0) #else + +/// DOCME #define StartupLog(a) #endif ///////////////////////// // FrameMain constructor + +/// @brief DOCME +/// @param args +/// FrameMain::FrameMain (wxArrayString args) : wxFrame ((wxFrame*)NULL,-1,_T(""),wxDefaultPosition,wxSize(920,700),wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) { @@ -229,8 +237,9 @@ FrameMain::FrameMain (wxArrayString args) } -//////////////////////// -// FrameMain destructor + +/// @brief FrameMain destructor +/// FrameMain::~FrameMain () { DeInitContents(); #ifdef WITH_AUTOMATION @@ -239,8 +248,9 @@ FrameMain::~FrameMain () { } -////////////////////// -// Initialize toolbar + +/// @brief Initialize toolbar +/// void FrameMain::InitToolbar () { // Create toolbar wxSystemOptions::SetOption(_T("msw.remap"), 0); @@ -313,12 +323,19 @@ void FrameMain::InitToolbar () { } + +/// @brief DOCME +/// @param item_text +/// @param hotkey_name +/// @return +/// wxString MakeHotkeyText(const wxChar *item_text, const wxChar *hotkey_name) { return wxString::Format(_T("%s\t%s"), item_text, Hotkeys.GetText(hotkey_name).c_str()); } -/////////////////////// -// Initialize menu bar + +/// @brief Initialize menu bar +/// void FrameMain::InitMenu() { // Deinit menu if needed if (menuCreated) { @@ -562,8 +579,9 @@ void FrameMain::InitMenu() { } -/////////////////////// -// Initialize contents + +/// @brief Initialize contents +/// void FrameMain::InitContents() { // Set a background panel StartupLog(_T("Create background panel")); @@ -629,8 +647,9 @@ void FrameMain::InitContents() { } -///////////////////////// -// Deinitialize controls + +/// @brief Deinitialize controls +/// void FrameMain::DeInitContents() { if (detachedVideo) detachedVideo->Destroy(); if (stylingAssistant) stylingAssistant->Destroy(); @@ -642,8 +661,9 @@ void FrameMain::DeInitContents() { } -////////////////// -// Update toolbar + +/// @brief Update toolbar +/// void FrameMain::UpdateToolbar() { // Collect flags bool isVideo = VideoContext::Get()->IsLoaded(); @@ -667,8 +687,12 @@ void FrameMain::UpdateToolbar() { } -////////////////// -// Open subtitles + +/// @brief Open subtitles +/// @param filename +/// @param charset +/// @return +/// void FrameMain::LoadSubtitles (wxString filename,wxString charset) { // First check if there is some loaded if (AssFile::top && AssFile::top->loaded) { @@ -759,8 +783,12 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) { } -////////////////// -// Save subtitles + +/// @brief Save subtitles +/// @param saveas +/// @param withCharset +/// @return +/// bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { // Try to get filename from file wxString filename; @@ -813,8 +841,11 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { } -////////////////////////// -// Try to close subtitles + +/// @brief Try to close subtitles +/// @param enableCancel +/// @return +/// int FrameMain::TryToCloseSubs(bool enableCancel) { AssFile *ass = AssFile::top; if (ass->IsModified()) { @@ -832,8 +863,12 @@ int FrameMain::TryToCloseSubs(bool enableCancel) { } -//////////////////// -// Set display mode + +/// @brief Set display mode +/// @param _showVid +/// @param _showAudio +/// @return +/// void FrameMain::SetDisplayMode(int _showVid,int _showAudio) { // Shown? static bool firstRun = true; @@ -873,8 +908,9 @@ void FrameMain::SetDisplayMode(int _showVid,int _showAudio) { } -//////////////////// -// Update title bar + +/// @brief Update title bar +/// void FrameMain::UpdateTitle() { // Determine if current subs are modified bool subsMod = AssFile::top->IsModified(); @@ -912,8 +948,10 @@ void FrameMain::UpdateTitle() { } -///////////////////////////////////////// -// Updates subs with video/whatever data + +/// @brief Updates subs with video/whatever data +/// @param fromSubs +/// void FrameMain::SynchronizeProject(bool fromSubs) { // Gather current data AssFile *subs = AssFile::top; @@ -1098,8 +1136,12 @@ void FrameMain::SynchronizeProject(bool fromSubs) { } -/////////////// -// Loads video + +/// @brief Loads video +/// @param file +/// @param autoload +/// @return +/// void FrameMain::LoadVideo(wxString file,bool autoload) { if (blockVideoLoad) return; Freeze(); @@ -1166,8 +1208,12 @@ void FrameMain::LoadVideo(wxString file,bool autoload) { } -/////////////// -// Loads audio + +/// @brief Loads audio +/// @param filename +/// @param FromVideo +/// @return +/// void FrameMain::LoadAudio(wxString filename,bool FromVideo) { if (blockAudioLoad) return; VideoContext::Get()->Stop(); @@ -1191,8 +1237,10 @@ void FrameMain::LoadAudio(wxString filename,bool FromVideo) { } -///////////// -// Loads VFR + +/// @brief Loads VFR +/// @param filename +/// void FrameMain::LoadVFR(wxString filename) { VideoContext::Get()->Stop(); if (filename != _T("")) { @@ -1223,22 +1271,28 @@ void FrameMain::LoadVFR(wxString filename) { } -///////////// -// Saves VFR + +/// @brief Saves VFR +/// @param filename +/// void FrameMain::SaveVFR(wxString filename) { VFR_Output.Save(filename); } -///////////// -// Open help + +/// @brief Open help +/// @param page +/// void FrameMain::OpenHelp(wxString page) { HelpButton::OpenPage(_T("Main")); } -/////////////////////// -// Detach video window + +/// @brief Detach video window +/// @param detach +/// void FrameMain::DetachVideo(bool detach) { if (detach) { if (!detachedVideo) { @@ -1256,8 +1310,11 @@ void FrameMain::DetachVideo(bool detach) { } -///////////////////////////////////////////// -// Sets status and clear after n miliseconds + +/// @brief Sets status and clear after n miliseconds +/// @param text +/// @param ms +/// void FrameMain::StatusTimeout(wxString text,int ms) { SetStatusText(text,1); StatusClear.SetOwner(this,StatusClear_Timer); @@ -1265,8 +1322,9 @@ void FrameMain::StatusTimeout(wxString text,int ms) { } -/////////////////////////// -// Setup accelerator table + +/// @brief Setup accelerator table +/// void FrameMain::SetAccelerators() { std::vector entry; entry.reserve(32); @@ -1305,8 +1363,11 @@ void FrameMain::SetAccelerators() { } -////////////////////// -// Load list of files + +/// @brief Load list of files +/// @param list +/// @return +/// bool FrameMain::LoadList(wxArrayString list) { // Build list wxArrayString List; @@ -1393,16 +1454,18 @@ bool FrameMain::LoadList(wxArrayString list) { -////////////////////// -// Sets the descriptions for undo/redo + +/// @brief Sets the descriptions for undo/redo +/// void FrameMain::SetUndoRedoDesc() { editMenu->SetHelpString(0,_T("Undo ")+AssFile::GetUndoDescription()); editMenu->SetHelpString(1,_T("Redo ")+AssFile::GetRedoDescription()); } -///////////////////////////////// -// Check if ASSDraw is available + +/// @brief Check if ASSDraw is available +/// bool FrameMain::HasASSDraw() { #ifdef __WINDOWS__ wxFileName fn(StandardPaths::DecodePath(_T("?data/ASSDraw3.exe"))); @@ -1412,3 +1475,4 @@ bool FrameMain::HasASSDraw() { #endif } + diff --git a/aegisub/src/frame_main.h b/aegisub/src/frame_main.h index e09b0885c..ce5530286 100644 --- a/aegisub/src/frame_main.h +++ b/aegisub/src/frame_main.h @@ -36,6 +36,8 @@ #ifndef FRAME_MAIN_H + +/// DOCME #define FRAME_MAIN_H @@ -65,56 +67,124 @@ class VideoBox; class DialogDetachedVideo; class DialogStyling; class AegisubFileDropTarget; + +/// DOCME namespace Automation4 { class FeatureMacro; class ScriptManager; }; -//////////////////// -// Main Frame class + +/// DOCME +/// @class FrameMain +/// @brief DOCME +/// +/// DOCME class FrameMain: public wxFrame { friend class AegisubFileDropTarget; friend class AegisubApp; friend class SubtitlesGrid; private: + + /// DOCME + + /// DOCME bool showVideo,showAudio; + + /// DOCME bool HasSelection; + + /// DOCME bool menuCreated; + + /// DOCME wxTimer AutoSave; + + /// DOCME wxTimer StatusClear; + + /// DOCME bool blockAudioLoad; + + /// DOCME bool blockVideoLoad; + + /// DOCME wxPanel *Panel; + + /// DOCME wxMenuBar *MenuBar; + + /// DOCME wxMenu *fileMenu; + + /// DOCME wxMenu *editMenu; + + /// DOCME wxMenu *videoMenu; + + /// DOCME wxMenu *timingMenu; + + /// DOCME wxMenu *subtitlesMenu; + + /// DOCME wxMenu *helpMenu; + + /// DOCME wxMenu *audioMenu; + + /// DOCME wxMenu *viewMenu; + + /// DOCME wxMenu *automationMenu; + + /// DOCME wxMenu *kanjiTimingMenu; + + /// DOCME wxMenu *RecentSubs; + + /// DOCME wxMenu *RecentVids; + + /// DOCME wxMenu *RecentAuds; + + /// DOCME wxMenu *RecentTimecodes; + + /// DOCME wxMenu *RecentKeyframes; + + /// DOCME wxToolBar *Toolbar; + + /// DOCME wxComboBox *ZoomBox; + + /// DOCME wxWindow *PreviousFocus; + + /// DOCME wxLogWindow *LogWindow; #ifdef WITH_AUTOMATION + + /// DOCME Automation4::ScriptManager *local_scripts; #endif + + /// DOCME std::vector activeMacroItems; int AddMacroMenuItems(wxMenu *menu, const std::vector ¯os); @@ -265,16 +335,36 @@ private: void SynchronizeProject(bool FromSubs=false); public: + + /// DOCME SubtitlesGrid *SubsBox; + + /// DOCME SubsEditBox *EditBox; + + /// DOCME AudioBox *audioBox; + + /// DOCME VideoBox *videoBox; + + /// DOCME DialogDetachedVideo *detachedVideo; + + /// DOCME DialogStyling *stylingAssistant; + + /// DOCME wxBoxSizer *MainSizer; + + /// DOCME wxBoxSizer *TopSizer; + + /// DOCME wxBoxSizer *BottomSizer; + + /// DOCME wxBoxSizer *ToolSizer; FrameMain (wxArrayString args); @@ -301,152 +391,409 @@ public: //////////////// // Menu Entries enum { + + /// DOCME Menu_File_New = 200, + + /// DOCME Menu_File_Open, + + /// DOCME Menu_File_Save, + + /// DOCME Menu_File_SaveAs, + + /// DOCME Menu_File_Close, + + /// DOCME Menu_File_Open_Video, + + /// DOCME Menu_File_Close_Video, + + /// DOCME Menu_File_Open_Subtitles, + + /// DOCME Menu_File_Open_Subtitles_Charset, + + /// DOCME Menu_File_New_Subtitles, + + /// DOCME Menu_File_Save_Subtitles, + + /// DOCME Menu_File_Save_Subtitles_As, + + /// DOCME Menu_File_Save_Subtitles_With_Charset, + + /// DOCME Menu_File_Export_Subtitles, + + /// DOCME Menu_File_Open_VFR, + + /// DOCME Menu_File_Save_VFR, + + /// DOCME Menu_File_Close_VFR, + + /// DOCME Menu_File_New_Window, + + /// DOCME Menu_File_Exit, + + /// DOCME Menu_File_Recent_Subs_Parent, + + /// DOCME Menu_File_Recent_Vids_Parent, + + /// DOCME Menu_File_Recent_Auds_Parent, + + /// DOCME Menu_File_Recent_Timecodes_Parent, + + /// DOCME Menu_File_Recent_Keyframes_Parent, + + /// DOCME Menu_Video_JumpTo, + + /// DOCME Menu_View_Zoom, + + /// DOCME Menu_View_Zoom_50, + + /// DOCME Menu_View_Zoom_100, + + /// DOCME Menu_View_Zoom_200, + + /// DOCME Menu_Video_Zoom_In, + + /// DOCME Menu_Video_Zoom_Out, + + /// DOCME Menu_Video_Load_Keyframes, + + /// DOCME Menu_Video_Save_Keyframes, + + /// DOCME Menu_Video_Close_Keyframes, + + /// DOCME Toolbar_Zoom_Dropdown, + + /// DOCME Menu_Video_AR, + + /// DOCME Menu_Video_AR_Default, + + /// DOCME Menu_Video_AR_Full, + + /// DOCME Menu_Video_AR_Wide, + + /// DOCME Menu_Video_AR_235, + + /// DOCME Menu_Video_AR_Custom, + + /// DOCME Menu_Video_Select_Visible, + + /// DOCME Menu_Video_Play, + + /// DOCME Menu_Video_Detach, + + /// DOCME Menu_Video_Dummy, + + /// DOCME Menu_Video_Overscan, + + /// DOCME Menu_Video_Details, + + /// DOCME Menu_Audio_Open_File, + + /// DOCME Menu_Audio_Open_From_Video, + + /// DOCME Menu_Audio_Close, #ifdef _DEBUG + + /// DOCME Menu_Audio_Open_Dummy, + + /// DOCME Menu_Audio_Open_Dummy_Noise, #endif + + /// DOCME Menu_Edit_Select, + + /// DOCME Menu_Edit_Undo, + + /// DOCME Menu_Edit_Redo, + + /// DOCME Menu_Edit_Sort, + + /// DOCME Menu_Edit_Find, + + /// DOCME Menu_Edit_Find_Next, + + /// DOCME Menu_Edit_Replace, + + /// DOCME Menu_Edit_Shift, + + /// DOCME Menu_Edit_Cut, + + /// DOCME Menu_Edit_Copy, + + /// DOCME Menu_Edit_Paste, + + /// DOCME Menu_Edit_Paste_Over, + + /// DOCME Menu_Edit_Delete, + + /// DOCME Menu_View_Language, + + /// DOCME Menu_View_Associations, + + /// DOCME Menu_View_Standard, + + /// DOCME Menu_View_Audio, + + /// DOCME Menu_View_Video, + + /// DOCME Menu_View_Subs, + + /// DOCME Menu_Subtitles_Join, + + /// DOCME Menu_Subtitles_Recombine, + + /// DOCME Menu_Subtitles_Insert, + + /// DOCME Menu_Tools_Properties, + + /// DOCME Menu_Tools_Styles_Manager, + + /// DOCME Menu_Tools_Attachments, + + /// DOCME Menu_Tools_Translation, + + /// DOCME Menu_Tools_SpellCheck, + + /// DOCME Menu_Tools_Fonts_Collector, + + /// DOCME Menu_Tools_Automation, + + /// DOCME Menu_Tools_Styling, + + /// DOCME Menu_Tools_Resample, + + /// DOCME Menu_Tools_Timing_Processor, + + /// DOCME Menu_Tools_Kanji_Timer, + + /// DOCME Menu_Tools_Options, + + /// DOCME Menu_Tools_Log, + + /// DOCME Menu_Tools_ASSDraw, + + /// DOCME Menu_Help_Contents, + + /// DOCME Menu_Help_IRCChannel, + + /// DOCME Menu_Help_Website, + + /// DOCME Menu_Help_Forums, + + /// DOCME Menu_Help_BugTracker, + + /// DOCME Menu_Help_Check_Updates, + + /// DOCME Menu_Help_About, + + /// DOCME Menu_Subs_Snap_Start_To_Video, + + /// DOCME Menu_Subs_Snap_End_To_Video, + + /// DOCME Menu_Subs_Snap_Video_To_Start, + + /// DOCME Menu_Subs_Snap_Video_To_End, + + /// DOCME Menu_Video_Snap_To_Scene, + + /// DOCME Menu_Video_Shift_To_Frame, + + /// DOCME AutoSave_Timer, + + /// DOCME StatusClear_Timer, + + /// DOCME Video_Next_Frame, + + /// DOCME Video_Prev_Frame, + + /// DOCME Video_Focus_Seek, + + /// DOCME Grid_Next_Line, + + /// DOCME Grid_Prev_Line, + + /// DOCME Grid_Toggle_Tags, + + /// DOCME Edit_Box_Commit, + + /// DOCME Video_Frame_Play, + + /// DOCME Medusa_Play, + + /// DOCME Medusa_Stop, + + /// DOCME Medusa_Shift_Start_Forward, + + /// DOCME Medusa_Shift_Start_Back, + + /// DOCME Medusa_Shift_End_Forward, + + /// DOCME Medusa_Shift_End_Back, + + /// DOCME Medusa_Play_Before, + + /// DOCME Medusa_Play_After, + + /// DOCME Medusa_Next, + + /// DOCME Medusa_Prev, + + /// DOCME Medusa_Enter, + + /// DOCME Menu_File_Recent = 2000, + + /// DOCME Menu_Video_Recent = 2200, + + /// DOCME Menu_Audio_Recent = 2400, + + /// DOCME Menu_Timecodes_Recent = 2500, + + /// DOCME Menu_Keyframes_Recent = 2600, + + /// DOCME Menu_Automation_Macro = 2700 }; #endif + diff --git a/aegisub/src/frame_main_events.cpp b/aegisub/src/frame_main_events.cpp index 976b8f9f9..45bb92269 100644 --- a/aegisub/src/frame_main_events.cpp +++ b/aegisub/src/frame_main_events.cpp @@ -235,15 +235,21 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame) END_EVENT_TABLE() -//////////////////////////////// -// Redirect grid events to grid + +/// @brief Redirect grid events to grid +/// @param event +/// void FrameMain::OnGridEvent (wxCommandEvent &event) { SubsBox->GetEventHandler()->ProcessEvent(event); } -/////////////////////// -// Rebuild recent list + +/// @brief Rebuild recent list +/// @param listName +/// @param menu +/// @param startID +/// void FrameMain::RebuildRecentList(wxString listName,wxMenu *menu,int startID) { // Wipe previous list int count = (int)menu->GetMenuItemCount(); @@ -269,8 +275,10 @@ void FrameMain::RebuildRecentList(wxString listName,wxMenu *menu,int startID) { } -//////////////////////// -// Menu is being opened + +/// @brief Menu is being opened +/// @param event +/// void FrameMain::OnMenuOpen (wxMenuEvent &event) { // Get menu MenuBar->Freeze(); @@ -469,8 +477,12 @@ void FrameMain::OnMenuOpen (wxMenuEvent &event) { } -////////////////////////////// -// Macro menu creation helper + +/// @brief Macro menu creation helper +/// @param menu +/// @param macros +/// @return +/// int FrameMain::AddMacroMenuItems(wxMenu *menu, const std::vector ¯os) { #ifdef WITH_AUTOMATION if (macros.empty()) { @@ -492,8 +504,10 @@ int FrameMain::AddMacroMenuItems(wxMenu *menu, const std::vectorPlay(); } -////////////// -// Open video + +/// @brief Open video +/// @param event +/// void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) { wxString path = Options.AsText(_T("Last open video path")); wxString str = wxString(_("Video Formats")) + _T(" (*.avi,*.mkv,*.mp4,*.avs,*.d2v,*.ogm,*.mpeg,*.mpg,*.vob)|*.avi;*.avs;*.d2v;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|") @@ -641,15 +685,19 @@ void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) { } -/////////////// -// Close video + +/// @brief Close video +/// @param event +/// void FrameMain::OnCloseVideo(wxCommandEvent& WXUNUSED(event)) { LoadVideo(_T("")); } -////////////// -// Open Audio + +/// @brief Open Audio +/// @param event +/// void FrameMain::OnOpenAudio (wxCommandEvent& WXUNUSED(event)) { wxString path = Options.AsText(_T("Last open audio path")); wxString str = wxString(_("Audio Formats")) + _T(" (*.wav,*.mp3,*.ogg,*.flac,*.mp4,*.ac3,*.aac,*.mka,*.m4a,*.w64)|*.wav;*.mp3;*.ogg;*.flac;*.mp4;*.ac3;*.aac;*.mka;*.m4a;*.w64|") @@ -664,27 +712,45 @@ void FrameMain::OnOpenAudio (wxCommandEvent& WXUNUSED(event)) { } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnOpenAudioFromVideo (wxCommandEvent& WXUNUSED(event)) { LoadAudio(_T(""),true); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnCloseAudio (wxCommandEvent& WXUNUSED(event)) { LoadAudio(_T("")); } #ifdef _DEBUG + +/// @brief DOCME +/// @param event +/// void FrameMain::OnOpenDummyAudio (wxCommandEvent& WXUNUSED(event)) { LoadAudio(_T("?dummy")); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnOpenDummyNoiseAudio (wxCommandEvent& WXUNUSED(event)) { LoadAudio(_T("?noise")); } #endif -////////////////// -// Open subtitles + +/// @brief Open subtitles +/// @param event +/// void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) { wxString path = Options.AsText(_T("Last open subtitles path")); wxString filename = wxFileSelector(_("Open subtitles file"),path,_T(""),_T(""),AssFile::GetWildcardList(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST); @@ -697,8 +763,10 @@ void FrameMain::OnOpenSubtitles(wxCommandEvent& WXUNUSED(event)) { } -//////////////////////////////////////// -// Open subtitles with specific charset + +/// @brief Open subtitles with specific charset +/// @param event +/// void FrameMain::OnOpenSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) { // Initialize charsets wxArrayString choices = AegisubCSConv::GetEncodingsList(); @@ -717,36 +785,46 @@ void FrameMain::OnOpenSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) { } -///////////////////// -// Save subtitles as + +/// @brief Save subtitles as +/// @param event +/// void FrameMain::OnSaveSubtitlesAs(wxCommandEvent& WXUNUSED(event)) { SaveSubtitles(true); } -////////////////// -// Save subtitles + +/// @brief Save subtitles +/// @param event +/// void FrameMain::OnSaveSubtitles(wxCommandEvent& WXUNUSED(event)) { SaveSubtitles(false); } -//////////////////////////////////////// -// Save subtitles with specific charset + +/// @brief Save subtitles with specific charset +/// @param event +/// void FrameMain::OnSaveSubtitlesCharset(wxCommandEvent& WXUNUSED(event)) { SaveSubtitles(true,true); } -/////////////////// -// Close subtitles + +/// @brief Close subtitles +/// @param event +/// void FrameMain::OnNewSubtitles(wxCommandEvent& WXUNUSED(event)) { LoadSubtitles(_T("")); } -//////////////////// -// Export subtitles + +/// @brief Export subtitles +/// @param event +/// void FrameMain::OnExportSubtitles(wxCommandEvent & WXUNUSED(event)) { #ifdef WITH_AUTOMATION int autoreload = Options.AsInt(_T("Automation Autoreload Mode")); @@ -776,8 +854,10 @@ void FrameMain::OnExportSubtitles(wxCommandEvent & WXUNUSED(event)) { } -///////////////// -// Open VFR tags + +/// @brief Open VFR tags +/// @param event +/// void FrameMain::OnOpenVFR(wxCommandEvent &event) { wxString path = Options.AsText(_T("Last open timecodes path")); wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") @@ -791,8 +871,10 @@ void FrameMain::OnOpenVFR(wxCommandEvent &event) { } -///////////////// -// Save VFR tags + +/// @brief Save VFR tags +/// @param event +/// void FrameMain::OnSaveVFR(wxCommandEvent &event) { wxString path = Options.AsText(_T("Last open timecodes path")); wxString str = wxString(_("All Supported Types")) + _T("(*.txt)|*.txt|") @@ -807,15 +889,20 @@ void FrameMain::OnSaveVFR(wxCommandEvent &event) { -////////////////// -// Close VFR tags + +/// @brief Close VFR tags +/// @param event +/// void FrameMain::OnCloseVFR(wxCommandEvent &event) { LoadVFR(_T("")); } -////////////////// -// Open keyframes + +/// @brief Open keyframes +/// @param event +/// @return +/// void FrameMain::OnOpenKeyframes (wxCommandEvent &event) { // Pick file wxString path = Options.AsText(_T("Last open keyframes path")); @@ -832,8 +919,10 @@ void FrameMain::OnOpenKeyframes (wxCommandEvent &event) { } -/////////////////// -// Close keyframes + +/// @brief Close keyframes +/// @param event +/// void FrameMain::OnCloseKeyframes (wxCommandEvent &event) { VideoContext::Get()->CloseOverKeyFrames(); videoBox->videoSlider->Refresh(); @@ -842,8 +931,11 @@ void FrameMain::OnCloseKeyframes (wxCommandEvent &event) { } -////////////////// -// Save keyframes + +/// @brief Save keyframes +/// @param event +/// @return +/// void FrameMain::OnSaveKeyframes (wxCommandEvent &event) { // Pick file wxString path = Options.AsText(_T("Last open keyframes path")); @@ -857,32 +949,50 @@ void FrameMain::OnSaveKeyframes (wxCommandEvent &event) { } -/////////////// -// Zoom levels + +/// @brief Zoom levels +/// @param event +/// void FrameMain::OnSetZoom50(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); videoBox->videoDisplay->zoomBox->SetSelection(3); videoBox->videoDisplay->SetZoomPos(3); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnSetZoom100(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); videoBox->videoDisplay->zoomBox->SetSelection(7); videoBox->videoDisplay->SetZoomPos(7); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnSetZoom200(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); videoBox->videoDisplay->zoomBox->SetSelection(15); videoBox->videoDisplay->SetZoomPos(15); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnZoomIn (wxCommandEvent &event) { VideoContext::Get()->Stop(); videoBox->videoDisplay->zoomBox->SetSelection(videoBox->videoDisplay->zoomBox->GetSelection()+1); videoBox->videoDisplay->SetZoomPos(videoBox->videoDisplay->zoomBox->GetSelection()); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnZoomOut (wxCommandEvent &event) { VideoContext::Get()->Stop(); int selTo = videoBox->videoDisplay->zoomBox->GetSelection()-1; @@ -891,20 +1001,28 @@ void FrameMain::OnZoomOut (wxCommandEvent &event) { videoBox->videoDisplay->SetZoomPos(videoBox->videoDisplay->zoomBox->GetSelection()); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnSetZoom(wxCommandEvent &event) { videoBox->videoDisplay->SetZoomPos(videoBox->videoDisplay->zoomBox->GetSelection()); } -//////////////// -// Detach video + +/// @brief Detach video +/// @param event +/// void FrameMain::OnDetachVideo(wxCommandEvent &event) { DetachVideo(); } -/////////////////// -// Use dummy video + +/// @brief Use dummy video +/// @param event +/// void FrameMain::OnDummyVideo (wxCommandEvent &event) { wxString fn; if (DialogDummyVideo::CreateDummyVideo(this, fn)) { @@ -913,8 +1031,10 @@ void FrameMain::OnDummyVideo (wxCommandEvent &event) { } -/////////////////// -// Overscan toggle + +/// @brief Overscan toggle +/// @param event +/// void FrameMain::OnOverscan (wxCommandEvent &event) { Options.SetBool(_T("Show overscan mask"),event.IsChecked()); Options.Save(); @@ -923,8 +1043,10 @@ void FrameMain::OnOverscan (wxCommandEvent &event) { } -////////////////////// -// Show video details + +/// @brief Show video details +/// @param event +/// void FrameMain::OnOpenVideoDetails (wxCommandEvent &event) { VideoContext::Get()->Stop(); DialogVideoDetails videodetails(this); @@ -932,8 +1054,10 @@ void FrameMain::OnOpenVideoDetails (wxCommandEvent &event) { } -/////////////////////// -// Open jump to dialog + +/// @brief Open jump to dialog +/// @param event +/// void FrameMain::OnJumpTo(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); if (VideoContext::Get()->IsLoaded()) { @@ -944,8 +1068,10 @@ void FrameMain::OnJumpTo(wxCommandEvent& WXUNUSED(event)) { } -///////////////////// -// Open shift dialog + +/// @brief Open shift dialog +/// @param event +/// void FrameMain::OnShift(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); DialogShiftTimes Shift(this,SubsBox); @@ -953,8 +1079,10 @@ void FrameMain::OnShift(wxCommandEvent& WXUNUSED(event)) { } -/////////////////// -// Open properties + +/// @brief Open properties +/// @param event +/// void FrameMain::OnOpenProperties (wxCommandEvent &event) { VideoContext::Get()->Stop(); DialogProperties Properties(this); @@ -965,8 +1093,10 @@ void FrameMain::OnOpenProperties (wxCommandEvent &event) { } -/////////////////////// -// Open styles manager + +/// @brief Open styles manager +/// @param event +/// void FrameMain::OnOpenStylesManager(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); DialogStyleManager StyleManager(this,SubsBox); @@ -976,8 +1106,10 @@ void FrameMain::OnOpenStylesManager(wxCommandEvent& WXUNUSED(event)) { } -//////////////////// -// Open attachments + +/// @brief Open attachments +/// @param event +/// void FrameMain::OnOpenAttachments(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); DialogAttachments attachments(this); @@ -985,8 +1117,10 @@ void FrameMain::OnOpenAttachments(wxCommandEvent& WXUNUSED(event)) { } -////////////////////////////// -// Open translation assistant + +/// @brief Open translation assistant +/// @param event +/// void FrameMain::OnOpenTranslation(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); int start = SubsBox->GetFirstSelRow(); @@ -996,8 +1130,10 @@ void FrameMain::OnOpenTranslation(wxCommandEvent& WXUNUSED(event)) { } -////////////////////// -// Open Spell Checker + +/// @brief Open Spell Checker +/// @param event +/// void FrameMain::OnOpenSpellCheck (wxCommandEvent &event) { VideoContext::Get()->Stop(); new DialogSpellChecker(this); @@ -1006,8 +1142,10 @@ void FrameMain::OnOpenSpellCheck (wxCommandEvent &event) { } -//////////////////////// -// Open Fonts Collector + +/// @brief Open Fonts Collector +/// @param event +/// void FrameMain::OnOpenFontsCollector (wxCommandEvent &event) { VideoContext::Get()->Stop(); DialogFontsCollector Collector(this); @@ -1015,8 +1153,10 @@ void FrameMain::OnOpenFontsCollector (wxCommandEvent &event) { } -///////////////////////////// -// Open Resolution Resampler + +/// @brief Open Resolution Resampler +/// @param event +/// void FrameMain::OnOpenResample (wxCommandEvent &event) { VideoContext::Get()->Stop(); DialogResample diag(this, SubsBox); @@ -1024,22 +1164,28 @@ void FrameMain::OnOpenResample (wxCommandEvent &event) { } -///////////////////////////////////// -// Open Timing post-processor dialog + +/// @brief Open Timing post-processor dialog +/// @param event +/// void FrameMain::OnOpenTimingProcessor (wxCommandEvent &event) { DialogTimingProcessor timing(this,SubsBox); timing.ShowModal(); } -///////////////////////////////////// -// Open Kanji Timer dialog + +/// @brief Open Kanji Timer dialog +/// @param event +/// void FrameMain::OnOpenKanjiTimer (wxCommandEvent &event) { DialogKanjiTimer kanjitimer(this,SubsBox); kanjitimer.ShowModal(); } -/////////////////////// -// Open Options dialog + +/// @brief Open Options dialog +/// @param event +/// void FrameMain::OnOpenOptions (wxCommandEvent &event) { try { DialogOptions options(this); @@ -1051,22 +1197,28 @@ void FrameMain::OnOpenOptions (wxCommandEvent &event) { } -////////////////// -// Open log window + +/// @brief Open log window +/// @param event +/// void FrameMain::OnOpenLog (wxCommandEvent &event) { LogWindow->Show(true); } -////////////////// -// Launch ASSDraw + +/// @brief Launch ASSDraw +/// @param event +/// void FrameMain::OnOpenASSDraw (wxCommandEvent &event) { wxExecute(_T("\"") + StandardPaths::DecodePath(_T("?data/ASSDraw3.exe")) + _T("\"")); } -/////////////////// -// Open Automation + +/// @brief Open Automation +/// @param event +/// void FrameMain::OnOpenAutomation (wxCommandEvent &event) { #ifdef WITH_AUTOMATION #ifdef __APPLE__ @@ -1104,8 +1256,10 @@ void FrameMain::OnOpenAutomation (wxCommandEvent &event) { } -/////////////////////////////////////////////////////////// -// General handler for all Automation-generated menu items + +/// @brief General handler for all Automation-generated menu items +/// @param event +/// void FrameMain::OnAutomationMacro (wxCommandEvent &event) { #ifdef WITH_AUTOMATION SubsBox->BeginBatch(); @@ -1128,8 +1282,10 @@ void FrameMain::OnAutomationMacro (wxCommandEvent &event) { } -////////////////////// -// Snap subs to video + +/// @brief Snap subs to video +/// @param event +/// void FrameMain::OnSnapSubsStartToVid (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { wxArrayInt sel = SubsBox->GetSelection(); @@ -1140,6 +1296,10 @@ void FrameMain::OnSnapSubsStartToVid (wxCommandEvent &event) { } } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnSnapSubsEndToVid (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { wxArrayInt sel = SubsBox->GetSelection(); @@ -1151,8 +1311,10 @@ void FrameMain::OnSnapSubsEndToVid (wxCommandEvent &event) { } -////////////////////// -// Jump video to subs + +/// @brief Jump video to subs +/// @param event +/// void FrameMain::OnSnapVidToSubsStart (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { wxArrayInt sel = SubsBox->GetSelection(); @@ -1163,6 +1325,10 @@ void FrameMain::OnSnapVidToSubsStart (wxCommandEvent &event) { } } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnSnapVidToSubsEnd (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { wxArrayInt sel = SubsBox->GetSelection(); @@ -1174,8 +1340,10 @@ void FrameMain::OnSnapVidToSubsEnd (wxCommandEvent &event) { } -///////////////// -// Snap to scene + +/// @brief Snap to scene +/// @param event +/// void FrameMain::OnSnapToScene (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { // Get frames @@ -1235,8 +1403,11 @@ void FrameMain::OnSnapToScene (wxCommandEvent &event) { } -////////////////// -// Shift to frame + +/// @brief Shift to frame +/// @param event +/// @return +/// void FrameMain::OnShiftToFrame (wxCommandEvent &event) { if (VideoContext::Get()->IsLoaded()) { // Get selection @@ -1267,8 +1438,11 @@ void FrameMain::OnShiftToFrame (wxCommandEvent &event) { } -//////// -// Undo + +/// @brief Undo +/// @param event +/// @return +/// void FrameMain::OnUndo(wxCommandEvent& WXUNUSED(event)) { // Block if it's on a editbox //wxWindow *focused = wxWindow::FindFocus(); @@ -1281,8 +1455,10 @@ void FrameMain::OnUndo(wxCommandEvent& WXUNUSED(event)) { } -//////// -// Redo + +/// @brief Redo +/// @param event +/// void FrameMain::OnRedo(wxCommandEvent& WXUNUSED(event)) { VideoContext::Get()->Stop(); AssFile::StackRedo(); @@ -1291,32 +1467,40 @@ void FrameMain::OnRedo(wxCommandEvent& WXUNUSED(event)) { } -//////// -// Find + +/// @brief Find +/// @param event +/// void FrameMain::OnFind(wxCommandEvent &event) { VideoContext::Get()->Stop(); Search.OpenDialog(false); } -///////////// -// Find next + +/// @brief Find next +/// @param event +/// void FrameMain::OnFindNext(wxCommandEvent &event) { VideoContext::Get()->Stop(); Search.FindNext(); } -////////////////// -// Find & replace + +/// @brief Find & replace +/// @param event +/// void FrameMain::OnReplace(wxCommandEvent &event) { VideoContext::Get()->Stop(); Search.OpenDialog(true); } -////////////////////////////////// -// Change aspect ratio to default + +/// @brief Change aspect ratio to default +/// @param event +/// void FrameMain::OnSetARDefault (wxCommandEvent &event) { VideoContext::Get()->Stop(); VideoContext::Get()->SetAspectRatio(0); @@ -1324,8 +1508,10 @@ void FrameMain::OnSetARDefault (wxCommandEvent &event) { } -///////////////////////////////////// -// Change aspect ratio to fullscreen + +/// @brief Change aspect ratio to fullscreen +/// @param event +/// void FrameMain::OnSetARFull (wxCommandEvent &event) { VideoContext::Get()->Stop(); VideoContext::Get()->SetAspectRatio(1); @@ -1333,8 +1519,10 @@ void FrameMain::OnSetARFull (wxCommandEvent &event) { } -///////////////////////////////////// -// Change aspect ratio to widescreen + +/// @brief Change aspect ratio to widescreen +/// @param event +/// void FrameMain::OnSetARWide (wxCommandEvent &event) { VideoContext::Get()->Stop(); VideoContext::Get()->SetAspectRatio(2); @@ -1342,8 +1530,10 @@ void FrameMain::OnSetARWide (wxCommandEvent &event) { } -/////////////////////////////// -// Change aspect ratio to 2:35 + +/// @brief Change aspect ratio to 2:35 +/// @param event +/// void FrameMain::OnSetAR235 (wxCommandEvent &event) { VideoContext::Get()->Stop(); VideoContext::Get()->SetAspectRatio(3); @@ -1351,8 +1541,11 @@ void FrameMain::OnSetAR235 (wxCommandEvent &event) { } -///////////////////////////////////////// -// Change aspect ratio to a custom value + +/// @brief Change aspect ratio to a custom value +/// @param event +/// @return +/// void FrameMain::OnSetARCustom (wxCommandEvent &event) { // Get text VideoContext::Get()->Stop(); @@ -1402,8 +1595,10 @@ void FrameMain::OnSetARCustom (wxCommandEvent &event) { } -//////////////////////////////////// -// Window is attempted to be closed + +/// @brief Window is attempted to be closed +/// @param event +/// void FrameMain::OnCloseWindow (wxCloseEvent &event) { // Stop audio and video VideoContext::Get()->Stop(); @@ -1426,8 +1621,11 @@ void FrameMain::OnCloseWindow (wxCloseEvent &event) { } -////////////////// -// Cut/copy/paste + +/// @brief Cut/copy/paste +/// @param event +/// @return +/// void FrameMain::OnCut (wxCommandEvent &event) { if (FindFocus() == EditBox->TextEdit) { EditBox->TextEdit->Cut(); @@ -1436,6 +1634,11 @@ void FrameMain::OnCut (wxCommandEvent &event) { SubsBox->CutLines(SubsBox->GetSelection()); } + +/// @brief DOCME +/// @param event +/// @return +/// void FrameMain::OnCopy (wxCommandEvent &event) { if (FindFocus() == EditBox->TextEdit) { EditBox->TextEdit->Copy(); @@ -1444,6 +1647,11 @@ void FrameMain::OnCopy (wxCommandEvent &event) { SubsBox->CopyLines(SubsBox->GetSelection()); } + +/// @brief DOCME +/// @param event +/// @return +/// void FrameMain::OnPaste (wxCommandEvent &event) { if (FindFocus() == EditBox->TextEdit) { EditBox->TextEdit->Paste(); @@ -1453,23 +1661,29 @@ void FrameMain::OnPaste (wxCommandEvent &event) { } -////////////// -// Paste over + +/// @brief Paste over +/// @param event +/// void FrameMain::OnPasteOver (wxCommandEvent &event) { SubsBox->PasteLines(SubsBox->GetFirstSelRow(),true); } -//////////////////////// -// Select visible lines + +/// @brief Select visible lines +/// @param event +/// void FrameMain::OnSelectVisible (wxCommandEvent &event) { VideoContext::Get()->Stop(); SubsBox->SelectVisible(); } -////////////////////// -// Open select dialog + +/// @brief Open select dialog +/// @param event +/// void FrameMain::OnSelect (wxCommandEvent &event) { VideoContext::Get()->Stop(); DialogSelection select(this, SubsBox); @@ -1477,8 +1691,10 @@ void FrameMain::OnSelect (wxCommandEvent &event) { } -////////////////// -// Sort subtitles + +/// @brief Sort subtitles +/// @param event +/// void FrameMain::OnSort (wxCommandEvent &event) { // Ensure that StartMS is set properly AssEntry *curEntry; @@ -1499,8 +1715,10 @@ void FrameMain::OnSort (wxCommandEvent &event) { } -////////////////////////// -// Open styling assistant + +/// @brief Open styling assistant +/// @param event +/// void FrameMain::OnOpenStylingAssistant (wxCommandEvent &event) { VideoContext::Get()->Stop(); if (!stylingAssistant) stylingAssistant = new DialogStyling(this,SubsBox); @@ -1508,8 +1726,10 @@ void FrameMain::OnOpenStylingAssistant (wxCommandEvent &event) { } -/////////////// -// Auto backup + +/// @brief Auto backup +/// @param event +/// void FrameMain::OnAutoSave(wxTimerEvent &event) { // Auto Save try { @@ -1547,37 +1767,47 @@ void FrameMain::OnAutoSave(wxTimerEvent &event) { } -/////////////////// -// Clear statusbar + +/// @brief Clear statusbar +/// @param event +/// void FrameMain::OnStatusClear(wxTimerEvent &event) { SetStatusText(_T(""),1); } -//////////// -// Key down + +/// @brief Key down +/// @param event +/// void FrameMain::OnKeyDown(wxKeyEvent &event) { audioBox->audioDisplay->AddPendingEvent(event); event.Skip(); } -///////////////////// -// Next frame hotkey + +/// @brief Next frame hotkey +/// @param event +/// void FrameMain::OnNextFrame(wxCommandEvent &event) { videoBox->videoSlider->NextFrame(); } -///////////////////////// -// Previous frame hotkey + +/// @brief Previous frame hotkey +/// @param event +/// void FrameMain::OnPrevFrame(wxCommandEvent &event) { videoBox->videoSlider->PrevFrame(); } -/////////////////////////////////////////////////// -// Toggle focus between seek bar and whatever else + +/// @brief Toggle focus between seek bar and whatever else +/// @param event +/// void FrameMain::OnFocusSeek(wxCommandEvent &event) { wxWindow *curFocus = wxWindow::FindFocus(); if (curFocus == videoBox->videoSlider) { @@ -1590,8 +1820,11 @@ void FrameMain::OnFocusSeek(wxCommandEvent &event) { } -//////////////////////// -// Previous line hotkey + +/// @brief Previous line hotkey +/// @param event +/// @return +/// void FrameMain::OnPrevLine(wxCommandEvent &event) { int next = EditBox->linen-1; if (next < 0) return; @@ -1601,8 +1834,11 @@ void FrameMain::OnPrevLine(wxCommandEvent &event) { } -//////////////////// -// Next line hotkey + +/// @brief Next line hotkey +/// @param event +/// @return +/// void FrameMain::OnNextLine(wxCommandEvent &event) { int nrows = SubsBox->GetRows(); int next = EditBox->linen+1; @@ -1613,8 +1849,10 @@ void FrameMain::OnNextLine(wxCommandEvent &event) { } -////////////////////////////////// -// Cycle through tag hiding modes + +/// @brief Cycle through tag hiding modes +/// @param event +/// void FrameMain::OnToggleTags(wxCommandEvent &event) { // Read value int tagMode = Options.AsInt(_T("Grid hide overrides")); @@ -1641,8 +1879,11 @@ void FrameMain::OnToggleTags(wxCommandEvent &event) { } -///////////////////////////// -// Commit Edit Box's changes + +/// @brief Commit Edit Box's changes +/// @param event +/// @return +/// void FrameMain::OnEditBoxCommit(wxCommandEvent &event) { // Find focus wxWindow *focus = FindFocus(); @@ -1666,8 +1907,10 @@ void FrameMain::OnEditBoxCommit(wxCommandEvent &event) { } -/////////////////////////////// -// Choose a different language + +/// @brief Choose a different language +/// @param event +/// void FrameMain::OnChooseLanguage (wxCommandEvent &event) { // Get language AegisubApp *app = (AegisubApp*) wxTheApp; @@ -1697,8 +1940,10 @@ void FrameMain::OnChooseLanguage (wxCommandEvent &event) { } -///////////////////// -// Pick associations + +/// @brief Pick associations +/// @param event +/// void FrameMain::OnPickAssociations(wxCommandEvent &event) { #ifdef WIN32 DialogAssociations diag(NULL); @@ -1707,44 +1952,61 @@ void FrameMain::OnPickAssociations(wxCommandEvent &event) { } -///////////////// -// View standard + +/// @brief View standard +/// @param event +/// @return +/// void FrameMain::OnViewStandard (wxCommandEvent &event) { if (!audioBox->audioDisplay->loaded || !VideoContext::Get()->IsLoaded()) return; SetDisplayMode(1,1); } -////////////// -// View video + +/// @brief View video +/// @param event +/// @return +/// void FrameMain::OnViewVideo (wxCommandEvent &event) { if (!VideoContext::Get()->IsLoaded()) return; SetDisplayMode(1,0); } -////////////// -// View audio + +/// @brief View audio +/// @param event +/// @return +/// void FrameMain::OnViewAudio (wxCommandEvent &event) { if (!audioBox->audioDisplay->loaded) return; SetDisplayMode(0,1); } -///////////// -// View subs + +/// @brief View subs +/// @param event +/// void FrameMain::OnViewSubs (wxCommandEvent &event) { SetDisplayMode(0,0); } -//////////////////// -// Medusa shortcuts + +/// @brief Medusa shortcuts +/// @param event +/// void FrameMain::OnMedusaPlay(wxCommandEvent &event) { int start=0,end=0; audioBox->audioDisplay->GetTimesSelection(start,end); audioBox->audioDisplay->Play(start,end); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaStop(wxCommandEvent &event) { // Playing, stop if (audioBox->audioDisplay->player->IsPlaying()) { @@ -1759,47 +2021,84 @@ void FrameMain::OnMedusaStop(wxCommandEvent &event) { audioBox->audioDisplay->Play(end-500,end); } } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaShiftStartForward(wxCommandEvent &event) { audioBox->audioDisplay->curStartMS += 10; audioBox->audioDisplay->Update(); audioBox->audioDisplay->wxWindow::Update(); audioBox->audioDisplay->UpdateTimeEditCtrls(); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaShiftStartBack(wxCommandEvent &event) { audioBox->audioDisplay->curStartMS -= 10; audioBox->audioDisplay->Update(); audioBox->audioDisplay->wxWindow::Update(); audioBox->audioDisplay->UpdateTimeEditCtrls(); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaShiftEndForward(wxCommandEvent &event) { audioBox->audioDisplay->curEndMS += 10; audioBox->audioDisplay->Update(); audioBox->audioDisplay->wxWindow::Update(); audioBox->audioDisplay->UpdateTimeEditCtrls(); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaShiftEndBack(wxCommandEvent &event) { audioBox->audioDisplay->curEndMS -= 10; audioBox->audioDisplay->Update(); audioBox->audioDisplay->wxWindow::Update(); audioBox->audioDisplay->UpdateTimeEditCtrls(); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaPlayBefore(wxCommandEvent &event) { int start=0,end=0; audioBox->audioDisplay->GetTimesSelection(start,end); audioBox->audioDisplay->Play(start-500,start); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaPlayAfter(wxCommandEvent &event) { int start=0,end=0; audioBox->audioDisplay->GetTimesSelection(start,end); audioBox->audioDisplay->Play(end,end+500); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaNext(wxCommandEvent &event) { audioBox->audioDisplay->Next(false); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaPrev(wxCommandEvent &event) { audioBox->audioDisplay->Prev(false); } + +/// @brief DOCME +/// @param event +/// void FrameMain::OnMedusaEnter(wxCommandEvent &event) { audioBox->audioDisplay->CommitChanges(true); } + diff --git a/aegisub/src/gl_text.cpp b/aegisub/src/gl_text.cpp index 492e0d7fe..281035dba 100644 --- a/aegisub/src/gl_text.cpp +++ b/aegisub/src/gl_text.cpp @@ -45,38 +45,49 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// OpenGLText::OpenGLText() { r = g = b = a = 1.0f; } -////////////// -// Destructor + +/// @brief Destructor +/// OpenGLText::~OpenGLText() { Reset(); } -///////// -// Reset + +/// @brief Reset +/// void OpenGLText::Reset() { textures.clear(); glyphs.clear(); } -//////////////// -// Get instance + +/// @brief Get instance +/// @return +/// OpenGLText& OpenGLText::GetInstance() { static OpenGLText instance; return instance; } -//////////// -// Set font + +/// @brief Set font +/// @param face +/// @param size +/// @param bold +/// @param italics +/// @return +/// void OpenGLText::DoSetFont(wxString face,int size,bool bold,bool italics) { // No change required if (size == fontSize && face == fontFace && bold == fontBold && italics == fontItalics) return; @@ -95,8 +106,11 @@ void OpenGLText::DoSetFont(wxString face,int size,bool bold,bool italics) { } -////////////// -// Set colour + +/// @brief Set colour +/// @param col +/// @param alpha +/// void OpenGLText::DoSetColour(wxColour col,float alpha) { r = col.Red() / 255.0f; g = col.Green() / 255.0f; @@ -105,8 +119,12 @@ void OpenGLText::DoSetColour(wxColour col,float alpha) { } -///////// -// Print + +/// @brief Print +/// @param text +/// @param x +/// @param y +/// void OpenGLText::DoPrint(wxString text,int x,int y) { // Set OpenGL glEnable(GL_BLEND); @@ -129,8 +147,13 @@ void OpenGLText::DoPrint(wxString text,int x,int y) { } -///////////////// -// Draw a string + +/// @brief Draw a string +/// @param text +/// @param x +/// @param y +/// @return +/// void OpenGLText::DrawString(wxString text,int x,int y) { // Variables size_t len = text.Length(); @@ -160,8 +183,13 @@ void OpenGLText::DrawString(wxString text,int x,int y) { } -///////////////////////// -// Calculate text extent + +/// @brief Calculate text extent +/// @param text +/// @param w +/// @param h +/// @return +/// void OpenGLText::DoGetExtent(wxString text,int &w,int &h) { // Variables size_t len = text.Length(); @@ -198,8 +226,11 @@ void OpenGLText::DoGetExtent(wxString text,int &w,int &h) { } -/////////////// -// Get a glyph + +/// @brief Get a glyph +/// @param i +/// @return +/// OpenGLTextGlyph OpenGLText::GetGlyph(int i) { glyphMap::iterator res = glyphs.find(i); @@ -211,8 +242,11 @@ OpenGLTextGlyph OpenGLText::GetGlyph(int i) { } -////////////////// -// Create a glyph + +/// @brief Create a glyph +/// @param n +/// @return +/// OpenGLTextGlyph OpenGLText::CreateGlyph(int n) { // Create glyph OpenGLTextGlyph glyph; @@ -240,8 +274,11 @@ OpenGLTextGlyph OpenGLText::CreateGlyph(int n) { } -/////////////////////// -// Texture constructor + +/// @brief Texture constructor +/// @param w +/// @param h +/// OpenGLTextTexture::OpenGLTextTexture(int w,int h) { // Properties x = y = nextY = 0; @@ -265,8 +302,9 @@ OpenGLTextTexture::OpenGLTextTexture(int w,int h) { } -////////////////////// -// Texture destructor + +/// @brief Texture destructor +/// OpenGLTextTexture::~OpenGLTextTexture() { if (tex) { glDeleteTextures(1,&tex); @@ -275,8 +313,11 @@ OpenGLTextTexture::~OpenGLTextTexture() { } -////////////////////////// -// Can fit a glyph in it? + +/// @brief Can fit a glyph in it? +/// @param glyph +/// @return +/// bool OpenGLTextTexture::TryToInsert(OpenGLTextGlyph &glyph) { // Get size int w = glyph.w; @@ -304,8 +345,10 @@ bool OpenGLTextTexture::TryToInsert(OpenGLTextGlyph &glyph) { } -////////// -// Insert + +/// @brief Insert +/// @param glyph +/// void OpenGLTextTexture::Insert(OpenGLTextGlyph &glyph) { // Glyph data wxString str = wxChar(glyph.value); @@ -355,8 +398,11 @@ void OpenGLTextTexture::Insert(OpenGLTextGlyph &glyph) { } -//////////////// -// Draw a glyph + +/// @brief Draw a glyph +/// @param x +/// @param y +/// void OpenGLTextGlyph::Draw(int x,int y) { // Store matrix and translate glPushMatrix(); @@ -386,17 +432,21 @@ void OpenGLTextGlyph::Draw(int x,int y) { } -//////////////////// -// Glyph Destructor + +/// @brief Glyph Destructor +/// OpenGLTextGlyph::~OpenGLTextGlyph() { if (tempBmp) delete tempBmp; tempBmp = NULL; } -///////////////////// -// Get glyph metrics + +/// DOCME wxBitmap *OpenGLTextGlyph::tempBmp = NULL; + +/// @brief DOCME +/// void OpenGLTextGlyph::GetMetrics() { // Glyph data wxCoord desc,lead; @@ -413,3 +463,4 @@ void OpenGLTextGlyph::GetMetrics() { } } + diff --git a/aegisub/src/gl_text.h b/aegisub/src/gl_text.h index fd58e70e3..b7bc39103 100644 --- a/aegisub/src/gl_text.h +++ b/aegisub/src/gl_text.h @@ -50,16 +50,38 @@ #include -///////////////////// -// Glyph information + +/// DOCME +/// @class OpenGLTextGlyph +/// @brief DOCME +/// +/// DOCME class OpenGLTextGlyph { private: + + /// DOCME static wxBitmap *tempBmp; public: + + /// DOCME int value; + + /// DOCME int tex; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME float x1,y1,x2,y2; + + /// DOCME + + /// DOCME int w,h; void GetMetrics(); @@ -68,19 +90,37 @@ public: ~OpenGLTextGlyph(); }; + +/// DOCME typedef std::map glyphMap; -/////////////// -// Texture map + +/// DOCME +/// @class OpenGLTextTexture +/// @brief DOCME +/// +/// DOCME class OpenGLTextTexture { private: + + /// DOCME + + /// DOCME + + /// DOCME int x,y,nextY; + + /// DOCME + + /// DOCME int width,height; void Insert(OpenGLTextGlyph &glyph); public: + + /// DOCME GLuint tex; bool TryToInsert(OpenGLTextGlyph &glyph); @@ -90,19 +130,47 @@ public: }; -///////////////////////////// -// OpenGL Text Drawing class + +/// DOCME +/// @class OpenGLText +/// @brief DOCME +/// +/// DOCME class OpenGLText { private: + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME float r,g,b,a; + + /// DOCME int lineHeight; + + /// DOCME int fontSize; + + /// DOCME bool fontBold; + + /// DOCME bool fontItalics; + + /// DOCME wxString fontFace; + + /// DOCME wxFont font; + + /// DOCME glyphMap glyphs; + + /// DOCME std::vector textures; OpenGLText(); @@ -122,10 +190,39 @@ private: void DoGetExtent(wxString text,int &w,int &h); public: + + /// @brief DOCME + /// @return + /// static wxFont GetFont() { return GetInstance().font; } + + /// @brief DOCME + /// @param face=_T(Ó) + /// @param size=10 + /// @param bold=true + /// @param italics=false + /// static void SetFont(wxString face=_T("Verdana"),int size=10,bool bold=true,bool italics=false) { GetInstance().DoSetFont(face,size,bold,italics); } + + /// @brief DOCME + /// @param col + /// @param alpha=1.0f + /// static void SetColour(wxColour col,float alpha=1.0f) { GetInstance().DoSetColour(col,alpha); } + + /// @brief DOCME + /// @param text + /// @param x + /// @param y + /// static void Print(wxString text,int x,int y) { GetInstance().DoPrint(text,x,y); } + + /// @brief DOCME + /// @param text + /// @param w + /// @param h + /// static void GetExtent(wxString text,int &w,int &h) { GetInstance().DoGetExtent(text,w,h); } }; + diff --git a/aegisub/src/gl_wrap.cpp b/aegisub/src/gl_wrap.cpp index 268775c48..200e66cc1 100644 --- a/aegisub/src/gl_wrap.cpp +++ b/aegisub/src/gl_wrap.cpp @@ -55,16 +55,23 @@ ////////////////////////// // Extension get function #ifdef __WIN32__ + +/// @brief DOCME +/// @param str +/// @return +/// void* glGetProc(const char *str) { return wglGetProcAddress(str); } #else -//void* glGetProc(const char *str) { return glXGetProcAddress((const GLubyte *)str); } + +/// DOCME #define glGetProc(a) glXGetProcAddress((const GLubyte *)(a)) #endif -/////////////// -// Constructor + +/// @brief Constructor +/// OpenGLWrapper::OpenGLWrapper() { r1 = g1 = b1 = a1 = 1.0f; r2 = g2 = b2 = a2 = 1.0f; @@ -72,8 +79,13 @@ OpenGLWrapper::OpenGLWrapper() { } -///////////// -// Draw line + +/// @brief Draw line +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// void OpenGLWrapper::DrawLine(float x1,float y1,float x2,float y2) { SetModeLine(); glBegin(GL_LINES); @@ -83,8 +95,14 @@ void OpenGLWrapper::DrawLine(float x1,float y1,float x2,float y2) { } -///////////// -// Draw line + +/// @brief Draw line +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// @param step +/// void OpenGLWrapper::DrawDashedLine(float x1,float y1,float x2,float y2,float step) { float dist = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); int steps = (int)((dist-20)/step); @@ -96,15 +114,25 @@ void OpenGLWrapper::DrawDashedLine(float x1,float y1,float x2,float y2,float ste } -/////////////// -// Draw circle + +/// @brief Draw circle +/// @param x +/// @param y +/// @param radiusX +/// @param radiusY +/// void OpenGLWrapper::DrawEllipse(float x,float y,float radiusX,float radiusY) { DrawRing(x,y,radiusY,radiusY,radiusX/radiusY); } -////////////////// -// Draw rectangle + +/// @brief Draw rectangle +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// void OpenGLWrapper::DrawRectangle(float x1,float y1,float x2,float y2) { // Fill if (a2 != 0.0) { @@ -130,8 +158,15 @@ void OpenGLWrapper::DrawRectangle(float x1,float y1,float x2,float y2) { } -///////////////// -// Draw triangle + +/// @brief Draw triangle +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// @param x3 +/// @param y3 +/// void OpenGLWrapper::DrawTriangle(float x1,float y1,float x2,float y2,float x3,float y3) { // Fill if (a2 != 0.0) { @@ -155,8 +190,16 @@ void OpenGLWrapper::DrawTriangle(float x1,float y1,float x2,float y2,float x3,fl } -/////////////////////// -// Draw ring (annulus) + +/// @brief Draw ring (annulus) +/// @param x +/// @param y +/// @param r1 +/// @param r2 +/// @param ar +/// @param arcStart +/// @param arcEnd +/// void OpenGLWrapper::DrawRing(float x,float y,float r1,float r2,float ar,float arcStart,float arcEnd) { // Make r1 bigger if (r2 > r1) { @@ -247,8 +290,12 @@ void OpenGLWrapper::DrawRing(float x,float y,float r1,float r2,float ar,float ar } -/////////////////// -// Set line colour + +/// @brief Set line colour +/// @param col +/// @param alpha +/// @param width +/// void OpenGLWrapper::SetLineColour(wxColour col,float alpha,int width) { r1 = col.Red()/255.0f; g1 = col.Green()/255.0f; @@ -258,8 +305,11 @@ void OpenGLWrapper::SetLineColour(wxColour col,float alpha,int width) { } -/////////////////// -// Set fill colour + +/// @brief Set fill colour +/// @param col +/// @param alpha +/// void OpenGLWrapper::SetFillColour(wxColour col,float alpha) { r2 = col.Red()/255.0f; g2 = col.Green()/255.0f; @@ -268,8 +318,9 @@ void OpenGLWrapper::SetFillColour(wxColour col,float alpha) { } -//////// -// Line + +/// @brief Line +/// void OpenGLWrapper::SetModeLine() { glColor4f(r1,g1,b1,a1); glEnable(GL_BLEND); @@ -279,8 +330,9 @@ void OpenGLWrapper::SetModeLine() { } -//////// -// Fill + +/// @brief Fill +/// void OpenGLWrapper::SetModeFill() { glColor4f(r2,g2,b2,a2); if (a2 == 1.0f) glDisable(GL_BLEND); @@ -291,8 +343,11 @@ void OpenGLWrapper::SetModeFill() { } -/////////////////////////// -// Is extension supported? + +/// @brief Is extension supported? +/// @param ext +/// @return +/// bool OpenGLWrapper::IsExtensionSupported(const char *ext) { char *extList = (char*) glGetString(GL_EXTENSIONS); if (!extList) return false; @@ -301,7 +356,8 @@ bool OpenGLWrapper::IsExtensionSupported(const char *ext) { -///////// -// Mutex + +/// DOCME wxMutex OpenGLWrapper::glMutex; + diff --git a/aegisub/src/gl_wrap.h b/aegisub/src/gl_wrap.h index 26d05e99e..153abcd72 100644 --- a/aegisub/src/gl_wrap.h +++ b/aegisub/src/gl_wrap.h @@ -42,23 +42,49 @@ #else #include #include + +/// DOCME typedef GLuint GLhandleARB; #endif #include #include -////////////////// -// OpenGL Wrapper + +/// DOCME +/// @class OpenGLWrapper +/// @brief DOCME +/// +/// DOCME class OpenGLWrapper { private: + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME float r1,g1,b1,a1; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME float r2,g2,b2,a2; + + /// DOCME int lw; public: OpenGLWrapper(); + + /// DOCME static wxMutex glMutex; void SetLineColour(wxColour col,float alpha=1.0f,int width=1); @@ -68,6 +94,12 @@ public: void DrawLine(float x1,float y1,float x2,float y2); void DrawDashedLine(float x1,float y1,float x2,float y2,float dashLen); void DrawEllipse(float x,float y,float radiusX,float radiusY); + + /// @brief DOCME + /// @param x + /// @param y + /// @param radius + /// void DrawCircle(float x,float y,float radius) { DrawEllipse(x,y,radius,radius); } void DrawRectangle(float x1,float y1,float x2,float y2); void DrawRing(float x,float y,float r1,float r2,float ar=1.0f,float arcStart=0.0f,float arcEnd=0.0f); @@ -76,3 +108,4 @@ public: static bool IsExtensionSupported(const char *ext); }; + diff --git a/aegisub/src/help_button.cpp b/aegisub/src/help_button.cpp index 4f8cccec1..50da6899f 100644 --- a/aegisub/src/help_button.cpp +++ b/aegisub/src/help_button.cpp @@ -49,8 +49,13 @@ #include "standard_paths.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _page +/// @param position +/// @param size +/// HelpButton::HelpButton(wxWindow *parent,wxString _page,wxPoint position,wxSize size) : wxButton (parent,wxID_HELP,_T(""),position,size) { @@ -59,8 +64,11 @@ HelpButton::HelpButton(wxWindow *parent,wxString _page,wxPoint position,wxSize s } -/////////// -// Pressed + +/// @brief Pressed +/// @param event +/// @return +/// void HelpButton::OnPressed(wxCommandEvent &event) { // Verify if the page is valid if (id.IsEmpty()) { @@ -73,8 +81,10 @@ void HelpButton::OnPressed(wxCommandEvent &event) { } -/////////////// -// Open a page + +/// @brief Open a page +/// @param pageID +/// void HelpButton::OpenPage(const wxString pageID) { // Transcode InitStatic(); @@ -95,10 +105,13 @@ void HelpButton::OpenPage(const wxString pageID) { } -////////////// -// Static map + +/// DOCME std::map *HelpButton::pages = NULL; + +/// @brief DOCME +/// void HelpButton::InitStatic() { if (!pages) { pages = new std::map; @@ -127,7 +140,11 @@ void HelpButton::InitStatic() { } } + +/// @brief DOCME +/// void HelpButton::ClearPages() { if (pages) delete pages; } + diff --git a/aegisub/src/help_button.h b/aegisub/src/help_button.h index 637538a60..c58c16c30 100644 --- a/aegisub/src/help_button.h +++ b/aegisub/src/help_button.h @@ -44,13 +44,21 @@ #include -/////////////////////// -// Browse button class + +/// DOCME +/// @class HelpButton +/// @brief DOCME +/// +/// DOCME class HelpButton : public wxButton { private: + + /// DOCME wxString id; void OnPressed(wxCommandEvent &event); + + /// DOCME static std::map *pages; static void InitStatic(); @@ -61,3 +69,4 @@ public: static void ClearPages(); }; + diff --git a/aegisub/src/hilimod_textctrl.cpp b/aegisub/src/hilimod_textctrl.cpp index e414558bd..a6cf75792 100644 --- a/aegisub/src/hilimod_textctrl.cpp +++ b/aegisub/src/hilimod_textctrl.cpp @@ -43,8 +43,17 @@ #include "options.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param value +/// @param pos +/// @param size +/// @param style +/// @param validator +/// @param name +/// HiliModTextCtrl::HiliModTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) : wxTextCtrl(parent,id,value,pos,size,style,validator,name) { @@ -56,8 +65,11 @@ wxTextCtrl(parent,id,value,pos,size,style,validator,name) } -////////////////// -// Modified event + +/// @brief Modified event +/// @param event +/// @return +/// void HiliModTextCtrl::OnModified(wxCommandEvent &event) { if (UpdateLocked) return; Modified(); @@ -65,8 +77,9 @@ void HiliModTextCtrl::OnModified(wxCommandEvent &event) { } -////////////////// -// Commited event + +/// @brief Commited event +/// void HiliModTextCtrl::Commited() { if (isModified) { orig = GetValue(); @@ -77,8 +90,10 @@ void HiliModTextCtrl::Commited() { } -///////////// -// Set value + +/// @brief Set value +/// @param value +/// void HiliModTextCtrl::SetValue(const wxString& value) { UpdateLocked = true; orig = value; @@ -88,8 +103,9 @@ void HiliModTextCtrl::SetValue(const wxString& value) { } -//////////////// -// Was modified + +/// @brief Was modified +/// void HiliModTextCtrl::Modified() { bool match = GetValue() == orig; @@ -108,3 +124,4 @@ void HiliModTextCtrl::Modified() { } } + diff --git a/aegisub/src/hilimod_textctrl.h b/aegisub/src/hilimod_textctrl.h index 06ac94aaf..a67cd15a3 100644 --- a/aegisub/src/hilimod_textctrl.h +++ b/aegisub/src/hilimod_textctrl.h @@ -36,6 +36,8 @@ #ifndef HILIMOD_TEXTCTRL + +/// DOCME #define HILIMOD_TEXTCTRL @@ -45,13 +47,23 @@ #include -////////////// -// Main class + +/// DOCME +/// @class HiliModTextCtrl +/// @brief DOCME +/// +/// DOCME class HiliModTextCtrl : public wxTextCtrl { private: + + /// DOCME bool UpdateLocked; + + /// DOCME bool isModified; + + /// DOCME wxString orig; void OnModified(wxCommandEvent &event); @@ -63,9 +75,13 @@ public: void Modified(); void Commited(); void SetValue(const wxString& value); + + /// @brief DOCME + /// bool HasBeenModified() { return isModified; } }; #endif + diff --git a/aegisub/src/hotkeys.cpp b/aegisub/src/hotkeys.cpp index 5a162158c..8a12444ee 100644 --- a/aegisub/src/hotkeys.cpp +++ b/aegisub/src/hotkeys.cpp @@ -48,22 +48,29 @@ -/////////////////////////////// HotkeyType ////////////////////////////////// -//////////////// -// Constructors + +/// @brief Constructors HotkeyType ////////////////////////////////// +/// HotkeyType::HotkeyType() { flags = 0; keycode = 0; } + +/// @brief DOCME +/// @param text +/// @param name +/// HotkeyType::HotkeyType(wxString text,wxString name) { Parse(text); origName = name; } -//////////////////////// -// Get string of hotkey + +/// @brief Get string of hotkey +/// @return +/// wxString HotkeyType::GetText() { wxString text; @@ -79,8 +86,10 @@ wxString HotkeyType::GetText() { } -////////////////////////// -// Parse text into hotkey + +/// @brief Parse text into hotkey +/// @param text +/// void HotkeyType::Parse(wxString text) { // Reset flags = 0; @@ -139,9 +148,14 @@ void HotkeyType::Parse(wxString text) { } -////////////////////////// -// Get name from Key code + +/// DOCME std::map HotkeyType::keyName; + +/// @brief DOCME +/// @param keycode +/// @return +/// wxString HotkeyType::GetKeyName(int keycode) { // Fill map FillMap(); @@ -156,8 +170,10 @@ wxString HotkeyType::GetKeyName(int keycode) { } -//////////// -// Fill map + +/// @brief Fill map +/// @return +/// void HotkeyType::FillMap() { if (keyName.empty()) { keyName[WXK_BACK] = _T("Backspace"); @@ -216,28 +232,31 @@ void HotkeyType::FillMap() { } -////////////////////////////// HotkeyManager //////////////////////////////// -////////////// -// Definition + +/// DOCME HotkeyManager Hotkeys; -/////////////// -// Constructor + +/// @brief Constructor +/// HotkeyManager::HotkeyManager() { modified = false; } -////////////// -// Destructor + +/// @brief Destructor +/// HotkeyManager::~HotkeyManager() { key.clear(); } -//////// -// Save + +/// @brief Save +/// @return +/// void HotkeyManager::Save() { // Check if it's actually modified if (!modified) return; @@ -257,8 +276,10 @@ void HotkeyManager::Save() { } -//////// -// Load + +/// @brief Load +/// @return +/// void HotkeyManager::Load() { // Load defaults LoadDefaults(); @@ -330,17 +351,20 @@ void HotkeyManager::Load() { } -///////////////// -// Load defaults + +/// @brief Load defaults +/// void HotkeyManager::LoadDefaults() { modified = true; - // NOTE!! - // _() is used here instead of _T(). This is done so the strings can be extracted. - // However, since this function is called before locale is set, it won't ever be translated. - // Keep this in mind: THESE CANNOT BE TRANSLATED HERE! - // As a safeguard, _() is undefined here + + /// @note () is used here instead of _T(). This is done so the strings can be extracted. + /// However, since this function is called before locale is set, it won't ever be translated. + /// Keep this in mind: THESE CANNOT BE TRANSLATED HERE! + /// As a safeguard, _() is undefined here #undef _ + + /// DOCME #define _(a) _T(a) SetHotkey(_("New subtitles"),_T("Ctrl-N")); @@ -469,28 +493,41 @@ void HotkeyManager::LoadDefaults() { } -////////////// -// Set hotkey + +/// @brief Set hotkey +/// @param function +/// @param hotkey +/// void HotkeyManager::SetHotkey(wxString function,HotkeyType hotkey) { key[function.Lower()] = hotkey; modified = true; } + +/// @brief DOCME +/// @param function +/// @param hotkey +/// void HotkeyManager::SetHotkey(wxString function,wxString hotkey) { key[function.Lower()] = HotkeyType(hotkey,function); modified = true; } -//////////// -// Set file + +/// @brief Set file +/// @param file +/// void HotkeyManager::SetFile(wxString file) { filename = file; } -////////////////////// -// Get hotkey as text + +/// @brief Get hotkey as text +/// @param function +/// @return +/// wxString HotkeyManager::GetText(wxString function) { std::map::iterator cur = key.find(function.Lower()); if (cur != key.end()) { @@ -500,8 +537,12 @@ wxString HotkeyManager::GetText(wxString function) { } -/////////////////////////////////// -// Get hotkey as accelerator entry + +/// @brief Get hotkey as accelerator entry +/// @param function +/// @param id +/// @return +/// wxAcceleratorEntry HotkeyManager::GetAccelerator(wxString function,int id) { std::map::iterator cur = key.find(function.Lower()); if (cur != key.end()) { @@ -514,8 +555,13 @@ wxAcceleratorEntry HotkeyManager::GetAccelerator(wxString function,int id) { } -//////////////////////// -// Set last key pressed + +/// @brief Set last key pressed +/// @param keypress +/// @param ctrl +/// @param alt +/// @param shift +/// void HotkeyManager::SetPressed(int keypress,bool ctrl,bool alt,bool shift) { lastKey = keypress; lastMod = 0; @@ -525,8 +571,11 @@ void HotkeyManager::SetPressed(int keypress,bool ctrl,bool alt,bool shift) { } -/////////////// -// Is pressed? + +/// @brief Is pressed? +/// @param function +/// @return +/// bool HotkeyManager::IsPressed(wxString function) { std::map::iterator cur = key.find(function.Lower()); if (cur != key.end()) { @@ -537,8 +586,11 @@ bool HotkeyManager::IsPressed(wxString function) { } -/////////////////////// -// Search for a hotkey + +/// @brief Search for a hotkey +/// @param keycode +/// @param mod +/// HotkeyType *HotkeyManager::Find(int keycode,int mod) { for (std::map::iterator cur = key.begin();cur != key.end();cur++) { if (cur->second.keycode == keycode && cur->second.flags == mod) { @@ -549,3 +601,4 @@ HotkeyType *HotkeyManager::Find(int keycode,int mod) { return NULL; } + diff --git a/aegisub/src/hotkeys.h b/aegisub/src/hotkeys.h index 4823f68cd..86d0244a2 100644 --- a/aegisub/src/hotkeys.h +++ b/aegisub/src/hotkeys.h @@ -36,6 +36,8 @@ #ifndef HOTKEY_H + +/// DOCME #define HOTKEY_H @@ -52,12 +54,22 @@ class DialogOptions; -//////////////// -// Hotkey class + +/// DOCME +/// @class HotkeyType +/// @brief DOCME +/// +/// DOCME class HotkeyType { public: + + /// DOCME int flags; + + /// DOCME int keycode; + + /// DOCME wxString origName; HotkeyType(); @@ -66,24 +78,40 @@ public: void Parse(wxString text); wxString GetText(); + + /// DOCME static std::map keyName; static wxString GetKeyName(int keycode); static void FillMap(); }; -///////////////////////////// -// Class that stores hotkeys + +/// DOCME +/// @class HotkeyManager +/// @brief DOCME +/// +/// DOCME class HotkeyManager { friend class DialogOptions; private: + + /// DOCME bool modified; + + /// DOCME wxString filename; + + /// DOCME int lastKey; + + /// DOCME int lastMod; public: + + /// DOCME std::map key; HotkeyManager(); @@ -111,3 +139,4 @@ extern HotkeyManager Hotkeys; #endif + diff --git a/aegisub/src/idle_field_event.cpp b/aegisub/src/idle_field_event.cpp index 617d80fd7..b0ed2c17b 100644 --- a/aegisub/src/idle_field_event.cpp +++ b/aegisub/src/idle_field_event.cpp @@ -44,8 +44,11 @@ #include -/////////////// -// Constructor + +/// @brief Constructor +/// @param _control +/// @param _name +/// IdleFieldHandler::IdleFieldHandler(wxWindow *_control,wxString _name) { control = _control; name = _name; @@ -85,24 +88,29 @@ BEGIN_EVENT_TABLE(IdleFieldHandler,wxEvtHandler) END_EVENT_TABLE() -/////////////////// -// Get Focus event + +/// @brief Get Focus event +/// @param event +/// void IdleFieldHandler::OnSetFocus(wxFocusEvent &event) { SetFocus(); event.Skip(); } -/////////////////// -// Lose Focus event + +/// @brief Lose Focus event +/// @param event +/// void IdleFieldHandler::OnKillFocus(wxFocusEvent &event) { KillFocus(); event.Skip(); } -///////////// -// Get focus + +/// @brief Get focus +/// void IdleFieldHandler::SetFocus() { if (overriden) { // Prepare @@ -124,8 +132,9 @@ void IdleFieldHandler::SetFocus() { } -////////////// -// Lose Focus + +/// @brief Lose Focus +/// void IdleFieldHandler::KillFocus() { bool modify = false; if (text && text->GetValue().IsEmpty() || box && box->GetValue().IsEmpty()) modify = true; @@ -150,8 +159,10 @@ void IdleFieldHandler::KillFocus() { } -////////////////////////// -// Parent control changed + +/// @brief Parent control changed +/// @param event +/// void IdleFieldHandler::OnChange(wxCommandEvent &event) { if (locked) return; @@ -165,3 +176,4 @@ void IdleFieldHandler::OnChange(wxCommandEvent &event) { event.Skip(); } + diff --git a/aegisub/src/idle_field_event.h b/aegisub/src/idle_field_event.h index 2c1af8a1d..83481e77f 100644 --- a/aegisub/src/idle_field_event.h +++ b/aegisub/src/idle_field_event.h @@ -45,18 +45,38 @@ #include -///////// -// Class + +/// DOCME +/// @class IdleFieldHandler +/// @brief DOCME +/// +/// DOCME class IdleFieldHandler : public wxEvtHandler { private: + + /// DOCME wxComboBox *box; + + /// DOCME wxTextCtrl *text; + + /// DOCME bool overriden; + + /// DOCME bool locked; + + /// DOCME wxColour grey; + + /// DOCME wxColour original; + + /// DOCME wxWindow *control; + + /// DOCME wxString name; void SetFocus(); @@ -72,3 +92,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/kana_table.cpp b/aegisub/src/kana_table.cpp index ef502e3a2..eff9b0ae0 100644 --- a/aegisub/src/kana_table.cpp +++ b/aegisub/src/kana_table.cpp @@ -40,6 +40,9 @@ #include "kana_table.h" + +/// @brief DOCME +/// KanaTable::KanaTable() { @@ -265,14 +268,24 @@ KanaTable::KanaTable() Insert(L"",L"\u30fc",L"o"); } + +/// @brief DOCME +/// KanaTable::~KanaTable() { // Do nothing } + +/// @brief DOCME +/// @param hira +/// @param kata +/// @param hep +/// void KanaTable::Insert(const wchar_t *hira, const wchar_t *kata, const wchar_t *hep) { entries.push_back(KanaEntry(hira,kata,hep)); } + diff --git a/aegisub/src/kana_table.h b/aegisub/src/kana_table.h index d5ad7ac76..93e954789 100644 --- a/aegisub/src/kana_table.h +++ b/aegisub/src/kana_table.h @@ -42,15 +42,34 @@ #include -/////////////////////////// -// Hiragana/katakana entry + +/// DOCME +/// @class KanaEntry +/// @brief DOCME +/// +/// DOCME class KanaEntry { public: + + /// DOCME wxString hiragana; + + /// DOCME wxString katakana; + + /// DOCME wxString hepburn; + + /// @brief DOCME + /// KanaEntry() {} + + /// @brief DOCME + /// @param hira + /// @param kata + /// @param hep + /// KanaEntry(const wxString &hira, const wxString &kata, const wxString &hep) { hiragana = hira; katakana = kata; @@ -59,15 +78,22 @@ public: }; -/////////////////////////// -// Hiragana/Katakana table + +/// DOCME +/// @class KanaTable +/// @brief DOCME +/// +/// DOCME class KanaTable { private: void Insert(const wchar_t *hira, const wchar_t *kata, const wchar_t *hep); public: + + /// DOCME std::list entries; KanaTable(); ~KanaTable(); }; + diff --git a/aegisub/src/keyframe.cpp b/aegisub/src/keyframe.cpp index 7510e1300..7bb80244e 100644 --- a/aegisub/src/keyframe.cpp +++ b/aegisub/src/keyframe.cpp @@ -47,8 +47,10 @@ #include "vfr.h" -////////////////// -// Load Keyframes + +/// @brief Load Keyframes +/// @param filename +/// void KeyFrameFile::Load(wxString filename) { // Load try { @@ -83,8 +85,10 @@ void KeyFrameFile::Load(wxString filename) { } -////////////////// -// Save Keyframes + +/// @brief Save Keyframes +/// @param filename +/// void KeyFrameFile::Save(wxString filename) { // Get keyframes wxArrayInt keyFrames = VideoContext::Get()->GetKeyFrames(); @@ -104,8 +108,11 @@ void KeyFrameFile::Save(wxString filename) { } -////////////////////////// -// Aegisub keyframes file + +/// @brief Aegisub keyframes file +/// @param file +/// @param keyFrames +/// void KeyFrameFile::OpenAegiKeyFrames(TextFileReader& file, wxArrayInt& keyFrames) { double fps; @@ -136,8 +143,11 @@ void KeyFrameFile::OpenAegiKeyFrames(TextFileReader& file, wxArrayInt& keyFrames } -/////////////////// -// XviD stats file + +/// @brief XviD stats file +/// @param file +/// @param keyFrames +/// void KeyFrameFile::OpenXviDKeyFrames(TextFileReader& file, wxArrayInt& keyFrames) { wxString cur = file.ReadLineFromFile(); @@ -156,8 +166,11 @@ void KeyFrameFile::OpenXviDKeyFrames(TextFileReader& file, wxArrayInt& keyFrames } } -/////////////////// -// DivX stats file + +/// @brief DivX stats file +/// @param file +/// @param keyFrames +/// void KeyFrameFile::OpenDivXKeyFrames(TextFileReader& file, wxArrayInt& keyFrames) { wxString cur = file.ReadLineFromFile(); @@ -177,8 +190,11 @@ void KeyFrameFile::OpenDivXKeyFrames(TextFileReader& file, wxArrayInt& keyFrames } } -/////////////////// -// x264 stats file + +/// @brief x264 stats file +/// @param file +/// @param keyFrames +/// void KeyFrameFile::Openx264KeyFrames(TextFileReader& file, wxArrayInt& keyFrames) { wxString cur = file.ReadLineFromFile(); @@ -200,3 +216,4 @@ void KeyFrameFile::Openx264KeyFrames(TextFileReader& file, wxArrayInt& keyFrames } } + diff --git a/aegisub/src/keyframe.h b/aegisub/src/keyframe.h index 5ad5584b6..4e4ef6c15 100644 --- a/aegisub/src/keyframe.h +++ b/aegisub/src/keyframe.h @@ -40,8 +40,12 @@ #include "text_file_reader.h" -///////// -// Class + +/// DOCME +/// @class KeyFrameFile +/// @brief DOCME +/// +/// DOCME class KeyFrameFile { public: @@ -54,3 +58,4 @@ private: static void Openx264KeyFrames(TextFileReader& file, wxArrayInt& keyFrames); }; + diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 2db567993..3bd0c158a 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -79,21 +79,42 @@ IMPLEMENT_APP(AegisubApp) #ifdef WITH_STARTUPLOG + +/// DOCME #define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0) #else #define StartupLog(a) #endif #ifdef __VISUALC__ + +/// DOCME #define MS_VC_EXCEPTION 0x406d1388 + +/// DOCME typedef struct tagTHREADNAME_INFO { + + /// DOCME DWORD dwType; // must be 0x1000 + + /// DOCME LPCSTR szName; // pointer to name (in same addr space) + + /// DOCME DWORD dwThreadID; // thread ID (-1 caller thread) + + /// DOCME DWORD dwFlags; // reserved for future use, most be zero + +/// DOCME } THREADNAME_INFO; + +/// @brief DOCME +/// @param dwThreadID +/// @param szThreadName +/// void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { THREADNAME_INFO info; info.dwType = 0x1000; @@ -107,10 +128,10 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { } #endif -/////////////////////////// -// Initialization function -// ----------------------- -// Gets called when application starts, creates MainFrame + +/// @brief Gets called when application starts, creates MainFrame ----------------------- Initialization function +/// @return +/// bool AegisubApp::OnInit() { #ifdef __VISUALC__ SetThreadName((DWORD) -1,"AegiMain"); @@ -241,8 +262,10 @@ bool AegisubApp::OnInit() { } -//////// -// Exit + +/// @brief Exit +/// @return +/// int AegisubApp::OnExit() { SubtitleFormat::DestroyFormats(); VideoContext::Clear(); @@ -256,13 +279,16 @@ int AegisubApp::OnExit() { #ifndef _DEBUG -///////////////////////////////////////////// -// Message displayed on unhandled exceptions + +/// DOCME const static wxChar unhandled_exception_message[] = _T("Oops, Aegisub has crashed!\n\nI have tried to emergency-save a copy of your file, and a crash log file has been generated.\n\nYou can find the emergency-saved file in:\n%s\n\nIf you submit the crash log to the Aegisub team, we will investigate the problem and attempt to fix it. You can find the crashlog in:\n%s\n\nAegisub will now close."); + +/// DOCME const static wxChar unhandled_exception_message_nocrashlog[] = _T("Oops, Aegisub has crashed!\n\nI have tried to emergency-save a copy of your file.\n\nYou can find the emergency-saved file in:\n%s\n\nAegisub will now close."); -/////////////////////// -// Unhandled exception + +/// @brief Unhandled exception +/// void AegisubApp::OnUnhandledException() { // Attempt to recover file wxFileName origfile(AssFile::top->filename); @@ -281,8 +307,9 @@ void AegisubApp::OnUnhandledException() { } -/////////////////// -// Fatal exception + +/// @brief Fatal exception +/// void AegisubApp::OnFatalException() { // Attempt to recover file wxFileName origfile(AssFile::top->filename); @@ -314,6 +341,10 @@ void AegisubApp::OnFatalException() { //////////////// // Stack walker #if wxUSE_STACKWALKER == 1 + +/// @brief DOCME +/// @param frame +/// void StackWalker::OnStackFrame(const wxStackFrame &frame) { wxString dst = wxString::Format(_T("%03i - 0x%08X: "),frame.GetLevel(),frame.GetAddress()) + frame.GetName(); if (frame.HasSourceLocation()) dst += _T(" on ") + frame.GetFileName() + wxString::Format(_T(":%i"),frame.GetLine()); @@ -323,6 +354,10 @@ void StackWalker::OnStackFrame(const wxStackFrame &frame) { else wxLogMessage(dst); } + +/// @brief DOCME +/// @param cause +/// StackWalker::StackWalker(wxString cause) { file.open(wxString(StandardPaths::DecodePath(_T("?user/crashlog.txt"))).mb_str(),std::ios::out | std::ios::app); if (file.is_open()) { @@ -335,6 +370,9 @@ StackWalker::StackWalker(wxString cause) { } } + +/// @brief DOCME +/// StackWalker::~StackWalker() { if (file.is_open()) { char dashes[1024]; @@ -351,8 +389,10 @@ StackWalker::~StackWalker() { -////////////////// -// Call main loop + +/// @brief Call main loop +/// @return +/// int AegisubApp::OnRun() { wxString error; @@ -396,8 +436,9 @@ int AegisubApp::OnRun() { } -///////////////////////////////// -// Registry program to filetypes + +/// @brief Registry program to filetypes +/// void AegisubApp::RegistryAssociate () { #if defined(__WINDOWS__) // Command to open with this @@ -453,8 +494,10 @@ void AegisubApp::RegistryAssociate () { } -//////////// -// Open URL + +/// @brief Open URL +/// @param url +/// void AegisubApp::OpenURL(wxString url) { wxLaunchDefaultBrowser(url, wxBROWSER_NEW_WINDOW); } @@ -463,6 +506,10 @@ void AegisubApp::OpenURL(wxString url) { //////////////// // Apple events #ifdef __WXMAC__ + +/// @brief DOCME +/// @param filename +/// void AegisubApp::MacOpenFile(const wxString &filename) { if (frame != NULL && !filename.empty()) { frame->LoadSubtitles(filename); @@ -481,8 +528,10 @@ BEGIN_EVENT_TABLE(AegisubApp,wxApp) END_EVENT_TABLE() -///////////////////// -// Mouse wheel moved + +/// @brief Mouse wheel moved +/// @param event +/// void AegisubApp::OnMouseWheel(wxMouseEvent &event) { wxPoint pt; wxWindow *target = wxFindWindowAtPointer(pt); @@ -494,8 +543,10 @@ void AegisubApp::OnMouseWheel(wxMouseEvent &event) { } -/////////////// -// Key pressed + +/// @brief Key pressed +/// @param event +/// void AegisubApp::OnKey(wxKeyEvent &event) { //frame->audioBox->audioDisplay->AddPendingEvent(event); if (!event.GetSkipped()) { @@ -503,3 +554,4 @@ void AegisubApp::OnKey(wxKeyEvent &event) { } } + diff --git a/aegisub/src/main.h b/aegisub/src/main.h index c0b6d82d1..d345a2abc 100644 --- a/aegisub/src/main.h +++ b/aegisub/src/main.h @@ -36,6 +36,8 @@ #ifndef MAIN_H + +/// DOCME #define MAIN_H @@ -53,25 +55,43 @@ // Prototypes class FrameMain; class PluginManager; + +/// DOCME namespace Automation4 { class AutoloadScriptManager; } -//////////////////////////////// -// Application class definition + +/// DOCME +/// @class AegisubApp +/// @brief DOCME +/// +/// DOCME class AegisubApp: public wxApp { private: + + /// DOCME PluginManager *plugins; void OnMouseWheel(wxMouseEvent &event); void OnKey(wxKeyEvent &key); public: + + /// DOCME AegisubLocale locale; + + /// DOCME FrameMain *frame; #ifdef WITH_AUTOMATION + + /// DOCME Automation4::AutoloadScriptManager *global_scripts; #endif + + /// @brief DOCME + /// @return + /// static AegisubApp* Get() { return (AegisubApp*) wxTheApp; } static void OpenURL(wxString url); @@ -102,9 +122,19 @@ DECLARE_APP(AegisubApp) //////////////// // Stack walker #if wxUSE_STACKWALKER == 1 + +/// DOCME +/// @class StackWalker +/// @brief DOCME +/// +/// DOCME class StackWalker: public wxStackWalker { private: + + /// DOCME std::ofstream file; + + /// DOCME int formatLen; public: @@ -117,3 +147,4 @@ public: #endif + diff --git a/aegisub/src/mkv_wrap.cpp b/aegisub/src/mkv_wrap.cpp index 1231c589c..a4275baee 100644 --- a/aegisub/src/mkv_wrap.cpp +++ b/aegisub/src/mkv_wrap.cpp @@ -51,32 +51,37 @@ #include "ass_time.h" -//////////// -// Instance + +/// DOCME MatroskaWrapper MatroskaWrapper::wrapper; -/////////// -// Defines + +/// DOCME #define CACHESIZE 65536 -/////////////// -// Constructor + +/// @brief Constructor +/// MatroskaWrapper::MatroskaWrapper() { file = NULL; } -////////////// -// Destructor + +/// @brief Destructor +/// MatroskaWrapper::~MatroskaWrapper() { Close(); } -///////////// -// Open file + +/// @brief Open file +/// @param filename +/// @param parse +/// void MatroskaWrapper::Open(wxString filename,bool parse) { // Make sure it's closed first Close(); @@ -105,8 +110,10 @@ void MatroskaWrapper::Open(wxString filename,bool parse) { } -////////////// -// Close file + +/// @brief Close file +/// @return +/// void MatroskaWrapper::Close() { if (file) { mkv_Close(file); @@ -119,22 +126,29 @@ void MatroskaWrapper::Close() { } -//////////////////// -// Return keyframes + +/// @brief Return keyframes +/// @return +/// wxArrayInt MatroskaWrapper::GetKeyFrames() { return keyFrames; } -/////////////////////// -// Comparison operator + +/// @brief Comparison operator +/// @param t1 +/// @param t2 +/// @return +/// bool operator < (MkvFrame &t1, MkvFrame &t2) { return t1.time < t2.time; } -////////////////// -// Actually parse + +/// @brief Actually parse +/// void MatroskaWrapper::Parse() { // Clear keyframes and timecodes keyFrames.Clear(); @@ -242,8 +256,11 @@ void MatroskaWrapper::Parse() { } -/////////////////////////// -// Set target to timecodes + +/// @brief Set target to timecodes +/// @param target +/// @return +/// void MatroskaWrapper::SetToTimecodes(FrameRate &target) { // Enough frames? int frames = timecodes.size(); @@ -287,8 +304,10 @@ void MatroskaWrapper::SetToTimecodes(FrameRate &target) { } -///////////////// -// Get subtitles + +/// @brief Get subtitles +/// @param target +/// void MatroskaWrapper::GetSubtitles(AssFile *target) { // Get info int tracks = mkv_GetNumTracks(file); @@ -493,17 +512,35 @@ void MatroskaWrapper::GetSubtitles(AssFile *target) { ////////////////////////////// LOTS OF HAALI C CODE DOWN HERE /////////////////////////////////////// #ifdef __VISUALC__ + +/// DOCME #define std_fread fread + +/// DOCME #define std_fseek _fseeki64 + +/// DOCME #define std_ftell _ftelli64 #else + +/// DOCME #define std_fread fread + +/// DOCME #define std_fseek fseeko + +/// DOCME #define std_ftell ftello #endif -/////////////// -// STDIO class + +/// @brief STDIO class +/// @param _st +/// @param pos +/// @param buffer +/// @param count +/// @return +/// int StdIoRead(InputStream *_st, ulonglong pos, void *buffer, int count) { MkvStdIO *st = (MkvStdIO *) _st; size_t rd; @@ -523,7 +560,13 @@ int StdIoRead(InputStream *_st, ulonglong pos, void *buffer, int count) { /* scan for a signature sig(big-endian) starting at file position pos * return position of the first byte of signature or -1 if error/not found - */ + +/// @brief */ +/// @param _st +/// @param start +/// @param signature +/// @return +/// longlong StdIoScan(InputStream *_st, ulonglong start, unsigned signature) { MkvStdIO *st = (MkvStdIO *) _st; int c; @@ -542,34 +585,71 @@ longlong StdIoScan(InputStream *_st, ulonglong start, unsigned signature) { return -1; } -/* return cache size, this is used to limit readahead */ + +/// @brief This is used to limit readahead. +/// @param _st +/// @return Cache size +/// unsigned StdIoGetCacheSize(InputStream *_st) { return CACHESIZE; } -/* return last error message */ + +/// @brief Get last error message +/// @param _st +/// @return Last error message +/// const char *StdIoGetLastError(InputStream *_st) { MkvStdIO *st = (MkvStdIO *) _st; return strerror(st->error); } -/* memory allocation, this is done via stdlib */ + +/// @brief Memory allocation, this is done via stdlib +/// @param _st +/// @param size +/// @return +/// void *StdIoMalloc(InputStream *_st, size_t size) { return malloc(size); } + +/// @brief DOCME +/// @param _st +/// @param mem +/// @param size +/// @return +/// void *StdIoRealloc(InputStream *_st, void *mem, size_t size) { return realloc(mem,size); } + +/// @brief DOCME +/// @param _st +/// @param mem +/// void StdIoFree(InputStream *_st, void *mem) { free(mem); } + +/// @brief DOCME +/// @param _st +/// @param cur +/// @param max +/// @return +/// int StdIoProgress(InputStream *_st, ulonglong cur, ulonglong max) { return 1; } + +/// @brief DOCME +/// @param _st +/// @return +/// longlong StdIoGetFileSize(InputStream *_st) { MkvStdIO *st = (MkvStdIO *) _st; longlong epos = 0; @@ -580,6 +660,10 @@ longlong StdIoGetFileSize(InputStream *_st) { return epos; } + +/// @brief DOCME +/// @param filename +/// MkvStdIO::MkvStdIO(wxString filename) { read = StdIoRead; scan = StdIoScan; @@ -597,3 +681,4 @@ MkvStdIO::MkvStdIO(wxString filename) { } } + diff --git a/aegisub/src/mkv_wrap.h b/aegisub/src/mkv_wrap.h index 06fee7520..504797246 100644 --- a/aegisub/src/mkv_wrap.h +++ b/aegisub/src/mkv_wrap.h @@ -54,29 +54,56 @@ class AssFile; -///////////////////////////// -// STD IO for MatroskaParser + +/// DOCME +/// @class MkvStdIO +/// @brief DOCME +/// +/// DOCME class MkvStdIO : public InputStream { public: MkvStdIO(wxString filename); + + /// DOCME FILE *fp; + + /// DOCME int error; }; -////////////////// -// MkvFrame class + +/// DOCME +/// @class MkvFrame +/// @brief DOCME +/// +/// DOCME class MkvFrame { public: + + /// DOCME double time; + + /// DOCME bool isKey; + + /// DOCME int64_t filePos; + + /// @brief DOCME + /// MkvFrame() { time = 0; isKey = false; filePos = -1; } + + /// @brief DOCME + /// @param keyframe + /// @param timecode + /// @param _filePos + /// MkvFrame(bool keyframe,double timecode,int64_t _filePos) { isKey = keyframe; time = timecode; @@ -87,34 +114,67 @@ public: bool operator < (MkvFrame &t1, MkvFrame &t2); -////////////////////////// -// Matroska wrapper class + +/// DOCME +/// @class MatroskaWrapper +/// @brief DOCME +/// +/// DOCME class MatroskaWrapper { private: + + /// DOCME wxArrayInt keyFrames; + + /// DOCME std::vector timecodes; + + /// DOCME wxArrayInt bytePos; public: + + /// DOCME MkvStdIO *input; + + /// DOCME MatroskaFile *file; + + /// DOCME std::list frames; + + /// DOCME std::vector rawFrames; MatroskaWrapper(); ~MatroskaWrapper(); + + /// @brief DOCME + /// @return + /// bool IsOpen() { return file != NULL; } void Open(wxString filename,bool parse=true); void Close(); void Parse(); void SetToTimecodes(FrameRate &target); + + /// @brief DOCME + /// @return + /// wxArrayInt GetBytePositions() { return bytePos; } + + /// @brief DOCME + /// @return + /// unsigned int GetFrameCount() { return timecodes.size(); } wxArrayInt GetKeyFrames(); void GetSubtitles(AssFile *target); + + /// DOCME static MatroskaWrapper wrapper; }; + diff --git a/aegisub/src/options.cpp b/aegisub/src/options.cpp index fd815448f..70049a11b 100644 --- a/aegisub/src/options.cpp +++ b/aegisub/src/options.cpp @@ -53,8 +53,9 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// OptionsManager::OptionsManager() { modified = false; overriding = false; @@ -62,23 +63,28 @@ OptionsManager::OptionsManager() { } -////////////// -// Destructor + +/// @brief Destructor +/// OptionsManager::~OptionsManager() { Clear(); } -///////// -// Clear + +/// @brief Clear +/// void OptionsManager::Clear() { opt.clear(); optType.clear(); } -/////////////////////// -// Load default values + +/// @brief Load default values +/// @param onlyDefaults +/// @param doOverride +/// void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) { ///// PUBLIC ////// // Here go the options that can be edited by the options menu @@ -410,23 +416,29 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) { } -//////////////// -// Set filename + +/// @brief Set filename +/// @param file +/// void OptionsManager::SetFile(wxString file) { filename = file; } -//////////////// -// Get filename + +/// @brief Get filename +/// @return +/// wxString OptionsManager::GetFile() const { return filename; } -//////// -// Save + +/// @brief Save +/// @return +/// void OptionsManager::Save() { // Check if it's actually modified if (!modified) return; @@ -445,8 +457,10 @@ void OptionsManager::Save() { } -//////// -// Load + +/// @brief Load +/// @return +/// void OptionsManager::Load() { // Check if file exists wxFileName path(filename); @@ -510,8 +524,13 @@ void OptionsManager::Load() { } -///////////// -// Write int + +/// @brief Write int +/// @param key +/// @param param +/// @param ifLastVersion +/// @return +/// void OptionsManager::SetInt(wxString key,int param,int ifLastVersion) { if (ifLastVersion == -1) { if (overriding) ifLastVersion = 0; @@ -524,8 +543,13 @@ void OptionsManager::SetInt(wxString key,int param,int ifLastVersion) { } -/////////////// -// Write float + +/// @brief Write float +/// @param key +/// @param param +/// @param ifLastVersion +/// @return +/// void OptionsManager::SetFloat(wxString key,double param,int ifLastVersion) { if (ifLastVersion == -1) { if (overriding) ifLastVersion = 0; @@ -538,8 +562,13 @@ void OptionsManager::SetFloat(wxString key,double param,int ifLastVersion) { } -//////////////// -// Write string + +/// @brief Write string +/// @param key +/// @param param +/// @param ifLastVersion +/// @return +/// void OptionsManager::SetText(wxString key,wxString param,int ifLastVersion) { if (ifLastVersion == -1) { if (overriding) ifLastVersion = 0; @@ -552,8 +581,13 @@ void OptionsManager::SetText(wxString key,wxString param,int ifLastVersion) { } -///////////////// -// Write boolean + +/// @brief Write boolean +/// @param key +/// @param param +/// @param ifLastVersion +/// @return +/// void OptionsManager::SetBool(wxString key,bool param,int ifLastVersion) { if (ifLastVersion == -1) { if (overriding) ifLastVersion = 0; @@ -566,8 +600,13 @@ void OptionsManager::SetBool(wxString key,bool param,int ifLastVersion) { } -//////////////// -// Write colour + +/// @brief Write colour +/// @param key +/// @param param +/// @param ifLastVersion +/// @return +/// void OptionsManager::SetColour(wxString key,wxColour param,int ifLastVersion) { if (ifLastVersion == -1) { if (overriding) ifLastVersion = 0; @@ -580,16 +619,22 @@ void OptionsManager::SetColour(wxString key,wxColour param,int ifLastVersion) { } -////////////// -// Reset with + +/// @brief Reset with +/// @param key +/// @param param +/// void OptionsManager::ResetWith(wxString key,wxString param) { opt[key.Lower()].ResetWith(param); modified = true; } -////////// -// As int + +/// @brief As int +/// @param key +/// @return +/// int OptionsManager::AsInt(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -600,8 +645,11 @@ int OptionsManager::AsInt(wxString key) { } -////////////// -// As boolean + +/// @brief As boolean +/// @param key +/// @return +/// bool OptionsManager::AsBool(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -612,8 +660,11 @@ bool OptionsManager::AsBool(wxString key) { } -//////////// -// As float + +/// @brief As float +/// @param key +/// @return +/// double OptionsManager::AsFloat(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -624,8 +675,11 @@ double OptionsManager::AsFloat(wxString key) { } -///////////// -// As string + +/// @brief As string +/// @param key +/// @return +/// wxString OptionsManager::AsText(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -636,8 +690,11 @@ wxString OptionsManager::AsText(wxString key) { } -///////////// -// As colour + +/// @brief As colour +/// @param key +/// @return +/// wxColour OptionsManager::AsColour(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -648,8 +705,11 @@ wxColour OptionsManager::AsColour(wxString key) { } -///////////////////// -// Modification type + +/// @brief Modification type +/// @param key +/// @return +/// ModType OptionsManager::GetModType(wxString key) { std::map::iterator cur; cur = (optType.find(key.Lower())); @@ -660,8 +720,11 @@ ModType OptionsManager::GetModType(wxString key) { } -/////////////// -// Is defined? + +/// @brief Is defined? +/// @param key +/// @return +/// bool OptionsManager::IsDefined(wxString key) { std::map::iterator cur; cur = (opt.find(key.Lower())); @@ -669,8 +732,11 @@ bool OptionsManager::IsDefined(wxString key) { } -///////////////////////////////////// -// Adds an item to a list of recents + +/// @brief Adds an item to a list of recents +/// @param entry +/// @param list +/// void OptionsManager::AddToRecentList (wxString entry,wxString list) { // Find strings already in recent list wxArrayString orig; @@ -702,8 +768,11 @@ void OptionsManager::AddToRecentList (wxString entry,wxString list) { } -/////////////////////////////////////////////////////////////// -// Removes an item from a list of recents, if it's in the list + +/// @brief Removes an item from a list of recents, if it's in the list +/// @param entry +/// @param list +/// void OptionsManager::RemoveFromRecentList (wxString entry,wxString list) { // Find strings already in recent list wxArrayString cleaned; @@ -734,8 +803,11 @@ void OptionsManager::RemoveFromRecentList (wxString entry,wxString list) { } -/////////////////// -// Get recent list + +/// @brief Get recent list +/// @param list +/// @return +/// wxArrayString OptionsManager::GetRecentList (wxString list) { wxArrayString work; int recentMax = AsInt(list + _T(" max")); @@ -750,14 +822,17 @@ wxArrayString OptionsManager::GetRecentList (wxString list) { } -///////////////////////// -// Set modification type + +/// @brief Set modification type +/// @param type +/// void OptionsManager::SetModificationType(ModType type) { curModType = type; } -/////////////////// -// Global instance + +/// DOCME OptionsManager Options; + diff --git a/aegisub/src/options.h b/aegisub/src/options.h index 90f1df567..20202220b 100644 --- a/aegisub/src/options.h +++ b/aegisub/src/options.h @@ -45,31 +45,67 @@ #include "variable_data.h" -////////////////////// -// Modification types + +/// DOCME enum ModType { + + /// DOCME MOD_OFF = -1, + + /// DOCME MOD_AUTOMATIC, + + /// DOCME MOD_RESTART, + + /// DOCME MOD_EDIT_BOX, + + /// DOCME MOD_GRID, + + /// DOCME MOD_VIDEO, + + /// DOCME MOD_VIDEO_RELOAD, + + /// DOCME MOD_AUDIO, + + /// DOCME MOD_AUDIO_RELOAD }; -///////////////////////////// -// Class that stores options + +/// DOCME +/// @class OptionsManager +/// @brief DOCME +/// +/// DOCME class OptionsManager { private: + + /// DOCME ModType curModType; + + /// DOCME bool modified; + + /// DOCME bool overriding; + + /// DOCME wxString filename; + + /// DOCME std::map opt; + + /// DOCME std::map optType; + + /// DOCME int lastVersion; void SetModificationType(ModType type); @@ -110,3 +146,4 @@ public: // Global instance extern OptionsManager Options; + diff --git a/aegisub/src/osx_bevelButton.cpp b/aegisub/src/osx_bevelButton.cpp index 4e6013881..24995079f 100644 --- a/aegisub/src/osx_bevelButton.cpp +++ b/aegisub/src/osx_bevelButton.cpp @@ -28,9 +28,25 @@ IMPLEMENT_DYNAMIC_CLASS(wxBevelButton, wxControl) #include "wx/mac/uma.h" // Button + +/// DOCME static const int kMacOSXHorizontalBorder = 2 ; + +/// DOCME static const int kMacOSXVerticalBorder = 4 ; + +/// @brief DOCME +/// @param parent +/// @param id +/// @param lbl +/// @param pos +/// @param size +/// @param style +/// @param validator +/// @param name +/// @return +/// bool wxBevelButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, const wxPoint& pos, const wxSize& size, long style, @@ -59,6 +75,9 @@ bool wxBevelButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, return TRUE; } + +/// @brief DOCME +/// wxSize wxBevelButton::DoGetBestSize() const { int wBtn = 70 ; @@ -73,3 +92,4 @@ wxSize wxBevelButton::DoGetBestSize() const #endif // __WXMAC__ + diff --git a/aegisub/src/osx_bevelButton.h b/aegisub/src/osx_bevelButton.h index ce007ecd4..f6d3cf127 100644 --- a/aegisub/src/osx_bevelButton.h +++ b/aegisub/src/osx_bevelButton.h @@ -12,6 +12,8 @@ #ifdef __WXMAC__ #ifndef _WX_BEVEL_BUTTON_H_ + +/// DOCME #define _WX_BEVEL_BUTTON_H_ #include "wx/control.h" @@ -19,12 +21,31 @@ //WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; -// Pushbutton + +/// DOCME +/// @class wxBevelButton +/// @brief DOCME +/// +/// DOCME class WXDLLEXPORT wxBevelButton: public wxButton { DECLARE_DYNAMIC_CLASS(wxButton) public: + + /// @brief DOCME + /// inline wxBevelButton() {} + + /// @brief DOCME + /// @param parent + /// @param id + /// @param wxEmptyString + /// @param wxDefaultPosition + /// @param wxDefaultSize + /// @param 0 + /// @param wxDefaultValidator + /// @param wxButtonNameStr + /// inline wxBevelButton(wxWindow *parent, wxWindowID id, const wxString& label = wxEmptyString, const wxPoint& pos = wxDefaultPosition, @@ -51,3 +72,4 @@ virtual wxSize DoGetBestSize() const ; #endif // __WXMAC__ + diff --git a/aegisub/src/plugin_manager.cpp b/aegisub/src/plugin_manager.cpp index be5296e5e..c35539a51 100644 --- a/aegisub/src/plugin_manager.cpp +++ b/aegisub/src/plugin_manager.cpp @@ -47,8 +47,9 @@ #include "spellchecker_manager.h" -/////////////// -// Constructor + +/// @brief Constructor +/// PluginManager::PluginManager() { init = false; @@ -59,8 +60,9 @@ PluginManager::PluginManager() { } -////////////// -// Destructor + +/// @brief Destructor +/// PluginManager::~PluginManager() { VideoProviderFactoryManager::ClearProviders(); AudioProviderFactoryManager::ClearProviders(); @@ -78,8 +80,9 @@ PluginManager::~PluginManager() { } -////////////////////////////////// -// Registers all built-in plugins + +/// @brief Registers all built-in plugins +/// void PluginManager::RegisterBuiltInPlugins() { if (!init) { // Managers @@ -100,3 +103,4 @@ void PluginManager::RegisterBuiltInPlugins() { init = true; } + diff --git a/aegisub/src/plugin_manager.h b/aegisub/src/plugin_manager.h index 1ceab55b0..ff3903298 100644 --- a/aegisub/src/plugin_manager.h +++ b/aegisub/src/plugin_manager.h @@ -42,13 +42,21 @@ #endif -//////////////////////// -// Plugin manager class + +/// DOCME +/// @class PluginManager +/// @brief DOCME +/// +/// DOCME class PluginManager { private: + + /// DOCME bool init; #ifdef WITH_AUTO4_LUA + + /// DOCME Automation4::LuaScriptFactory *lua; #endif @@ -59,3 +67,4 @@ public: void RegisterBuiltInPlugins(); }; + diff --git a/aegisub/src/quicktime_common.cpp b/aegisub/src/quicktime_common.cpp index 8e97b52ed..0d5c684ce 100644 --- a/aegisub/src/quicktime_common.cpp +++ b/aegisub/src/quicktime_common.cpp @@ -41,11 +41,17 @@ #include -// static init fun + +/// DOCME int QuickTimeProvider::qt_initcount = 0; + +/// DOCME GWorldPtr QuickTimeProvider::default_gworld = NULL; + +/// @brief DOCME +/// void QuickTimeProvider::InitQuickTime() { OSErr qt_err; #ifdef WIN32 @@ -75,6 +81,9 @@ void QuickTimeProvider::InitQuickTime() { } + +/// @brief DOCME +/// void QuickTimeProvider::DeInitQuickTime() { #ifdef WIN32 // calls to InitializeQTML() must be balanced with an equal number of calls to TerminateQTML() @@ -89,7 +98,12 @@ void QuickTimeProvider::DeInitQuickTime() { } -// convert a wxstring containing a filename to a QT data reference + +/// @brief convert a wxstring containing a filename to a QT data reference +/// @param string +/// @param dataref +/// @param dataref_type +/// void QuickTimeProvider::wxStringToDataRef(const wxString &string, Handle *dataref, OSType *dataref_type) { // convert filename, first to a CFStringRef... wxString wx_filename = wxFileName(string).GetShortPath(); @@ -102,19 +116,33 @@ void QuickTimeProvider::wxStringToDataRef(const wxString &string, Handle *datare } -// check if this error code signifies an error, and if it does, throw an exception + +/// @brief check if this error code signifies an error, and if it does, throw an exception +/// @param err +/// @param errmsg +/// void QuickTimeProvider::QTCheckError(OSErr err, wxString errmsg) { if (err != noErr) throw errmsg; /* CheckError(err, errmsg.c_str()); // I wonder if this actually works on Mac, and if so, what it does */ } + +/// @brief DOCME +/// @param err +/// @param errmsg +/// @return +/// void QuickTimeProvider::QTCheckError(OSStatus err, wxString errmsg) { if (err != noErr) throw errmsg; } -// return true if QT considers file openable + +/// @brief return true if QT considers file openable +/// @param dataref +/// @param dataref_type +/// bool QuickTimeProvider::CanOpen(const Handle& dataref, const OSType dataref_type) { Boolean can_open; Boolean prefer_img; @@ -131,3 +159,4 @@ bool QuickTimeProvider::CanOpen(const Handle& dataref, const OSType dataref_type #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/quicktime_common.h b/aegisub/src/quicktime_common.h index 1a4ba5628..8d3a7c38e 100644 --- a/aegisub/src/quicktime_common.h +++ b/aegisub/src/quicktime_common.h @@ -46,6 +46,8 @@ // QT stuff #ifdef _MSC_VER + +/// DOCME #define _STDINT_H // avoid conflicts between MSVC's stdint.h and QT's stdint.h #pragma warning(disable: 4004) // get MSVC to shut up about a macro redefinition in QT's ConditionalMacros.h #endif @@ -61,6 +63,12 @@ extern "C" { } + +/// DOCME +/// @class QuickTimeProvider +/// @brief DOCME +/// +/// DOCME class QuickTimeProvider { public: void InitQuickTime(); @@ -72,12 +80,20 @@ public: void QTCheckError(OSErr err, wxString errmsg); void QTCheckError(OSStatus err, wxString errmsg); + + /// DOCME static int qt_initcount; + + /// DOCME static GWorldPtr default_gworld; + + /// @brief DOCME + /// virtual ~QuickTimeProvider() {}; }; #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/scintilla_text_ctrl.cpp b/aegisub/src/scintilla_text_ctrl.cpp index 723a46b1d..85048e115 100644 --- a/aegisub/src/scintilla_text_ctrl.cpp +++ b/aegisub/src/scintilla_text_ctrl.cpp @@ -43,8 +43,17 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param value +/// @param pos +/// @param size +/// @param style +/// @param validator +/// @param name +/// ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) : wxStyledTextCtrl(parent, id, pos, size, 0, value) { @@ -52,14 +61,18 @@ ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxSt } -////////////// -// Destructor + +/// @brief Destructor +/// ScintillaTextCtrl::~ScintillaTextCtrl() { } -/////////////////////////////////// -// Get unicode-compatible position + +/// @brief Get unicode-compatible position +/// @param pos +/// @return +/// int ScintillaTextCtrl::GetUnicodePosition(int pos) { wxString string = GetText().Left(pos); wxCharBuffer buffer = string.mb_str(wxConvUTF8); @@ -67,8 +80,11 @@ int ScintillaTextCtrl::GetUnicodePosition(int pos) { } -/////////////////////////////////////// -// Reverse unicode-compatible position + +/// @brief Reverse unicode-compatible position +/// @param pos +/// @return +/// int ScintillaTextCtrl::GetReverseUnicodePosition(int pos) { // Get UTF8 wxCharBuffer buffer = GetText().mb_str(wxConvUTF8); @@ -88,15 +104,22 @@ int ScintillaTextCtrl::GetReverseUnicodePosition(int pos) { } -////////////////////////////// -// Start unicode-safe styling + +/// @brief Start unicode-safe styling +/// @param start +/// @param mask +/// void ScintillaTextCtrl::StartUnicodeStyling(int start,int mask) { StartStyling(GetUnicodePosition(start),mask); } -//////////////////////// -// Unicode-safe styling + +/// @brief Unicode-safe styling +/// @param start +/// @param length +/// @param style +/// void ScintillaTextCtrl::SetUnicodeStyling(int start,int length,int style) { // Get the real length wxString string = GetText().Mid(start,length); @@ -108,8 +131,13 @@ void ScintillaTextCtrl::SetUnicodeStyling(int start,int length,int style) { } -////////////////////////////////////// -// Get boundaries of word at position + +/// @brief Get boundaries of word at position +/// @param pos +/// @param _start +/// @param _end +/// @return +/// void ScintillaTextCtrl::GetBoundsOfWordAtPosition(int pos,int &_start,int &_end) { // Results IntPairVector results; @@ -127,8 +155,11 @@ void ScintillaTextCtrl::GetBoundsOfWordAtPosition(int pos,int &_start,int &_end) } -////////////////////////////////// -// Get word at specified position + +/// @brief Get word at specified position +/// @param pos +/// @return +/// wxString ScintillaTextCtrl::GetWordAtPosition(int pos) { int start,end; GetBoundsOfWordAtPosition(pos,start,end); @@ -136,9 +167,13 @@ wxString ScintillaTextCtrl::GetWordAtPosition(int pos) { } -//////////////////////////////// -// Set selection, unicode-aware + +/// @brief Set selection, unicode-aware +/// @param start +/// @param end +/// void ScintillaTextCtrl::SetSelectionU(int start, int end) { SetSelection(GetUnicodePosition(start),GetUnicodePosition(end)); } + diff --git a/aegisub/src/scintilla_text_ctrl.h b/aegisub/src/scintilla_text_ctrl.h index 97a7cb578..5cba6ec6e 100644 --- a/aegisub/src/scintilla_text_ctrl.h +++ b/aegisub/src/scintilla_text_ctrl.h @@ -44,14 +44,21 @@ #include -///////// -// Class + +/// DOCME +/// @class ScintillaTextCtrl +/// @brief DOCME +/// +/// DOCME class ScintillaTextCtrl : public wxStyledTextCtrl { public: wxString GetWordAtPosition(int pos); void GetBoundsOfWordAtPosition(int pos,int &start,int &end); int GetUnicodePosition(int pos); int GetReverseUnicodePosition(int pos); + + /// @brief DOCME + /// wxString GetValue() { return GetText(); } void StartUnicodeStyling(int start,int mask=31); @@ -62,3 +69,4 @@ public: virtual ~ScintillaTextCtrl(); }; + diff --git a/aegisub/src/spellchecker.cpp b/aegisub/src/spellchecker.cpp index 3a159cd5d..079759797 100644 --- a/aegisub/src/spellchecker.cpp +++ b/aegisub/src/spellchecker.cpp @@ -46,8 +46,10 @@ #include "options.h" -///////////////////// -// Get spell checker + +/// @brief Get spell checker +/// @return +/// SpellChecker *SpellCheckerFactoryManager::GetSpellChecker() { // List of providers wxArrayString list = GetFactoryList(Options.AsText(_T("Spell Checker"))); @@ -72,8 +74,9 @@ SpellChecker *SpellCheckerFactoryManager::GetSpellChecker() { } -////////////////////////// -// Register all providers + +/// @brief Register all providers +/// void SpellCheckerFactoryManager::RegisterProviders() { #ifdef WITH_HUNSPELL RegisterFactory(new HunspellSpellCheckerFactory(),_T("Hunspell")); @@ -81,14 +84,16 @@ void SpellCheckerFactoryManager::RegisterProviders() { } -/////////////////////// -// Clear all providers + +/// @brief Clear all providers +/// void SpellCheckerFactoryManager::ClearProviders() { ClearFactories(); } -////////// -// Static + +/// DOCME template std::map* FactoryManager::factories=NULL; + diff --git a/aegisub/src/spellchecker_hunspell.cpp b/aegisub/src/spellchecker_hunspell.cpp index c56dbaef6..c22ca46a8 100644 --- a/aegisub/src/spellchecker_hunspell.cpp +++ b/aegisub/src/spellchecker_hunspell.cpp @@ -56,8 +56,9 @@ #include -/////////////// -// Constructor + +/// @brief Constructor +/// HunspellSpellChecker::HunspellSpellChecker() { hunspell = NULL; conv = NULL; @@ -65,15 +66,17 @@ HunspellSpellChecker::HunspellSpellChecker() { } -////////////// -// Destructor + +/// @brief Destructor +/// HunspellSpellChecker::~HunspellSpellChecker() { Reset(); } -///////// -// Reset + +/// @brief Reset +/// void HunspellSpellChecker::Reset() { delete hunspell; hunspell = NULL; @@ -84,8 +87,11 @@ void HunspellSpellChecker::Reset() { } -////////////////////////// -// Can add to dictionary? + +/// @brief Can add to dictionary? +/// @param word +/// @return +/// bool HunspellSpellChecker::CanAddWord(wxString word) { if (!hunspell) return false; wxCharBuffer buffer = word.mb_str(*conv); @@ -93,8 +99,11 @@ bool HunspellSpellChecker::CanAddWord(wxString word) { } -////////////////////////// -// Add word to dictionary + +/// @brief Add word to dictionary +/// @param word +/// @return +/// void HunspellSpellChecker::AddWord(wxString word) { // Dictionary OK? if (!hunspell) return; @@ -158,8 +167,11 @@ void HunspellSpellChecker::AddWord(wxString word) { } -////////////////////////////// -// Check if the word is valid + +/// @brief Check if the word is valid +/// @param word +/// @return +/// bool HunspellSpellChecker::CheckWord(wxString word) { if (!hunspell) return true; wxCharBuffer buf = word.mb_str(*conv); @@ -168,8 +180,11 @@ bool HunspellSpellChecker::CheckWord(wxString word) { } -//////////////////////////// -// Get suggestions for word + +/// @brief Get suggestions for word +/// @param word +/// @return +/// wxArrayString HunspellSpellChecker::GetSuggestions(wxString word) { // Array wxArrayString suggestions; @@ -200,8 +215,10 @@ wxArrayString HunspellSpellChecker::GetSuggestions(wxString word) { } -////////////////////////////////////// -// Get list of available dictionaries + +/// @brief Get list of available dictionaries +/// @return +/// wxArrayString HunspellSpellChecker::GetLanguageList() { // Get dir name wxString path = StandardPaths::DecodePathMaybeRelative(Options.AsText(_T("Dictionaries path")), _T("?data")) + _T("/"); @@ -233,8 +250,10 @@ wxArrayString HunspellSpellChecker::GetLanguageList() { } -//////////////// -// Set language + +/// @brief Set language +/// @param language +/// void HunspellSpellChecker::SetLanguage(wxString language) { // Unload Reset(); @@ -283,3 +302,4 @@ void HunspellSpellChecker::SetLanguage(wxString language) { #endif // WITH_HUNSPELL + diff --git a/aegisub/src/spellchecker_hunspell.h b/aegisub/src/spellchecker_hunspell.h index 2b8e3a1ce..05e3b786e 100644 --- a/aegisub/src/spellchecker_hunspell.h +++ b/aegisub/src/spellchecker_hunspell.h @@ -46,14 +46,28 @@ -////////////////// -// Hunspell class + +/// DOCME +/// @class HunspellSpellChecker +/// @brief DOCME +/// +/// DOCME class HunspellSpellChecker : public SpellChecker { private: + + /// DOCME Hunspell *hunspell; + + /// DOCME wxMBConv *conv; + + /// DOCME wxString affpath; + + /// DOCME wxString dicpath; + + /// DOCME wxString usrdicpath; void Reset(); @@ -73,12 +87,20 @@ public: }; -/////////// -// Factory + +/// DOCME +/// @class HunspellSpellCheckerFactory +/// @brief DOCME +/// +/// DOCME class HunspellSpellCheckerFactory : public SpellCheckerFactory { public: + + /// @brief DOCME + /// SpellChecker *CreateSpellChecker() { return new HunspellSpellChecker(); } }; #endif + diff --git a/aegisub/src/spellchecker_manager.h b/aegisub/src/spellchecker_manager.h index c2e1f0ca1..cddff0a26 100644 --- a/aegisub/src/spellchecker_manager.h +++ b/aegisub/src/spellchecker_manager.h @@ -45,8 +45,12 @@ #include "include/aegisub/spellchecker.h" -/////////////////// -// Factory Manager + +/// DOCME +/// @class SpellCheckerFactoryManager +/// @brief DOCME +/// +/// DOCME class SpellCheckerFactoryManager : public FactoryManager { public: static SpellChecker *GetSpellChecker(); @@ -54,3 +58,4 @@ public: static void ClearProviders(); }; + diff --git a/aegisub/src/spline.cpp b/aegisub/src/spline.cpp index 2f237d5a1..9e5450ad3 100644 --- a/aegisub/src/spline.cpp +++ b/aegisub/src/spline.cpp @@ -44,14 +44,17 @@ #include "utils.h" -////////////////////// -// Spline constructor + +/// @brief Spline constructor +/// Spline::Spline() { } -///////////////// -// Encode to ASS + +/// @brief Encode to ASS +/// @return +/// wxString Spline::EncodeToASS() { wxString result; char lastCommand = 0; @@ -91,8 +94,10 @@ wxString Spline::EncodeToASS() { } -/////////////////// -// Decode from ASS + +/// @brief Decode from ASS +/// @param str +/// void Spline::DecodeFromASS(wxString str) { // Clear current curves.clear(); @@ -183,8 +188,11 @@ void Spline::DecodeFromASS(wxString str) { } -//////////////////////////////// -// Insert a curve to the spline + +/// @brief Insert a curve to the spline +/// @param curve +/// @param index +/// void Spline::InsertCurve(SplineCurve &curve,int index) { if (index == -1) curves.push_back(curve); else { @@ -196,8 +204,11 @@ void Spline::InsertCurve(SplineCurve &curve,int index) { } -//////////////////////// -// Get a specific curve + +/// @brief Get a specific curve +/// @param index +/// @return +/// SplineCurve *Spline::GetCurve(int index) { int i=0; for (std::list::iterator cur=curves.begin();cur!=curves.end() && i <= index;cur++,i++) { @@ -207,8 +218,12 @@ SplineCurve *Spline::GetCurve(int index) { } -//////////////////////////////////////// -// Moves a specific point in the spline + +/// @brief Moves a specific point in the spline +/// @param curveIndex +/// @param point +/// @param pos +/// void Spline::MovePoint(int curveIndex,int point,wxPoint pos) { // Curves int i = 0; @@ -270,8 +285,11 @@ void Spline::MovePoint(int curveIndex,int point,wxPoint pos) { } -////////////////////////////////////// -// Gets a list of points in the curve + +/// @brief Gets a list of points in the curve +/// @param points +/// @param pointCurve +/// void Spline::GetPointList(std::vector &points,std::vector &pointCurve) { // Prepare points.clear(); @@ -324,8 +342,14 @@ void Spline::GetPointList(std::vector &points,std::vector &pointC } -/////////////////////////////////////////////////////// -// t value and curve of the point closest to reference + +/// @brief t value and curve of the point closest to reference +/// @param reference +/// @param curve +/// @param t +/// @param pt +/// @return +/// void Spline::GetClosestParametricPoint(Vector2D reference,int &curve,float &t,Vector2D &pt) { // Has at least one curve? curve = -1; @@ -359,8 +383,11 @@ void Spline::GetClosestParametricPoint(Vector2D reference,int &curve,float &t,Ve } -////////////////////////////// -// Point closest to reference + +/// @brief Point closest to reference +/// @param reference +/// @return +/// Vector2D Spline::GetClosestPoint(Vector2D reference) { int curve; float t; @@ -370,16 +397,21 @@ Vector2D Spline::GetClosestPoint(Vector2D reference) { } -////////////////////////////////////// -// Control point closest to reference + +/// @brief Control point closest to reference +/// @param reference +/// @return +/// Vector2D Spline::GetClosestControlPoint(Vector2D reference) { // TODO return Vector2D(-1,-1); } -/////////////////////// -// Smoothes the spline + +/// @brief Smoothes the spline +/// @param smooth +/// void Spline::Smooth(float smooth) { // See if there are enough curves if (curves.size() < 3) return; @@ -401,3 +433,4 @@ void Spline::Smooth(float smooth) { } } + diff --git a/aegisub/src/spline.h b/aegisub/src/spline.h index 251f71ce7..d52fe9c15 100644 --- a/aegisub/src/spline.h +++ b/aegisub/src/spline.h @@ -47,10 +47,16 @@ #include "spline_curve.h" -///////////////////////// -// Spline managing class + +/// DOCME +/// @class Spline +/// @brief DOCME +/// +/// DOCME class Spline { public: + + /// DOCME std::list curves; Spline(); @@ -58,6 +64,10 @@ public: wxString EncodeToASS(); void DecodeFromASS(wxString str); + + /// @brief DOCME + /// @param curve + /// void AppendCurve(SplineCurve &curve) { InsertCurve(curve,-1); } void InsertCurve(SplineCurve &curve,int index); void MovePoint(int curveIndex,int point,wxPoint pos); @@ -71,3 +81,4 @@ public: Vector2D GetClosestControlPoint(Vector2D reference); }; + diff --git a/aegisub/src/spline_curve.cpp b/aegisub/src/spline_curve.cpp index c369de483..9b92108f0 100644 --- a/aegisub/src/spline_curve.cpp +++ b/aegisub/src/spline_curve.cpp @@ -43,15 +43,20 @@ #include "utils.h" -///////////////////// -// Curve constructor + +/// @brief Curve constructor +/// SplineCurve::SplineCurve() { type = CURVE_INVALID; } -///////////////////////////////////////////////////////// -// Split a curve in two using the de Casteljau algorithm + +/// @brief Split a curve in two using the de Casteljau algorithm +/// @param c1 +/// @param c2 +/// @param t +/// void SplineCurve::Split(SplineCurve &c1,SplineCurve &c2,float t) { // Split a line if (type == CURVE_LINE) { @@ -90,9 +95,13 @@ void SplineCurve::Split(SplineCurve &c1,SplineCurve &c2,float t) { } -////////////////////// -// Smoothes the curve -// Based on http://antigrain.com/research/bezier_interpolation/index.html + +/// @brief Based on http://antigrain.com/research/bezier_interpolation/index.html Smoothes the curve +/// @param P0 +/// @param P3 +/// @param smooth +/// @return +/// void SplineCurve::Smooth(Vector2D P0,Vector2D P3,float smooth) { // Validate if (type != CURVE_LINE) return; @@ -123,8 +132,11 @@ void SplineCurve::Smooth(Vector2D P0,Vector2D P3,float smooth) { } -/////////////// -// Get a point + +/// @brief Get a point +/// @param t +/// @return +/// Vector2D SplineCurve::GetPoint(float t) const { // Point if (type == CURVE_POINT) return p1; @@ -144,11 +156,17 @@ Vector2D SplineCurve::GetPoint(float t) const { } -/////////////////////// -// Get start/end point + +/// @brief Get start/end point +/// @return +/// Vector2D SplineCurve::GetStartPoint() const { return p1; } + +/// @brief DOCME +/// @return +/// Vector2D SplineCurve::GetEndPoint() const { switch (type) { case CURVE_POINT: return p1; @@ -159,15 +177,21 @@ Vector2D SplineCurve::GetEndPoint() const { } -////////////////////////////////// -// Get point closest to reference + +/// @brief Get point closest to reference +/// @param ref +/// @return +/// Vector2D SplineCurve::GetClosestPoint(Vector2D ref) const { return GetPoint(GetClosestParam(ref)); } -/////////////////////////////////////////// -// Get value of parameter closest to point + +/// @brief Get value of parameter closest to point +/// @param ref +/// @return +/// float SplineCurve::GetClosestParam(Vector2D ref) const { // Line if (type == CURVE_LINE) { @@ -195,8 +219,11 @@ float SplineCurve::GetClosestParam(Vector2D ref) const { } -////////////////// -// Quick distance + +/// @brief Quick distance +/// @param ref +/// @return +/// float SplineCurve::GetQuickDistance(Vector2D ref) const { // Bicubic if (type == CURVE_BICUBIC) { @@ -214,17 +241,27 @@ float SplineCurve::GetQuickDistance(Vector2D ref) const { } -////////////////////////////////////////// -// Closest t in segment p1-p2 to point p3 + +/// @brief Closest t in segment p1-p2 to point p3 +/// @param pt1 +/// @param pt2 +/// @param pt3 +/// @return +/// float SplineCurve::GetClosestSegmentPart(Vector2D pt1,Vector2D pt2,Vector2D pt3) const { return MID(0.0f,(pt3-pt1).Dot(pt2-pt1)/(pt2-pt1).SquareLen(),1.0f); } -///////////////////////////////////////////////// -// Closest distance between p3 and segment p1-p2 + +/// @brief Closest distance between p3 and segment p1-p2 +/// @param pt1 +/// @param pt2 +/// @param pt3 +/// float SplineCurve::GetClosestSegmentDistance(Vector2D pt1,Vector2D pt2,Vector2D pt3) const { float t = GetClosestSegmentPart(pt1,pt2,pt3); return (pt1*(1.0f-t)+pt2*t-pt3).Len(); } + diff --git a/aegisub/src/spline_curve.h b/aegisub/src/spline_curve.h index d900d20a6..ab01928b1 100644 --- a/aegisub/src/spline_curve.h +++ b/aegisub/src/spline_curve.h @@ -43,25 +43,47 @@ #include "vector2d.h" -/////////////// -// Curve types + +/// DOCME enum CurveType { + + /// DOCME CURVE_INVALID, + + /// DOCME CURVE_POINT, + + /// DOCME CURVE_LINE, + + /// DOCME CURVE_BICUBIC }; -//////////////// -// Spline curve + +/// DOCME +/// @class SplineCurve +/// @brief DOCME +/// +/// DOCME class SplineCurve { private: float GetClosestSegmentPart(Vector2D p1,Vector2D p2,Vector2D p3) const; float GetClosestSegmentDistance(Vector2D p1,Vector2D p2,Vector2D p3) const; public: + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME Vector2D p1,p2,p3,p4; + + /// DOCME CurveType type; SplineCurve(); @@ -76,3 +98,4 @@ public: float GetQuickDistance(Vector2D ref) const; }; + diff --git a/aegisub/src/standard_paths.cpp b/aegisub/src/standard_paths.cpp index b3c7f7628..0ba035fdc 100644 --- a/aegisub/src/standard_paths.cpp +++ b/aegisub/src/standard_paths.cpp @@ -44,16 +44,19 @@ #include "standard_paths.h" -//////////////// -// Get instance + +/// @brief Get instance +/// @return +/// StandardPaths &StandardPaths::GetInstance() { static StandardPaths instance; return instance; } -/////////////// -// Constructor + +/// @brief Constructor +/// StandardPaths::StandardPaths() { wxStandardPathsBase &paths = wxStandardPaths::Get(); @@ -87,8 +90,11 @@ StandardPaths::StandardPaths() { } -/////////////// -// Decode path + +/// @brief Decode path +/// @param path +/// @return +/// wxString StandardPaths::DoDecodePath(wxString path) { // Decode if (path[0] == _T('?')) { @@ -118,23 +124,32 @@ wxString StandardPaths::DoDecodePath(wxString path) { } -/////////////// -// Encode path + +/// @brief Encode path +/// @param path +/// @return +/// wxString StandardPaths::DoEncodePath(const wxString &path) { // TODO return path; } -///////////////////////// -// Set value of a ? path + +/// @brief Set value of a ? path +/// @param path +/// @param value +/// void StandardPaths::DoSetPathValue(const wxString &path, const wxString &value) { paths[path] = value; } -/////////////////////////////////////////////////////////////////////////// -// Decode a path that for legacy reasons might be relative to another path + +/// @brief Decode a path that for legacy reasons might be relative to another path +/// @param path +/// @param relativeTo +/// wxString StandardPaths::DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo) { wxFileName res(DecodePath(path)); if (res.IsRelative()) @@ -142,3 +157,4 @@ wxString StandardPaths::DecodePathMaybeRelative(const wxString &path, const wxSt return res.GetFullPath(); } + diff --git a/aegisub/src/standard_paths.h b/aegisub/src/standard_paths.h index c89125682..856f62747 100644 --- a/aegisub/src/standard_paths.h +++ b/aegisub/src/standard_paths.h @@ -44,12 +44,18 @@ #include -////////////////////////////////// -// Standard path conversion class + +/// DOCME +/// @class StandardPaths +/// @brief DOCME +/// +/// DOCME class StandardPaths { private: static StandardPaths &GetInstance(); + + /// DOCME std::map paths; StandardPaths(); @@ -61,9 +67,25 @@ private: void DoSetPathValue(const wxString &path, const wxString &value); public: + + /// @brief DOCME + /// @param path + /// @return + /// static wxString DecodePath(const wxString &path) { return GetInstance().DoDecodePath(path); } static wxString DecodePathMaybeRelative(const wxString &path, const wxString &relativeTo); + + /// @brief DOCME + /// @param path + /// @return + /// static wxString EncodePath(const wxString &path) { return GetInstance().DoEncodePath(path); } + + /// @brief DOCME + /// @param path + /// @param value + /// static void SetPathValue(const wxString &path, const wxString &value) { GetInstance().DoSetPathValue(path,value); } }; + diff --git a/aegisub/src/static_bmp.cpp b/aegisub/src/static_bmp.cpp index 548c0b1f8..af4b77b8a 100644 --- a/aegisub/src/static_bmp.cpp +++ b/aegisub/src/static_bmp.cpp @@ -43,8 +43,12 @@ #include "static_bmp.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _bmp +/// @param style +/// BitmapControl::BitmapControl(wxWindow *parent,wxBitmap _bmp,int style) : wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, style) { @@ -60,10 +64,13 @@ BEGIN_EVENT_TABLE(BitmapControl, wxWindow) END_EVENT_TABLE() -/////////// -// OnPaint + +/// @brief OnPaint +/// @param event +/// void BitmapControl::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); dc.DrawBitmap(bmp,0,0); } + diff --git a/aegisub/src/static_bmp.h b/aegisub/src/static_bmp.h index 4868d8ee4..08f4b710d 100644 --- a/aegisub/src/static_bmp.h +++ b/aegisub/src/static_bmp.h @@ -45,10 +45,16 @@ #include -///////////////////// -// About image class + +/// DOCME +/// @class BitmapControl +/// @brief DOCME +/// +/// DOCME class BitmapControl: public wxWindow { private: + + /// DOCME wxBitmap bmp; void OnPaint(wxPaintEvent& event); @@ -58,3 +64,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/string_codec.cpp b/aegisub/src/string_codec.cpp index 782f45f7d..188a28f0f 100644 --- a/aegisub/src/string_codec.cpp +++ b/aegisub/src/string_codec.cpp @@ -41,6 +41,11 @@ #include "string_codec.h" + +/// @brief DOCME +/// @param input +/// @return +/// wxString inline_string_encode(const wxString &input) { const size_t inlen = input.length(); @@ -57,6 +62,10 @@ wxString inline_string_encode(const wxString &input) return output; } + +/// @brief DOCME +/// @param input +/// wxString inline_string_decode(const wxString &input) { const size_t inlen = input.length(); @@ -81,3 +90,4 @@ wxString inline_string_decode(const wxString &input) return output; } + diff --git a/aegisub/src/string_codec.h b/aegisub/src/string_codec.h index 5e5b5171b..d3c3513c4 100644 --- a/aegisub/src/string_codec.h +++ b/aegisub/src/string_codec.h @@ -55,6 +55,8 @@ /// The encoded string should be usable in any kind of field in an ASS file. #ifndef _STRING_CODEC_H + +/// DOCME #define _STRING_CODEC_H #include @@ -65,3 +67,4 @@ wxString inline_string_decode(const wxString &input); #endif + diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index 6f93b8fb7..ba95f7403 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -67,8 +67,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param gridp +/// SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxRAISED_BORDER, _T("SubsEditBox")) { // Setup @@ -215,8 +218,9 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren } -////////////// -// Destructor + +/// @brief Destructor +/// SubsEditBox::~SubsEditBox() { ActorBox->PopEventHandler(true); Effect->PopEventHandler(true); @@ -224,8 +228,10 @@ SubsEditBox::~SubsEditBox() { } -///////////////////////////////// -// Set split or single line mode + +/// @brief Set split or single line mode +/// @param newSize +/// void SubsEditBox::SetSplitLineMode(wxSize newSize) { // Widths int topWidth; @@ -257,8 +263,11 @@ void SubsEditBox::SetSplitLineMode(wxSize newSize) { } -/////////////////// -// Update function + +/// @brief Update function +/// @param timeOnly +/// @param weak +/// void SubsEditBox::Update (bool timeOnly,bool weak) { if (enabled) { AssDialogue *curdiag = grid->GetDialogue(linen); @@ -308,8 +317,9 @@ void SubsEditBox::Update (bool timeOnly,bool weak) { } -////////////////// -// Update globals + +/// @brief Update globals +/// void SubsEditBox::UpdateGlobals () { // Styles StyleBox->Clear(); @@ -335,8 +345,11 @@ void SubsEditBox::UpdateGlobals () { } -////////////////// -// Jump to a line + +/// @brief Jump to a line +/// @param n +/// @param weak +/// void SubsEditBox::SetToLine(int n,bool weak) { // Set to nothing if (n == -1) { @@ -415,16 +428,20 @@ BEGIN_EVENT_TABLE(SubsEditBox, wxPanel) END_EVENT_TABLE() -/////////// -// On size + +/// @brief On size +/// @param event +/// void SubsEditBox::OnSize(wxSizeEvent &event) { if (setupDone) SetSplitLineMode(event.GetSize()); event.Skip(); } -///////////////////// -// Text edited event + +/// @brief Text edited event +/// @param event +/// void SubsEditBox::OnEditText(wxStyledTextEvent &event) { int modType = event.GetModificationType(); if (modType == (wxSTC_MOD_INSERTTEXT | wxSTC_PERFORMED_USER) || modType == (wxSTC_MOD_DELETETEXT | wxSTC_PERFORMED_USER)) { @@ -433,15 +450,19 @@ void SubsEditBox::OnEditText(wxStyledTextEvent &event) { } -////////////////////////// -// User Interface updated + +/// @brief User Interface updated +/// @param event +/// void SubsEditBox::OnUpdateUI(wxStyledTextEvent &event) { TextEdit->UpdateCallTip(); } -////////////// -// Need style + +/// @brief Need style +/// @param event +/// void SubsEditBox::OnNeedStyle(wxStyledTextEvent &event) { // Check if it needs to fix text wxString text = TextEdit->GetText(); @@ -454,21 +475,27 @@ void SubsEditBox::OnNeedStyle(wxStyledTextEvent &event) { } -/////////////////// -// Character added + +/// @brief Character added +/// @param event +/// void SubsEditBox::OnCharAdded(wxStyledTextEvent &event) { //int character = event.GetKey(); } -//////////// -// Key down + +/// @brief Key down +/// @param event +/// void SubsEditBox::OnKeyDown(wxStyledTextEvent &event) { } -///////////////////////////// -// Syntax highlight checkbox + +/// @brief Syntax highlight checkbox +/// @param event +/// void SubsEditBox::OnSyntaxBox(wxCommandEvent &event) { TextEdit->UpdateStyle(); Options.SetBool(_T("Syntax Highlight Enabled"),SyntaxHighlight->GetValue()); @@ -477,8 +504,10 @@ void SubsEditBox::OnSyntaxBox(wxCommandEvent &event) { } -////////////////////////// -// Time by frame radiobox + +/// @brief Time by frame radiobox +/// @param event +/// void SubsEditBox::OnFrameRadio(wxCommandEvent &event) { if (ByFrame->GetValue()) { StartTime->SetByFrame(true); @@ -490,8 +519,10 @@ void SubsEditBox::OnFrameRadio(wxCommandEvent &event) { } -////////////////////////// -// Standard time radiobox + +/// @brief Standard time radiobox +/// @param event +/// void SubsEditBox::OnTimeRadio(wxCommandEvent &event) { if (ByTime->GetValue()) { StartTime->SetByFrame(false); @@ -503,8 +534,11 @@ void SubsEditBox::OnTimeRadio(wxCommandEvent &event) { } -////////////////////////////////////////////////// -// Sets state (enabled/disabled) for all controls + +/// @brief Sets state (enabled/disabled) for all controls +/// @param state +/// @return +/// void SubsEditBox::SetControlsState (bool state) { if (state == controlState) return; controlState = state; @@ -557,8 +591,9 @@ void SubsEditBox::SetControlsState (bool state) { } -//////////////////////////////////// -// Disables or enables frame timing + +/// @brief Disables or enables frame timing +/// void SubsEditBox::UpdateFrameTiming () { if (VFR_Output.IsLoaded()) ByFrame->Enable(enabled); else { @@ -571,8 +606,10 @@ void SubsEditBox::UpdateFrameTiming () { } -///////////////// -// Style changed + +/// @brief Style changed +/// @param event +/// void SubsEditBox::OnStyleChange(wxCommandEvent &event) { grid->BeginBatch(); wxArrayInt sel = grid->GetSelection(); @@ -591,8 +628,10 @@ void SubsEditBox::OnStyleChange(wxCommandEvent &event) { } -///////////////// -// Style changed + +/// @brief Style changed +/// @param event +/// void SubsEditBox::OnActorChange(wxCommandEvent &event) { grid->BeginBatch(); wxArrayInt sel = grid->GetSelection(); @@ -622,8 +661,10 @@ void SubsEditBox::OnActorChange(wxCommandEvent &event) { } -/////////////////////////// -// Layer changed with spin + +/// @brief Layer changed with spin +/// @param event +/// void SubsEditBox::OnLayerChange(wxSpinEvent &event) { // Value long temp = event.GetPosition(); @@ -648,8 +689,10 @@ void SubsEditBox::OnLayerChange(wxSpinEvent &event) { } -//////////////////////////// -// Layer changed with enter + +/// @brief Layer changed with enter +/// @param event +/// void SubsEditBox::OnLayerEnter(wxCommandEvent &event) { // Value long temp = Layer->GetValue(); @@ -674,8 +717,10 @@ void SubsEditBox::OnLayerEnter(wxCommandEvent &event) { } -////////////////////// -// Start time changed + +/// @brief Start time changed +/// @param event +/// void SubsEditBox::OnStartTimeChange(wxCommandEvent &event) { if (StartTime->time > EndTime->time) StartTime->SetTime(EndTime->time.GetMS()); bool join = Options.AsBool(_T("Link Time Boxes Commit")) && EndTime->HasBeenModified(); @@ -686,8 +731,10 @@ void SubsEditBox::OnStartTimeChange(wxCommandEvent &event) { } -//////////////////// -// End time changed + +/// @brief End time changed +/// @param event +/// void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) { if (StartTime->time > EndTime->time) EndTime->SetTime(StartTime->time.GetMS()); bool join = Options.AsBool(_T("Link Time Boxes Commit")) && StartTime->HasBeenModified(); @@ -698,8 +745,10 @@ void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) { } -//////////////////// -// Duration changed + +/// @brief Duration changed +/// @param event +/// void SubsEditBox::OnDurationChange(wxCommandEvent &event) { EndTime->SetTime(StartTime->time.GetMS() + Duration->time.GetMS()); StartTime->Update(); @@ -709,8 +758,14 @@ void SubsEditBox::OnDurationChange(wxCommandEvent &event) { } -/////////////////////// -// Commit time changes + +/// @brief Commit time changes +/// @param start +/// @param end +/// @param fromStart +/// @param commit +/// @return +/// void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart,bool commit) { // Get selection if (!start && !end) return; @@ -751,8 +806,10 @@ void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart,bool commit) { } -//////////////////// -// Margin L changed + +/// @brief Margin L changed +/// @param event +/// void SubsEditBox::OnMarginLChange(wxCommandEvent &event) { MarginL->Commited(); grid->BeginBatch(); @@ -773,8 +830,10 @@ void SubsEditBox::OnMarginLChange(wxCommandEvent &event) { } -//////////////////// -// Margin R changed + +/// @brief Margin R changed +/// @param event +/// void SubsEditBox::OnMarginRChange(wxCommandEvent &event) { MarginR->Commited(); grid->BeginBatch(); @@ -795,8 +854,10 @@ void SubsEditBox::OnMarginRChange(wxCommandEvent &event) { } -//////////////////// -// Margin V changed + +/// @brief Margin V changed +/// @param event +/// void SubsEditBox::OnMarginVChange(wxCommandEvent &event) { MarginV->Commited(); grid->BeginBatch(); @@ -818,8 +879,10 @@ void SubsEditBox::OnMarginVChange(wxCommandEvent &event) { } -////////////////// -// Effect changed + +/// @brief Effect changed +/// @param event +/// void SubsEditBox::OnEffectChange(wxCommandEvent &event) { Effect->Commited(); grid->BeginBatch(); @@ -839,8 +902,10 @@ void SubsEditBox::OnEffectChange(wxCommandEvent &event) { } -///////////////////////// -// Comment state changed + +/// @brief Comment state changed +/// @param event +/// void SubsEditBox::OnCommentChange(wxCommandEvent &event) { grid->BeginBatch(); wxArrayInt sel = grid->GetSelection(); @@ -859,8 +924,10 @@ void SubsEditBox::OnCommentChange(wxCommandEvent &event) { } -/////////////////////// -// Event handler class + +/// @brief Event handler class +/// @param _control +/// SubsEditBoxEvent::SubsEditBoxEvent(SubsEditBox *_control) { control = _control; } @@ -869,13 +936,20 @@ BEGIN_EVENT_TABLE(SubsEditBoxEvent, wxEvtHandler) EVT_KEY_DOWN(SubsEditBoxEvent::OnKeyPress) END_EVENT_TABLE() + +/// @brief DOCME +/// @param event +/// void SubsEditBoxEvent::OnKeyPress(wxKeyEvent &event) { control->DoKeyPress(event); } -/////////////////////// -// Actual text changed + +/// @brief Actual text changed +/// @param event +/// @return +/// void SubsEditBox::DoKeyPress(wxKeyEvent &event) { int key = event.GetKeyCode(); @@ -894,8 +968,11 @@ void SubsEditBox::DoKeyPress(wxKeyEvent &event) { } -////////// -// Commit + +/// @brief Commit +/// @param stay +/// @return +/// void SubsEditBox::Commit(bool stay) { // Record pre-commit data wxString oldText = grid->GetDialogue(linen)->Text; @@ -951,8 +1028,10 @@ void SubsEditBox::Commit(bool stay) { } -/////////////// -// Commit text + +/// @brief Commit text +/// @param weak +/// void SubsEditBox::CommitText(bool weak) { AssDialogue *cur = grid->GetDialogue(linen); @@ -980,8 +1059,11 @@ void SubsEditBox::CommitText(bool weak) { } -////////////////////////////////////// -// Gets block number at text position + +/// @brief Gets block number at text position +/// @param pos +/// @return +/// int SubsEditBox::BlockAtPos(int pos) { // Prepare int n=0; @@ -998,8 +1080,14 @@ int SubsEditBox::BlockAtPos(int pos) { } -//////////////// -// Set override + +/// @brief Set override +/// @param tagname +/// @param preValue +/// @param forcePos +/// @param getFocus +/// @return +/// void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos,bool getFocus) { // Selection int selstart, selend; @@ -1278,71 +1366,91 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos,b } -///////////////////// -// Set primary color + +/// @brief Set primary color +/// @param event +/// void SubsEditBox::OnButtonColor1(wxCommandEvent &event) { SetOverride(_T("\\1c")); } -/////////////////////// -// Set secondary color + +/// @brief Set secondary color +/// @param event +/// void SubsEditBox::OnButtonColor2(wxCommandEvent &event) { SetOverride(_T("\\2c")); } -///////////////////// -// Set outline color + +/// @brief Set outline color +/// @param event +/// void SubsEditBox::OnButtonColor3(wxCommandEvent &event) { SetOverride(_T("\\3c")); } -//////////////////// -// Set shadow color + +/// @brief Set shadow color +/// @param event +/// void SubsEditBox::OnButtonColor4(wxCommandEvent &event) { SetOverride(_T("\\4c")); } -///////////////// -// Set font face + +/// @brief Set font face +/// @param event +/// void SubsEditBox::OnButtonFontFace(wxCommandEvent &event) { SetOverride(_T("\\fn")); } -//////// -// Bold + +/// @brief Bold +/// @param event +/// void SubsEditBox::OnButtonBold(wxCommandEvent &event) { SetOverride(_T("\\b")); } -/////////// -// Italics + +/// @brief Italics +/// @param event +/// void SubsEditBox::OnButtonItalics(wxCommandEvent &event) { SetOverride(_T("\\i")); } -///////////// -// Underline + +/// @brief Underline +/// @param event +/// void SubsEditBox::OnButtonUnderline(wxCommandEvent &event) { SetOverride(_T("\\u")); } -///////////// -// Strikeout + +/// @brief Strikeout +/// @param event +/// void SubsEditBox::OnButtonStrikeout(wxCommandEvent &event) { SetOverride(_T("\\s")); } -////////// -// Commit + +/// @brief Commit +/// @param event +/// void SubsEditBox::OnButtonCommit(wxCommandEvent &event) { #ifdef __APPLE__ Commit(wxGetMouseState().CmdDown()); @@ -1353,3 +1461,4 @@ void SubsEditBox::OnButtonCommit(wxCommandEvent &event) { + diff --git a/aegisub/src/subs_edit_box.h b/aegisub/src/subs_edit_box.h index 6bd5280cd..7193fefa4 100644 --- a/aegisub/src/subs_edit_box.h +++ b/aegisub/src/subs_edit_box.h @@ -55,54 +55,134 @@ class HiliModTextCtrl; class wxStyledTextCtrl; -////////////////// -// Edit box class + +/// DOCME +/// @class SubsEditBox +/// @brief DOCME +/// +/// DOCME class SubsEditBox : public wxPanel { friend class SubsTextEditHandler; friend class SubsTextEditCtrl; friend class AudioDisplay; private: + + /// DOCME bool splitLineMode; + + /// DOCME bool setupDone; + + /// DOCME bool enabled; + + /// DOCME bool textEditReady; + + /// DOCME bool controlState; + + /// DOCME wxColour origBgColour; + + /// DOCME wxColour disabledBgColour; + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxCheckBox *CommentBox; + + /// DOCME wxComboBox *StyleBox; + + /// DOCME wxComboBox *ActorBox; + + /// DOCME TimeEdit *StartTime; + + /// DOCME TimeEdit *EndTime; + + /// DOCME TimeEdit *Duration; + + /// DOCME wxSpinCtrl *Layer; + + /// DOCME HiliModTextCtrl *MarginL; + + /// DOCME HiliModTextCtrl *MarginR; + + /// DOCME HiliModTextCtrl *MarginV; + + /// DOCME HiliModTextCtrl *Effect; + + /// DOCME wxRadioButton *ByTime; + + /// DOCME wxRadioButton *ByFrame; + + /// DOCME wxCheckBox *SyntaxHighlight; + + /// DOCME wxButton *Bold; + + /// DOCME wxButton *Italics; + + /// DOCME wxButton *Underline; + + /// DOCME wxButton *Strikeout; + + /// DOCME wxButton *FontName; + + /// DOCME wxButton *Color1; + + /// DOCME wxButton *Color2; + + /// DOCME wxButton *Color3; + + /// DOCME wxButton *Color4; + + /// DOCME wxButton *CommitButton; + + /// DOCME wxSizer *TopSizer; + + /// DOCME wxSizer *MiddleBotSizer; + + /// DOCME wxSizer *MiddleSizer; + + /// DOCME wxSizer *MainSizer; + + /// DOCME wxSizer *DummySizer; + + /// DOCME wxSizer *BottomSizer; void SetControlsState(bool state); @@ -145,8 +225,14 @@ private: void OnSize(wxSizeEvent &event); public: + + /// DOCME int linen; + + /// DOCME AudioDisplay *audio; + + /// DOCME SubsTextEditCtrl *TextEdit; SubsEditBox(wxWindow *parent,SubtitlesGrid *gridp); @@ -168,10 +254,16 @@ public: }; -///////////////// -// Event handler + +/// DOCME +/// @class SubsEditBoxEvent +/// @brief DOCME +/// +/// DOCME class SubsEditBoxEvent : public wxEvtHandler { private: + + /// DOCME SubsEditBox *control; void OnKeyPress(wxKeyEvent &event); @@ -184,31 +276,82 @@ public: /////// // IDs enum { + + /// DOCME EDIT_BOX = 1300, + + /// DOCME SYNTAX_BOX, + + /// DOCME RADIO_TIME_BY_FRAME, + + /// DOCME RADIO_TIME_BY_TIME, + + /// DOCME STYLE_COMBOBOX, + + /// DOCME ACTOR_COMBOBOX, + + /// DOCME LAYER_BOX, + + /// DOCME STARTTIME_BOX, + + /// DOCME ENDTIME_BOX, + + /// DOCME DURATION_BOX, + + /// DOCME MARGINL_BOX, + + /// DOCME MARGINR_BOX, + + /// DOCME MARGINV_BOX, + + /// DOCME EFFECT_BOX, + + /// DOCME COMMENT_CHECKBOX, + + /// DOCME BUTTON_BOLD, + + /// DOCME BUTTON_ITALICS, + + /// DOCME BUTTON_UNDERLINE, + + /// DOCME BUTTON_STRIKEOUT, + + /// DOCME BUTTON_FONT_NAME, + + /// DOCME BUTTON_COLOR1, + + /// DOCME BUTTON_COLOR2, + + /// DOCME BUTTON_COLOR3, + + /// DOCME BUTTON_COLOR4, + + /// DOCME BUTTON_COMMIT }; + diff --git a/aegisub/src/subs_edit_ctrl.cpp b/aegisub/src/subs_edit_ctrl.cpp index f5f3488da..93ea8143a 100644 --- a/aegisub/src/subs_edit_ctrl.cpp +++ b/aegisub/src/subs_edit_ctrl.cpp @@ -49,8 +49,18 @@ #include "ass_dialogue.h" -//////////////////////// -// Edit box constructor + +/// @brief Edit box constructor +/// @param parent +/// @param id +/// @param value +/// @param pos +/// @param wsize +/// @param style +/// @param validator +/// @param name +/// @return +/// SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& wsize, long style, const wxValidator& validator, const wxString& name) : ScintillaTextCtrl(parent, id, value, pos, wsize, style, validator, name) { @@ -142,8 +152,9 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxWindowID id, const wxStri } -////////////// -// Destructor + +/// @brief Destructor +/// SubsTextEditCtrl::~SubsTextEditCtrl() { delete spellchecker; spellchecker = NULL; @@ -173,16 +184,19 @@ BEGIN_EVENT_TABLE(SubsTextEditCtrl,wxStyledTextCtrl) END_EVENT_TABLE() -////////////// -// Lose focus + +/// @brief Lose focus +/// @param event +/// void SubsTextEditCtrl::OnLoseFocus(wxFocusEvent &event) { CallTipCancel(); event.Skip(); } -////////////// -// Set styles + +/// @brief Set styles +/// void SubsTextEditCtrl::SetStyles() { // Styles wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); @@ -241,8 +255,12 @@ void SubsTextEditCtrl::SetStyles() { } -///////////////// -// Style a range + +/// @brief Style a range +/// @param start +/// @param _length +/// @return +/// void SubsTextEditCtrl::UpdateStyle(int start, int _length) { // Styling enabled? if (Options.AsBool(_T("Syntax Highlight Enabled")) == 0) return; @@ -458,8 +476,10 @@ void SubsTextEditCtrl::UpdateStyle(int start, int _length) { } -/////////////////// -// Update call tip + +/// @brief Update call tip +/// @return +/// void SubsTextEditCtrl::UpdateCallTip() { // Enabled? if (!Options.AsBool(_T("Call tips enabled"))) return; @@ -675,8 +695,12 @@ void SubsTextEditCtrl::UpdateCallTip() { } -/////////////// -// Spell check + +/// @brief Spell check +/// @param start +/// @param len +/// @return +/// void SubsTextEditCtrl::StyleSpellCheck(int start, int len) { // See if it has a spellchecker if (!spellchecker) return; @@ -712,8 +736,10 @@ void SubsTextEditCtrl::StyleSpellCheck(int start, int len) { } -/////////////////////////// -// Set text to a new value + +/// @brief Set text to a new value +/// @param _text +/// void SubsTextEditCtrl::SetTextTo(const wxString _text) { // Setup control->textEditReady = false; @@ -744,8 +770,11 @@ void SubsTextEditCtrl::SetTextTo(const wxString _text) { } -/////////////// -// Mouse event + +/// @brief Mouse event +/// @param event +/// @return +/// void SubsTextEditCtrl::OnMouseEvent(wxMouseEvent &event) { // Right click if (event.ButtonUp(wxMOUSE_BTN_RIGHT)) { @@ -761,8 +790,10 @@ void SubsTextEditCtrl::OnMouseEvent(wxMouseEvent &event) { } -/////////////////// -// Show popup menu + +/// @brief Show popup menu +/// @param activePos +/// void SubsTextEditCtrl::ShowPopupMenu(int activePos) { // Menu wxMenu menu; @@ -957,8 +988,10 @@ void SubsTextEditCtrl::ShowPopupMenu(int activePos) { } -/////////////////////////////// -// Split line preserving times + +/// @brief Split line preserving times +/// @param event +/// void SubsTextEditCtrl::OnSplitLinePreserve (wxCommandEvent &event) { int from,to; GetSelection(&from, &to); @@ -970,8 +1003,10 @@ void SubsTextEditCtrl::OnSplitLinePreserve (wxCommandEvent &event) { } -/////////////////////////////// -// Split line estimating times + +/// @brief Split line estimating times +/// @param event +/// void SubsTextEditCtrl::OnSplitLineEstimate (wxCommandEvent &event) { int from,to; GetSelection(&from, &to); @@ -983,43 +1018,55 @@ void SubsTextEditCtrl::OnSplitLineEstimate (wxCommandEvent &event) { } -/////// -// Cut + +/// @brief Cut +/// @param event +/// void SubsTextEditCtrl::OnCut(wxCommandEvent &event) { Cut(); } -//////// -// Copy + +/// @brief Copy +/// @param event +/// void SubsTextEditCtrl::OnCopy(wxCommandEvent &event) { Copy(); } -///////// -// Paste + +/// @brief Paste +/// @param event +/// void SubsTextEditCtrl::OnPaste(wxCommandEvent &event) { Paste(); } -//////// -// Undo + +/// @brief Undo +/// @param event +/// void SubsTextEditCtrl::OnUndo(wxCommandEvent &event) { Undo(); } -////////////// -// Select All + +/// @brief Select All +/// @param event +/// void SubsTextEditCtrl::OnSelectAll(wxCommandEvent &event) { SelectAll(); } -////////////////////////// -// Add word to dictionary + +/// @brief Add word to dictionary +/// @param event +/// void SubsTextEditCtrl::OnAddToDictionary(wxCommandEvent &event) { if (spellchecker) spellchecker->AddWord(currentWord); UpdateStyle(); @@ -1027,8 +1074,10 @@ void SubsTextEditCtrl::OnAddToDictionary(wxCommandEvent &event) { } -////////////////// -// Use suggestion + +/// @brief Use suggestion +/// @param event +/// void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) { // Get suggestion wxString suggestion = sugs[event.GetId()-EDIT_MENU_SUGGESTIONS]; @@ -1048,8 +1097,10 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) { -//////////////////////////// -// Use thesaurus suggestion + +/// @brief Use thesaurus suggestion +/// @param event +/// void SubsTextEditCtrl::OnUseThesaurusSuggestion(wxCommandEvent &event) { // Get suggestion wxString suggestion = thesSugs[event.GetId()-EDIT_MENU_THESAURUS_SUGS]; @@ -1074,8 +1125,10 @@ void SubsTextEditCtrl::OnUseThesaurusSuggestion(wxCommandEvent &event) { } -/////////////////////////// -// Set dictionary language + +/// @brief Set dictionary language +/// @param event +/// void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) { // Get language list wxArrayString langs = spellchecker->GetLanguageList(); @@ -1093,8 +1146,10 @@ void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) { } -////////////////////////// -// Set thesaurus language + +/// @brief Set thesaurus language +/// @param event +/// void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) { // Get language list wxArrayString langs = thesaurus->GetLanguageList(); @@ -1111,3 +1166,4 @@ void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) { UpdateStyle(); } + diff --git a/aegisub/src/subs_edit_ctrl.h b/aegisub/src/subs_edit_ctrl.h index 32169a68e..fc87b60fd 100644 --- a/aegisub/src/subs_edit_ctrl.h +++ b/aegisub/src/subs_edit_ctrl.h @@ -51,19 +51,39 @@ class SubsEditBox; -//////////////////// -// SubsTextEditCtrl + +/// DOCME +/// @class SubsTextEditCtrl +/// @brief DOCME +/// +/// DOCME class SubsTextEditCtrl : public ScintillaTextCtrl { private: + + /// DOCME SpellChecker *spellchecker; + + /// DOCME Thesaurus *thesaurus; + + /// DOCME wxString currentWord; + + /// DOCME wxArrayString sugs; + + /// DOCME wxArrayString thesSugs; + + /// DOCME int currentWordPos; + + /// DOCME wxArrayString proto; + + /// DOCME int tipProtoN; void ShowPopupMenu(int activePos=-1); @@ -84,6 +104,8 @@ private: void OnLoseFocus(wxFocusEvent &event); public: + + /// DOCME SubsEditBox *control; SubsTextEditCtrl(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); @@ -102,21 +124,54 @@ public: /////// // IDs enum { + + /// DOCME EDIT_MENU_SPLIT_PRESERVE = 1400, + + /// DOCME EDIT_MENU_SPLIT_ESTIMATE, + + /// DOCME EDIT_MENU_CUT, + + /// DOCME EDIT_MENU_COPY, + + /// DOCME EDIT_MENU_PASTE, + + /// DOCME EDIT_MENU_UNDO, + + /// DOCME EDIT_MENU_SELECT_ALL, + + /// DOCME EDIT_MENU_ADD_TO_DICT, + + /// DOCME EDIT_MENU_SUGGESTION, + + /// DOCME EDIT_MENU_SUGGESTIONS, + + /// DOCME EDIT_MENU_THESAURUS = 1450, + + /// DOCME EDIT_MENU_THESAURUS_SUGS, + + /// DOCME EDIT_MENU_DIC_LANGUAGE = 1600, + + /// DOCME EDIT_MENU_DIC_LANGS, + + /// DOCME EDIT_MENU_THES_LANGUAGE = 1700, + + /// DOCME EDIT_MENU_THES_LANGS }; + diff --git a/aegisub/src/subs_grid.cpp b/aegisub/src/subs_grid.cpp index 0af74599d..7e89b8697 100644 --- a/aegisub/src/subs_grid.cpp +++ b/aegisub/src/subs_grid.cpp @@ -91,8 +91,16 @@ BEGIN_EVENT_TABLE(SubtitlesGrid, BaseGrid) END_EVENT_TABLE() -/////////////// -// Constructor + +/// @brief Constructor +/// @param parentFr +/// @param parent +/// @param id +/// @param pos +/// @param size +/// @param style +/// @param name +/// SubtitlesGrid::SubtitlesGrid(FrameMain* parentFr, wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : BaseGrid(parent,id,pos,size,style,name) { @@ -104,14 +112,18 @@ SubtitlesGrid::SubtitlesGrid(FrameMain* parentFr, wxWindow *parent, wxWindowID i } -////////////// -// Destructor + +/// @brief Destructor +/// SubtitlesGrid::~SubtitlesGrid() { } -////////////// -// Popup menu + +/// @brief Popup menu +/// @param alternate +/// @return +/// void SubtitlesGrid::OnPopupMenu(bool alternate) { // Alternate if (alternate) { @@ -210,8 +222,10 @@ void SubtitlesGrid::OnPopupMenu(bool alternate) { } -//////////////////////////////////// -// Process a show/hide column event + +/// @brief Process a show/hide column event +/// @param event +/// void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) { // Set width int item = event.GetId()-MENU_SHOW_COL; @@ -227,8 +241,11 @@ void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) { } -/////////////////////////// -// Process keyboard events + +/// @brief Process keyboard events +/// @param event +/// @return +/// void SubtitlesGrid::OnKeyDown(wxKeyEvent &event) { // Get key #ifdef __APPLE__ @@ -337,8 +354,10 @@ void SubtitlesGrid::OnDuplicateNextFrame (wxCommandEvent &WXUNUSED(&event)) { } -///////////// -// Call swap + +/// @brief Call swap +/// @param event +/// void SubtitlesGrid::OnSwap (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -347,8 +366,10 @@ void SubtitlesGrid::OnSwap (wxCommandEvent &event) { } -/////////////////////////// -// Call join (concatenate) + +/// @brief Call join (concatenate) +/// @param event +/// void SubtitlesGrid::OnJoinConcat (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -357,8 +378,10 @@ void SubtitlesGrid::OnJoinConcat (wxCommandEvent &event) { } -/////////////////////// -// Call join (replace) + +/// @brief Call join (replace) +/// @param event +/// void SubtitlesGrid::OnJoinReplace (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -367,8 +390,10 @@ void SubtitlesGrid::OnJoinReplace (wxCommandEvent &event) { } -//////////////// -// Adjoin lines + +/// @brief Adjoin lines +/// @param event +/// void SubtitlesGrid::OnAdjoin (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -376,6 +401,10 @@ void SubtitlesGrid::OnAdjoin (wxCommandEvent &event) { EndBatch(); } + +/// @brief DOCME +/// @param event +/// void SubtitlesGrid::OnAdjoin2 (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -384,8 +413,10 @@ void SubtitlesGrid::OnAdjoin2 (wxCommandEvent &event) { } -//////////////////////// -// Call join as karaoke + +/// @brief Call join as karaoke +/// @param event +/// void SubtitlesGrid::OnJoinAsKaraoke (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -394,8 +425,10 @@ void SubtitlesGrid::OnJoinAsKaraoke (wxCommandEvent &event) { } -///////////////////////// -// Call split by karaoke + +/// @brief Call split by karaoke +/// @param event +/// void SubtitlesGrid::OnSplitByKaraoke (wxCommandEvent &event) { BeginBatch(); wxArrayInt sels = GetSelection(); @@ -411,8 +444,10 @@ void SubtitlesGrid::OnSplitByKaraoke (wxCommandEvent &event) { } -////////////////////// -// Call insert before + +/// @brief Call insert before +/// @param event +/// void SubtitlesGrid::OnInsertBefore (wxCommandEvent &event) { BeginBatch(); // Find line @@ -443,8 +478,10 @@ void SubtitlesGrid::OnInsertBefore (wxCommandEvent &event) { } -///////////////////// -// Call insert after + +/// @brief Call insert after +/// @param event +/// void SubtitlesGrid::OnInsertAfter (wxCommandEvent &event) { BeginBatch(); // Find line @@ -473,8 +510,10 @@ void SubtitlesGrid::OnInsertAfter (wxCommandEvent &event) { } -///////////////////////////////// -// Call insert before with video + +/// @brief Call insert before with video +/// @param event +/// void SubtitlesGrid::OnInsertBeforeVideo (wxCommandEvent &event) { BeginBatch(); // Find line @@ -495,8 +534,10 @@ void SubtitlesGrid::OnInsertBeforeVideo (wxCommandEvent &event) { } -//////////////////////////////// -// Call insert after with video + +/// @brief Call insert after with video +/// @param event +/// void SubtitlesGrid::OnInsertAfterVideo (wxCommandEvent &event) { BeginBatch(); // Find line @@ -547,8 +588,10 @@ void SubtitlesGrid::OnDeleteLines (wxCommandEvent &WXUNUSED(&event)) { } -////////////////////////// -// Set start to video pos + +/// @brief Set start to video pos +/// @param event +/// void SubtitlesGrid::OnSetStartToVideo(wxCommandEvent &event) { BeginBatch(); SetSubsToVideo(true); @@ -556,8 +599,10 @@ void SubtitlesGrid::OnSetStartToVideo(wxCommandEvent &event) { } -//////////////////////// -// Set end to video pos + +/// @brief Set end to video pos +/// @param event +/// void SubtitlesGrid::OnSetEndToVideo(wxCommandEvent &event) { BeginBatch(); SetSubsToVideo(false); @@ -565,8 +610,10 @@ void SubtitlesGrid::OnSetEndToVideo(wxCommandEvent &event) { } -////////////////////////// -// Set video pos to start + +/// @brief Set video pos to start +/// @param event +/// void SubtitlesGrid::OnSetVideoToStart(wxCommandEvent &event) { BeginBatch(); SetVideoToSubs(true); @@ -574,8 +621,10 @@ void SubtitlesGrid::OnSetVideoToStart(wxCommandEvent &event) { } -//////////////////////// -// Set video pos to end + +/// @brief Set video pos to end +/// @param event +/// void SubtitlesGrid::OnSetVideoToEnd(wxCommandEvent &event) { BeginBatch(); SetVideoToSubs(false); @@ -583,8 +632,11 @@ void SubtitlesGrid::OnSetVideoToEnd(wxCommandEvent &event) { } -////////////// -// Recombine + +/// @brief Recombine +/// @param event +/// @return +/// void SubtitlesGrid::OnRecombine(wxCommandEvent &event) { // Get selection bool cont; @@ -664,8 +716,11 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) { -////////////// -// Export audio clip of line + +/// @brief Export audio clip of line +/// @param event +/// @return +/// void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) { int64_t num_samples,start=0,end=0,temp; AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay; @@ -743,8 +798,10 @@ void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) { outfile.close(); } } -////////////////////////////////////// -// Clears grid and sets it to default + +/// @brief Clears grid and sets it to default +/// @param _ass +/// void SubtitlesGrid::LoadDefault (AssFile *_ass) { if (_ass) { ass = _ass; @@ -754,8 +811,12 @@ void SubtitlesGrid::LoadDefault (AssFile *_ass) { } -///////////////////////////////////// -// Read data from ASS file structure + +/// @brief Read data from ASS file structure +/// @param _ass +/// @param keepSelection +/// @param dontModify +/// void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModify) { // Store selected rows std::vector srows; @@ -837,8 +898,12 @@ void SubtitlesGrid::LoadFromAss (AssFile *_ass,bool keepSelection,bool dontModif } -/////////////////// -// Swaps two lines + +/// @brief Swaps two lines +/// @param n1 +/// @param n2 +/// @return +/// void SubtitlesGrid::SwapLines(int n1,int n2) { // Check bounds and get iterators int rows = GetRows(); @@ -859,8 +924,13 @@ void SubtitlesGrid::SwapLines(int n1,int n2) { } -///////////////// -// Insert a line + +/// @brief Insert a line +/// @param line +/// @param n +/// @param after +/// @param update +/// void SubtitlesGrid::InsertLine(AssDialogue *line,int n,bool after,bool update) { // Check bounds and get iterators entryIter pos = diagMap.at(n); @@ -887,8 +957,10 @@ void SubtitlesGrid::InsertLine(AssDialogue *line,int n,bool after,bool update) { } -/////////////////////////// -// Copy lines to clipboard + +/// @brief Copy lines to clipboard +/// @param target +/// void SubtitlesGrid::CopyLines(wxArrayInt target) { // Prepare text wxString data = _T(""); @@ -910,8 +982,10 @@ void SubtitlesGrid::CopyLines(wxArrayInt target) { } -//////////////////// -// Cut to clipboard + +/// @brief Cut to clipboard +/// @param target +/// void SubtitlesGrid::CutLines(wxArrayInt target) { BeginBatch(); CopyLines(target); @@ -920,8 +994,12 @@ void SubtitlesGrid::CutLines(wxArrayInt target) { } -////////////////////////////// -// Paste lines from clipboard + +/// @brief Paste lines from clipboard +/// @param n +/// @param pasteOver +/// @return +/// void SubtitlesGrid::PasteLines(int n,bool pasteOver) { BeginBatch(); @@ -1027,8 +1105,11 @@ void SubtitlesGrid::PasteLines(int n,bool pasteOver) { } -///////////////////////// -// Delete selected lines + +/// @brief Delete selected lines +/// @param target +/// @param flagModified +/// void SubtitlesGrid::DeleteLines(wxArrayInt target, bool flagModified) { // Check if it's wiping file int deleted = 0; @@ -1062,8 +1143,12 @@ void SubtitlesGrid::DeleteLines(wxArrayInt target, bool flagModified) { } -//////////////////////// -// Joins selected lines + +/// @brief Joins selected lines +/// @param n1 +/// @param n2 +/// @param concat +/// void SubtitlesGrid::JoinLines(int n1,int n2,bool concat) { // Initialize int min_ms = 0x0FFFFFFF; @@ -1118,8 +1203,13 @@ void SubtitlesGrid::JoinLines(int n1,int n2,bool concat) { } -////////////////////////// -// Adjoins selected lines + +/// @brief Adjoins selected lines +/// @param n1 +/// @param n2 +/// @param setStart +/// @return +/// void SubtitlesGrid::AdjoinLines(int n1,int n2,bool setStart) { // Set start if (setStart) { @@ -1153,8 +1243,11 @@ void SubtitlesGrid::AdjoinLines(int n1,int n2,bool setStart) { } -/////////////////////////////////// -// Joins selected lines as karaoke + +/// @brief Joins selected lines as karaoke +/// @param n1 +/// @param n2 +/// void SubtitlesGrid::JoinAsKaraoke(int n1,int n2) { // Initialize wxString finalText = _T(""); @@ -1202,8 +1295,12 @@ void SubtitlesGrid::JoinAsKaraoke(int n1,int n2) { } -/////////////////// -// Duplicate lines + +/// @brief Duplicate lines +/// @param n1 +/// @param n2 +/// @param nextFrame +/// void SubtitlesGrid::DuplicateLines(int n1,int n2,bool nextFrame) { AssDialogue *cur; bool update = false; @@ -1237,14 +1334,16 @@ void SubtitlesGrid::DuplicateLines(int n1,int n2,bool nextFrame) { } -/////////////////////// -// Shifts line by time -// ------------------- -// Where type = -// 0: Start + End -// 1: Start -// 2: End -// + +/// @brief Shifts line by time +/// @param n +/// @param len +/// @param type +/// +/// Where type = +/// - 0: Start + End +/// - 1: Start +/// - 2: End void SubtitlesGrid::ShiftLineByTime(int n,int len,int type) { AssDialogue *cur = GetDialogue(n); @@ -1258,14 +1357,13 @@ void SubtitlesGrid::ShiftLineByTime(int n,int len,int type) { } -//////////////////////// -// Shifts line by frame -// ------------------- -// Where type = -// 0: Start + End -// 1: Start -// 2: End -// + +/// @brief Shifts line by Frame +/// @param n +/// @param len +/// @param type +/// +/// @see ShiftLineByTime() void SubtitlesGrid::ShiftLineByFrames(int n,int len,int type) { AssDialogue *cur = GetDialogue(n); @@ -1279,8 +1377,14 @@ void SubtitlesGrid::ShiftLineByFrames(int n,int len,int type) { } -////////////// -// Split line + +/// @brief Split line +/// @param n +/// @param pos +/// @param mode +/// @param textIn +/// @return +/// void SubtitlesGrid::SplitLine(int n,int pos,int mode,wxString textIn) { // Split AssDialogue *n1,*n2; @@ -1323,13 +1427,11 @@ void SubtitlesGrid::SplitLine(int n,int pos,int mode,wxString textIn) { } -////////////////// -// Split line by karaoke -// --------------------- -// Splits the line into as many new lines as there are karaoke syllables, -// timed as the syllables. -// DOES NOT FLAG AS MODIFIED OR COMMIT CHANGES -// Returns true if changes were made. + +/// @brief Returns true if changes were made. DOES NOT FLAG AS MODIFIED OR COMMIT CHANGES timed as the syllables. Splits the line into as many new lines as there are karaoke syllables, --------------------- Split line by karaoke +/// @param lineNumber +/// @return +/// bool SubtitlesGrid::SplitLineByKaraoke(int lineNumber) { AssDialogue *line = GetDialogue(lineNumber); @@ -1371,10 +1473,11 @@ bool SubtitlesGrid::SplitLineByKaraoke(int lineNumber) { } -////////////////// -// Commit changes -// -------------- -// This will save the work .ass and refresh it + +/// @brief This will save the work .ass and refresh it -------------- Commit changes +/// @param force +/// @param videoOnly +/// void SubtitlesGrid::CommitChanges(bool force,bool videoOnly) { if (VideoContext::Get()->IsLoaded() || force) { // Check if it's playing @@ -1409,8 +1512,11 @@ void SubtitlesGrid::CommitChanges(bool force,bool videoOnly) { } -////////////////////////// -// Set start to video pos + +/// @brief Set start to video pos +/// @param start +/// @return +/// void SubtitlesGrid::SetSubsToVideo(bool start) { // Check if it's OK to do it if (!VFR_Output.IsLoaded()) return; @@ -1441,8 +1547,11 @@ void SubtitlesGrid::SetSubsToVideo(bool start) { } -////////////////////////////// -// Set video pos to start/end + +/// @brief Set video pos to start/end +/// @param start +/// @return +/// void SubtitlesGrid::SetVideoToSubs(bool start) { wxArrayInt sel = GetSelection(); if (sel.Count() == 0) return; @@ -1456,9 +1565,10 @@ void SubtitlesGrid::SetVideoToSubs(bool start) { } -///////////////////////////////////////////////////////////////////// -// Retrieve a list of selected lines in the actual ASS file -// (ie. not as displayed in the grid but as represented in the file) + +/// @brief (ie. not as displayed in the grid but as represented in the file) Retrieve a list of selected lines in the actual ASS file +/// @return +/// std::vector SubtitlesGrid::GetAbsoluteSelection() { std::vector result; result.reserve(GetNumberSelection()); @@ -1481,9 +1591,10 @@ std::vector SubtitlesGrid::GetAbsoluteSelection() { } -///////////////////////////////////////////////////////////////////// -// Update list of selected lines from absolute selection -// selection vector must be sorted + +/// @brief selection vector must be sorted Update list of selected lines from absolute selection +/// @param selection +/// void SubtitlesGrid::SetSelectionFromAbsolute(std::vector &selection) { int nrows = GetRows(); @@ -1498,3 +1609,4 @@ void SubtitlesGrid::SetSelectionFromAbsolute(std::vector &selection) { } } + diff --git a/aegisub/src/subs_grid.h b/aegisub/src/subs_grid.h index c780265b6..70d7a6c84 100644 --- a/aegisub/src/subs_grid.h +++ b/aegisub/src/subs_grid.h @@ -61,15 +61,21 @@ class FrameMain; class AudioDisplay; -//////////// -// Typedefs + +/// DOCME typedef std::list::iterator entryIter; -////////////// -// Main class + +/// DOCME +/// @class SubtitlesGrid +/// @brief DOCME +/// +/// DOCME class SubtitlesGrid: public BaseGrid { private: + + /// DOCME bool ready; void OnPopupMenu(bool alternate=false); @@ -101,6 +107,8 @@ private: void OnShowColMenu(wxCommandEvent &event); public: + + /// DOCME 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); @@ -141,31 +149,84 @@ public: /////// // IDs enum { + + /// DOCME MENU_GRID_START = 1200, + + /// DOCME MENU_INSERT_BEFORE, + + /// DOCME MENU_INSERT_AFTER, + + /// DOCME MENU_INSERT_BEFORE_VIDEO, + + /// DOCME MENU_INSERT_AFTER_VIDEO, + + /// DOCME MENU_SWAP, + + /// DOCME MENU_DUPLICATE, + + /// DOCME MENU_DUPLICATE_NEXT_FRAME, + + /// DOCME MENU_SPLIT_BY_KARAOKE, + + /// DOCME MENU_COPY, + + /// DOCME MENU_PASTE, + + /// DOCME MENU_CUT, + + /// DOCME MENU_DELETE, + + /// DOCME MENU_JOIN_CONCAT, + + /// DOCME MENU_JOIN_REPLACE, + + /// DOCME MENU_ADJOIN, + + /// DOCME MENU_ADJOIN2, + + /// DOCME MENU_JOIN_AS_KARAOKE, + + /// DOCME MENU_RECOMBINE, + + /// DOCME MENU_SET_START_TO_VIDEO, + + /// DOCME MENU_SET_END_TO_VIDEO, + + /// DOCME MENU_SET_VIDEO_TO_START, + + /// DOCME MENU_SET_VIDEO_TO_END, + + /// DOCME MENU_GRID_END, + + /// DOCME MENU_AUDIOCLIP, + + /// DOCME MENU_SHOW_COL = 1250 // Don't put anything after this }; + diff --git a/aegisub/src/subs_preview.cpp b/aegisub/src/subs_preview.cpp index 027f5ff21..7bb4483ec 100644 --- a/aegisub/src/subs_preview.cpp +++ b/aegisub/src/subs_preview.cpp @@ -49,8 +49,15 @@ #include "ass_file.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param pos +/// @param size +/// @param winStyle +/// @param col +/// SubtitlesPreview::SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize size,int winStyle,wxColour col) : wxWindow(parent,id,pos,size,winStyle) { @@ -65,8 +72,9 @@ SubtitlesPreview::SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize si } -////////////// -// Destructor + +/// @brief Destructor +/// SubtitlesPreview::~SubtitlesPreview() { delete bmp; bmp = NULL; @@ -77,8 +85,11 @@ SubtitlesPreview::~SubtitlesPreview() { } -///////////// -// Set style + +/// @brief Set style +/// @param _style +/// @return +/// void SubtitlesPreview::SetStyle(AssStyle *_style) { // Prepare style AssStyle *tmpStyle = AssEntry::GetAsStyle(_style->Clone()); @@ -103,8 +114,10 @@ void SubtitlesPreview::SetStyle(AssStyle *_style) { } -//////////// -// Set text + +/// @brief Set text +/// @param text +/// void SubtitlesPreview::SetText(wxString text) { if (text != showText) { showText = text; @@ -113,8 +126,12 @@ void SubtitlesPreview::SetText(wxString text) { } -//////////////// -// Update image + +/// @brief Update image +/// @param w +/// @param h +/// @return +/// void SubtitlesPreview::UpdateBitmap(int w,int h) { // Visible? if (!IsShownOnScreen()) return; @@ -190,8 +207,10 @@ BEGIN_EVENT_TABLE(SubtitlesPreview,wxWindow) END_EVENT_TABLE() -/////////////// -// Paint event + +/// @brief Paint event +/// @param event +/// void SubtitlesPreview::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); if (!bmp) UpdateBitmap(); @@ -199,8 +218,10 @@ void SubtitlesPreview::OnPaint(wxPaintEvent &event) { } -////////////// -// Size event + +/// @brief Size event +/// @param event +/// void SubtitlesPreview::OnSize(wxSizeEvent &event) { delete vid; vid = NULL; @@ -208,8 +229,10 @@ void SubtitlesPreview::OnSize(wxSizeEvent &event) { } -////////////// -// Set colour + +/// @brief Set colour +/// @param col +/// void SubtitlesPreview::SetColour(wxColour col) { backColour = col; delete vid; @@ -217,3 +240,4 @@ void SubtitlesPreview::SetColour(wxColour col) { UpdateBitmap(); } + diff --git a/aegisub/src/subs_preview.h b/aegisub/src/subs_preview.h index 0912e8075..fa84321c8 100644 --- a/aegisub/src/subs_preview.h +++ b/aegisub/src/subs_preview.h @@ -51,14 +51,28 @@ class AssStyle; class VideoProvider; -///////////////////////// -// Subtitles preview box + +/// DOCME +/// @class SubtitlesPreview +/// @brief DOCME +/// +/// DOCME class SubtitlesPreview : public wxWindow { private: + + /// DOCME wxBitmap *bmp; + + /// DOCME AssStyle *style; + + /// DOCME wxString showText; + + /// DOCME VideoProvider *vid; + + /// DOCME wxColour backColour; void UpdateBitmap(int w=-1,int h=-1); @@ -69,6 +83,9 @@ public: void SetStyle(AssStyle *style); void SetText(wxString text); void SetColour(wxColour col); + + /// @brief DOCME + /// void Update() { UpdateBitmap(); } SubtitlesPreview(wxWindow *parent,int id,wxPoint pos,wxSize size,int style,wxColour colour); @@ -77,3 +94,4 @@ public: DECLARE_EVENT_TABLE() }; + diff --git a/aegisub/src/subtitle_format.cpp b/aegisub/src/subtitle_format.cpp index a25e924f5..a51bb5d13 100644 --- a/aegisub/src/subtitle_format.cpp +++ b/aegisub/src/subtitle_format.cpp @@ -55,8 +55,9 @@ #include "vfr.h" -/////////////// -// Constructor + +/// @brief Constructor +/// SubtitleFormat::SubtitleFormat() { Line = NULL; Register(); @@ -64,21 +65,26 @@ SubtitleFormat::SubtitleFormat() { } -////////////// -// Destructor + +/// @brief Destructor +/// SubtitleFormat::~SubtitleFormat () { Remove(); } -//////// -// List + +/// DOCME std::list SubtitleFormat::formats; + +/// DOCME bool SubtitleFormat::loaded = false; -////////////// -// Set target + +/// @brief Set target +/// @param file +/// void SubtitleFormat::SetTarget(AssFile *file) { ClearCopy(); if (!file) Line = NULL; @@ -87,16 +93,18 @@ void SubtitleFormat::SetTarget(AssFile *file) { } -/////////////// -// Create copy + +/// @brief Create copy +/// void SubtitleFormat::CreateCopy() { SetTarget(new AssFile(*assFile)); isCopy = true; } -////////////// -// Clear copy + +/// @brief Clear copy +/// void SubtitleFormat::ClearCopy() { if (isCopy) { delete assFile; @@ -106,29 +114,40 @@ void SubtitleFormat::ClearCopy() { } -/////////////////// -// Clear subtitles + +/// @brief Clear subtitles +/// void SubtitleFormat::Clear() { assFile->Clear(); } -//////////////// -// Load default + +/// @brief Load default +/// @param defline +/// void SubtitleFormat::LoadDefault(bool defline) { assFile->LoadDefault(defline); } -//////////// -// Add line + +/// @brief Add line +/// @param data +/// @param group +/// @param lasttime +/// @param version +/// @param outgroup +/// @return +/// int SubtitleFormat::AddLine(wxString data,wxString group,int lasttime,int &version,wxString *outgroup) { return assFile->AddLine(data,group,lasttime,version,outgroup); } -/////////////// -// Add formats + +/// @brief Add formats +/// void SubtitleFormat::LoadFormats () { if (!loaded) { new ASSSubtitleFormat(); @@ -147,8 +166,9 @@ void SubtitleFormat::LoadFormats () { } -/////////////////// -// Destroy formats + +/// @brief Destroy formats +/// void SubtitleFormat::DestroyFormats () { std::list::iterator cur; for (cur=formats.begin();cur!=formats.end();cur = formats.begin()) { @@ -158,8 +178,11 @@ void SubtitleFormat::DestroyFormats () { } -///////////////////////////// -// Get an appropriate reader + +/// @brief Get an appropriate reader +/// @param filename +/// @return +/// SubtitleFormat *SubtitleFormat::GetReader(wxString filename) { LoadFormats(); std::list::iterator cur; @@ -172,8 +195,11 @@ SubtitleFormat *SubtitleFormat::GetReader(wxString filename) { } -///////////////////////////// -// Get an appropriate writer + +/// @brief Get an appropriate writer +/// @param filename +/// @return +/// SubtitleFormat *SubtitleFormat::GetWriter(wxString filename) { LoadFormats(); std::list::iterator cur; @@ -186,8 +212,10 @@ SubtitleFormat *SubtitleFormat::GetWriter(wxString filename) { } -//////////// -// Register + +/// @brief Register +/// @return +/// void SubtitleFormat::Register() { std::list::iterator cur; for (cur=formats.begin();cur!=formats.end();cur++) { @@ -197,8 +225,10 @@ void SubtitleFormat::Register() { } -////////// -// Remove + +/// @brief Remove +/// @return +/// void SubtitleFormat::Remove() { std::list::iterator cur; for (cur=formats.begin();cur!=formats.end();cur++) { @@ -210,22 +240,29 @@ void SubtitleFormat::Remove() { } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString SubtitleFormat::GetReadWildcards() { return wxArrayString(); } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString SubtitleFormat::GetWriteWildcards() { return wxArrayString(); } -///////////////////// -// Get wildcard list + +/// @brief Get wildcard list +/// @param mode +/// @return +/// wxString SubtitleFormat::GetWildcards(int mode) { // Ensure it's loaded LoadFormats(); @@ -278,8 +315,11 @@ wxString SubtitleFormat::GetWildcards(int mode) { } -///////////////////////////////// -// Ask the user to enter the FPS + +/// @brief Ask the user to enter the FPS +/// @param showSMPTE +/// @return +/// SubtitleFormat::FPSRational SubtitleFormat::AskForFPS(bool showSMPTE) { wxArrayString choices; FPSRational fps_rat; @@ -365,15 +405,19 @@ SubtitleFormat::FPSRational SubtitleFormat::AskForFPS(bool showSMPTE) { } -////////////// -// Sort lines + +/// @brief Sort lines +/// void SubtitleFormat::SortLines() { Line->sort(LessByPointedToValue()); } -//////////////// -// Convert tags + +/// @brief Convert tags +/// @param format +/// @param lineEnd +/// void SubtitleFormat::ConvertTags(int format,wxString lineEnd) { using std::list; list::iterator next; @@ -394,8 +438,9 @@ void SubtitleFormat::ConvertTags(int format,wxString lineEnd) { } -//////////////////////////// -// Remove all comment lines + +/// @brief Remove all comment lines +/// void SubtitleFormat::StripComments() { using std::list; list::iterator next; @@ -413,8 +458,9 @@ void SubtitleFormat::StripComments() { } -///////////////////////////////// -// Remove all non-dialogue lines + +/// @brief Remove all non-dialogue lines +/// void SubtitleFormat::StripNonDialogue() { using std::list; list::iterator next; @@ -431,8 +477,12 @@ void SubtitleFormat::StripNonDialogue() { } -/////////////////////////////////////////// -// Helper function for RecombineOverlaps() + +/// @brief Helper function for RecombineOverlaps() +/// @param list +/// @param next +/// @param newdlg +/// static void InsertLineSortedIntoList(std::list &list, std::list::iterator next, AssDialogue *newdlg) { std::list::iterator insertpos = next; bool inserted = false; @@ -450,9 +500,9 @@ static void InsertLineSortedIntoList(std::list &list, std::list::iterator next; @@ -529,8 +579,9 @@ void SubtitleFormat::RecombineOverlaps() { } -//////////////////////////////////////////////// -// Merge identical lines that follow each other + +/// @brief Merge identical lines that follow each other +/// void SubtitleFormat::MergeIdentical() { using std::list; list::iterator next; @@ -557,3 +608,4 @@ void SubtitleFormat::MergeIdentical() { } + diff --git a/aegisub/src/subtitle_format.h b/aegisub/src/subtitle_format.h index de20938f7..553eef36c 100644 --- a/aegisub/src/subtitle_format.h +++ b/aegisub/src/subtitle_format.h @@ -52,26 +52,48 @@ class AssFile; class AssEntry; -/////////////////// -// Subtitle reader + +/// DOCME +/// @class SubtitleFormat +/// @brief DOCME +/// +/// DOCME class SubtitleFormat { private: + + /// DOCME bool isCopy; + + /// DOCME AssFile *assFile; void Register(); void Remove(); + + /// DOCME static std::list formats; + + /// DOCME static bool loaded; protected: + + /// DOCME struct FPSRational { + + /// DOCME int num; + + /// DOCME int den; + + /// DOCME bool smpte_dropframe; }; + + /// DOCME std::list *Line; void CreateCopy(); @@ -86,6 +108,10 @@ protected: void Clear(); void LoadDefault(bool defline=true); + + /// @brief DOCME + /// @return + /// AssFile *GetAssFile() { return assFile; } int AddLine(wxString data,wxString group,int lasttime,int &version,wxString *outgroup=NULL); FPSRational AskForFPS(bool showSMPTE=false); @@ -101,9 +127,29 @@ public: static wxString GetWildcards(int mode); + + /// @brief DOCME + /// @param filename + /// @return + /// virtual bool CanReadFile(wxString filename) { return false; }; + + /// @brief DOCME + /// @param filename + /// @return + /// virtual bool CanWriteFile(wxString filename) { return false; }; + + /// @brief DOCME + /// @param filename + /// @param forceEncoding=_T(Ó) + /// virtual void ReadFile(wxString filename,wxString forceEncoding=_T("")) { }; + + /// @brief DOCME + /// @param filename + /// @param encoding=_T(Ó) + /// virtual void WriteFile(wxString filename,wxString encoding=_T("")) { }; static SubtitleFormat *GetReader(wxString filename); @@ -112,3 +158,4 @@ public: static void DestroyFormats(); }; + diff --git a/aegisub/src/subtitle_format_ass.cpp b/aegisub/src/subtitle_format_ass.cpp index aa8b15d34..236310996 100644 --- a/aegisub/src/subtitle_format_ass.cpp +++ b/aegisub/src/subtitle_format_ass.cpp @@ -45,22 +45,29 @@ #include "ass_dialogue.h" -///////////// -// Can read? + +/// @brief Can read? +/// @param filename +/// @return +/// bool ASSSubtitleFormat::CanReadFile(wxString filename) { return (filename.Right(4).Lower() == _T(".ass") || filename.Right(4).Lower() == _T(".ssa")); } -//////////// -// Get name + +/// @brief Get name +/// @return +/// wxString ASSSubtitleFormat::GetName() { return _T("Advanced Substation Alpha"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString ASSSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("ass")); @@ -69,8 +76,10 @@ wxArrayString ASSSubtitleFormat::GetReadWildcards() { } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString ASSSubtitleFormat::GetWriteWildcards() { wxArrayString formats; formats.Add(_T("ass")); @@ -79,8 +88,11 @@ wxArrayString ASSSubtitleFormat::GetWriteWildcards() { } -///////////// -// Read file + +/// @brief Read file +/// @param filename +/// @param encoding +/// void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using namespace std; @@ -151,15 +163,21 @@ void ASSSubtitleFormat::ReadFile(wxString filename,wxString encoding) { } -////////////////////// -// Can write to file? + +/// @brief Can write to file? +/// @param filename +/// @return +/// bool ASSSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(4).Lower() == _T(".ass") || filename.Right(4).Lower() == _T(".ssa")); } -////////////// -// Write file + +/// @brief Write file +/// @param _filename +/// @param encoding +/// void ASSSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { // Open file TextFileWriter file(_filename,encoding); @@ -182,3 +200,4 @@ void ASSSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { } } + diff --git a/aegisub/src/subtitle_format_ass.h b/aegisub/src/subtitle_format_ass.h index 372dc060e..5326691ea 100644 --- a/aegisub/src/subtitle_format_ass.h +++ b/aegisub/src/subtitle_format_ass.h @@ -48,8 +48,12 @@ class AssDialogue; -///////////////////// -// ASS reader/writer + +/// DOCME +/// @class ASSSubtitleFormat +/// @brief DOCME +/// +/// DOCME class ASSSubtitleFormat : public SubtitleFormat { public: wxString GetName(); @@ -63,3 +67,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_dvd.cpp b/aegisub/src/subtitle_format_dvd.cpp index fb44016cf..22377ffc2 100644 --- a/aegisub/src/subtitle_format_dvd.cpp +++ b/aegisub/src/subtitle_format_dvd.cpp @@ -44,6 +44,8 @@ #include "subtitles_provider_manager.h" #include "ass_dialogue.h" #include "ass_file.h" + +/// DOCME #undef _OPENMP #ifdef _OPENMP #include @@ -56,15 +58,19 @@ //#pragma comment(lib, "tessdll.lib") -/////////////// -// Format name + +/// @brief Format name +/// @return +/// wxString DVDSubtitleFormat::GetName() { return _T("DVD Subpictures"); } -////////////// -// Extensions + +/// @brief Extensions +/// @return +/// wxArrayString DVDSubtitleFormat::GetWriteWildcards() { wxArrayString results; results.Add(_T("sup")); @@ -72,15 +78,20 @@ wxArrayString DVDSubtitleFormat::GetWriteWildcards() { } -///////////// -// Can write + +/// @brief Can write +/// @param filename +/// @return +/// bool DVDSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Lower().EndsWith(_T(".sup"))); } -/////////////////////// -// Get subpicture list + +/// @brief Get subpicture list +/// @param pics +/// void DVDSubtitleFormat::GetSubPictureList(std::vector &pics) { // Create video frame int w = 720; @@ -344,8 +355,11 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector &pics) { } -/////////////////////// -// Actually write them + +/// @brief Actually write them +/// @param filename +/// @param encoding +/// void DVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) { // Prepare subtitles CreateCopy(); @@ -431,3 +445,4 @@ void DVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) { } } + diff --git a/aegisub/src/subtitle_format_dvd.h b/aegisub/src/subtitle_format_dvd.h index 62499d569..2dd415cfd 100644 --- a/aegisub/src/subtitle_format_dvd.h +++ b/aegisub/src/subtitle_format_dvd.h @@ -43,26 +43,57 @@ #include "subtitle_format.h" -////////////////// -// Helper classes + +/// DOCME struct SubPicture { - //wxImage img; + + /// DOCME std::vector data[2]; + + /// DOCME + + /// DOCME int x,y; + + /// DOCME + + /// DOCME int w,h; + + /// DOCME + + /// DOCME int start,end; }; + +/// DOCME struct RLEGroup { + + /// DOCME int col; + + /// DOCME int len; + + /// DOCME bool eol; + + /// @brief DOCME + /// @param _col + /// @param _len + /// @param _eol + /// RLEGroup(int _col,int _len,bool _eol) { col = _col; len = _len; eol = _eol; } }; -////////////////////////// -// DVD subpictures writer + +/// DOCME +/// @class DVDSubtitleFormat +/// @brief DOCME +/// +/// DOCME class DVDSubtitleFormat : public SubtitleFormat { private: void GetSubPictureList(std::vector &pics); @@ -74,3 +105,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_encore.cpp b/aegisub/src/subtitle_format_encore.cpp index f0e019500..a2ea9b0f3 100644 --- a/aegisub/src/subtitle_format_encore.cpp +++ b/aegisub/src/subtitle_format_encore.cpp @@ -44,15 +44,19 @@ #include "text_file_writer.h" -//////// -// Name + +/// @brief Name +/// @return +/// wxString EncoreSubtitleFormat::GetName() { return _T("Adobe Encore"); } -///////////// -// Wildcards + +/// @brief Wildcards +/// @return +/// wxArrayString EncoreSubtitleFormat::GetWriteWildcards() { wxArrayString formats; formats.Add(_T("encore.txt")); @@ -60,15 +64,21 @@ wxArrayString EncoreSubtitleFormat::GetWriteWildcards() { } -/////////////////// -// Can write file? + +/// @brief Can write file? +/// @param filename +/// @return +/// bool EncoreSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(11).Lower() == _T(".encore.txt")); } -////////////// -// Write file + +/// @brief Write file +/// @param _filename +/// @param encoding +/// void EncoreSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { // Get FPS FPSRational fps_rat = AskForFPS(true); @@ -104,3 +114,4 @@ void EncoreSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { ClearCopy(); } + diff --git a/aegisub/src/subtitle_format_encore.h b/aegisub/src/subtitle_format_encore.h index 9762d5068..340303078 100644 --- a/aegisub/src/subtitle_format_encore.h +++ b/aegisub/src/subtitle_format_encore.h @@ -43,8 +43,12 @@ #include "subtitle_format.h" -/////////////////////// -// Adobe Encore writer + +/// DOCME +/// @class EncoreSubtitleFormat +/// @brief DOCME +/// +/// DOCME class EncoreSubtitleFormat : public SubtitleFormat { public: wxString GetName(); @@ -53,3 +57,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_microdvd.cpp b/aegisub/src/subtitle_format_microdvd.cpp index 3c09d0f2a..0f759a936 100644 --- a/aegisub/src/subtitle_format_microdvd.cpp +++ b/aegisub/src/subtitle_format_microdvd.cpp @@ -48,15 +48,19 @@ #include -/////////////////// -// Get format name + +/// @brief Get format name +/// @return +/// wxString MicroDVDSubtitleFormat::GetName() { return _T("MicroDVD"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString MicroDVDSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("sub")); @@ -64,15 +68,20 @@ wxArrayString MicroDVDSubtitleFormat::GetReadWildcards() { } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString MicroDVDSubtitleFormat::GetWriteWildcards() { return GetReadWildcards(); } -//////////////////// -// Can read a file? + +/// @brief Can read a file? +/// @param filename +/// @return +/// bool MicroDVDSubtitleFormat::CanReadFile(wxString filename) { // Return false immediately if extension is wrong if (filename.Right(4).Lower() != _T(".sub")) return false; @@ -88,15 +97,22 @@ bool MicroDVDSubtitleFormat::CanReadFile(wxString filename) { } -///////////////////// -// Can write a file? + +/// @brief Can write a file? +/// @param filename +/// @return +/// bool MicroDVDSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(4).Lower() == _T(".sub")); } -/////////////// -// Read a file + +/// @brief Read a file +/// @param filename +/// @param forceEncoding +/// @return +/// void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) { // Load and prepare regexp TextFileReader file(filename); @@ -167,8 +183,11 @@ void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) } -//////////////// -// Write a file + +/// @brief Write a file +/// @param filename +/// @param encoding +/// void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) { // Set FPS FrameRate cfr; @@ -213,3 +232,4 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) { ClearCopy(); } + diff --git a/aegisub/src/subtitle_format_microdvd.h b/aegisub/src/subtitle_format_microdvd.h index ba25ef042..7cb270dec 100644 --- a/aegisub/src/subtitle_format_microdvd.h +++ b/aegisub/src/subtitle_format_microdvd.h @@ -43,8 +43,12 @@ #include "subtitle_format.h" -////////////////////////// -// MicroDVD reader/writer + +/// DOCME +/// @class MicroDVDSubtitleFormat +/// @brief DOCME +/// +/// DOCME class MicroDVDSubtitleFormat : public SubtitleFormat { public: wxString GetName(); @@ -58,3 +62,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_mkv.cpp b/aegisub/src/subtitle_format_mkv.cpp index e3ce7b970..ad8a4b409 100644 --- a/aegisub/src/subtitle_format_mkv.cpp +++ b/aegisub/src/subtitle_format_mkv.cpp @@ -45,8 +45,11 @@ #include "ass_file.h" -///////////// -// Can read? + +/// @brief Can read? +/// @param filename +/// @return +/// bool MKVSubtitleFormat::CanReadFile(wxString filename) { if (filename.Right(4).Lower() == _T(".mkv") || filename.Right(4).Lower() == _T(".mks") || filename.Right(4).Lower() == _T(".mka")) @@ -56,15 +59,19 @@ bool MKVSubtitleFormat::CanReadFile(wxString filename) { } -//////////// -// Get name + +/// @brief Get name +/// @return +/// wxString MKVSubtitleFormat::GetName() { return _T("Matroska"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString MKVSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("mkv")); @@ -74,8 +81,11 @@ wxArrayString MKVSubtitleFormat::GetReadWildcards() { } -///////////// -// Read file + +/// @brief Read file +/// @param filename +/// @param encoding +/// void MKVSubtitleFormat::ReadFile(wxString filename,wxString encoding) { // Open matroska MatroskaWrapper wrap; @@ -89,15 +99,22 @@ void MKVSubtitleFormat::ReadFile(wxString filename,wxString encoding) { } -////////////////////// -// Can write to file? + +/// @brief Can write to file? +/// @param filename +/// @return +/// bool MKVSubtitleFormat::CanWriteFile(wxString filename) { return false; } -////////////// -// Write file + +/// @brief Write file +/// @param _filename +/// @param encoding +/// void MKVSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { } + diff --git a/aegisub/src/subtitle_format_mkv.h b/aegisub/src/subtitle_format_mkv.h index 8e16d6a01..28d6594e0 100644 --- a/aegisub/src/subtitle_format_mkv.h +++ b/aegisub/src/subtitle_format_mkv.h @@ -48,8 +48,12 @@ class AssDialogue; -///////////////////// -// ASS reader/writer + +/// DOCME +/// @class MKVSubtitleFormat +/// @brief DOCME +/// +/// DOCME class MKVSubtitleFormat : public SubtitleFormat { public: wxString GetName(); @@ -62,3 +66,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_prs.cpp b/aegisub/src/subtitle_format_prs.cpp index 52a3acff1..1d4a0a834 100644 --- a/aegisub/src/subtitle_format_prs.cpp +++ b/aegisub/src/subtitle_format_prs.cpp @@ -62,8 +62,11 @@ #include "../prs/prs.h" -////////////////////// -// Can write to file? + +/// @brief Can write to file? +/// @param filename +/// @return +/// bool PRSSubtitleFormat::CanWriteFile(wxString filename) { #ifdef __WINDOWS__ return false; @@ -74,15 +77,19 @@ bool PRSSubtitleFormat::CanWriteFile(wxString filename) { } -//////////// -// Get name + +/// @brief Get name +/// @return +/// wxString PRSSubtitleFormat::GetName() { return _T("Pre-Rendered Subtitles"); } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString PRSSubtitleFormat::GetWriteWildcards() { wxArrayString formats; formats.Add(_T("prs")); @@ -90,8 +97,12 @@ wxArrayString PRSSubtitleFormat::GetWriteWildcards() { } -////////////// -// Write file + +/// @brief Write file +/// @param filename +/// @param encoding +/// @return +/// void PRSSubtitleFormat::WriteFile(wxString filename,wxString encoding) { #ifdef __WINDOWS__ // Video loaded? @@ -215,8 +226,16 @@ void PRSSubtitleFormat::WriteFile(wxString filename,wxString encoding) { } -////////////////////////// -// Insert frame into file + +/// @brief Insert frame into file +/// @param file +/// @param framen +/// @param frames +/// @param bmp +/// @param x +/// @param y +/// @param maxalpha +/// void PRSSubtitleFormat::InsertFrame(PRSFile &file,int &framen,std::vector &frames,wxImage &bmp,int x,int y,int maxalpha) { // Generic data holder size_t datasize = 0; @@ -346,8 +365,11 @@ void PRSSubtitleFormat::InsertFrame(PRSFile &file,int &framen,std::vector & } -/////////////////////////////////// -// Get rectangles of useful glyphs + +/// @brief Get rectangles of useful glyphs +/// @param image +/// @param rects +/// void PRSSubtitleFormat::GetSubPictureRectangles(wxImage &image,std::vector &rects) { // Boundaries int w = image.GetWidth(); @@ -402,8 +424,10 @@ void PRSSubtitleFormat::GetSubPictureRectangles(wxImage &image,std::vector PRSSubtitleFormat::GetFrameRanges() { // Loop through subtitles in file std::vector frames; @@ -485,14 +509,14 @@ std::vector PRSSubtitleFormat::GetFrameRanges() { } -///////////////////////////////////////////// -// Optimize the image by tweaking the colors -// First, a little macro to help the comparisons down there + +/// DOCME #define IN_ERROR_MARGIN(col1,col2,error) ((col1 > col2 ? ((int)(col1-col2)) : ((int)(col2-col1))) <= (error)) -// Now, since I don't expect anyone to be able to decypher this... -// This "flood fills" the image based on alpha, to make it easier to compress, without affecting visual quality -// e.g. if you have a pixel with 25% opacity, then a difference of as much as 3 in the color channels won't have a visual impact + +/// @brief e.g. if you have a pixel with 25% opacity, then a difference of as much as 3 in the color channels won't have a visual impact This "flood fills" the image based on alpha, to make it easier to compress, without affecting visual quality Now, since I don't expect anyone to be able to decypher this... +/// @param image +/// void PRSSubtitleFormat::OptimizeImage(wxImage &image) { // Get the raw data unsigned char *data = (unsigned char*) image.GetData(); @@ -650,11 +674,18 @@ void PRSSubtitleFormat::OptimizeImage(wxImage &image) { /////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////// -// Generates a 32-bit wxImage from two frames -// ------------------------------------------ -// Frame 1 should have the image on a BLACK background -// Frame 2 should have the same image on a WHITE background + +/// @brief Frame 2 should have the same image on a WHITE background Frame 1 should have the image on a BLACK background ------------------------------------------ Generates a 32-bit wxImage from two frames +/// @param frame1 +/// @param frame2 +/// @param w +/// @param h +/// @param pitch +/// @param dstx +/// @param dsty +/// @param maxalpha +/// @return +/// wxImage PRSSubtitleFormat::CalculateAlpha(const unsigned char* frame1, const unsigned char* frame2, int w, int h, int pitch, int *dstx, int *dsty, int *maxalpha) { // Allocate image data unsigned char *data = (unsigned char*) malloc(sizeof(unsigned char)*w*h*3); @@ -755,9 +786,11 @@ wxImage PRSSubtitleFormat::CalculateAlpha(const unsigned char* frame1, const uns } -//////////////////////////////////////////////// -// Creates a sub image preserving alpha channel -// Modified from wx's source + +/// @brief Modified from wx's source Creates a sub image preserving alpha channel +/// @param source +/// @param rect +/// wxImage PRSSubtitleFormat::SubImageWithAlpha (wxImage &source,const wxRect &rect) { wxImage image; wxCHECK_MSG(source.Ok(), image, wxT("invalid image") ); @@ -799,3 +832,4 @@ wxImage PRSSubtitleFormat::SubImageWithAlpha (wxImage &source,const wxRect &rect #endif + diff --git a/aegisub/src/subtitle_format_prs.h b/aegisub/src/subtitle_format_prs.h index a1ca6e292..d5c67cf2f 100644 --- a/aegisub/src/subtitle_format_prs.h +++ b/aegisub/src/subtitle_format_prs.h @@ -52,12 +52,22 @@ class PRSDisplay; class PRSFile; -////////////// -// PRS writer + +/// DOCME +/// @class PRSSubtitleFormat +/// @brief DOCME +/// +/// DOCME class PRSSubtitleFormat : public SubtitleFormat { private: + + /// DOCME PRSDisplay *lastDisplay; + + /// DOCME int id; + + /// DOCME int optimizer; void InsertFrame(PRSFile &file,int &framen,std::vector &frames,wxImage &bmp,int x,int y,int maxalpha); @@ -77,3 +87,4 @@ public: #endif + diff --git a/aegisub/src/subtitle_format_srt.cpp b/aegisub/src/subtitle_format_srt.cpp index becf49543..0ed92c595 100644 --- a/aegisub/src/subtitle_format_srt.cpp +++ b/aegisub/src/subtitle_format_srt.cpp @@ -46,29 +46,39 @@ #include "ass_file.h" -///////////// -// Can read? + +/// @brief Can read? +/// @param filename +/// @return +/// bool SRTSubtitleFormat::CanReadFile(wxString filename) { return (filename.Right(4).Lower() == _T(".srt")); } -////////////// -// Can write? + +/// @brief Can write? +/// @param filename +/// @return +/// bool SRTSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(4).Lower() == _T(".srt")); } -//////////// -// Get name + +/// @brief Get name +/// @return +/// wxString SRTSubtitleFormat::GetName() { return _T("SubRip"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString SRTSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("srt")); @@ -76,15 +86,20 @@ wxArrayString SRTSubtitleFormat::GetReadWildcards() { } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString SRTSubtitleFormat::GetWriteWildcards() { return GetReadWildcards(); } -///////////// -// Read file + +/// @brief Read file +/// @param filename +/// @param encoding +/// void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using namespace std; @@ -175,8 +190,11 @@ void SRTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { } -////////////// -// Write file + +/// @brief Write file +/// @param _filename +/// @param encoding +/// void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { // Open file TextFileWriter file(_filename,encoding); @@ -215,3 +233,4 @@ void SRTSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { ClearCopy(); } + diff --git a/aegisub/src/subtitle_format_srt.h b/aegisub/src/subtitle_format_srt.h index 473c89b22..bd4706183 100644 --- a/aegisub/src/subtitle_format_srt.h +++ b/aegisub/src/subtitle_format_srt.h @@ -48,8 +48,12 @@ class AssDialogue; -///////////////////// -// SRT reader/writer + +/// DOCME +/// @class SRTSubtitleFormat +/// @brief DOCME +/// +/// DOCME class SRTSubtitleFormat : public SubtitleFormat { public: wxString GetName(); @@ -63,3 +67,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_transtation.cpp b/aegisub/src/subtitle_format_transtation.cpp index a579c788c..e8bf8d4aa 100644 --- a/aegisub/src/subtitle_format_transtation.cpp +++ b/aegisub/src/subtitle_format_transtation.cpp @@ -48,15 +48,19 @@ #include -//////// -// Name + +/// @brief Name +/// @return +/// wxString TranStationSubtitleFormat::GetName() { return _T("TranStation"); } -///////////// -// Wildcards + +/// @brief Wildcards +/// @return +/// wxArrayString TranStationSubtitleFormat::GetWriteWildcards() { wxArrayString formats; formats.Add(_T("transtation.txt")); @@ -64,15 +68,22 @@ wxArrayString TranStationSubtitleFormat::GetWriteWildcards() { } -/////////////////// -// Can write file? + +/// @brief Can write file? +/// @param filename +/// @return +/// bool TranStationSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(16).Lower() == _T(".transtation.txt")); } -////////////// -// Write file + +/// @brief Write file +/// @param _filename +/// @param encoding +/// @return +/// void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding) { // Get FPS FPSRational fps_rat = AskForFPS(true); @@ -114,6 +125,12 @@ void TranStationSubtitleFormat::WriteFile(wxString _filename,wxString encoding) ClearCopy(); } + +/// @brief DOCME +/// @param current +/// @param fps_rat +/// @param nextl_start +/// wxString TranStationSubtitleFormat::ConvertLine(AssDialogue *current, FPSRational *fps_rat, int nextl_start) { // Get line data AssStyle *style = GetAssFile()->GetStyle(current->Style); @@ -155,3 +172,4 @@ wxString TranStationSubtitleFormat::ConvertLine(AssDialogue *current, FPSRationa return header + current->Text; } + diff --git a/aegisub/src/subtitle_format_transtation.h b/aegisub/src/subtitle_format_transtation.h index 00410f65f..35d14c917 100644 --- a/aegisub/src/subtitle_format_transtation.h +++ b/aegisub/src/subtitle_format_transtation.h @@ -43,8 +43,12 @@ #include "subtitle_format.h" -////////////////////// -// TranStation writer + +/// DOCME +/// @class TranStationSubtitleFormat +/// @brief DOCME +/// +/// DOCME class TranStationSubtitleFormat : public SubtitleFormat { private: wxString ConvertLine(AssDialogue *line, FPSRational *fps_rat, int nextl_start); @@ -56,3 +60,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_ttxt.cpp b/aegisub/src/subtitle_format_ttxt.cpp index 45db9b96a..374043984 100644 --- a/aegisub/src/subtitle_format_ttxt.cpp +++ b/aegisub/src/subtitle_format_ttxt.cpp @@ -45,15 +45,19 @@ #include "options.h" -/////////////////// -// Get format name + +/// @brief Get format name +/// @return +/// wxString TTXTSubtitleFormat::GetName() { return _T("MPEG-4 Streaming Text"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString TTXTSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("ttxt")); @@ -61,31 +65,42 @@ wxArrayString TTXTSubtitleFormat::GetReadWildcards() { } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString TTXTSubtitleFormat::GetWriteWildcards() { return GetReadWildcards(); //return wxArrayString(); } -//////////////////// -// Can read a file? + +/// @brief Can read a file? +/// @param filename +/// @return +/// bool TTXTSubtitleFormat::CanReadFile(wxString filename) { return (filename.Right(5).Lower() == _T(".ttxt")); } -///////////////////// -// Can write a file? + +/// @brief Can write a file? +/// @param filename +/// @return +/// bool TTXTSubtitleFormat::CanWriteFile(wxString filename) { //return false; return (filename.Right(5).Lower() == _T(".ttxt")); } -/////////////// -// Read a file + +/// @brief Read a file +/// @param filename +/// @param forceEncoding +/// void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) { // Load default LoadDefault(false); @@ -135,8 +150,11 @@ void TTXTSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding) { } -/////////////////////////// -// Process a dialogue line + +/// @brief Process a dialogue line +/// @param node +/// @return +/// bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) { // Get time wxString sampleTime = node->GetAttribute(_T("sampleTime"),_T("00:00:00.000")); @@ -195,15 +213,20 @@ bool TTXTSubtitleFormat::ProcessLine(wxXmlNode *node) { } -////////////////////// -// Process the header + +/// @brief Process the header +/// @param node +/// void TTXTSubtitleFormat::ProcessHeader(wxXmlNode *node) { // TODO } -//////////////// -// Write a file + +/// @brief Write a file +/// @param filename +/// @param encoding +/// void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { // Convert to TTXT CreateCopy(); @@ -240,8 +263,10 @@ void TTXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { } -//////////////// -// Write header + +/// @brief Write header +/// @param root +/// void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) { // Write stream header wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE,_T("TextStreamHeader")); @@ -291,8 +316,11 @@ void TTXTSubtitleFormat::WriteHeader(wxXmlNode *root) { } -////////////// -// Write line + +/// @brief Write line +/// @param root +/// @param line +/// void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) { // If it doesn't start at the end of previous, add blank wxXmlNode *node,*subNode; @@ -318,8 +346,9 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *line) { } -////////////////////////////// -// Converts whole file to TTXT + +/// @brief Converts whole file to TTXT +/// void TTXTSubtitleFormat::ConvertToTTXT () { // Convert SortLines(); @@ -348,3 +377,4 @@ void TTXTSubtitleFormat::ConvertToTTXT () { Line->push_back(diag); } + diff --git a/aegisub/src/subtitle_format_ttxt.h b/aegisub/src/subtitle_format_ttxt.h index 41d5f8794..268f4b8d5 100644 --- a/aegisub/src/subtitle_format_ttxt.h +++ b/aegisub/src/subtitle_format_ttxt.h @@ -45,12 +45,22 @@ #include -////////////////////// -// TTXT reader/writer + +/// DOCME +/// @class TTXTSubtitleFormat +/// @brief DOCME +/// +/// DOCME class TTXTSubtitleFormat : public SubtitleFormat { private: + + /// DOCME int version; + + /// DOCME AssDialogue *diag; + + /// DOCME AssDialogue *prev; bool ProcessLine(wxXmlNode *node); @@ -73,3 +83,4 @@ public: void WriteFile(wxString filename,wxString encoding); }; + diff --git a/aegisub/src/subtitle_format_txt.cpp b/aegisub/src/subtitle_format_txt.cpp index 03fd5d1a6..f3042c6ec 100644 --- a/aegisub/src/subtitle_format_txt.cpp +++ b/aegisub/src/subtitle_format_txt.cpp @@ -48,29 +48,39 @@ #include "dialog_text_import.h" -///////////// -// Can read? + +/// @brief Can read? +/// @param filename +/// @return +/// bool TXTSubtitleFormat::CanReadFile(wxString filename) { return (filename.Right(4).Lower() == _T(".txt")); } -////////////// -// Can write? + +/// @brief Can write? +/// @param filename +/// @return +/// bool TXTSubtitleFormat::CanWriteFile(wxString filename) { return (filename.Right(4).Lower() == _T(".txt") && filename.Right(11).Lower() != _T(".encore.txt") && filename.Right(16).Lower() != _T(".transtation.txt")); } -//////////// -// Get name + +/// @brief Get name +/// @return +/// wxString TXTSubtitleFormat::GetName() { return _T("Plain-Text"); } -////////////////////// -// Get read wildcards + +/// @brief Get read wildcards +/// @return +/// wxArrayString TXTSubtitleFormat::GetReadWildcards() { wxArrayString formats; formats.Add(_T("txt")); @@ -78,15 +88,21 @@ wxArrayString TXTSubtitleFormat::GetReadWildcards() { } -/////////////////////// -// Get write wildcards + +/// @brief Get write wildcards +/// @return +/// wxArrayString TXTSubtitleFormat::GetWriteWildcards() { return GetReadWildcards(); } -///////////// -// Read file + +/// @brief Read file +/// @param filename +/// @param encoding +/// @return +/// void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using namespace std; // Import options DialogTextImport dlg; @@ -175,8 +191,11 @@ void TXTSubtitleFormat::ReadFile(wxString filename,wxString encoding) { using na } -///////////// -// Write file + +/// @brief Write file +/// @param filename +/// @param encoding +/// void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using namespace std; size_t num_actor_names = 0, num_dialogue_lines = 0; @@ -239,3 +258,4 @@ void TXTSubtitleFormat::WriteFile(wxString filename,wxString encoding) { using n } } + diff --git a/aegisub/src/subtitle_format_txt.h b/aegisub/src/subtitle_format_txt.h index dafdf280b..f7b16b1be 100644 --- a/aegisub/src/subtitle_format_txt.h +++ b/aegisub/src/subtitle_format_txt.h @@ -48,8 +48,12 @@ class AssDialogue; -////////////// -// TXT reader + +/// DOCME +/// @class TXTSubtitleFormat +/// @brief DOCME +/// +/// DOCME class TXTSubtitleFormat : public SubtitleFormat { private: @@ -64,3 +68,4 @@ public: void WriteFile(wxString filename, wxString encoding = _T("")); }; + diff --git a/aegisub/src/subtitles_provider.cpp b/aegisub/src/subtitles_provider.cpp index 203ca628c..71a32cfa8 100644 --- a/aegisub/src/subtitles_provider.cpp +++ b/aegisub/src/subtitles_provider.cpp @@ -49,14 +49,17 @@ #include "options.h" -////////////// -// Destructor + +/// @brief Destructor +/// SubtitlesProvider::~SubtitlesProvider() { } -//////////////////////////////////////////////////////////////// -// Check if provider available (doesn't verify provider works!) + +/// @brief Check if provider available (doesn't verify provider works!) +/// @return +/// bool SubtitlesProviderFactoryManager::ProviderAvailable() { // List of providers wxArrayString list = GetFactoryList(Options.AsText(_T("Subtitles provider"))); @@ -66,8 +69,10 @@ bool SubtitlesProviderFactoryManager::ProviderAvailable() { } -//////////////// -// Get provider + +/// @brief Get provider +/// @return +/// SubtitlesProvider* SubtitlesProviderFactoryManager::GetProvider() { // List of providers wxArrayString list = GetFactoryList(Options.AsText(_T("Subtitles provider"))); @@ -95,8 +100,9 @@ SubtitlesProvider* SubtitlesProviderFactoryManager::GetProvider() { } -////////////////////// -// Register providers + +/// @brief Register providers +/// void SubtitlesProviderFactoryManager::RegisterProviders() { #ifdef WITH_CSRI CSRISubtitlesProviderFactory *csri = new CSRISubtitlesProviderFactory(); @@ -108,14 +114,16 @@ void SubtitlesProviderFactoryManager::RegisterProviders() { } -/////////////////// -// Clear providers + +/// @brief Clear providers +/// void SubtitlesProviderFactoryManager::ClearProviders() { ClearFactories(); } -////////// -// Static + +/// DOCME template std::map* FactoryManager::factories=NULL; + diff --git a/aegisub/src/subtitles_provider_csri.cpp b/aegisub/src/subtitles_provider_csri.cpp index 4b6f92cc7..3990978a5 100644 --- a/aegisub/src/subtitles_provider_csri.cpp +++ b/aegisub/src/subtitles_provider_csri.cpp @@ -48,24 +48,29 @@ #include "video_context.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param type +/// CSRISubtitlesProvider::CSRISubtitlesProvider(wxString type) { subType = type; instance = NULL; } -////////////// -// Destructor + +/// @brief Destructor +/// CSRISubtitlesProvider::~CSRISubtitlesProvider() { if (instance) csri_close(instance); instance = NULL; } -////////////////// -// Load subtitles + +/// @brief Load subtitles +/// @param subs +/// void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) { // Close if (instance) csri_close(instance); @@ -114,8 +119,12 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) { } -////////////////// -// Draw subtitles + +/// @brief Draw subtitles +/// @param dst +/// @param time +/// @return +/// void CSRISubtitlesProvider::DrawSubtitles(AegiVideoFrame &dst,double time) { // Check if CSRI loaded properly if (!instance) return; @@ -151,8 +160,9 @@ void CSRISubtitlesProvider::DrawSubtitles(AegiVideoFrame &dst,double time) { } -///////////////////// -// Get CSRI subtypes + +/// @brief Get CSRI subtypes +/// wxArrayString CSRISubtitlesProviderFactory::GetSubTypes() { csri_info *info; wxArrayString final; @@ -176,3 +186,4 @@ wxArrayString CSRISubtitlesProviderFactory::GetSubTypes() { #endif // WITH_CSRI + diff --git a/aegisub/src/subtitles_provider_csri.h b/aegisub/src/subtitles_provider_csri.h index dd4426754..674cefed4 100644 --- a/aegisub/src/subtitles_provider_csri.h +++ b/aegisub/src/subtitles_provider_csri.h @@ -43,6 +43,8 @@ #include #include "include/aegisub/subtitles_provider.h" #ifdef WIN32 + +/// DOCME #define CSRIAPI #endif @@ -52,11 +54,19 @@ #include "csri/csri.h" #endif -///////////////////////////////////////////////// -// Common Subtitles Rendering Interface provider + +/// DOCME +/// @class CSRISubtitlesProvider +/// @brief DOCME +/// +/// DOCME class CSRISubtitlesProvider : public SubtitlesProvider { private: + + /// DOCME wxString subType; + + /// DOCME csri_inst *instance; public: @@ -68,13 +78,22 @@ public: }; -/////////// -// Factory + +/// DOCME +/// @class CSRISubtitlesProviderFactory +/// @brief DOCME +/// +/// DOCME class CSRISubtitlesProviderFactory : public SubtitlesProviderFactory { public: + + /// @brief DOCME + /// @param subType=_T(Ó) + /// SubtitlesProvider *CreateProvider(wxString subType=_T("")) { return new CSRISubtitlesProvider(subType); } wxArrayString GetSubTypes(); }; #endif + diff --git a/aegisub/src/subtitles_provider_libass.cpp b/aegisub/src/subtitles_provider_libass.cpp index ca79e40f0..3c6d6e4c7 100644 --- a/aegisub/src/subtitles_provider_libass.cpp +++ b/aegisub/src/subtitles_provider_libass.cpp @@ -55,8 +55,9 @@ extern "C" { } #endif -/////////////// -// Constructor + +/// @brief Constructor +/// LibassSubtitlesProvider::LibassSubtitlesProvider() { // Initialize library static bool first = true; @@ -96,14 +97,17 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() { } -////////////// -// Destructor + +/// @brief Destructor +/// LibassSubtitlesProvider::~LibassSubtitlesProvider() { } -////////////////// -// Load subtitles + +/// @brief Load subtitles +/// @param subs +/// void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) { // Prepare subtitles std::vector data; @@ -117,15 +121,25 @@ void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) { } -///////////////////////////// -// Macros to get the colours + +/// DOCME #define _r(c) ((c)>>24) + +/// DOCME #define _g(c) (((c)>>16)&0xFF) + +/// DOCME #define _b(c) (((c)>>8)&0xFF) + +/// DOCME #define _a(c) ((c)&0xFF) -////////////////// -// Draw subtitles + +/// @brief Draw subtitles +/// @param frame +/// @param time +/// @return +/// void LibassSubtitlesProvider::DrawSubtitles(AegiVideoFrame &frame,double time) { // Set size ass_set_frame_size(ass_renderer, frame.w, frame.h); @@ -177,10 +191,11 @@ void LibassSubtitlesProvider::DrawSubtitles(AegiVideoFrame &frame,double time) { } -////////// -// Static + +/// DOCME ass_library_t* LibassSubtitlesProvider::ass_library; #endif // WITH_LIBASS + diff --git a/aegisub/src/subtitles_provider_libass.h b/aegisub/src/subtitles_provider_libass.h index 0de195cf4..fa278cad8 100644 --- a/aegisub/src/subtitles_provider_libass.h +++ b/aegisub/src/subtitles_provider_libass.h @@ -48,12 +48,22 @@ extern "C" { #include "../libass/ass.h" } -/////////////////// -// libass provider + +/// DOCME +/// @class LibassSubtitlesProvider +/// @brief DOCME +/// +/// DOCME class LibassSubtitlesProvider : public SubtitlesProvider { private: + + /// DOCME static ass_library_t* ass_library; + + /// DOCME ass_renderer_t* ass_renderer; + + /// DOCME ass_track_t* ass_track; public: @@ -65,12 +75,21 @@ public: }; -/////////// -// Factory + +/// DOCME +/// @class LibassSubtitlesProviderFactory +/// @brief DOCME +/// +/// DOCME class LibassSubtitlesProviderFactory : public SubtitlesProviderFactory { public: + + /// @brief DOCME + /// @param subType=_T(Ó) + /// SubtitlesProvider *CreateProvider(wxString subType=_T("")) { return new LibassSubtitlesProvider(); } }; #endif + diff --git a/aegisub/src/subtitles_provider_manager.h b/aegisub/src/subtitles_provider_manager.h index 5bc39dfb0..a34aa979d 100644 --- a/aegisub/src/subtitles_provider_manager.h +++ b/aegisub/src/subtitles_provider_manager.h @@ -46,8 +46,12 @@ #include "factory_manager.h" -/////////////////// -// Factory Manager + +/// DOCME +/// @class SubtitlesProviderFactoryManager +/// @brief DOCME +/// +/// DOCME class SubtitlesProviderFactoryManager : public FactoryManager { public: static SubtitlesProvider *GetProvider(); @@ -57,3 +61,4 @@ public: }; + diff --git a/aegisub/src/text_file_reader.cpp b/aegisub/src/text_file_reader.cpp index 8b3b4252f..903f90771 100644 --- a/aegisub/src/text_file_reader.cpp +++ b/aegisub/src/text_file_reader.cpp @@ -49,6 +49,13 @@ #include "charset_detect.h" #endif + +/// @brief DOCME +/// @param filename +/// @param enc +/// @param trim +/// @return +/// TextFileReader::TextFileReader(wxString filename, wxString enc, bool trim) : encoding(enc), conv((iconv_t)-1), trim(trim), readComplete(false), currout(0), outptr(0), currentLine(0) { #ifdef __WINDOWS__ @@ -66,10 +73,18 @@ TextFileReader::TextFileReader(wxString filename, wxString enc, bool trim) conv = iconv_open(WCHAR_T_ENCODING, encoding.ToAscii()); } + +/// @brief DOCME +/// TextFileReader::~TextFileReader() { if (conv != (iconv_t)-1) iconv_close(conv); } + +/// @brief DOCME +/// @param filename +/// @return +/// wxString TextFileReader::GetEncoding(const wxString filename) { // Prepare unsigned char b[4]; @@ -116,6 +131,10 @@ wxString TextFileReader::GetEncoding(const wxString filename) { #endif } + +/// @brief DOCME +/// @return +/// wchar_t TextFileReader::GetWChar() { // If there's already some converted characters waiting, return the next one if (++currout < outptr) { @@ -165,6 +184,10 @@ wchar_t TextFileReader::GetWChar() { throw wxString::Format(_T("Invalid input character found near line %u"), currentLine); } + +/// @brief DOCME +/// @return +/// wxString TextFileReader::ReadLineFromFile() { wxString buffer; size_t bufAlloc = 1024; @@ -198,10 +221,19 @@ wxString TextFileReader::ReadLineFromFile() { return buffer; } + +/// @brief DOCME +/// @return +/// bool TextFileReader::HasMoreLines() { return !readComplete; } + +/// @brief DOCME +/// @param enc +/// @return +/// void TextFileReader::EnsureValid(wxString enc) { if (enc == _T("binary")) return; @@ -214,7 +246,11 @@ void TextFileReader::EnsureValid(wxString enc) { } } + +/// @brief DOCME +/// wxString TextFileReader::GetCurrentEncoding() { return encoding; } + diff --git a/aegisub/src/text_file_reader.h b/aegisub/src/text_file_reader.h index 5c8644db9..68f32674a 100644 --- a/aegisub/src/text_file_reader.h +++ b/aegisub/src/text_file_reader.h @@ -42,19 +42,45 @@ #include #include + +/// DOCME +/// @class TextFileReader +/// @brief DOCME +/// +/// DOCME class TextFileReader { private: + + /// DOCME wxString encoding; + + /// DOCME std::ifstream file; + + /// DOCME iconv_t conv; + + /// DOCME bool trim; + + /// DOCME bool readComplete; + + /// DOCME wchar_t outbuf[256]; + + /// DOCME wchar_t *currout; + + /// DOCME wchar_t *outptr; + + /// DOCME size_t outbytesleft; + + /// DOCME unsigned int currentLine; wchar_t GetWChar(); @@ -74,3 +100,4 @@ public: static wxString GetEncoding(const wxString filename); }; + diff --git a/aegisub/src/text_file_writer.cpp b/aegisub/src/text_file_writer.cpp index 0dd7801d8..7fe425f44 100644 --- a/aegisub/src/text_file_writer.cpp +++ b/aegisub/src/text_file_writer.cpp @@ -42,6 +42,11 @@ #include "aegisub_endian.h" #include "charset_conv.h" + +/// @brief DOCME +/// @param filename +/// @param encoding +/// TextFileWriter::TextFileWriter(wxString filename, wxString encoding) : conv() { #ifdef WIN32 @@ -65,10 +70,18 @@ TextFileWriter::TextFileWriter(wxString filename, wxString encoding) } } + +/// @brief DOCME +/// TextFileWriter::~TextFileWriter() { // Explicit empty destructor required with an auto_ptr to an incomplete class } + +/// @brief DOCME +/// @param line +/// @param addLineBreak +/// void TextFileWriter::WriteLineToFile(wxString line, bool addLineBreak) { wxString temp = line; if (addLineBreak) temp += _T("\r\n"); @@ -78,3 +91,4 @@ void TextFileWriter::WriteLineToFile(wxString line, bool addLineBreak) { file.write(buf.data(), conv->MBBuffLen(buf.data())); } + diff --git a/aegisub/src/text_file_writer.h b/aegisub/src/text_file_writer.h index be928093c..6ac63d431 100644 --- a/aegisub/src/text_file_writer.h +++ b/aegisub/src/text_file_writer.h @@ -36,6 +36,8 @@ #ifndef TEXT_FILE_WRITER_H + +/// DOCME #define TEXT_FILE_WRITER_H #include @@ -45,9 +47,19 @@ class AegisubCSConv; + +/// DOCME +/// @class TextFileWriter +/// @brief DOCME +/// +/// DOCME class TextFileWriter { private: + + /// DOCME std::ofstream file; + + /// DOCME std::auto_ptr conv; TextFileWriter(const TextFileWriter&); @@ -62,3 +74,4 @@ public: #endif + diff --git a/aegisub/src/thesaurus.cpp b/aegisub/src/thesaurus.cpp index 3f0cbe4d1..00a8168ee 100644 --- a/aegisub/src/thesaurus.cpp +++ b/aegisub/src/thesaurus.cpp @@ -43,8 +43,9 @@ #include "thesaurus_myspell.h" -///////////////////// -// Get spell checker + +/// @brief Get spell checker +/// Thesaurus *Thesaurus::GetThesaurus() { // Initialize Thesaurus *thes = NULL; @@ -56,3 +57,4 @@ Thesaurus *Thesaurus::GetThesaurus() { return thes; } + diff --git a/aegisub/src/thesaurus.h b/aegisub/src/thesaurus.h index 10efe3411..a0bb28b2b 100644 --- a/aegisub/src/thesaurus.h +++ b/aegisub/src/thesaurus.h @@ -46,27 +46,45 @@ #include -///////////////////////// -// Thesaurus entry class + +/// DOCME +/// @class ThesaurusEntry +/// @brief DOCME +/// +/// DOCME class ThesaurusEntry { public: + + /// DOCME wxString name; + + /// DOCME wxArrayString words; }; -///////////////////////// -// Thesaurus entry array + +/// DOCME typedef std::vector ThesaurusEntryArray; -/////////////////////// -// Thesaurus interface + +/// DOCME +/// @class Thesaurus +/// @brief DOCME +/// +/// DOCME class Thesaurus { public: static Thesaurus *GetThesaurus(); + + /// @brief DOCME + /// Thesaurus() {} + + /// @brief DOCME + /// virtual ~Thesaurus() {} virtual void Lookup(wxString word,ThesaurusEntryArray &result)=0; @@ -74,3 +92,4 @@ public: virtual void SetLanguage(wxString language)=0; }; + diff --git a/aegisub/src/thesaurus_myspell.cpp b/aegisub/src/thesaurus_myspell.cpp index e12a5e61d..918c2b919 100644 --- a/aegisub/src/thesaurus_myspell.cpp +++ b/aegisub/src/thesaurus_myspell.cpp @@ -49,8 +49,9 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// MySpellThesaurus::MySpellThesaurus() { conv = NULL; mythes = NULL; @@ -58,8 +59,9 @@ MySpellThesaurus::MySpellThesaurus() { } -////////////// -// Destructor + +/// @brief Destructor +/// MySpellThesaurus::~MySpellThesaurus() { delete mythes; mythes = NULL; @@ -68,8 +70,12 @@ MySpellThesaurus::~MySpellThesaurus() { } -/////////////////// -// Get suggestions + +/// @brief Get suggestions +/// @param word +/// @param result +/// @return +/// void MySpellThesaurus::Lookup(wxString word,ThesaurusEntryArray &result) { // Loaded? if (!mythes) return; @@ -93,8 +99,10 @@ void MySpellThesaurus::Lookup(wxString word,ThesaurusEntryArray &result) { } -///////////////////// -// Get language list + +/// @brief Get language list +/// @return +/// wxArrayString MySpellThesaurus::GetLanguageList() { // Get dir name wxString path = StandardPaths::DecodePathMaybeRelative(Options.AsText(_T("Dictionaries path")), _T("?data")) + _T("/"); @@ -128,8 +136,10 @@ wxArrayString MySpellThesaurus::GetLanguageList() { } -//////////////// -// Set language + +/// @brief Set language +/// @param language +/// void MySpellThesaurus::SetLanguage(wxString language) { // Unload delete mythes; @@ -156,3 +166,4 @@ void MySpellThesaurus::SetLanguage(wxString language) { if (mythes) conv = new wxCSConv(wxString(mythes->get_th_encoding(),wxConvUTF8)); } + diff --git a/aegisub/src/thesaurus_myspell.h b/aegisub/src/thesaurus_myspell.h index cba5b9f71..7ea73972e 100644 --- a/aegisub/src/thesaurus_myspell.h +++ b/aegisub/src/thesaurus_myspell.h @@ -48,11 +48,19 @@ class MyThes; -/////////////////////// -// Thesaurus interface + +/// DOCME +/// @class MySpellThesaurus +/// @brief DOCME +/// +/// DOCME class MySpellThesaurus: public Thesaurus { private: + + /// DOCME MyThes *mythes; + + /// DOCME wxCSConv *conv; public: @@ -64,3 +72,4 @@ public: void SetLanguage(wxString language); }; + diff --git a/aegisub/src/timeedit_ctrl.cpp b/aegisub/src/timeedit_ctrl.cpp index 181e6102f..cafc319b8 100644 --- a/aegisub/src/timeedit_ctrl.cpp +++ b/aegisub/src/timeedit_ctrl.cpp @@ -49,13 +49,26 @@ // Use the multiline style only on wxGTK to workaround some wxGTK bugs with the default singleline style #ifdef __WXGTK__ + +/// DOCME #define TimeEditWindowStyle wxTE_MULTILINE | wxTE_CENTRE #else + +/// DOCME #define TimeEditWindowStyle wxTE_CENTRE #endif -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param value +/// @param pos +/// @param size +/// @param style +/// @param validator +/// @param name +/// TimeEdit::TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) : wxTextCtrl(parent,id,value,pos,size,TimeEditWindowStyle | style,validator,name) { @@ -108,8 +121,11 @@ BEGIN_EVENT_TABLE(TimeEdit, wxTextCtrl) END_EVENT_TABLE() -////////////////// -// Modified event + +/// @brief Modified event +/// @param event +/// @return +/// void TimeEdit::OnModified(wxCommandEvent &event) { event.Skip(); if (!ready) return; @@ -117,8 +133,11 @@ void TimeEdit::OnModified(wxCommandEvent &event) { } -///////////////////// -// Modified function + +/// @brief Modified function +/// @param byUser +/// @return +/// void TimeEdit::Modified(bool byUser) { // Lock if (!ready) return; @@ -139,8 +158,11 @@ void TimeEdit::Modified(bool byUser) { } -///////////////////////////// -// Set time and update stuff + +/// @brief Set time and update stuff +/// @param ms +/// @param setModified +/// void TimeEdit::SetTime(int ms,bool setModified) { int oldMs = time.GetMS(); time.SetMS(ms); @@ -149,8 +171,11 @@ void TimeEdit::SetTime(int ms,bool setModified) { } -///////////////////////////////////////// -// Toggles between set by frame and time + +/// @brief Toggles between set by frame and time +/// @param enable +/// @return +/// void TimeEdit::SetByFrame(bool enable) { if (enable == byFrame) return; @@ -170,8 +195,9 @@ void TimeEdit::SetByFrame(bool enable) { } -///////////////////////////////////// -// Update text to reflect time value + +/// @brief Update text to reflect time value +/// void TimeEdit::UpdateText() { ready = false; if (byFrame) { @@ -183,8 +209,9 @@ void TimeEdit::UpdateText() { } -////////// -// Update + +/// @brief Update +/// void TimeEdit::Update() { // Update frame if (byFrame) { @@ -208,8 +235,10 @@ void TimeEdit::Update() { } -///////////////////////////////////////////////// -// Reads value from a text control and update it + +/// @brief Reads value from a text control and update it +/// @param byUser +/// void TimeEdit::UpdateTime(bool byUser) { bool insertion = Options.AsBool(_T("Insert Mode on Time Boxes")); wxString text = GetValue(); @@ -241,8 +270,10 @@ void TimeEdit::UpdateTime(bool byUser) { } -/////////////// -// Key pressed + +/// @brief Key pressed +/// @param event +/// void TimeEdit::OnKeyDown(wxKeyEvent &event) { // Get key ID int key = event.GetKeyCode(); @@ -282,8 +313,10 @@ void TimeEdit::OnKeyDown(wxKeyEvent &event) { } -////////////// -// Focus lost + +/// @brief Focus lost +/// @param event +/// void TimeEdit::OnKillFocus(wxFocusEvent &event) { if (!byFrame && !Options.AsBool(_T("Insert Mode on Time Boxes"))) { if (time.GetASSFormated() != GetValue()) { @@ -297,8 +330,11 @@ void TimeEdit::OnKillFocus(wxFocusEvent &event) { ///// Mouse/copy/paste events down here ///// -/////////////// -// Mouse event + +/// @brief Mouse event +/// @param event +/// @return +/// void TimeEdit::OnMouseEvent(wxMouseEvent &event) { // Right click context menu if (event.RightUp()) { @@ -316,8 +352,10 @@ void TimeEdit::OnMouseEvent(wxMouseEvent &event) { } -///////////// -// Menu Copy + +/// @brief Menu Copy +/// @param event +/// void TimeEdit::OnCopy(wxCommandEvent &event) { SetFocus(); SetSelection(0,GetValue().Length()); @@ -326,8 +364,10 @@ void TimeEdit::OnCopy(wxCommandEvent &event) { } -////////////// -// Menu Paste + +/// @brief Menu Paste +/// @param event +/// void TimeEdit::OnPaste(wxCommandEvent &event) { SetFocus(); PasteTime(); @@ -335,8 +375,10 @@ void TimeEdit::OnPaste(wxCommandEvent &event) { } -///////////////////// -// Copy to clipboard + +/// @brief Copy to clipboard +/// @return +/// void TimeEdit::CopyTime() { // Frame if (byFrame) { @@ -352,8 +394,9 @@ void TimeEdit::CopyTime() { } -//////////////////////// -// Paste from clipboard + +/// @brief Paste from clipboard +/// void TimeEdit::PasteTime() { // Frame if (byFrame) { @@ -386,3 +429,4 @@ void TimeEdit::PasteTime() { } } + diff --git a/aegisub/src/timeedit_ctrl.h b/aegisub/src/timeedit_ctrl.h index 7bd965268..e576f743f 100644 --- a/aegisub/src/timeedit_ctrl.h +++ b/aegisub/src/timeedit_ctrl.h @@ -44,21 +44,33 @@ #include #include "ass_time.h" - -/////////////////////////// -// Time Edit control class +/// @class TimeEdit +/// @brief DOCME +/// class TimeEdit : public wxTextCtrl { private: + + /// DOCME bool byFrame; + + /// DOCME bool ready; + + /// DOCME bool modified; void Modified(bool byUser=true); void UpdateText(); void CopyTime(); void PasteTime(); + + /// DOCME void UpdateTime(bool byUser=true); +/// DOCME + + + /// DOCME void OnModified(wxCommandEvent &event); void OnMouseEvent(wxMouseEvent &event); void OnKeyDown(wxKeyEvent &event); @@ -66,15 +78,31 @@ private: void OnPaste(wxCommandEvent &event); void OnKillFocus(wxFocusEvent &event); +/// @brief DOCME +/// + public: + + /// DOCME AssTime time; + + /// DOCME bool isEnd; + + + /// DOCME + + /// DOCME bool showModified; TimeEdit(wxWindow* parent, wxWindowID id, const wxString& value = _T(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); void SetByFrame(bool enable); void SetTime(int ms,bool setModified=false); void Update(); + + /// @brief DOCME + /// @return + /// bool HasBeenModified() { return modified; } DECLARE_EVENT_TABLE() @@ -84,7 +112,13 @@ public: /////// // IDs enum { + + /// DOCME Time_Edit_Copy = 1320, + + /// DOCME Time_Edit_Paste }; + + diff --git a/aegisub/src/toggle_bitmap.cpp b/aegisub/src/toggle_bitmap.cpp index e8a782456..a9865f764 100644 --- a/aegisub/src/toggle_bitmap.cpp +++ b/aegisub/src/toggle_bitmap.cpp @@ -46,8 +46,13 @@ #include -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param image +/// @param size +/// ToggleBitmap::ToggleBitmap(wxWindow *parent,wxWindowID id,const wxBitmap &image,const wxSize &size) : wxControl (parent,id,wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER) { @@ -67,15 +72,19 @@ ToggleBitmap::ToggleBitmap(wxWindow *parent,wxWindowID id,const wxBitmap &image, } -///////////// -// Get state + +/// @brief Get state +/// @return +/// bool ToggleBitmap::GetValue() { return state; } -///////////// -// Set state + +/// @brief Set state +/// @param _state +/// void ToggleBitmap::SetValue(bool _state) { // Set flag state = _state; @@ -85,8 +94,10 @@ void ToggleBitmap::SetValue(bool _state) { } -////////////// -// Draw image + +/// @brief Draw image +/// @param dc +/// void ToggleBitmap::DrawImage(wxDC &dc) { // Get size int w,h; @@ -121,8 +132,10 @@ BEGIN_EVENT_TABLE(ToggleBitmap,wxControl) END_EVENT_TABLE() -//////////////// -// Mouse events + +/// @brief Mouse events +/// @param event +/// void ToggleBitmap::OnMouseEvent(wxMouseEvent &event) { // Get mouse position int x = event.GetX(); @@ -145,10 +158,13 @@ void ToggleBitmap::OnMouseEvent(wxMouseEvent &event) { } -/////////////// -// Paint event + +/// @brief Paint event +/// @param event +/// void ToggleBitmap::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); DrawImage(dc); } + diff --git a/aegisub/src/toggle_bitmap.h b/aegisub/src/toggle_bitmap.h index 7b2003112..b98a8d507 100644 --- a/aegisub/src/toggle_bitmap.h +++ b/aegisub/src/toggle_bitmap.h @@ -36,6 +36,8 @@ #ifndef TOGGLE_BITMAP_H + +/// DOCME #define TOGGLE_BITMAP_H @@ -45,11 +47,19 @@ #include -///////// -// Class + +/// DOCME +/// @class ToggleBitmap +/// @brief DOCME +/// +/// DOCME class ToggleBitmap : public wxControl { private: + + /// DOCME wxBitmap img; + + /// DOCME bool state; void OnMouseEvent(wxMouseEvent &event); @@ -67,3 +77,4 @@ public: #endif + diff --git a/aegisub/src/tooltip_manager.cpp b/aegisub/src/tooltip_manager.cpp index 7076e5376..70e10b5c4 100644 --- a/aegisub/src/tooltip_manager.cpp +++ b/aegisub/src/tooltip_manager.cpp @@ -43,8 +43,9 @@ #include "hotkeys.h" -/////////////////// -// Update all tips + +/// @brief Update all tips +/// void ToolTipManager::DoUpdate() { for (std::list::iterator cur=tips.begin();cur!=tips.end();cur++) { (*cur).Update(); @@ -52,8 +53,12 @@ void ToolTipManager::DoUpdate() { } -///////////// -// Add a tip + +/// @brief Add a tip +/// @param window +/// @param tooltip +/// @param hotkeys +/// void ToolTipManager::AddTips(wxWindow *window,wxString tooltip,wxArrayString hotkeys) { ToolTipBinding tip; tip.hotkeys = hotkeys; @@ -64,8 +69,12 @@ void ToolTipManager::AddTips(wxWindow *window,wxString tooltip,wxArrayString hot } -////////////////////////// -// Single hotkey overload + +/// @brief Single hotkey overload +/// @param window +/// @param tooltip +/// @param hotkey +/// void ToolTipManager::Bind(wxWindow *window,wxString tooltip,wxString hotkey) { wxArrayString hotkeys; if (!hotkey.IsEmpty()) hotkeys.Add(hotkey); @@ -73,8 +82,13 @@ void ToolTipManager::Bind(wxWindow *window,wxString tooltip,wxString hotkey) { } -//////////////////////// -// Two hotkeys overload + +/// @brief Two hotkeys overload +/// @param window +/// @param tooltip +/// @param hotkey1 +/// @param hotkey2 +/// void ToolTipManager::Bind(wxWindow *window,wxString tooltip,wxString hotkey1,wxString hotkey2) { wxArrayString hotkeys; hotkeys.Add(hotkey1); @@ -83,16 +97,19 @@ void ToolTipManager::Bind(wxWindow *window,wxString tooltip,wxString hotkey1,wxS } -/////////////////// -// Static instance + +/// @brief Static instance +/// @return +/// ToolTipManager &ToolTipManager::GetInstance() { static ToolTipManager instance; return instance; } -//////////////// -// Update a tip + +/// @brief Update a tip +/// void ToolTipBinding::Update() { wxString finalTip = toolTip; wxArrayString hotkeysLeft = hotkeys; @@ -103,3 +120,4 @@ void ToolTipBinding::Update() { window->SetToolTip(finalTip); } + diff --git a/aegisub/src/tooltip_manager.h b/aegisub/src/tooltip_manager.h index a5be2b8b6..06494385a 100644 --- a/aegisub/src/tooltip_manager.h +++ b/aegisub/src/tooltip_manager.h @@ -47,38 +47,67 @@ #include -/////////////////// -// Tooltip binding + +/// DOCME +/// @class ToolTipBinding +/// @brief DOCME +/// +/// DOCME class ToolTipBinding { friend class ToolTipManager; private: + + /// DOCME wxWindow *window; + + /// DOCME wxString toolTip; + + /// DOCME wxArrayString hotkeys; void Update(); }; -///////////////////////////// -// Tooltip manager singleton + +/// DOCME +/// @class ToolTipManager +/// @brief DOCME +/// +/// DOCME class ToolTipManager { private: + + /// @brief DOCME + /// ToolTipManager() {}; ToolTipManager(ToolTipManager const&); ToolTipManager& operator=(ToolTipManager const&); static ToolTipManager &GetInstance(); + + /// DOCME std::list tips; void DoUpdate(); void AddTips(wxWindow *window,wxString tooltip,wxArrayString hotkeys); public: + + /// @brief DOCME + /// static void Update() { GetInstance().DoUpdate(); } + + /// @brief DOCME + /// @param window + /// @param tooltip + /// @param hotkeys + /// static void Bind(wxWindow *window,wxString tooltip,wxArrayString hotkeys) { GetInstance().AddTips(window,tooltip,hotkeys); } static void Bind(wxWindow *window,wxString tooltip,wxString hotkey=_T("")); static void Bind(wxWindow *window,wxString tooltip,wxString hotkey1,wxString hotkey2); }; + diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp index 6f90db872..3dfb05ad7 100644 --- a/aegisub/src/utils.cpp +++ b/aegisub/src/utils.cpp @@ -56,8 +56,11 @@ extern "C" { #ifndef __LINUX__ -////////////////////////// -// Absolute of 64 bit int + +/// @brief Absolute of 64 bit int +/// @param input +/// @return +/// int64_t abs64(int64_t input) { if (input < 0) return -input; return input; @@ -65,8 +68,12 @@ int64_t abs64(int64_t input) { #endif -/////////////////////////////////////// -// Count number of matches of a substr + +/// @brief Count number of matches of a substr +/// @param parent +/// @param child +/// @return +/// int CountMatches(wxString parent,wxString child) { size_t pos = wxString::npos; int n = 0; @@ -75,8 +82,12 @@ int CountMatches(wxString parent,wxString child) { } -///////////////////////////////////// -// Make a path relative to reference + +/// @brief Make a path relative to reference +/// @param _path +/// @param reference +/// @return +/// wxString MakeRelativePath(wxString _path,wxString reference) { if (_path.IsEmpty()) return _T(""); if (_path.Left(1) == _T("?")) return _path; @@ -87,8 +98,12 @@ wxString MakeRelativePath(wxString _path,wxString reference) { } -/////////////////////////////////////// -// Extract original path from relative + +/// @brief Extract original path from relative +/// @param _path +/// @param reference +/// @return +/// wxString DecodeRelativePath(wxString _path,wxString reference) { if (_path.IsEmpty()) return _T(""); if (_path.Left(1) == _T("?")) return _path; @@ -104,8 +119,11 @@ wxString DecodeRelativePath(wxString _path,wxString reference) { } -//////////////// -// Pretty float + +/// @brief Pretty float +/// @param src +/// @return +/// wxString PrettyFloat(wxString src) { if (src.Contains(_T("."))) { size_t len = src.Length(); @@ -121,27 +139,45 @@ wxString PrettyFloat(wxString src) { return src; } + +/// @brief DOCME +/// @param src +/// @return +/// wxString PrettyFloatF(float src) { return PrettyFloat(wxString::Format(_T("%f"),src)); } + +/// @brief DOCME +/// @param src +/// @return +/// wxString PrettyFloatD(double src) { return PrettyFloat(wxString::Format(_T("%f"),src)); } -/////////////////// -// Float to string + +/// @brief Float to string +/// @param value +/// @return +/// wxString AegiFloatToString(double value) { return PrettyFloat(wxString::Format(_T("%f"),value)); } -///////////////// -// Int to string + +/// @brief Int to string +/// @param value +/// @return +/// wxString AegiIntegerToString(int value) { return wxString::Format(_T("%i"),value); } -////////////////////////// -// Pretty reading of size -// There shall be no kiB, MiB stuff here + +/// @brief There shall be no kiB, MiB stuff here Pretty reading of size +/// @param bytes +/// @return +/// wxString PrettySize(int bytes) { // Suffixes wxArrayString suffix; @@ -173,8 +209,16 @@ wxString PrettySize(int bytes) { } -////////////////////////////////// -// Append a menu item with bitmap + +/// @brief Append a menu item with bitmap +/// @param parentMenu +/// @param id +/// @param text +/// @param help +/// @param bmp +/// @param pos +/// @return +/// wxMenuItem* AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxString help,wxBitmap bmp,int pos) { wxMenuItem *cur = new wxMenuItem(parentMenu,id,text,help); // Mac software does not use icons in menus so we shouldn't either @@ -187,9 +231,11 @@ wxMenuItem* AppendBitmapMenuItem (wxMenu* parentMenu,int id,wxString text,wxStri } -/////////////////////////////////////////////////////////////// -// Get the smallest power of two that is greater or equal to x -// Code from http://bob.allegronetwork.com/prog/tricks.html + +/// @brief Code from http://bob.allegronetwork.com/prog/tricks.html Get the smallest power of two that is greater or equal to x +/// @param x +/// @return +/// int SmallestPowerOf2(int x) { x--; x |= (x >> 1); @@ -202,8 +248,13 @@ int SmallestPowerOf2(int x) { } -/////////////////////// -// Get word boundaries + +/// @brief Get word boundaries +/// @param text +/// @param results +/// @param start +/// @param end +/// void GetWordBoundaries(const wxString text,IntPairVector &results,int start,int end) { // Variables wxChar cur; @@ -286,8 +337,11 @@ void GetWordBoundaries(const wxString text,IntPairVector &results,int start,int } -///////////////////////////////////////////////////////// -// Determine whether wchar 'c' is a whitespace character + +/// @brief Determine whether wchar 'c' is a whitespace character +/// @param c +/// @return +/// bool IsWhitespace(wchar_t c) { const wchar_t whitespaces[] = { @@ -307,8 +361,11 @@ bool IsWhitespace(wchar_t c) } -/////////////////////////////////////////////////////////////// -// Returns true if str is empty of consists of only whitespace + +/// @brief Returns true if str is empty of consists of only whitespace +/// @param str +/// @return +/// bool StringEmptyOrWhitespace(const wxString &str) { for (size_t i = 0; i < str.size(); ++i) @@ -319,9 +376,13 @@ bool StringEmptyOrWhitespace(const wxString &str) } -///////////////////// -// String to integer -// wxString::ToLong() is slow and not as flexible + +/// @brief wxString::ToLong() is slow and not as flexible String to integer +/// @param str +/// @param start +/// @param end +/// @return +/// int AegiStringToInt(const wxString &str,int start,int end) { // Initialize to zero and get length if end set to -1 int sign = 1; @@ -344,8 +405,14 @@ int AegiStringToInt(const wxString &str,int start,int end) { -///////////////////////// -// String to fixed point + +/// @brief String to fixed point +/// @param str +/// @param decimalPlaces +/// @param start +/// @param end +/// @return +/// int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start,int end) { // Parts of the number int sign = 1; @@ -391,9 +458,11 @@ int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start,int end) } -//////////////////////////////// -// Convert a wxBitmap to wxIcon -// This is needed because wxIcon has to be 16x16 to work properly on win32 + +/// @brief This is needed because wxIcon has to be 16x16 to work properly on win32 Convert a wxBitmap to wxIcon +/// @param iconBmp +/// @return +/// wxIcon BitmapToIcon(wxBitmap iconBmp) { // Create the icon and background bmp wxIcon ico; @@ -415,10 +484,9 @@ wxIcon BitmapToIcon(wxBitmap iconBmp) { return ico; } -/////////////////////// -// Start Aegisub again -// It is assumed that something has prepared closing the current instance -// just before this is called. + +/// @brief just before this is called. It is assumed that something has prepared closing the current instance Start Aegisub again +/// void RestartAegisub() { #if defined(__WXMSW__) wxStandardPaths stand; @@ -436,3 +504,4 @@ void RestartAegisub() { #endif } + diff --git a/aegisub/src/utils.h b/aegisub/src/utils.h index ab5245b7a..7c8656b66 100644 --- a/aegisub/src/utils.h +++ b/aegisub/src/utils.h @@ -46,8 +46,8 @@ #include -//////////// -// Typedefs + +/// DOCME typedef std::vector > IntPairVector; @@ -79,29 +79,42 @@ void RestartAegisub(); ////////// // Macros #ifndef MIN + +/// DOCME #define MIN(a,b) ((a)<(b))?(a):(b) #endif #ifndef MAX + +/// DOCME #define MAX(a,b) ((a)>(b))?(a):(b) #endif #ifndef MID + +/// DOCME #define MID(a,b,c) MAX((a),MIN((b),(c))) #endif #ifndef FORCEINLINE #ifdef __VISUALC__ + +/// DOCME #define FORCEINLINE __forceinline #else + +/// DOCME #define FORCEINLINE inline // __attribute__((always_inline)) gives me errors on g++ ~amz #endif #endif -/////////// -// Inlines + +/// @brief Inlines +/// @param a +/// @param b +/// static inline void IntSwap(int &a,int &b) { int c = a; a = b; @@ -109,9 +122,12 @@ static inline void IntSwap(int &a,int &b) { } -////////////////////////// -// Clamp integer to range -// Code taken from http://bob.allegronetwork.com/prog/tricks.html#clamp + +/// @brief Code taken from http://bob.allegronetwork.com/prog/tricks.html#clamp Clamp integer to range +/// @param x +/// @param min +/// @param max +/// static FORCEINLINE int ClampSignedInteger32(int x,int min,int max) { x -= min; x &= (~x) >> 31; @@ -122,3 +138,4 @@ static FORCEINLINE int ClampSignedInteger32(int x,int min,int max) { return x; } + diff --git a/aegisub/src/validators.cpp b/aegisub/src/validators.cpp index 55fe0ef17..51d7787ca 100644 --- a/aegisub/src/validators.cpp +++ b/aegisub/src/validators.cpp @@ -44,8 +44,12 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _valPtr +/// @param isfloat +/// @param issigned +/// NumValidator::NumValidator(wxString* _valPtr,bool isfloat,bool issigned) { isFloat = isfloat; isSigned = issigned; @@ -65,8 +69,10 @@ NumValidator::NumValidator(wxString* _valPtr,bool isfloat,bool issigned) { } -//////////////////// -// Copy constructor + +/// @brief Copy constructor +/// @param from +/// NumValidator::NumValidator(const NumValidator &from) : wxValidator() { @@ -84,16 +90,21 @@ BEGIN_EVENT_TABLE(NumValidator, wxValidator) END_EVENT_TABLE() -///////// -// Clone + +/// @brief Clone +/// @return +/// wxObject* NumValidator::Clone() const { NumValidator *clone = new NumValidator(valPtr,isFloat,isSigned); return clone; } -//////////// -// Validate + +/// @brief Validate +/// @param parent +/// @return +/// bool NumValidator::Validate(wxWindow* parent) { wxTextCtrl *ctrl = (wxTextCtrl*) GetWindow(); wxString value = ctrl->GetValue(); @@ -115,8 +126,14 @@ bool NumValidator::Validate(wxWindow* parent) { } -/////////////////////////////////////// -// Check if a given character is valid + +/// @brief Check if a given character is valid +/// @param chr +/// @param isFirst +/// @param canSign +/// @param gotDecimal +/// @return +/// bool NumValidator::CheckCharacter(int chr,bool isFirst,bool canSign,bool &gotDecimal) { // Check sign if (chr == _T('-') || chr == _T('+')) { @@ -142,8 +159,11 @@ bool NumValidator::CheckCharacter(int chr,bool isFirst,bool canSign,bool &gotDec } -///////////////////// -// Filter keypresses + +/// @brief Filter keypresses +/// @param event +/// @return +/// void NumValidator::OnChar(wxKeyEvent& event) { wxTextCtrl *ctrl = (wxTextCtrl*) GetWindow(); wxString value = ctrl->GetValue(); @@ -185,8 +205,10 @@ void NumValidator::OnChar(wxKeyEvent& event) { } -////////////////////// -// Transfer to window + +/// @brief Transfer to window +/// @return +/// bool NumValidator::TransferToWindow() { wxTextCtrl *ctrl = (wxTextCtrl*) GetWindow(); if (isFloat) ctrl->SetValue(PrettyFloatD(fValue)); @@ -196,8 +218,9 @@ bool NumValidator::TransferToWindow() { } -/////////////////////// -// Receive from window + +/// @brief Receive from window +/// bool NumValidator::TransferFromWindow() { wxTextCtrl *ctrl = (wxTextCtrl*) GetWindow(); wxString value = ctrl->GetValue(); @@ -219,3 +242,4 @@ bool NumValidator::TransferFromWindow() { return true; } + diff --git a/aegisub/src/validators.h b/aegisub/src/validators.h index a17638a5f..2e21d1434 100644 --- a/aegisub/src/validators.h +++ b/aegisub/src/validators.h @@ -36,6 +36,8 @@ #ifndef VALIDATORS_H + +/// DOCME #define VALIDATORS_H @@ -45,15 +47,29 @@ #include -///////////////////// -// Numeric validator + +/// DOCME +/// @class NumValidator +/// @brief DOCME +/// +/// DOCME class NumValidator : public wxValidator { private: + + /// DOCME double fValue; + + /// DOCME int iValue; + + /// DOCME wxString* valPtr; + + /// DOCME bool isFloat; + + /// DOCME bool isSigned; wxObject* Clone() const; bool Validate(wxWindow* parent); @@ -74,3 +90,4 @@ public: #endif + diff --git a/aegisub/src/variable_data.cpp b/aegisub/src/variable_data.cpp index bcd1a4828..d1ebc0dc5 100644 --- a/aegisub/src/variable_data.cpp +++ b/aegisub/src/variable_data.cpp @@ -45,23 +45,27 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// VariableData::VariableData () { type = VARDATA_NONE; value = NULL; } -////////////// -// Destructor + +/// @brief Destructor +/// VariableData::~VariableData () { DeleteValue (); } -//////////////////////////// -// Deletes the stored value + +/// @brief Deletes the stored value +/// @return +/// void VariableData::DeleteValue () { if (!value) return; if (type == VARDATA_NONE) return; @@ -79,8 +83,10 @@ void VariableData::DeleteValue () { } -////////////////////// -// Sets to an integer + +/// @brief Sets to an integer +/// @param param +/// void VariableData::SetInt(int param) { DeleteValue(); type = VARDATA_INT; @@ -88,8 +94,10 @@ void VariableData::SetInt(int param) { } -/////////////////// -// Sets to a float + +/// @brief Sets to a float +/// @param param +/// void VariableData::SetFloat(double param) { DeleteValue(); type = VARDATA_FLOAT; @@ -97,8 +105,10 @@ void VariableData::SetFloat(double param) { } -///////////////////// -// Sets to a boolean + +/// @brief Sets to a boolean +/// @param param +/// void VariableData::SetBool(bool param) { DeleteValue(); type = VARDATA_BOOL; @@ -106,8 +116,10 @@ void VariableData::SetBool(bool param) { } -//////////////////// -// Sets to a string + +/// @brief Sets to a string +/// @param param +/// void VariableData::SetText(wxString param) { DeleteValue(); type = VARDATA_TEXT; @@ -115,8 +127,10 @@ void VariableData::SetText(wxString param) { } -//////////////////// -// Sets to a colour + +/// @brief Sets to a colour +/// @param param +/// void VariableData::SetColour(wxColour param) { DeleteValue(); type = VARDATA_COLOUR; @@ -124,8 +138,10 @@ void VariableData::SetColour(wxColour param) { } -//////////////////// -// Sets to a block + +/// @brief Sets to a block +/// @param param +/// void VariableData::SetBlock(AssDialogueBlockOverride *param) { DeleteValue(); type = VARDATA_BLOCK; @@ -133,8 +149,10 @@ void VariableData::SetBlock(AssDialogueBlockOverride *param) { } -///////////////////////////////////////////////////////// -// Resets a value with a string, preserving current type + +/// @brief Resets a value with a string, preserving current type +/// @param value +/// void VariableData::ResetWith(wxString value) { switch (type) { case VARDATA_INT: { @@ -168,8 +186,10 @@ void VariableData::ResetWith(wxString value) { } -/////////////////// -// Reads as an int + +/// @brief Reads as an int +/// @return +/// int VariableData::AsInt() const { if (!value) throw _T("Null parameter"); if (type == VARDATA_BOOL) return (*value_bool)?1:0; @@ -180,8 +200,10 @@ int VariableData::AsInt() const { } -//////////////////// -// Reads as a float + +/// @brief Reads as a float +/// @return +/// double VariableData::AsFloat() const { if (!value) throw _T("Null parameter"); if (type == VARDATA_FLOAT) return *value_float; @@ -191,8 +213,10 @@ double VariableData::AsFloat() const { } -/////////////////// -// Reads as a bool + +/// @brief Reads as a bool +/// @return +/// bool VariableData::AsBool() const { if (!value) throw _T("Null parameter"); if (type == VARDATA_BOOL) return *value_bool; @@ -203,8 +227,10 @@ bool VariableData::AsBool() const { } -///////////////////// -// Reads as a colour + +/// @brief Reads as a colour +/// @return +/// wxColour VariableData::AsColour() const { if (!value) throw _T("Null parameter"); if (type == VARDATA_COLOUR) return *value_colour; @@ -217,8 +243,10 @@ wxColour VariableData::AsColour() const { } -//////////////////// -// Reads as a block + +/// @brief Reads as a block +/// @return +/// AssDialogueBlockOverride *VariableData::AsBlock() const { if (!value) throw _T("Null parameter"); if (type != VARDATA_BLOCK) throw _T("Wrong parameter type, should be block"); @@ -226,8 +254,10 @@ AssDialogueBlockOverride *VariableData::AsBlock() const { } -///////////////////// -// Reads as a string + +/// @brief Reads as a string +/// @return +/// wxString VariableData::AsText() const { if (!value) throw _T("Null parameter"); if (type != VARDATA_TEXT) { @@ -245,15 +275,19 @@ wxString VariableData::AsText() const { } -///////////// -// Gets type + +/// @brief Gets type +/// @return +/// VariableDataType VariableData::GetType() const { return type; } -//////// -// Copy + +/// @brief Copy +/// @param param +/// void VariableData::operator= (const VariableData ¶m) { switch(param.GetType()) { case VARDATA_INT: SetInt(param.AsInt()); break; @@ -266,3 +300,4 @@ void VariableData::operator= (const VariableData ¶m) { } } + diff --git a/aegisub/src/variable_data.h b/aegisub/src/variable_data.h index 07c91c72f..95dfe493a 100644 --- a/aegisub/src/variable_data.h +++ b/aegisub/src/variable_data.h @@ -44,15 +44,29 @@ #include -///////////////// -// Enum of types + +/// DOCME enum VariableDataType { + + /// DOCME VARDATA_NONE, + + /// DOCME VARDATA_INT, + + /// DOCME VARDATA_FLOAT, + + /// DOCME VARDATA_TEXT, + + /// DOCME VARDATA_BOOL, + + /// DOCME VARDATA_COLOUR, + + /// DOCME VARDATA_BLOCK }; @@ -62,19 +76,39 @@ enum VariableDataType { class AssDialogueBlockOverride; -////////////////////////////////////// -// Class to store variable data types + +/// DOCME +/// @class VariableData +/// @brief DOCME +/// +/// DOCME class VariableData { private: union { + + /// DOCME void *value; + + /// DOCME int *value_int; + + /// DOCME double *value_float; + + /// DOCME bool *value_bool; + + /// DOCME wxString *value_text; + + /// DOCME wxColour *value_colour; + + /// DOCME AssDialogueBlockOverride *value_block; }; + + /// DOCME VariableDataType type; protected: @@ -104,3 +138,4 @@ public: void operator= (const VariableData ¶m); }; + diff --git a/aegisub/src/vector2d.cpp b/aegisub/src/vector2d.cpp index e7b3653c3..92a72a8f8 100644 --- a/aegisub/src/vector2d.cpp +++ b/aegisub/src/vector2d.cpp @@ -42,54 +42,78 @@ #include "vector2d.h" -//////////////////// -// Null constructor + +/// @brief Null constructor +/// Vector2D::Vector2D () { x = y = 0; } -//////////////////////// -// Standard constructor + +/// @brief Standard constructor +/// @param _x +/// @param _y +/// Vector2D::Vector2D (float _x,float _y) { x = _x; y = _y; } -//////////////////////////////////// -// Construction from another vector + +/// @brief Construction from another vector +/// @param vec +/// Vector2D::Vector2D (const Vector2D &vec) { x = vec.x; y = vec.y; } -////////////// -// Assignment + +/// @brief Assignment +/// @param param +/// void Vector2D::operator = (const Vector2D param) { x = param.x; y = param.y; } -////////////// -// Comparison + +/// @brief Comparison +/// @param param +/// @return +/// bool Vector2D::operator == (const Vector2D param) const { return ((x == param.x) && (y == param.y)); } + +/// @brief DOCME +/// @param param +/// @return +/// bool Vector2D::operator != (const Vector2D param) const { return ((x != param.x) || (y == param.y)); } -/////////// -// Adition + +/// @brief Adition +/// @param param +/// @return +/// Vector2D Vector2D::operator + (const Vector2D param) const { return Vector2D(x + param.x,y + param.y); } + +/// @brief DOCME +/// @param param +/// @return +/// Vector2D Vector2D::operator += (const Vector2D param) { x += param.x; y += param.y; @@ -97,12 +121,20 @@ Vector2D Vector2D::operator += (const Vector2D param) { } -/////////////// -// Subtraction + +/// @brief Subtraction +/// @param param +/// @return +/// Vector2D Vector2D::operator - (const Vector2D param) const { return Vector2D(x - param.x,y - param.y); } + +/// @brief DOCME +/// @param param +/// @return +/// Vector2D Vector2D::operator -= (const Vector2D param) { x -= param.x; y -= param.y; @@ -110,77 +142,118 @@ Vector2D Vector2D::operator -= (const Vector2D param) { } -////////// -// Negate + +/// @brief Negate +/// @return +/// Vector2D Vector2D::operator - () const { return Vector2D(-x,-y); } -//////////////////////////// -// Multiplication by scalar + +/// @brief Multiplication by scalar +/// @param param +/// @return +/// Vector2D Vector2D::operator * (float param) const { return Vector2D(x * param,y * param); } + +/// @brief DOCME +/// @param param +/// @return +/// Vector2D Vector2D::operator *= (float param) { x *= param; y *= param; return *this; } + +/// @brief DOCME +/// @param f +/// @param v +/// @return +/// Vector2D operator * (float f,const Vector2D &v) { return Vector2D(v.x * f,v.y * f); } -////////////////////// -// Division by scalar + +/// @brief Division by scalar +/// @param param +/// @return +/// Vector2D Vector2D::operator / (float param) const { return Vector2D(x / param,y / param); } + +/// @brief DOCME +/// @param param +/// @return +/// Vector2D Vector2D::operator /= (float param) { x /= param; y /= param; return *this; } + +/// @brief DOCME +/// @param f +/// @param v +/// @return +/// Vector2D operator / (float f,const Vector2D &v) { return Vector2D(v.x / f,v.y / f); } -///////////////// -// Cross product + +/// @brief Cross product +/// @param param +/// @return +/// float Vector2D::Cross (const Vector2D param) const { return x * param.y - y * param.x; } -/////////////// -// Dot product + +/// @brief Dot product +/// @param param +/// @return +/// float Vector2D::Dot (const Vector2D param) const { return (x * param.x) + (y * param.y); } -////////// -// Length + +/// @brief Length +/// @return +/// float Vector2D::Len () const { return sqrt(x*x + y*y); } -////////////////// -// Squared Length + +/// @brief Squared Length +/// @return +/// float Vector2D::SquareLen () const { return x*x + y*y; } -/////////// -// Unitary + +/// @brief Unitary +/// Vector2D Vector2D::Unit () const { float l = Len(); if (l != 0) { @@ -192,3 +265,4 @@ Vector2D Vector2D::Unit () const { else return Vector2D(0,0); } + diff --git a/aegisub/src/vector2d.h b/aegisub/src/vector2d.h index 6ec5e14dc..51f7d93e0 100644 --- a/aegisub/src/vector2d.h +++ b/aegisub/src/vector2d.h @@ -38,10 +38,18 @@ #pragma once -////////////////////////////// -// Vector2D class declaration + +/// DOCME +/// @class Vector2D +/// @brief DOCME +/// +/// DOCME class Vector2D { public: + + /// DOCME + + /// DOCME float x,y; Vector2D (); @@ -68,8 +76,15 @@ public: float Dot (const Vector2D param) const; float Len () const; + + /// @brief DOCME + /// @return + /// float Length () const { return Len(); } float SquareLen () const; + + /// @brief DOCME + /// float SquareLength () const { return SquareLen(); } }; @@ -79,3 +94,4 @@ public: Vector2D operator * (float f,const Vector2D &v); Vector2D operator / (float f,const Vector2D &v); + diff --git a/aegisub/src/version.cpp b/aegisub/src/version.cpp index 9209cc28e..95b58d7e4 100644 --- a/aegisub/src/version.cpp +++ b/aegisub/src/version.cpp @@ -45,34 +45,62 @@ #else #ifndef BUILD_SVN_REVISION + +/// DOCME #define BUILD_SVN_REVISION 0 #endif #endif + +/// DOCME #define _T_rec(X) _T(X) + +/// DOCME #define _T_stringize(X) _T(#X) + +/// DOCME #define _T_int(X) _T_stringize(X) + +/// DOCME #define BUILD_TIMESTAMP _T_rec(__DATE__) _T(" ") _T_rec(__TIME__) // Define FINAL_RELEASE to mark a build as a "final" version, ie. not pre-release version // In that case it won't include the SVN revision information + +/// DOCME struct VersionInfoStruct { - // Some raw data + + /// DOCME wxChar *VersionNumber; + + /// DOCME bool IsDebug; + + /// DOCME bool IsRelease; + + /// DOCME int SvnRev; + + /// DOCME wxChar *BuildTime; + + /// DOCME wxChar *BuildCredit; - // Nice strings for display + + /// DOCME wxString LongVersionString; + + /// DOCME wxString ShortVersionString; - // Generate the above data + + /// @brief // Generate the above data + /// VersionInfoStruct() { wxString VersionStr; @@ -134,34 +162,64 @@ struct VersionInfoStruct { }; + +/// DOCME VersionInfoStruct versioninfo; + +/// @brief DOCME +/// @return +/// wxString GetAegisubLongVersionString() { return versioninfo.LongVersionString; } + +/// @brief DOCME +/// @return +/// wxString GetAegisubShortVersionString() { return versioninfo.ShortVersionString; } + +/// @brief DOCME +/// @return +/// wxString GetAegisubBuildTime() { return versioninfo.BuildTime; } + +/// @brief DOCME +/// @return +/// wxString GetAegisubBuildCredit() { return versioninfo.BuildCredit; } + +/// @brief DOCME +/// @return +/// bool GetIsOfficialRelease() { return versioninfo.IsRelease; } + +/// @brief DOCME +/// @return +/// wxString GetVersionNumber() { return versioninfo.VersionNumber; } + +/// @brief DOCME +/// int GetSVNRevision() { return versioninfo.SvnRev; } + diff --git a/aegisub/src/vfr.cpp b/aegisub/src/vfr.cpp index cb7daec39..864439ab7 100644 --- a/aegisub/src/vfr.cpp +++ b/aegisub/src/vfr.cpp @@ -47,22 +47,26 @@ #include "text_file_writer.h" -///////////////////// -// V2 Clear function + +/// @brief V2 Clear function +/// void FrameRate::Clear () { Frame.clear(); } -//////////////// -// V2 Add frame + +/// @brief V2 Add frame +/// @param ms +/// void FrameRate::AddFrame(int ms) { Frame.push_back(ms); } -////////////////// -// V2 Get Average + +/// @brief V2 Get Average +/// void FrameRate::CalcAverage() { if (Frame.size() <= 1) @@ -72,23 +76,26 @@ void FrameRate::CalcAverage() { } -//////////////////////// FrameRate ////////////////////// -/////////////// -// Constructor + +/// @brief Constructor FrameRate ////////////////////// +/// FrameRate::FrameRate() { Unload(); } -////////////// -// Destructor + +/// @brief Destructor +/// FrameRate::~FrameRate() { Unload(); } -////////////////// -// Loads VFR file + +/// @brief Loads VFR file +/// @param filename +/// void FrameRate::Load(wxString filename) { using namespace std; @@ -231,8 +238,10 @@ void FrameRate::Load(wxString filename) { } -//////// -// Save + +/// @brief Save +/// @param filename +/// void FrameRate::Save(wxString filename) { TextFileWriter file(filename,_T("ASCII")); file.WriteLineToFile(_T("# timecode format v2")); @@ -242,8 +251,9 @@ void FrameRate::Save(wxString filename) { } -////////// -// Unload + +/// @brief Unload +/// void FrameRate::Unload () { FrameRateType = NONE; AverageFrameRate = 0; @@ -255,8 +265,10 @@ void FrameRate::Unload () { } -/////////////// -// Sets to CFR + +/// @brief Sets to CFR +/// @param fps +/// void FrameRate::SetCFR(double fps) { Unload(); loaded = true; @@ -265,8 +277,10 @@ void FrameRate::SetCFR(double fps) { } -/////////////// -// Sets to VFR + +/// @brief Sets to VFR +/// @param newTimes +/// void FrameRate::SetVFR(std::vector newTimes) { // Prepare Unload(); @@ -282,8 +296,12 @@ void FrameRate::SetVFR(std::vector newTimes) { } -///////////////////////////// -// Gets frame number at time + +/// @brief Gets frame number at time +/// @param ms +/// @param useceil +/// @return +/// int FrameRate::PFrameAtTime(int ms,bool useceil) { // Check if it's loaded if (!loaded) return -1; @@ -345,8 +363,11 @@ int FrameRate::PFrameAtTime(int ms,bool useceil) { } -////////////////////// -// Gets time at frame + +/// @brief Gets time at frame +/// @param frame +/// @return +/// int FrameRate::PTimeAtFrame(int frame) { // Not loaded if (!loaded) return -1; @@ -373,18 +394,24 @@ int FrameRate::PTimeAtFrame(int frame) { } -///////////////////////////// -// Get correct frame at time -// returns the adjusted time for end frames when start=false -// otherwise for start frames + +/// @brief otherwise for start frames returns the adjusted time for end frames when start=false Get correct frame at time +/// @param ms +/// @param start +/// @return +/// int FrameRate::GetFrameAtTime(int ms,bool start) { return PFrameAtTime(ms,start); } -///////////////////////////// -// Get correct time at frame -// compensates and returns an end time when start=false + +/// @brief compensates and returns an end time when start=false Get correct time at frame +/// @param frame +/// @param start +/// @param exact +/// @return +/// int FrameRate::GetTimeAtFrame(int frame,bool start,bool exact) { int finalTime; @@ -409,16 +436,19 @@ int FrameRate::GetTimeAtFrame(int frame,bool start,bool exact) { } -//////////////////////////////////////// -// Get the current list of frames/times + +/// @brief Get the current list of frames/times +/// @return +/// std::vector FrameRate::GetFrameTimeList() { return Frame; } -/////////////////////////////////////////// -// Calculate the common FPS for evil stuff -// e.g., in a mix of 24fps and 30fps, returns 120fps + +/// @brief e.g., in a mix of 24fps and 30fps, returns 120fps Calculate the common FPS for evil stuff +/// @return +/// double FrameRate::GetCommonFPS() { // Variables int curDist; @@ -515,8 +545,11 @@ double FrameRate::GetCommonFPS() { } -/////////// -// Globals + +/// DOCME FrameRate VFR_Output; + +/// DOCME FrameRate VFR_Input; + diff --git a/aegisub/src/vfr.h b/aegisub/src/vfr.h index b2742aabe..925fcea87 100644 --- a/aegisub/src/vfr.h +++ b/aegisub/src/vfr.h @@ -51,25 +51,42 @@ #include "include/aegisub/aegisub.h" -/////////////////////// -// Framerate type enum + +/// DOCME enum ASS_FrameRateType { + + /// DOCME NONE, + + /// DOCME CFR, + + /// DOCME VFR }; -/////////////////// -// Framerate class + +/// DOCME +/// @class FrameRate +/// @brief DOCME +/// +/// DOCME class FrameRate { friend class VideoContext; private: + + /// DOCME double last_time; + + /// DOCME int last_frame; + + /// DOCME std::vector Frame; - // contains the assumed fps for v1 timecodes, average for v2 and actual fps for cfr + + /// DOCME double AverageFrameRate; void AddFrame(int ms); @@ -79,8 +96,14 @@ private: int PFrameAtTime(int ms,bool useCeil=false); int PTimeAtFrame(int frame); + + /// DOCME ASS_FrameRateType FrameRateType; + + /// DOCME bool loaded; + + /// DOCME wxString vfrFile; public: @@ -98,9 +121,24 @@ public: int GetFrameAtTime(int ms,bool start=true); int GetTimeAtFrame(int frame,bool start=true,bool exact=false); + + /// @brief DOCME + /// @return + /// double GetAverage() { return AverageFrameRate; }; + + /// @brief DOCME + /// @return + /// bool IsLoaded() { return loaded; }; + + /// @brief DOCME + /// @return + /// ASS_FrameRateType GetFrameRateType() { return FrameRateType; }; + + /// @brief DOCME + /// wxString GetFilename() { return vfrFile; }; std::vector GetFrameTimeList(); @@ -113,3 +151,4 @@ public: extern FrameRate VFR_Output; extern FrameRate VFR_Input; + diff --git a/aegisub/src/vfw_wrap.cpp b/aegisub/src/vfw_wrap.cpp index 34668b37e..a6a64a40e 100644 --- a/aegisub/src/vfw_wrap.cpp +++ b/aegisub/src/vfw_wrap.cpp @@ -48,8 +48,10 @@ #endif -///////////////////// -// Get keyframe list + +/// @brief Get keyframe list +/// @param filename +/// wxArrayInt VFWWrapper::GetKeyFrames(wxString filename) { wxArrayInt frames; @@ -122,3 +124,4 @@ wxArrayInt VFWWrapper::GetKeyFrames(wxString filename) { return frames; } + diff --git a/aegisub/src/vfw_wrap.h b/aegisub/src/vfw_wrap.h index 35962502d..09a88ad92 100644 --- a/aegisub/src/vfw_wrap.h +++ b/aegisub/src/vfw_wrap.h @@ -43,10 +43,15 @@ #include -///////////////////// -// VFW wrapper class + +/// DOCME +/// @class VFWWrapper +/// @brief DOCME +/// +/// DOCME class VFWWrapper { public: static wxArrayInt GetKeyFrames(wxString filename); }; + diff --git a/aegisub/src/video_box.cpp b/aegisub/src/video_box.cpp index 18bb4186c..fa2da39a1 100644 --- a/aegisub/src/video_box.cpp +++ b/aegisub/src/video_box.cpp @@ -66,8 +66,11 @@ -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param isDetached +/// VideoBox::VideoBox(wxWindow *parent, bool isDetached) : wxPanel (parent,-1) { @@ -181,8 +184,10 @@ BEGIN_EVENT_TABLE(VideoBox, wxPanel) END_EVENT_TABLE() -////////////// -// Play video + +/// @brief Play video +/// @param event +/// void VideoBox::OnVideoPlay(wxCommandEvent &event) { VideoContext *ctx = VideoContext::Get(); #ifdef __APPLE__ @@ -194,8 +199,10 @@ void VideoBox::OnVideoPlay(wxCommandEvent &event) { } -/////////////////// -// Play video line + +/// @brief Play video line +/// @param event +/// void VideoBox::OnVideoPlayLine(wxCommandEvent &event) { VideoContext *ctx = VideoContext::Get(); #ifdef __APPLE__ @@ -207,48 +214,61 @@ void VideoBox::OnVideoPlayLine(wxCommandEvent &event) { } -////////////// -// Stop video + +/// @brief Stop video +/// @param event +/// void VideoBox::OnVideoStop(wxCommandEvent &event) { VideoContext::Get()->Stop(); } -///////////////////// -// Toggle autoscroll + +/// @brief Toggle autoscroll +/// @param event +/// void VideoBox::OnVideoToggleScroll(wxCommandEvent &event) { Options.SetBool(_T("Sync video with subs"),AutoScroll->GetValue()); Options.Save(); } -//////////////// -// Mode changed + +/// @brief Mode changed +/// @param event +/// void VideoBox::OnModeChange(wxCommandEvent &event) { videoDisplay->SetVisualMode(event.GetId() - Video_Mode_Standard); } -/////////////////////////// -// Sub-tool button pressed + +/// @brief Sub-tool button pressed +/// @param event +/// void VideoBox::OnSubTool(wxCommandEvent &event) { videoDisplay->visual->OnSubTool(event); } -/////////////////// -// Realtime toggle + +/// @brief Realtime toggle +/// @param event +/// void VideoBox::OnToggleRealtime(wxCommandEvent &event) { Options.SetBool(_T("Video Visual Realtime"),event.IsChecked()); Options.Save(); } -//////// -// Help + +/// @brief Help +/// @param event +/// void VideoBox::OnHelp(wxCommandEvent &event) { HelpButton::OpenPage(_T("Visual Typesetting")); } + diff --git a/aegisub/src/video_box.h b/aegisub/src/video_box.h index 4858a9b51..76f9581cf 100644 --- a/aegisub/src/video_box.h +++ b/aegisub/src/video_box.h @@ -56,8 +56,12 @@ class ToggleBitmap; class FrameMain; -/////////////////// -// Video box class + +/// DOCME +/// @class VideoBox +/// @brief DOCME +/// +/// DOCME class VideoBox : public wxPanel { private: void OnVideoPlay(wxCommandEvent &event); @@ -71,17 +75,37 @@ private: void OnHelp(wxCommandEvent &event); public: + + /// DOCME wxToolBar *visualToolBar; + + /// DOCME wxToolBar *visualSubToolBar; //wxSizer *visualSubToolBar; + + /// DOCME ToggleBitmap *AutoScroll; + + /// DOCME wxBoxSizer *VideoSizer; + + /// DOCME wxBoxSizer *videoSliderSizer; + + /// DOCME wxWindow *videoPage; + + /// DOCME wxTextCtrl *VideoPosition; + + /// DOCME wxTextCtrl *VideoSubsPos; + + /// DOCME VideoDisplay *videoDisplay; + + /// DOCME VideoSlider *videoSlider; VideoBox (wxWindow *parent, bool isDetached); @@ -93,19 +117,46 @@ public: /////// // IDs enum { + + /// DOCME Video_Play = 500, + + /// DOCME Video_Play_Line, + + /// DOCME Video_Stop, + + /// DOCME Video_Auto_Scroll, + + /// DOCME Video_Mode_Standard, + + /// DOCME Video_Mode_Drag, + + /// DOCME Video_Mode_Rotate_Z, + + /// DOCME Video_Mode_Rotate_XY, + + /// DOCME Video_Mode_Scale, + + /// DOCME Video_Mode_Clip, + + /// DOCME Video_Mode_Vector_Clip, + + /// DOCME Video_Mode_Realtime, + + /// DOCME Video_Mode_Help }; + diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index b4700b97e..862fbb576 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -77,6 +77,8 @@ /////// // IDs enum { + + /// DOCME VIDEO_PLAY_TIMER = 1300 }; @@ -88,13 +90,14 @@ BEGIN_EVENT_TABLE(VideoContext, wxEvtHandler) END_EVENT_TABLE() -//////////// -// Instance + +/// DOCME VideoContext *VideoContext::instance = NULL; -/////////////// -// Constructor + +/// @brief Constructor +/// VideoContext::VideoContext() { // Set GL context glContext = NULL; @@ -127,8 +130,9 @@ VideoContext::VideoContext() { } -////////////// -// Destructor + +/// @brief Destructor +/// VideoContext::~VideoContext () { Reset(); if (ownGlContext) @@ -137,8 +141,10 @@ VideoContext::~VideoContext () { } -//////////////// -// Get Instance + +/// @brief Get Instance +/// @return +/// VideoContext *VideoContext::Get() { if (!instance) { instance = new VideoContext; @@ -147,8 +153,9 @@ VideoContext *VideoContext::Get() { } -///////// -// Clear + +/// @brief Clear +/// void VideoContext::Clear() { instance->audio = NULL; delete instance; @@ -156,8 +163,9 @@ void VideoContext::Clear() { } -///////// -// Reset + +/// @brief Reset +/// void VideoContext::Reset() { // Reset ?video path StandardPaths::SetPathValue(_T("?video"),_T("")); @@ -208,8 +216,9 @@ void VideoContext::Reset() { } -//////////////// -// Reload video + +/// @brief Reload video +/// void VideoContext::Reload() { if (IsLoaded()) { wxString name = videoName; @@ -221,8 +230,9 @@ void VideoContext::Reload() { } -////////////////// -// Unload texture + +/// @brief Unload texture +/// void VideoContext::UnloadTexture() { // Remove textures if (lastTex != 0) { @@ -233,8 +243,10 @@ void VideoContext::UnloadTexture() { } -/////////////////////// -// Sets video filename + +/// @brief Sets video filename +/// @param filename +/// void VideoContext::SetVideo(const wxString &filename) { // Unload video Reset(); @@ -318,8 +330,11 @@ void VideoContext::SetVideo(const wxString &filename) { } -/////////////////// -// Add new display + +/// @brief Add new display +/// @param display +/// @return +/// void VideoContext::AddDisplay(VideoDisplay *display) { for (std::list::iterator cur=displayList.begin();cur!=displayList.end();cur++) { if ((*cur) == display) return; @@ -328,15 +343,19 @@ void VideoContext::AddDisplay(VideoDisplay *display) { } -////////////////// -// Remove display + +/// @brief Remove display +/// @param display +/// void VideoContext::RemoveDisplay(VideoDisplay *display) { displayList.remove(display); } -/////////////////// -// Update displays + +/// @brief Update displays +/// @param full +/// void VideoContext::UpdateDisplays(bool full) { for (std::list::iterator cur=displayList.begin();cur!=displayList.end();cur++) { // Get display @@ -372,8 +391,11 @@ void VideoContext::UpdateDisplays(bool full) { } -///////////////////// -// Refresh subtitles + +/// @brief Refresh subtitles +/// @param video +/// @param subtitles +/// void VideoContext::Refresh (bool video, bool subtitles) { // Reset frame lastFrame = -1; @@ -395,8 +417,11 @@ void VideoContext::Refresh (bool video, bool subtitles) { } -/////////////////////////////////////// -// Jumps to a frame and update display + +/// @brief Jumps to a frame and update display +/// @param n +/// @return +/// void VideoContext::JumpToFrame(int n) { // Loaded? if (!loaded) return; @@ -448,8 +473,11 @@ void VideoContext::JumpToFrame(int n) { } -//////////////////////////// -// Jumps to a specific time + +/// @brief Jumps to a specific time +/// @param ms +/// @param exact +/// void VideoContext::JumpToTime(int ms,bool exact) { int frame; if (exact) frame = VFR_Output.PFrameAtTime(ms); @@ -458,8 +486,11 @@ void VideoContext::JumpToTime(int ms,bool exact) { } -////////////////// -// Get GL context + +/// @brief Get GL context +/// @param canvas +/// @return +/// wxGLContext *VideoContext::GetGLContext(wxGLCanvas *canvas) { // wxGLCanvas and wxGLContext is a funky couple. // On wxMac wxGLContext has a different constructor than everywhere else... @@ -482,8 +513,12 @@ wxGLContext *VideoContext::GetGLContext(wxGLCanvas *canvas) { } -//////////////////////// -// Requests a new frame + +/// @brief Requests a new frame +/// @param n +/// @param raw +/// @return +/// AegiVideoFrame VideoContext::GetFrame(int n,bool raw) { // Current frame if -1 if (n == -1) n = frame_n; @@ -503,8 +538,11 @@ AegiVideoFrame VideoContext::GetFrame(int n,bool raw) { } -/////////////////////////// -// Get GL Texture of frame + +/// @brief Get GL Texture of frame +/// @param n +/// @return +/// GLuint VideoContext::GetFrameAsTexture(int n) { // Already uploaded if (n == lastFrame || n == -1) return lastTex; @@ -587,8 +625,10 @@ GLuint VideoContext::GetFrameAsTexture(int n) { } -///////////////// -// Save snapshot + +/// @brief Save snapshot +/// @param raw +/// void VideoContext::SaveSnapshot(bool raw) { // Get folder wxString option = Options.AsText(_T("Video Screenshot Path")); @@ -628,15 +668,20 @@ void VideoContext::SaveSnapshot(bool raw) { } -//////////////////////////// -// Get dimensions of script + +/// @brief Get dimensions of script +/// @param sw +/// @param sh +/// void VideoContext::GetScriptSize(int &sw,int &sh) { grid->ass->GetResolution(sw,sh); } -//////// -// Play + +/// @brief Play +/// @return +/// void VideoContext::Play() { // Stop if already playing if (isPlaying) { @@ -661,8 +706,10 @@ void VideoContext::Play() { } -///////////// -// Play line + +/// @brief Play line +/// @return +/// void VideoContext::PlayLine() { // Get line AssDialogue *curline = grid->GetDialogue(grid->editBox->linen); @@ -689,8 +736,9 @@ void VideoContext::PlayLine() { } -//////// -// Stop + +/// @brief Stop +/// void VideoContext::Stop() { if (isPlaying) { playback.Stop(); @@ -700,8 +748,11 @@ void VideoContext::Stop() { } -////////////// -// Play timer + +/// @brief Play timer +/// @param event +/// @return +/// void VideoContext::OnPlayTimer(wxTimerEvent &event) { // Lock wxMutexError res = playMutex.TryLock(); @@ -753,8 +804,10 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) { } -////////////////////////////// -// Get name of temp work file + +/// @brief Get name of temp work file +/// @return +/// wxString VideoContext::GetTempWorkFile () { if (tempfile.IsEmpty()) { tempfile = wxFileName::CreateTempFileName(_T("aegisub")); @@ -765,53 +818,67 @@ wxString VideoContext::GetTempWorkFile () { } -///////////////// -// Get keyframes + +/// @brief Get keyframes +/// @return +/// wxArrayInt VideoContext::GetKeyFrames() { if (OverKeyFramesLoaded()) return overKeyFrames; return KeyFrames; } -///////////////// -// Set keyframes + +/// @brief Set keyframes +/// @param frames +/// void VideoContext::SetKeyFrames(wxArrayInt frames) { KeyFrames = frames; } -///////////////////////// -// Set keyframe override + +/// @brief Set keyframe override +/// @param frames +/// void VideoContext::SetOverKeyFrames(wxArrayInt frames) { overKeyFrames = frames; overKeyFramesLoaded = true; } -/////////////////// -// Close keyframes + +/// @brief Close keyframes +/// void VideoContext::CloseOverKeyFrames() { overKeyFrames.Clear(); overKeyFramesLoaded = false; } -////////////////////////////////////////// -// Check if override keyframes are loaded + +/// @brief Check if override keyframes are loaded +/// @return +/// bool VideoContext::OverKeyFramesLoaded() { return overKeyFramesLoaded; } -///////////////////////////////// -// Check if keyframes are loaded + +/// @brief Check if keyframes are loaded +/// @return +/// bool VideoContext::KeyFramesLoaded() { return overKeyFramesLoaded || keyFramesLoaded; } -////////////////////////// -// Calculate aspect ratio + +/// @brief Calculate aspect ratio +/// @param type +/// @return +/// double VideoContext::GetARFromType(int type) { if (type == 0) return (double)VideoContext::Get()->GetWidth()/(double)VideoContext::Get()->GetHeight(); if (type == 1) return 4.0/3.0; @@ -821,8 +888,11 @@ double VideoContext::GetARFromType(int type) { } -///////////////////// -// Sets aspect ratio + +/// @brief Sets aspect ratio +/// @param _type +/// @param value +/// void VideoContext::SetAspectRatio(int _type, double value) { // Get value if (_type != 4) value = GetARFromType(_type); @@ -836,8 +906,10 @@ void VideoContext::SetAspectRatio(int _type, double value) { } -////////////////////// -// Thread constructor + +/// @brief Thread constructor +/// @param par +/// VideoContextThread::VideoContextThread(VideoContext *par) : wxThread(wxTHREAD_DETACHED) { @@ -845,8 +917,9 @@ VideoContextThread::VideoContextThread(VideoContext *par) } -////////////////////// -// Thread entry point + +/// @brief Thread entry point +/// wxThread::ExitCode VideoContextThread::Entry() { // Set up thread int frame = parent->threadNextFrame; @@ -883,3 +956,4 @@ wxThread::ExitCode VideoContextThread::Entry() { } } + diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h index a9617f6bf..9c00d056b 100644 --- a/aegisub/src/video_context.h +++ b/aegisub/src/video_context.h @@ -55,6 +55,8 @@ #else #include #include + +/// DOCME typedef GLuint GLhandleARB; #endif #include "video_frame.h" @@ -72,70 +74,164 @@ class SubtitlesProvider; class VideoContextThread; -////////////// -// Main class + +/// DOCME +/// @class VideoContext +/// @brief DOCME +/// +/// DOCME class VideoContext : public wxEvtHandler { friend class AudioProvider; friend class VisualTool; friend class VideoContextThread; private: + + /// DOCME static VideoContext *instance; + + /// DOCME std::list displayList; + + /// DOCME GLuint lastTex; + + /// DOCME int lastFrame; + + /// DOCME bool ownGlContext; + + /// DOCME wxGLContext *glContext; + + /// DOCME VideoFrameFormat vidFormat; + + /// DOCME AegiVideoFrame tempFrame; + + /// DOCME wxString tempfile; + + /// DOCME VideoProvider *provider; + + /// DOCME SubtitlesProvider *subsProvider; + + /// DOCME bool keyFramesLoaded; + + /// DOCME bool overKeyFramesLoaded; + + /// DOCME wxArrayInt KeyFrames; + + /// DOCME wxArrayInt overKeyFrames; + + /// DOCME wxString keyFramesFilename; + + /// DOCME wxMutex playMutex; + + /// DOCME wxTimer playback; + + /// DOCME wxStopWatch playTime; + + /// DOCME int startFrame; + + /// DOCME int endFrame; + + /// DOCME int playNextFrame; + + /// DOCME int nextFrame; + + /// DOCME bool threaded; + + /// DOCME bool threadLocked; + + /// DOCME int threadNextFrame; + + /// DOCME wxMutex vidMutex; + + /// DOCME wxThread *thread; + + /// DOCME bool loaded; + + /// DOCME bool isInverted; + + /// DOCME bool isPlaying; + + /// DOCME bool keepAudioSync; + + /// DOCME + + /// DOCME float texW,texH; + + /// DOCME + + /// DOCME int w,h; + + /// DOCME int frame_n; + + /// DOCME int length; + + /// DOCME double fps; + + /// DOCME double arValue; + + /// DOCME int arType; void UnloadTexture(); void OnPlayTimer(wxTimerEvent &event); public: + + /// DOCME SubtitlesGrid *grid; + + /// DOCME wxString videoName; + + /// DOCME AssDialogue *curLine; + + /// DOCME AudioDisplay *audio; VideoContext(); @@ -144,6 +240,10 @@ public: void AddDisplay(VideoDisplay *display); void RemoveDisplay(VideoDisplay *display); + + /// @brief DOCME + /// @return + /// VideoProvider *GetProvider() { return provider; } AegiVideoFrame GetFrame(int n,bool raw=false); @@ -151,26 +251,88 @@ public: wxGLContext *GetGLContext(wxGLCanvas *canvas); GLuint GetFrameAsTexture(int n); + + /// @brief DOCME + /// @return + /// float GetTexW() { return texW; } + + /// @brief DOCME + /// @return + /// float GetTexH() { return texH; } + + /// @brief DOCME + /// @return + /// VideoFrameFormat GetFormat() { return vidFormat; } + + /// @brief DOCME + /// @return + /// bool IsLoaded() { return loaded; } + + /// @brief DOCME + /// @return + /// bool IsPlaying() { return isPlaying; } + + /// @brief DOCME + /// @return + /// bool IsInverted() { return isInverted; } + + /// @brief DOCME + /// @param true + /// @return + /// void EnableAudioSync(bool sync = true) { keepAudioSync = sync; } + + /// @brief DOCME + /// @return + /// int GetWidth() { return w; } + + /// @brief DOCME + /// @return + /// int GetHeight() { return h; } + + /// @brief DOCME + /// @return + /// int GetLength() { return length; } + + /// @brief DOCME + /// @return + /// int GetFrameN() { return frame_n; } + + /// @brief DOCME + /// @return + /// double GetFPS() { return fps; } + + /// @brief DOCME + /// @param _fps + /// @return + /// void SetFPS(double _fps) { fps = _fps; } double GetARFromType(int type); void SetAspectRatio(int type,double value=1.0); + + /// @brief DOCME + /// @return + /// int GetAspectRatioType() { return arType; } + + /// @brief DOCME + /// @return + /// double GetAspectRatioValue() { return arValue; } void SetVideo(const wxString &filename); @@ -196,7 +358,15 @@ public: void CloseOverKeyFrames(); bool OverKeyFramesLoaded(); bool KeyFramesLoaded(); + + /// @brief DOCME + /// @return + /// wxString GetKeyFramesName() { return keyFramesFilename; } + + /// @brief DOCME + /// @param name + /// void SetKeyFramesName(wxString name) { keyFramesFilename = name; } static VideoContext *Get(); @@ -206,10 +376,16 @@ public: }; -////////// -// Thread + +/// DOCME +/// @class VideoContextThread +/// @brief DOCME +/// +/// DOCME class VideoContextThread : public wxThread { private: + + /// DOCME VideoContext *parent; public: @@ -217,3 +393,4 @@ public: wxThread::ExitCode Entry(); }; + diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 98a198ef2..910e58f18 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -83,10 +83,20 @@ /////// // IDs enum { + + /// DOCME VIDEO_MENU_COPY_COORDS = 1230, + + /// DOCME VIDEO_MENU_COPY_TO_CLIPBOARD, + + /// DOCME VIDEO_MENU_COPY_TO_CLIPBOARD_RAW, + + /// DOCME VIDEO_MENU_SAVE_SNAPSHOT, + + /// DOCME VIDEO_MENU_SAVE_SNAPSHOT_RAW }; @@ -108,12 +118,19 @@ BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas) END_EVENT_TABLE() -////////////// -// Parameters + +/// DOCME int attribList[] = { WX_GL_RGBA , WX_GL_DOUBLEBUFFER, WX_GL_STENCIL_SIZE, 8, 0 }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// @param pos +/// @param size +/// @param style +/// @param name +/// VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) #ifdef __WXMAC__ : wxGLCanvas (parent, id, pos, size, style, name, attribList) @@ -138,8 +155,9 @@ VideoDisplay::VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos, } -////////////// -// Destructor + +/// @brief Destructor +/// VideoDisplay::~VideoDisplay () { delete visual; visual = NULL; @@ -147,8 +165,10 @@ VideoDisplay::~VideoDisplay () { } -/////////////// -// Show cursor + +/// @brief Show cursor +/// @param show +/// void VideoDisplay::ShowCursor(bool show) { // Show if (show) SetCursor(wxNullCursor); @@ -167,8 +187,10 @@ void VideoDisplay::ShowCursor(bool show) { } -////////// -// Render + +/// @brief Render +/// @return +/// void VideoDisplay::Render() // Yes it's legal C++ to replace the body of a function with one huge try..catch statement try { @@ -326,8 +348,9 @@ catch (...) { } -/////////////////////////////////// -// TV effects (overscan and so on) + +/// @brief TV effects (overscan and so on) +/// void VideoDisplay::DrawTVEffects() { // Get coordinates int sw,sh; @@ -356,8 +379,13 @@ void VideoDisplay::DrawTVEffects() { } -////////////////////// -// Draw overscan mask + +/// @brief Draw overscan mask +/// @param sizeH +/// @param sizeV +/// @param colour +/// @param alpha +/// void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double alpha) { // Parameters int sw,sh; @@ -390,8 +418,10 @@ void VideoDisplay::DrawOverscanMask(int sizeH,int sizeV,wxColour colour,double a } -/////////////// -// Update size + +/// @brief Update size +/// @return +/// void VideoDisplay::UpdateSize() { // Don't do anything if it's a free sizing display //if (freeSize) return; @@ -436,8 +466,10 @@ void VideoDisplay::UpdateSize() { } -////////// -// Resets + +/// @brief Resets +/// @return +/// void VideoDisplay::Reset() { // Only calculate sizes if it's visible if (!IsShownOnScreen()) return; @@ -454,16 +486,20 @@ void VideoDisplay::Reset() { } -/////////////// -// Paint event + +/// @brief Paint event +/// @param event +/// void VideoDisplay::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); Render(); } -////////////// -// Size Event + +/// @brief Size Event +/// @param event +/// void VideoDisplay::OnSizeEvent(wxSizeEvent &event) { //Refresh(false); if (freeSize) { @@ -473,8 +509,11 @@ void VideoDisplay::OnSizeEvent(wxSizeEvent &event) { } -/////////////// -// Mouse stuff + +/// @brief Mouse stuff +/// @param event +/// @return +/// void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { // Locked? if (locked) return; @@ -517,8 +556,10 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { } -///////////// -// Key event + +/// @brief Key event +/// @param event +/// void VideoDisplay::OnKey(wxKeyEvent &event) { // FIXME: should these be configurable? // Think of the frenchmen and other people not using qwerty layout @@ -534,16 +575,20 @@ void VideoDisplay::OnKey(wxKeyEvent &event) { -/////////////////// -// Sets zoom level + +/// @brief Sets zoom level +/// @param value +/// void VideoDisplay::SetZoom(double value) { zoomValue = value; UpdateSize(); } -////////////////////// -// Sets zoom position + +/// @brief Sets zoom position +/// @param value +/// void VideoDisplay::SetZoomPos(int value) { if (value < 0) value = 0; if (value > 15) value = 15; @@ -552,8 +597,9 @@ void VideoDisplay::SetZoomPos(int value) { } -//////////////////////////// -// Updates position display + +/// @brief Updates position display +/// void VideoDisplay::UpdatePositionDisplay() { // Update position display control if (!PositionDisplay) { @@ -595,8 +641,9 @@ void VideoDisplay::UpdatePositionDisplay() { } -//////////////////////////////////////////////////// -// Updates box with subs position relative to frame + +/// @brief Updates box with subs position relative to frame +/// void VideoDisplay::UpdateSubsRelativeTime() { // Set variables wxString startSign; @@ -627,8 +674,10 @@ void VideoDisplay::UpdateSubsRelativeTime() { } -///////////////////// -// Copy to clipboard + +/// @brief Copy to clipboard +/// @param event +/// void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) { if (wxTheClipboard->Open()) { wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1).GetImage(),24))); @@ -637,8 +686,10 @@ void VideoDisplay::OnCopyToClipboard(wxCommandEvent &event) { } -////////////////////////// -// Copy to clipboard (raw) + +/// @brief Copy to clipboard (raw) +/// @param event +/// void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &event) { if (wxTheClipboard->Open()) { wxTheClipboard->SetData(new wxBitmapDataObject(wxBitmap(VideoContext::Get()->GetFrame(-1,true).GetImage(),24))); @@ -647,22 +698,28 @@ void VideoDisplay::OnCopyToClipboardRaw(wxCommandEvent &event) { } -///////////////// -// Save snapshot + +/// @brief Save snapshot +/// @param event +/// void VideoDisplay::OnSaveSnapshot(wxCommandEvent &event) { VideoContext::Get()->SaveSnapshot(false); } -////////////////////// -// Save snapshot (raw) + +/// @brief Save snapshot (raw) +/// @param event +/// void VideoDisplay::OnSaveSnapshotRaw(wxCommandEvent &event) { VideoContext::Get()->SaveSnapshot(true); } -///////////////////// -// Copy coordinates + +/// @brief Copy coordinates +/// @param event +/// void VideoDisplay::OnCopyCoords(wxCommandEvent &event) { if (wxTheClipboard->Open()) { int sw,sh; @@ -675,8 +732,11 @@ void VideoDisplay::OnCopyCoords(wxCommandEvent &event) { } -///////////////////////////// -// Convert mouse coordinates + +/// @brief Convert mouse coordinates +/// @param x +/// @param y +/// void VideoDisplay::ConvertMouseCoords(int &x,int &y) { int w,h; GetClientSize(&w,&h); @@ -689,8 +749,10 @@ void VideoDisplay::ConvertMouseCoords(int &x,int &y) { } -//////////// -// Set mode + +/// @brief Set mode +/// @param mode +/// void VideoDisplay::SetVisualMode(int mode) { // Set visual if (visualMode != mode) { @@ -726,3 +788,4 @@ void VideoDisplay::SetVisualMode(int mode) { Render(); } + diff --git a/aegisub/src/video_display.h b/aegisub/src/video_display.h index 1510304a5..b0ef25e14 100644 --- a/aegisub/src/video_display.h +++ b/aegisub/src/video_display.h @@ -62,19 +62,45 @@ class VisualTool; class VideoBox; -////////////// -// Main class + +/// DOCME +/// @class VideoDisplay +/// @brief DOCME +/// +/// DOCME class VideoDisplay: public wxGLCanvas { friend class AudioProvider; friend class VisualTool; private: + + /// DOCME int visualMode; + + /// DOCME wxSize origSize; + + /// DOCME + + /// DOCME int w,h; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int dx1,dx2,dy1,dy2; + + /// DOCME + + /// DOCME int mouse_x,mouse_y; + + /// DOCME bool locked; void DrawTVEffects(); @@ -83,6 +109,10 @@ private: void OnPaint(wxPaintEvent& event); void OnKey(wxKeyEvent &event); void OnMouseEvent(wxMouseEvent& event); + + /// @brief DOCME + /// @param event + /// void OnEraseBackground(wxEraseEvent &event) {} void OnSizeEvent(wxSizeEvent &event); @@ -93,15 +123,31 @@ private: void OnSaveSnapshotRaw(wxCommandEvent &event); public: + + /// DOCME VisualTool *visual; + + /// DOCME VideoBox *box; + + /// DOCME double zoomValue; + + /// DOCME bool freeSize; + + /// DOCME VideoSlider *ControlSlider; + + /// DOCME wxComboBox *zoomBox; + + /// DOCME wxTextCtrl *PositionDisplay; + + /// DOCME wxTextCtrl *SubsPosition; VideoDisplay(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); @@ -124,3 +170,4 @@ public: + diff --git a/aegisub/src/video_frame.cpp b/aegisub/src/video_frame.cpp index 419876b87..06d9b2366 100644 --- a/aegisub/src/video_frame.cpp +++ b/aegisub/src/video_frame.cpp @@ -43,8 +43,9 @@ #include "utils.h" -///////// -// Reset + +/// @brief Reset +/// void AegiVideoFrame::Reset() { // Note that this function DOES NOT unallocate memory. // Use Clear() for that @@ -66,15 +67,20 @@ void AegiVideoFrame::Reset() { } -/////////////// -// Constructor + +/// @brief Constructor +/// AegiVideoFrame::AegiVideoFrame() { Reset(); } -////////////////// -// Create default + +/// @brief Create default +/// @param width +/// @param height +/// @param fmt +/// AegiVideoFrame::AegiVideoFrame(int width,int height,VideoFrameFormat fmt) { // Clear Reset(); @@ -98,8 +104,9 @@ AegiVideoFrame::AegiVideoFrame(int width,int height,VideoFrameFormat fmt) { } -//////////// -// Allocate + +/// @brief Allocate +/// void AegiVideoFrame::Allocate() { // Check consistency wxASSERT(pitch[0] > 0 && pitch[0] < 10000); @@ -139,8 +146,9 @@ void AegiVideoFrame::Allocate() { } -///////// -// Clear + +/// @brief Clear +/// void AegiVideoFrame::Clear() { // Free memory if (cppAlloc) delete[] data[0]; @@ -163,8 +171,10 @@ void AegiVideoFrame::Clear() { } -/////////////// -// Create copy + +/// @brief Create copy +/// @param source +/// void AegiVideoFrame::CopyFrom(const AegiVideoFrame &source) { w = source.w; h = source.h; @@ -177,10 +187,10 @@ void AegiVideoFrame::CopyFrom(const AegiVideoFrame &source) { } -/////////////// -// Get wxImage -// ------ -// This function is only used on screenshots, so it doesn't have to be fast + +/// @brief This function is only used on screenshots, so it doesn't have to be fast ------ Get wxImage +/// @return +/// wxImage AegiVideoFrame::GetImage() const { // RGB if (format == FORMAT_RGB32 || format == FORMAT_RGB24) { @@ -228,8 +238,10 @@ wxImage AegiVideoFrame::GetImage() const { } -///////////////////////////// -// Get float luminosity data + +/// @brief Get float luminosity data +/// @param buffer +/// void AegiVideoFrame::GetFloat(float *buffer) const { int Bpp = GetBpp(); const unsigned char *src = data[0]; @@ -257,8 +269,11 @@ void AegiVideoFrame::GetFloat(float *buffer) const { } -/////////////////////// -// Get Bytes per Pixel + +/// @brief Get Bytes per Pixel +/// @param plane +/// @return +/// int AegiVideoFrame::GetBpp(int plane) const { switch (format) { case FORMAT_RGB32: return 4; @@ -272,8 +287,10 @@ int AegiVideoFrame::GetBpp(int plane) const { } -////////////////////////////// -// Convert from another frame + +/// @brief Convert from another frame +/// @param source +/// void AegiVideoFrame::ConvertFrom(const AegiVideoFrame &source) { // Ensure compatibility if (w != source.w) throw _T("AegiVideoFrame::ConvertFrom: Widths don't match."); @@ -327,3 +344,4 @@ void AegiVideoFrame::ConvertFrom(const AegiVideoFrame &source) { } } + diff --git a/aegisub/src/video_frame.h b/aegisub/src/video_frame.h index 1d1a02c7e..81399e466 100644 --- a/aegisub/src/video_frame.h +++ b/aegisub/src/video_frame.h @@ -39,37 +39,74 @@ #include -////////////////////// -// Video Frame format -// All formats use 8 bits per sample. + +/// DOCME enum VideoFrameFormat { + + /// DOCME FORMAT_NONE = 0x0000, + + /// DOCME FORMAT_RGB24 = 0x0001, // RGB, interleaved + + /// DOCME FORMAT_RGB32 = 0x0002, // RGBA, interleaved + + /// DOCME FORMAT_YUY2 = 0x0004, // YCbCr 4:2:2, planar + + /// DOCME FORMAT_YV12 = 0x0008, // YCbCr 4:2:0, planar + + /// DOCME FORMAT_YUV444 = 0x0010, // YCbCr 4:4:4, planar + + /// DOCME FORMAT_YUV444A = 0x0020, // YCbCr 4:4:4 plus alpha, planar + + /// DOCME FORMAT_YUVMONO = 0x0040, // Y only (greyscale) }; -///////////////////// -// Video Frame class + +/// DOCME +/// @class AegiVideoFrame +/// @brief DOCME +/// +/// DOCME class AegiVideoFrame { private: + + /// DOCME unsigned int memSize; void Reset(); public: + + /// DOCME unsigned char *data[4]; // Pointers to the data planes. Interleaved formats only use data[0] + + /// DOCME VideoFrameFormat format; // Data format + + /// DOCME unsigned int w; // Width in pixels + + /// DOCME unsigned int h; // Height in pixels + + /// DOCME unsigned int pitch[4]; // Pitch, that is, the number of bytes used by each row. + + /// DOCME bool flipped; // First row is actually the bottom one + + /// DOCME bool invertChannels; // Swap Red and Blue channels or U and V planes (controls RGB versus BGR ordering etc) + + /// DOCME bool cppAlloc; // Allocated with C++'s "new" operator, instead of "malloc" AegiVideoFrame(); @@ -85,3 +122,4 @@ public: int GetBpp(int plane=0) const; }; + diff --git a/aegisub/src/video_provider_avs.cpp b/aegisub/src/video_provider_avs.cpp index 5e5a94796..062d40882 100644 --- a/aegisub/src/video_provider_avs.cpp +++ b/aegisub/src/video_provider_avs.cpp @@ -55,8 +55,10 @@ #include "charset_conv.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _filename +/// AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename) { AVSTRACE(wxString::Format(_T("AvisynthVideoProvider: Creating new AvisynthVideoProvider: \"%s\", \"%s\""), _filename, _subfilename)); bool mpeg2dec3_priority = true; @@ -79,8 +81,9 @@ AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename) { } -////////////// -// Destructor + +/// @brief Destructor +/// AvisynthVideoProvider::~AvisynthVideoProvider() { AVSTRACE(_T("AvisynthVideoProvider: Destroying AvisynthVideoProvider")); RGB32Video = NULL; @@ -94,8 +97,12 @@ AvisynthVideoProvider::~AvisynthVideoProvider() { ////////////////////////////////////// VIDEO PROVIDER ////////////////////////////////////// -///////////////////////////////////////// -// Actually open the video into Avisynth + +/// @brief Actually open the video into Avisynth +/// @param _filename +/// @param mpeg2dec3_priority +/// @return +/// PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priority) { AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening video")); wxMutexLocker lock(AviSynthMutex); @@ -313,8 +320,11 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori } -//////////////////////// -// Actually get a frame + +/// @brief Actually get a frame +/// @param _n +/// @return +/// const AegiVideoFrame AvisynthVideoProvider::GetFrame(int _n) { // Transform n if overriden int n = _n; @@ -359,16 +369,19 @@ const AegiVideoFrame AvisynthVideoProvider::GetFrame(int _n) { return final; } -//////////////////////// -// Override frame times + +/// @brief Override frame times +/// @param list +/// void AvisynthVideoProvider::OverrideFrameTimeList(wxArrayInt list) { frameTime = list; num_frames = frameTime.Count(); } -/////////////// -// Get warning + +/// @brief Get warning +/// wxString AvisynthVideoProvider::GetWarning() { if (usedDirectShow) return L"Warning! The file is being opened using Avisynth's DirectShowSource, which has unreliable seeking. Frame numbers might not match the real number. PROCEED AT YOUR OWN RISK!"; else return L""; @@ -376,3 +389,4 @@ wxString AvisynthVideoProvider::GetWarning() { #endif + diff --git a/aegisub/src/video_provider_avs.h b/aegisub/src/video_provider_avs.h index 3a11a2ed5..e38764c84 100644 --- a/aegisub/src/video_provider_avs.h +++ b/aegisub/src/video_provider_avs.h @@ -43,29 +43,63 @@ #include "include/aegisub/video_provider.h" -//////////// -// Provider + +/// DOCME +/// @class AvisynthVideoProvider +/// @brief DOCME +/// +/// DOCME class AvisynthVideoProvider: public VideoProvider, AviSynthWrapper { private: + + /// DOCME VideoInfo vi; + + /// DOCME AegiVideoFrame iframe; + + /// DOCME bool usedDirectShow; + + /// DOCME wxString rendererCallString; + + /// DOCME wxString decoderName; + + /// DOCME int num_frames; + + /// DOCME int last_fnum; + + /// DOCME double fps; + + /// DOCME wxArrayInt frameTime; + + /// DOCME bool byFrame; + + /// DOCME wxArrayInt KeyFrames; + + /// DOCME bool keyFramesLoaded; + + /// DOCME bool isVfr; + + /// DOCME FrameRate trueFrameRate; + + /// DOCME PClip RGB32Video; PClip OpenVideo(wxString _filename, bool mpeg2dec3_priority = true); @@ -77,32 +111,88 @@ public: const AegiVideoFrame GetFrame(int n); void GetFloatFrame(float* Buffer, int n); - // properties + + /// @brief // properties + /// @return + /// int GetPosition() { return last_fnum; }; + + /// @brief DOCME + /// @return + /// int GetFrameCount() { return num_frames? num_frames: vi.num_frames; }; + + /// @brief DOCME + /// @return + /// double GetFPS() { return (double)vi.fps_numerator/(double)vi.fps_denominator; }; + + /// @brief DOCME + /// @return + /// int GetWidth() { return vi.width; }; + + /// @brief DOCME + /// @return + /// int GetHeight() { return vi.height; }; + + /// @brief DOCME + /// @return + /// bool AreKeyFramesLoaded() { return keyFramesLoaded; }; + + /// @brief DOCME + /// @return + /// wxArrayInt GetKeyFrames() { return KeyFrames; }; + + /// @brief DOCME + /// @return + /// bool IsVFR() { return isVfr; }; + + /// @brief DOCME + /// @return + /// FrameRate GetTrueFrameRate() { return isVfr? trueFrameRate: FrameRate(); }; void OverrideFrameTimeList(wxArrayInt list); + + /// @brief DOCME + /// @return + /// bool IsNativelyByFrames() { return byFrame; } + + /// @brief DOCME + /// @return + /// bool NeedsVFRHack() { return true; } wxString GetWarning(); + + /// @brief DOCME + /// @return + /// wxString GetDecoderName() { return wxString(L"Avisynth/") + decoderName; } }; -/////////// -// Factory + +/// DOCME +/// @class AvisynthVideoProviderFactory +/// @brief DOCME +/// +/// DOCME class AvisynthVideoProviderFactory : public VideoProviderFactory { public: + + /// @brief DOCME + /// @param video + /// VideoProvider *CreateProvider(wxString video) { return new AvisynthVideoProvider(video); } }; #endif + diff --git a/aegisub/src/video_provider_cache.cpp b/aegisub/src/video_provider_cache.cpp index e56098ebf..30eab3a8c 100644 --- a/aegisub/src/video_provider_cache.cpp +++ b/aegisub/src/video_provider_cache.cpp @@ -42,8 +42,10 @@ #include "video_provider_cache.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// VideoProviderCache::VideoProviderCache(VideoProvider *parent) { master = parent; cacheMax = 0; @@ -51,16 +53,20 @@ VideoProviderCache::VideoProviderCache(VideoProvider *parent) { } -////////////// -// Destructor + +/// @brief Destructor +/// VideoProviderCache::~VideoProviderCache() { delete master; ClearCache(); } -///////////// -// Get frame + +/// @brief Get frame +/// @param n +/// @return +/// const AegiVideoFrame VideoProviderCache::GetFrame(int n) { // See if frame is cached CachedFrame cached; @@ -84,24 +90,33 @@ const AegiVideoFrame VideoProviderCache::GetFrame(int n) { } -//////////////// -// Get as float + +/// @brief Get as float +/// @param buffer +/// @param n +/// void VideoProviderCache::GetFloatFrame(float* buffer, int n) { const AegiVideoFrame frame = GetFrame(n); frame.GetFloat(buffer); } -////////////////////////// -// Set maximum cache size + +/// @brief Set maximum cache size +/// @param n +/// void VideoProviderCache::SetCacheMax(int n) { if (n < 0) n = 0; cacheMax = n; } -//////////////// -// Add to cache + +/// @brief Add to cache +/// @param n +/// @param frame +/// @return +/// void VideoProviderCache::Cache(int n,const AegiVideoFrame frame) { // Cache enabled? if (cacheMax == 0) return; @@ -123,8 +138,9 @@ void VideoProviderCache::Cache(int n,const AegiVideoFrame frame) { } -/////////////// -// Clear cache + +/// @brief Clear cache +/// void VideoProviderCache::ClearCache() { while (cache.size()) { cache.front().frame.Clear(); @@ -133,48 +149,102 @@ void VideoProviderCache::ClearCache() { } -/////////////////// -// Wrapper methods + +/// @brief Wrapper methods +/// @return +/// int VideoProviderCache::GetPosition() { return pos; } + +/// @brief DOCME +/// @return +/// int VideoProviderCache::GetFrameCount() { return master->GetFrameCount(); } + +/// @brief DOCME +/// @return +/// int VideoProviderCache::GetWidth() { return master->GetWidth(); } + +/// @brief DOCME +/// @return +/// int VideoProviderCache::GetHeight() { return master->GetHeight(); } + +/// @brief DOCME +/// @return +/// double VideoProviderCache::GetFPS() { return master->GetFPS(); } + +/// @brief DOCME +/// @return +/// bool VideoProviderCache::IsVFR() { return master->IsVFR(); } + +/// @brief DOCME +/// @return +/// bool VideoProviderCache::AreKeyFramesLoaded() { return master->AreKeyFramesLoaded(); } + +/// @brief DOCME +/// @return +/// wxArrayInt VideoProviderCache::GetKeyFrames() { return master->GetKeyFrames(); } + +/// @brief DOCME +/// @return +/// FrameRate VideoProviderCache::GetTrueFrameRate() { return master->GetTrueFrameRate(); } + +/// @brief DOCME +/// @param list +/// void VideoProviderCache::OverrideFrameTimeList(std::vector list) { master->OverrideFrameTimeList(list); } + +/// @brief DOCME +/// @return +/// bool VideoProviderCache::IsNativelyByFrames() { return master->IsNativelyByFrames(); } + +/// @brief DOCME +/// @return +/// bool VideoProviderCache::NeedsVFRHack() { return master->NeedsVFRHack(); } + +/// @brief DOCME +/// @return +/// wxString VideoProviderCache::GetWarning() { return master->GetWarning(); } + +/// @brief DOCME +/// wxString VideoProviderCache::GetDecoderName() { return master->GetDecoderName(); } + diff --git a/aegisub/src/video_provider_cache.h b/aegisub/src/video_provider_cache.h index b464b25de..1153a3e29 100644 --- a/aegisub/src/video_provider_cache.h +++ b/aegisub/src/video_provider_cache.h @@ -45,22 +45,42 @@ #include "vfr.h" -//////////////// -// Cached frame + +/// DOCME +/// @class CachedFrame +/// @brief DOCME +/// +/// DOCME class CachedFrame { public: + + /// DOCME AegiVideoFrame frame; + + /// DOCME int n; }; -//////////////////////////// -// Video Provider interface + +/// DOCME +/// @class VideoProviderCache +/// @brief DOCME +/// +/// DOCME class VideoProviderCache : public VideoProvider { private: + + /// DOCME VideoProvider *master; + + /// DOCME unsigned int cacheMax; + + /// DOCME std::list cache; + + /// DOCME int pos; void Cache(int n,const AegiVideoFrame frame); @@ -95,3 +115,4 @@ public: virtual wxString GetDecoderName(); }; + diff --git a/aegisub/src/video_provider_dummy.cpp b/aegisub/src/video_provider_dummy.cpp index 58379e701..e80a0cf52 100644 --- a/aegisub/src/video_provider_dummy.cpp +++ b/aegisub/src/video_provider_dummy.cpp @@ -54,8 +54,15 @@ public: } registerDummyVideo; */ -/////////////// -// Constructor + +/// @brief Constructor +/// @param _fps +/// @param frames +/// @param _width +/// @param _height +/// @param colour +/// @param pattern +/// void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height, const wxColour &colour, bool pattern) { lastFrame = -1; framecount = frames; @@ -121,8 +128,10 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height } -/////////////////////// -// Parsing constructor + +/// @brief Parsing constructor +/// @param filename +/// DummyVideoProvider::DummyVideoProvider(wxString filename) { wxString params; @@ -183,74 +192,105 @@ DummyVideoProvider::DummyVideoProvider(wxString filename) } -////////////////////// -// Direct constructor + +/// @brief Direct constructor +/// @param _fps +/// @param frames +/// @param _width +/// @param _height +/// @param colour +/// @param pattern +/// DummyVideoProvider::DummyVideoProvider(double _fps, int frames, int _width, int _height, const wxColour &colour, bool pattern) { Create(_fps, frames, _width, _height, colour, pattern); } -////////////// -// Destructor + +/// @brief Destructor +/// DummyVideoProvider::~DummyVideoProvider() { frame.Clear(); } -////////////////////////////////////////////////// -// Construct a fake filename describing the video + +/// @brief Construct a fake filename describing the video +/// @param fps +/// @param frames +/// @param _width +/// @param _height +/// @param colour +/// @param pattern +/// @return +/// wxString DummyVideoProvider::MakeFilename(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern) { return wxString::Format(_T("?dummy:%f:%d:%d:%d:%d:%d:%d:%s"), fps, frames, _width, _height, colour.Red(), colour.Green(), colour.Blue(), pattern?_T("c"):_T("")); } -///////////// -// Get frame + +/// @brief Get frame +/// @param n +/// @return +/// const AegiVideoFrame DummyVideoProvider::GetFrame(int n) { lastFrame = n; return frame; } -//////////////// -// Get position + +/// @brief Get position +/// @return +/// int DummyVideoProvider::GetPosition() { return lastFrame; } -/////////////////// -// Get frame count + +/// @brief Get frame count +/// @return +/// int DummyVideoProvider::GetFrameCount() { return framecount; } -///////////// -// Get width + +/// @brief Get width +/// @return +/// int DummyVideoProvider::GetWidth() { return width; } -////////////// -// Get height + +/// @brief Get height +/// @return +/// int DummyVideoProvider::GetHeight() { return height; } -/////////// -// Get FPS + +/// @brief Get FPS +/// @return +/// double DummyVideoProvider::GetFPS() { return fps; } -//////////////////// -// Get decoder name + +/// @brief Get decoder name +/// wxString DummyVideoProvider::GetDecoderName() { return L"Dummy Video Provider"; } + diff --git a/aegisub/src/video_provider_dummy.h b/aegisub/src/video_provider_dummy.h index 1fe966aa5..ff8d6376a 100644 --- a/aegisub/src/video_provider_dummy.h +++ b/aegisub/src/video_provider_dummy.h @@ -37,6 +37,8 @@ // The dummy video provider needs a header, since it needs to be created directly as a special case #ifndef _VIDEO_PROVIDER_DUMMY_H + +/// DOCME #define _VIDEO_PROVIDER_DUMMY_H @@ -47,15 +49,31 @@ #include "vfr.h" -//////////////////////// -// Dummy video provider + +/// DOCME +/// @class DummyVideoProvider +/// @brief DOCME +/// +/// DOCME class DummyVideoProvider : public VideoProvider { private: + + /// DOCME int lastFrame; + + /// DOCME int framecount; + + /// DOCME double fps; + + /// DOCME int width; + + /// DOCME int height; + + /// DOCME AegiVideoFrame frame; void Create(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern); @@ -75,10 +93,29 @@ public: int GetHeight(); double GetFPS(); + + /// @brief DOCME + /// @return + /// bool AreKeyFramesLoaded() { return false; }; + + /// @brief DOCME + /// @return + /// wxArrayInt GetKeyFrames() { return wxArrayInt(); }; + + /// @brief DOCME + /// @return + /// bool IsVFR() { return false; }; + + /// @brief DOCME + /// @return + /// bool NeedsVFRHack() { return true; } + + /// @brief DOCME + /// FrameRate GetTrueFrameRate() { return FrameRate(); }; wxString GetDecoderName(); @@ -86,3 +123,4 @@ public: #endif + diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index 7031514a4..9715d0e80 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -53,8 +53,10 @@ #endif -/////////////// -// Constructor + +/// @brief Constructor +/// @param filename +/// FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) { COMInited = false; #ifdef WIN32 @@ -87,8 +89,9 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) { } } -/////////////// -// Destructor + +/// @brief Destructor +/// FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() { Close(); #ifdef WIN32 @@ -97,8 +100,10 @@ FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() { #endif } -/////////////// -// Open video + +/// @brief Open video +/// @param filename +/// void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { // make sure we don't have anything messy lying around Close(); @@ -271,8 +276,9 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { FrameNumber = 0; } -/////////////// -// Close video + +/// @brief Close video +/// void FFmpegSourceVideoProvider::Close() { FFMS_DestroyVideoSource(VideoSource); VideoSource = NULL; @@ -285,8 +291,11 @@ void FFmpegSourceVideoProvider::Close() { } -/////////////// -// Get frame + +/// @brief Get frame +/// @param _n +/// @return +/// const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n) { // don't try to seek to insane places int n = _n; @@ -330,24 +339,41 @@ const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n) { } -/////////////// -// Utility functions + +/// @brief Utility functions +/// @return +/// int FFmpegSourceVideoProvider::GetWidth() { return VideoInfo->Width; } + +/// @brief DOCME +/// @return +/// int FFmpegSourceVideoProvider::GetHeight() { return VideoInfo->Height; } + +/// @brief DOCME +/// @return +/// int FFmpegSourceVideoProvider::GetFrameCount() { return VideoInfo->NumFrames; } + +/// @brief DOCME +/// @return +/// int FFmpegSourceVideoProvider::GetPosition() { return FrameNumber; } + +/// @brief DOCME +/// double FFmpegSourceVideoProvider::GetFPS() { return double(VideoInfo->FPSNumerator) / double(VideoInfo->FPSDenominator); } @@ -355,3 +381,4 @@ double FFmpegSourceVideoProvider::GetFPS() { #endif /* WITH_FFMPEGSOURCE */ + diff --git a/aegisub/src/video_provider_ffmpegsource.h b/aegisub/src/video_provider_ffmpegsource.h index 03874cd29..05f44db95 100644 --- a/aegisub/src/video_provider_ffmpegsource.h +++ b/aegisub/src/video_provider_ffmpegsource.h @@ -44,25 +44,53 @@ #include -/////////////////////// -// FFmpegSource video provider + +/// DOCME +/// @class FFmpegSourceVideoProvider +/// @brief DOCME +/// +/// DOCME class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider { private: + + /// DOCME FFVideo *VideoSource; + + /// DOCME const FFVideoProperties *VideoInfo; + + /// DOCME int FrameNumber; + + /// DOCME wxArrayInt KeyFramesList; + + /// DOCME bool KeyFramesLoaded; + + /// DOCME std::vector TimecodesVector; + + /// DOCME FrameRate Timecodes; + + /// DOCME AegiVideoFrame CurFrame; + + /// DOCME char FFMSErrMsg[1024]; + + /// DOCME unsigned MsgSize; + + /// DOCME wxString ErrorMsg; + + /// DOCME bool COMInited; void LoadVideo(wxString filename); @@ -81,22 +109,55 @@ public: int GetWidth(); int GetHeight(); double GetFPS(); + + /// @brief DOCME + /// @return + /// bool AreKeyFramesLoaded() { return KeyFramesLoaded; }; + + /// @brief DOCME + /// @return + /// wxArrayInt GetKeyFrames() { return KeyFramesList; }; + + /// @brief DOCME + /// @return + /// bool IsVFR() { return true; }; + + /// @brief DOCME + /// @return + /// FrameRate GetTrueFrameRate() { return Timecodes; }; + + /// @brief DOCME + /// @return + /// wxString GetDecoderName() { return L"FFmpegSource"; } + + /// @brief DOCME + /// @return + /// int GetDesiredCacheSize() { return 8; } }; -/////////// -// Factory + +/// DOCME +/// @class FFmpegSourceVideoProviderFactory +/// @brief DOCME +/// +/// DOCME class FFmpegSourceVideoProviderFactory : public VideoProviderFactory { public: + + /// @brief DOCME + /// @param video + /// VideoProvider *CreateProvider(wxString video) { return new FFmpegSourceVideoProvider(video); } }; #endif /* WITH_FFMPEGSOURCE */ + diff --git a/aegisub/src/video_provider_manager.cpp b/aegisub/src/video_provider_manager.cpp index 5c239d063..7fe6f223d 100644 --- a/aegisub/src/video_provider_manager.cpp +++ b/aegisub/src/video_provider_manager.cpp @@ -57,8 +57,11 @@ #include "video_provider_yuv4mpeg.h" -//////////////// -// Get provider + +/// @brief Get provider +/// @param video +/// @return +/// VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) { // First check special case of dummy video if (video.StartsWith(_T("?dummy:"))) { @@ -108,8 +111,9 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) { } -////////////////////////// -// Register all providers + +/// @brief Register all providers +/// void VideoProviderFactoryManager::RegisterProviders() { #ifdef WITH_AVISYNTH RegisterFactory(new AvisynthVideoProviderFactory(),_T("Avisynth")); @@ -123,14 +127,16 @@ void VideoProviderFactoryManager::RegisterProviders() { } -/////////////////////// -// Clear all providers + +/// @brief Clear all providers +/// void VideoProviderFactoryManager::ClearProviders() { ClearFactories(); } -////////// -// Static + +/// DOCME template std::map* FactoryManager::factories=NULL; + diff --git a/aegisub/src/video_provider_manager.h b/aegisub/src/video_provider_manager.h index 5ac929b2e..b6a7a5bff 100644 --- a/aegisub/src/video_provider_manager.h +++ b/aegisub/src/video_provider_manager.h @@ -46,8 +46,12 @@ #include "factory_manager.h" -/////////////////// -// Factory Manager + +/// DOCME +/// @class VideoProviderFactoryManager +/// @brief DOCME +/// +/// DOCME class VideoProviderFactoryManager : public FactoryManager { public: static void RegisterProviders(); @@ -55,3 +59,4 @@ public: static void ClearProviders(); }; + diff --git a/aegisub/src/video_provider_quicktime.cpp b/aegisub/src/video_provider_quicktime.cpp index 946d5a3a4..22668c26e 100644 --- a/aegisub/src/video_provider_quicktime.cpp +++ b/aegisub/src/video_provider_quicktime.cpp @@ -42,10 +42,16 @@ // this function has a different name on win32 because the original name // conflicts with a windows api function #ifndef WIN32 + +/// DOCME #define MacOffsetRect OffsetRect #endif + +/// @brief DOCME +/// @param filename +/// QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) { in_dataref = NULL; movie = NULL; @@ -87,12 +93,18 @@ QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) { } + +/// @brief DOCME +/// QuickTimeVideoProvider::~QuickTimeVideoProvider() { Close(); DeInitQuickTime(); } + +/// @brief DOCME +/// void QuickTimeVideoProvider::Close() { if (movie) DisposeMovie(movie); @@ -112,6 +124,10 @@ void QuickTimeVideoProvider::Close() { + +/// @brief DOCME +/// @param _filename +/// void QuickTimeVideoProvider::LoadVideo(const wxString _filename) { Close(); @@ -173,6 +189,10 @@ void QuickTimeVideoProvider::LoadVideo(const wxString _filename) { } + +/// @brief DOCME +/// @return +/// std::vector QuickTimeVideoProvider::IndexFile() { TimeScale scale = GetMovieTimeScale(movie); OSType v_type[1]; @@ -211,6 +231,11 @@ std::vector QuickTimeVideoProvider::IndexFile() { } + +/// @brief DOCME +/// @param n +/// @return +/// const AegiVideoFrame QuickTimeVideoProvider::GetFrame(int n) { if (n < 0) n = 0; @@ -254,28 +279,50 @@ const AegiVideoFrame QuickTimeVideoProvider::GetFrame(int n) { -/////////////// -// Utility functions + +/// @brief Utility functions +/// @return +/// int QuickTimeVideoProvider::GetWidth() { return w; } + +/// @brief DOCME +/// @return +/// int QuickTimeVideoProvider::GetHeight() { return h; } + +/// @brief DOCME +/// @return +/// int QuickTimeVideoProvider::GetFrameCount() { return num_frames; } + +/// @brief DOCME +/// @return +/// int QuickTimeVideoProvider::GetPosition() { return cur_fn; } + +/// @brief DOCME +/// @return +/// double QuickTimeVideoProvider::GetFPS() { return assumed_fps; } + +/// @brief DOCME +/// @return +/// bool QuickTimeVideoProvider::AreKeyFramesLoaded() { if (keyframes.GetCount() > 0) return true; @@ -283,10 +330,17 @@ bool QuickTimeVideoProvider::AreKeyFramesLoaded() { return false; } + +/// @brief DOCME +/// @return +/// wxArrayInt QuickTimeVideoProvider::GetKeyFrames() { return keyframes; } + +/// @brief DOCME +/// FrameRate QuickTimeVideoProvider::GetTrueFrameRate() { return vfr_fps; } @@ -294,3 +348,4 @@ FrameRate QuickTimeVideoProvider::GetTrueFrameRate() { #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/video_provider_quicktime.h b/aegisub/src/video_provider_quicktime.h index d57952758..b30f40903 100644 --- a/aegisub/src/video_provider_quicktime.h +++ b/aegisub/src/video_provider_quicktime.h @@ -49,21 +49,53 @@ #include "vfr.h" + +/// DOCME +/// @class QuickTimeVideoProvider +/// @brief DOCME +/// +/// DOCME class QuickTimeVideoProvider : public VideoProvider, QuickTimeProvider { private: + + /// DOCME Movie movie; // source object + + /// DOCME GWorldPtr gw; // render buffer + + /// DOCME Handle in_dataref; // input data handle + + /// DOCME + + /// DOCME int w, h; // width/height + + /// DOCME int num_frames; // length of file in frames + + /// DOCME int cur_fn; // current frame number + + /// DOCME FrameRate vfr_fps; // vfr framerate + + /// DOCME double assumed_fps; // average framerate + + /// DOCME wxArrayInt keyframes; // list of keyframes + + /// DOCME std::vector qt_timestamps; // qt timestamps (used for seeking) + + /// DOCME OSErr qt_err; // quicktime error code + + /// DOCME wxString errmsg; // aegisub error message void LoadVideo(const wxString filename); @@ -81,20 +113,43 @@ public: int GetWidth(); int GetHeight(); double GetFPS(); + + /// @brief DOCME + /// @return + /// bool IsVFR() { return true; }; FrameRate GetTrueFrameRate(); wxArrayInt GetKeyFrames(); bool QuickTimeVideoProvider::AreKeyFramesLoaded(); + + /// @brief DOCME + /// @return + /// wxString GetDecoderName() { return L"QuickTime"; }; + + /// @brief DOCME + /// @return + /// int GetDesiredCacheSize() { return 8; }; }; + +/// DOCME +/// @class QuickTimeVideoProviderFactory +/// @brief DOCME +/// +/// DOCME class QuickTimeVideoProviderFactory : public VideoProviderFactory { public: + + /// @brief DOCME + /// @param video + /// VideoProvider *CreateProvider(wxString video) { return new QuickTimeVideoProvider(video); } }; #endif /* WITH_QUICKTIME */ + diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index 319131c8f..f68e4726b 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -42,12 +42,20 @@ // (yes, really) // With cstdio it's at least possible to work around the problem... #ifdef _MSC_VER + +/// DOCME #define fseeko _fseeki64 + +/// DOCME #define ftello _ftelli64 #endif + +/// @brief DOCME +/// @param filename +/// YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString filename) { sf = NULL; w = 0; @@ -78,11 +86,18 @@ YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString filename) { } + +/// @brief DOCME +/// YUV4MPEGVideoProvider::~YUV4MPEGVideoProvider() { Close(); } + +/// @brief DOCME +/// @param _filename +/// void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) { Close(); @@ -134,6 +149,9 @@ void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) { } + +/// @brief DOCME +/// void YUV4MPEGVideoProvider::Close() { seek_table.clear(); if (sf) @@ -142,7 +160,10 @@ void YUV4MPEGVideoProvider::Close() { } -// verify that the file is actually a YUV4MPEG file + +/// @brief verify that the file is actually a YUV4MPEG file +/// @return +/// void YUV4MPEGVideoProvider::CheckFileFormat() { char buf[10]; if (fread(buf, 10, 1, sf) != 1) @@ -154,7 +175,12 @@ void YUV4MPEGVideoProvider::CheckFileFormat() { } -// read a frame or file header and return a list of its parameters + +/// @brief read a frame or file header and return a list of its parameters +/// @param startpos +/// @param reset_pos +/// @return +/// std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool reset_pos) { int64_t oldpos = ftello(sf); std::vector tags; @@ -204,7 +230,10 @@ std::vector YUV4MPEGVideoProvider::ReadHeader(int64_t startpos, bool r } -// parse a file header and set file properties + +/// @brief parse a file header and set file properties +/// @param tags +/// void YUV4MPEGVideoProvider::ParseFileHeader(const std::vector& tags) { if (tags.size() <= 1) throw wxString(_T("ParseFileHeader: contentless header")); @@ -296,7 +325,11 @@ void YUV4MPEGVideoProvider::ParseFileHeader(const std::vector& tags) { } -// parse a frame header (currently unused) + +/// @brief parse a frame header (currently unused) +/// @param tags +/// @return +/// YUV4MPEGVideoProvider::Y4M_FrameFlags YUV4MPEGVideoProvider::ParseFrameHeader(const std::vector& tags) { if (tags.front().Cmp(_("FRAME"))) throw wxString(_T("ParseFrameHeader: malformed frame header (bad magic)")); @@ -307,7 +340,10 @@ YUV4MPEGVideoProvider::Y4M_FrameFlags YUV4MPEGVideoProvider::ParseFrameHeader(co } -// index the file, i.e. find all frames and their flags + +/// @brief index the file, i.e. find all frames and their flags +/// @return +/// int YUV4MPEGVideoProvider::IndexFile() { int framecount = 0; int64_t curpos = ftello(sf); @@ -347,6 +383,11 @@ int YUV4MPEGVideoProvider::IndexFile() { } + +/// @brief DOCME +/// @param n +/// @return +/// const AegiVideoFrame YUV4MPEGVideoProvider::GetFrame(int n) { // don't try to seek to insane places if (n < 0) @@ -407,26 +448,44 @@ const AegiVideoFrame YUV4MPEGVideoProvider::GetFrame(int n) { -/////////////// -// Utility functions + +/// @brief Utility functions +/// @return +/// int YUV4MPEGVideoProvider::GetWidth() { return w; } + +/// @brief DOCME +/// @return +/// int YUV4MPEGVideoProvider::GetHeight() { return h; } + +/// @brief DOCME +/// @return +/// int YUV4MPEGVideoProvider::GetFrameCount() { return num_frames; } + +/// @brief DOCME +/// @return +/// int YUV4MPEGVideoProvider::GetPosition() { return cur_fn; } + +/// @brief DOCME +/// double YUV4MPEGVideoProvider::GetFPS() { return double(fps_rat.num) / double(fps_rat.den); } + diff --git a/aegisub/src/video_slider.cpp b/aegisub/src/video_slider.cpp index f607c2bdf..c810cb6a3 100644 --- a/aegisub/src/video_slider.cpp +++ b/aegisub/src/video_slider.cpp @@ -51,8 +51,11 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param id +/// VideoSlider::VideoSlider (wxWindow* parent, wxWindowID id) : wxWindow (parent,id,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE) { @@ -66,15 +69,20 @@ VideoSlider::VideoSlider (wxWindow* parent, wxWindowID id) } -///////////// -// Get value + +/// @brief Get value +/// @return +/// int VideoSlider::GetValue() { return val; } -///////////// -// Set value + +/// @brief Set value +/// @param value +/// @return +/// void VideoSlider::SetValue(int value) { if (locked) return; val = value; @@ -84,8 +92,11 @@ void VideoSlider::SetValue(int value) { } -///////////// -// Set range + +/// @brief Set range +/// @param from +/// @param to +/// void VideoSlider::SetRange(int from,int to) { if (from > to) from = to; locked = false; @@ -96,8 +107,11 @@ void VideoSlider::SetRange(int from,int to) { } -////////////////// -// Get value at X + +/// @brief Get value at X +/// @param x +/// @return +/// int VideoSlider::GetValueAtX(int x) { // Get dimensions int w,h; @@ -111,8 +125,11 @@ int VideoSlider::GetValueAtX(int x) { } -////////////////// -// Get X at value + +/// @brief Get X at value +/// @param value +/// @return +/// int VideoSlider::GetXAtValue(int value) { // Get dimensions int w,h; @@ -126,8 +143,10 @@ int VideoSlider::GetXAtValue(int value) { } -///////////////////// -// Next frame hotkey + +/// @brief Next frame hotkey +/// @return +/// void VideoSlider::NextFrame() { if (VideoContext::Get()->IsPlaying()) return; @@ -138,8 +157,10 @@ void VideoSlider::NextFrame() { } -///////////////////////// -// Previous frame hotkey + +/// @brief Previous frame hotkey +/// @return +/// void VideoSlider::PrevFrame() { if (VideoContext::Get()->IsPlaying()) return; @@ -162,8 +183,10 @@ BEGIN_EVENT_TABLE(VideoSlider, wxWindow) END_EVENT_TABLE() -/////////////////// -// Change position + +/// @brief Change position +/// @return +/// void VideoSlider::UpdateVideo() { if (Display) { if (VideoContext::Get()->IsPlaying()) return; @@ -174,8 +197,11 @@ void VideoSlider::UpdateVideo() { } -//////////////// -// Mouse events + +/// @brief Mouse events +/// @param event +/// @return +/// void VideoSlider::OnMouse(wxMouseEvent &event) { // Coordinates int x = event.GetX(); @@ -246,8 +272,11 @@ void VideoSlider::OnMouse(wxMouseEvent &event) { } -////////////////// -// Key down event + +/// @brief Key down event +/// @param event +/// @return +/// void VideoSlider::OnKeyDown(wxKeyEvent &event) { if (VideoContext::Get()->IsPlaying()) return; @@ -380,16 +409,20 @@ void VideoSlider::OnKeyDown(wxKeyEvent &event) { } -/////////////// -// Paint event + +/// @brief Paint event +/// @param event +/// void VideoSlider::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); DrawImage(dc); } -////////////// -// Draw image + +/// @brief Draw image +/// @param destdc +/// void VideoSlider::DrawImage(wxDC &destdc) { // Get dimensions int w,h; @@ -486,8 +519,9 @@ void VideoSlider::DrawImage(wxDC &destdc) { } -//////////////// -// Update image + +/// @brief Update image +/// void VideoSlider::UpdateImage () { //wxClientDC dc(this); //DrawImage(dc); @@ -495,9 +529,12 @@ void VideoSlider::UpdateImage () { } -//////////////// -// Focus change + +/// @brief Focus change +/// @param event +/// void VideoSlider::OnFocus(wxFocusEvent &event) { Refresh(false); } + diff --git a/aegisub/src/video_slider.h b/aegisub/src/video_slider.h index a4191f547..899319e9c 100644 --- a/aegisub/src/video_slider.h +++ b/aegisub/src/video_slider.h @@ -50,13 +50,25 @@ class VideoDisplay; class SubtitlesGrid; -///////////////////// -// Class declaration + +/// DOCME +/// @class VideoSlider +/// @brief DOCME +/// +/// DOCME class VideoSlider: public wxWindow { private: + + /// DOCME int val; + + /// DOCME int min; + + /// DOCME int max; + + /// DOCME bool locked; int GetValueAtX(int x); @@ -69,10 +81,18 @@ private: void OnKeyDown(wxKeyEvent &event); void OnPaint(wxPaintEvent &event); void OnFocus(wxFocusEvent &event); + + /// @brief DOCME + /// @param event + /// void OnEraseBackground(wxEraseEvent &event) {} public: + + /// DOCME VideoDisplay *Display; + + /// DOCME SubtitlesGrid *grid; VideoSlider(wxWindow* parent, wxWindowID id); @@ -91,7 +111,12 @@ public: /////// // IDs enum { + + /// DOCME NextFrame = 1300, + + /// DOCME PrevFrame }; + diff --git a/aegisub/src/visual_feature.cpp b/aegisub/src/visual_feature.cpp index bd65b871d..07b490e2e 100644 --- a/aegisub/src/visual_feature.cpp +++ b/aegisub/src/visual_feature.cpp @@ -43,8 +43,9 @@ #include "gl_wrap.h" -/////////////// -// Constructor + +/// @brief Constructor +/// VisualDraggableFeature::VisualDraggableFeature() { type = DRAG_NONE; x = -1; @@ -57,8 +58,12 @@ VisualDraggableFeature::VisualDraggableFeature() { } -///////////////////// -// Is mouse over it? + +/// @brief Is mouse over it? +/// @param mx +/// @param my +/// @return +/// bool VisualDraggableFeature::IsMouseOver(int mx,int my) { // Square if (type == DRAG_BIG_SQUARE) { @@ -102,8 +107,10 @@ bool VisualDraggableFeature::IsMouseOver(int mx,int my) { } -//////////////// -// Draw feature + +/// @brief Draw feature +/// @param gl +/// void VisualDraggableFeature::Draw(OpenGLWrapper *gl) { wxASSERT(gl); @@ -140,3 +147,4 @@ void VisualDraggableFeature::Draw(OpenGLWrapper *gl) { } } + diff --git a/aegisub/src/visual_feature.h b/aegisub/src/visual_feature.h index da1f55a4e..3192a16ee 100644 --- a/aegisub/src/visual_feature.h +++ b/aegisub/src/visual_feature.h @@ -48,30 +48,64 @@ class OpenGLWrapper; -//////////////// -// Feature type + +/// DOCME enum DraggableFeatureType { + + /// DOCME DRAG_NONE, + + /// DOCME DRAG_BIG_SQUARE, + + /// DOCME DRAG_BIG_CIRCLE, + + /// DOCME DRAG_BIG_TRIANGLE, + + /// DOCME DRAG_SMALL_SQUARE, + + /// DOCME DRAG_SMALL_CIRCLE }; -///////////////////// -// Drag-able feature + +/// DOCME +/// @class VisualDraggableFeature +/// @brief DOCME +/// +/// DOCME class VisualDraggableFeature { public: + + /// DOCME DraggableFeatureType type; + + /// DOCME + + /// DOCME int x,y; + + /// DOCME int layer; // Higher = above + + /// DOCME + + /// DOCME int value,value2; + + /// DOCME AssDialogue *line; + + /// DOCME int lineN; + + /// DOCME int brother[4]; bool IsMouseOver(int x,int y); @@ -80,3 +114,4 @@ public: VisualDraggableFeature(); }; + diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index 3a4885a77..7836d1280 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -62,8 +62,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param par +/// VisualTool::VisualTool(VideoDisplay *par) : eventSink(this) { // Config parent = par; @@ -95,14 +97,18 @@ VisualTool::VisualTool(VideoDisplay *par) : eventSink(this) { } -////////////// -// Destructor + +/// @brief Destructor +/// VisualTool::~VisualTool() { } -/////////////// -// Mouse event + +/// @brief Mouse event +/// @param event +/// @return +/// void VisualTool::OnMouseEvent (wxMouseEvent &event) { // General variables mouseX = event.GetX(); @@ -268,8 +274,11 @@ void VisualTool::OnMouseEvent (wxMouseEvent &event) { } -////////// -// Commit + +/// @brief Commit +/// @param full +/// @return +/// void VisualTool::Commit(bool full) { // Get grid SubtitlesGrid *grid = VideoContext::Get()->grid; @@ -288,8 +297,10 @@ void VisualTool::Commit(bool full) { } -//////////////////////////// -// Get active dialogue line + +/// @brief Get active dialogue line +/// @return +/// AssDialogue* VisualTool::GetActiveDialogueLine() { SubtitlesGrid *grid = VideoContext::Get()->grid; AssDialogue *diag = grid->GetDialogue(grid->editBox->linen); @@ -307,8 +318,10 @@ AssDialogue* VisualTool::GetActiveDialogueLine() { } -/////////////////////////// -// Get feature under mouse + +/// @brief Get feature under mouse +/// @return +/// int VisualTool::GetHighlightedFeature() { int highestLayerFound = -99999; int bestMatch = -1; @@ -322,8 +335,9 @@ int VisualTool::GetHighlightedFeature() { } -///////////////////// -// Draw all features + +/// @brief Draw all features +/// void VisualTool::DrawAllFeatures() { // Populate list, if needed if (!dragListOK) { @@ -344,8 +358,9 @@ void VisualTool::DrawAllFeatures() { } -/////////// -// Refresh + +/// @brief Refresh +/// void VisualTool::Refresh() { frame_n = VideoContext::Get()->GetFrameN(); if (!dragging) dragListOK = false; @@ -353,12 +368,25 @@ void VisualTool::Refresh() { } -//////////////////////// -// Get position of line + +/// @brief Get position of line +/// @param diag +/// @param x +/// @param y +/// void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y) { int orgx=0,orgy=0; GetLinePosition(diag,x,y,orgx,orgy); } + +/// @brief DOCME +/// @param diag +/// @param x +/// @param y +/// @param orgx +/// @param orgy +/// @return +/// void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, int &orgy) { // No dialogue if (!diag) { @@ -479,8 +507,18 @@ void VisualTool::GetLinePosition(AssDialogue *diag,int &x, int &y, int &orgx, in } -/////////////////////////////////////// -// Get the destination of move, if any + +/// @brief Get the destination of move, if any +/// @param diag +/// @param hasMove +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// @param t1 +/// @param t2 +/// @return +/// void VisualTool::GetLineMove(AssDialogue *diag,bool &hasMove,int &x1,int &y1,int &x2,int &y2,int &t1,int &t2) { // Parse tags hasMove = false; @@ -516,8 +554,14 @@ void VisualTool::GetLineMove(AssDialogue *diag,bool &hasMove,int &x1,int &y1,int } -/////////////////////// -// Get line's rotation + +/// @brief Get line's rotation +/// @param diag +/// @param rx +/// @param ry +/// @param rz +/// @return +/// void VisualTool::GetLineRotation(AssDialogue *diag,float &rx,float &ry,float &rz) { // Default values rx = ry = rz = 0.0f; @@ -555,8 +599,13 @@ void VisualTool::GetLineRotation(AssDialogue *diag,float &rx,float &ry,float &rz } -//////////////////// -// Get line's scale + +/// @brief Get line's scale +/// @param diag +/// @param scalX +/// @param scalY +/// @return +/// void VisualTool::GetLineScale(AssDialogue *diag,float &scalX,float &scalY) { // Default values scalX = scalY = 100.0f; @@ -588,8 +637,16 @@ void VisualTool::GetLineScale(AssDialogue *diag,float &scalX,float &scalY) { } -/////////////////// -// Get line's clip + +/// @brief Get line's clip +/// @param diag +/// @param x1 +/// @param y1 +/// @param x2 +/// @param y2 +/// @param inverse +/// @return +/// void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse) { // Default values x1 = y1 = 0; @@ -634,8 +691,13 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,b } -////////////////////////////////////// -// Get line vector clip, if it exists + +/// @brief Get line vector clip, if it exists +/// @param diag +/// @param scale +/// @param inverse +/// @return +/// wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse) { // Prepare overrides wxString result; @@ -679,29 +741,41 @@ wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale,bool &invers } -//////////////// -// Set override + +/// @brief Set override +/// @param tag +/// @param value +/// void VisualTool::SetOverride(wxString tag,wxString value) { VideoContext::Get()->grid->editBox->SetOverride(tag,value,0,false); parent->SetFocus(); } -////////////////// -// Connect button + +/// @brief Connect button +/// @param button +/// void VisualTool::ConnectButton(wxButton *button) { button->Connect(wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(VisualToolEvent::OnButton),NULL,&eventSink); } -////////////// -// Event sink + +/// @brief Event sink +/// @param _tool +/// VisualToolEvent::VisualToolEvent(VisualTool *_tool) { tool = _tool; } + +/// @brief DOCME +/// @param event +/// void VisualToolEvent::OnButton(wxCommandEvent &event) { tool->OnButton(event); } + diff --git a/aegisub/src/visual_tool.h b/aegisub/src/visual_tool.h index 2b3ff6728..d49dbe1e2 100644 --- a/aegisub/src/visual_tool.h +++ b/aegisub/src/visual_tool.h @@ -54,16 +54,24 @@ class AssDialogue; class VisualTool; -///////////////////////// -// Visual sub tool range + +/// DOCME #define VISUAL_SUB_TOOL_START 1300 + +/// DOCME #define VISUAL_SUB_TOOL_END (VISUAL_SUB_TOOL_START+100) -//////////////////// -// Event sink class + +/// DOCME +/// @class VisualToolEvent +/// @brief DOCME +/// +/// DOCME class VisualToolEvent : public wxEvtHandler { private: + + /// DOCME VisualTool *tool; public: @@ -73,34 +81,88 @@ public: }; -//////////////////////// -// Visual handler class + +/// DOCME +/// @class VisualTool +/// @brief DOCME +/// +/// DOCME class VisualTool : public OpenGLWrapper { friend class VisualToolEvent; private: + + /// DOCME VideoDisplay *parent; + + /// DOCME VisualToolEvent eventSink; protected: + + /// DOCME wxColour colour[4]; + + /// DOCME bool holding; + + /// DOCME AssDialogue *curDiag; + + /// DOCME bool dragging; + + /// DOCME int curFeature; + + /// DOCME std::vector features; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int dragStartX,dragStartY,dragOrigX,dragOrigY; + + /// DOCME bool dragListOK; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int w,h,sw,sh,mx,my; + + /// DOCME int frame_n; + + /// DOCME bool leftClick; + + /// DOCME bool leftDClick; + + /// DOCME bool shiftDown; + + /// DOCME bool ctrlDown; + + /// DOCME bool altDown; void GetLinePosition(AssDialogue *diag,int &x,int &y); @@ -113,6 +175,10 @@ protected: void FillPositionData(); void SetOverride(wxString tag,wxString value); + + /// @brief DOCME + /// @return + /// VideoDisplay *GetParent() { return parent; } AssDialogue *GetActiveDialogueLine(); int GetHighlightedFeature(); @@ -120,28 +186,89 @@ protected: void Commit(bool full=false); void ConnectButton(wxButton *button); + + /// @brief DOCME + /// @param event + /// @return + /// virtual void OnButton(wxCommandEvent &event) {} + + /// @brief DOCME + /// @return + /// virtual bool CanHold() { return false; } + + /// @brief DOCME + /// @return + /// virtual bool HoldEnabled() { return true; } + + /// @brief DOCME + /// virtual void InitializeHold() {} + + /// @brief DOCME + /// virtual void UpdateHold() {} + + /// @brief DOCME + /// @return + /// virtual void CommitHold() {} + + /// @brief DOCME + /// @return + /// virtual bool CanDrag() { return false; } + + /// @brief DOCME + /// @return + /// virtual bool DragEnabled() { return true; } + + /// @brief DOCME + /// virtual void PopulateFeatureList() { wxLogMessage(_T("wtf?")); } + + /// @brief DOCME + /// @param feature + /// virtual void InitializeDrag(VisualDraggableFeature &feature) {} + + /// @brief DOCME + /// @param feature + /// virtual void UpdateDrag(VisualDraggableFeature &feature) {} + + /// @brief DOCME + /// @param feature + /// virtual void CommitDrag(VisualDraggableFeature &feature) {} + + /// @brief DOCME + /// @param feature + /// virtual void ClickedFeature(VisualDraggableFeature &feature) {} + + /// @brief DOCME + /// virtual void DoRefresh() {} public: + + /// DOCME + + /// DOCME int mouseX,mouseY; void OnMouseEvent(wxMouseEvent &event); + + /// @brief DOCME + /// @param event + /// virtual void OnSubTool(wxCommandEvent &event) {} virtual void Update()=0; virtual void Draw()=0; @@ -153,3 +280,4 @@ public: + diff --git a/aegisub/src/visual_tool_clip.cpp b/aegisub/src/visual_tool_clip.cpp index dc7cde713..b21399803 100644 --- a/aegisub/src/visual_tool_clip.cpp +++ b/aegisub/src/visual_tool_clip.cpp @@ -47,8 +47,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// VisualToolClip::VisualToolClip(VideoDisplay *_parent) : VisualTool(_parent) { @@ -64,16 +66,19 @@ VisualToolClip::VisualToolClip(VideoDisplay *_parent) } -////////// -// Update + +/// @brief Update +/// void VisualToolClip::Update() { // Render parent GetParent()->Render(); } -//////// -// Draw + +/// @brief Draw +/// @return +/// void VisualToolClip::Draw() { // Get current line AssDialogue *line = GetActiveDialogueLine(); @@ -117,8 +122,9 @@ void VisualToolClip::Draw() { } -///////////////// -// Start holding + +/// @brief Start holding +/// void VisualToolClip::InitializeHold() { startX = mouseX; startY = mouseY; @@ -127,8 +133,9 @@ void VisualToolClip::InitializeHold() { } -/////////////// -// Update hold + +/// @brief Update hold +/// void VisualToolClip::UpdateHold() { // Coordinates curX1 = startX * sw / w; @@ -151,8 +158,9 @@ void VisualToolClip::UpdateHold() { } -/////////////// -// Commit hold + +/// @brief Commit hold +/// void VisualToolClip::CommitHold() { if (inverse) SetOverride(_T("\\iclip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2)); @@ -161,8 +169,9 @@ void VisualToolClip::CommitHold() { } -///////////////////////// -// Populate feature list + +/// @brief Populate feature list +/// void VisualToolClip::PopulateFeatureList() { // Clear if (features.size() != 4) { @@ -209,8 +218,10 @@ void VisualToolClip::PopulateFeatureList() { } -////////////// -// Initialize + +/// @brief Initialize +/// @param feature +/// void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) { curDiag = GetActiveDialogueLine(); curDiag->StripTag(_T("\\clip")); @@ -218,8 +229,10 @@ void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) { } -/////////////// -// Update drag + +/// @brief Update drag +/// @param feature +/// void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) { // Update brothers features[feature.brother[0]].y = feature.y; @@ -237,9 +250,12 @@ void VisualToolClip::UpdateDrag(VisualDraggableFeature &feature) { } -///////////////// -// Done dragging + +/// @brief Done dragging +/// @param feature +/// void VisualToolClip::CommitDrag(VisualDraggableFeature &feature) { CommitHold(); } + diff --git a/aegisub/src/visual_tool_clip.h b/aegisub/src/visual_tool_clip.h index e9a02aa80..aee84177e 100644 --- a/aegisub/src/visual_tool_clip.h +++ b/aegisub/src/visual_tool_clip.h @@ -43,18 +43,43 @@ #include "visual_tool.h" -/////////////////// -// Clip tool class + +/// DOCME +/// @class VisualToolClip +/// @brief DOCME +/// +/// DOCME class VisualToolClip : public VisualTool { private: + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int startX,startY,curX1,curY1,curX2,curY2; + + /// DOCME bool inverse; + + /// @brief DOCME + /// @return + /// bool CanHold() { return true; } void InitializeHold(); void UpdateHold(); void CommitHold(); + + /// @brief DOCME + /// bool CanDrag() { return true; } void PopulateFeatureList(); void InitializeDrag(VisualDraggableFeature &feature); @@ -68,3 +93,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_cross.cpp b/aegisub/src/visual_tool_cross.cpp index cd1f823c6..3d2f6b921 100644 --- a/aegisub/src/visual_tool_cross.cpp +++ b/aegisub/src/visual_tool_cross.cpp @@ -46,8 +46,10 @@ #include "ass_file.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// VisualToolCross::VisualToolCross(VideoDisplay *_parent) : VisualTool(_parent) { @@ -55,15 +57,17 @@ VisualToolCross::VisualToolCross(VideoDisplay *_parent) } -////////////// -// Destructor + +/// @brief Destructor +/// VisualToolCross::~VisualToolCross() { GetParent()->ShowCursor(true); } -////////// -// Update + +/// @brief Update +/// void VisualToolCross::Update() { // Position if (leftDClick) { @@ -81,8 +85,9 @@ void VisualToolCross::Update() { } -//////// -// Draw + +/// @brief Draw +/// void VisualToolCross::Draw() { // Is it outside? if (mouseX == -1 || mouseY == -1) return; @@ -142,3 +147,4 @@ void VisualToolCross::Draw() { glMatrixMode(GL_MODELVIEW); } + diff --git a/aegisub/src/visual_tool_cross.h b/aegisub/src/visual_tool_cross.h index 87d07275a..e513b4534 100644 --- a/aegisub/src/visual_tool_cross.h +++ b/aegisub/src/visual_tool_cross.h @@ -43,8 +43,12 @@ #include "visual_tool.h" -//////////////////////// -// Crosshair tool class + +/// DOCME +/// @class VisualToolCross +/// @brief DOCME +/// +/// DOCME class VisualToolCross : public VisualTool { public: VisualToolCross(VideoDisplay *parent); @@ -54,3 +58,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_drag.cpp b/aegisub/src/visual_tool_drag.cpp index 4e004a872..4ae8d0745 100644 --- a/aegisub/src/visual_tool_drag.cpp +++ b/aegisub/src/visual_tool_drag.cpp @@ -53,12 +53,17 @@ /////// // IDs enum { + + /// DOCME BUTTON_TOGGLE_MOVE = VISUAL_SUB_TOOL_START }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// @param toolBar +/// VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxToolBar *toolBar) : VisualTool(_parent) { @@ -74,8 +79,10 @@ VisualToolDrag::VisualToolDrag(VideoDisplay *_parent,wxToolBar *toolBar) } -///////////////////////// -// Update toggle buttons + +/// @brief Update toggle buttons +/// @return +/// void VisualToolDrag::UpdateToggleButtons() { // Check which bitmap to use bool toMove = true; @@ -97,8 +104,11 @@ void VisualToolDrag::UpdateToggleButtons() { } -///////////////////////// -// Toggle button pressed + +/// @brief Toggle button pressed +/// @param event +/// @return +/// void VisualToolDrag::OnButton(wxCommandEvent &event) { // Get line AssDialogue *line = GetActiveDialogueLine(); @@ -126,22 +136,25 @@ void VisualToolDrag::OnButton(wxCommandEvent &event) { } -/////////// -// Refresh + +/// @brief Refresh +/// void VisualToolDrag::DoRefresh() { UpdateToggleButtons(); } -////////// -// Update + +/// @brief Update +/// void VisualToolDrag::Update() { GetParent()->Render(); } -//////// -// Draw + +/// @brief Draw +/// void VisualToolDrag::Draw() { DrawAllFeatures(); @@ -196,8 +209,9 @@ void VisualToolDrag::Draw() { } -///////////////// -// Populate list + +/// @brief Populate list +/// void VisualToolDrag::PopulateFeatureList() { // Clear features features.clear(); @@ -275,14 +289,18 @@ void VisualToolDrag::PopulateFeatureList() { } -////////////////// -// Start dragging + +/// @brief Start dragging +/// @param feature +/// void VisualToolDrag::InitializeDrag(VisualDraggableFeature &feature) { } -/////////////// -// Update drag + +/// @brief Update drag +/// @param feature +/// void VisualToolDrag::UpdateDrag(VisualDraggableFeature &feature) { // Update "value" to reflect the time of the frame in which the feature is being dragged int time = VFR_Output.GetTimeAtFrame(frame_n,true,true); @@ -290,8 +308,10 @@ void VisualToolDrag::UpdateDrag(VisualDraggableFeature &feature) { } -/////////////// -// Commit drag + +/// @brief Commit drag +/// @param feature +/// void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) { // Origin if (feature.type == DRAG_BIG_TRIANGLE) { @@ -316,3 +336,4 @@ void VisualToolDrag::CommitDrag(VisualDraggableFeature &feature) { } } + diff --git a/aegisub/src/visual_tool_drag.h b/aegisub/src/visual_tool_drag.h index a7ea11788..3eb557c04 100644 --- a/aegisub/src/visual_tool_drag.h +++ b/aegisub/src/visual_tool_drag.h @@ -45,13 +45,24 @@ #include "visual_tool.h" -/////////////////// -// Drag tool class + +/// DOCME +/// @class VisualToolDrag +/// @brief DOCME +/// +/// DOCME class VisualToolDrag : public VisualTool { private: + + /// DOCME wxBitmapButton *toggleMove; + + /// DOCME bool toggleMoveOnMove; + + /// @brief DOCME + /// bool CanDrag() { return true; } void PopulateFeatureList(); void InitializeDrag(VisualDraggableFeature &feature); @@ -69,3 +80,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_rotatexy.cpp b/aegisub/src/visual_tool_rotatexy.cpp index 80ec39dae..ad9620369 100644 --- a/aegisub/src/visual_tool_rotatexy.cpp +++ b/aegisub/src/visual_tool_rotatexy.cpp @@ -47,8 +47,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *_parent) : VisualTool(_parent) { @@ -57,16 +59,19 @@ VisualToolRotateXY::VisualToolRotateXY(VideoDisplay *_parent) } -////////// -// Update + +/// @brief Update +/// void VisualToolRotateXY::Update() { // Render parent GetParent()->Render(); } -//////// -// Draw + +/// @brief Draw +/// @return +/// void VisualToolRotateXY::Draw() { // Get line to draw AssDialogue *line = GetActiveDialogueLine(); @@ -177,8 +182,9 @@ void VisualToolRotateXY::Draw() { } -///////////////// -// Start holding + +/// @brief Start holding +/// void VisualToolRotateXY::InitializeHold() { GetLinePosition(curDiag,odx,ody,orgx,orgy); GetLineRotation(curDiag,origAngleX,origAngleY,rz); @@ -191,8 +197,9 @@ void VisualToolRotateXY::InitializeHold() { } -/////////////// -// Update hold + +/// @brief Update hold +/// void VisualToolRotateXY::UpdateHold() { // Find screen angles float screenAngleX = (orgy-mouseY*sh/h)*2.0; @@ -224,16 +231,18 @@ void VisualToolRotateXY::UpdateHold() { } -/////////////// -// Commit hold + +/// @brief Commit hold +/// void VisualToolRotateXY::CommitHold() { SetOverride(_T("\\frx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleX))); SetOverride(_T("\\fry"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngleY))); } -////////////////// -// Get \org pivot + +/// @brief Get \org pivot +/// void VisualToolRotateXY::PopulateFeatureList() { // Get line curDiag = GetActiveDialogueLine(); @@ -249,26 +258,32 @@ void VisualToolRotateXY::PopulateFeatureList() { } -/////////////////////////// -// Update dragging of \org + +/// @brief Update dragging of \org +/// @param feature +/// void VisualToolRotateXY::UpdateDrag(VisualDraggableFeature &feature) { orgx = feature.x; orgy = feature.y; } -/////////////////////////// -// Commit dragging of \org + +/// @brief Commit dragging of \org +/// @param feature +/// void VisualToolRotateXY::CommitDrag(VisualDraggableFeature &feature) { SetOverride(_T("\\org"),wxString::Format(_T("(%i,%i)"),feature.x,feature.y)); } -/////////// -// Refresh + +/// @brief Refresh +/// void VisualToolRotateXY::DoRefresh() { AssDialogue *line = GetActiveDialogueLine(); GetLinePosition(line,odx,ody,orgx,orgy); GetLineRotation(line,curAngleX,curAngleY,rz); } + diff --git a/aegisub/src/visual_tool_rotatexy.h b/aegisub/src/visual_tool_rotatexy.h index 9d42fcd27..58acc1f50 100644 --- a/aegisub/src/visual_tool_rotatexy.h +++ b/aegisub/src/visual_tool_rotatexy.h @@ -43,20 +43,53 @@ #include "visual_tool.h" -////////////////////////// -// XY Rotation tool class + +/// DOCME +/// @class VisualToolRotateXY +/// @brief DOCME +/// +/// DOCME class VisualToolRotateXY : public VisualTool { private: + + /// DOCME + + /// DOCME + + /// DOCME float curAngleX,startAngleX,origAngleX; + + /// DOCME + + /// DOCME + + /// DOCME float curAngleY,startAngleY,origAngleY; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int orgx,orgy,odx,ody; + + /// DOCME float rz; + + /// @brief DOCME + /// @return + /// bool CanHold() { return true; } void InitializeHold(); void UpdateHold(); void CommitHold(); + + /// @brief DOCME + /// bool CanDrag() { return true; } void PopulateFeatureList(); void UpdateDrag(VisualDraggableFeature &feature); @@ -71,3 +104,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_rotatez.cpp b/aegisub/src/visual_tool_rotatez.cpp index c6b26733a..d73e73914 100644 --- a/aegisub/src/visual_tool_rotatez.cpp +++ b/aegisub/src/visual_tool_rotatez.cpp @@ -47,8 +47,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *_parent) : VisualTool(_parent) { @@ -57,16 +59,19 @@ VisualToolRotateZ::VisualToolRotateZ(VideoDisplay *_parent) } -////////// -// Update + +/// @brief Update +/// void VisualToolRotateZ::Update() { // Render parent GetParent()->Render(); } -//////// -// Draw + +/// @brief Draw +/// @return +/// void VisualToolRotateZ::Draw() { // Get line to draw AssDialogue *line = GetActiveDialogueLine(); @@ -162,8 +167,9 @@ void VisualToolRotateZ::Draw() { } -///////////////// -// Start holding + +/// @brief Start holding +/// void VisualToolRotateZ::InitializeHold() { GetLinePosition(curDiag,odx,ody,orgx,orgy); startAngle = atan2(double(orgy-mouseY*sh/h),double(mouseX*sw/w-orgx)) * 180.0 / 3.1415926535897932; @@ -174,8 +180,9 @@ void VisualToolRotateZ::InitializeHold() { } -/////////////// -// Update hold + +/// @brief Update hold +/// void VisualToolRotateZ::UpdateHold() { // Find angle float screenAngle = atan2(double(orgy-mouseY*sh/h),double(mouseX*sw/w-orgx)) * 180.0 / 3.1415926535897932; @@ -191,15 +198,17 @@ void VisualToolRotateZ::UpdateHold() { } -/////////////// -// Commit hold + +/// @brief Commit hold +/// void VisualToolRotateZ::CommitHold() { SetOverride(_T("\\frz"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curAngle))); } -////////////////// -// Get \org pivot + +/// @brief Get \org pivot +/// void VisualToolRotateZ::PopulateFeatureList() { // Get line curDiag = GetActiveDialogueLine(); @@ -215,26 +224,32 @@ void VisualToolRotateZ::PopulateFeatureList() { } -/////////////////////////// -// Update dragging of \org + +/// @brief Update dragging of \org +/// @param feature +/// void VisualToolRotateZ::UpdateDrag(VisualDraggableFeature &feature) { orgx = feature.x; orgy = feature.y; } -/////////////////////////// -// Commit dragging of \org + +/// @brief Commit dragging of \org +/// @param feature +/// void VisualToolRotateZ::CommitDrag(VisualDraggableFeature &feature) { SetOverride(_T("\\org"),wxString::Format(_T("(%i,%i)"),feature.x,feature.y)); } -/////////// -// Refresh + +/// @brief Refresh +/// void VisualToolRotateZ::DoRefresh() { AssDialogue *line = GetActiveDialogueLine(); GetLinePosition(line,odx,ody,orgx,orgy); GetLineRotation(line,rx,ry,curAngle); } + diff --git a/aegisub/src/visual_tool_rotatez.h b/aegisub/src/visual_tool_rotatez.h index 1f63f67b6..211901cf0 100644 --- a/aegisub/src/visual_tool_rotatez.h +++ b/aegisub/src/visual_tool_rotatez.h @@ -43,19 +43,48 @@ #include "visual_tool.h" -///////////////////////// -// Z Rotation tool class + +/// DOCME +/// @class VisualToolRotateZ +/// @brief DOCME +/// +/// DOCME class VisualToolRotateZ : public VisualTool { private: + + /// DOCME + + /// DOCME + + /// DOCME float curAngle,startAngle,origAngle; + + /// DOCME + + /// DOCME + + /// DOCME + + /// DOCME int orgx,orgy,odx,ody; + + /// DOCME + + /// DOCME float rx,ry; + + /// @brief DOCME + /// @return + /// bool CanHold() { return true; } void InitializeHold(); void UpdateHold(); void CommitHold(); + + /// @brief DOCME + /// bool CanDrag() { return true; } void PopulateFeatureList(); void UpdateDrag(VisualDraggableFeature &feature); @@ -70,3 +99,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_scale.cpp b/aegisub/src/visual_tool_scale.cpp index 7834657f4..6b389187e 100644 --- a/aegisub/src/visual_tool_scale.cpp +++ b/aegisub/src/visual_tool_scale.cpp @@ -47,8 +47,10 @@ #include "utils.h" -/////////////// -// Constructor + +/// @brief Constructor +/// @param _parent +/// VisualToolScale::VisualToolScale(VideoDisplay *_parent) : VisualTool(_parent) { @@ -56,16 +58,19 @@ VisualToolScale::VisualToolScale(VideoDisplay *_parent) } -////////// -// Update + +/// @brief Update +/// void VisualToolScale::Update() { // Render parent GetParent()->Render(); } -//////// -// Draw + +/// @brief Draw +/// @return +/// void VisualToolScale::Draw() { // Get line to draw AssDialogue *line = GetActiveDialogueLine(); @@ -135,8 +140,9 @@ void VisualToolScale::Draw() { } -///////////////// -// Start holding + +/// @brief Start holding +/// void VisualToolScale::InitializeHold() { startX = mouseX; startY = mouseY; @@ -148,8 +154,9 @@ void VisualToolScale::InitializeHold() { } -/////////////// -// Update hold + +/// @brief Update hold +/// void VisualToolScale::UpdateHold() { // Deltas int deltaX = mouseX - startX; @@ -173,10 +180,12 @@ void VisualToolScale::UpdateHold() { } -/////////////// -// Commit hold + +/// @brief Commit hold +/// void VisualToolScale::CommitHold() { SetOverride(_T("\\fscx"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleX))); SetOverride(_T("\\fscy"),PrettyFloat(wxString::Format(_T("(%0.3f)"),curScaleY))); } + diff --git a/aegisub/src/visual_tool_scale.h b/aegisub/src/visual_tool_scale.h index a84a30bb2..8f5c8d2ea 100644 --- a/aegisub/src/visual_tool_scale.h +++ b/aegisub/src/visual_tool_scale.h @@ -43,14 +43,37 @@ #include "visual_tool.h" -//////////////////// -// Scale tool class + +/// DOCME +/// @class VisualToolScale +/// @brief DOCME +/// +/// DOCME class VisualToolScale : public VisualTool { private: + + /// DOCME + + /// DOCME + + /// DOCME float curScaleX,startScaleX,origScaleX; + + /// DOCME + + /// DOCME + + /// DOCME float curScaleY,startScaleY,origScaleY; + + /// DOCME + + /// DOCME int startX,startY; + + /// @brief DOCME + /// bool CanHold() { return true; } void InitializeHold(); void UpdateHold(); @@ -63,3 +86,4 @@ public: void Draw(); }; + diff --git a/aegisub/src/visual_tool_vector_clip.cpp b/aegisub/src/visual_tool_vector_clip.cpp index 6d80f7c5a..a6ebe49e5 100644 --- a/aegisub/src/visual_tool_vector_clip.cpp +++ b/aegisub/src/visual_tool_vector_clip.cpp @@ -48,20 +48,41 @@ /////// // IDs enum { + + /// DOCME BUTTON_DRAG = VISUAL_SUB_TOOL_START, + + /// DOCME BUTTON_LINE, + + /// DOCME BUTTON_BICUBIC, + + /// DOCME BUTTON_CONVERT, + + /// DOCME BUTTON_INSERT, + + /// DOCME BUTTON_REMOVE, + + /// DOCME BUTTON_FREEHAND, + + /// DOCME BUTTON_FREEHAND_SMOOTH, + + /// DOCME BUTTON_LAST // Leave this at the end and don't use it }; -/////////////// -// Constructor + +/// @brief Constructor +/// @param parent +/// @param _toolBar +/// VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxToolBar *_toolBar) : VisualTool(parent) { @@ -90,15 +111,19 @@ VisualToolVectorClip::VisualToolVectorClip(VideoDisplay *parent,wxToolBar *_tool } -//////////////////// -// Sub-tool pressed + +/// @brief Sub-tool pressed +/// @param event +/// void VisualToolVectorClip::OnSubTool(wxCommandEvent &event) { SetMode(event.GetId() - BUTTON_DRAG); } -//////////// -// Set mode + +/// @brief Set mode +/// @param _mode +/// void VisualToolVectorClip::SetMode(int _mode) { // Make sure clicked is checked and everything else isn't. (Yes, this is radio behavior, but the separators won't let me use it) for (int i=BUTTON_DRAG;iRender(); } -//////// -// Draw + +/// @brief Draw +/// @return +/// void VisualToolVectorClip::Draw() { // Get line AssDialogue *line = GetActiveDialogueLine(); @@ -200,8 +228,9 @@ void VisualToolVectorClip::Draw() { } -///////////////////////// -// Populate feature list + +/// @brief Populate feature list +/// void VisualToolVectorClip::PopulateFeatureList() { // Clear features.clear(); @@ -262,22 +291,28 @@ void VisualToolVectorClip::PopulateFeatureList() { } -///////////// -// Can drag? + +/// @brief Can drag? +/// @return +/// bool VisualToolVectorClip::DragEnabled() { return mode <= 4; } -////////// -// Update + +/// @brief Update +/// @param feature +/// void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) { spline.MovePoint(feature.value,feature.value2,wxPoint(feature.x,feature.y)); } -////////// -// Commit + +/// @brief Commit +/// @param feature +/// void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) { if (inverse) SetOverride(_T("\\iclip"),_T("(") + spline.EncodeToASS() + _T(")")); @@ -286,8 +321,11 @@ void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) { } -///////////////////// -// Clicked a feature + +/// @brief Clicked a feature +/// @param feature +/// @return +/// void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) { // Delete a control point if (mode == 5) { @@ -316,15 +354,19 @@ void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) { } -///////////// -// Can hold? + +/// @brief Can hold? +/// @return +/// bool VisualToolVectorClip::HoldEnabled() { return mode <= 4 || mode == 6 || mode == 7; } -/////////////////// -// Initialize hold + +/// @brief Initialize hold +/// @return +/// void VisualToolVectorClip::InitializeHold() { // Insert line/bicubic if (mode == 1 || mode == 2) { @@ -418,8 +460,10 @@ void VisualToolVectorClip::InitializeHold() { } -/////////////// -// Update hold + +/// @brief Update hold +/// @return +/// void VisualToolVectorClip::UpdateHold() { // Insert line if (mode == 1) { @@ -468,8 +512,9 @@ void VisualToolVectorClip::UpdateHold() { } -/////////////// -// Commit hold + +/// @brief Commit hold +/// void VisualToolVectorClip::CommitHold() { // Smooth spline if (!holding && mode == 7) spline.Smooth(); @@ -487,8 +532,9 @@ void VisualToolVectorClip::CommitHold() { } -/////////// -// Refresh + +/// @brief Refresh +/// void VisualToolVectorClip::DoRefresh() { if (!dragging) { // Get line @@ -505,3 +551,4 @@ void VisualToolVectorClip::DoRefresh() { } } + diff --git a/aegisub/src/visual_tool_vector_clip.h b/aegisub/src/visual_tool_vector_clip.h index ebb96acba..61342188c 100644 --- a/aegisub/src/visual_tool_vector_clip.h +++ b/aegisub/src/visual_tool_vector_clip.h @@ -45,24 +45,47 @@ #include "spline.h" -////////////////////////// -// Vector clip tool class + +/// DOCME +/// @class VisualToolVectorClip +/// @brief DOCME +/// +/// DOCME class VisualToolVectorClip : public VisualTool { private: + + /// DOCME Spline spline; + + /// DOCME wxToolBar *toolBar; + + /// DOCME int mode; + + /// DOCME + + /// DOCME int lastX,lastY; + + /// DOCME bool inverse; void SetMode(int mode); + + /// @brief DOCME + /// @return + /// bool CanHold() { return true; } bool HoldEnabled(); void InitializeHold(); void UpdateHold(); void CommitHold(); + + /// @brief DOCME + /// bool CanDrag() { return true; } bool DragEnabled(); void PopulateFeatureList(); @@ -80,3 +103,4 @@ public: void Draw(); }; +