1 /*************************************************************************** 2 * Copyright (C) 2007 by PCMan (Hong Jen Yee) * 3 * pcman.tw@gmail.com * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU General Public License as published by * 7 * the Free Software Foundation; either version 2 of the License, or * 8 * (at your option) any later version. * 9 * * 10 * This program is distributed in the hope that it will be useful, * 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * GNU General Public License for more details. * 14 * * 15 * You should have received a copy of the GNU General Public License * 16 * along with this program; if not, write to the * 17 * Free Software Foundation, Inc., * 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19 ***************************************************************************/ 20 #ifndef MAINWIN_H 21 #define MAINWIN_H 22 23 #include <gtk/gtk.h> 24 #include <gdk-pixbuf/gdk-pixbuf.h> 25 26 #include "image-view.h" 27 #include "image-list.h" 28 29 /** 30 @author PCMan (Hong Jen Yee) <pcman.tw@gmail.com> 31 */ 32 33 #define MAIN_WIN_TYPE (main_win_get_type ()) 34 #define MAIN_WIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIN_WIN_TYPE, MainWin)) 35 #define MAIN_WIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIN_WIN_TYPE, MainWinClass)) 36 #define IS_MAIN_WIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIN_WIN_TYPE)) 37 #define IS_MAIN_WIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIN_WIN_TYPE)) 38 #define MAIN_WIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIN_WIN_TYPE, MainWinClass)) 39 40 typedef enum 41 { 42 ZOOM_NONE = 0, 43 ZOOM_FIT, 44 ZOOM_ORIG, 45 ZOOM_SCALE 46 } ZoomMode; 47 48 typedef struct _MainWinClass 49 { 50 GtkWindowClass parent_class; 51 } MainWinClass; 52 53 typedef struct _MainWin 54 { 55 GtkWindow parent; 56 57 GdkPixbuf* pix; 58 GdkPixbufAnimation* animation; 59 GdkPixbufAnimationIter* animation_iter; 60 guint animation_timeout; 61 62 GtkWidget* img_view; 63 GtkWidget* scroll; 64 GtkWidget* evt_box; 65 GtkWidget* nav_bar; 66 GtkWidget* btn_rotate_cw; 67 GtkWidget* btn_rotate_ccw; 68 GtkWidget* btn_flip_v; 69 GtkWidget* btn_flip_h; 70 GtkWidget* btn_orig; 71 GtkWidget* btn_fit; 72 GtkWidget* btn_play_stop; 73 GtkWidget* img_play_stop; 74 GtkWidget* percent; 75 GdkCursor* hand_cursor; 76 77 GtkAllocation scroll_allocation; 78 79 ZoomMode zoom_mode; 80 gboolean full_screen; 81 gboolean slideshow_running; 82 gboolean slideshow_cancelled; 83 guint slide_timeout; 84 gboolean dragging; 85 double scale; 86 int drag_old_x; 87 int drag_old_y; 88 int rotation_angle; 89 ImageList* img_list; 90 } MainWin; 91 92 GtkWidget* main_win_new(); 93 94 gboolean main_win_open( MainWin* mw, const char* file_path, ZoomMode zoom ); 95 96 void main_win_start_slideshow( MainWin* mw ); 97 98 void main_win_close( MainWin* mw ); 99 100 gboolean main_win_save( MainWin* mw, const char* file_path, const char* type, gboolean confirm ); 101 102 void main_win_show_error( MainWin* mw, const char* message ); 103 104 void main_win_fit_size( MainWin* mw, int width, int height, gboolean can_strech, GdkInterpType type ); 105 106 void main_win_fit_window_size( MainWin* mw, gboolean can_strech, GdkInterpType type ); 107 108 void main_win_center_image( MainWin* mw ); 109 110 gboolean main_win_scale_image( MainWin* mw, double new_scale, GdkInterpType type ); 111 112 113 GType main_win_get_type(); 114 115 #endif 116