Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zathura
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
116
Issues
116
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwmt
zathura
Commits
2df776b3
Commit
2df776b3
authored
Sep 11, 2018
by
Naohiro Aota
Committed by
Sebastian Ramacher
Sep 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option for right-to-left layout (fixes #754)
parent
3d12dbc5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
4 deletions
+28
-4
zathura/callbacks.c
zathura/callbacks.c
+4
-1
zathura/config.c
zathura/config.c
+2
-0
zathura/database-plain.c
zathura/database-plain.c
+5
-0
zathura/database.h
zathura/database.h
+1
-0
zathura/zathura.c
zathura/zathura.c
+13
-2
zathura/zathura.h
zathura/zathura.h
+3
-1
No files found.
zathura/callbacks.c
View file @
2df776b3
...
...
@@ -329,7 +329,10 @@ cb_page_layout_value_changed(girara_session_t* session, const char* name, girara
unsigned
int
page_padding
=
1
;
girara_setting_get
(
zathura
->
ui
.
session
,
"page-padding"
,
&
page_padding
);
page_widget_set_mode
(
zathura
,
page_padding
,
pages_per_row
,
first_page_column
);
bool
page_right_to_left
=
false
;
girara_setting_get
(
zathura
->
ui
.
session
,
"page-right-to-left"
,
&
page_right_to_left
);
page_widget_set_mode
(
zathura
,
page_padding
,
pages_per_row
,
first_page_column
,
page_right_to_left
);
zathura_document_set_page_layout
(
zathura
->
document
,
page_padding
,
pages_per_row
,
first_page_column
);
}
...
...
zathura/config.c
View file @
2df776b3
...
...
@@ -191,6 +191,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add
(
gsession
,
"pages-per-row"
,
&
int_value
,
INT
,
false
,
_
(
"Number of pages per row"
),
cb_page_layout_value_changed
,
NULL
);
int_value
=
1
;
girara_setting_add
(
gsession
,
"first-page-column"
,
"1:2"
,
STRING
,
false
,
_
(
"Column of the first page"
),
cb_page_layout_value_changed
,
NULL
);
bool_value
=
false
;
girara_setting_add
(
gsession
,
"page-right-to-left"
,
&
bool_value
,
BOOLEAN
,
false
,
_
(
"Render pages from right to left"
),
cb_page_layout_value_changed
,
NULL
);
float_value
=
40
;
girara_setting_add
(
gsession
,
"scroll-step"
,
&
float_value
,
FLOAT
,
false
,
_
(
"Scroll step"
),
NULL
,
NULL
);
float_value
=
40
;
...
...
zathura/database-plain.c
View file @
2df776b3
...
...
@@ -27,6 +27,7 @@
#define KEY_ZOOM "zoom"
#define KEY_ROTATE "rotate"
#define KEY_PAGES_PER_ROW "pages-per-row"
#define KEY_PAGE_RIGHT_TO_LEFT "page-right-to-left"
#define KEY_FIRST_PAGE_COLUMN "first-page-column"
#define KEY_POSITION_X "position-x"
#define KEY_POSITION_Y "position-y"
...
...
@@ -560,6 +561,7 @@ plain_set_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
g_key_file_set_integer
(
priv
->
history
,
name
,
KEY_ROTATE
,
file_info
->
rotation
);
g_key_file_set_integer
(
priv
->
history
,
name
,
KEY_PAGES_PER_ROW
,
file_info
->
pages_per_row
);
g_key_file_set_string
(
priv
->
history
,
name
,
KEY_FIRST_PAGE_COLUMN
,
file_info
->
first_page_column_list
);
g_key_file_set_boolean
(
priv
->
history
,
name
,
KEY_PAGE_RIGHT_TO_LEFT
,
file_info
->
page_right_to_left
);
g_key_file_set_double
(
priv
->
history
,
name
,
KEY_POSITION_X
,
file_info
->
position_x
);
g_key_file_set_double
(
priv
->
history
,
name
,
KEY_POSITION_Y
,
file_info
->
position_y
);
g_key_file_set_integer
(
priv
->
history
,
name
,
KEY_TIME
,
time
(
NULL
));
...
...
@@ -603,6 +605,9 @@ plain_get_fileinfo(zathura_database_t* db, const char* file, zathura_fileinfo_t*
if
(
g_key_file_has_key
(
priv
->
history
,
name
,
KEY_FIRST_PAGE_COLUMN
,
NULL
)
==
TRUE
)
{
file_info
->
first_page_column_list
=
g_key_file_get_string
(
priv
->
history
,
name
,
KEY_FIRST_PAGE_COLUMN
,
NULL
);
}
if
(
g_key_file_has_key
(
priv
->
history
,
name
,
KEY_PAGE_RIGHT_TO_LEFT
,
NULL
)
==
TRUE
)
{
file_info
->
page_right_to_left
=
g_key_file_get_boolean
(
priv
->
history
,
name
,
KEY_PAGE_RIGHT_TO_LEFT
,
NULL
);
}
if
(
g_key_file_has_key
(
priv
->
history
,
name
,
KEY_POSITION_X
,
NULL
)
==
TRUE
)
{
file_info
->
position_x
=
g_key_file_get_double
(
priv
->
history
,
name
,
KEY_POSITION_X
,
NULL
);
}
...
...
zathura/database.h
View file @
2df776b3
...
...
@@ -15,6 +15,7 @@ typedef struct zathura_fileinfo_s {
double
zoom
;
unsigned
int
rotation
;
unsigned
int
pages_per_row
;
bool
page_right_to_left
;
char
*
first_page_column_list
;
double
position_x
;
double
position_y
;
...
...
zathura/zathura.c
View file @
2df776b3
...
...
@@ -980,6 +980,7 @@ document_open(zathura_t* zathura, const char* path, const char* uri, const char*
.
rotation
=
0
,
.
pages_per_row
=
0
,
.
first_page_column_list
=
NULL
,
.
page_right_to_left
=
false
,
.
position_x
=
0
,
.
position_y
=
0
};
...
...
@@ -1152,6 +1153,7 @@ document_open(zathura_t* zathura, const char* path, const char* uri, const char*
unsigned
int
pages_per_row
=
1
;
char
*
first_page_column_list
=
NULL
;
unsigned
int
page_padding
=
1
;
bool
page_right_to_left
=
false
;
girara_setting_get
(
zathura
->
ui
.
session
,
"page-padding"
,
&
page_padding
);
...
...
@@ -1177,7 +1179,9 @@ document_open(zathura_t* zathura, const char* path, const char* uri, const char*
g_free
(
file_info
.
first_page_column_list
);
g_free
(
first_page_column_list
);
page_widget_set_mode
(
zathura
,
page_padding
,
pages_per_row
,
first_page_column
);
page_right_to_left
=
file_info
.
page_right_to_left
;
page_widget_set_mode
(
zathura
,
page_padding
,
pages_per_row
,
first_page_column
,
page_right_to_left
);
zathura_document_set_page_layout
(
zathura
->
document
,
page_padding
,
pages_per_row
,
first_page_column
);
girara_set_view
(
zathura
->
ui
.
session
,
zathura
->
ui
.
page_widget
);
...
...
@@ -1341,6 +1345,7 @@ save_fileinfo_to_db(zathura_t* zathura)
.
rotation
=
zathura_document_get_rotation
(
zathura
->
document
),
.
pages_per_row
=
1
,
.
first_page_column_list
=
"1:2"
,
.
page_right_to_left
=
false
,
.
position_x
=
zathura_document_get_position_x
(
zathura
->
document
),
.
position_y
=
zathura_document_get_position_y
(
zathura
->
document
)
};
...
...
@@ -1349,6 +1354,8 @@ save_fileinfo_to_db(zathura_t* zathura)
&
(
file_info
.
pages_per_row
));
girara_setting_get
(
zathura
->
ui
.
session
,
"first-page-column"
,
&
(
file_info
.
first_page_column_list
));
girara_setting_get
(
zathura
->
ui
.
session
,
"page-right-to-left"
,
&
(
file_info
.
page_right_to_left
));
/* save file info */
zathura_db_set_fileinfo
(
zathura
->
database
,
path
,
&
file_info
);
...
...
@@ -1509,7 +1516,8 @@ statusbar_page_number_update(zathura_t* zathura)
void
page_widget_set_mode
(
zathura_t
*
zathura
,
unsigned
int
page_padding
,
unsigned
int
pages_per_row
,
unsigned
int
first_page_column
)
unsigned
int
pages_per_row
,
unsigned
int
first_page_column
,
bool
page_right_to_left
)
{
/* show at least one page */
if
(
pages_per_row
==
0
)
{
...
...
@@ -1540,6 +1548,9 @@ page_widget_set_mode(zathura_t* zathura, unsigned int page_padding,
int
y
=
(
i
+
first_page_column
-
1
)
/
pages_per_row
;
GtkWidget
*
page_widget
=
zathura
->
pages
[
i
];
if
(
page_right_to_left
)
{
x
=
pages_per_row
-
1
-
x
;
}
gtk_grid_attach
(
GTK_GRID
(
zathura
->
ui
.
page_widget
),
page_widget
,
x
,
y
,
1
,
1
);
}
...
...
zathura/zathura.h
View file @
2df776b3
...
...
@@ -404,9 +404,11 @@ bool adjust_view(zathura_t* zathura);
* @param page_padding padding in pixels between pages
* @param pages_per_row Number of shown pages per row
* @param first_page_column Column on which first page start
* @param page_right_to_left Render pages right to left
*/
void
page_widget_set_mode
(
zathura_t
*
zathura
,
unsigned
int
page_padding
,
unsigned
int
pages_per_row
,
unsigned
int
first_page_column
);
unsigned
int
pages_per_row
,
unsigned
int
first_page_column
,
bool
page_right_to_left
);
/**
* 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