@@ -120,7 +120,7 @@ bool MainWindow::basicMain(EditorWidget *editWidget,
120120 if (!toolExec) {
121121 if (opt_ide == IDE_NONE) {
122122 // run in a separate window with the ide hidden
123- fullScreen = new BaseWindow (w (), h (), _system );
123+ fullScreen = new BaseWindow (w (), h (), _runtime );
124124 fullScreen->box (FL_NO_BOX);
125125 fullScreen->callback (quit_cb);
126126 fullScreen->add (_out);
@@ -143,7 +143,7 @@ bool MainWindow::basicMain(EditorWidget *editWidget,
143143 restart = false ;
144144 runMode = run_state;
145145 chdir (path);
146- success = _system ->run (filename);
146+ success = _runtime ->run (filename);
147147 }
148148 while (restart);
149149
@@ -454,7 +454,7 @@ void MainWindow::font_size_incr(Fl_Widget *w, void *eventData) {
454454 if (size < MAX_FONT_SIZE) {
455455 editWidget->setFontSize (size + 1 );
456456 updateConfig (editWidget);
457- _system ->setFontSize (size + 1 );
457+ _runtime ->setFontSize (size + 1 );
458458 }
459459 } else {
460460 handle (EVENT_INCREASE_FONT);
@@ -468,7 +468,7 @@ void MainWindow::font_size_decr(Fl_Widget *w, void *eventData) {
468468 if (size > MIN_FONT_SIZE) {
469469 editWidget->setFontSize (size - 1 );
470470 updateConfig (editWidget);
471- _system ->setFontSize (size - 1 );
471+ _runtime ->setFontSize (size - 1 );
472472 }
473473 } else {
474474 handle (EVENT_DECREASE_FONT);
@@ -907,20 +907,12 @@ bool initialise(int argc, char **argv) {
907907 return true ;
908908}
909909
910- /* *
911- * save application state at program exit
912- */
913- void save_profile (void ) {
914- wnd->_profile ->save (wnd);
915- }
916-
917910/* *
918911 * application entry point
919912 */
920913int main (int argc, char **argv) {
921914 int result;
922915 if (initialise (argc, argv)) {
923- atexit (save_profile);
924916 Fl::run ();
925917 result = 0 ;
926918 } else {
@@ -1012,7 +1004,7 @@ MainWindow::MainWindow(int w, int h) :
10121004 _outputGroup->labelfont (FL_HELVETICA);
10131005 _outputGroup->user_data ((void *)gw_output);
10141006 _out = new GraphicsWidget (x1, y1 + 1 , x2, y2 -1 );
1015- _system = new Runtime (x2, y2 - 1 , DEF_FONT_SIZE);
1007+ _runtime = new Runtime (x2, y2 - 1 , DEF_FONT_SIZE);
10161008 _outputGroup->resizable (_out);
10171009 _outputGroup->end ();
10181010 _tabGroup->resizable (_outputGroup);
@@ -1023,7 +1015,9 @@ MainWindow::MainWindow(int w, int h) :
10231015}
10241016
10251017MainWindow::~MainWindow () {
1026- delete _system;
1018+ _profile->save (this );
1019+ delete _profile;
1020+ delete _runtime;
10271021}
10281022
10291023Fl_Group *MainWindow::createTab (GroupWidgetEnum groupWidgetEnum, const char *label) {
@@ -1341,7 +1335,7 @@ void MainWindow::setTitle(Fl_Window *widget, const char *filename) {
13411335}
13421336
13431337void MainWindow::setBreak () {
1344- _system ->setExit (false );
1338+ _runtime ->setExit (false );
13451339 runMode = break_state;
13461340}
13471341
@@ -1363,15 +1357,15 @@ bool MainWindow::isIdeHidden() {
13631357
13641358void MainWindow::resize (int x, int y, int w, int h) {
13651359 BaseWindow::resize (x, y, w, h);
1366- _system ->resize (_out->w (), _out->h ());
1360+ _runtime ->resize (_out->w (), _out->h ());
13671361}
13681362
13691363void MainWindow::resizeDisplay (int x, int y, int w, int h) {
13701364 // resize the graphics widget (output tab child)
13711365 _out->resize (x, y, w, h);
13721366
13731367 // resize the runtime platforn
1374- _system ->resize (w, h);
1368+ _runtime ->resize (w, h);
13751369}
13761370
13771371/* *
@@ -1398,7 +1392,7 @@ bool MainWindow::logPrint() {
13981392
13991393int MainWindow::handle (int e) {
14001394 int result;
1401- if (getSelectedTab () == _outputGroup && _system ->handle (e)) {
1395+ if (getSelectedTab () == _outputGroup && _runtime ->handle (e)) {
14021396 result = 1 ;
14031397 } else {
14041398 result = BaseWindow::handle (e);
0 commit comments