[gegl] bin: add a prefernces screen, for now toggled with ctrl-p
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] bin: add a prefernces screen, for now toggled with ctrl-p
- Date: Sun, 24 Feb 2019 23:41:32 +0000 (UTC)
commit d8a54b12af5b04e65bc809da3aa4cc0dda8e481e
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Feb 25 00:39:56 2019 +0100
bin: add a prefernces screen, for now toggled with ctrl-p
It allows toggling mipmap, opencl and use of display ICC profile,
as well as provides a - for now read only view on other members
of gegl_config().
bin/lua/init.lua | 1 +
bin/lua/preferences.lua | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
bin/ui.c | 28 +++++++++++++++--
bin/ui.h | 2 +-
4 files changed, 109 insertions(+), 4 deletions(-)
---
diff --git a/bin/lua/init.lua b/bin/lua/init.lua
index f02e51690..5834d29b7 100644
--- a/bin/lua/init.lua
+++ b/bin/lua/init.lua
@@ -64,6 +64,7 @@ struct State {
const char *property_focus; // interned string of property name, or "operation" or "id"
int editing_property;
+ int show_preferences;
float u, v;
diff --git a/bin/lua/preferences.lua b/bin/lua/preferences.lua
new file mode 100644
index 000000000..23c90f6e5
--- /dev/null
+++ b/bin/lua/preferences.lua
@@ -0,0 +1,82 @@
+
+local em = mrg:em()
+mrg:set_edge_left(mrg:height() * .2)
+
+mrg:set_style("font-size: 10vh; text-stroke-width: 0.2em;
text-stroke-color:rgba(0,0,0,0.4);color:white;background:transparent;");
+mrg:print("\n");
+mrg:print("Preferences\n");
+mrg:set_style("font-size: 6vh");
+
+
+mrg:text_listen(Mrg.PRESS, function(ev)
+ if Gegl.config().mipmap_rendering then
+ Gegl.config().mipmap_rendering = false
+ else
+ Gegl.config().mipmap_rendering = true
+ end
+ ev:stop_propagate()
+end)
+mrg:print("mipmap")
+if Gegl.config().mipmap_rendering then
+ mrg:print(" yes")
+else
+ mrg:print(" no")
+end
+mrg:print("\n")
+mrg:text_listen_done ()
+
+
+mrg:text_listen(Mrg.PRESS, function(ev)
+ if Gegl.config().use_opencl then
+ Gegl.config().use_opencl = false
+ ffi.C.argvs_eval("clear")
+ else
+ Gegl.config().use_opencl = true
+ ffi.C.argvs_eval("clear")
+ end
+ ev:stop_propagate()
+end)
+mrg:print("OpenCL")
+if Gegl.config().use_opencl then
+ mrg:print(" yes")
+ ffi.C.argvs_eval("clear")
+else
+ mrg:print(" no")
+ ffi.C.argvs_eval("clear")
+end
+mrg:text_listen_done ()
+mrg:print("\n")
+
+
+mrg:text_listen(Mrg.PRESS, function(ev)
+ if o.color_managed_display ~= 0 then
+ o.color_managed_display = 0
+ else
+ o.color_managed_display = 1
+ end
+ ev:stop_propagate()
+end)
+mrg:print("use display ICC profile")
+if o.color_managed_display ~= 0 then
+ mrg:print(" yes")
+ ffi.C.argvs_eval("clear")
+else
+ mrg:print(" no")
+ ffi.C.argvs_eval("clear")
+end
+mrg:text_listen_done ()
+mrg:print("\n")
+
+mrg:set_style("font-size: 3vh");
+
+mrg:print("threads: " .. Gegl.config().threads .. "\n")
+mrg:print("queue-size: " .. Gegl.config().queue_size.. "\n")
+mrg:print("application-license: " .. Gegl.config().application_license.. "\n")
+mrg:print("swap: " .. Gegl.config().swap .. "\n")
+mrg:print("swap-compression: " .. Gegl.config().swap_compression .. "\n")
+mrg:print("tile-size: " .. Gegl.config().tile_width .. 'x' .. Gegl.config().tile_height .."\n")
+mrg:print("tile-cache-size: " .. (Gegl.config().tile_cache_size / 1024 / 1024) .. 'mb\n')
+mrg:print("chunk-size: " .. (Gegl.config().chunk_size / 1024 / 1024) .. 'mb\n')
+
+
+
diff --git a/bin/ui.c b/bin/ui.c
index 14ccd1859..6e598ec82 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -436,6 +436,7 @@ Setting settings[]=
// FLOAT_PROP(render_quality, "1.0 = normal 2.0 = render at 2.0 zoom factor 4.0 render at 25%"),
// FLOAT_PROP(preview_quality, "preview quality for use during some interactions, same scale as
render-quality"),
FLOAT_PROP(scale, "display scale factor"),
+ INT_PROP(show_preferences, "show preferences"),
INT_PROP(show_bindings, "show currently valid keybindings"),
INT_PROP(show_graph, "show the graph (and commandline)"),
INT_PROP(show_thumbbar, "show the thumbbar"),
@@ -4907,7 +4908,7 @@ static GList *commandline_get_completions (GeglNode *node,
{
char *tmp = g_strdup (commandline);
char *fragment;
- char ** operations = operations;
+ char ** operations;
char *found_op = NULL;
gint i;
guint n_operations;
@@ -5023,7 +5024,7 @@ static GList *commandline_get_completions (GeglNode *node,
{
char prefixed_by_gegl[512];
- char ** operations = operations;
+ char ** operations;
gint i;
guint n_operations;
/* the last fragment is what we're completing */
@@ -5691,6 +5692,23 @@ static void gegl_ui (Mrg *mrg, void *data)
}
cairo_new_path (mrg_cr (mrg));
+ if (o->show_preferences)
+ {
+#if HAVE_LUA
+ if (run_lua_file ("preferences.lua"))
+ {
+ }
+ else
+#endif
+ {
+ mrg_printf ("non-lua preferences NYI\n");
+ canvas_touch_handling (mrg, o);
+ //ui_viewer (o);
+ }
+ }
+
+
+ mrg_add_binding (mrg, "control-p", NULL, NULL, run_command, "toggle preferences");
mrg_add_binding (mrg, "control-q", NULL, NULL, run_command, "quit");
mrg_add_binding (mrg, "F11", NULL, NULL, run_command, "toggle fullscreen");
mrg_add_binding (mrg, "control-f", NULL, NULL, run_command, "toggle fullscreen");
@@ -7006,11 +7024,15 @@ cmd_toggle (COMMAND_ARGS)
{
o->show_bindings = !o->show_bindings;
}
+ else if (!strcmp(argv[1], "preferences"))
+ {
+ o->show_preferences = !o->show_preferences;
+ }
else if (!strcmp(argv[1], "colormanaged-display"))
{
o->color_managed_display = !o->color_managed_display;
printf ("%s colormanagement of display\n", o->color_managed_display?"enabled":"disabled");
- //mrg_gegl_dirty ();
+ mrg_gegl_dirty ();
}
else if (!strcmp(argv[1], "opencl"))
{
diff --git a/bin/ui.h b/bin/ui.h
index 87fa145c5..b9775c9e0 100644
--- a/bin/ui.h
+++ b/bin/ui.h
@@ -76,7 +76,7 @@ struct _GeState {
const char *property_focus; // interned string of property name, or "operation" or "id"
int editing_property;
-
+ int show_preferences;
float u, v;
float scale;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]