Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser-plugin/plugin.cpp
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marcopg@litl.com>2009-03-14 02:30:52 (GMT)
committer Marco Pesenti Gritti <marcopg@litl.com>2010-07-27 22:04:20 (GMT)
commit12676ee4975c899d086b3b17f9326cdf60fbfcc4 (patch)
tree7aa5a28c473b699b1e288abe62ee8b5eba8eeb66 /browser-plugin/plugin.cpp
parent4ef6544ecca1803b48985882b1e0e769257b1c93 (diff)
Reformat to respect evince indentation style.
Diffstat (limited to 'browser-plugin/plugin.cpp')
-rw-r--r--browser-plugin/plugin.cpp177
1 files changed, 89 insertions, 88 deletions
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp
index 40db488..1896420 100644
--- a/browser-plugin/plugin.cpp
+++ b/browser-plugin/plugin.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2009 litl, LLC
@@ -23,26 +24,26 @@
Plugin::Plugin (NPP instance)
{
- mInstance = instance;
- mWindow = 0;
- mScriptableObject = NULL;
+ mInstance = instance;
+ mWindow = 0;
+ mScriptableObject = NULL;
- mScrolledWindow = gtk_scrolled_window_new (NULL, NULL);
+ mScrolledWindow = gtk_scrolled_window_new (NULL, NULL);
- mView = ev_view_new ();
- g_signal_connect (G_OBJECT (mView),
- "notify::sizing-mode",
- G_CALLBACK (Plugin::SizingModeCallback),
- reinterpret_cast<void*>(this));
+ mView = ev_view_new ();
+ g_signal_connect (G_OBJECT (mView),
+ "notify::sizing-mode",
+ G_CALLBACK (Plugin::SizingModeCallback),
+ reinterpret_cast<void*>(this));
- /* FIXME should be set automatically in EvView. It seem to be currently
- used only to calculate the minimum and maximux allowed zoom level. */
- ev_view_set_screen_dpi (EV_VIEW(mView), 96);
+ /* FIXME should be set automatically in EvView. It seem to be currently
+ used only to calculate the minimum and maximux allowed zoom level. */
+ ev_view_set_screen_dpi (EV_VIEW(mView), 96);
- gtk_container_add (GTK_CONTAINER(mScrolledWindow), mView);
- gtk_widget_show (mView);
+ gtk_container_add (GTK_CONTAINER(mScrolledWindow), mView);
+ gtk_widget_show (mView);
- UpdateSizingMode ();
+ UpdateSizingMode ();
}
Plugin::~Plugin ()
@@ -52,15 +53,15 @@ Plugin::~Plugin ()
void
Plugin::ZoomIn ()
{
- ev_view_set_sizing_mode (EV_VIEW (mView), EV_SIZING_FREE);
- ev_view_zoom_in (EV_VIEW (mView));
+ ev_view_set_sizing_mode (EV_VIEW (mView), EV_SIZING_FREE);
+ ev_view_zoom_in (EV_VIEW (mView));
}
void
Plugin::ZoomOut ()
{
- ev_view_set_sizing_mode (EV_VIEW (mView), EV_SIZING_FREE);
- ev_view_zoom_out (EV_VIEW (mView));
+ ev_view_set_sizing_mode (EV_VIEW (mView), EV_SIZING_FREE);
+ ev_view_zoom_out (EV_VIEW (mView));
}
void
@@ -76,104 +77,104 @@ Plugin::FindPrevious (const char *text)
void
Plugin::SetWindow (GdkNativeWindow window)
{
- if (mWindow != 0) {
- return;
- }
+ if (mWindow != 0) {
+ return;
+ }
- mWindow = window;
+ mWindow = window;
- GtkWidget *plug = gtk_plug_new (window);
- gtk_container_add (GTK_CONTAINER (plug), mScrolledWindow);
- gtk_widget_show (mScrolledWindow);
+ GtkWidget *plug = gtk_plug_new (window);
+ gtk_container_add (GTK_CONTAINER (plug), mScrolledWindow);
+ gtk_widget_show (mScrolledWindow);
- gtk_widget_show (plug);
+ gtk_widget_show (plug);
}
void
Plugin::Load (const char *fname)
{
- GError *error = NULL;
+ GError *error = NULL;
- GFile *file = g_file_new_for_path (fname);
- char *uri = g_file_get_uri (file);
- g_object_unref (file);
+ GFile *file = g_file_new_for_path (fname);
+ char *uri = g_file_get_uri (file);
+ g_object_unref (file);
- /* FIXME display loading error in the UI */
+ /* FIXME display loading error in the UI */
- EvDocument *document = ev_document_factory_get_document (uri, &error);
- if (error) {
- g_warning ("Cannot create document for %s", uri);
- g_error_free (error);
- return;
- }
+ EvDocument *document = ev_document_factory_get_document (uri, &error);
+ if (error) {
+ g_warning ("Cannot create document for %s", uri);
+ g_error_free (error);
+ return;
+ }
- ev_view_set_document (EV_VIEW (mView), document);
+ ev_view_set_document (EV_VIEW (mView), document);
- ev_document_load (document, uri, &error);
- if (error) {
- g_warning ("Cannot load %s", uri);
- g_error_free (error);
- return;
- }
+ ev_document_load (document, uri, &error);
+ if (error) {
+ g_warning ("Cannot load %s", uri);
+ g_error_free (error);
+ return;
+ }
- g_free (uri);
+ g_free (uri);
}
NPObject *
Plugin::GetScriptableNPObject ()
{
- if (!mScriptableObject) {
- mScriptableObject = NPN_CreateObject (
- mInstance, GET_NPOBJECT_CLASS (ScriptablePluginObject));
- }
+ if (!mScriptableObject) {
+ mScriptableObject = NPN_CreateObject (
+ mInstance, GET_NPOBJECT_CLASS (ScriptablePluginObject));
+ }
- if (mScriptableObject) {
- NPN_RetainObject (mScriptableObject);
- }
+ if (mScriptableObject) {
+ NPN_RetainObject (mScriptableObject);
+ }
- return mScriptableObject;
+ return mScriptableObject;
}
void
Plugin::UpdateSizingMode ()
{
- EvSizingMode sizingMode;
-
- g_signal_handlers_disconnect_by_func (
- mView, (gpointer)ev_view_update_view_size, mScrolledWindow);
-
- g_object_get (G_OBJECT (mView),
- "sizing-mode", &sizingMode,
- NULL);
-
- if (sizingMode != EV_SIZING_FREE)
- ev_view_update_view_size (EV_VIEW (mView),
- GTK_SCROLLED_WINDOW (mScrolledWindow));
-
- switch (sizingMode) {
- case EV_SIZING_BEST_FIT:
- case EV_SIZING_FIT_WIDTH:
- g_object_set (G_OBJECT (mScrolledWindow),
- "hscrollbar-policy", GTK_POLICY_NEVER,
- "vscrollbar-policy", GTK_POLICY_ALWAYS,
- NULL);
- g_signal_connect (mView, "zoom_invalid",
- G_CALLBACK (ev_view_update_view_size),
- mScrolledWindow);
- break;
-
- case EV_SIZING_FREE:
- g_object_set (G_OBJECT (mScrolledWindow),
- "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- NULL);
- break;
- }
+ EvSizingMode sizingMode;
+
+ g_signal_handlers_disconnect_by_func (
+ mView, (gpointer)ev_view_update_view_size, mScrolledWindow);
+
+ g_object_get (G_OBJECT (mView),
+ "sizing-mode", &sizingMode,
+ NULL);
+
+ if (sizingMode != EV_SIZING_FREE)
+ ev_view_update_view_size (EV_VIEW (mView),
+ GTK_SCROLLED_WINDOW (mScrolledWindow));
+
+ switch (sizingMode) {
+ case EV_SIZING_BEST_FIT:
+ case EV_SIZING_FIT_WIDTH:
+ g_object_set (G_OBJECT (mScrolledWindow),
+ "hscrollbar-policy", GTK_POLICY_NEVER,
+ "vscrollbar-policy", GTK_POLICY_ALWAYS,
+ NULL);
+ g_signal_connect (mView, "zoom_invalid",
+ G_CALLBACK (ev_view_update_view_size),
+ mScrolledWindow);
+ break;
+
+ case EV_SIZING_FREE:
+ g_object_set (G_OBJECT (mScrolledWindow),
+ "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ NULL);
+ break;
+ }
}
void
Plugin::SizingModeCallback (EvView *view, GParamSpec *pspec, gpointer data)
{
- Plugin *plugin = reinterpret_cast<Plugin*> (data);
- plugin->UpdateSizingMode ();
+ Plugin *plugin = reinterpret_cast<Plugin*> (data);
+ plugin->UpdateSizingMode ();
}