changes plot updates mechanism to use win-plot-refs - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/win-plot-refs.c
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年08月25日 15:49:10 +0200
committerfrancesco-ST <francesco.abbate@st.com>2010年08月25日 15:49:10 +0200
commit57eff12fb29f77f919d12de2550d5e1484c4ff4a (patch)
treecfb418cbe90d12a698b0ec7d4b5f7e0a13cd592f /win-plot-refs.c
parent29a9dbd5af79c3c80749efaf09fb8240482ff5b5 (diff)
downloadgsl-shell-57eff12fb29f77f919d12de2550d5e1484c4ff4a.tar.gz
changes plot updates mechanism to use win-plot-refs
Now the plot does not store a window ID any more. When an update of the plot is needed a reverse lookup is made in the window-plot refs table to find all the windows that references the given plot and asking the to update the slot. The net results of this change is that: - all the windows that contains the plot are automatically updated - the lua_plot class is now virtually a simple "plot" class - the lookup mechanisms could be slower because we need to search the windows by inspecting some lua tables Added also the missing 'show' method for plots.
Diffstat (limited to 'win-plot-refs.c')
-rw-r--r--win-plot-refs.c 30
1 files changed, 30 insertions, 0 deletions
diff --git a/win-plot-refs.c b/win-plot-refs.c
index 3dbd4dd9..bd7a642a 100644
--- a/win-plot-refs.c
+++ b/win-plot-refs.c
@@ -60,3 +60,33 @@ window_plot_ref_remove (lua_State *L, int slot_id, int window_index)
lua_pop (L, 2);
}
+
+void
+window_plot_rev_lookup_apply (lua_State *L, int plot_index, lua_CFunction func)
+{
+ INDEX_SET_ABS(L, plot_index);
+
+ lua_getfield (L, LUA_REGISTRYINDEX, window_plot_ref_table_name);
+ lua_pushnil (L);
+
+ while (lua_next (L, -2) != 0)
+ {
+ lua_pushnil (L);
+
+ while (lua_next (L, -2) != 0)
+ {
+ if (lua_rawequal (L, -1, plot_index))
+ {
+ lua_pushcfunction (L, func);
+ lua_pushvalue (L, -5);
+ lua_pushvalue (L, -4);
+ lua_call (L, 2, 0);
+ }
+ lua_pop (L, 1);
+ }
+
+ lua_pop (L, 1);
+ }
+
+ lua_pop (L, 1);
+}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月30日 08:00:11 +0000

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