author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年03月28日 13:08:31 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年03月28日 22:19:14 +0200 |
commit | a8892c648d7cf5201a5836410fa708f28b539294 (patch) | |
tree | 31d5e656b499d7083a65e67fb4f6544841ee6fc9 /agg-plot/lua-plot.cpp | |
parent | c029d0205e36aa6453870f240011a3616eccca77 (diff) | |
download | gsl-shell-a8892c648d7cf5201a5836410fa708f28b539294.tar.gz |
-rw-r--r-- | agg-plot/lua-plot.cpp | 19 |
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index 8ba21bbc..0b0f9a19 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -28,6 +28,7 @@ extern "C" { #include "lua-cpp-utils.h" #include "bitmap-plot.h" #include "window.h" +#include "window-cpp.h" #include "gs-types.h" #include "lua-utils.h" #include "window_registry.h" @@ -463,11 +464,19 @@ plot_flush (lua_State *L) int plot_show (lua_State *L) { - lua_pushcfunction (L, window_attach); - window_new (L); - lua_pushvalue (L, 1); - lua_pushstring (L, ""); - lua_call (L, 3, 0); + sg_plot* plot = object_check<sg_plot>(L, 1, GS_PLOT); + window* win = push_new_object<window>(L, GS_WINDOW, colors::white); + + int slot_id = win->attach (plot, ""); + assert(slot_id >= 0); + window_refs_add (L, slot_id, -1, 1); + + gslshell::ret_status st; + win->start(L, st); + + if (st.error_msg()) + return luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context()); + return 0; } |