|
@@ -214,14 +214,17 @@ void kcApp::_createMenu(int w, int h)
|
214
|
214
|
{
|
215
|
215
|
Fl_Menu_Item items[] =
|
216
|
216
|
{
|
217
|
|
- { "&File", 0, 0, 0, FL_SUBMENU },
|
218
|
|
- { "&New File", 0, (Fl_Callback*)_s_menu_cb },
|
|
217
|
+ { "kc", 0, 0, 0, FL_SUBMENU },
|
|
218
|
+ { "&About", FL_COMMAND + 'a', (Fl_Callback*)_s_menu_cb, (void*)kAboutMenuId },
|
|
219
|
+ { "&Quit", FL_COMMAND + 'q', (Fl_Callback*)_s_menu_cb, (void*)kQuitMenuId },
|
219
|
220
|
{ 0 },
|
220
|
221
|
{ 0 }
|
221
|
222
|
};
|
222
|
|
-
|
|
223
|
+
|
223
|
224
|
_menu = new Fl_Menu_Bar(0,0,w,h);
|
224
|
225
|
_menu->copy(items);
|
|
226
|
+ this->add(_menu);
|
|
227
|
+
|
225
|
228
|
}
|
226
|
229
|
|
227
|
230
|
kcApp::page_t* kcApp::_createPage( const char* title )
|
|
@@ -1388,7 +1391,7 @@ void kcApp::_setSampleRateBtn( unsigned value )
|
1388
|
1391
|
unsigned n = _sr_btn->size();
|
1389
|
1392
|
for(i=0; i<n-1; ++i)
|
1390
|
1393
|
{
|
1391
|
|
- if( _sr_btn->menu()[i].argument() == value )
|
|
1394
|
+ if( _sr_btn->menu()[i].argument() == (int)value )
|
1392
|
1395
|
{
|
1393
|
1396
|
_sr_btn->value(i);
|
1394
|
1397
|
_sr_btn->copy_label( _sr_btn->mvalue()->label() );
|
|
@@ -1825,6 +1828,29 @@ kcApp* kcApp::_getApp( Fl_Widget* w )
|
1825
|
1828
|
return (kcApp*)gp->user_data();
|
1826
|
1829
|
}
|
1827
|
1830
|
|
|
1831
|
+void kcApp::_onCloseApp()
|
|
1832
|
+{
|
|
1833
|
+ if( _tlCtl != NULL )
|
|
1834
|
+ {
|
|
1835
|
+ delete _tlCtl;
|
|
1836
|
+ _tlCtl = NULL;
|
|
1837
|
+ }
|
|
1838
|
+
|
|
1839
|
+ _stopTimerFl = true;
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+ // When all windows are windows are closed then the app.
|
|
1843
|
+ // will close - so hiding the application window
|
|
1844
|
+ // causes the program to close.
|
|
1845
|
+ //
|
|
1846
|
+ // Note that simply returning from this callback will
|
|
1847
|
+ // prevent the application from closing. Because the existence
|
|
1848
|
+ // of the callback alone is enough to disable default
|
|
1849
|
+ // event handling.
|
|
1850
|
+ hide();
|
|
1851
|
+
|
|
1852
|
+}
|
|
1853
|
+
|
1828
|
1854
|
|
1829
|
1855
|
void kcApp::_testStub()
|
1830
|
1856
|
{
|
|
@@ -1863,20 +1889,7 @@ void kcApp::_callback(void* data)
|
1863
|
1889
|
{
|
1864
|
1890
|
if( Fl::event() == FL_CLOSE )
|
1865
|
1891
|
{
|
1866
|
|
- delete _tlCtl;
|
1867
|
|
-
|
1868
|
|
- _stopTimerFl = true;
|
1869
|
|
-
|
1870
|
|
-
|
1871
|
|
- // When all windows are windows are closed then the app.
|
1872
|
|
- // will close - so hiding the application window
|
1873
|
|
- // causes the program to close.
|
1874
|
|
- //
|
1875
|
|
- // Note that simply returning from this callback will
|
1876
|
|
- // prevent the application from closing. Because the existence
|
1877
|
|
- // of the callback alone is enough to disable default
|
1878
|
|
- // event handling.
|
1879
|
|
- hide();
|
|
1892
|
+ _onCloseApp();
|
1880
|
1893
|
}
|
1881
|
1894
|
|
1882
|
1895
|
}
|
|
@@ -1921,7 +1934,31 @@ bool kcApp::_status_timeout_cb()
|
1921
|
1934
|
}
|
1922
|
1935
|
|
1923
|
1936
|
void kcApp::_s_menu_cb(Fl_Widget *w, void *data)
|
1924
|
|
-{ }
|
|
1937
|
+{
|
|
1938
|
+ const Fl_Menu_Item* mip;
|
|
1939
|
+ kcApp* p;
|
|
1940
|
+
|
|
1941
|
+ if((p=_getApp(w)) == NULL )
|
|
1942
|
+ return;
|
|
1943
|
+
|
|
1944
|
+ if((mip = p->_menu->mvalue()) == NULL )
|
|
1945
|
+ return;
|
|
1946
|
+
|
|
1947
|
+ unsigned id = (long int)mip->user_data();
|
|
1948
|
+
|
|
1949
|
+ switch(id)
|
|
1950
|
+ {
|
|
1951
|
+ case kAboutMenuId:
|
|
1952
|
+ fl_message("%s Compiled:%s %s",PACKAGE_STRING,__DATE__,__TIME__);
|
|
1953
|
+ break;
|
|
1954
|
+
|
|
1955
|
+ case kQuitMenuId:
|
|
1956
|
+ p->_onCloseApp();
|
|
1957
|
+ break;
|
|
1958
|
+ }
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+}
|
1925
|
1962
|
|
1926
|
1963
|
void kcApp::_s_tab_cb(Fl_Widget* w, void* data)
|
1927
|
1964
|
{ ((kcApp*)data)->_tab_cb(w); }
|