// paste external text void clipboard_paste_text(gchar *text) { struct Item *item; double pt[2]; reset_selection(); get_current_pointer_coords(pt); set_current_page(pt); ui.selection = g_new(struct Selection, 1); ui.selection->type = ITEM_SELECTRECT; ui.selection->layer = ui.cur_layer; ui.selection->items = NULL; item = g_new(struct Item, 1); ui.selection->items = g_list_append(ui.selection->items, item); ui.cur_layer->items = g_list_append(ui.cur_layer->items, item); ui.cur_layer->nitems++; item->type = ITEM_TEXT; g_memmove(&(item->brush), &(ui.brushes[ui.cur_mapping][TOOL_PEN]), sizeof(struct Brush)); item->text = text; // text was newly allocated, we keep it item->font_name = g_strdup(ui.font_name); item->font_size = ui.font_size; item->bbox.left = pt[0]; item->bbox.top = pt[1]; make_canvas_item_one(ui.cur_layer->group, item); update_item_bbox(item); // move the text to fit on the page if needed if (item->bbox.right > ui.cur_page->width) item->bbox.left += ui.cur_page->width-item->bbox.right; if (item->bbox.left < 0) item->bbox.left = 0; if (item->bbox.bottom > ui.cur_page->height) item->bbox.top += ui.cur_page->height-item->bbox.bottom; if (item->bbox.top < 0) item->bbox.top = 0; gnome_canvas_item_set(item->canvas_item, "x", item->bbox.left, "y", item->bbox.top, NULL); update_item_bbox(item); ui.selection->bbox = item->bbox; ui.selection->canvas_item = gnome_canvas_item_new(ui.cur_layer->group, gnome_canvas_rect_get_type(), "width-pixels", 1, "outline-color-rgba", 0x000000ff, "fill-color-rgba", 0x80808040, "x1", ui.selection->bbox.left, "x2", ui.selection->bbox.right, "y1", ui.selection->bbox.top, "y2", ui.selection->bbox.bottom, NULL); make_dashed(ui.selection->canvas_item); prepare_new_undo(); undo->type = ITEM_PASTE; undo->layer = ui.cur_layer; undo->itemlist = g_list_copy(ui.selection->items); update_copy_paste_enabled(); update_color_menu(); update_thickness_buttons(); update_color_buttons(); update_font_button(); update_cursor(); // FIXME: can't know if pointer is within selection! }
void finalize_selectrect(void) { double x1, x2, y1, y2; GList *itemlist; struct Item *item; ui.cur_item_type = ITEM_NONE; if (ui.selection->bbox.left > ui.selection->bbox.right) { x1 = ui.selection->bbox.right; x2 = ui.selection->bbox.left; ui.selection->bbox.left = x1; ui.selection->bbox.right = x2; } else { x1 = ui.selection->bbox.left; x2 = ui.selection->bbox.right; } if (ui.selection->bbox.top > ui.selection->bbox.bottom) { y1 = ui.selection->bbox.bottom; y2 = ui.selection->bbox.top; ui.selection->bbox.top = y1; ui.selection->bbox.bottom = y2; } else { y1 = ui.selection->bbox.top; y2 = ui.selection->bbox.bottom; } for (itemlist = ui.selection->layer->items; itemlist!=NULL; itemlist = itemlist->next) { item = (struct Item *)itemlist->data; if (item->bbox.left >= x1 && item->bbox.right <= x2 && item->bbox.top >= y1 && item->bbox.bottom <= y2) { ui.selection->items = g_list_append(ui.selection->items, item); } } if (ui.selection->items == NULL) { // if we clicked inside a text zone or image? item = click_is_in_text_or_image(ui.selection->layer, x1, y1); if (item!=NULL && item==click_is_in_text_or_image(ui.selection->layer, x2, y2)) { ui.selection->items = g_list_append(ui.selection->items, item); g_memmove(&(ui.selection->bbox), &(item->bbox), sizeof(struct BBox)); gnome_canvas_item_set(ui.selection->canvas_item, "x1", item->bbox.left, "x2", item->bbox.right, "y1", item->bbox.top, "y2", item->bbox.bottom, NULL); } } if (ui.selection->items == NULL) reset_selection(); else make_dashed(ui.selection->canvas_item); update_cursor(); update_copy_paste_enabled(); update_font_button(); }
// paste xournal native data void clipboard_paste_from_xournal(GtkSelectionData *sel_data) { unsigned char *p; int nitems, npts, i, len; struct Item *item; double hoffset, voffset, cx, cy; double *pf; int sx, sy, wx, wy; reset_selection(); ui.selection = g_new(struct Selection, 1); p = sel_data->data + sizeof(int); g_memmove(&nitems, p, sizeof(int)); p+= sizeof(int); ui.selection->type = ITEM_SELECTRECT; ui.selection->layer = ui.cur_layer; g_memmove(&ui.selection->bbox, p, sizeof(struct BBox)); p+= sizeof(struct BBox); ui.selection->items = NULL; // find by how much we translate the pasted selection gnome_canvas_get_scroll_offsets(canvas, &sx, &sy); gdk_window_get_geometry(GTK_WIDGET(canvas)->window, NULL, NULL, &wx, &wy, NULL); gnome_canvas_window_to_world(canvas, sx + wx/2, sy + wy/2, &cx, &cy); cx -= ui.cur_page->hoffset; cy -= ui.cur_page->voffset; if (cx + (ui.selection->bbox.right-ui.selection->bbox.left)/2 > ui.cur_page->width) cx = ui.cur_page->width - (ui.selection->bbox.right-ui.selection->bbox.left)/2; if (cx - (ui.selection->bbox.right-ui.selection->bbox.left)/2 < 0) cx = (ui.selection->bbox.right-ui.selection->bbox.left)/2; if (cy + (ui.selection->bbox.bottom-ui.selection->bbox.top)/2 > ui.cur_page->height) cy = ui.cur_page->height - (ui.selection->bbox.bottom-ui.selection->bbox.top)/2; if (cy - (ui.selection->bbox.bottom-ui.selection->bbox.top)/2 < 0) cy = (ui.selection->bbox.bottom-ui.selection->bbox.top)/2; hoffset = cx - (ui.selection->bbox.right+ui.selection->bbox.left)/2; voffset = cy - (ui.selection->bbox.top+ui.selection->bbox.bottom)/2; ui.selection->bbox.left += hoffset; ui.selection->bbox.right += hoffset; ui.selection->bbox.top += voffset; ui.selection->bbox.bottom += voffset; ui.selection->canvas_item = gnome_canvas_item_new(ui.cur_layer->group, gnome_canvas_rect_get_type(), "width-pixels", 1, "outline-color-rgba", 0x000000ff, "fill-color-rgba", 0x80808040, "x1", ui.selection->bbox.left, "x2", ui.selection->bbox.right, "y1", ui.selection->bbox.top, "y2", ui.selection->bbox.bottom, NULL); make_dashed(ui.selection->canvas_item); while (nitems-- > 0) { item = g_new(struct Item, 1); ui.selection->items = g_list_append(ui.selection->items, item); ui.cur_layer->items = g_list_append(ui.cur_layer->items, item); ui.cur_layer->nitems++; g_memmove(&item->type, p, sizeof(int)); p+= sizeof(int); if (item->type == ITEM_STROKE) { g_memmove(&item->brush, p, sizeof(struct Brush)); p+= sizeof(struct Brush); g_memmove(&npts, p, sizeof(int)); p+= sizeof(int); item->path = gnome_canvas_points_new(npts); pf = (double *)p; for (i=0; i<npts; i++) { item->path->coords[2*i] = pf[2*i] + hoffset; item->path->coords[2*i+1] = pf[2*i+1] + voffset; } p+= 2*item->path->num_points*sizeof(double); if (item->brush.variable_width) { item->widths = g_memdup(p, (item->path->num_points-1)*sizeof(double)); p+= (item->path->num_points-1)*sizeof(double); } else item->widths = NULL; update_item_bbox(item); make_canvas_item_one(ui.cur_layer->group, item); } if (item->type == ITEM_TEXT) { g_memmove(&item->brush, p, sizeof(struct Brush)); p+= sizeof(struct Brush); g_memmove(&item->bbox.left, p, sizeof(double)); p+= sizeof(double); g_memmove(&item->bbox.top, p, sizeof(double)); p+= sizeof(double); item->bbox.left += hoffset; item->bbox.top += voffset; g_memmove(&len, p, sizeof(int)); p+= sizeof(int); item->text = g_malloc(len+1); g_memmove(item->text, p, len+1); p+= len+1; g_memmove(&len, p, sizeof(int)); p+= sizeof(int); item->font_name = g_malloc(len+1); g_memmove(item->font_name, p, len+1); p+= len+1; g_memmove(&item->font_size, p, sizeof(double)); p+= sizeof(double); make_canvas_item_one(ui.cur_layer->group, item); } if (item->type == ITEM_IMAGE) { item->canvas_item = NULL; item->image_png = NULL; item->image_png_len = 0; g_memmove(&item->bbox, p, sizeof(struct BBox)); p+= sizeof(struct BBox); item->bbox.left += hoffset; item->bbox.right += hoffset; item->bbox.top += voffset; item->bbox.bottom += voffset; g_memmove(&item->image_png_len, p, sizeof(gsize)); p+= sizeof(gsize); if (item->image_png_len > 0) { item->image_png = g_memdup(p, item->image_png_len); item->image = pixbuf_from_buffer(item->image_png, item->image_png_len); p+= item->image_png_len; } else { item->image = NULL; } make_canvas_item_one(ui.cur_layer->group, item); } } prepare_new_undo(); undo->type = ITEM_PASTE; undo->layer = ui.cur_layer; undo->itemlist = g_list_copy(ui.selection->items); gtk_selection_data_free(sel_data); update_copy_paste_enabled(); update_color_menu(); update_thickness_buttons(); update_color_buttons(); update_font_button(); update_cursor(); // FIXME: can't know if pointer is within selection! }
void finalize_selectregion(void) { GList *itemlist; struct Item *item; ArtVpath *vpath; ArtSVP *lassosvp; int i, n; double *pt; ui.cur_item_type = ITEM_NONE; // build SVP for the lasso path n = ui.cur_path.num_points; vpath = g_malloc((n+2)*sizeof(ArtVpath)); for (i=0; i<n; i++) { vpath[i].x = ui.cur_path.coords[2*i]; vpath[i].y = ui.cur_path.coords[2*i+1]; } vpath[n].x = vpath[0].x; vpath[n].y = vpath[0].y; vpath[0].code = ART_MOVETO; for (i=1; i<=n; i++) vpath[i].code = ART_LINETO; vpath[n+1].code = ART_END; lassosvp = art_svp_from_vpath(vpath); g_free(vpath); // see which items we selected for (itemlist = ui.selection->layer->items; itemlist!=NULL; itemlist = itemlist->next) { item = (struct Item *)itemlist->data; if (hittest_item(lassosvp, item)) { // update the selection bbox if (ui.selection->items==NULL || ui.selection->bbox.left>item->bbox.left) ui.selection->bbox.left = item->bbox.left; if (ui.selection->items==NULL || ui.selection->bbox.right<item->bbox.right) ui.selection->bbox.right = item->bbox.right; if (ui.selection->items==NULL || ui.selection->bbox.top>item->bbox.top) ui.selection->bbox.top = item->bbox.top; if (ui.selection->items==NULL || ui.selection->bbox.bottom<item->bbox.bottom) ui.selection->bbox.bottom = item->bbox.bottom; // add the item ui.selection->items = g_list_append(ui.selection->items, item); } } art_svp_free(lassosvp); if (ui.selection->items == NULL) { // if we clicked inside a text zone or image? pt = ui.cur_path.coords; item = click_is_in_text_or_image(ui.selection->layer, pt[0], pt[1]); if (item!=NULL) { for (i=0; i<n; i++, pt+=2) { if (pt[0]<item->bbox.left || pt[0]>item->bbox.right || pt[1]<item->bbox.top || pt[1]>item->bbox.bottom) { item = NULL; break; } } } if (item!=NULL) { ui.selection->items = g_list_append(ui.selection->items, item); g_memmove(&(ui.selection->bbox), &(item->bbox), sizeof(struct BBox)); } } if (ui.selection->items == NULL) reset_selection(); else { // make a selection rectangle instead of the lasso shape gtk_object_destroy(GTK_OBJECT(ui.selection->canvas_item)); ui.selection->canvas_item = gnome_canvas_item_new(ui.cur_layer->group, gnome_canvas_rect_get_type(), "width-pixels", 1, "outline-color-rgba", 0x000000ff, "fill-color-rgba", 0x80808040, "x1", ui.selection->bbox.left, "x2", ui.selection->bbox.right, "y1", ui.selection->bbox.top, "y2", ui.selection->bbox.bottom, NULL); make_dashed(ui.selection->canvas_item); ui.selection->type = ITEM_SELECTRECT; } update_cursor(); update_copy_paste_enabled(); update_font_button(); }
void init_stuff (int argc, char *argv[]) { GtkWidget *w; GList *dev_list; GdkDevice *device; GdkScreen *screen; int i, j; struct Brush *b; gboolean can_xinput, success; gchar *tmppath, *tmpfn; // create some data structures needed to populate the preferences ui.default_page.bg = g_new(struct Background, 1); // initialize config file names tmppath = g_build_filename(g_get_home_dir(), CONFIG_DIR, NULL); mkdir(tmppath, 0700); // safer (MRU data may be confidential) ui.mrufile = g_build_filename(tmppath, MRU_FILE, NULL); ui.configfile = g_build_filename(tmppath, CONFIG_FILE, NULL); g_free(tmppath); // initialize preferences init_config_default(); load_config_from_file(); ui.font_name = g_strdup(ui.default_font_name); ui.font_size = ui.default_font_size; ui.hiliter_alpha_mask = 0xffffff00 + (guint)(255*ui.hiliter_opacity); // we need an empty canvas prior to creating the journal structures canvas = GNOME_CANVAS (gnome_canvas_new_aa ()); // initialize data ui.default_page.bg->canvas_item = NULL; ui.layerbox_length = 0; if (argc > 2 || (argc == 2 && argv[1][0] == '-')) { printf(_("Invalid command line parameters.\n" "Usage: %s [filename.xoj]\n"), argv[0]); gtk_exit(0); } undo = NULL; redo = NULL; journal.pages = NULL; bgpdf.status = STATUS_NOT_INIT; new_journal(); ui.cur_item_type = ITEM_NONE; ui.cur_item = NULL; ui.cur_path.coords = NULL; ui.cur_path_storage_alloc = 0; ui.cur_path.ref_count = 1; ui.cur_widths = NULL; ui.cur_widths_storage_alloc = 0; ui.selection = NULL; ui.cursor = NULL; ui.pen_cursor_pix = ui.hiliter_cursor_pix = NULL; ui.cur_brush = &(ui.brushes[0][ui.toolno[0]]); for (j=0; j<=NUM_BUTTONS; j++) for (i=0; i < NUM_STROKE_TOOLS; i++) { b = &(ui.brushes[j][i]); b->tool_type = i; if (b->color_no>=0) { b->color_rgba = predef_colors_rgba[b->color_no]; if (i == TOOL_HIGHLIGHTER) { b->color_rgba &= ui.hiliter_alpha_mask; } } b->thickness = predef_thickness[i][b->thickness_no]; } for (i=0; i<NUM_STROKE_TOOLS; i++) g_memmove(ui.default_brushes+i, &(ui.brushes[0][i]), sizeof(struct Brush)); ui.cur_mapping = 0; ui.which_unswitch_button = 0; ui.in_proximity = FALSE; ui.warned_generate_fontconfig = FALSE; reset_recognizer(); // initialize various interface elements gtk_window_set_default_size(GTK_WINDOW (winMain), ui.window_default_width, ui.window_default_height); if (ui.maximize_at_start) gtk_window_maximize(GTK_WINDOW (winMain)); update_toolbar_and_menu(); update_font_button(); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("journalApplyAllPages")), ui.bg_apply_all_pages); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("journalNewPageKeepsBG")), ui.new_page_bg_from_pdf); if (ui.fullscreen) { gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("viewFullscreen")), TRUE); gtk_toggle_tool_button_set_active( GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonFullscreen")), TRUE); gtk_window_fullscreen(GTK_WINDOW(winMain)); } gtk_button_set_relief(GTK_BUTTON(GET_COMPONENT("buttonColorChooser")), GTK_RELIEF_NONE); allow_all_accels(); add_scroll_bindings(); // prevent interface items from stealing focus // glade doesn't properly handle can_focus, so manually set it gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(GET_COMPONENT("comboLayer")), FALSE); g_signal_connect(GET_COMPONENT("spinPageNo"), "activate", G_CALLBACK(handle_activate_signal), NULL); gtk_container_forall(GTK_CONTAINER(winMain), unset_flags, (gpointer)GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS(GTK_WIDGET(canvas), GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS(GTK_WIDGET(GET_COMPONENT("spinPageNo")), GTK_CAN_FOCUS); // install hooks on button/key/activation events to make the spinPageNo lose focus gtk_container_forall(GTK_CONTAINER(winMain), install_focus_hooks, NULL); // set up and initialize the canvas gtk_widget_show (GTK_WIDGET (canvas)); w = GET_COMPONENT("scrolledwindowMain"); gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (canvas)); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (w), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_events (GTK_WIDGET (canvas), GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK); gnome_canvas_set_pixels_per_unit (canvas, ui.zoom); gnome_canvas_set_center_scroll_region (canvas, TRUE); gtk_layout_get_hadjustment(GTK_LAYOUT (canvas))->step_increment = ui.scrollbar_step_increment; gtk_layout_get_vadjustment(GTK_LAYOUT (canvas))->step_increment = ui.scrollbar_step_increment; // set up the page size and canvas size update_page_stuff(); g_signal_connect ((gpointer) canvas, "button_press_event", G_CALLBACK (on_canvas_button_press_event), NULL); g_signal_connect ((gpointer) canvas, "button_release_event", G_CALLBACK (on_canvas_button_release_event), NULL); g_signal_connect ((gpointer) canvas, "enter_notify_event", G_CALLBACK (on_canvas_enter_notify_event), NULL); g_signal_connect ((gpointer) canvas, "leave_notify_event", G_CALLBACK (on_canvas_leave_notify_event), NULL); g_signal_connect ((gpointer) canvas, "proximity_in_event", G_CALLBACK (on_canvas_proximity_event), NULL); g_signal_connect ((gpointer) canvas, "proximity_out_event", G_CALLBACK (on_canvas_proximity_event), NULL); g_signal_connect ((gpointer) canvas, "expose_event", G_CALLBACK (on_canvas_expose_event), NULL); g_signal_connect ((gpointer) canvas, "key_press_event", G_CALLBACK (on_canvas_key_press_event), NULL); g_signal_connect ((gpointer) canvas, "motion_notify_event", G_CALLBACK (on_canvas_motion_notify_event), NULL); g_signal_connect ((gpointer) gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)), "value-changed", G_CALLBACK (on_vscroll_changed), NULL); g_signal_connect ((gpointer) gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), "value-changed", G_CALLBACK (on_hscroll_changed), NULL); g_object_set_data (G_OBJECT (winMain), "canvas", canvas); screen = gtk_widget_get_screen(winMain); ui.screen_width = gdk_screen_get_width(screen); ui.screen_height = gdk_screen_get_height(screen); can_xinput = FALSE; dev_list = gdk_devices_list(); while (dev_list != NULL) { device = (GdkDevice *)dev_list->data; if (device != gdk_device_get_core_pointer() && device->num_axes >= 2) { /* get around a GDK bug: map the valuator range CORRECTLY to [0,1] */ #ifdef ENABLE_XINPUT_BUGFIX gdk_device_set_axis_use(device, 0, GDK_AXIS_IGNORE); gdk_device_set_axis_use(device, 1, GDK_AXIS_IGNORE); #endif gdk_device_set_mode(device, GDK_MODE_SCREEN); if (g_strrstr(device->name, "raser")) gdk_device_set_source(device, GDK_SOURCE_ERASER); can_xinput = TRUE; } dev_list = dev_list->next; } if (!can_xinput) gtk_widget_set_sensitive(GET_COMPONENT("optionsUseXInput"), FALSE); ui.use_xinput = ui.allow_xinput && can_xinput; gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsProgressiveBG")), ui.progressive_bg); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsPrintRuling")), ui.print_ruling); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsAutoloadPdfXoj")), ui.autoload_pdf_xoj); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsAutosaveXoj")), ui.autosave_enabled); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsLeftHanded")), ui.left_handed); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsShortenMenus")), ui.shorten_menus); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsAutoSavePrefs")), ui.auto_save_prefs); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsButtonSwitchMapping")), ui.button_switch_mapping); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsLargePenCursor")), ui.large_pencursor); gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsPenCursor")), ui.pen_cursor); hide_unimplemented(); update_undo_redo_enabled(); update_copy_paste_enabled(); update_vbox_order(ui.vertical_order[ui.fullscreen?1:0]); gtk_widget_grab_focus(GTK_WIDGET(canvas)); // show everything... gtk_widget_show (winMain); update_cursor(); /* this will cause extension events to get enabled/disabled, but we need the windows to be mapped first */ gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsUseXInput")), ui.use_xinput); /* fix a bug in GTK+ 2.16 and 2.17: scrollbars shouldn't get extended input events from pointer motion when cursor moves into main window */ if (!gtk_check_version(2, 16, 0)) { g_signal_connect ( GET_COMPONENT("menubar"), "event", G_CALLBACK (filter_extended_events), NULL); g_signal_connect ( GET_COMPONENT("toolbarMain"), "event", G_CALLBACK (filter_extended_events), NULL); g_signal_connect ( GET_COMPONENT("toolbarPen"), "event", G_CALLBACK (filter_extended_events), NULL); g_signal_connect ( GET_COMPONENT("statusbar"), "event", G_CALLBACK (filter_extended_events), NULL); g_signal_connect ( (gpointer)(gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(w))), "event", G_CALLBACK (filter_extended_events), NULL); g_signal_connect ( (gpointer)(gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(w))), "event", G_CALLBACK (filter_extended_events), NULL); } // 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); } }