186
188
k_menu_debug_draw_anchors,
187
189
k_menu_debug_DumpBitmaps,
188
190
k_menu_debug_dump_gmodel,
189
k_menu_debug_SeeSource,
190
k_menu_debug_SeeSourceUndo,
191
k_menu_see_ldp_source,
192
k_menu_see_ldp_sourceUndo,
193
k_menu_see_lmd_source,
191
194
k_menu_debug_SeeXML,
192
195
k_menu_debug_see_midi_events,
193
196
k_menu_debug_see_paths,
337
340
EVT_UPDATE_UI (k_menu_play_stop, MainFrame::on_update_UI_sound)
338
341
EVT_MENU (k_menu_play_pause, MainFrame::on_play_pause)
339
342
EVT_UPDATE_UI (k_menu_play_pause, MainFrame::on_update_UI_sound)
340
// EVT_MENU (MENU_Metronome, MainFrame::OnMetronomeOnOff)
341
EVT_UPDATE_UI (MENU_Metronome, MainFrame::on_update_UI_sound)
343
EVT_MENU (k_menu_metronome, MainFrame::on_metronome_on_off)
344
EVT_UPDATE_UI (k_menu_metronome, MainFrame::on_update_UI_sound)
343
346
EVT_MENU (k_menu_preferences, MainFrame::on_options)
345
// EVT_MENU (k_menu_open_book, MainFrame::OnOpenBook)
346
EVT_UPDATE_UI (k_menu_open_book, MainFrame::disable_tool) //OnOpenBookUI)
348
EVT_MENU (k_menu_open_books, MainFrame::on_open_books)
349
// EVT_UPDATE_UI (k_menu_open_books, MainFrame::disable_tool) //on_open_booksUI)
349
352
EVT_MENU (k_menu_windowCloseAll, MainFrame::on_window_close_all)
382
385
//debug events requiring a score to be enabled
383
386
EVT_MENU (k_menu_debug_dump_column_tables, MainFrame::on_debug_dump_column_tables)
384
387
EVT_UPDATE_UI (k_menu_debug_dump_column_tables, MainFrame::on_update_UI_score)
385
EVT_MENU (k_menu_debug_SeeSource, MainFrame::on_debug_see_source)
386
EVT_UPDATE_UI (k_menu_debug_SeeSource, MainFrame::on_update_UI_document)
387
// EVT_MENU (k_menu_debug_SeeSourceUndo, MainFrame::on_debug_see_sourceForUndo)
388
EVT_UPDATE_UI (k_menu_debug_SeeSourceUndo, MainFrame::disable_tool) //on_update_UI_document)
388
EVT_MENU (k_menu_see_ldp_source, MainFrame::on_debug_see_ldp_source)
389
EVT_UPDATE_UI (k_menu_see_ldp_source, MainFrame::on_update_UI_document)
390
EVT_MENU (k_menu_see_lmd_source, MainFrame::on_debug_see_lmd_source)
391
EVT_UPDATE_UI (k_menu_see_lmd_source, MainFrame::on_update_UI_document)
392
// EVT_MENU (k_menu_see_ldp_sourceUndo, MainFrame::on_debug_see_sourceForUndo)
393
EVT_UPDATE_UI (k_menu_see_ldp_sourceUndo, MainFrame::disable_tool) //on_update_UI_document)
389
394
// EVT_MENU (k_menu_debug_SeeXML, MainFrame::OnDebugSeeXML)
390
395
EVT_UPDATE_UI (k_menu_debug_SeeXML, MainFrame::disable_tool) //on_update_UI_document)
391
396
EVT_MENU (k_menu_debug_see_midi_events, MainFrame::on_debug_see_midi_events)
404
409
EVT_UPDATE_UI (k_menu_debug_dump_gmodel, MainFrame::on_update_UI_document)
408
// EVT_SPINCTRL (k_id_spin_metronome, MainFrame::OnMetronomeUpdate)
409
// EVT_TEXT (k_id_spin_metronome, MainFrame::OnMetronomeUpdateText)
410
// EVT_TIMER (k_id_timer_metronome, MainFrame::OnMetronomeTimer)
413
EVT_SPINCTRL (k_id_spin_metronome, MainFrame::on_metronome_update)
414
EVT_TEXT (k_id_spin_metronome, MainFrame::on_metronome_update_text)
415
EVT_TIMER (k_id_timer_metronome, MainFrame::on_metronome_timer)
413
418
EVT_CLOSE (MainFrame::on_close_frame)
467
473
// entries[0].Set(wxACCEL_CTRL, WXK_F1, wxID_ABOUT);
468
474
// wxAcceleratorTable accel(1, entries);
469
475
// SetAcceleratorTable(accel);
471
// // create main metronome and associate it to frame metronome controls
472
// //metronome speed. Default MM=60
473
// long nMM = pPrefs->Read(_T("/Metronome/MM"), 60);
474
// m_pMainMtr = LENMUS_NEW lmMetronome(nMM);
475
// m_pMtr = m_pMainMtr;
477
479
// // initialize flags for toggle buttons status
478
480
// m_fHelpOpened = false;
503
510
//---------------------------------------------------------------------------------------
511
void MainFrame::create_metronome()
513
// create main metronome and associate it to frame metronome controls
514
//metronome speed. Default MM=60
517
wxConfigBase* pPrefs = m_appScope.get_preferences();
519
nMM = pPrefs->Read(_T("/Metronome/MM"), 60L);
520
m_pMainMtr = LENMUS_NEW GlobalMetronome(m_appScope, nMM);
523
//inform Lomse, to use global metronome in ScorePlayerCtrl
524
LomseDoorway& lomse = m_appScope.get_lomse();
525
lomse.set_global_metronome_and_replace_local(m_pMainMtr);
527
//store in ApplicationScope, to be used in dynamic exercises (EBookCtrol objects)
528
m_appScope.set_metronome(m_pMainMtr);
531
//---------------------------------------------------------------------------------------
504
532
void MainFrame::save_preferences()
506
534
//AWARE: MainFrame destructor is invoked from TheApp destructor, after
535
563
pPrefs->Write(_T("/MainFrame/Top"), wndPos.y );
536
564
pPrefs->Write(_T("/MainFrame/Maximized"), fMaximized);
538
// //save metronome settings and delete main metronome
540
// pPrefs->Write(_T("/Metronome/MM"), m_pMainMtr->GetMM() );
541
// delete m_pMainMtr;
566
//save metronome settings and delete main metronome
568
pPrefs->Write(_T("/Metronome/MM"), m_pMainMtr->get_mm() );
544
572
//save file history
545
573
m_fileHistory.Save(*pPrefs);
568
595
wxMenu* pMenuFile = LENMUS_NEW wxMenu;
570
597
create_menu_item(pMenuFile, k_menu_file_new, _("&New\tCtrl+N"),
571
_("Open LENMUS_NEW blank document"), wxITEM_NORMAL, _T("tool_new"));
598
_("Open new blank document"), wxITEM_NORMAL, _T("tool_new"));
572
599
create_menu_item(pMenuFile, k_menu_file_open, _("&Open ...\tCtrl+O"),
573
600
_("Open a document"), wxITEM_NORMAL, _T("tool_open"));
574
601
create_menu_item(pMenuFile, k_menu_file_reload, _T("&Reload"),
575
602
_("Reload document"), wxITEM_NORMAL, _T("")); //_T("tool_reload"));
577
//create_menu_item(pMenuFile, k_menu_open_book, _("Open &books"),
578
// _("Hide/show eMusicBooks"), wxITEM_NORMAL, _T("tool_open_ebook"));
604
create_menu_item(pMenuFile, k_menu_open_books, _("Open &books"),
605
_("Open music books"), wxITEM_NORMAL, _T("tool_open_ebook"));
579
606
//create_menu_item(pMenuFile, k_menu_file_Import, _("&Import..."),
580
607
// _("Open a MusicXML score"), wxITEM_NORMAL);
588
615
//create_menu_item(pSubmenuExport, k_menu_file_export_jpg, _("As &jpg image"),
589
616
// _("Save score as JPG images"), wxITEM_NORMAL, _T("tool_save_as_jpg"));
591
//pItem = LENMUS_NEW wxMenuItem(pMenuFile, k_menu_file_export, _("&Export ..."),
618
//////wxMenuItem* pItem = LENMUS_NEW wxMenuItem(pMenuFile, k_menu_file_export, _("&Export ..."),
592
619
// _("Save score in other formats"), wxITEM_NORMAL, pSubmenuExport);
593
620
//pItem->SetBitmap( wxArtProvider::GetBitmap(_T("empty"), wxART_TOOLBAR, nIconSize) );
594
621
//pMenuFile->Append(pItem);
622
649
// // eBooks menu -------------------------------------------------------------------
623
650
// m_booksMenu = LENMUS_NEW wxMenu;
624
// create_menu_item(m_booksMenu, k_menu_open_book, _("Open &books"),
651
// create_menu_item(m_booksMenu, k_menu_open_books, _("Open &books"),
625
652
// _("Hide/show eMusicBooks"), wxITEM_NORMAL, _T("tool_open_ebook"));
626
653
// create_menu_item(m_booksMenu, lmMENU_eBookPanel, _("View index"),
627
654
// _("Show/hide navigation panel"), wxITEM_CHECK, _T("tool_index_panel"));
664
691
// _("Hide/show rulers"), wxITEM_CHECK);
665
692
create_menu_item(pMenuView, k_menu_view_welcome_page, _("&Welcome page"),
666
693
_("Hide/show welcome page"));
668
695
//create_menu_item(pMenuView, k_menu_view_counters, _("&Counters panel"),
669
696
// _("Hide/show counters panel"));
699
728
create_menu_item(m_dbgMenu, k_menu_debug_see_paths, _T("See paths") );
700
729
m_dbgMenu->AppendSeparator();
702
create_menu_item(m_dbgMenu, k_menu_debug_justify_systems, _("Justify systems"),
731
create_menu_item(m_dbgMenu, k_menu_debug_justify_systems, _T("Justify systems"),
703
732
_T(""), wxITEM_CHECK);
704
733
create_menu_item(m_dbgMenu, k_menu_debug_DumpBitmaps, _T("Save offscreen bitmaps") );
705
734
create_menu_item(m_dbgMenu, k_menu_debug_CheckHarmony, _T("Check harmony") );
706
735
create_menu_item(m_dbgMenu, k_menu_debug_TestProcessor, _T("Run test processor") );
707
create_menu_item(m_dbgMenu, k_menu_debug_print_preview, _("Print Pre&view"),
736
create_menu_item(m_dbgMenu, k_menu_debug_print_preview, _T("Print Pre&view"),
708
737
_T(""), wxITEM_NORMAL);
709
738
create_menu_item(m_dbgMenu, k_menu_debug_ForceReleaseBehaviour, _T("&Release Behaviour"),
710
739
_T("Force release behaviour for certain functions"), wxITEM_CHECK);
728
757
create_menu_item(pSubmenuDrawBox, k_menu_debug_draw_box_slice, _T("Draw slice box"));
729
758
create_menu_item(pSubmenuDrawBox, k_menu_debug_draw_box_slice_instr, _T("Draw slice intrs box"));
730
759
create_menu_item(pSubmenuDrawBox, k_menu_debug_remove_boxes, _T("Remove drawn boxes"));
731
create_menu_item(pSubmenuDrawBox, k_menu_debug_draw_box_inline, _("Draw inline boxes"));
760
create_menu_item(pSubmenuDrawBox, k_menu_debug_draw_box_inline, _T("Draw inline boxes"));
733
pItem = LENMUS_NEW wxMenuItem(m_dbgMenu, k_menu_debug_draw_box, _T("Draw box ..."),
762
wxMenuItem* pItem = LENMUS_NEW wxMenuItem(m_dbgMenu, k_menu_debug_draw_box, _T("Draw box ..."),
734
763
_T("Force to draw box rectangles"), wxITEM_NORMAL, pSubmenuDrawBox);
735
764
m_dbgMenu->Append(pItem);
745
774
create_menu_item(m_dbgMenu, k_menu_debug_see_staffobjs, _T("See staffobjs table") );
746
775
create_menu_item(m_dbgMenu, k_menu_debug_see_midi_events, _T("See &MIDI events") );
747
776
create_menu_item(m_dbgMenu, k_menu_debug_dump_gmodel, _T("See graphical model") );
748
create_menu_item(m_dbgMenu, k_menu_debug_dump_column_tables, _("See column tables"));
777
create_menu_item(m_dbgMenu, k_menu_debug_dump_column_tables, _T("See column tables"));
750
779
m_dbgMenu->AppendSeparator(); //exporters
751
create_menu_item(m_dbgMenu, k_menu_debug_SeeSource, _T("See &LDP source") );
752
create_menu_item(m_dbgMenu, k_menu_debug_SeeSourceUndo, _T("See LDP source for &Undo/Redo") );
780
create_menu_item(m_dbgMenu, k_menu_see_ldp_source, _T("See &LDP source") );
781
create_menu_item(m_dbgMenu, k_menu_see_ldp_sourceUndo, _T("See LDP source for &Undo/Redo") );
782
create_menu_item(m_dbgMenu, k_menu_see_lmd_source, _T("See L&MD source") );
753
783
create_menu_item(m_dbgMenu, k_menu_debug_SeeXML, _T("See &XML") );
792
822
_("Do count off before starting the play back"), wxITEM_CHECK);
793
823
pMenuSound->AppendSeparator();
795
create_menu_item(pMenuSound, MENU_Metronome, _("Metronome on"),
825
create_menu_item(pMenuSound, k_menu_metronome, _("Metronome on"),
796
826
_("Turn metronome on/off"), wxITEM_CHECK);
797
827
pMenuSound->AppendSeparator();
1015
1045
//---------------------------------------------------------------------------------------
1016
1046
void MainFrame::open_file()
1018
// LenMus files are either simple files, usually scores (.lms - LenMus Score) or
1019
// eMusicBooks (.lmb - LenMus Book) files
1020
// All eMusicBooks are located in 'locale/xx/books' folder
1022
1048
Paths* pPaths = m_appScope.get_paths();
1023
wxString defaultPath = pPaths->GetBooksPath();
1049
wxString defaultPath = pPaths->GetScoresPath();
1024
1050
wxString sFile = wxFileSelector(_("Open LenMus document"), defaultPath,
1025
wxEmptyString, wxEmptyString, wxT("LenMus files|*.lms;*.lmb"));
1051
wxEmptyString, wxEmptyString, wxT("LenMus files|*.lms;*.lmb;*.lmd"));
1027
1053
if (!sFile.empty())
1035
1061
//---------------------------------------------------------------------------------------
1062
void MainFrame::on_open_book(wxCommandEvent& event)
1064
wxString sFullpath = event.GetString();
1065
string filename( to_std_string(sFullpath) );
1066
load_file(filename);
1067
m_fileHistory.AddFileToHistory(sFullpath);
1070
//---------------------------------------------------------------------------------------
1036
1071
void MainFrame::on_file_reload(wxCommandEvent& WXUNUSED(event))
1038
1073
load_file(m_lastOpenFile);
1379
////---------------------------------------------------------------------------------------
1380
//void MainFrame::OnMetronomeOnOff(wxCommandEvent& WXUNUSED(event))
1382
// if (m_pMtr->IsRunning()) {
1384
// //TODO switch off metronome LED
1411
//---------------------------------------------------------------------------------------
1412
void MainFrame::on_metronome_on_off(wxCommandEvent& WXUNUSED(event))
1414
if (m_pMtr->is_running())
1417
//TODO switch off metronome LED
1392
1425
//---------------------------------------------------------------------------------------
1393
1426
void MainFrame::update_toolbars_layout()
1446
1479
// wxITEM_NORMAL, _("New score"));
1447
1480
m_pTbFile->AddTool(k_menu_file_open, _T("Open"), wxArtProvider::GetBitmap(_T("tool_open"),
1448
1481
wxART_TOOLBAR, nSize), _("Open a score"));
1450
//m_pTbFile->AddTool(k_menu_open_book, _T("Books"),
1451
// wxArtProvider::GetBitmap(_T("tool_open_ebook"), wxART_TOOLBAR, nSize),
1452
// wxArtProvider::GetBitmap(_T("tool_open_ebook_dis"), wxART_TOOLBAR, nSize),
1453
// wxITEM_NORMAL, _("Open the music books"));
1482
m_pTbFile->AddTool(k_menu_open_books, _T("Books"),
1483
wxArtProvider::GetBitmap(_T("tool_open_ebook"), wxART_TOOLBAR, nSize),
1484
wxArtProvider::GetBitmap(_T("tool_open_ebook_dis"), wxART_TOOLBAR, nSize),
1485
wxITEM_NORMAL, _("Open the music books"));
1454
1486
m_pTbFile->AddTool(wxID_SAVE, _T("Save"),
1455
1487
wxArtProvider::GetBitmap(_T("tool_save"), wxART_TOOLBAR, nSize),
1456
1488
wxArtProvider::GetBitmap(_T("tool_save_dis"), wxART_TOOLBAR, nSize),
1559
1591
//Metronome toolbar
1560
1592
m_pTbMtr = LENMUS_NEW wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, style);
1561
1593
m_pTbMtr->SetToolBitmapSize(nSize);
1562
m_pTbMtr->AddTool(MENU_Metronome, _T("Metronome"),
1594
m_pTbMtr->AddTool(k_menu_metronome, _T("Metronome"),
1563
1595
wxArtProvider::GetBitmap(_T("tool_metronome"),
1564
1596
wxART_TOOLBAR, nSize), _("Turn metronome on/off"),
1566
1598
m_pSpinMetronome = LENMUS_NEW wxSpinCtrl(m_pTbMtr, k_id_spin_metronome, _T(""), wxDefaultPosition,
1567
1599
wxSize(60, -1), wxSP_ARROW_KEYS | wxSP_WRAP, 20, 300);
1568
// m_pSpinMetronome->SetValue( m_pMtr->GetMM() );
1600
m_pSpinMetronome->SetValue( m_pMtr->get_mm() );
1569
1601
m_pTbMtr->AddControl(m_pSpinMetronome);
1570
1602
m_pTbMtr->Realize();
1888
1920
// oFilename.GetFullPath().c_str() ));
1892
//void MainFrame::InitializeBooks()
1894
// // create the books window
1895
// m_pBookController = LENMUS_NEW TextBookController();
1897
// // set the config object
1898
// m_pBookController->UseConfig(wxConfig::Get(), _T("TextBooksController"));
1900
// //set directory for cache files.
1901
// m_pBookController->SetTempDir( g_pPaths->GetTempPath() );
1902
// m_pBookController->SetTitleFormat(_("Available books"));
1904
// // eMusicBooks are a single .lmb (LenMus Book) file
1905
// // All eMusicBooks are located in 'book' folder
1906
// wxString sPath = g_pPaths->GetBooksPath();
1907
// wxString sPattern = _T("*.lmb");
1908
// ScanForBooks(sPath, sPattern);
1912
1924
//---------------------------------------------------------------------------------------
1913
1925
void MainFrame::show_welcome_window()
1929
1941
////---------------------------------------------------------------------------------------
1930
//void MainFrame::ScanForBooks(wxString sPath, wxString sPattern)
1932
// //Scan the received folder for books and load all books found
1934
// //wxLogMessage(_T("[MainFrame::ScanForBooks] Scanning path <%s>"), sPath);
1935
// wxDir dir(sPath);
1936
// if ( !dir.IsOpened() ) {
1937
// // TODO: deal with the error here - wxDir would already log an error message
1938
// // explaining the exact reason of the failure
1939
// wxMessageBox(wxString::Format(_("Error when trying to move to folder %s"),
1940
// sPath.c_str() ));
1944
// // Add first the 'intro' page
1945
// wxFileName oFileIntro(sPath, _T("intro"), _T("lmb"), wxPATH_NATIVE);
1946
// if (!m_pBookController->AddBook(oFileIntro)) {
1947
// //TODO better error handling
1948
// wxMessageBox(wxString::Format(_("Failed adding book %s"),
1949
// oFileIntro.GetFullPath().c_str() ));
1953
// // Then the 'release_notes' page
1954
// wxFileName oFileRN(sPath, _T("release_notes"), _T("lmb"), wxPATH_NATIVE);
1955
// if (!m_pBookController->AddBook(oFileRN)) {
1956
// //TODO better error handling
1957
// wxMessageBox(wxString::Format(_("Failed adding book %s"),
1958
// oFileRN.GetFullPath().c_str() ));
1962
// // Now, the 'General Exercises' eBook
1963
// wxFileName oFileExercises(sPath, _T("GeneralExercises"), _T("lmb"), wxPATH_NATIVE);
1964
// if (!m_pBookController->AddBook(oFileExercises)) {
1965
// //TODO better error handling
1966
// wxMessageBox(wxString::Format(_("Failed adding book %s"),
1967
// oFileExercises.GetFullPath().c_str() ));
1970
// // Add now any other eBook found on this folder
1972
// //wxLogMessage(wxString::Format(
1973
// // _T("Enumerating .hhp files in directory: %s"), sPath));
1974
// wxString sFilename;
1975
// bool fFound = dir.GetFirst(&sFilename, sPattern, wxDIR_FILES);
1977
// //wxLogMessage(_T("[MainFrame::ScanForBooks] Encontrado %s"), sFilename);
1978
// wxFileName oFilename(sPath, sFilename, wxPATH_NATIVE);
1979
// if (oFilename.GetName() != _T("help")
1980
// && oFilename.GetName() != _T("intro")
1981
// && oFilename.GetName() != _T("release_notes")
1982
// && oFilename.GetName() != _T("GeneralExercises")) {
1983
// if (!m_pBookController->AddBook(oFilename)) {
1984
// //TODO better error handling
1985
// wxMessageBox(wxString::Format(_("Failed adding book %s"),
1986
// oFilename.GetFullPath().c_str() ));
1989
// fFound = dir.GetNext(&sFilename);
1994
////---------------------------------------------------------------------------------------
1995
1942
//lmController* MainFrame::GetActiveController()
1997
1944
// //returns the controller associated to the active view
2148
2095
// m_fHelpOpened = fPressed;
2151
////---------------------------------------------------------------------------------------
2152
//void MainFrame::OnOpenBook(wxCommandEvent& event)
2154
// OpenBook(_T("intro_thm0.htm"));
2155
// // if (!m_pBookController)
2157
// // // create book controller and load books
2158
// // InitializeBooks();
2159
// // wxASSERT(m_pBookController);
2161
// // // display book "intro"
2162
// // m_pBookController->Display(_T("intro_thm0.htm")); //By page name
2163
// // m_pBookController->GetFrame()->NotifyPageChanged(); // needed in Linux. I don't know why !
2164
// //OnActiveChildChanged(m_pBookController->GetFrame());
2168
// // m_pBookController->GetFrame()->SetFocus();
2172
////---------------------------------------------------------------------------------------
2173
//void MainFrame::OpenBook(const wxString& sPageName)
2175
// if (!m_pBookController)
2177
// // create book controller and load books
2178
// InitializeBooks();
2179
// wxASSERT(m_pBookController);
2181
// // display requested book
2182
// m_pBookController->Display(sPageName); //By page name
2183
// m_pBookController->GetFrame()->NotifyPageChanged(); // needed in Linux. I don't know why !
2184
// OnActiveChildChanged(m_pBookController->GetFrame());
2188
// m_pBookController->GetFrame()->SetFocus();
2098
//---------------------------------------------------------------------------------------
2099
void MainFrame::on_open_books(wxCommandEvent& event)
2101
BooksDlg dlg(this, m_appScope);
2102
if (dlg.ShowModal() == wxID_OK)
2104
wxString filename = dlg.get_full_path();
2105
wxCommandEvent myEvent(LM_EVT_OPEN_BOOK, k_id_open_book);
2106
myEvent.SetEventObject(this);
2107
myEvent.SetString(filename);
2108
::wxPostEvent(this, myEvent);
2192
2112
//---------------------------------------------------------------------------------------
2193
2113
void MainFrame::on_window_close_all(wxCommandEvent& WXUNUSED(event))
2369
2289
//---------------------------------------------------------------------------------------
2370
void MainFrame::on_debug_see_source(wxCommandEvent& WXUNUSED(event))
2290
void MainFrame::on_debug_see_ldp_source(wxCommandEvent& WXUNUSED(event))
2372
2292
DocumentWindow* pCanvas = get_active_document_window();
2374
2294
pCanvas->debug_display_ldp_source();
2376
// ImoScore* pScore = get_active_score();
2377
// wxASSERT(pScore);
2379
// DlgDebug dlg(this, _T("Generated source code"), pScore->SourceLDP(false)); //false: do not include undo/redo data
2297
//---------------------------------------------------------------------------------------
2298
void MainFrame::on_debug_see_lmd_source(wxCommandEvent& WXUNUSED(event))
2300
DocumentWindow* pCanvas = get_active_document_window();
2302
pCanvas->debug_display_lmd_source();
2383
2305
//void MainFrame::on_debug_see_sourceForUndo(wxCommandEvent& event)
3109
3030
ScorePlayer* pPlayer = m_appScope.get_score_player();
3110
pPlayer->load_score(pScore, NULL);
3031
pPlayer->load_score(pScore, this);
3112
bool fVisualTracking = true;
3113
bool fCountOff = GetMenuBar()->IsChecked(k_menu_play_countoff);
3114
int playMode = k_play_normal_instrument;
3115
long nMM = 60; //60000/pMtr->GetInterval();
3116
3033
DocumentCanvas* pCanvas = dynamic_cast<DocumentCanvas*>( get_active_canvas() );
3117
3034
Interactor* pInteractor = NULL;
3119
3036
pInteractor = pCanvas->get_interactor();
3121
pPlayer->play(fVisualTracking, fCountOff, playMode, nMM, pInteractor);
3038
pPlayer->play(k_do_visual_tracking, 0, pInteractor);
3180
3097
// lmController* pController = GetActiveScoreView()->GetController();
3181
3098
// get_active_score()->OnInstrProperties(-1, pController); //-1 = select instrument
3184
//void MainFrame::OnMetronomeTimer(wxTimerEvent& event)
3186
// //A metronome click has been produced, and this event is generated so that we
3187
// //can flash the metronome LED or do any other desired visual efect.
3188
// //Do not generate sounds as they are done by the lmMetronome object
3190
// //TODO flash metronome LED
3191
// // Me.picMtrLEDOff.Visible = false;
3192
// // Me.picMtrLEDRojoOn.Visible = true;
3193
//// ::wxMilliSleep(100);
3194
// // Me.picMtrLEDOff.Visible = true;
3195
// // Me.picMtrLEDRojoOn.Visible = false;
3199
//void MainFrame::OnMetronomeUpdate(wxSpinEvent& WXUNUSED(event))
3201
// int nMM = m_pSpinMetronome->GetValue();
3202
// if (m_pMtr) m_pMtr->SetMM(nMM);
3205
//void MainFrame::OnMetronomeUpdateText(wxCommandEvent& WXUNUSED(event))
3207
// int nMM = m_pSpinMetronome->GetValue();
3208
// if (m_pMtr) m_pMtr->SetMM(nMM);
3101
void MainFrame::on_metronome_timer(wxTimerEvent& event)
3103
//A metronome click has been produced, and this event is generated so that we
3104
//can flash the metronome LED or do any other desired visual efect.
3105
//Do not generate sounds as they are done by the Metronome object
3107
//TODO flash metronome LED
3108
// Me.picMtrLEDOff.Visible = false;
3109
// Me.picMtrLEDRojoOn.Visible = true;
3110
// ::wxMilliSleep(100);
3111
// Me.picMtrLEDOff.Visible = true;
3112
// Me.picMtrLEDRojoOn.Visible = false;
3116
//---------------------------------------------------------------------------------------
3117
void MainFrame::on_metronome_update(wxSpinEvent& WXUNUSED(event))
3119
int nMM = m_pSpinMetronome->GetValue();
3120
if (m_pMtr) m_pMtr->set_mm(nMM);
3123
//---------------------------------------------------------------------------------------
3124
void MainFrame::on_metronome_update_text(wxCommandEvent& WXUNUSED(event))
3126
int nMM = m_pSpinMetronome->GetValue();
3127
if (m_pMtr) m_pMtr->set_mm(nMM);
3211
3130
//void MainFrame::DumpScore(ImoScore* pScore)
3213
3132
// if (!pScore) return;
3218
//------------------------------------------------------------------------------------
3219
// mandatory overrides in PlayerGui
3220
//------------------------------------------------------------------------------------
3221
void MainFrame::on_end_of_playback()
3223
m_pMainMtr->mute(false);
3226
//------------------------------------------------------------------------------------
3227
bool MainFrame::countoff_status()
3229
return GetMenuBar()->IsChecked(k_menu_play_countoff);
3232
//------------------------------------------------------------------------------------
3233
bool MainFrame::metronome_status()
3235
return m_pMainMtr->is_running();
3238
//------------------------------------------------------------------------------------
3239
int MainFrame::get_play_mode()
3241
return k_play_normal_instrument;
3244
//------------------------------------------------------------------------------------
3245
int MainFrame::get_metronome_mm()
3247
return m_pMainMtr->get_mm();
3250
//------------------------------------------------------------------------------------
3251
Metronome* MainFrame::get_metronome()
3299
3257
////------------------------------------------------------------------------------------
3300
3258
//// Tips at application start
3301
3259
////------------------------------------------------------------------------------------