svnno****@sourc*****
svnno****@sourc*****
Thu Dec 25 14:05:58 JST 2008
Revision: 3515 http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3515 Author: ikezoe Date: 2008-12-25 14:05:57 +0900 (Thu, 25 Dec 2008) Log Message: ----------- * module/embed/webkit-gtk/kz-webkit-gtk.c: Zoom function. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2008-12-25 04:10:58 UTC (rev 3514) +++ kazehakase/trunk/ChangeLog 2008-12-25 05:05:57 UTC (rev 3515) @@ -2,6 +2,7 @@ * module/embed/webkit-gtk/kz-webkit-gtk.c: Open a new tab with middle click. Also store navigation history but still buggy. + * module/embed/webkit-gtk/kz-webkit-gtk.c: Zoom function. 2008-10-29 Ryo SHIMIZU <furyo****@on-ai*****> Modified: kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c =================================================================== --- kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2008-12-25 04:10:58 UTC (rev 3514) +++ kazehakase/trunk/module/embed/webkit-gtk/kz-webkit-gtk.c 2008-12-25 05:05:57 UTC (rev 3515) @@ -85,6 +85,10 @@ static gchar *ensure_title (KzEmbed *kzembed); static gboolean selection_is_collapsed (KzEmbed *kzembed); static gboolean is_loading (KzEmbed *kzembed); +static void zoom_set (KzEmbed *kzembed, + int zoom, + gboolean reflow); +static int zoom_get (KzEmbed *kzembed); static gboolean get_lock (KzEmbed *kzembed); static void set_lock (KzEmbed *kzembed, gboolean lock); @@ -96,7 +100,8 @@ gboolean allow); static void get_history (KzEmbed *kzembed, KzBookmark *history); - +static void set_history (KzEmbed *kzembed, + KzBookmark *history); static gboolean shistory_get_pos (KzEmbed *kzembed, gint *pos, gint *count); @@ -254,12 +259,12 @@ iface->save_with_content = NULL; iface->set_text_into_textarea = NULL; iface->get_text_from_textarea = NULL; - iface->zoom_set = NULL; - iface->zoom_get = NULL; + iface->zoom_set = zoom_set; + iface->zoom_get = zoom_get; iface->set_text_size = NULL; iface->get_text_size = NULL; iface->get_html_with_contents = NULL; - iface->set_history = NULL; + iface->set_history = set_history; iface->get_history = get_history; iface->get_last_modified = NULL; iface->fine_scroll = NULL; @@ -576,6 +581,19 @@ return KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->is_loading; } +static void +zoom_set (KzEmbed *kzembed, int zoom, gboolean reflow) +{ + webkit_web_view_set_zoom_level(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view, + (gfloat) zoom / 100); +} + +static int +zoom_get (KzEmbed *kzembed) +{ + return (gint)webkit_web_view_get_zoom_level(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view) * 100; +} + static gboolean get_lock (KzEmbed *kzembed) { @@ -739,6 +757,36 @@ g_list_free(children); } +static void +set_history (KzEmbed *kzembed, KzBookmark *history) +{ +#if 0 + WebKitWebBackForwardList *list; + WebKitWebHistoryItem *item; + GList *children, *node; + gint current_pos; + + list = webkit_web_view_get_back_forward_list(KZ_WEBKIT_GTK_GET_PRIVATE(kzembed)->web_view); + if (!list) + return; + + children = kz_bookmark_get_children(history); + for (node = children; node; node = g_list_next (node)) + { + KzBookmark *child = KZ_BOOKMARK(node->data); + + item = webkit_web_history_item_new_with_data(kz_bookmark_get_link(child), + kz_bookmark_get_title(child)); + webkit_web_back_forward_list_add_item(list, item); + } + g_list_free(children); + + current_pos = kz_bookmark_get_current(history); + item = webkit_web_back_forward_list_get_nth_item(list, current_pos); + webkit_web_back_forward_list_go_to_item(list, item); +#endif +} + static gboolean shistory_get_pos (KzEmbed *kzembed, gint *pos, gint *count) {