diff options
author | Christian Persch <chpe+gnomebugz@stud.uni-saarland.de> | 2003-05-20 19:46:28 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-20 19:46:28 +0800 |
commit | 754c3261279b58118b16cfe9018613f058b59c9b (patch) | |
tree | d23770eeefb5b947ee44a27fc3cbad04f026de86 /embed | |
parent | bc555495c56dc8836db5ac7a4f3f6b5772e315d6 (diff) | |
download | gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar.gz gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar.bz2 gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar.lz gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar.xz gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.tar.zst gsoc2013-epiphany-754c3261279b58118b16cfe9018613f058b59c9b.zip |
Simplified and reorganised zoom. Implement a zoom control for the toolbar.
2003-05-19 Christian Persch <chpe+gnomebugz@stud.uni-saarland.de>
Simplified and reorganised zoom. Implement a zoom control for the
toolbar.
* lib/widgets/ephy-zoom-action.h:
* lib/widgets/ephy-zoom-action.c:
* lib/widgets/ephy-zoom-control.h:
* lib/widgets/ephy-zoom-control.c:
New. A simple zoom control and a corresponding egg action.
* lib/ephy-zoom.h:
* lib/ephy-zoom.c:
New. Define the supported zoom levels, plus some helper functions.
* data/ui/epiphany-toolbar.xml.in:
* src/toolbar.h:
* src/toolbar.c: (toolbar_update_zoom_control),
(zoom_to_level_cb), (toolbar_setup_actions):
Hook up zoom control.
* src/ephy-window.c: (toolbar_update_zoom_control):
New. Updates toolbar zoom control and menu item sensitivity.
* embed/mozilla/mozilla-embed.c: (impl_zoom_set, impl_zoom_get):
* embed/ephy-embed.[ch]: (zoom_set), (zoom_get), (ephy_embed_zoom_set),
(ephy_embed_zoom_get):
* lib/ephy-marshal.list:
* src/ephy-nautilus-view.c: (gnv_embed_zoom_change_cb),
(gnv_zoomable_set_zoom_level_cb):
* src/ephy-tab.c: (ephy_tab_zoom_changed_cb):
* src/ephy-window.c: (ephy_window_set_zoom):
Use float zoom factor instead of int percent for zoom.
* src/ephy-nautilus-view.c: (ephy_nautilus_view_instance_init),
(ephy_nautilus_view_class_init), (gnv_zoomable_set_zoom_level_cb),
(gnv_zoomable_zoom_in_cb), (gnv_zoomable_zoom_out_cb),
(gnv_zoomable_zoom_to_default_cb), (gnv_embed_zoom_change_cb):
* src/window-commands.c: (window_cmd_view_zoom_in),
(window_cmd_view_zoom_out), (window_cmd_view_zoom_normal):
Simplified; use ephy-zoom.h where appropriate.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed.c | 8 | ||||
-rw-r--r-- | embed/ephy-embed.h | 8 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 21 |
3 files changed, 19 insertions, 18 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 6c6406d9c..c0858a32f 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -245,10 +245,10 @@ ephy_embed_base_init (gpointer g_class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EphyEmbedClass, zoom_change), NULL, NULL, - g_cclosure_marshal_VOID__INT, + g_cclosure_marshal_VOID__FLOAT, G_TYPE_NONE, 1, - G_TYPE_INT); + G_TYPE_FLOAT); initialized = TRUE; } } @@ -411,7 +411,7 @@ ephy_embed_copy_page (EphyEmbed *dest, gresult ephy_embed_zoom_set (EphyEmbed *embed, - int zoom, + float zoom, gboolean reflow) { EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); @@ -420,7 +420,7 @@ ephy_embed_zoom_set (EphyEmbed *embed, gresult ephy_embed_zoom_get (EphyEmbed *embed, - int *zoom) + float *zoom) { EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); return klass->zoom_get (embed, zoom); diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 73671ccbd..c8e732e09 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -235,10 +235,10 @@ struct EphyEmbedClass EphyEmbed *source, EmbedDisplayType display_type); gresult (* zoom_set) (EphyEmbed *embed, - int zoom, + float zoom, gboolean reflow); gresult (* zoom_get) (EphyEmbed *embed, - int *zoom); + float *zoom); gresult (* selection_can_cut) (EphyEmbed *embed); gresult (* selection_can_copy) (EphyEmbed *embed); gresult (* can_paste) (EphyEmbed *embed); @@ -337,11 +337,11 @@ gresult ephy_embed_copy_page (EphyEmbed *dest, /* Zoom */ gresult ephy_embed_zoom_set (EphyEmbed *embed, - int zoom, + float zoom, gboolean reflow); gresult ephy_embed_zoom_get (EphyEmbed *embed, - int *zoom); + float *zoom); /* Clipboard */ gresult ephy_embed_selection_can_cut (EphyEmbed *embed); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index aaca63203..06c12b032 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -25,6 +25,7 @@ #include "MozillaPrivate.h" #include "EphyWrapper.h" #include "EventContext.h" +#include "ephy-debug.h" #include <nsIWindowWatcher.h> #include <nsIURI.h> @@ -37,8 +38,6 @@ #include <nsIPrintOptions.h> #include <nsGfxCIID.h> -#include <math.h> - static void mozilla_embed_class_init (MozillaEmbedClass *klass); static void @@ -104,11 +103,11 @@ impl_copy_page (EphyEmbed *dest, EmbedDisplayType display_type); static gresult impl_zoom_set (EphyEmbed *embed, - int zoom, + float zoom, gboolean reflow); static gresult impl_zoom_get (EphyEmbed *embed, - int *zoom); + float *zoom); static gresult impl_selection_can_cut (EphyEmbed *embed); static gresult @@ -772,7 +771,7 @@ impl_copy_page (EphyEmbed *dest, static gresult impl_zoom_set (EphyEmbed *embed, - int zoom, + float zoom, gboolean reflow) { EphyWrapper *wrapper; @@ -781,7 +780,7 @@ impl_zoom_set (EphyEmbed *embed, wrapper = MOZILLA_EMBED(embed)->priv->wrapper; g_return_val_if_fail (wrapper != NULL, G_FAILED); - result = wrapper->SetZoom ((float)(zoom) / 100, reflow); + result = wrapper->SetZoom (zoom, reflow); if (NS_SUCCEEDED (result)) { @@ -793,7 +792,7 @@ impl_zoom_set (EphyEmbed *embed, static gresult impl_zoom_get (EphyEmbed *embed, - int *zoom) + float *zoom) { float f; EphyWrapper *wrapper; @@ -801,15 +800,17 @@ impl_zoom_get (EphyEmbed *embed, wrapper = MOZILLA_EMBED(embed)->priv->wrapper; if (!wrapper) { - *zoom = 100; - return G_OK; + LOG ("impl_zoom_get: wrapper == NULL") + + *zoom = 1.0; + return G_FAILED; } nsresult result = wrapper->GetZoom (&f); if (NS_SUCCEEDED (result)) { - *zoom = (int) rint (f * 100); + *zoom = f; return G_OK; } |