aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-12-08 01:54:57 +0800
committerChristian Persch <chpe@src.gnome.org>2005-12-08 01:54:57 +0800
commitc92bf4456143bc5e230bd0153d4bc938b68fddfc (patch)
tree83b5d68baf5fa04b78b2eb2f1df33562091be071
parent89e2f69727a24f8667b1daf2341bae55b0567d10 (diff)
downloadgsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar.gz
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar.bz2
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar.lz
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar.xz
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.tar.zst
gsoc2013-epiphany-c92bf4456143bc5e230bd0153d4bc938b68fddfc.zip
Add ephy_embed_scroll_pixels.
2005-12-07 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed.c: (ephy_embed_scroll), (ephy_embed_page_scroll), (ephy_embed_scroll_pixels): * embed/ephy-embed.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/mozilla-embed.cpp: Add ephy_embed_scroll_pixels.
-rw-r--r--ChangeLog11
-rw-r--r--embed/ephy-embed.c29
-rw-r--r--embed/ephy-embed.h13
-rw-r--r--embed/mozilla/EphyBrowser.cpp35
-rw-r--r--embed/mozilla/EphyBrowser.h5
-rw-r--r--embed/mozilla/mozilla-embed.cpp21
6 files changed, 94 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index bde65d7e3..1fa6b0f0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-12-07 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/ephy-embed.c: (ephy_embed_scroll),
+ (ephy_embed_page_scroll), (ephy_embed_scroll_pixels):
+ * embed/ephy-embed.h:
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/EphyBrowser.h:
+ * embed/mozilla/mozilla-embed.cpp:
+
+ Add ephy_embed_scroll_pixels.
+
2005-12-06 Crispin Flowerday <gnome@flowerday.cx>
* embed/ephy-embed.c: (ephy_embed_scroll),
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 6eaf2b66c..c016408c7 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -654,10 +654,11 @@ ephy_embed_get_zoom (EphyEmbed *embed)
*
**/
void
-ephy_embed_scroll (EphyEmbed *embed, int num_lines)
+ephy_embed_scroll (EphyEmbed *embed,
+ int num_lines)
{
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
- iface->scroll (embed, num_lines);
+ iface->scroll_lines (embed, num_lines);
}
/**
@@ -670,10 +671,30 @@ ephy_embed_scroll (EphyEmbed *embed, int num_lines)
*
**/
void
-ephy_embed_page_scroll (EphyEmbed *embed, int num_pages)
+ephy_embed_page_scroll (EphyEmbed *embed,
+ int num_pages)
{
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
- iface->page_scroll (embed, num_pages);
+ iface->scroll_pages (embed, num_pages);
+}
+
+/**
+ * ephy_embed_scroll_pixels:
+ * @embed: an #EphyEmbed
+ * @dx: the number of pixels to scroll in X direction
+ * @dy: the number of pixels to scroll in Y direction
+ *
+ * Scrolls the view by pixels. Positive numbers scroll down resp. right,
+ * negative numbers scroll up resp. left.
+ *
+ **/
+void
+ephy_embed_scroll_pixels (EphyEmbed *embed,
+ int dx,
+ int dy)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ iface->scroll_pixels (embed, dx, dy);
}
/**
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 6f1787222..6190c14b4 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -192,8 +192,13 @@ struct _EphyEmbedIface
void (* set_zoom) (EphyEmbed *embed,
float zoom);
float (* get_zoom) (EphyEmbed *embed);
- void (* scroll) (EphyEmbed *embed, int num_lines);
- void (* page_scroll) (EphyEmbed *embed, int num_pages);
+ void (* scroll_lines) (EphyEmbed *embed,
+ int num_lines);
+ void (* scroll_pages) (EphyEmbed *embed,
+ int num_pages);
+ void (* scroll_pixels) (EphyEmbed *embed,
+ int dx,
+ int dy);
char * (* get_encoding) (EphyEmbed *embed);
gboolean (* has_automatic_encoding) (EphyEmbed *embed);
void (* set_encoding) (EphyEmbed *embed,
@@ -292,6 +297,10 @@ void ephy_embed_scroll (EphyEmbed *embed,
void ephy_embed_page_scroll (EphyEmbed *embed,
int num_pages);
+
+void ephy_embed_scroll_pixels (EphyEmbed *embed,
+ int dx,
+ int dy);
/* Encoding */
char *ephy_embed_get_encoding (EphyEmbed *embed);
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index b87fe9bf3..0f49127cf 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -928,9 +928,9 @@ nsresult EphyBrowser::GetZoom (float *aZoom)
return mdv->GetTextZoom (aZoom);
}
-nsresult EphyBrowser::ScrollLines (int aNumLines)
+nsresult
+EphyBrowser::ScrollLines (PRInt32 aNumLines)
{
- nsresult rv;
nsCOMPtr<nsIDOMWindow> DOMWindow;
mWebBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow));
@@ -938,13 +938,14 @@ nsresult EphyBrowser::ScrollLines (int aNumLines)
{
DOMWindow = mDOMWindow;
}
+ NS_ENSURE_TRUE (DOMWindow, NS_ERROR_FAILURE);
- DOMWindow->ScrollByLines (aNumLines);
+ return DOMWindow->ScrollByLines (aNumLines);
}
-nsresult EphyBrowser::ScrollPages (int aNumPages)
+nsresult
+EphyBrowser::ScrollPages (PRInt32 aNumPages)
{
- nsresult rv;
nsCOMPtr<nsIDOMWindow> DOMWindow;
mWebBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow));
@@ -952,17 +953,35 @@ nsresult EphyBrowser::ScrollPages (int aNumPages)
{
DOMWindow = mDOMWindow;
}
+ NS_ENSURE_TRUE (DOMWindow, NS_ERROR_FAILURE);
- DOMWindow->ScrollByPages (aNumPages);
+ return DOMWindow->ScrollByPages (aNumPages);
}
+nsresult
+EphyBrowser::ScrollPixels (PRInt32 aDeltaX,
+ PRInt32 aDeltaY)
+{
+ nsCOMPtr<nsIDOMWindow> DOMWindow;
-nsresult EphyBrowser::GetDocument (nsIDOMDocument **aDOMDocument)
+ mWebBrowserFocus->GetFocusedWindow (getter_AddRefs(DOMWindow));
+ if (!DOMWindow)
+ {
+ DOMWindow = mDOMWindow;
+ }
+ NS_ENSURE_TRUE (DOMWindow, NS_ERROR_FAILURE);
+
+ return DOMWindow->ScrollBy (aDeltaX, aDeltaY);
+}
+
+nsresult
+EphyBrowser::GetDocument (nsIDOMDocument **aDOMDocument)
{
return mDOMWindow->GetDocument (aDOMDocument);
}
-nsresult EphyBrowser::GetTargetDocument (nsIDOMDocument **aDOMDocument)
+nsresult
+EphyBrowser::GetTargetDocument (nsIDOMDocument **aDOMDocument)
{
NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE);
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 56058718b..ec605eb10 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -147,8 +147,9 @@ public:
nsresult SetZoom (float aTextZoom);
nsresult GetZoom (float *aTextZoom);
- nsresult ScrollLines (int aNumLines);
- nsresult ScrollPages (int aNumPages);
+ nsresult ScrollLines (PRInt32 aNumLines);
+ nsresult ScrollPages (PRInt32 aNumPages);
+ nsresult ScrollPixels (PRInt32 aDeltaX, PRInt32 aDeltaY);
nsresult Print ();
nsresult SetPrintPreviewMode (PRBool previewMode);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 17797f6e3..cbf728559 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -653,7 +653,8 @@ impl_get_zoom (EphyEmbed *embed)
}
static void
-impl_scroll (EphyEmbed *embed, int num_lines)
+impl_scroll_lines (EphyEmbed *embed,
+ int num_lines)
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
@@ -661,13 +662,24 @@ impl_scroll (EphyEmbed *embed, int num_lines)
}
static void
-impl_page_scroll (EphyEmbed *embed, int num_pages)
+impl_scroll_pages (EphyEmbed *embed,
+ int num_pages)
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
mpriv->browser->ScrollPages (num_pages);
}
+static void
+impl_scroll_pixels (EphyEmbed *embed,
+ int dx,
+ int dy)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
+
+ mpriv->browser->ScrollPixels (dx, dy);
+}
+
static int
impl_shistory_n_items (EphyEmbed *embed)
{
@@ -1197,8 +1209,9 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->reload = impl_reload;
iface->set_zoom = impl_set_zoom;
iface->get_zoom = impl_get_zoom;
- iface->scroll = impl_scroll;
- iface->page_scroll = impl_page_scroll;
+ iface->scroll_lines = impl_scroll_lines;
+ iface->scroll_pages = impl_scroll_pages;
+ iface->scroll_pixels = impl_scroll_pixels;
iface->shistory_n_items = impl_shistory_n_items;
iface->shistory_get_nth = impl_shistory_get_nth;
iface->shistory_get_pos = impl_shistory_get_pos;