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().
parent c90f0b20
......@@ -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;
......
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')
......@@ -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"))
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment