author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年07月27日 15:03:09 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年07月27日 15:03:09 +0200 |
commit | 816557deba04dc5d2e8735e49de51728c2457382 (patch) | |
tree | a71fa2c18c5cdb7b3984d329678271b27ff2b4df | |
parent | 38e96641ade34c5a2709b8e0ee3a283bd6bbd630 (diff) | |
download | gsl-shell-816557deba04dc5d2e8735e49de51728c2457382.tar.gz |
-rw-r--r-- | fox-gui/gsl_shell_app.cpp | 3 | ||||
-rw-r--r-- | fox-gui/lua_plot_window.cpp | 31 |
diff --git a/fox-gui/gsl_shell_app.cpp b/fox-gui/gsl_shell_app.cpp index 599e37aa..e66abd63 100644 --- a/fox-gui/gsl_shell_app.cpp +++ b/fox-gui/gsl_shell_app.cpp @@ -52,8 +52,7 @@ long gsl_shell_app::on_window_close(FXObject* sender, FXSelector, void*) { fx_plot_window* win = (fx_plot_window*) sender; m_engine.window_close_notify(win->lua_id); - win->hide(); - return 1; + return 0; } void gsl_shell_app::wait_window_mapping() diff --git a/fox-gui/lua_plot_window.cpp b/fox-gui/lua_plot_window.cpp index ed85e73a..65159584 100644 --- a/fox-gui/lua_plot_window.cpp +++ b/fox-gui/lua_plot_window.cpp @@ -15,7 +15,6 @@ extern "C" { __BEGIN_DECLS -static int fox_window_free (lua_State *L); static int fox_window_close (lua_State *L); static const struct luaL_Reg fox_window_functions[] = { @@ -28,10 +27,15 @@ static const struct luaL_Reg fox_window_methods[] = { {"close", fox_window_close }, {"refresh", fox_window_slot_refresh }, {"update", fox_window_slot_update }, - {"__gc", fox_window_free }, {NULL, NULL} }; + +struct lua_fox_window +{ + fx_plot_window* window; +}; + __END_DECLS typedef plot<manage_owner> sg_plot; @@ -42,7 +46,10 @@ fox_window_new (lua_State *L) gsl_shell_app* app = global_app; app->lock(); - fx_plot_window* win = new(L, GS_FOX_WINDOW) fx_plot_window(app, "GSL Shell FX plot", NULL, NULL, 480, 480); + lua_fox_window* bwin = new(L, GS_FOX_WINDOW) lua_fox_window(); + fx_plot_window* win = new fx_plot_window(app, "GSL Shell FX plot", NULL, NULL, 480, 480); + bwin->window = win; + win->setTarget(app); app->window_create_request(win); @@ -57,17 +64,9 @@ fox_window_new (lua_State *L) } int -fox_window_free (lua_State *L) -{ - fx_plot_window *win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); - win->~fx_plot_window(); - return 0; -} - -int fox_window_attach (lua_State *L) { - fx_plot_window *win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); + fx_plot_window *win = object_check<lua_fox_window>(L, 1, GS_FOX_WINDOW)->window; sg_plot* p = object_check<sg_plot>(L, 2, GS_PLOT); gsl_shell_app* app = win->get_app(); app->lock(); @@ -87,7 +86,7 @@ fox_window_close (lua_State *L) int fox_window_slot_refresh (lua_State *L) { - fx_plot_window* win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); + fx_plot_window *win = object_check<lua_fox_window>(L, 1, GS_FOX_WINDOW)->window; fx_plot_canvas* canvas = win->canvas(); gsl_shell_app* app = win->get_app(); @@ -109,7 +108,7 @@ fox_window_slot_refresh (lua_State *L) int fox_window_slot_update (lua_State *L) { - fx_plot_window* win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); + fx_plot_window *win = object_check<lua_fox_window>(L, 1, GS_FOX_WINDOW)->window; fx_plot_canvas* canvas = win->canvas(); gsl_shell_app* app = win->get_app(); @@ -129,7 +128,7 @@ fox_window_slot_update (lua_State *L) int fox_window_save_slot_image (lua_State *L) { - fx_plot_window* win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); + fx_plot_window *win = object_check<lua_fox_window>(L, 1, GS_FOX_WINDOW)->window; fx_plot_canvas* canvas = win->canvas(); gsl_shell_app* app = win->get_app(); app->lock(); @@ -141,7 +140,7 @@ fox_window_save_slot_image (lua_State *L) int fox_window_restore_slot_image (lua_State *L) { - fx_plot_window* win = object_check<fx_plot_window>(L, 1, GS_FOX_WINDOW); + fx_plot_window *win = object_check<lua_fox_window>(L, 1, GS_FOX_WINDOW)->window; fx_plot_canvas* canvas = win->canvas(); gsl_shell_app* app = win->get_app(); app->lock(); |