author | francesco-ST <francesco.abbate@st.com> | 2010年09月28日 15:55:57 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年09月28日 15:55:57 +0200 |
commit | 62f2a0a67721aecbb2e46692152fecbc6cd188b5 (patch) | |
tree | 3d1bb019097a33ab99ab5001b4bfa1e75d452e54 /agg-plot/lua-plot.cpp | |
parent | 241338efd708e77e62ad335b95c771ced5b75975 (diff) | |
download | gsl-shell-62f2a0a67721aecbb2e46692152fecbc6cd188b5.tar.gz |
-rw-r--r-- | agg-plot/lua-plot.cpp | 42 |
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index c98dcca3..01b60858 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -59,6 +59,8 @@ static int plot_clear (lua_State *L); static int plot_sync_mode_get (lua_State *L); static int plot_sync_mode_set (lua_State *L); +static int plot_pad_mode_get (lua_State *L); +static int plot_pad_mode_set (lua_State *L); static int canvas_new (lua_State *L); @@ -91,6 +93,7 @@ static const struct luaL_Reg plot_properties_get[] = { {"title", plot_title_get }, {"units", plot_units_get }, {"sync", plot_sync_mode_get }, + {"pad", plot_pad_mode_get }, {NULL, NULL} }; @@ -98,6 +101,7 @@ static const struct luaL_Reg plot_properties_set[] = { {"title", plot_title_set }, {"units", plot_units_set }, {"sync", plot_sync_mode_set }, + {"pad", plot_pad_mode_set }, {NULL, NULL} }; @@ -214,22 +218,10 @@ plot_units_set (lua_State *L) { lua_plot *p = object_check<lua_plot>(L, 1, GS_PLOT); bool request = (bool) lua_toboolean (L, 2); - AGG_LOCK(); - - bool current = p->use_units(); - - if (current != request) - { - p->set_units(request); - AGG_UNLOCK(); - plot_update_raw (L, p, 1); - } - else - { - AGG_UNLOCK(); - } - + p->set_units(request); + AGG_UNLOCK(); + plot_update_raw (L, p, 1); return 0; } @@ -360,6 +352,26 @@ plot_clear (lua_State *L) return 0; } +static int plot_pad_mode_set (lua_State *L) +{ + lua_plot *p = object_check<lua_plot>(L, 1, GS_PLOT); + bool request = (bool) lua_toboolean (L, 2); + AGG_LOCK(); + p->pad_mode(request); + AGG_UNLOCK(); + plot_update_raw (L, p, 1); + return 0; +} + +static int plot_pad_mode_get (lua_State *L) +{ + lua_plot *p = object_check<lua_plot>(L, 1, GS_PLOT); + AGG_LOCK(); + lua_pushboolean (L, p->pad_mode()); + AGG_UNLOCK(); + return 1; +} + int plot_sync_mode_get (lua_State *L) { |