From: auroux
Date: Sat, 3 Jun 2006 13:38:32 +0000 (+0000)
Subject: Public release 0.2.1.
X-Git-Url: https://git.donarmstrong.com/?p=xournal.git;a=commitdiff_plain;h=a78b442e4b673ac29d7dd29cfb2c9bca6f07130a
Public release 0.2.1.
---
diff --git a/ChangeLog b/ChangeLog
index 7627fdd..644872b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
-Version ?:
+Version 0.2.1 (Jun 3, 2006):
+ - recently used files listed in file menu
+ - can change color or thickness of pen strokes in selection
+ - function to apply paper style to all pages
- can specify on command line a PDF file to annotate
+ - suggest a derived file name for PDF annotation
+ - speed up switching between pages
- fixed a bug in XInput initialization (thanks to Luca de Cicco)
+ - fixed a bug in print ranges (thanks to Mathieu Bouchard)
+ - fixed a refresh bug in rescaling bitmap backgrounds
Version 0.2 (Jan 29, 2006):
- PDF file annotation using xpdf's pdftoppm
diff --git a/NEWS b/NEWS
index d94177b..c1e9555 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
-Version 0.2 (Jan 29, 2006)
+Version 0.2.1 (June 3, 2006)
Installation: see INSTALL
User's manual: see html-doc/manual.html
Updates: see http://math.mit.edu/~auroux/software/xournal/
+
+See also: http://sourceforge.net/projects/xournal
diff --git a/README b/README
index d94177b..c1e9555 100644
--- a/README
+++ b/README
@@ -1,5 +1,7 @@
-Version 0.2 (Jan 29, 2006)
+Version 0.2.1 (June 3, 2006)
Installation: see INSTALL
User's manual: see html-doc/manual.html
Updates: see http://math.mit.edu/~auroux/software/xournal/
+
+See also: http://sourceforge.net/projects/xournal
diff --git a/configure.in b/configure.in
index 85c4e00..d7e52a9 100644
--- a/configure.in
+++ b/configure.in
@@ -10,20 +10,11 @@ AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
-dnl set this var to NONE (PC) or other thing (Maemo)
-usehildon='NONE'
-if test "x$usehildon" != xNONE
-then
- pkg_modules="gtk+-2.0 >= 2.4.0 libgnomecanvas-2.0 >= 2.4.0 libgnomeprintui-2.2 >= 2.0.0 hildon-libs libosso"
-else
- pkg_modules="gtk+-2.0 >= 2.4.0 libgnomecanvas-2.0 >= 2.4.0 libgnomeprintui-2.2 >= 2.0.0"
-fi
+pkg_modules="gtk+-2.0 >= 2.4.0 libgnomecanvas-2.0 >= 2.4.0 libgnomeprintui-2.2 >= 2.0.0"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
-AM_CONDITIONAL(USE_HILDON, test "x$usehildon" != xNONE)
-
AC_OUTPUT([
Makefile
src/Makefile
diff --git a/html-doc/manual.html b/html-doc/manual.html
index a7bfcc4..e1036cb 100644
--- a/html-doc/manual.html
+++ b/html-doc/manual.html
@@ -24,7 +24,7 @@
Xournal User's Manual
- Version 0.2
+ Version 0.2.1
@@ -449,6 +449,20 @@ A core file may also be helpful.
Version history
+Version 0.2.1 (Jun 3, 2006):
+
+ - recently used files listed in file menu
+ - can change color or thickness of pen strokes in selection
+ - function to apply paper style to all pages
+ - can specify on command line a PDF file to annotate
+ - suggest a derived file name for PDF annotation
+ - speed up switching between pages
+ - fixed a bug in XInput initialization (thanks to Luca de Cicco)
+ - fixed a bug in print ranges (thanks to Mathieu Bouchard)
+ - fixed a refresh bug in rescaling bitmap backgrounds
+
+
+
Version 0.2 (January 29, 2006):
- PDF file annotation using xpdf's pdftoppm
diff --git a/src/TODO b/src/TODO
index fcb3fcb..8323a09 100644
--- a/src/TODO
+++ b/src/TODO
@@ -1,32 +1,27 @@
-- print range bugfix (SEE PATCH?)
-- non-attached annotation => suggest a derived filename for save-as
- when opening a PDF file from command-line, store full path in name
-- gtk_message_dialog_format_secondary_text in xo-print.c crashes 2.4 ?
-- lasso selection tool
-- prefs file, save prefs
-- recent files list
+List of features to be implemented (not in any particular order)
+----------------------------------------------------------------
+
- map tools to stylus buttons (maybe: btn click on toolbar item affects
the corresponding tool; tool switching cleaner than for eraser)
-- flatten (incl undo/redo...) - enabled only if nlayers>1
-- bg: apply to all pages (SEE PATCH?)
-- recolor selection / change pen stroke thickness
-- resize selection
- move selection to another page by drag-drop
(should apply to vertspacer when origin moves to another page,
but in the up direction only do so when all the stuff fits on prev page)
(SEE ALSO FEATURE REQUEST 1472482 and reply to it - optional behavior too?)
+- lasso selection tool
+- prefs file, save prefs
+- flatten (incl undo/redo...) - enabled only if nlayers>1
+- resize selection
- text tool, font chooser, default font
- color chooser (papercolor, pen color); maybe more default colors
- printing: print-to-PDF? (with & without pdf background to merge)
opacity issue for highlighter strokes (maybe print them below ?)
save gnome printer settings (throughout a session, and on disk)
(maybe a separate config file .xournal/gnome-print-settings)
-....
- file print-options, own print-to-ps/pdf
- help index
- pressure sensitivity
- insert images (screen capture or from file or from clipboard),
not as full-page backgrounds (new ITEM type)
- more pen/highlighter shapes (chisel)
-- convert to/from Jarnal format
+- convert to/from Jarnal format; to/from MS Journal format???
- recalibration upon screen resize / compensation for miscalibration
diff --git a/src/main.c b/src/main.c
index 52b889c..7a5e641 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,7 +31,6 @@ void hide_unimplemented(void)
gtk_widget_hide(GET_COMPONENT("filePrintOptions"));
gtk_widget_hide(GET_COMPONENT("journalFlatten"));
gtk_widget_hide(GET_COMPONENT("papercolorOther"));
- gtk_widget_hide(GET_COMPONENT("journalApplyAllPages"));
gtk_widget_hide(GET_COMPONENT("toolsText"));
gtk_widget_hide(GET_COMPONENT("buttonText"));
gtk_widget_hide(GET_COMPONENT("toolsSelectRegion"));
@@ -51,11 +50,18 @@ void init_stuff (int argc, char *argv[])
GdkScreen *screen;
int i;
struct Brush *b;
- gboolean can_xinput;
+ gboolean can_xinput, success;
+ gchar *tmppath, *tmpfn;
// we need an empty canvas prior to creating the journal structures
canvas = GNOME_CANVAS (gnome_canvas_new_aa ());
+ // initialize config file names
+ tmppath = g_build_filename(g_get_home_dir(), CONFIG_DIR, NULL);
+ g_mkdir(tmppath, 0700); // safer (MRU data may be confidential)
+ ui.mrufile = g_build_filename(tmppath, MRU_FILE, NULL);
+ g_free(tmppath);
+
// initialize data
// TODO: load this from a preferences file
@@ -84,15 +90,8 @@ void init_stuff (int argc, char *argv[])
undo = NULL; redo = NULL;
journal.pages = NULL;
bgpdf.status = STATUS_NOT_INIT;
-
- if (argc == 1) new_journal();
- else if (!open_journal(argv[1])) {
- new_journal();
- w = gtk_message_dialog_new(GTK_WINDOW (winMain), GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Error opening file '%s'", argv[1]);
- gtk_dialog_run(GTK_DIALOG(w));
- gtk_widget_destroy(w);
- }
+
+ new_journal();
ui.cur_item_type = ITEM_NONE;
ui.cur_item = NULL;
@@ -207,6 +206,37 @@ void init_stuff (int argc, char *argv[])
update_undo_redo_enabled();
update_copy_paste_enabled();
+
+ // show everything...
+
+ gtk_widget_show (winMain);
+ update_cursor();
+
+ // load the MRU
+
+ init_mru();
+
+ // and finally, open a file specified on the command line
+ // (moved here because display parameters weren't initialized yet...)
+
+ if (argc == 1) return;
+ set_cursor_busy(TRUE);
+ if (g_path_is_absolute(argv[1]))
+ tmpfn = g_strdup(argv[1]);
+ else {
+ tmppath = g_get_current_dir();
+ tmpfn = g_build_filename(tmppath, argv[1], NULL);
+ g_free(tmppath);
+ }
+ success = open_journal(tmpfn);
+ g_free(tmpfn);
+ set_cursor_busy(FALSE);
+ if (!success) {
+ w = gtk_message_dialog_new(GTK_WINDOW (winMain), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Error opening file '%s'", argv[1]);
+ gtk_dialog_run(GTK_DIALOG(w));
+ gtk_widget_destroy(w);
+ }
}
@@ -238,13 +268,12 @@ main (int argc, char *argv[])
init_stuff (argc, argv);
- gtk_widget_show (winMain);
- update_cursor();
-
gtk_main ();
if (bgpdf.status != STATUS_NOT_INIT) shutdown_bgpdf();
if (bgpdf.status != STATUS_NOT_INIT) end_bgpdf_shutdown();
+
+ save_mru_list();
return 0;
}
diff --git a/src/xo-callbacks.c b/src/xo-callbacks.c
index 88b61ac..032a5c8 100644
--- a/src/xo-callbacks.c
+++ b/src/xo-callbacks.c
@@ -188,11 +188,18 @@ on_fileSaveAs_activate (GtkMenuItem *menuitem,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
if (ui.filename!=NULL) {
- if (ui.filename[0] == '/')
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (dialog), ui.filename);
- else
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), ui.filename);
- } else {
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (dialog), ui.filename);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), g_basename(ui.filename));
+ }
+ else
+ if (bgpdf.status!=STATUS_NOT_INIT && bgpdf.file_domain == DOMAIN_ABSOLUTE
+ && bgpdf.filename != NULL) {
+ filename = g_strdup_printf("%s.xoj", bgpdf.filename->s);
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (dialog), filename);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), g_basename(filename));
+ g_free(filename);
+ }
+ else {
curtime = time(NULL);
strftime(stime, 30, "%F-Note-%H-%M.xoj", localtime(&curtime));
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), stime);
@@ -329,6 +336,8 @@ on_filePrint_activate (GtkMenuItem *menuitem,
switch(gnome_print_dialog_get_range(GNOME_PRINT_DIALOG(printDialog))) {
case GNOME_PRINT_RANGE_RANGE:
gnome_print_dialog_get_range_page(GNOME_PRINT_DIALOG(printDialog), &fromPage, &toPage);
+ fromPage--;
+ toPage--;
break;
default:
fromPage = 0;
@@ -366,9 +375,8 @@ on_filePrintPDF_activate (GtkMenuItem *menuitem,
}
else
in_fn = g_strdup_printf("%s.pdf", ui.filename);
- if (in_fn[0] == '/')
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (dialog), in_fn);
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), in_fn);
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER (dialog), in_fn);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), g_basename(in_fn));
} else {
curtime = time(NULL);
strftime(stime, 30, "%F-Note-%H-%M.pdf", localtime(&curtime));
@@ -425,6 +433,7 @@ on_editUndo_activate (GtkMenuItem *menuitem,
GList *list, *itemlist;
struct UndoErasureData *erasure;
struct Item *it;
+ struct Brush tmp_brush;
struct Background *tmp_bg;
double tmp_x, tmp_y;
@@ -485,7 +494,7 @@ on_editUndo_activate (GtkMenuItem *menuitem,
make_page_clipbox(undo->page);
}
update_canvas_bg(undo->page);
- do_switch_page(g_list_index(journal.pages, undo->page), TRUE);
+ do_switch_page(g_list_index(journal.pages, undo->page), TRUE, TRUE);
}
else if (undo->type == ITEM_NEW_DEFAULT_BG) {
tmp_bg = ui.default_page.bg;
@@ -510,13 +519,13 @@ on_editUndo_activate (GtkMenuItem *menuitem,
// so do_switch_page() won't try to remap the layers of the defunct page
if (ui.pageno >= undo->val) ui.pageno--;
if (ui.pageno < 0) ui.pageno = 0;
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
else if (undo->type == ITEM_DELETE_PAGE) {
journal.pages = g_list_insert(journal.pages, undo->page, undo->val);
journal.npages++;
make_canvas_items(); // re-create the canvas items
- do_switch_page(undo->val, TRUE);
+ do_switch_page(undo->val, TRUE, TRUE);
}
else if (undo->type == ITEM_MOVESEL) {
for (itemlist = undo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
@@ -541,7 +550,7 @@ on_editUndo_activate (GtkMenuItem *menuitem,
undo->layer->group = NULL;
undo->page->layers = g_list_remove(undo->page->layers, undo->layer);
undo->page->nlayers--;
- do_switch_page(ui.pageno, FALSE); // don't stay with bad cur_layer info
+ do_switch_page(ui.pageno, FALSE, FALSE); // don't stay with bad cur_layer info
}
else if (undo->type == ITEM_DELETE_LAYER) {
// special case of -1: deleted the last layer, created a new one
@@ -572,7 +581,20 @@ on_editUndo_activate (GtkMenuItem *menuitem,
"width-units", it->brush.thickness, NULL);
}
}
- do_switch_page(ui.pageno, FALSE); // show the restored layer & others...
+ do_switch_page(ui.pageno, FALSE, FALSE); // show the restored layer & others...
+ }
+ else if (undo->type == ITEM_REPAINTSEL) {
+ for (itemlist = undo->itemlist, list = undo->auxlist; itemlist!=NULL;
+ itemlist = itemlist->next, list = list->next) {
+ it = (struct Item *)itemlist->data;
+ g_memmove(&tmp_brush, &(it->brush), sizeof(struct Brush));
+ g_memmove(&(it->brush), list->data, sizeof(struct Brush));
+ g_memmove(list->data, &tmp_brush, sizeof(struct Brush));
+ if (it->type == ITEM_STROKE && it->canvas_item != NULL)
+ gnome_canvas_item_set(it->canvas_item,
+ "fill-color-rgba", it->brush.color_rgba,
+ "width-units", it->brush.thickness, NULL);
+ }
}
// move item from undo to redo stack
@@ -594,6 +616,7 @@ on_editRedo_activate (GtkMenuItem *menuitem,
GList *list, *itemlist, *target;
struct UndoErasureData *erasure;
struct Item *it;
+ struct Brush tmp_brush;
struct Background *tmp_bg;
struct Layer *l;
double tmp_x, tmp_y;
@@ -654,7 +677,7 @@ on_editRedo_activate (GtkMenuItem *menuitem,
make_page_clipbox(redo->page);
}
update_canvas_bg(redo->page);
- do_switch_page(g_list_index(journal.pages, redo->page), TRUE);
+ do_switch_page(g_list_index(journal.pages, redo->page), TRUE, TRUE);
}
else if (redo->type == ITEM_NEW_DEFAULT_BG) {
tmp_bg = ui.default_page.bg;
@@ -680,7 +703,7 @@ on_editRedo_activate (GtkMenuItem *menuitem,
journal.pages = g_list_insert(journal.pages, redo->page, redo->val);
journal.npages++;
- do_switch_page(redo->val, TRUE);
+ do_switch_page(redo->val, TRUE, TRUE);
}
else if (redo->type == ITEM_DELETE_PAGE) {
// unmap all the canvas items
@@ -698,7 +721,7 @@ on_editRedo_activate (GtkMenuItem *menuitem,
if (ui.pageno > undo->val || ui.pageno == journal.npages) ui.pageno--;
ui.cur_page = NULL;
// so do_switch_page() won't try to remap the layers of the defunct page
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
else if (redo->type == ITEM_MOVESEL) {
for (itemlist = redo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
@@ -729,7 +752,7 @@ on_editRedo_activate (GtkMenuItem *menuitem,
redo->page->bg->canvas_item);
redo->page->layers = g_list_insert(redo->page->layers, redo->layer, redo->val);
redo->page->nlayers++;
- do_switch_page(ui.pageno, FALSE);
+ do_switch_page(ui.pageno, FALSE, FALSE);
}
else if (redo->type == ITEM_DELETE_LAYER) {
gtk_object_destroy(GTK_OBJECT(redo->layer->group));
@@ -744,7 +767,20 @@ on_editRedo_activate (GtkMenuItem *menuitem,
redo->page->layers = g_list_append(redo->page->layers, redo->layer2);
redo->page->nlayers++;
}
- do_switch_page(ui.pageno, FALSE);
+ do_switch_page(ui.pageno, FALSE, FALSE);
+ }
+ else if (redo->type == ITEM_REPAINTSEL) {
+ for (itemlist = redo->itemlist, list = redo->auxlist; itemlist!=NULL;
+ itemlist = itemlist->next, list = list->next) {
+ it = (struct Item *)itemlist->data;
+ g_memmove(&tmp_brush, &(it->brush), sizeof(struct Brush));
+ g_memmove(&(it->brush), list->data, sizeof(struct Brush));
+ g_memmove(list->data, &tmp_brush, sizeof(struct Brush));
+ if (it->type == ITEM_STROKE && it->canvas_item != NULL)
+ gnome_canvas_item_set(it->canvas_item,
+ "fill-color-rgba", it->brush.color_rgba,
+ "width-units", it->brush.thickness, NULL);
+ }
}
// move item from redo to undo stack
@@ -797,14 +833,16 @@ on_viewContinuous_activate (GtkMenuItem *menuitem,
{
GtkAdjustment *v_adj;
double yscroll;
+ struct Page *pg;
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
if (ui.view_continuous) return;
ui.view_continuous = TRUE;
v_adj = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
- yscroll = gtk_adjustment_get_value(v_adj) - ui.cur_page->voffset*ui.zoom;
+ pg = ui.cur_page;
+ yscroll = gtk_adjustment_get_value(v_adj) - pg->voffset*ui.zoom;
update_page_stuff();
- gtk_adjustment_set_value(v_adj, yscroll + ui.cur_page->voffset*ui.zoom);
+ gtk_adjustment_set_value(v_adj, yscroll + pg->voffset*ui.zoom);
// force a refresh
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
}
@@ -875,7 +913,7 @@ void
on_viewFirstPage_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- do_switch_page(0, TRUE);
+ do_switch_page(0, TRUE, FALSE);
}
@@ -884,7 +922,7 @@ on_viewPreviousPage_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
if (ui.pageno == 0) return;
- do_switch_page(ui.pageno-1, TRUE);
+ do_switch_page(ui.pageno-1, TRUE, FALSE);
}
@@ -897,7 +935,7 @@ on_viewNextPage_activate (GtkMenuItem *menuitem,
on_journalNewPageEnd_activate(menuitem, user_data);
return;
}
- do_switch_page(ui.pageno+1, TRUE);
+ do_switch_page(ui.pageno+1, TRUE, FALSE);
}
@@ -905,7 +943,7 @@ void
on_viewLastPage_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- do_switch_page(journal.npages-1, TRUE);
+ do_switch_page(journal.npages-1, TRUE, FALSE);
}
@@ -947,7 +985,7 @@ on_journalNewPageBefore_activate (GtkMenuItem *menuitem,
pg = new_page(ui.cur_page);
journal.pages = g_list_insert(journal.pages, pg, ui.pageno);
journal.npages++;
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
prepare_new_undo();
undo->type = ITEM_NEW_PAGE;
@@ -967,7 +1005,7 @@ on_journalNewPageAfter_activate (GtkMenuItem *menuitem,
pg = new_page(ui.cur_page);
journal.pages = g_list_insert(journal.pages, pg, ui.pageno+1);
journal.npages++;
- do_switch_page(ui.pageno+1, TRUE);
+ do_switch_page(ui.pageno+1, TRUE, TRUE);
prepare_new_undo();
undo->type = ITEM_NEW_PAGE;
@@ -987,7 +1025,7 @@ on_journalNewPageEnd_activate (GtkMenuItem *menuitem,
pg = new_page((struct Page *)g_list_last(journal.pages)->data);
journal.pages = g_list_append(journal.pages, pg);
journal.npages++;
- do_switch_page(journal.npages-1, TRUE);
+ do_switch_page(journal.npages-1, TRUE, TRUE);
prepare_new_undo();
undo->type = ITEM_NEW_PAGE;
@@ -1027,7 +1065,7 @@ on_journalDeletePage_activate (GtkMenuItem *menuitem,
if (ui.pageno == journal.npages) ui.pageno--;
ui.cur_page = NULL;
// so do_switch_page() won't try to remap the layers of the defunct page
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
@@ -1172,7 +1210,7 @@ on_journalPaperSize_activate (GtkMenuItem *menuitem,
make_page_clipbox(ui.cur_page);
update_canvas_bg(ui.cur_page);
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
@@ -1376,7 +1414,7 @@ on_journalLoadBackground_activate (GtkMenuItem *menuitem,
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
rescale_bg_pixmaps();
}
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
void
@@ -1420,7 +1458,7 @@ on_journalScreenshot_activate (GtkMenuItem *menuitem,
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
rescale_bg_pixmaps();
}
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
@@ -1428,7 +1466,31 @@ void
on_journalApplyAllPages_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
-
+ struct Page *page;
+ GList *pglist;
+
+ if (ui.cur_page->bg->type != BG_SOLID) return;
+ reset_selection();
+ for (pglist = journal.pages; pglist!=NULL; pglist = pglist->next) {
+ page = (struct Page *)pglist->data;
+ prepare_new_undo();
+ undo->type = ITEM_NEW_BG_RESIZE;
+ undo->page = page;
+ undo->bg = page->bg;
+ undo->val_x = page->width;
+ undo->val_y = page->height;
+ if (pglist->next!=NULL) undo->multiop |= MULTIOP_CONT_REDO;
+ if (pglist->prev!=NULL) undo->multiop |= MULTIOP_CONT_UNDO;
+ page->bg = (struct Background *)g_memdup(ui.cur_page->bg, sizeof(struct Background));
+ page->width = ui.cur_page->width;
+ page->height = ui.cur_page->height;
+ page->bg->canvas_item = undo->bg->canvas_item;
+ undo->bg->canvas_item = NULL;
+
+ make_page_clipbox(page);
+ update_canvas_bg(page);
+ }
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
@@ -2008,7 +2070,7 @@ on_canvas_button_press_event (GtkWidget *widget,
ui.pageno++;
tmppage = g_list_nth_data(journal.pages, ui.pageno);
}
- if (page_change) do_switch_page(ui.pageno, FALSE);
+ if (page_change) do_switch_page(ui.pageno, FALSE, FALSE);
// can't paint on the background...
@@ -2114,7 +2176,7 @@ on_canvas_expose_event (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
-
+ if (ui.view_continuous && ui.progressive_bg) rescale_bg_pixmaps();
return FALSE;
}
@@ -2184,7 +2246,6 @@ on_canvas_motion_notify_event (GtkWidget *widget,
return FALSE;
}
-
void
on_comboLayer_changed (GtkComboBox *combobox,
gpointer user_data)
@@ -2261,7 +2322,7 @@ on_vscroll_changed (GtkAdjustment *adjustment,
ui.pageno--;
tmppage = g_list_nth_data(journal.pages, ui.pageno);
}
- if (need_update) do_switch_page(ui.pageno, FALSE);
+ if (need_update) do_switch_page(ui.pageno, FALSE, FALSE);
return;
}
@@ -2286,7 +2347,7 @@ on_spinPageNo_value_changed (GtkSpinButton *spinbutton,
if (val == ui.pageno) return;
if (val < 0) val = 0;
if (val > journal.npages-1) val = journal.npages-1;
- do_switch_page(val, TRUE);
+ do_switch_page(val, TRUE, FALSE);
}
@@ -2310,7 +2371,7 @@ on_journalDefaultBackground_activate (GtkMenuItem *menuitem,
make_page_clipbox(ui.cur_page);
update_canvas_bg(ui.cur_page);
- do_switch_page(ui.pageno, TRUE);
+ do_switch_page(ui.pageno, TRUE, TRUE);
}
@@ -2502,3 +2563,32 @@ on_optionsProgressiveBG_activate (GtkMenuItem *menuitem,
if (!ui.progressive_bg) rescale_bg_pixmaps();
}
+
+void
+on_mru_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ int which;
+ gboolean success;
+ GtkWidget *dialog;
+
+ if (!ok_to_close()) return; // user aborted on save confirmation
+
+ for (which = 0 ; which < MRU_SIZE; which++) {
+ if (ui.mrumenu[which] == GTK_WIDGET(menuitem)) break;
+ }
+ if (which == MRU_SIZE || ui.mru[which] == NULL) return; // not found...
+
+ set_cursor_busy(TRUE);
+ success = open_journal(ui.mru[which]);
+ set_cursor_busy(FALSE);
+ if (success) return;
+
+ /* open failed */
+ dialog = gtk_message_dialog_new(GTK_WINDOW (winMain), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Error opening file '%s'", ui.mru[which]);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ delete_mru_entry(which);
+}
+
diff --git a/src/xo-callbacks.h b/src/xo-callbacks.h
index a4799a8..622a25e 100644
--- a/src/xo-callbacks.h
+++ b/src/xo-callbacks.h
@@ -479,3 +479,7 @@ void
on_optionsProgressiveBG_activate (GtkMenuItem *menuitem,
gpointer user_data);
+
+void
+on_mru_activate (GtkMenuItem *menuitem,
+ gpointer user_data);
diff --git a/src/xo-file.c b/src/xo-file.c
index a052475..c180d61 100644
--- a/src/xo-file.c
+++ b/src/xo-file.c
@@ -1107,3 +1107,93 @@ void bgpdf_update_bg(int pageno, struct BgPdfPage *bgpg)
}
}
+// initialize the recent files list
+void init_mru(void)
+{
+ int i;
+ gsize lfptr;
+ char s[5];
+ GIOChannel *f;
+ gchar *str;
+ GIOStatus status;
+
+ g_strlcpy(s, "mru0", 5);
+ for (s[3]='0', i=0; i0) {
+ str[lfptr] = 0;
+ ui.mru[i] = str;
+ i++;
+ }
+ }
+ if (f) {
+ g_io_channel_shutdown(f, FALSE, NULL);
+ g_io_channel_unref(f);
+ }
+ update_mru_menu();
+}
+
+void update_mru_menu(void)
+{
+ int i;
+ gboolean anyone = FALSE;
+
+ for (i=0; i=1; j--) ui.mru[j] = ui.mru[j-1];
+ ui.mru[0] = g_strdup(name);
+ update_mru_menu();
+}
+
+void delete_mru_entry(int which)
+{
+ int i;
+
+ if (ui.mru[which]!=NULL) g_free(ui.mru[which]);
+ for (i=which+1;ivoffset*ui.zoom);
- gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
+ if (refresh_all)
+ gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
+ else if (!ui.view_continuous)
+ gnome_canvas_item_move(GNOME_CANVAS_ITEM(ui.cur_page->group), 0., 0.);
}
}
@@ -1047,6 +1052,8 @@ void update_page_stuff(void)
ui.cur_page->bg->type == BG_SOLID);
gtk_widget_set_sensitive(GET_COMPONENT("journalSetAsDefault"),
ui.cur_page->bg->type == BG_SOLID);
+ gtk_widget_set_sensitive(GET_COMPONENT("journalApplyAllPages"),
+ ui.cur_page->bg->type == BG_SOLID);
gtk_widget_set_sensitive(GET_COMPONENT("viewFirstPage"), ui.pageno!=0);
gtk_widget_set_sensitive(GET_COMPONENT("viewPreviousPage"), ui.pageno!=0);
@@ -1093,6 +1100,7 @@ void update_file_name(char *filename)
else p = g_utf8_next_char(p);
g_snprintf(tmp, 100, "Xournal - %s", p);
gtk_window_set_title(GTK_WINDOW (winMain), tmp);
+ new_mru_entry(filename);
}
void update_undo_redo_enabled(void)
@@ -1142,7 +1150,9 @@ void process_color_activate(GtkMenuItem *menuitem, int color)
if (ui.toolno == TOOL_PEN || ui.toolno == TOOL_HIGHLIGHTER)
set_cur_color(color);
- // later add selection tools
+ if ((ui.toolno == TOOL_SELECTREGION || ui.toolno == TOOL_SELECTRECT) &&
+ ui.selection != NULL)
+ recolor_selection(color);
update_color_buttons();
update_color_menu();
@@ -1160,6 +1170,8 @@ void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val)
}
if (tool >= NUM_STROKE_TOOLS) {
+ if ((tool == TOOL_SELECTREGION || tool == TOOL_SELECTRECT) && ui.selection != NULL)
+ rethicken_selection(val);
update_thickness_buttons(); // undo illegal button selection
return;
}
diff --git a/src/xo-misc.h b/src/xo-misc.h
index 8662cd3..7fd40cb 100644
--- a/src/xo-misc.h
+++ b/src/xo-misc.h
@@ -47,7 +47,7 @@ void update_file_name(char *filename);
void update_undo_redo_enabled(void);
void update_copy_paste_enabled(void);
-void do_switch_page(int pg, gboolean rescroll);
+void do_switch_page(int pg, gboolean rescroll, gboolean refresh_all);
void set_cur_color(int color);
void process_color_activate(GtkMenuItem *menuitem, int color);
void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val);
diff --git a/src/xo-paint.c b/src/xo-paint.c
index 348334d..2aed317 100644
--- a/src/xo-paint.c
+++ b/src/xo-paint.c
@@ -774,3 +774,61 @@ void clipboard_paste(void)
gtk_selection_data_free(sel_data);
update_copy_paste_enabled();
}
+
+// modify the color or thickness of pen strokes in a selection
+
+void recolor_selection(int color)
+{
+ GList *itemlist;
+ struct Item *item;
+ struct Brush *brush;
+
+ if (ui.selection == NULL) return;
+ prepare_new_undo();
+ undo->type = ITEM_REPAINTSEL;
+ undo->itemlist = NULL;
+ undo->auxlist = NULL;
+ for (itemlist = ui.selection->items; itemlist!=NULL; itemlist = itemlist->next) {
+ item = (struct Item *)itemlist->data;
+ if (item->type != ITEM_STROKE || item->brush.tool_type!=TOOL_PEN) continue;
+ // store info for undo
+ undo->itemlist = g_list_append(undo->itemlist, item);
+ brush = (struct Brush *)g_malloc(sizeof(struct Brush));
+ g_memmove(brush, &(item->brush), sizeof(struct Brush));
+ undo->auxlist = g_list_append(undo->auxlist, brush);
+ // repaint the stroke
+ item->brush.color_no = color;
+ item->brush.color_rgba = predef_colors_rgba[color];
+ if (item->canvas_item!=NULL)
+ gnome_canvas_item_set(item->canvas_item,
+ "fill-color-rgba", item->brush.color_rgba, NULL);
+ }
+}
+
+void rethicken_selection(int val)
+{
+ GList *itemlist;
+ struct Item *item;
+ struct Brush *brush;
+
+ if (ui.selection == NULL) return;
+ prepare_new_undo();
+ undo->type = ITEM_REPAINTSEL;
+ undo->itemlist = NULL;
+ undo->auxlist = NULL;
+ for (itemlist = ui.selection->items; itemlist!=NULL; itemlist = itemlist->next) {
+ item = (struct Item *)itemlist->data;
+ if (item->type != ITEM_STROKE || item->brush.tool_type!=TOOL_PEN) continue;
+ // store info for undo
+ undo->itemlist = g_list_append(undo->itemlist, item);
+ brush = (struct Brush *)g_malloc(sizeof(struct Brush));
+ g_memmove(brush, &(item->brush), sizeof(struct Brush));
+ undo->auxlist = g_list_append(undo->auxlist, brush);
+ // repaint the stroke
+ item->brush.thickness_no = val;
+ item->brush.thickness = predef_thickness[TOOL_PEN][val];
+ if (item->canvas_item!=NULL)
+ gnome_canvas_item_set(item->canvas_item,
+ "width-units", item->brush.thickness, NULL);
+ }
+}
diff --git a/src/xo-paint.h b/src/xo-paint.h
index 4df6f1b..4d3a43c 100644
--- a/src/xo-paint.h
+++ b/src/xo-paint.h
@@ -17,3 +17,6 @@ void finalize_movesel(void);
void selection_delete(void);
void selection_to_clip(void);
void clipboard_paste(void);
+
+void recolor_selection(int color);
+void rethicken_selection(int val);
diff --git a/src/xo-print.c b/src/xo-print.c
index 933868e..147fd2e 100644
--- a/src/xo-print.c
+++ b/src/xo-print.c
@@ -168,15 +168,21 @@ void print_job_render(GnomePrintJob *gpj, int fromPage, int toPage)
g_signal_connect(wait_dialog, "response", G_CALLBACK (cb_print_abort), &abort);
for (i = fromPage; i <= toPage; i++) {
- gtk_message_dialog_format_secondary_text(
- GTK_MESSAGE_DIALOG(wait_dialog), "Page %d", i+1);
+#if GTK_CHECK_VERSION(2,6,0)
+ if (!gtk_check_version(2, 6, 0))
+ gtk_message_dialog_format_secondary_text(
+ GTK_MESSAGE_DIALOG(wait_dialog), "Page %d", i+1);
+#endif
while (gtk_events_pending()) gtk_main_iteration();
print_page(gpc, (struct Page *)g_list_nth_data(journal.pages, i), i+1,
pgwidth, pgheight, &abort);
if (abort) break;
}
- gtk_message_dialog_format_secondary_text(
+#if GTK_CHECK_VERSION(2,6,0)
+ if (!gtk_check_version(2, 6, 0))
+ gtk_message_dialog_format_secondary_text(
GTK_MESSAGE_DIALOG(wait_dialog), "Finalizing...");
+#endif
while (gtk_events_pending()) gtk_main_iteration();
gnome_print_context_close(gpc);
diff --git a/src/xournal b/src/xournal
deleted file mode 100755
index f9ca5c4..0000000
Binary files a/src/xournal and /dev/null differ
diff --git a/src/xournal.h b/src/xournal.h
index 0b94190..7c20c73 100644
--- a/src/xournal.h
+++ b/src/xournal.h
@@ -1,6 +1,12 @@
#include
#include
+// PREF FILES INFO
+
+#define CONFIG_DIR ".xournal"
+#define MRU_FILE "recent-files"
+#define MRU_SIZE 8
+
// DATA STRUCTURES AND CONSTANTS
#define PIXEL_MOTION_THRESHOLD 0.3
@@ -133,6 +139,7 @@ typedef struct Item {
#define ITEM_NEW_DEFAULT_BG 11
#define ITEM_NEW_PAGE 13
#define ITEM_DELETE_PAGE 14
+#define ITEM_REPAINTSEL 15
typedef struct Layer {
GList *items; // the items on the layer, from bottom to top
@@ -195,6 +202,9 @@ typedef struct UIData {
gboolean emulate_eraser;
gboolean antialias_bg; // bilinear interpolation on bg pixmaps
gboolean progressive_bg; // rescale bg's one at a time
+ char *mrufile; // file for the MRU
+ char *mru[MRU_SIZE]; // MRU data
+ GtkWidget *mrumenu[MRU_SIZE];
} UIData;
typedef struct UndoErasureData {
@@ -211,7 +221,8 @@ typedef struct UndoItem {
struct Layer *layer2; // for ITEM_DELETE_LAYER with val=-1
struct Page *page; // for ITEM_NEW_BG_ONE/RESIZE, ITEM_NEW_PAGE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_DELETE_PAGE
GList *erasurelist; // for ITEM_ERASURE
- GList *itemlist; // for ITEM_MOVESEL, ITEM_PASTE
+ GList *itemlist; // for ITEM_MOVESEL, ITEM_PASTE, ITEM_REPAINTSEL
+ GList *auxlist; // for ITEM_REPAINTSEL
struct Background *bg; // for ITEM_NEW_BG_ONE/RESIZE, ITEM_NEW_DEFAULT_BG
int val; // for ITEM_NEW_PAGE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_DELETE_PAGE
double val_x, val_y; // for ITEM_MOVESEL, ITEM_NEW_BG_RESIZE, ITEM_PAPER_RESIZE, ITEM_NEW_DEFAULT_BG
diff --git a/xournal.glade b/xournal.glade
index c7ea714..d0afe62 100644
--- a/xournal.glade
+++ b/xournal.glade
@@ -55,7 +55,7 @@
-
+
True
gtk-open
1
@@ -101,6 +101,97 @@
+
+
+
+
+
+
+
+