Changed behaviour of plot to avoid padding on units by default - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/lua-plot.cpp
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年09月28日 15:55:57 +0200
committerfrancesco-ST <francesco.abbate@st.com>2010年09月28日 15:55:57 +0200
commit62f2a0a67721aecbb2e46692152fecbc6cd188b5 (patch)
tree3d1bb019097a33ab99ab5001b4bfa1e75d452e54 /agg-plot/lua-plot.cpp
parent241338efd708e77e62ad335b95c771ced5b75975 (diff)
downloadgsl-shell-62f2a0a67721aecbb2e46692152fecbc6cd188b5.tar.gz
Changed behaviour of plot to avoid padding on units by default
The padding can be enabled/disabled using a plot property.
Diffstat (limited to 'agg-plot/lua-plot.cpp')
-rw-r--r--agg-plot/lua-plot.cpp 42
1 files changed, 27 insertions, 15 deletions
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)
{
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月13日 21:47:41 +0000

AltStyle によって変換されたページ (->オリジナル) /