X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fxo-file.c;h=97f3bcf0909e7b434a57853acbb5884d2730b618;hb=62e6c9d87f653624015e8dacd4c5e5abbec4cffa;hp=91044b0e491202286720fd52005ed4b7682448d0;hpb=2e5ff0bff41fa53d4941b6f0fe49c8914bf29cbc;p=xournal.git diff --git a/src/xo-file.c b/src/xo-file.c index 91044b0..97f3bcf 100644 --- a/src/xo-file.c +++ b/src/xo-file.c @@ -124,8 +124,10 @@ gboolean save_journal(const char *filename) } g_free(tmpfn); } + tmpstr = g_markup_escape_text(pg->bg->filename->s, -1); gzprintf(f, "domain=\"%s\" filename=\"%s\" ", - file_domain_names[pg->bg->file_domain], pg->bg->filename->s); + file_domain_names[pg->bg->file_domain], tmpstr); + g_free(tmpstr); } } else if (pg->bg->type == BG_PDF) { @@ -156,8 +158,10 @@ gboolean save_journal(const char *filename) } g_free(tmpfn); } + tmpstr = g_markup_escape_text(pg->bg->filename->s, -1); gzprintf(f, "domain=\"%s\" filename=\"%s\" ", - file_domain_names[pg->bg->file_domain], pg->bg->filename->s); + file_domain_names[pg->bg->file_domain], tmpstr); + g_free(tmpstr); } gzprintf(f, "pageno=\"%d\" ", pg->bg->file_page_seq); } @@ -180,8 +184,10 @@ gboolean save_journal(const char *filename) gzprintf(f, "\n\n"); } if (item->type == ITEM_TEXT) { + tmpstr = g_markup_escape_text(item->font_name, -1); gzprintf(f, "font_name, item->font_size, item->bbox.left, item->bbox.top); + tmpstr, item->font_size, item->bbox.left, item->bbox.top); + g_free(tmpstr); if (item->brush.color_no >= 0) gzputs(f, color_names[item->brush.color_no]); else @@ -189,7 +195,6 @@ gboolean save_journal(const char *filename) tmpstr = g_markup_escape_text(item->text, -1); gzprintf(f, "\">%s\n", tmpstr); g_free(tmpstr); - } } gzprintf(f, "\n"); @@ -944,20 +949,21 @@ void bgpdf_child_handler(GPid pid, gint status, gpointer data) struct BgPdfPage *bgpg; gchar *ppm_name; GdkPixbuf *pixbuf; + int npad, ret; if (bgpdf.requests == NULL) return; req = (struct BgPdfRequest *)bgpdf.requests->data; - ppm_name = g_strdup_printf("%s/p-%06d.ppm", bgpdf.tmpdir, req->pageno); -// printf("Child %d finished, should look for %s... \n", pid, ppm_name); - - if (bgpdf.status == STATUS_ABORTED || bgpdf.status == STATUS_SHUTDOWN) - pixbuf = NULL; - else - pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL); - - unlink(ppm_name); - g_free(ppm_name); + pixbuf = NULL; + // pdftoppm used to generate p-nnnnnn.ppm (6 digits); new versions produce variable width + for (npad = 6; npad>0; npad--) { + ppm_name = g_strdup_printf("%s/p-%0*d.ppm", bgpdf.tmpdir, npad, req->pageno); + if (bgpdf.status != STATUS_ABORTED && bgpdf.status != STATUS_SHUTDOWN) + pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL); + ret = unlink(ppm_name); + g_free(ppm_name); + if (pixbuf != NULL || ret == 0) break; + } if (pixbuf != NULL) { // success // printf("success\n"); @@ -1322,6 +1328,10 @@ void init_config_default(void) ui.view_continuous = TRUE; ui.allow_xinput = TRUE; ui.discard_corepointer = FALSE; + ui.left_handed = FALSE; + ui.shorten_menus = FALSE; + ui.shorten_menu_items = g_strdup(DEFAULT_SHORTEN_MENUS); + ui.auto_save_prefs = FALSE; ui.bg_apply_all_pages = FALSE; ui.use_erasertip = FALSE; ui.window_default_width = 720; @@ -1470,9 +1480,21 @@ void save_config_to_file(void) update_keyval("general", "interface_fullscreen", " interface components in fullscreen mode, from top to bottom", verbose_vertical_order(ui.vertical_order[1])); + update_keyval("general", "interface_lefthanded", + " interface has left-handed scrollbar (true/false)", + g_strdup(ui.left_handed?"true":"false")); + update_keyval("general", "shorten_menus", + " hide some unwanted menu or toolbar items (true/false)", + g_strdup(ui.shorten_menus?"true":"false")); + update_keyval("general", "shorten_menu_items", + " interface items to hide (customize at your own risk!)\n see source file xo-interface.c for a list of item names", + g_strdup(ui.shorten_menu_items)); update_keyval("general", "highlighter_opacity", " highlighter opacity (0 to 1, default 0.5)\n warning: opacity level is not saved in xoj files!", g_strdup_printf("%.2f", ui.hiliter_opacity)); + update_keyval("general", "autosave_prefs", + " auto-save preferences on exit (true/false)", + g_strdup(ui.auto_save_prefs?"true":"false")); update_keyval("paper", "width", " the default page width, in points (1/72 in)", @@ -1775,7 +1797,12 @@ void load_config_from_file(void) parse_keyval_string("general", "default_path", &ui.default_path); parse_keyval_vorderlist("general", "interface_order", ui.vertical_order[0]); parse_keyval_vorderlist("general", "interface_fullscreen", ui.vertical_order[1]); + parse_keyval_boolean("general", "interface_lefthanded", &ui.left_handed); + parse_keyval_boolean("general", "shorten_menus", &ui.shorten_menus); + if (parse_keyval_string("general", "shorten_menu_items", &str)) + if (str!=NULL) { g_free(ui.shorten_menu_items); ui.shorten_menu_items = str; } parse_keyval_float("general", "highlighter_opacity", &ui.hiliter_opacity, 0., 1.); + parse_keyval_boolean("general", "autosave_prefs", &ui.auto_save_prefs); parse_keyval_float("paper", "width", &ui.default_page.width, 1., 5000.); parse_keyval_float("paper", "height", &ui.default_page.height, 1., 5000.);