gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat
-rw-r--r--fox-gui/lua_plot_window.cpp 28
-rw-r--r--fox-gui/window_part.cpp 2
-rw-r--r--fox-gui/window_surface.cpp 9
-rw-r--r--fox-gui/window_surface.h 2
4 files changed, 39 insertions, 2 deletions
diff --git a/fox-gui/lua_plot_window.cpp b/fox-gui/lua_plot_window.cpp
index 5f0b4b2a..03901aa8 100644
--- a/fox-gui/lua_plot_window.cpp
+++ b/fox-gui/lua_plot_window.cpp
@@ -119,11 +119,35 @@ fox_window_new (lua_State *L)
return 1;
}
+static int
+fox_window_layout_try(lua_State* L)
+{
+ window_mutex wm(L, 1);
+ const char *spec = lua_tostring(L, 2);
+
+ if (!spec) return type_error_return(L, 2, "string");
+
+ fx_plot_window* win = wm.window();
+ window_surface& surface = win->surface();
+
+ const int window_lua_index = 1;
+ for (unsigned k = 0; k < surface.plot_number(); k++)
+ {
+ if (surface.plot(k))
+ window_refs_remove(L, k + 1, window_lua_index);
+ }
+
+ surface.split(spec);
+ surface.draw_all();
+ return 0;
+}
+
int
fox_window_layout(lua_State* L)
{
- return luaL_error(L, "window's layout method not yet implemented "
- "in FOX client");
+ int nret = fox_window_layout_try(L);
+ if (nret < 0) lua_error(L);
+ return nret;
}
static int
diff --git a/fox-gui/window_part.cpp b/fox-gui/window_part.cpp
index 89d9b84c..0b86be10 100644
--- a/fox-gui/window_part.cpp
+++ b/fox-gui/window_part.cpp
@@ -9,6 +9,7 @@ int
window_part::parse(const char* str)
{
const char* p = str;
+ m_index.clear();
parse_element(p);
return m_index.size();
}
@@ -91,6 +92,7 @@ window_part::split_rec(const rect_type& r, unsigned& k)
void
window_part::split()
{
+ m_rect.clear();
rect_type r(0, 0, 1, 1);
unsigned pos = 0;
split_rec(r, pos);
diff --git a/fox-gui/window_surface.cpp b/fox-gui/window_surface.cpp
index 9d4d71e8..9196f7f1 100644
--- a/fox-gui/window_surface.cpp
+++ b/fox-gui/window_surface.cpp
@@ -178,6 +178,15 @@ window_surface::slot_update(unsigned index)
}
void
+window_surface::draw_all()
+{
+ for (unsigned k = 0; k < m_plots.size(); k++)
+ render(k);
+ const agg::rect_i r(0, 0, get_width(), get_height());
+ m_window->update_region(r);
+}
+
+void
window_surface::save_slot_image(unsigned index)
{
save_plot_image(index);
diff --git a/fox-gui/window_surface.h b/fox-gui/window_surface.h
index 88996de5..5eec2d62 100644
--- a/fox-gui/window_surface.h
+++ b/fox-gui/window_surface.h
@@ -60,6 +60,8 @@ public:
void render(unsigned index);
opt_rect<int> render_drawing_queue(unsigned index);
+ void draw_all();
+
sg_plot* plot(unsigned index) const { return m_plots[index].plot; }
agg::rect_i get_plot_area(unsigned index) const;
generated by cgit v1.2.3 (git 2.46.0) at 2025年09月29日 02:33:37 +0000

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