From d212ce24d25e8a301666661c2080c9a573baeb8d Mon Sep 17 00:00:00 2001 From: kpl Date: Mon, 12 Aug 2013 00:01:37 -0700 Subject: [PATCH] kcApp.h/cpp: Added 'print pgm' option. --- src/kc/kcApp.cpp | 32 +++++++++++++++++++++++++++++++- src/kc/kcApp.h | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/kc/kcApp.cpp b/src/kc/kcApp.cpp index fb494ae..8748370 100644 --- a/src/kc/kcApp.cpp +++ b/src/kc/kcApp.cpp @@ -198,6 +198,11 @@ void kcApp::_createSetupDlg( Fl_Group* grp ) btn->callback( _s_btn_cb, kTestBtnId ); yy += btn->h() + vBord; + btn = new Fl_Button(xx,yy,200,kMenuH,"Print program"); + btn->callback( _s_btn_cb, kPrintPgmBtnId ); + yy += btn->h() + vBord; + + _ena_chk = new Fl_Check_Button(xx,yy,ctl_width,kMenuH,"Enable Audio"); _ena_chk->callback( _s_btn_cb, kEnableBtnId ); yy += _ena_chk->h() + vBord; @@ -1147,7 +1152,7 @@ void kcApp::_setTmlnValue( ctl_t* cp, unsigned instVarId, const cmDspValue_t* vp if((path = cmDsvStrcz(vp)) != NULL ) { cp->u.tmln.tlctl->setAudioFilePath(path); - //cp->u.tmln.tlctl->redraw(); + } } break; @@ -1881,6 +1886,27 @@ void kcApp::_testStub() _tlCtl->testStub(); } +void kcApp::_printPgm() +{ + const char* pathStr = cmFsUserDir(); // make the default dir the user's home dir + const char patStr[] = ""; //"Text Files (*.txt)\tAudio Files (*.{wav,aif,aiff})"; // All Files (*.*) is append to this automatically + const char titleStr[] = "JSON output file name"; + + Fl_File_Chooser fc = Fl_File_Chooser(pathStr,patStr,Fl_File_Chooser::CREATE,titleStr); + + fc.preview(0); // default the previous option to 'off'. + fc.show(); // show the chooser + + // make the chooser modal + while( fc.shown() ) + Fl::wait(); + + if( fc.count() > 0) + cmAdIfPrintPgm(_aiH, cmInvalidIdx, fc.value(0) ); + +} + + void kcApp::_s_callback(Fl_Widget* wp, void* data) { ((kcApp*)data)->_callback(NULL); } @@ -2022,6 +2048,10 @@ void kcApp::_btn_cb(Fl_Widget* w, long data) _testStub(); break; + case kPrintPgmBtnId: + _printPgm(); + break; + default: { assert(0); } } diff --git a/src/kc/kcApp.h b/src/kc/kcApp.h index 6445677..ff58955 100644 --- a/src/kc/kcApp.h +++ b/src/kc/kcApp.h @@ -148,6 +148,7 @@ private: kSubSystemIdxBtnId, kSrateBtnId, kTestBtnId, + kPrintPgmBtnId, kAboutMenuId, kQuitMenuId @@ -389,6 +390,7 @@ private: void _onCloseApp(); void _testStub(); + void _printPgm(); // main app callback static void _s_callback(Fl_Widget* wp, void* data);