1 /* 2 * Copyright © 2009-2018 Siyan Panayotov <contact@siyanpanayotov.com> 3 * 4 * This file is part of Viewnior. 5 * 6 * Viewnior is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Viewnior is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Viewnior. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __VNR_CROP_H_ 21 #define __VNR_CROP_H_ 22 23 #include <gtk/gtk.h> 24 #include "vnr-window.h" 25 26 G_BEGIN_DECLS 27 28 typedef struct _VnrCrop VnrCrop; 29 typedef struct _VnrCropClass VnrCropClass; 30 31 #define VNR_TYPE_CROP (vnr_crop_get_type ()) 32 #define VNR_CROP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VNR_TYPE_CROP, VnrCrop)) 33 #define VNR_CROP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VNR_TYPE_CROP, VnrCropClass)) 34 #define VNR_IS_CROP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VNR_TYPE_CROP)) 35 #define VNR_IS_CROP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VNR_TYPE_CROP)) 36 #define VNR_CROP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VNR_TYPE_CROP, VnrCropClass)) 37 38 struct _VnrCrop { 39 GObject parent; 40 41 VnrWindow *vnr_win; 42 43 GdkPixbuf *preview_pixbuf; 44 45 gdouble zoom; 46 gdouble width; 47 gdouble height; 48 49 GdkGC *gc; 50 GtkWidget *image; 51 GtkSpinButton *spin_x; 52 GtkSpinButton *spin_y; 53 GtkSpinButton *spin_width; 54 GtkSpinButton *spin_height; 55 56 gdouble sub_x; 57 gdouble sub_y; 58 gdouble sub_width; 59 gdouble sub_height; 60 61 gboolean drawing_rectangle; 62 gboolean do_redraw; 63 gdouble start_x; 64 gdouble start_y; 65 66 GdkRectangle area; 67 }; 68 69 struct _VnrCropClass { 70 GObjectClass parent_class; 71 }; 72 73 GType vnr_crop_get_type (void) G_GNUC_CONST; 74 75 GObject *vnr_crop_new (VnrWindow *vnr_win); 76 gboolean vnr_crop_run (VnrCrop *crop); 77 78 G_END_DECLS 79 80 #endif /* __VNR_CROP_H_ */ 81