Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
21a65cbe
Commit
21a65cbe
authored
Feb 07, 2012
by
Moritz Lipp
Browse files
Rename PageViewWidget to PageWidget
parent
76323a4c
Changes
10
Hide whitespace changes
Inline
Side-by-side
callbacks.c
View file @
21a65cbe
...
...
@@ -14,7 +14,7 @@
#include "document.h"
#include "utils.h"
#include "shortcuts.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
gboolean
cb_destroy
(
GtkWidget
*
UNUSED
(
widget
),
gpointer
UNUSED
(
data
))
...
...
@@ -45,7 +45,7 @@ void
cb_view_vadjustment_value_changed
(
GtkAdjustment
*
GIRARA_UNUSED
(
adjustment
),
gpointer
data
)
{
zathura_t
*
zathura
=
data
;
if
(
!
zathura
||
!
zathura
->
document
||
!
zathura
->
document
->
pages
||
!
zathura
->
ui
.
page_
view
)
{
if
(
!
zathura
||
!
zathura
->
document
||
!
zathura
->
document
->
pages
||
!
zathura
->
ui
.
page_
widget
)
{
return
;
}
...
...
@@ -108,7 +108,7 @@ cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UN
pages_per_row
=
1
;
}
page_
view
_set_mode
(
zathura
,
pages_per_row
);
page_
widget
_set_mode
(
zathura
,
pages_per_row
);
}
void
...
...
@@ -179,7 +179,7 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session)
g_object_set
(
page
->
drawing_area
,
"draw-links"
,
FALSE
,
NULL
);
zathura_link_t
*
link
=
zathura_page_
view
_link_get
(
ZATHURA_PAGE
_VIEW
(
page
->
drawing_area
),
index
);
zathura_link_t
*
link
=
zathura_page_
widget
_link_get
(
ZATHURA_PAGE
(
page
->
drawing_area
),
index
);
if
(
link
!=
NULL
)
{
switch
(
link
->
type
)
{
case
ZATHURA_LINK_TO_PAGE
:
...
...
commands.c
View file @
21a65cbe
...
...
@@ -10,7 +10,7 @@
#include "print.h"
#include "document.h"
#include "utils.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
#include <girara/session.h>
...
...
document.c
View file @
21a65cbe
...
...
@@ -23,7 +23,7 @@
#include "zathura.h"
#include "render.h"
#include "database.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
#include <girara/datastructures.h>
#include <girara/utils.h>
...
...
@@ -433,7 +433,7 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id)
if
(
page
!=
NULL
)
{
page
->
number
=
page_id
;
page
->
visible
=
false
;
page
->
drawing_area
=
zathura_page_
view
_new
(
page
);
page
->
drawing_area
=
zathura_page_
widget
_new
(
page
);
page
->
document
=
document
;
gtk_widget_set_size_request
(
page
->
drawing_area
,
page
->
width
*
document
->
scale
,
page
->
height
*
document
->
scale
);
...
...
page_
view_
widget.c
→
page_widget.c
View file @
21a65cbe
/* See LICENSE file for license and copyright information */
#include "page_
view_
widget.h"
#include "page_widget.h"
#include "render.h"
#include "utils.h"
#include <girara/utils.h>
#include <girara/settings.h>
#include <girara/datastructures.h>
G_DEFINE_TYPE
(
ZathuraPage
View
,
zathura_page_
view
,
GTK_TYPE_DRAWING_AREA
)
G_DEFINE_TYPE
(
ZathuraPage
,
zathura_page_
widget
,
GTK_TYPE_DRAWING_AREA
)
typedef
struct
zathura_page_
view
_private_s
{
typedef
struct
zathura_page_
widget
_private_s
{
zathura_page_t
*
page
;
zathura_t
*
zathura
;
cairo_surface_t
*
surface
;
/** Cairo surface */
...
...
@@ -20,18 +20,18 @@ typedef struct zathura_page_view_private_s {
girara_list_t
*
search_results
;
/** True if search results should be drawn */
unsigned
int
link_offset
;
/**< Offset to the links */
unsigned
int
number_of_links
;
/**< Offset to the links */
}
zathura_page_
view
_private_t
;
}
zathura_page_
widget
_private_t
;
#define ZATHURA_PAGE_
VIEW_
GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PAGE
_VIEW
, zathura_page_
view
_private_t))
#define ZATHURA_PAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PAGE, zathura_page_
widget
_private_t))
static
gboolean
zathura_page_
view
_expose
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
);
static
void
zathura_page_
view
_finalize
(
GObject
*
object
);
static
void
zathura_page_
view
_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
view
_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
view
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
);
static
void
redraw_rect
(
ZathuraPage
View
*
widget
,
zathura_rectangle_t
*
rectangle
);
static
void
redraw_all_rects
(
ZathuraPage
View
*
widget
,
girara_list_t
*
rectangles
);
static
gboolean
zathura_page_
widget
_expose
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
);
static
void
zathura_page_
widget
_finalize
(
GObject
*
object
);
static
void
zathura_page_
widget
_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
widget
_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
widget
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
);
static
void
redraw_rect
(
ZathuraPage
*
widget
,
zathura_rectangle_t
*
rectangle
);
static
void
redraw_all_rects
(
ZathuraPage
*
widget
,
girara_list_t
*
rectangles
);
enum
properties_e
{
...
...
@@ -44,20 +44,20 @@ enum properties_e
};
static
void
zathura_page_
view
_class_init
(
ZathuraPage
View
Class
*
class
)
zathura_page_
widget
_class_init
(
ZathuraPageClass
*
class
)
{
/* add private members */
g_type_class_add_private
(
class
,
sizeof
(
zathura_page_
view
_private_t
));
g_type_class_add_private
(
class
,
sizeof
(
zathura_page_
widget
_private_t
));
/* overwrite methods */
GtkWidgetClass
*
widget_class
=
GTK_WIDGET_CLASS
(
class
);
widget_class
->
expose_event
=
zathura_page_
view
_expose
;
widget_class
->
size_allocate
=
zathura_page_
view
_size_allocate
;
widget_class
->
expose_event
=
zathura_page_
widget
_expose
;
widget_class
->
size_allocate
=
zathura_page_
widget
_size_allocate
;
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
class
);
object_class
->
finalize
=
zathura_page_
view
_finalize
;
object_class
->
set_property
=
zathura_page_
view
_set_property
;
object_class
->
get_property
=
zathura_page_
view
_get_property
;
object_class
->
finalize
=
zathura_page_
widget
_finalize
;
object_class
->
set_property
=
zathura_page_
widget
_set_property
;
object_class
->
get_property
=
zathura_page_
widget
_get_property
;
/* add properties */
g_object_class_install_property
(
object_class
,
PROP_PAGE
,
...
...
@@ -73,9 +73,9 @@ zathura_page_view_class_init(ZathuraPageViewClass* class)
}
static
void
zathura_page_
view
_init
(
ZathuraPage
View
*
widget
)
zathura_page_
widget
_init
(
ZathuraPage
*
widget
)
{
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
priv
->
page
=
NULL
;
priv
->
surface
=
NULL
;
priv
->
links
=
NULL
;
...
...
@@ -91,32 +91,32 @@ zathura_page_view_init(ZathuraPageView* widget)
}
GtkWidget
*
zathura_page_
view
_new
(
zathura_page_t
*
page
)
zathura_page_
widget
_new
(
zathura_page_t
*
page
)
{
g_return_val_if_fail
(
page
!=
NULL
,
NULL
);
return
g_object_new
(
ZATHURA_TYPE_PAGE
_VIEW
,
"page"
,
page
,
NULL
);
return
g_object_new
(
ZATHURA_TYPE_PAGE
,
"page"
,
page
,
NULL
);
}
static
void
zathura_page_
view
_finalize
(
GObject
*
object
)
zathura_page_
widget
_finalize
(
GObject
*
object
)
{
ZathuraPage
View
*
widget
=
ZATHURA_PAGE
_VIEW
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
ZathuraPage
*
widget
=
ZATHURA_PAGE
(
object
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
if
(
priv
->
surface
)
{
cairo_surface_destroy
(
priv
->
surface
);
}
g_static_mutex_free
(
&
(
priv
->
lock
));
girara_list_free
(
priv
->
links
);
G_OBJECT_CLASS
(
zathura_page_
view
_parent_class
)
->
finalize
(
object
);
G_OBJECT_CLASS
(
zathura_page_
widget
_parent_class
)
->
finalize
(
object
);
}
static
void
zathura_page_
view
_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
zathura_page_
widget
_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
ZathuraPage
View
*
pageview
=
ZATHURA_PAGE
_VIEW
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
pageview
);
ZathuraPage
*
pageview
=
ZATHURA_PAGE
(
object
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
pageview
);
switch
(
prop_id
)
{
case
PROP_PAGE
:
...
...
@@ -159,10 +159,10 @@ zathura_page_view_set_property(GObject* object, guint prop_id, const GValue* val
}
static
void
zathura_page_
view
_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
zathura_page_
widget
_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
ZathuraPage
View
*
pageview
=
ZATHURA_PAGE
_VIEW
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
pageview
);
ZathuraPage
*
pageview
=
ZATHURA_PAGE
(
object
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
pageview
);
switch
(
prop_id
)
{
case
PROP_LINKS_NUMBER
:
...
...
@@ -174,7 +174,7 @@ zathura_page_view_get_property(GObject* object, guint prop_id, GValue* value, GP
}
static
gboolean
zathura_page_
view
_expose
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
)
zathura_page_
widget
_expose
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
)
{
cairo_t
*
cairo
=
gdk_cairo_create
(
widget
->
window
);
if
(
cairo
==
NULL
)
{
...
...
@@ -186,7 +186,7 @@ zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* event)
cairo_rectangle
(
cairo
,
event
->
area
.
x
,
event
->
area
.
y
,
event
->
area
.
width
,
event
->
area
.
height
);
cairo_clip
(
cairo
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
g_static_mutex_lock
(
&
(
priv
->
lock
));
if
(
priv
->
surface
!=
NULL
)
{
cairo_save
(
cairo
);
...
...
@@ -299,16 +299,16 @@ zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* event)
}
static
void
zathura_page_
view
_redraw_canvas
(
ZathuraPage
View
*
pageview
)
zathura_page_
widget
_redraw_canvas
(
ZathuraPage
*
pageview
)
{
GtkWidget
*
widget
=
GTK_WIDGET
(
pageview
);
gtk_widget_queue_draw
(
widget
);
}
void
zathura_page_
view
_update_surface
(
ZathuraPage
View
*
widget
,
cairo_surface_t
*
surface
)
zathura_page_
widget
_update_surface
(
ZathuraPage
*
widget
,
cairo_surface_t
*
surface
)
{
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
g_static_mutex_lock
(
&
(
priv
->
lock
));
if
(
priv
->
surface
!=
NULL
)
{
cairo_surface_destroy
(
priv
->
surface
);
...
...
@@ -316,18 +316,18 @@ zathura_page_view_update_surface(ZathuraPageView* widget, cairo_surface_t* surfa
priv
->
surface
=
surface
;
g_static_mutex_unlock
(
&
(
priv
->
lock
));
/* force a redraw here */
zathura_page_
view
_redraw_canvas
(
widget
);
zathura_page_
widget
_redraw_canvas
(
widget
);
}
static
void
zathura_page_
view
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
)
zathura_page_
widget
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
)
{
GTK_WIDGET_CLASS
(
zathura_page_
view
_parent_class
)
->
size_allocate
(
widget
,
allocation
);
zathura_page_
view
_update_surface
(
ZATHURA_PAGE
_VIEW
(
widget
),
NULL
);
GTK_WIDGET_CLASS
(
zathura_page_
widget
_parent_class
)
->
size_allocate
(
widget
,
allocation
);
zathura_page_
widget
_update_surface
(
ZATHURA_PAGE
(
widget
),
NULL
);
}
static
void
redraw_rect
(
ZathuraPage
View
*
widget
,
zathura_rectangle_t
*
rectangle
)
redraw_rect
(
ZathuraPage
*
widget
,
zathura_rectangle_t
*
rectangle
)
{
/* cause the rect to be drawn */
GdkRectangle
grect
;
...
...
@@ -339,9 +339,9 @@ redraw_rect(ZathuraPageView* widget, zathura_rectangle_t* rectangle)
}
static
void
redraw_all_rects
(
ZathuraPage
View
*
widget
,
girara_list_t
*
rectangles
)
redraw_all_rects
(
ZathuraPage
*
widget
,
girara_list_t
*
rectangles
)
{
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
GIRARA_LIST_FOREACH
(
rectangles
,
zathura_rectangle_t
*
,
iter
,
rect
)
zathura_rectangle_t
rectangle
=
recalc_rectangle
(
priv
->
page
,
*
rect
);
...
...
@@ -350,10 +350,10 @@ redraw_all_rects(ZathuraPageView* widget, girara_list_t* rectangles)
}
zathura_link_t
*
zathura_page_
view
_link_get
(
ZathuraPage
View
*
widget
,
unsigned
int
index
)
zathura_page_
widget
_link_get
(
ZathuraPage
*
widget
,
unsigned
int
index
)
{
g_return_val_if_fail
(
widget
!=
NULL
,
NULL
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
g_return_val_if_fail
(
priv
!=
NULL
,
NULL
);
if
(
priv
->
links
!=
NULL
&&
index
>=
priv
->
link_offset
&&
...
...
page_
view_
widget.h
→
page_widget.h
View file @
21a65cbe
/* See LICENSE file for license and copyright information */
#ifndef PAGE_
VIEW_
WIDGET_H
#define PAGE_
VIEW_
WIDGET_H
#ifndef PAGE_WIDGET_H
#define PAGE_WIDGET_H
#include <gtk/gtk.h>
#include "document.h"
...
...
@@ -14,60 +14,60 @@
* Before the properties contain the correct values, 'draw-links' has to be set
* to TRUE at least one time.
* */
typedef
struct
zathura_page_
view
_s
ZathuraPage
View
;
typedef
struct
zathura_page_
view
_class_s
ZathuraPage
View
Class
;
typedef
struct
zathura_page_
widget
_s
ZathuraPage
;
typedef
struct
zathura_page_
widget
_class_s
ZathuraPageClass
;
struct
zathura_page_
view
_s
{
struct
zathura_page_
widget
_s
{
GtkDrawingArea
parent
;
};
struct
zathura_page_
view
_class_s
{
struct
zathura_page_
widget
_class_s
{
GtkDrawingAreaClass
parent_class
;
};
#define ZATHURA_TYPE_PAGE
_VIEW
\
(zathura_page_
view
_get_type ())
#define ZATHURA_PAGE
_VIEW
(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ZATHURA_TYPE_PAGE
_VIEW
, ZathuraPage
View
))
#define ZATHURA_PAGE_
VIEW_
CLASS(obj) \
(G_TYPE_CHECK_CLASS_CAST ((obj), ZATHURA_PAGE
_VIEW
, ZathuraPage
View
Class))
#define ZATHURA_IS_PAGE
_VIEW
(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZATHURA_PAGE
_VIEW
))
#define ZATHURA_IS_PAGE_
VIEW_
WDIGET_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE ((obj), ZATHURA_TYPE_PAGE
_VIEW
))
#define ZATHURA_PAGE_
VIEW_
GET_CLASS \
(G_TYPE_INSTANCE_GET_CLASS ((obj), ZATHURA_TYPE_PAGE
_VIEW
, ZathuraPage
View
class))
#define ZATHURA_TYPE_PAGE \
(zathura_page_
widget
_get_type ())
#define ZATHURA_PAGE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ZATHURA_TYPE_PAGE, ZathuraPage))
#define ZATHURA_PAGE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_CAST ((obj), ZATHURA_PAGE, ZathuraPageClass))
#define ZATHURA_IS_PAGE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZATHURA_PAGE))
#define ZATHURA_IS_PAGE_WDIGET_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE ((obj), ZATHURA_TYPE_PAGE))
#define ZATHURA_PAGE_GET_CLASS \
(G_TYPE_INSTANCE_GET_CLASS ((obj), ZATHURA_TYPE_PAGE, ZathuraPageclass))
/**
* Returns the type of the page view widget.
* @return the type
*/
GType
zathura_page_
view
_get_type
(
void
);
GType
zathura_page_
widget
_get_type
(
void
);
/**
* Create a page view widget.
* @param page the page to be displayed
* @return a page view widget
*/
GtkWidget
*
zathura_page_
view
_new
(
zathura_page_t
*
page
);
GtkWidget
*
zathura_page_
widget
_new
(
zathura_page_t
*
page
);
/**
* Update the widget's surface. This should only be called from the render
* thread.
* @param widget the widget
* @param surface the new surface
*/
void
zathura_page_
view
_update_surface
(
ZathuraPage
View
*
widget
,
cairo_surface_t
*
surface
);
void
zathura_page_
widget
_update_surface
(
ZathuraPage
*
widget
,
cairo_surface_t
*
surface
);
/**
* Draw a rectangle to mark links or search results
* @param widget the widget
* @param rectangle the rectangle
* @param linkid the link id if it's a link, -1 otherwise
*/
void
zathura_page_
view
_draw_rectangle
(
ZathuraPage
View
*
widget
,
zathura_rectangle_t
*
rectangle
,
int
linkid
);
void
zathura_page_
widget
_draw_rectangle
(
ZathuraPage
*
widget
,
zathura_rectangle_t
*
rectangle
,
int
linkid
);
/**
* Clear all rectangles.
* @param widget the widget
*/
void
zathura_page_
view
_clear_rectangles
(
ZathuraPage
View
*
widget
);
void
zathura_page_
widget
_clear_rectangles
(
ZathuraPage
*
widget
);
/**
* Returns the zathura link object at the given index
...
...
@@ -76,6 +76,6 @@ void zathura_page_view_clear_rectangles(ZathuraPageView* widget);
* @param index Index of the link
* @return Link object or NULL if an error occured
*/
zathura_link_t
*
zathura_page_
view
_link_get
(
ZathuraPage
View
*
widget
,
unsigned
int
index
);
zathura_link_t
*
zathura_page_
widget
_link_get
(
ZathuraPage
*
widget
,
unsigned
int
index
);
#endif
render.c
View file @
21a65cbe
...
...
@@ -9,7 +9,7 @@
#include "render.h"
#include "zathura.h"
#include "document.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
void
*
render_job
(
void
*
data
);
bool
render
(
zathura_t
*
zathura
,
zathura_page_t
*
page
);
...
...
@@ -241,7 +241,7 @@ render(zathura_t* zathura, zathura_page_t* page)
}
/* update the widget */
zathura_page_
view
_update_surface
(
ZATHURA_PAGE
_VIEW
(
page
->
drawing_area
),
surface
);
zathura_page_
widget
_update_surface
(
ZATHURA_PAGE
(
page
->
drawing_area
),
surface
);
gdk_threads_leave
();
...
...
shortcuts.c
View file @
21a65cbe
...
...
@@ -13,7 +13,7 @@
#include "zathura.h"
#include "render.h"
#include "utils.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
bool
sc_abort
(
girara_session_t
*
session
,
girara_argument_t
*
UNUSED
(
argument
),
...
...
@@ -51,7 +51,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
unsigned
int
pages_per_row
=
1
;
girara_setting_get
(
session
,
"pages-per-row"
,
&
pages_per_row
);
if
(
zathura
->
ui
.
page_
view
==
NULL
||
zathura
->
document
==
NULL
)
{
if
(
zathura
->
ui
.
page_
widget
==
NULL
||
zathura
->
document
==
NULL
)
{
goto
error_ret
;
}
...
...
@@ -530,7 +530,7 @@ sc_toggle_index(girara_session_t* session, girara_argument_t* UNUSED(argument),
}
if
(
gtk_widget_get_visible
(
GTK_WIDGET
(
zathura
->
ui
.
index
)))
{
girara_set_view
(
session
,
zathura
->
ui
.
page_
view
_alignment
);
girara_set_view
(
session
,
zathura
->
ui
.
page_
widget
_alignment
);
gtk_widget_hide
(
GTK_WIDGET
(
zathura
->
ui
.
index
));
girara_mode_set
(
zathura
->
ui
.
session
,
zathura
->
modes
.
normal
);
}
else
{
...
...
utils.c
View file @
21a65cbe
...
...
@@ -186,7 +186,7 @@ page_calculate_offset(zathura_page_t* page, page_offset_t* offset)
zathura_t
*
zathura
=
document
->
zathura
;
g_return_if_fail
(
gtk_widget_translate_coordinates
(
page
->
drawing_area
,
zathura
->
ui
.
page_
view
,
0
,
0
,
&
(
offset
->
x
),
&
(
offset
->
y
))
==
true
);
zathura
->
ui
.
page_
widget
,
0
,
0
,
&
(
offset
->
x
),
&
(
offset
->
y
))
==
true
);
}
zathura_rectangle_t
...
...
zathura.c
View file @
21a65cbe
...
...
@@ -126,7 +126,7 @@ zathura_init(int argc, char* argv[])
zathura
->
ui
.
statusbar
.
file
=
NULL
;
zathura
->
ui
.
statusbar
.
buffer
=
NULL
;
zathura
->
ui
.
statusbar
.
page_number
=
NULL
;
zathura
->
ui
.
page_
view
=
NULL
;
zathura
->
ui
.
page_
widget
=
NULL
;
zathura
->
ui
.
index
=
NULL
;
/* print settings */
...
...
@@ -170,8 +170,8 @@ zathura_init(int argc, char* argv[])
zathura
->
ui
.
session
->
events
.
buffer_changed
=
buffer_changed
;
/* page view */
zathura
->
ui
.
page_
view
=
gtk_table_new
(
0
,
0
,
TRUE
);
if
(
!
zathura
->
ui
.
page_
view
)
{
zathura
->
ui
.
page_
widget
=
gtk_table_new
(
0
,
0
,
TRUE
);
if
(
!
zathura
->
ui
.
page_
widget
)
{
goto
error_free
;
}
...
...
@@ -182,13 +182,13 @@ zathura_init(int argc, char* argv[])
g_signal_connect
(
G_OBJECT
(
view_hadjustment
),
"value-changed"
,
G_CALLBACK
(
cb_view_vadjustment_value_changed
),
zathura
);
/* page view alignment */
zathura
->
ui
.
page_
view
_alignment
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
if
(
!
zathura
->
ui
.
page_
view
_alignment
)
{
zathura
->
ui
.
page_
widget
_alignment
=
gtk_alignment_new
(
0
.
5
,
0
.
5
,
0
,
0
);
if
(
!
zathura
->
ui
.
page_
widget
_alignment
)
{
goto
error_free
;
}
gtk_container_add
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
view
_alignment
),
zathura
->
ui
.
page_
view
);
gtk_container_add
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
widget
_alignment
),
zathura
->
ui
.
page_
widget
);
gtk_widget_show
(
zathura
->
ui
.
page_
view
);
gtk_widget_show
(
zathura
->
ui
.
page_
widget
);
/* statusbar */
zathura
->
ui
.
statusbar
.
file
=
girara_statusbar_item_add
(
zathura
->
ui
.
session
,
TRUE
,
TRUE
,
TRUE
,
NULL
);
...
...
@@ -215,8 +215,8 @@ zathura_init(int argc, char* argv[])
zathura
->
global
.
page_padding
=
1
;
girara_setting_get
(
zathura
->
ui
.
session
,
"page-padding"
,
&
zathura
->
global
.
page_padding
);
gtk_table_set_row_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_
view
),
zathura
->
global
.
page_padding
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_
view
),
zathura
->
global
.
page_padding
);
gtk_table_set_row_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_
widget
),
zathura
->
global
.
page_padding
);
gtk_table_set_col_spacings
(
GTK_TABLE
(
zathura
->
ui
.
page_
widget
),
zathura
->
global
.
page_padding
);
/* parse colors */
char
*
string_value
=
NULL
;
...
...
@@ -264,12 +264,12 @@ zathura_init(int argc, char* argv[])
error_free:
if
(
zathura
->
ui
.
page_
view
)
{
g_object_unref
(
zathura
->
ui
.
page_
view
);
if
(
zathura
->
ui
.
page_
widget
)
{
g_object_unref
(
zathura
->
ui
.
page_
widget
);
}
if
(
zathura
->
ui
.
page_
view
_alignment
)
{
g_object_unref
(
zathura
->
ui
.
page_
view
_alignment
);
if
(
zathura
->
ui
.
page_
widget
_alignment
)
{
g_object_unref
(
zathura
->
ui
.
page_
widget
_alignment
);
}
error_out:
...
...
@@ -424,9 +424,9 @@ document_open(zathura_t* zathura, const char* path, const char* password)
/* view mode */
int
pages_per_row
=
1
;
girara_setting_get
(
zathura
->
ui
.
session
,
"pages-per-row"
,
&
pages_per_row
);
page_
view
_set_mode
(
zathura
,
pages_per_row
);
page_
widget
_set_mode
(
zathura
,
pages_per_row
);
girara_set_view
(
zathura
->
ui
.
session
,
zathura
->
ui
.
page_
view
_alignment
);
girara_set_view
(
zathura
->
ui
.
session
,
zathura
->
ui
.
page_
widget
_alignment
);
/* threads */
zathura
->
sync
.
render_thread
=
render_init
(
zathura
);
...
...
@@ -504,12 +504,12 @@ document_close(zathura_t* zathura)
render_free
(
zathura
->
sync
.
render_thread
);
zathura
->
sync
.
render_thread
=
NULL
;
gtk_container_foreach
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
view
),
remove_page_from_table
,
(
gpointer
)
1
);
gtk_container_foreach
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
widget
),
remove_page_from_table
,
(
gpointer
)
1
);
zathura_document_free
(
zathura
->
document
);
zathura
->
document
=
NULL
;
gtk_widget_hide
(
zathura
->
ui
.
page_
view
);
gtk_widget_hide
(
zathura
->
ui
.
page_
widget
);
statusbar_page_number_update
(
zathura
);
...
...
@@ -601,7 +601,7 @@ statusbar_page_number_update(zathura_t* zathura)
}
void
page_
view
_set_mode
(
zathura_t
*
zathura
,
unsigned
int
pages_per_row
)
page_
widget
_set_mode
(
zathura_t
*
zathura
,
unsigned
int
pages_per_row
)
{
/* show at least one page */
if
(
pages_per_row
==
0
)
{
...
...
@@ -612,15 +612,15 @@ page_view_set_mode(zathura_t* zathura, unsigned int pages_per_row)
return
;
}
gtk_container_foreach
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
view
),
remove_page_from_table
,
(
gpointer
)
0
);
gtk_container_foreach
(
GTK_CONTAINER
(
zathura
->
ui
.
page_
widget
),
remove_page_from_table
,
(
gpointer
)
0
);
gtk_table_resize
(
GTK_TABLE
(
zathura
->
ui
.
page_
view
),
zathura
->
document
->
number_of_pages
/
pages_per_row
+
1
,
pages_per_row
);
gtk_table_resize
(
GTK_TABLE
(
zathura
->
ui
.
page_
widget
),
zathura
->
document
->
number_of_pages
/
pages_per_row
+
1
,
pages_per_row
);
for
(
unsigned
int
i
=
0
;
i
<
zathura
->
document
->
number_of_pages
;
i
++
)
{
int
x
=
i
%
pages_per_row
;
int
y
=
i
/
pages_per_row
;
gtk_table_attach
(
GTK_TABLE
(
zathura
->
ui
.
page_
view
),
zathura
->
document
->
pages
[
i
]
->
drawing_area
,
x
,
x
+
1
,
y
,
y
+
1
,
GTK_SHRINK
,
GTK_SHRINK
,
0
,
0
);
gtk_table_attach
(
GTK_TABLE
(
zathura
->
ui
.
page_
widget
),
zathura
->
document
->
pages
[
i
]
->
drawing_area
,
x
,
x
+
1
,
y
,
y
+
1
,
GTK_SHRINK
,
GTK_SHRINK
,
0
,
0
);
}
gtk_widget_show_all
(
zathura
->
ui
.
page_
view
);
gtk_widget_show_all
(
zathura
->
ui
.
page_
widget
);
}
zathura.h
View file @
21a65cbe
...
...
@@ -52,8 +52,8 @@ typedef struct zathura_s
GdkColor
highlight_color
;
/**< Color for highlighting */
}
colors
;
GtkWidget
*
page_
view
_alignment
;
GtkWidget
*
page_
view
;
/**< Widget that contains all rendered pages */
GtkWidget
*
page_
widget
_alignment
;
GtkWidget
*
page_
widget
;
/**< Widget that contains all rendered pages */
GtkWidget
*
index
;
/**< Widget to show the index of the document */
}
ui
;
...
...
@@ -178,7 +178,7 @@ bool page_set_delayed(zathura_t* zathura, unsigned int page_id);
* @param zathura The zathura session
* @param pages_per_row Number of shown pages per row
*/
void
page_
view
_set_mode
(
zathura_t
*
zathura
,
unsigned
int
pages_per_row
);
void
page_
widget
_set_mode
(
zathura_t
*
zathura
,
unsigned
int
pages_per_row
);
/**
* Updates the page number in the statusbar. Note that 1 will be added to the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment