Skip to content
GitLab
Menu
Projects
Groups
Snippets
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 @@
...
@@ -14,7 +14,7 @@
#include "document.h"
#include "document.h"
#include "utils.h"
#include "utils.h"
#include "shortcuts.h"
#include "shortcuts.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
gboolean
gboolean
cb_destroy
(
GtkWidget
*
UNUSED
(
widget
),
gpointer
UNUSED
(
data
))
cb_destroy
(
GtkWidget
*
UNUSED
(
widget
),
gpointer
UNUSED
(
data
))
...
@@ -45,7 +45,7 @@ void
...
@@ -45,7 +45,7 @@ void
cb_view_vadjustment_value_changed
(
GtkAdjustment
*
GIRARA_UNUSED
(
adjustment
),
gpointer
data
)
cb_view_vadjustment_value_changed
(
GtkAdjustment
*
GIRARA_UNUSED
(
adjustment
),
gpointer
data
)
{
{
zathura_t
*
zathura
=
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
;
return
;
}
}
...
@@ -108,7 +108,7 @@ cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UN
...
@@ -108,7 +108,7 @@ cb_pages_per_row_value_changed(girara_session_t* UNUSED(session), const char* UN
pages_per_row
=
1
;
pages_per_row
=
1
;
}
}
page_
view
_set_mode
(
zathura
,
pages_per_row
);
page_
widget
_set_mode
(
zathura
,
pages_per_row
);
}
}
void
void
...
@@ -179,7 +179,7 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session)
...
@@ -179,7 +179,7 @@ cb_sc_follow(GtkEntry* entry, girara_session_t* session)
g_object_set
(
page
->
drawing_area
,
"draw-links"
,
FALSE
,
NULL
);
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
)
{
if
(
link
!=
NULL
)
{
switch
(
link
->
type
)
{
switch
(
link
->
type
)
{
case
ZATHURA_LINK_TO_PAGE
:
case
ZATHURA_LINK_TO_PAGE
:
...
...
commands.c
View file @
21a65cbe
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include "print.h"
#include "print.h"
#include "document.h"
#include "document.h"
#include "utils.h"
#include "utils.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
#include <girara/session.h>
#include <girara/session.h>
...
...
document.c
View file @
21a65cbe
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#include "zathura.h"
#include "zathura.h"
#include "render.h"
#include "render.h"
#include "database.h"
#include "database.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
#include <girara/datastructures.h>
#include <girara/datastructures.h>
#include <girara/utils.h>
#include <girara/utils.h>
...
@@ -433,7 +433,7 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id)
...
@@ -433,7 +433,7 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id)
if
(
page
!=
NULL
)
{
if
(
page
!=
NULL
)
{
page
->
number
=
page_id
;
page
->
number
=
page_id
;
page
->
visible
=
false
;
page
->
visible
=
false
;
page
->
drawing_area
=
zathura_page_
view
_new
(
page
);
page
->
drawing_area
=
zathura_page_
widget
_new
(
page
);
page
->
document
=
document
;
page
->
document
=
document
;
gtk_widget_set_size_request
(
page
->
drawing_area
,
page
->
width
*
document
->
scale
,
page
->
height
*
document
->
scale
);
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 */
/* See LICENSE file for license and copyright information */
#include "page_
view_
widget.h"
#include "page_widget.h"
#include "render.h"
#include "render.h"
#include "utils.h"
#include "utils.h"
#include <girara/utils.h>
#include <girara/utils.h>
#include <girara/settings.h>
#include <girara/settings.h>
#include <girara/datastructures.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_page_t
*
page
;
zathura_t
*
zathura
;
zathura_t
*
zathura
;
cairo_surface_t
*
surface
;
/** Cairo surface */
cairo_surface_t
*
surface
;
/** Cairo surface */
...
@@ -20,18 +20,18 @@ typedef struct zathura_page_view_private_s {
...
@@ -20,18 +20,18 @@ typedef struct zathura_page_view_private_s {
girara_list_t
*
search_results
;
/** True if search results should be drawn */
girara_list_t
*
search_results
;
/** True if search results should be drawn */
unsigned
int
link_offset
;
/**< Offset to the links */
unsigned
int
link_offset
;
/**< Offset to the links */
unsigned
int
number_of_links
;
/**< 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) \
#define ZATHURA_PAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZATHURA_TYPE_PAGE
_VIEW
, zathura_page_
view
_private_t))
(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
gboolean
zathura_page_
widget
_expose
(
GtkWidget
*
widget
,
GdkEventExpose
*
event
);
static
void
zathura_page_
view
_finalize
(
GObject
*
object
);
static
void
zathura_page_
widget
_finalize
(
GObject
*
object
);
static
void
zathura_page_
view
_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
widget
_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_
widget
_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
zathura_page_
view
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
);
static
void
zathura_page_
widget
_size_allocate
(
GtkWidget
*
widget
,
GdkRectangle
*
allocation
);
static
void
redraw_rect
(
ZathuraPage
View
*
widget
,
zathura_rectangle_t
*
rectangle
);
static
void
redraw_rect
(
ZathuraPage
*
widget
,
zathura_rectangle_t
*
rectangle
);
static
void
redraw_all_rects
(
ZathuraPage
View
*
widget
,
girara_list_t
*
rectangles
);
static
void
redraw_all_rects
(
ZathuraPage
*
widget
,
girara_list_t
*
rectangles
);
enum
properties_e
enum
properties_e
{
{
...
@@ -44,20 +44,20 @@ enum properties_e
...
@@ -44,20 +44,20 @@ enum properties_e
};
};
static
void
static
void
zathura_page_
view
_class_init
(
ZathuraPage
View
Class
*
class
)
zathura_page_
widget
_class_init
(
ZathuraPageClass
*
class
)
{
{
/* add private members */
/* 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 */
/* overwrite methods */
GtkWidgetClass
*
widget_class
=
GTK_WIDGET_CLASS
(
class
);
GtkWidgetClass
*
widget_class
=
GTK_WIDGET_CLASS
(
class
);
widget_class
->
expose_event
=
zathura_page_
view
_expose
;
widget_class
->
expose_event
=
zathura_page_
widget
_expose
;
widget_class
->
size_allocate
=
zathura_page_
view
_size_allocate
;
widget_class
->
size_allocate
=
zathura_page_
widget
_size_allocate
;
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
class
);
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
class
);
object_class
->
finalize
=
zathura_page_
view
_finalize
;
object_class
->
finalize
=
zathura_page_
widget
_finalize
;
object_class
->
set_property
=
zathura_page_
view
_set_property
;
object_class
->
set_property
=
zathura_page_
widget
_set_property
;
object_class
->
get_property
=
zathura_page_
view
_get_property
;
object_class
->
get_property
=
zathura_page_
widget
_get_property
;
/* add properties */
/* add properties */
g_object_class_install_property
(
object_class
,
PROP_PAGE
,
g_object_class_install_property
(
object_class
,
PROP_PAGE
,
...
@@ -73,9 +73,9 @@ zathura_page_view_class_init(ZathuraPageViewClass* class)
...
@@ -73,9 +73,9 @@ zathura_page_view_class_init(ZathuraPageViewClass* class)
}
}
static
void
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
->
page
=
NULL
;
priv
->
surface
=
NULL
;
priv
->
surface
=
NULL
;
priv
->
links
=
NULL
;
priv
->
links
=
NULL
;
...
@@ -91,32 +91,32 @@ zathura_page_view_init(ZathuraPageView* widget)
...
@@ -91,32 +91,32 @@ zathura_page_view_init(ZathuraPageView* widget)
}
}
GtkWidget
*
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
);
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
static
void
zathura_page_
view
_finalize
(
GObject
*
object
)
zathura_page_
widget
_finalize
(
GObject
*
object
)
{
{
ZathuraPage
View
*
widget
=
ZATHURA_PAGE
_VIEW
(
object
);
ZathuraPage
*
widget
=
ZATHURA_PAGE
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
widget
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
widget
);
if
(
priv
->
surface
)
{
if
(
priv
->
surface
)
{
cairo_surface_destroy
(
priv
->
surface
);
cairo_surface_destroy
(
priv
->
surface
);
}
}
g_static_mutex_free
(
&
(
priv
->
lock
));
g_static_mutex_free
(
&
(
priv
->
lock
));
girara_list_free
(
priv
->
links
);
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
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
);
ZathuraPage
*
pageview
=
ZATHURA_PAGE
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
pageview
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
pageview
);
switch
(
prop_id
)
{
switch
(
prop_id
)
{
case
PROP_PAGE
:
case
PROP_PAGE
:
...
@@ -159,10 +159,10 @@ zathura_page_view_set_property(GObject* object, guint prop_id, const GValue* val
...
@@ -159,10 +159,10 @@ zathura_page_view_set_property(GObject* object, guint prop_id, const GValue* val
}
}
static
void
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
);
ZathuraPage
*
pageview
=
ZATHURA_PAGE
(
object
);
zathura_page_
view
_private_t
*
priv
=
ZATHURA_PAGE_
VIEW_
GET_PRIVATE
(
pageview
);
zathura_page_
widget
_private_t
*
priv
=
ZATHURA_PAGE_GET_PRIVATE
(
pageview
);
switch
(
prop_id
)
{
switch
(
prop_id
)
{
case
PROP_LINKS_NUMBER
:
case
PROP_LINKS_NUMBER
:
...
@@ -174,7 +174,7 @@ zathura_page_view_get_property(GObject* object, guint prop_id, GValue* value, GP
...
@@ -174,7 +174,7 @@ zathura_page_view_get_property(GObject* object, guint prop_id, GValue* value, GP
}
}
static
gboolean
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
);
cairo_t
*
cairo
=
gdk_cairo_create
(
widget
->
window
);
if
(
cairo
==
NULL
)
{
if
(
cairo
==
NULL
)
{
...
@@ -186,7 +186,7 @@ zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* event)
...
@@ -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_rectangle
(
cairo
,
event
->
area
.
x
,
event
->
area
.
y
,
event
->
area
.
width
,
event
->
area
.
height
);
cairo_clip
(
cairo
);
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
));
g_static_mutex_lock
(
&
(
priv
->
lock
));
if
(
priv
->
surface
!=
NULL
)
{
if
(
priv
->
surface
!=
NULL
)
{
cairo_save
(
cairo
);
cairo_save
(
cairo
);
...
@@ -299,16 +299,16 @@ zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* event)
...
@@ -299,16 +299,16 @@ zathura_page_view_expose(GtkWidget* widget, GdkEventExpose* event)
}
}
static
void
static
void
zathura_page_
view
_redraw_canvas
(
ZathuraPage
View
*
pageview
)
zathura_page_
widget
_redraw_canvas
(
ZathuraPage
*
pageview
)
{
{
GtkWidget
*
widget
=
GTK_WIDGET
(
pageview
);
GtkWidget
*
widget
=
GTK_WIDGET
(
pageview
);
gtk_widget_queue_draw
(
widget
);
gtk_widget_queue_draw
(
widget
);
}
}
void
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
));
g_static_mutex_lock
(
&
(
priv
->
lock
));
if
(
priv
->
surface
!=
NULL
)
{
if
(
priv
->
surface
!=
NULL
)
{
cairo_surface_destroy
(
priv
->
surface
);
cairo_surface_destroy
(
priv
->
surface
);
...
@@ -316,18 +316,18 @@ zathura_page_view_update_surface(ZathuraPageView* widget, cairo_surface_t* surfa
...
@@ -316,18 +316,18 @@ zathura_page_view_update_surface(ZathuraPageView* widget, cairo_surface_t* surfa
priv
->
surface
=
surface
;
priv
->
surface
=
surface
;
g_static_mutex_unlock
(
&
(
priv
->
lock
));
g_static_mutex_unlock
(
&
(
priv
->
lock
));
/* force a redraw here */
/* force a redraw here */
zathura_page_
view
_redraw_canvas
(
widget
);
zathura_page_
widget
_redraw_canvas
(
widget
);
}
}
static
void
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
);
GTK_WIDGET_CLASS
(
zathura_page_
widget
_parent_class
)
->
size_allocate
(
widget
,
allocation
);
zathura_page_
view
_update_surface
(
ZATHURA_PAGE
_VIEW
(
widget
),
NULL
);
zathura_page_
widget
_update_surface
(
ZATHURA_PAGE
(
widget
),
NULL
);
}
}
static
void
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 */
/* cause the rect to be drawn */
GdkRectangle
grect
;
GdkRectangle
grect
;
...
@@ -339,9 +339,9 @@ redraw_rect(ZathuraPageView* widget, zathura_rectangle_t* rectangle)
...
@@ -339,9 +339,9 @@ redraw_rect(ZathuraPageView* widget, zathura_rectangle_t* rectangle)
}
}
static
void
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
)
GIRARA_LIST_FOREACH
(
rectangles
,
zathura_rectangle_t
*
,
iter
,
rect
)
zathura_rectangle_t
rectangle
=
recalc_rectangle
(
priv
->
page
,
*
rect
);
zathura_rectangle_t
rectangle
=
recalc_rectangle
(
priv
->
page
,
*
rect
);
...
@@ -350,10 +350,10 @@ redraw_all_rects(ZathuraPageView* widget, girara_list_t* rectangles)
...
@@ -350,10 +350,10 @@ redraw_all_rects(ZathuraPageView* widget, girara_list_t* rectangles)
}
}
zathura_link_t
*
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
);
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
);
g_return_val_if_fail
(
priv
!=
NULL
,
NULL
);
if
(
priv
->
links
!=
NULL
&&
index
>=
priv
->
link_offset
&&
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 */
/* See LICENSE file for license and copyright information */
#ifndef PAGE_
VIEW_
WIDGET_H
#ifndef PAGE_WIDGET_H
#define PAGE_
VIEW_
WIDGET_H
#define PAGE_WIDGET_H
#include <gtk/gtk.h>
#include <gtk/gtk.h>
#include "document.h"
#include "document.h"
...
@@ -14,60 +14,60 @@
...
@@ -14,60 +14,60 @@
* Before the properties contain the correct values, 'draw-links' has to be set
* Before the properties contain the correct values, 'draw-links' has to be set
* to TRUE at least one time.
* to TRUE at least one time.
* */
* */
typedef
struct
zathura_page_
view
_s
ZathuraPage
View
;
typedef
struct
zathura_page_
widget
_s
ZathuraPage
;
typedef
struct
zathura_page_
view
_class_s
ZathuraPage
View
Class
;
typedef
struct
zathura_page_
widget
_class_s
ZathuraPageClass
;
struct
zathura_page_
view
_s
{
struct
zathura_page_
widget
_s
{
GtkDrawingArea
parent
;
GtkDrawingArea
parent
;
};
};
struct
zathura_page_
view
_class_s
{
struct
zathura_page_
widget
_class_s
{
GtkDrawingAreaClass
parent_class
;
GtkDrawingAreaClass
parent_class
;
};
};
#define ZATHURA_TYPE_PAGE
_VIEW
\
#define ZATHURA_TYPE_PAGE \
(zathura_page_
view
_get_type ())
(zathura_page_
widget
_get_type ())
#define ZATHURA_PAGE
_VIEW
(obj) \
#define ZATHURA_PAGE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ZATHURA_TYPE_PAGE
_VIEW
, ZathuraPage
View
))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ZATHURA_TYPE_PAGE, ZathuraPage))
#define ZATHURA_PAGE_
VIEW_
CLASS(obj) \
#define ZATHURA_PAGE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_CAST ((obj), ZATHURA_PAGE
_VIEW
, ZathuraPage
View
Class))
(G_TYPE_CHECK_CLASS_CAST ((obj), ZATHURA_PAGE, ZathuraPageClass))
#define ZATHURA_IS_PAGE
_VIEW
(obj) \
#define ZATHURA_IS_PAGE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZATHURA_PAGE
_VIEW
))
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZATHURA_PAGE))
#define ZATHURA_IS_PAGE_
VIEW_
WDIGET_CLASS(obj) \
#define ZATHURA_IS_PAGE_WDIGET_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE ((obj), ZATHURA_TYPE_PAGE
_VIEW
))
(G_TYPE_CHECK_CLASS_TYPE ((obj), ZATHURA_TYPE_PAGE))
#define ZATHURA_PAGE_
VIEW_
GET_CLASS \
#define ZATHURA_PAGE_GET_CLASS \
(G_TYPE_INSTANCE_GET_CLASS ((obj), ZATHURA_TYPE_PAGE
_VIEW
, ZathuraPage
View
class))
(G_TYPE_INSTANCE_GET_CLASS ((obj), ZATHURA_TYPE_PAGE, ZathuraPageclass))
/**
/**
* Returns the type of the page view widget.
* Returns the type of the page view widget.
* @return the type
* @return the type
*/
*/
GType
zathura_page_
view
_get_type
(
void
);
GType
zathura_page_
widget
_get_type
(
void
);
/**
/**
* Create a page view widget.
* Create a page view widget.
* @param page the page to be displayed
* @param page the page to be displayed
* @return a page view widget
* @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
* Update the widget's surface. This should only be called from the render
* thread.
* thread.
* @param widget the widget
* @param widget the widget
* @param surface the new surface
* @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
* Draw a rectangle to mark links or search results
* @param widget the widget
* @param widget the widget
* @param rectangle the rectangle
* @param rectangle the rectangle
* @param linkid the link id if it's a link, -1 otherwise
* @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.
* Clear all rectangles.
* @param widget the widget
* @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
* Returns the zathura link object at the given index
...
@@ -76,6 +76,6 @@ void zathura_page_view_clear_rectangles(ZathuraPageView* widget);
...
@@ -76,6 +76,6 @@ void zathura_page_view_clear_rectangles(ZathuraPageView* widget);
* @param index Index of the link
* @param index Index of the link
* @return Link object or NULL if an error occured
* @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
#endif
render.c
View file @
21a65cbe
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include "render.h"
#include "render.h"
#include "zathura.h"
#include "zathura.h"
#include "document.h"
#include "document.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
void
*
render_job
(
void
*
data
);
void
*
render_job
(
void
*
data
);
bool
render
(
zathura_t
*
zathura
,
zathura_page_t
*
page
);
bool
render
(
zathura_t
*
zathura
,
zathura_page_t
*
page
);
...
@@ -241,7 +241,7 @@ render(zathura_t* zathura, zathura_page_t* page)
...
@@ -241,7 +241,7 @@ render(zathura_t* zathura, zathura_page_t* page)
}
}
/* update the widget */
/* 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
();
gdk_threads_leave
();
...
...
shortcuts.c
View file @
21a65cbe
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
#include "zathura.h"
#include "zathura.h"
#include "render.h"
#include "render.h"
#include "utils.h"
#include "utils.h"
#include "page_
view_
widget.h"
#include "page_widget.h"
bool
bool
sc_abort
(
girara_session_t
*
session
,
girara_argument_t
*
UNUSED
(
argument
),
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,
...
@@ -51,7 +51,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
unsigned
int
pages_per_row
=
1
;
unsigned
int
pages_per_row
=
1
;
girara_setting_get
(
session
,
"pages-per-row"
,
&
pages_per_row
);
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
;
goto
error_ret
;
}
}
...
@@ -530,7 +530,7 @@ sc_toggle_index(girara_session_t* session, girara_argument_t* UNUSED(argument),
...
@@ -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
)))
{
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
));
gtk_widget_hide
(
GTK_WIDGET
(
zathura
->
ui
.
index
));
girara_mode_set
(
zathura
->
ui
.
session
,
zathura
->
modes
.
normal
);
girara_mode_set
(
zathura
->
ui
.
session
,
zathura
->
modes
.
normal
);
}
else
{
}
else
{
...
...
utils.c
View file @
21a65cbe
...
@@ -186,7 +186,7 @@ page_calculate_offset(zathura_page_t* page, page_offset_t* offset)
...
@@ -186,7 +186,7 @@ page_calculate_offset(zathura_page_t* page, page_offset_t* offset)
zathura_t
*
zathura
=
document
->
zathura
;
zathura_t
*
zathura
=
document
->
zathura
;
g_return_if_fail
(
gtk_widget_translate_coordinates
(
page
->
drawing_area
,
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
);
}
}