diff options
author | uranther <jwheaton@purdue.edu> | 2009-05-29 16:51:05 -0400 |
---|---|---|
committer | uranther <jwheaton@purdue.edu> | 2009-05-29 16:51:05 -0400 |
commit | 79bc5894756cf9ea267ec80938e7c9fe4881d1b4 (patch) | |
tree | 1c1130a1a3ddb4bced2c93bd30930842b100acbf | |
parent | 113ace97e4185c885b677e1b486e94e7ba6a5d12 (diff) |
Replaced reset_zoom with zoom_level; added floats to commands
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | examples/configs/sampleconfig | 2 | ||||
-rw-r--r-- | uzbl.c | 22 | ||||
-rw-r--r-- | uzbl.h | 9 |
4 files changed, 19 insertions, 15 deletions
@@ -153,7 +153,6 @@ actions follows: * `stop` * `zoom_in` * `zoom_out` -* `reset_zoom` * `uri <address>` * `js <body>` - execute the javascript in `<body>` diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 881173c..603ee0f 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -69,7 +69,7 @@ bind r = reload bind R = reload_ign_cache bind + = zoom_in bind - = zoom_out -bind = = reset_zoom +bind = = sh "echo set zoom_level = 1.0 > $4" bind t = toggle_status # Hilight matches. Notice the * after the slash - it makes the command incremental, i.e. gets called # on every character you type. You can do `bind /_ = search %s' if you want it less interactive. @@ -84,7 +84,7 @@ typedef const struct { void (*func)(void); } uzbl_cmdprop; -enum {TYPE_INT, TYPE_STR}; +enum {TYPE_INT, TYPE_STR, TYPE_FLOAT}; /* an abbreviation to help keep the table's width humane */ #define PTR(var, t, fun) { .ptr = (void*)&(var), .type = TYPE_##t, .func = fun } @@ -129,10 +129,11 @@ const struct { { "max_conns", PTR(uzbl.net.max_conns, INT, cmd_max_conns)}, { "max_conns_host", PTR(uzbl.net.max_conns_host, INT, cmd_max_conns_host)}, { "useragent", PTR(uzbl.net.useragent, STR, cmd_useragent)}, - /* exported WebKitWebSettings properties*/ + /* exported WebKitWebSettings properties */ { "font_size", PTR(uzbl.behave.font_size, INT, cmd_font_size)}, { "monospace_size", PTR(uzbl.behave.monospace_size, INT, cmd_font_size)}, { "minimum_font_size", PTR(uzbl.behave.minimum_font_size, INT, cmd_minimum_font_size)}, + { "zoom_level", PTR(uzbl.behave.zoom_level, FLOAT, cmd_zoom_level)}, { "disable_plugins", PTR(uzbl.behave.disable_plugins, INT, cmd_disable_plugins)}, { "disable_scripts", PTR(uzbl.behave.disable_scripts, INT, cmd_disable_scripts)}, { "autoload_images", PTR(uzbl.behave.autoload_img, INT, cmd_autoload_img)}, @@ -544,7 +545,6 @@ static struct {char *name; Command command[2];} cmdlist[] = { "stop", {view_stop_loading, 0}, }, { "zoom_in", {view_zoom_in, 0}, }, //Can crash (when max zoom reached?). { "zoom_out", {view_zoom_out, 0}, }, - { "reset_zoom", {reset_zoom_level, 0}, }, { "uri", {load_uri, NOSPLIT} }, { "js", {run_js, NOSPLIT} }, { "script", {run_external_js, 0} }, @@ -708,12 +708,6 @@ search_reverse_text (WebKitWebView *page, GArray *argv) { } static void -reset_zoom_level (WebKitWebView *page, GArray *argv) { - (void) argv; - webkit_web_view_set_zoom_level (page, 1.0); -} - -static void dehilight (WebKitWebView *page, GArray *argv) { (void) argv; webkit_web_view_set_highlight_text_matches (page, FALSE); @@ -1258,6 +1252,11 @@ cmd_font_size() { } static void +cmd_zoom_level() { + webkit_web_view_set_zoom_level (uzbl.gui.web_view, uzbl.behave.zoom_level); +} + +static void cmd_disable_plugins() { g_object_set (G_OBJECT(view_settings()), "enable-plugins", !uzbl.behave.disable_plugins, NULL); @@ -1429,9 +1428,12 @@ set_var_value(gchar *name, gchar *val) { if (c->type == TYPE_STR) { g_free(*c->ptr); *c->ptr = g_strdup(val); - } else if(c->type == TYPE_INT) { + } else if (c->type == TYPE_INT) { int *ip = (int *)c->ptr; *ip = (int)strtoul(val, &endp, 10); + } else if (c->type == TYPE_FLOAT) { + float *fp = (float *)c->ptr; + *fp = (float)strtof(val, &endp); } /* invoke a command specific function */ @@ -155,6 +155,7 @@ typedef struct { guint font_size; guint monospace_size; guint minimum_font_size; + gfloat zoom_level; guint disable_plugins; guint disable_scripts; guint autoload_img; @@ -398,9 +399,6 @@ static void search_reverse_text (WebKitWebView *page, GArray *argv); static void -reset_zoom_level (WebKitWebView *page, GArray *argv); - -static void dehilight (WebKitWebView *page, GArray *argv); static void @@ -454,10 +452,15 @@ cmd_max_conns(); static void cmd_max_conns_host(); +/* exported WebKitWebSettings properties */ + static void cmd_font_size(); static void +cmd_zoom_level(); + +static void cmd_disable_plugins(); static void |