kcApp.cpp: Changed console from splitter window to tab window.

This commit is contained in:
kevin 2013-01-30 18:19:39 -08:00
parent 95978d21f7
commit 13b910ac6f
2 changed files with 12 additions and 15 deletions

View File

@ -64,7 +64,7 @@
kcApp::kcApp(cmCtx_t* ctx, cmPrH_t prH, cmTsMp1cH_t printqH, int w, int h, const cmChar_t* title, cmAiH_t aiH, int argc, char* argv[] ) kcApp::kcApp(cmCtx_t* ctx, cmPrH_t prH, cmTsMp1cH_t printqH, int w, int h, const cmChar_t* title, cmAiH_t aiH, int argc, char* argv[] )
: Fl_Double_Window(w, h,title), : Fl_Double_Window(w, h,title),
_ctx(ctx),_prH(prH),_aiH(aiH), _ctx(ctx),_prH(prH),_aiH(aiH),
_menu(NULL),_splt(NULL),_con(NULL),_tabs(NULL),_mstr_grp(NULL), _menu(NULL),_con(NULL),_tabs(NULL),_mstr_grp(NULL),
_as_btn(NULL),_ai_btn(NULL),_ao_btn(NULL),_pgm_btn(NULL), _as_btn(NULL),_ai_btn(NULL),_ao_btn(NULL),_pgm_btn(NULL),
_ss_btn(NULL),_sr_btn(NULL),_ena_chk(NULL), _ss_btn(NULL),_sr_btn(NULL),_ena_chk(NULL),
_pageList(NULL),_ctlList(NULL), _pageList(NULL),_ctlList(NULL),
@ -82,22 +82,16 @@ kcApp::kcApp(cmCtx_t* ctx, cmPrH_t prH, cmTsMp1cH_t printqH, int w, int h, const
// and a horizontal splitter on the bottom // and a horizontal splitter on the bottom
begin(); begin();
_createMenu(w,kMenuH); _createMenu(w,kMenuH);
_splt = new Fl_HSplitter(0, kMenuH, w, h-kStatusH-kMenuH, h-kStatusH-kMenuH-100);
end(); end();
// Create a text display object for console output andvadd it to the lower splitter area // Create a text display object for console output andvadd it to the lower splitter area
Fl_Text_Buffer* buf = new Fl_Text_Buffer();
_con = new Fl_Text_Display(_splt->container2->x(),_splt->container2->y(),_splt->container2->w(),_splt->container2->h());
_con->buffer(buf);
_splt->container2->add(_con);
// Create a tab view and added it to the upper splitter area // Create a tab view and added it to the upper splitter area
_tabs = new Fl_Tabs(_splt->container1->x(),_splt->container1->y(),_splt->container1->w(),_splt->container1->h()); add(_tabs = new Fl_Tabs(this->x(),this->y()+kMenuH,this->w(),this->h()-kMenuH));
_tabs->callback(_s_tab_cb,this); _tabs->callback(_s_tab_cb,this);
_tabs->end(); _tabs->end();
_splt->container1->add(_tabs);
int tx,ty,th,tw; int tx=x(),ty=y(),th=this->w(),tw=this->h();
_tabs->client_area(tx,ty,tw,th); _tabs->client_area(tx,ty,tw,th);
// Create the 'Setup' tab group // Create the 'Setup' tab group
@ -105,23 +99,28 @@ kcApp::kcApp(cmCtx_t* ctx, cmPrH_t prH, cmTsMp1cH_t printqH, int w, int h, const
_tabs->add(setup_grp); _tabs->add(setup_grp);
_createSetupDlg(setup_grp); _createSetupDlg(setup_grp);
// Create the console window
Fl_Group* con_grp = new Fl_Group(tx,ty,tw,th,"Console");
_tabs->add(con_grp);
Fl_Text_Buffer* buf = new Fl_Text_Buffer();
_con = new Fl_Text_Display(tx,ty,tw,th);
_con->buffer(buf);
con_grp->add(_con);
// Create the master group // Create the master group
_tabs->add(_mstr_grp = new Fl_Group(tx,ty,tw,th,"Master")); _tabs->add(_mstr_grp = new Fl_Group(tx,ty,tw,th,"Master"));
// Create an empty tab group and make it resizable // Create an empty tab group and make it resizable
// to prevent the other tab groups from being resizable. // to prevent the other tab groups from being resizable.
Fl_Group* wdgt = new Fl_Group(tx,ty+30,1,1); Fl_Group* wdgt = new Fl_Group(tx,ty+30,1,1);
_tabs->add(wdgt); _tabs->add(wdgt);
_tabs->resizable(wdgt); // make other tabs non-resizable _tabs->resizable(wdgt); // make other tabs non-resizable
// make the splitter the resizable group element (thereby making the menu non-resizable). // make the splitter the resizable group element (thereby making the menu non-resizable).
// see:http://fltk.org/articles.php?L415+I0+T+M1000+P1 // see:http://fltk.org/articles.php?L415+I0+T+M1000+P1
resizable(_splt); resizable(_tabs);
show(argc, argv); show(argc, argv);
// direct all output to the console window // direct all output to the console window
cmRptSetup(&_ctx->rpt,_s_print,_s_print, this); cmRptSetup(&_ctx->rpt,_s_print,_s_print, this);
cmTsMp1cSetCbFunc(_printqH, _s_print_queue_cb, this ); cmTsMp1cSetCbFunc(_printqH, _s_print_queue_cb, this );
@ -141,7 +140,6 @@ kcApp::~kcApp()
void kcApp::resize(int x, int y, int w, int h) void kcApp::resize(int x, int y, int w, int h)
{ {
Fl_Double_Window::resize(x, y, w, h); Fl_Double_Window::resize(x, y, w, h);
_splt->resize(0, kMenuH, w, h-kStatusH);
cmPrefsPathSetInt(_prH,"appWndW",w); cmPrefsPathSetInt(_prH,"appWndW",w);
cmPrefsPathSetInt(_prH,"appWndH",h); cmPrefsPathSetInt(_prH,"appWndH",h);
} }

View File

@ -290,7 +290,6 @@ private:
cmAiH_t _aiH; cmAiH_t _aiH;
Fl_Menu_Bar* _menu; Fl_Menu_Bar* _menu;
Fl_HSplitter* _splt;
Fl_Text_Display* _con; Fl_Text_Display* _con;
Fl_Tabs* _tabs; Fl_Tabs* _tabs;
Fl_Group* _mstr_grp; Fl_Group* _mstr_grp;