Skip to content

Commit

Permalink
added option to determine for pdfs: if new page should come from pdf …
Browse files Browse the repository at this point in the history
…or it should be the default paper
  • Loading branch information
dmgerman committed Apr 25, 2012
1 parent 838fffd commit da2fa88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/xo-file.c
Expand Up @@ -1499,6 +1499,7 @@ void init_config_default(void)
ui.shorten_menu_items = g_strdup(DEFAULT_SHORTEN_MENUS);
ui.auto_save_prefs = FALSE;
ui.bg_apply_all_pages = FALSE;
ui.bg_new_background_from_pdf = FALSE;
ui.use_erasertip = FALSE;
ui.window_default_width = 720;
ui.window_default_height = 480;
Expand Down Expand Up @@ -1734,6 +1735,10 @@ void save_config_to_file(void)
update_keyval("paper", "apply_all",
_(" apply paper style changes to all pages (true/false)"),
g_strdup(ui.bg_apply_all_pages?"true":"false"));
update_keyval("paper", "new_background_from_pdf",
_("If a pdf is loaded, if true new pages are created by copying current PDF page, otherwise it creates new page with default paper"),
g_strdup(ui.bg_new_background_from_pdf?"true":"false"));

update_keyval("paper", "default_unit",
_(" preferred unit (cm, in, px, pt)"),
g_strdup(unit_names[ui.default_unit]));
Expand Down Expand Up @@ -2175,6 +2180,8 @@ void load_config_from_file(void)
bgcolor_names, predef_bgcolors_rgba, COLOR_MAX);
parse_keyval_enum("paper", "style", &(ui.default_page.bg->ruling), bgstyle_names, 4);
parse_keyval_boolean("paper", "apply_all", &ui.bg_apply_all_pages);
parse_keyval_boolean("paper", "new_background_from_pdf", &ui.bg_new_background_from_pdf);

parse_keyval_enum("paper", "default_unit", &ui.default_unit, unit_names, 4);
parse_keyval_boolean("paper", "progressive_bg", &ui.progressive_bg);
parse_keyval_boolean("paper", "print_ruling", &ui.print_ruling);
Expand Down
3 changes: 2 additions & 1 deletion src/xo-misc.c
Expand Up @@ -63,12 +63,13 @@ struct Page *new_page(struct Page *template)
pg->layers = g_list_append(NULL, l);
pg->nlayers = 1;

if (pg->bg->type == BG_PDF) {
if (pg->bg->type == BG_PDF && !ui.bg_new_background_from_pdf) {
// for pdfs load trhe default background
pg->bg = (struct Background *)g_memdup(ui.default_page.bg, sizeof(struct Background));
} else {
pg->bg = (struct Background *)g_memdup(template->bg, sizeof(struct Background));
}

pg->bg->canvas_item = NULL;
if (pg->bg->type == BG_PIXMAP || pg->bg->type == BG_PDF) {
gdk_pixbuf_ref(pg->bg->pixbuf);
Expand Down
1 change: 1 addition & 0 deletions src/xournal.h
Expand Up @@ -279,6 +279,7 @@ typedef struct UIData {
char *mru[MRU_SIZE]; // MRU data
GtkWidget *mrumenu[MRU_SIZE];
gboolean bg_apply_all_pages;
gboolean bg_new_background_from_pdf;
int window_default_width, window_default_height, scrollbar_step_increment;
gboolean print_ruling; // print the paper ruling ?
int default_unit; // the default unit for paper sizes
Expand Down

0 comments on commit da2fa88

Please sign in to comment.