void PowerTabView::OnUpdate(wxView* sender, wxObject* hint) { //------Last Checked------// // - Jan 27, 2005 WXUNUSED(sender); WXUNUSED(hint); }
Gura_ImplementMethod(wx_DebugReportUpload, OnServerReply) { Signal &sig = env.GetSignal(); #if 0 Object_wx_DebugReportUpload *pThis = Object_wx_DebugReportUpload::GetObjectThis(arg); if (pThis->IsInvalid(sig)) return Value::Nil; std::unique_ptr<wxArrayString> WXUNUSED(reply)(CreateArrayString(arg.GetList(0))); bool rtn = pThis->GetEntity()->OnServerReply(*WXUNUSED(reply)); return ReturnValue(env, arg, Value(rtn)); #endif SetError_NotImplemented(sig); return Value::Nil; }
// Overrides bool PowerTabView::OnCreate(wxDocument *doc, long flags) { //------Last Checked------// // - Jan 27, 2005 WXUNUSED(flags); MainFrame* mainFrame = GetMainFrame(); wxCHECK(mainFrame != NULL, false); m_frame = mainFrame->CreateChildFrame(doc, this); wxCHECK(m_frame != NULL, false); m_frame->SetTitle(wxT("PowerTabView")); m_canvas = CreateCanvas(this, m_frame); wxCHECK(m_canvas != NULL, false); #ifdef __X__ // X seems to require a forced resize int x, y; m_frame->GetSize(&x, &y); m_frame->SetSize(-1, -1, x, y); #endif m_frame->Show(true); Activate(true); return (true); }
void PowerTabTuningView::OnDraw(wxDC* dc) { // Note: Drawing is handled by the window class //------Last Checked------// // - Dec 30, 2004 WXUNUSED(dc); }
// Overrides bool PowerTabTuningView::OnCreate(wxDocument* doc, long flags) { //------Last Checked------// // - Dec 30, 2004 WXUNUSED(flags); MainFrame* mainFrame = GetMainFrame(); wxCHECK(mainFrame != NULL, false); m_frame = mainFrame->CreateChildFrame(doc, this); wxCHECK(m_frame != NULL, false); m_window = CreateViewWindow(); wxCHECK(m_window != NULL, false); #ifdef __X__ // X seems to require a forced resize int x, y; m_frame->GetSize(&x, &y); m_frame->SetSize(-1, -1, x, y); #endif m_frame->Show(true); Activate(true); return (true); }
TransportTracks GetAllPlaybackTracks(TrackList &trackList, bool selectedOnly, bool useMidi) { TransportTracks result; result.playbackTracks = trackList.GetWaveTrackArray(selectedOnly); #ifdef EXPERIMENTAL_MIDI_OUT if (useMidi) result.midiTracks = trackList.GetNoteTrackConstArray(selectedOnly); #else WXUNUSED(useMidi); #endif return result; }
void MainFrame::OnTestTestingFramework(wxCommandEvent& event) { // Menu Test -> Testing Framework //------Last Checked------// // - Jan 3, 2005 WXUNUSED(event); // TODO: Add any future test suites here TestingFramework* testingFramework = new TestingFramework; testingFramework->AddTestSuite(new AlternateEndingTestSuite); testingFramework->AddTestSuite(new BarlineTestSuite); testingFramework->AddTestSuite(new ChordDiagramTestSuite); testingFramework->AddTestSuite(new ChordNameTestSuite); testingFramework->AddTestSuite(new ChordTextTestSuite); testingFramework->AddTestSuite(new DirectionTestSuite); testingFramework->AddTestSuite(new DynamicTestSuite); testingFramework->AddTestSuite(new FloatingTextTestSuite); testingFramework->AddTestSuite(new FontSettingTestSuite); testingFramework->AddTestSuite(new GeneralMidiTestSuite); testingFramework->AddTestSuite(new GlobalTestSuite); testingFramework->AddTestSuite(new GuitarInTestSuite); testingFramework->AddTestSuite(new GuitarTestSuite); testingFramework->AddTestSuite(new KeySignatureTestSuite); testingFramework->AddTestSuite(new NoteTestSuite); testingFramework->AddTestSuite(new OldRehearsalSignTestSuite); testingFramework->AddTestSuite(new OldTimeSignatureTestSuite); testingFramework->AddTestSuite(new PositionTestSuite); testingFramework->AddTestSuite(new PowerTabDocumentTestSuite); testingFramework->AddTestSuite(new PowerTabFileHeaderTestSuite); testingFramework->AddTestSuite(new PowerTabObjectTestSuite); testingFramework->AddTestSuite(new RehearsalSignTestSuite); testingFramework->AddTestSuite(new RhythmSlashTestSuite); testingFramework->AddTestSuite(new ScoreTestSuite); testingFramework->AddTestSuite(new StaffTestSuite); testingFramework->AddTestSuite(new SystemSymbolTestSuite); testingFramework->AddTestSuite(new SystemTestSuite); testingFramework->AddTestSuite(new TempoMarkerTestSuite); testingFramework->AddTestSuite(new TimeSignatureTestSuite); testingFramework->AddTestSuite(new TuningTestSuite); testingFramework->SortTestSuitesByName(); TestingFrameworkDialog dlg; dlg.SetTestingFramework(testingFramework); // Center craps on Linux #ifdef __WXMSW__ dlg.Center(); #endif dlg.ShowModal(); }
void PowerTabTuningView::OnUpdate(wxView* sender, wxObject* hint) { //------Last Checked------// // - Dec 30, 2004 WXUNUSED(sender); WXUNUSED(hint); wxCHECK2(m_window != NULL, return); if ((sender != this) && (sender != NULL)) return; wxBusyCursor wait; // Add all the tunings from the document to the list control PowerTabTuningDocument* document = (PowerTabTuningDocument*)GetDocument(); wxCHECK2(document != NULL, return); m_window->DeleteAllItems(); size_t i = 0; size_t count = document->GetTuningCount(); for (; i < count; i++) { Tuning* tuning = document->GetTuning(i); wxCHECK2(tuning != NULL, continue); long index = m_window->InsertItem(m_window->GetItemCount(), tuning->GetName()); wxCHECK2(index != -1, continue); m_window->SetItem(index, PowerTabTuningViewWindow::COLUMN_STRINGS, wxString::Format(wxT("%d"), tuning->GetStringCount())); m_window->SetItem(index, PowerTabTuningViewWindow::COLUMN_SPELLING, tuning->GetSpelling()); } // Adjust the column widths int column = 0; for (; column < PowerTabTuningViewWindow::NUM_COLUMNS; column++) m_window->SetColumnWidth(column, wxLIST_AUTOSIZE_USEHEADER); }
// 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()); }
void wxStackFrame::OnParam(PSYMBOL_INFO pSymInfo) { m_paramTypes.Add(wxEmptyString); m_paramNames.Add(wxString::FromAscii(pSymInfo->Name)); // if symbol information is corrupted and we crash, the exception is going // to be ignored when we're called from WalkFromException() because of the // exception handler there returning EXCEPTION_CONTINUE_EXECUTION, but we'd // be left in an inconsistent state, so deal with it explicitly here (even // if normally we should never crash, of course...) #ifdef _CPPUNWIND try #else __try #endif { // as it is a parameter (and not a global var), it is always offset by // the frame address DWORD_PTR pValue = m_addrFrame + pSymInfo->Address; m_paramValues.Add(wxDbgHelpDLL::DumpSymbol(pSymInfo, (void *)pValue)); } #ifdef _CPPUNWIND catch ( ... ) #else __except ( EXCEPTION_EXECUTE_HANDLER ) #endif { m_paramValues.Add(wxEmptyString); } } BOOL CALLBACK EnumSymbolsProc(PSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data) { wxStackFrame *frame = wx_static_cast(wxStackFrame *, data); // we're only interested in parameters if ( pSymInfo->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER ) { frame->OnParam(pSymInfo); } // return true to continue enumeration, false would have stopped it return TRUE; }
subframe->GetClientSize(&width, &height); MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height)); canvas->SetCursor(wxCursor(wxCURSOR_PENCIL)); subframe->canvas = canvas; // Give it scrollbars canvas->SetScrollbars(20, 20, 50, 50); subframe->Show(true); } void MyFrame::OnSize(wxSizeEvent& #ifdef __WXUNIVERSAL__ event #else WXUNUSED(event) #endif ) { int w, h; GetClientSize(&w, &h); textWindow->SetSize(0, 0, 200, h); GetClientWindow()->SetSize(200, 0, w - 200, h); // FIXME: On wxX11, we need the MDI frame to process this // event, but on other platforms this should not // be done. #ifdef __WXUNIVERSAL__ event.Skip(); #endif
} else #endif { // x is wrong since the horizontal scrollbar is controlled by the // tree control, but we probably don't need it. scrolledWindow->GetViewStart(x, y); } } // In case we're using the generic tree control. void wxRemotelyScrolledTreeCtrl::PrepareDC( #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) wxDC& dc #else wxDC& WXUNUSED(dc) #endif ) { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; int startX, startY; GetViewStart(& startX, & startY); int xppu1, yppu1, xppu2, yppu2; win->wxGenericTreeCtrl::GetScrollPixelsPerUnit(& xppu1, & yppu1);
EVT_TREE_SEL_CHANGED(ID_PLAYLIST, PSFPlaylist::Selected) EVT_TREE_ITEM_ACTIVATED(ID_PLAYLIST, PSFPlaylist::Activated) EVT_DROP_FILES(PSFPlaylist::OnDropFiles) wxEND_EVENT_TABLE() void PSFPlaylist::Selected(wxTreeEvent &event) { PSFPlaylistItem *item = dynamic_cast<PSFPlaylistItem*>(GetItemData(GetSelection())); wxASSERT_MSG(item != 0, "failed to dynamic-cast wxTreeItemData into PSFPlaylistItem"); wxMessageOutputDebug().Printf("'%s' is seledted.", item->GetFileName()); } void PSFPlaylist::Activated(wxTreeEvent&Ended WXUNUSED(event)) { wxCommandEvent play_event(wxEVT_COMMAND_BUTTON_CLICKED, ID_PLAY); wxPostEvent(this, play_event); } void PSFPlaylist::OnDropFiles(wxDropFilesEvent& WXUNUSED(event)) { wxMessageOutputDebug().Printf("OnDropFiles"); } PSFPlaylistItem::PSFPlaylistItem(const wxString& fullpath, const wxString& filename) : m_loader(0), m_sound(0) {
void MainFrame::OnTestBatchFileSerialization(wxCommandEvent& event) { // Menu Test -> Batch File Serialization //------Last Checked------// // - Dec 31, 2004 WXUNUSED(event); // Display critical warning!!! if (wxMessageBox(wxT("CRITICAL WARNING: Do NOT perform this test on your original Power Tab files. Make a copy of files, place them in a temporary folder, and perform the test on the copied files instead.\n\nProceed with the the test?"), wxT("Batch File Serialization Test"), wxYES_NO | wxICON_ERROR) == wxNO) return; // Notes: This function will load (individually) all .ptb files // in a folder (and its subfolders), to ensure deserialization // is working correctly. If a file is the most recent file // format (v1.7), the file is saved to a memory stream, and // then compared with the original file to ensure serialization // is working correctly. If any errors occur, you will be prompted // to save the errors to a text file. wxArrayString errors; const wxString& dir = wxDirSelector(wxT("Select the folder where your Power Tab files (.ptb) reside, and then click OK.")); if (!dir.empty()) { const wxChar* errorMessageFormat = wxT("%s - [%s]"); // Get all .ptb files in the folder and its subfolders // This can take some time if you have alot of files or a slow machine wxArrayString files; { wxProgressDialog progressDialog(wxT("Scanning for Files"), wxT("Please wait. Scanning folders for Power Tab files..."), 0, this, wxPD_AUTO_HIDE | wxPD_APP_MODAL); wxDir::GetAllFiles(dir, &files, wxT("*.ptb")); progressDialog.Show(false); } // Process each file size_t i = 0; size_t fileCount = files.GetCount(); wxProgressDialog progressDialog(wxT("Batch File Serialization Test Progress"), wxT(""), fileCount, this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME); bool cancelled = false; // If true, user pressed Cancel button for (; i < fileCount; i++) { wxFileName fileName(files[i]); // Update progress status if (!progressDialog.Update(i, wxString::Format(wxT("Testing file %d of %d\n%s..."), i + 1, fileCount, fileName.GetFullName().c_str()))) { cancelled = true; break; } // Open the file wxFileInputStream stream(files[i]); if (stream.IsOk()) { PowerTabInputStream input_stream(stream); // Load the file PowerTabDocument document; if (!document.Load(input_stream)) { errors.Add(wxString::Format(errorMessageFormat, files[i].c_str(), input_stream.GetLastErrorMessage().c_str())); document.DeleteContents(); continue; } // If file version is the most current, we can perform a memory save test; if not, continue if (document.GetHeaderRef().GetVersion() != PowerTabFileHeader::FILEVERSION_CURRENT) { document.DeleteContents(); continue; } // Save the document to memory wxMemoryOutputStream memory_stream; document.SaveObject(memory_stream); // Size should be the same if (stream.GetSize() != memory_stream.GetSize()) { errors.Add(wxString::Format(errorMessageFormat, files[i].c_str(), wxT("Memory Save Test failure"))); document.DeleteContents(); continue; } // Compare each byte in the file to each byte of the saved memory data wxStreamBuffer* streamBuffer = memory_stream.GetOutputStreamBuffer(); if ((stream.GetSize() > 0) && (streamBuffer != NULL)) { // Set file position to start of file stream.SeekI(0); // Get a pointer to the memory stream buffer wxUint8* ptr = (wxUint8*)streamBuffer->GetBufferStart(); // Get number of bytes left to read from the file wxUint32 bytesLeft = stream.GetSize(); while (bytesLeft > 0) { // Read a chunk of data from the file const wxUint32 bufferSize = 4096; wxUint8 buffer[bufferSize]; wxUint32 bytesRead = min(bytesLeft, bufferSize); stream.Read(buffer, bufferSize); // Compare each byte in the chunk to the corresponding byte in the memory stream buffer wxUint32 b = 0; for (; b < bytesRead; b++) { if (buffer[b] != *ptr) { errors.Add(wxString::Format(errorMessageFormat, files[i].c_str(), wxT("Memory Save Test failure"))); document.DeleteContents(); // This line will force the while statement to fail bytesRead = bytesLeft; break; } ptr++; } bytesLeft -= bytesRead; } } else errors.Add(wxString::Format(errorMessageFormat, files[i].c_str(), wxT("Memory Save Test failure"))); document.DeleteContents(); } else errors.Add(wxString::Format(errorMessageFormat, files[i].c_str(), wxT("Could not open file"))); // Update progress if (!progressDialog.Update(i + 1)) { cancelled = true; break; } } // User didn't cancel if (!cancelled) { wxString message = wxString::Format(wxT("Testing complete\n\nFiles tested: %d\nErrors: %d"), fileCount, errors.GetCount()); int style = wxICON_INFORMATION; // Add text to allow user to save error messages if (errors.GetCount() > 0) { message += wxT("\n\nThere were errors that occurred during the testing process. Would you like to save them to file?"); style |= wxYES_NO; } // Display results of test to user; If user clicks Yes, save errors to file if (wxMessageBox(message, wxT("Batch File Serialization Test"), style) == wxYES) { wxFileDialog fileDialog(this, wxT("Save Results"), wxT(""), wxT("results.txt"), wxT("Text files (*.txt)|*.txt"), wxSAVE | wxHIDE_READONLY | wxOVERWRITE_PROMPT); if (fileDialog.ShowModal() == wxID_OK) { wxString pathName = fileDialog.GetPath(); // Create a new file wxTextFile file; file.Create(pathName); // Write the errors size_t e = 0; size_t count = errors.GetCount(); for (; e < count; e++) file.AddLine(errors[e]); file.Write(); file.Close(); } } } } }
/// Command Events ///< This code demonstrates how to parse a loaded Power Tab document ///< You could also load a document directly using Load void PowerTabView::OnTestParseFile(wxCommandEvent& event) { // Menu Test -> Parse File //------Last Checked------// // - Jan 25, 2005 WXUNUSED(event); // Get the active document PowerTabDocument* document = (PowerTabDocument*)GetDocument(); wxCHECK2(document != NULL, return); wxLongLong startTime = ::wxGetLocalTimeMillis(); // Get the header PowerTabFileHeader& header = document->GetHeaderRef(); // File version that the file was saved as; the document automatically // converts to the latest version during deserialization wxWord version = header.GetVersion(); // In Power Tab Editor v1.7, most of the header data is accessable via the Song Property Sheet: // Menu View -> File Information // Menu View -> Performance Notes // Menu View -> Lyrics // File is a song if (header.IsSong()) { wxByte contentType = header.GetSongContentType(); wxString title = header.GetSongTitle(); wxString artist = header.GetSongArtist(); wxByte releaseType = header.GetSongReleaseType(); // Audio release if (releaseType == PowerTabFileHeader::RELEASETYPE_PUBLIC_AUDIO) { wxByte releaseType = header.GetSongAudioReleaseType(); wxString releaseTitle = header.GetSongAudioReleaseTitle(); wxWord year = header.GetSongAudioReleaseYear(); bool live = header.IsSongAudioReleaseLive(); } // Video release else if (releaseType == PowerTabFileHeader::RELEASETYPE_PUBLIC_VIDEO) { wxString releaseTitle = header.GetSongVideoReleaseTitle(); bool live = header.IsSongVideoReleaseLive(); } // Bootleg else if (releaseType == PowerTabFileHeader::RELEASETYPE_BOOTLEG) { wxString releaseTitle = header.GetSongBootlegTitle(); wxDateTime bootlegDate = header.GetSongBootlegDate(); } // Not released else if (releaseType == PowerTabFileHeader::RELEASETYPE_NOTRELEASED) { // no extra data for this data } // If author is known, get the composer and lyricist; otherwise, song is traditional if (header.GetSongAuthorType() == PowerTabFileHeader::AUTHORTYPE_AUTHORKNOWN) { wxString composer = header.GetSongComposer(); wxString lyricist = header.GetSongLyricist(); } wxString arranger = header.GetSongArranger(); wxString guitarScoreTranscriber = header.GetSongGuitarScoreTranscriber(); wxString bassScoreTranscriber = header.GetSongBassScoreTranscriber(); wxString copyright = header.GetSongCopyright(); wxString lyrics = header.GetSongLyrics(); wxString guitarScoreNotes = header.GetSongGuitarScoreNotes(); wxString bassScoreNotes = header.GetSongBassScoreNotes(); } // File is a lesson else if (header.IsLesson()) { wxString title = header.GetLessonTitle(); wxString subtitle = header.GetLessonSubtitle(); wxWord musicStyle = header.GetLessonMusicStyle(); wxByte level = header.GetLessonLevel(); wxString author = header.GetLessonAuthor(); wxString notes = header.GetLessonNotes(); wxString copyright = header.GetLessonCopyright(); } wxUint8 scoreIndex = 0; // There are two scores in each document: // 1) Guitar score // 2) Bass score for (; scoreIndex < 2; scoreIndex++) { // Get the score Score* score = NULL; if (scoreIndex == 0) score = document->GetGuitarScore(); else score = document->GetBassScore(); wxCHECK2(score != NULL, continue); // Parse the guitars in the score // In Power Tab Editor v1.7, the guitar data can be accessed via the Guitar Property Sheet: // Menu Guitar -> Setup wxUint32 guitarIndex = 0; wxUint32 guitarCount = score->GetGuitarCount(); for (; guitarIndex < guitarCount; guitarIndex++) { Guitar* guitar = score->GetGuitar(guitarIndex); wxCHECK2(guitar != NULL, continue); wxByte number = guitar->GetNumber(); wxString description = guitar->GetDescription(); wxByte preset = guitar->GetPreset(); wxByte initialVolume = guitar->GetInitialVolume(); wxByte pan = guitar->GetPan(); wxByte reverb = guitar->GetReverb(); wxByte chorus = guitar->GetChorus(); wxByte tremolo = guitar->GetTremolo(); wxByte phaser = guitar->GetPhaser(); wxByte capo = guitar->GetCapo(); const Tuning& tuning = guitar->GetTuning(); wxString name = tuning.GetName(); wxInt8 musicNotationOffset = tuning.GetMusicNotationOffset(); bool usesSharps = tuning.UsesSharps(); // Get the MIDI note pitch for each string, starting with the highest string // Highest string = High E on standard guitar tuning size_t string = 0; size_t stringCount = tuning.GetStringCount(); for (; string < stringCount; string++) { // MIDI note pitch (see MIDI_NOTE_xx constants in generalmidi.h) wxByte note = tuning.GetNote(string); } } // Parse the chord diagrams in the score // In Power Tab Editor v1.7, chord diagrams can be accessed via the Guitar Property Sheet: // Menu Guitar -> Chord Diagram List // The chord diagrams appear in the Chord Diagram List in the order they are stored in the chord diagram // array in the score wxUint32 chordDiagramIndex = 0; wxUint32 chordDiagramCount = score->GetChordDiagramCount(); for (; chordDiagramIndex < chordDiagramCount; chordDiagramIndex++) { ChordDiagram* chordDiagram = score->GetChordDiagram(chordDiagramIndex); wxCHECK2(chordDiagram != NULL, continue); // In Power Tab Editor v1.7, chord name data can be accessed via the Chord Name dialog: // Menu Text -> Chord Name const ChordName& chordName = chordDiagram->GetChordNameConstRef(); wxByte tonicKey = 0; wxByte tonicKeyVariation = 0; chordName.GetTonic(tonicKey, tonicKeyVariation); wxByte bassNoteKey = 0; wxByte bassNoteKeyVariation = 0; chordName.GetBassNote(bassNoteKey, bassNoteKeyVariation); wxByte formula = chordName.GetFormula(); bool brackets = chordName.HasBrackets(); bool noChord = chordName.IsNoChord(); wxWord formulaModificationFlag = ChordName::extended9th; for (; formulaModificationFlag <= ChordName::suspended4th; formulaModificationFlag *= 2) { if (chordName.IsFormulaModificationFlagSet(formulaModificationFlag)) { } // Block overflow if (formulaModificationFlag == ChordName::suspended4th) break; } if (chordName.IsFretPositionUsed()) { wxByte fretPosition = chordName.GetFretPosition(); } if (chordName.IsTypeUsed()) { wxByte type = chordName.GetType(); } wxByte topFret = chordDiagram->GetTopFret(); size_t string = 0; size_t stringCount = chordDiagram->GetStringCount(); for (; string < stringCount; string++) { wxByte fretNumber = chordDiagram->GetFretNumber(string); } } // Parse the floating text items in the score // In Power Tab Editor v1.7, floating text items are created using: // Menu Text -> Insert // Floating text items are stored in the array by order of their rect.top and // rect.left values // i.e. An item at left = 40, top = 100 is stored prior to left = 10, top = 120 wxUint32 floatingTextIndex = 0; wxUint32 floatingTextCount = score->GetFloatingTextCount(); for (; floatingTextIndex < floatingTextCount; floatingTextIndex++) { FloatingText* floatingText = score->GetFloatingText(floatingTextIndex); wxCHECK2(floatingText != NULL, continue); wxString text = floatingText->GetText(); wxRect rect = floatingText->GetRect(); wxByte alignment = floatingText->GetAlignment(); bool border = floatingText->HasBorder(); // Font setting for the text const FontSetting& fontSetting = floatingText->GetFontSettingConstRef(); wxString faceName = fontSetting.GetFaceName(); wxInt32 pointSize = fontSetting.GetPointSize(); wxInt32 weight = fontSetting.GetWeight(); bool italic = fontSetting.IsItalic(); bool underline = fontSetting.IsUnderline(); bool strikeOut = fontSetting.IsStrikeOut(); wxColor color = fontSetting.GetColor(); } // Parse the guitar ins in the score // In Power Tab Editor v1.7, guitar ins can be accessed via the Guitar In dialog: // Menu Guitar -> Guitar In // Guitar Ins are stored in the array by order of their system, position and // staff values wxUint32 guitarInIndex = 0; wxUint32 guitarInCount = score->GetGuitarInCount(); for (; guitarInIndex < guitarInCount; guitarInIndex++) { GuitarIn* guitarIn = score->GetGuitarIn(guitarInIndex); wxCHECK2(guitarIn != NULL, continue); wxWord system = guitarIn->GetSystem(); wxByte staff = guitarIn->GetStaff(); wxByte position = guitarIn->GetPosition(); if (guitarIn->HasStaffGuitarsSet()) { wxByte staffGuitars = guitarIn->GetStaffGuitars(); } if (guitarIn->HasRhythmSlashGuitarsSet()) { wxByte rhythmSlashGuitars = guitarIn->GetRhythmSlashGuitars(); } } // Parse the tempo markers in the score // In Power Tab Editor v1.7, tempo markers can be accessed via the Tempo Marker dialog: // Menu Music Symbols -> Tempo Marker // and the Alteration of Pace dialog: // Menu Music Symbols -> Alteration of Pace // Tempo Markers are stored in the array by order of their system, position and // staff values wxUint32 tempoMarkerIndex = 0; wxUint32 tempoMarkerCount = score->GetTempoMarkerCount(); for (; tempoMarkerIndex < tempoMarkerCount; tempoMarkerIndex++) { TempoMarker* tempoMarker = score->GetTempoMarker(tempoMarkerIndex); wxCHECK2(tempoMarker != NULL, continue); if (tempoMarker->IsStandardMarker()) { wxByte beatType = tempoMarker->GetBeatType(); wxUint32 beatsPerMinute = tempoMarker->GetBeatsPerMinute(); } else if (tempoMarker->IsListesso()) { wxByte beatType = tempoMarker->GetBeatType(); wxByte listessoBeatType = tempoMarker->GetBeatType(); } else if (tempoMarker->IsAlterationOfPace()) { if (tempoMarker->IsAccelerando()) { } else if (tempoMarker->IsRitardando()) { } } if (tempoMarker->HasTripletFeel()) { wxByte tripletFeelType = tempoMarker->GetTripletFeelType(); } wxString description = tempoMarker->GetDescription(); } // Parse the dynamics in the score // In Power Tab Editor v1.7, dynamics can be accessed via the Dynamic dialog: // Menu Music Symbols -> Dynamic // Dynamics are stored in the array by order of their system, position and // staff values wxUint32 dynamicIndex = 0; wxUint32 dynamicCount = score->GetDynamicCount(); for (; dynamicIndex < dynamicCount; dynamicIndex++) { Dynamic* dynamic = score->GetDynamic(dynamicIndex); wxCHECK2(dynamic != NULL, continue); wxWord system = dynamic->GetSystem(); wxByte staff = dynamic->GetStaff(); wxByte position = dynamic->GetPosition(); // Staff volume is set if (dynamic->IsStaffVolumeSet()) { wxByte staffVolume = dynamic->GetStaffVolume(); } // Rhythm slash volume is set if (dynamic->IsRhythmSlashVolumeSet()) { wxByte rhythmSlashVolume = dynamic->GetRhythmSlashVolume(); } } // Parse the alternate endings in the score // In Power Tab Editor v1.7, alternate endings can be accessed via the Repeat Ending dialog: // Menu Music Symbols -> Repeat Ending // Alternate endings are stored in the array by order of their system and // position values wxUint32 alternateEndingIndex = 0; wxUint32 alternateEndingCount = score->GetAlternateEndingCount(); for (; alternateEndingIndex < alternateEndingCount; alternateEndingIndex++) { AlternateEnding* alternateEnding = score->GetAlternateEnding(alternateEndingIndex); wxCHECK2(alternateEnding != NULL, continue); wxWord system = alternateEnding->GetSystem(); wxByte position = alternateEnding->GetPosition(); // Determine which numbers are set wxWord number = 1; for (; number <= AlternateEnding::dalSegnoSegno; number++) { if (alternateEnding->IsNumberSet(number)) { // Number is set } } } // Parse the systems in the score // In Power Tab Editor v1.7, systems can be accessed via the Section menu: // Menu Section -> New Section // Systems are stored in the array by order they are drawn in the score wxUint32 systemIndex = 0; wxUint32 systemCount = score->GetSystemCount(); for (; systemIndex < systemCount; systemIndex++) { System* system = score->GetSystem(systemIndex); wxCHECK2(system != NULL, continue); wxRect rect = system->GetRect(); wxByte positionSpacing = system->GetPositionSpacing(); // Parse the directions in the system // In Power Tab Editor v1.7, directions can be accessed via the Musical Direction dialog: // Menu Music Symbols -> Musical Direction wxUint32 directionIndex = 0; wxUint32 directionCount = system->GetDirectionCount(); for (; directionIndex < directionCount; directionIndex++) { Direction* direction = system->GetDirection(directionIndex); wxCHECK2(direction != NULL, continue); wxUint32 position = direction->GetPosition(); // There may be up to 3 symbols per object size_t symbolIndex = 0; size_t symbolCount = direction->GetSymbolCount(); for (; symbolIndex < symbolCount; symbolIndex++) { wxByte symbolType = 0; wxByte activeSymbol = 0; wxByte repeatNumber = 0; direction->GetSymbol(symbolIndex, symbolType, activeSymbol, repeatNumber); } } // Parse the chord text items in the system // In Power Tab Editor v1.7, chord text/chord name data can be accessed via the Chord Name dialog: // Menu Text -> Chord Name wxUint32 chordTextIndex = 0; wxUint32 chordTextCount = system->GetChordTextCount(); for (; chordTextIndex < chordTextCount; chordTextIndex++) { ChordText* chordText = system->GetChordText(chordTextIndex); wxCHECK2(chordText != NULL, continue); wxUint32 positon = chordText->GetPosition(); const ChordName& chordName = chordText->GetChordNameConstRef(); wxByte tonicKey = 0; wxByte tonicKeyVariation = 0; chordName.GetTonic(tonicKey, tonicKeyVariation); wxByte bassNoteKey = 0; wxByte bassNoteKeyVariation = 0; chordName.GetBassNote(bassNoteKey, bassNoteKeyVariation); wxByte formula = chordName.GetFormula(); bool brackets = chordName.HasBrackets(); bool noChord = chordName.IsNoChord(); wxWord formulaModificationFlag = ChordName::extended9th; for (; formulaModificationFlag <= ChordName::suspended4th; formulaModificationFlag *= 2) { if (chordName.IsFormulaModificationFlagSet(formulaModificationFlag)) { } // Block overflow if (formulaModificationFlag == ChordName::suspended4th) break; } if (chordName.IsFretPositionUsed()) { wxByte fretPosition = chordName.GetFretPosition(); } if (chordName.IsTypeUsed()) { wxByte type = chordName.GetType(); } } // Parse the rhythm slashes in the system // In Power Tab Editor v1.7, rhythm slash data can be accessed via the Rhy. Slashes menu wxUint32 rhythmSlashIndex = 0; wxUint32 rhythmSlashCount = system->GetRhythmSlashCount(); for (; rhythmSlashIndex < rhythmSlashCount; rhythmSlashIndex++) { RhythmSlash* rhythmSlash = system->GetRhythmSlash(rhythmSlashIndex); wxCHECK2(rhythmSlash != NULL, continue); wxUint32 position = rhythmSlash->GetPosition(); wxByte durationType = rhythmSlash->GetDurationType(); wxByte previousDurationType = rhythmSlash->GetPreviousBeamDurationType(); bool beamStart = rhythmSlash->IsBeamStart(); bool fractionalBeam = rhythmSlash->HasFractionalBeam(); bool beamEnd = rhythmSlash->IsBeamEnd(); bool tripletStart = rhythmSlash->IsTripletStart(); bool tripletMiddle = rhythmSlash->IsTripletMiddle(); bool tripletEnd = rhythmSlash->IsTripletEnd(); bool dotted = rhythmSlash->IsDotted(); bool doubleDotted = rhythmSlash->IsDoubleDotted(); bool rest = rhythmSlash->IsRest(); bool tied = rhythmSlash->IsTied(); bool muted = rhythmSlash->IsMuted(); bool staccato = rhythmSlash->IsStaccato(); bool pickstrokeUp = rhythmSlash->HasPickStrokeUp(); bool pickstrokeDown = rhythmSlash->HasPickStrokeDown(); bool arpeggioUp = rhythmSlash->HasArpeggioUp(); bool arpeggioDown = rhythmSlash->HasArpeggioDown(); bool tripletFeel1st = rhythmSlash->IsTripletFeel1st(); bool tripletFeel2nd = rhythmSlash->IsTripletFeel2nd(); bool marcato = rhythmSlash->HasMarcato(); bool sforzando = rhythmSlash->HasSforzando(); bool slideIntoFromAbove = rhythmSlash->HasSlideIntoFromAbove(); bool slideIntoFromBelow = rhythmSlash->HasSlideIntoFromBelow(); bool slideOutOfDownwards = rhythmSlash->HasSlideOutOfDownwards(); bool slideOutOfUpwards = rhythmSlash->HasSlideOutOfUpwards(); // TODO: If has single note { wxByte stringNumber = 0; wxByte fretNumber = 0; rhythmSlash->GetSingleNoteData(stringNumber, fretNumber); } } // Parse the barline at the start of the system { const Barline& startBar = system->GetStartBarConstRef(); wxByte type = startBar.GetType(); if (startBar.IsRepeatEnd()) { wxUint32 repeatCount = startBar.GetRepeatCount(); } const KeySignature& keySignature = startBar.GetKeySignatureConstRef(); wxByte keyType = 0; wxByte keyAccidentals = 0; keySignature.GetKey(keyType, keyAccidentals); if (keySignature.IsShown()) { } if (keySignature.IsCancellation()) { } const TimeSignature& timeSignature = startBar.GetTimeSignatureConstRef(); wxByte beatsPerMeasure = 0; wxByte beatAmount = 0; timeSignature.GetMeter(beatsPerMeasure, beatAmount); if (timeSignature.IsCutTime()) { } if (timeSignature.IsCommonTime()) { } wxByte beat1 = 0; wxByte beat2 = 0; wxByte beat3 = 0; wxByte beat4 = 0; timeSignature.GetBeamingPattern(beat1, beat2, beat3, beat4); if (timeSignature.IsShown()) { } wxByte pulses = timeSignature.GetPulses(); const RehearsalSign& rehearsalSign = startBar.GetRehearsalSignConstRef(); if (rehearsalSign.IsSet()) { wxInt8 letter = rehearsalSign.GetLetter(); wxString description = rehearsalSign.GetDescription(); } } // Parse the barlines within the system wxUint32 barlineIndex = 0; wxUint32 barlineCount = system->GetBarlineCount(); for (; barlineIndex < barlineCount; barlineIndex++) { Barline* barline = system->GetBarline(barlineIndex); wxCHECK2(barline != NULL, continue); wxUint32 position = barline->GetPosition(); const KeySignature& keySignature = barline->GetKeySignatureConstRef(); wxByte keyType = 0; wxByte keyAccidentals = 0; keySignature.GetKey(keyType, keyAccidentals); if (keySignature.IsShown()) { } if (keySignature.IsCancellation()) { } const TimeSignature& timeSignature = barline->GetTimeSignatureConstRef(); wxByte beatsPerMeasure = 0; wxByte beatAmount = 0; timeSignature.GetMeter(beatsPerMeasure, beatAmount); if (timeSignature.IsCutTime()) { } if (timeSignature.IsCommonTime()) { } wxByte beat1 = 0; wxByte beat2 = 0; wxByte beat3 = 0; wxByte beat4 = 0; timeSignature.GetBeamingPattern(beat1, beat2, beat3, beat4); if (timeSignature.IsShown()) { } wxByte pulses = timeSignature.GetPulses(); const RehearsalSign& rehearsalSign = barline->GetRehearsalSignConstRef(); if (rehearsalSign.IsSet()) { wxInt8 letter = rehearsalSign.GetLetter(); wxString description = rehearsalSign.GetDescription(); } } // Parse the barline at the end of the system { const Barline& endBar = system->GetEndBarConstRef(); wxByte type = endBar.GetType(); if (endBar.IsRepeatEnd()) { wxUint32 repeatCount = endBar.GetRepeatCount(); } const KeySignature& keySignature = endBar.GetKeySignatureConstRef(); wxByte keyType = 0; wxByte keyAccidentals = 0; keySignature.GetKey(keyType, keyAccidentals); if (keySignature.IsShown()) { } if (keySignature.IsCancellation()) { } const TimeSignature& timeSignature = endBar.GetTimeSignatureConstRef(); wxByte beatsPerMeasure = 0; wxByte beatAmount = 0; timeSignature.GetMeter(beatsPerMeasure, beatAmount); if (timeSignature.IsCutTime()) { } if (timeSignature.IsCommonTime()) { } wxByte beat1 = 0; wxByte beat2 = 0; wxByte beat3 = 0; wxByte beat4 = 0; timeSignature.GetBeamingPattern(beat1, beat2, beat3, beat4); if (timeSignature.IsShown()) { } wxByte pulses = timeSignature.GetPulses(); const RehearsalSign& rehearsalSign = endBar.GetRehearsalSignConstRef(); if (rehearsalSign.IsSet()) { wxInt8 letter = rehearsalSign.GetLetter(); wxString description = rehearsalSign.GetDescription(); } } // Parse the staves in the system // In Power Tab Editor v1.7, staves can be accessed via the Section menu: // Menu Section -> Attach Staff // and by clicking the clef on the standard notation standard staff and // by clicking the "TAB" clef on the tablature staff wxUint32 staffIndex = 0; wxUint32 staffCount = system->GetStaffCount(); for (; staffIndex < staffCount; staffIndex++) { Staff* staff = system->GetStaff(staffIndex); wxCHECK2(staff != NULL, continue); wxByte clef = staff->GetClef(); wxByte tablatureStaffType = staff->GetTablatureStaffType(); // Parse the positions in each voice wxUint32 voice = 0; for (; voice < NUM_STAFF_VOICES; voice++) { wxUint32 positionIndex = 0; wxUint32 positionCount = staff->GetPositionCount(voice); for (; positionIndex < positionCount; positionIndex++) { Position* position = staff->GetPosition(voice, positionIndex); wxCHECK2(position != NULL, continue); wxUint32 positionIndex = 0; wxUint32 positionCount = staff->GetPositionCount(voice); for (; positionIndex < positionCount; positionIndex++) { Position* position = staff->GetPosition(voice, positionIndex); wxCHECK2(position != NULL, continue); wxUint32 position2 = position->GetPosition(); wxByte durationType = position->GetDurationType(); if (position->HasIrregularGroupingTiming()) { wxByte notesPlayed = 0; wxByte notesPlayedOver = 0; position->GetIrregularGroupingTiming(notesPlayed, notesPlayedOver); } wxByte previousBeamDurationType = position->GetPreviousBeamDurationType(); bool beamStart = position->IsBeamStart(); bool fractionalLeftBeam = position->HasFractionalLeftBeam(); bool fractionalRightBeam = position->HasFractionalRightBeam(); bool beamEnd = position->IsBeamEnd(); bool dotted = position->IsDotted(); bool doubleDotted = position->IsDoubleDotted(); bool rest = position->IsRest(); bool vibrato = position->HasVibrato(); bool wideVibrato = position->HasWideVibrato(); bool arpeggioUp = position->HasArpeggioUp(); bool arpeggioDown = position->HasArpeggioDown(); bool pickstrokeUp = position->HasPickStrokeUp(); bool pickstrokeDown = position->HasPickStrokeDown(); bool staccato = position->IsStaccato(); bool marcato = position->HasMarcato(); bool sforzando = position->HasSforzando(); bool tremoloPicking = position->HasTremoloPicking(); bool palmMuting = position->HasPalmMuting(); bool tap = position->HasTap(); bool acciaccatura = position->IsAcciaccatura(); bool tripletFeel1st = position->IsTripletFeel1st(); bool tripletFeel2nd = position->IsTripletFeel2nd(); bool letRing = position->HasLetRing(); bool fermata = position->HasFermata(); bool irregularGroupingStart = position->IsIrregularGroupingStart(); bool irregularGroupingMiddle = position->IsIrregularGroupingMiddle(); bool irregularGroupingEnd = position->IsIrregularGroupingEnd(); if (position->HasVolumeSwell()) { wxByte startVolume = 0; wxByte endVolume = 0; wxByte duration = 0; position->GetVolumeSwell(startVolume, endVolume, duration); } if (position->HasTremoloBar()) { wxByte type = 0; wxByte duration = 0; wxByte pitch = 0; position->GetTremoloBar(type, duration, pitch); } // Parse the notes // In Power Tab Editor v1.7, note data can be accessed via the Notes menu, as well as // the Tab Symbols menu wxUint32 noteIndex = 0; wxUint32 noteCount = position->GetNoteCount(); for (; noteIndex < noteCount; noteIndex++) { Note* note = position->GetNote(noteIndex); wxCHECK2(note != NULL, continue); wxUint32 string = note->GetString(); wxUint32 fretNumber = note->GetFretNumber(); bool tied = note->IsTied(); bool muted = note->IsMuted(); bool tieWrap = note->HasTieWrap(); bool hammerOn = note->HasHammerOn(); bool hammerOnFromNowhere = note->HasHammerOnFromNowhere(); bool pullOff = note->HasPullOff(); bool pullOffToNowhere = note->HasPullOffToNowhere(); bool naturalHarmonic = note->IsNaturalHarmonic(); bool ghostNote = note->IsGhostNote(); bool octave8va = note->IsOctave8va(); bool octave15ma = note->IsOctave15ma(); bool octave8vb = note->IsOctave8vb(); bool octave15mb = note->IsOctave15mb(); if (note->HasSlideInto()) { wxByte type = 0; note->GetSlideInto(type); } if (note->HasSlideOutOf()) { wxByte type = 0; wxInt8 steps = 0; note->GetSlideOutOf(type, steps); } if (note->HasBend()) { wxByte type = 0; wxByte bentPitch = 0; wxByte releasePitch = 0; wxByte duration = 0; wxByte drawStartPoint = 0; wxByte drawEndPoint = 0; note->GetBend(type, bentPitch, releasePitch, duration, drawStartPoint, drawEndPoint); } if (note->HasTappedHarmonic()) { wxByte tappedFretNumber = 0; note->GetTappedHarmonic(tappedFretNumber); } if (note->HasTrill()) { wxByte trilledFretNumber = 0; note->GetTrill(trilledFretNumber); } if (note->HasArtificialHarmonic()) { wxByte key = 0; wxByte keyVariation = 0; wxByte octave = 0; note->GetArtificialHarmonic(key, keyVariation, octave); } } } } } } } } // In Power Tab Editor v1.7, font settings can be accessed via the Song Property Sheet: // Menu View -> Fonts { const FontSetting& chordNameFontSetting = document->GetChordNameFontSettingConstRef(); wxString faceName = chordNameFontSetting.GetFaceName(); wxInt32 pointSize = chordNameFontSetting.GetPointSize(); wxInt32 weight = chordNameFontSetting.GetWeight(); bool italic = chordNameFontSetting.IsItalic(); bool underline = chordNameFontSetting.IsUnderline(); bool strikeOut = chordNameFontSetting.IsStrikeOut(); wxColor color = chordNameFontSetting.GetColor(); } { const FontSetting& tablatureNumbersFontSetting = document->GetTablatureNumbersFontSettingConstRef(); wxString faceName = tablatureNumbersFontSetting.GetFaceName(); wxInt32 pointSize = tablatureNumbersFontSetting.GetPointSize(); wxInt32 weight = tablatureNumbersFontSetting.GetWeight(); bool italic = tablatureNumbersFontSetting.IsItalic(); bool underline = tablatureNumbersFontSetting.IsUnderline(); bool strikeOut = tablatureNumbersFontSetting.IsStrikeOut(); wxColor color = tablatureNumbersFontSetting.GetColor(); } // In Power Tab Editor v1.7, tablature line spacing values can be accessed via the Line Height submenu // on the Section menu wxUint32 tablatureStaffLineSpacing = document->GetTablatureStaffLineSpacing(); // In Power Tab Editor v1.7, fade values can be accessed via the Fade dialog: // Menu Music Symbols -> Fade wxUint32 fadeIn = document->GetFadeIn(); wxUint32 fadeOut = document->GetFadeOut(); wxLongLong totalTime = ::wxGetLocalTimeMillis() - startTime; double milliseconds = ((double)totalTime.ToLong()) / 1000.0; wxMessageBox(wxString::Format(wxT("File parsed in %.3f seconds."), milliseconds), wxTheApp->GetAppName(), wxICON_INFORMATION); }