/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool ChordDiagram::DoDeserialize(PowerTabInputStream& stream, wxWord version) { //------Last Checked------// // - Jan 14, 2005 m_chordName.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); stream >> m_topFret; wxCHECK(stream.CheckState(), false); wxByte count = 0; stream >> count; wxCHECK(stream.CheckState(), false); size_t i = 0; for (; i < count; i++) { wxByte fretNumber = 0; stream >> fretNumber; wxCHECK(stream.CheckState(), false); m_fretNumberArray.Add(fretNumber); } return (true); }
/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool Tuning::Deserialize(PowerTabInputStream& stream, uint16_t) { stream.ReadMFCString(m_name); stream >> m_data; stream.ReadSmallVector(m_noteArray); return true; }
// Serialization Functions /// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool OldRehearsalSign::DoDeserialize(PowerTabInputStream& stream, wxWord version) { //------Last Checked------// // - Dec 29, 2004 WXUNUSED(version); stream >> m_system >> m_position >> m_data >> m_letter; wxCHECK(stream.CheckState(), false); stream.ReadMFCString(m_description); wxCHECK(stream.CheckState(), false); return (stream.CheckState()); }
/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool ChordDiagram::Deserialize(PowerTabInputStream& stream, uint16_t version) { m_chordName.Deserialize(stream, version); stream >> m_topFret; stream.ReadSmallVector(m_fretNumberArray); return true; }
/// Reads the MFC class information for an object from a Power Tab input stream /// @param stream Power Tab input stream to read from /// @param version File version /// @param classId Class id for the object /// @return True if the object's class information was read, false if not bool PowerTabObject::ReadMFCClassInformation(PowerTabInputStream& stream, wxWord version, wxString& classId) { //------Last Checked------// // - Dec 24, 2004 classId.Clear(); // Read the schema wxWord schema; stream >> schema; wxCHECK(stream.CheckState(), false); // Read the length of the class name wxWord length; stream >> length; wxCHECK(stream.CheckState(), false); if (length >= MAX_CLASSNAME_LENGTH) { stream.m_lastPowerTabError = POWERTABSTREAM_BAD_CLASS; return (false); } if (!stream.ReadAnsiText(length, classId)) { stream.m_lastPowerTabError = POWERTABSTREAM_BAD_CLASS; return (false); } // Add "old" tag for outdated classes used in v1.0-1.0.2 if (version <= PowerTabFileHeader::FILEVERSION_1_0_2) { if ((classId == wxT("CRehearsalSign")) || (classId == wxT("CTimeSignature"))) classId += wxT("-old"); } // Attach the schema to the class id classId += wxString::Format(wxT("-%d"), schema); // TODO: Add class validation here? return (stream.CheckState()); }
/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool FloatingText::DoDeserialize(PowerTabInputStream & stream, wxWord version) { //------Last Checked------// // - Dec 7, 2004 stream.ReadMFCString(m_text); wxCHECK(stream.CheckState(), false); stream.ReadMFCRect(m_rect); wxCHECK(stream.CheckState(), false); stream >> m_flags; wxCHECK(stream.CheckState(), false); m_fontSetting.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); return (stream.CheckState()); }
/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool FontSetting::DoDeserialize(PowerTabInputStream& stream, wxWord version) { //------Last Checked------// // - Dec 5, 2004 stream.ReadMFCString(m_faceName); wxCHECK(stream.CheckState(), false); stream >> m_pointSize >> m_weight >> m_italic >> m_underline >> m_strikeOut; wxCHECK(stream.CheckState(), false); stream.ReadWin32ColorRef(m_color); wxCHECK(stream.CheckState(), false); return (stream.CheckState()); }
/// Performs deserialization for the class /// @param stream Power Tab input stream to load from /// @param version File version /// @return True if the object was deserialized, false if not bool System::DoDeserialize(PowerTabInputStream& stream, wxWord version) { //------Last Checked------// // - Jan 14, 2005 // Version 1.0 and 1.0.2 if (version == PowerTabFileHeader::FILEVERSION_1_0 || version == PowerTabFileHeader::FILEVERSION_1_0_2) { wxByte key; wxWord endBar; stream.ReadMFCRect(m_rect); wxCHECK(stream.CheckState(), false); stream >> key >> endBar >> m_positionSpacing >> m_rhythmSlashSpacingAbove >> m_rhythmSlashSpacingBelow >> m_extraSpacing; wxCHECK(stream.CheckState(), false); // Update the key signature at start of section (always shown) wxByte keyType = (wxByte)((key >> 4) & 0xf); wxByte keyAccidentals = (wxByte)(key & 0xf); m_startBar.GetKeySignatureRef().Show(); // Cancellation if (keyType > 2) m_startBar.GetKeySignatureRef().SetCancellation(); keyType = (wxByte)(((keyType % 2) == 1) ? KeySignature::majorKey : KeySignature::minorKey); m_startBar.GetKeySignatureRef().SetKey(keyType, keyAccidentals); // Update the ending bar wxByte barType = HIBYTE(endBar); wxByte repeatCount = LOBYTE(endBar); m_endBar.SetBarlineData(barType, repeatCount); //SetEndBar(barType, repeatCount); m_directionArray.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); m_chordTextArray.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); m_rhythmSlashArray.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); m_staffArray.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); m_barlineArray.Deserialize(stream, version); wxCHECK(stream.CheckState(), false); // Any barline at position zero is now stored in the section m_startBar if (GetBarlineCount() > 0) { Barline* barline = m_barlineArray[0]; if (barline != NULL) { if (barline->GetPosition() == 0) { m_startBar = *barline; delete barline; m_barlineArray.RemoveAt(0); } } } // Update key signs that aren't show to match active key sign KeySignature* activeKeySignature = m_startBar.GetKeySignaturePtr(); size_t i = 0; size_t count = m_barlineArray.GetCount(); for (; i < count; i++) { KeySignature& keySignature = m_barlineArray[i]->GetKeySignatureRef(); // Key on bar doesn't match active if (keySignature != *activeKeySignature) { // Key isn't shown, update key to match if (!keySignature.IsShown()) { keySignature = *activeKeySignature; keySignature.Hide(); keySignature.SetCancellation(false); } // Update active key activeKeySignature = m_barlineArray[i]->GetKeySignaturePtr(); } } }