Simplify plot methods to manage the plot labels - 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 Abbate <francesco.bbt@gmail.com>2012年01月04日 14:40:49 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年01月04日 14:40:49 +0100
commit99b16872c85c2a090f334820d96f95f145d8db74 (patch)
tree12eab13fff805de8abcc3e06d5efb1e7dbc23395 /agg-plot/lua-plot.cpp
parent046c56f449db15b9c9aa113cb03adf695dd7b9b6 (diff)
downloadgsl-shell-99b16872c85c2a090f334820d96f95f145d8db74.tar.gz
Simplify plot methods to manage the plot labels
Diffstat (limited to 'agg-plot/lua-plot.cpp')
-rw-r--r--agg-plot/lua-plot.cpp 24
1 files changed, 12 insertions, 12 deletions
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp
index 3deeddbd..10fb9170 100644
--- a/agg-plot/lua-plot.cpp
+++ b/agg-plot/lua-plot.cpp
@@ -139,7 +139,7 @@ plot_new (lua_State *L)
{
const char *title = lua_tostring (L, 1);
if (title)
- p->set_title(title);
+ p->title() = title;
}
return 1;
@@ -159,7 +159,7 @@ canvas_new (lua_State *L)
{
const char *title = lua_tostring (L, 1);
if (title)
- p->set_title(title);
+ p->title() = title;
}
return 1;
@@ -242,18 +242,18 @@ plot_add_line (lua_State *L)
return plot_add_gener (L, true);
}
-static int plot_string_property_get (lua_State* L, const char* (sg_plot::*getter)() const)
+static int plot_string_property_get (lua_State* L, str& (sg_plot::*getref)())
{
sg_plot *p = object_check<sg_plot>(L, 1, GS_PLOT);
AGG_LOCK();
- const char *title = (p->*getter)();
- lua_pushstring (L, title);
+ str& ref = (p->*getref)();
+ lua_pushstring (L, ref.cstr());
AGG_UNLOCK();
return 1;
}
-static void plot_string_property_set (lua_State* L, void (sg_plot::*setter)(const char*), bool update)
+static void plot_string_property_set (lua_State* L, str& (sg_plot::*getref)(), bool update)
{
sg_plot *p = object_check<sg_plot>(L, 1, GS_PLOT);
const char *s = lua_tostring (L, 2);
@@ -262,7 +262,7 @@ static void plot_string_property_set (lua_State* L, void (sg_plot::*setter)(cons
gs_type_error (L, 2, "string");
AGG_LOCK();
- (p->*setter)(s);
+ (p->*getref)() = s;
AGG_UNLOCK();
if (update)
@@ -299,7 +299,7 @@ static void plot_bool_property_set(lua_State* L, void (sg_plot::*setter)(bool),
int
plot_title_set (lua_State *L)
{
- plot_string_property_set(L, &sg_plot::set_title, true);
+ plot_string_property_set(L, &sg_plot::title, true);
return 0;
}
@@ -312,27 +312,27 @@ plot_title_get (lua_State *L)
int
plot_xlab_set (lua_State *L)
{
- plot_string_property_set(L, &sg_plot::set_xlabel, true);
+ plot_string_property_set(L, &sg_plot::x_axis_title, true);
return 0;
}
int
plot_xlab_get (lua_State *L)
{
- return plot_string_property_get(L, &sg_plot::xlabel);
+ return plot_string_property_get(L, &sg_plot::x_axis_title);
}
int
plot_ylab_set (lua_State *L)
{
- plot_string_property_set(L, &sg_plot::set_ylabel, true);
+ plot_string_property_set(L, &sg_plot::y_axis_title, true);
return 0;
}
int
plot_ylab_get (lua_State *L)
{
- return plot_string_property_get(L, &sg_plot::ylabel);
+ return plot_string_property_get(L, &sg_plot::y_axis_title);
}
int
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月15日 16:22:41 +0000

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