28
28
/* Transition preview frame rate. I decided to use 25 fps, which
29
29
* should be handled on time by most machines. */
30
#define PREVIEW_FPS 25
30
#define PREVIEW_FPS 15
32
32
/* The transition speed is defined as a duration in seconds. */
37
#define comment_string "Imagination Slideshow Project - http://imagination.sf.net"
39
typedef struct _plugin plugin;
43
const gchar *name; /* The name of the transition */
44
gpointer address; /* The mem address of the routine */
37
#define old_comment_string \
38
"Imagination Slideshow Project - http://imagination.sf.net"
39
#define comment_string \
40
"Imagination 2.0 Slideshow Project - http://imagination.sf.net"
43
/* ****************************************************************************
44
* Subtitles related definitions
45
* ************************************************************************* */
46
/* Enum that holds all available positions of text. */
49
IMG_SUB_POS_TOP_LEFT = 0,
50
IMG_SUB_POS_TOP_CENTER,
51
IMG_SUB_POS_TOP_RIGHT,
52
IMG_SUB_POS_MIDDLE_LEFT,
53
IMG_SUB_POS_MIDDLE_CENTER,
54
IMG_SUB_POS_MIDDLE_RIGHT,
55
IMG_SUB_POS_BOTTOM_LEFT,
56
IMG_SUB_POS_BOTTOM_CENTER,
57
IMG_SUB_POS_BOTTOM_RIGHT
61
/* Enum with relative placings */
64
IMG_REL_PLACING_EXPORTED_VIDEO = 0,
65
IMG_REL_PLACING_ORIGINAL_IMAGE
71
* @cr: cairo context that should be used for drawing
72
* @layout: PangoLayout to be rendered
77
* @posx: final position (x coord)
78
* @posy: final position (y coord)
79
* @progress: progress of animation
80
* @font_color: array of RGBA values
82
* This is prototype for subtitle animation function. It's task it to render
83
* @layout to @cr according to @progress, @posx and @posy.
85
* When @progress > 1, @layout should be drawn at (@posx, @posy) without any
88
typedef void (*TextAnimationFunc)( cairo_t *cr,
97
gdouble *font_color );
100
/* ****************************************************************************
101
* Transition related definitions
102
* ************************************************************************* */
103
/* Prototype of transition renderer */
104
typedef void (*ImgRender)( cairo_t *,
109
/* ****************************************************************************
110
* Ken Burns effect related definitions
111
* ************************************************************************* */
112
typedef struct _ImgStopPoint ImgStopPoint;
115
gint time; /* Duration of this stop point */
116
gdouble offx; /* X and Y offsets of zoomed image */
118
gdouble zoom; /* Zoom level */
121
/* ****************************************************************************
122
* define for gtk clipboard
123
* ************************************************************************* */
124
#define IMG_CLIPBOARD (gdk_atom_intern_static_string ("IMAGINATIO_OWN_CLIPBOARD"))
125
#define IMG_INFO_LIST (gdk_atom_intern_static_string ("application/imagination-info-list"))
133
/* ****************************************************************************
134
* Common definitions that are used all over the place
135
* ************************************************************************* */
47
136
typedef struct _slide_struct slide_struct;
49
137
struct _slide_struct
56
gchar *path; /* transition model string path representation */
58
void (*render) (GdkDrawable*, GdkPixbuf*, GdkPixbuf*, gdouble, gint);
139
/* Common data - always filled */
140
gchar *resolution; /* Image dimensions */
141
gchar *type; /* Image type */
143
/* Fields that are filled when we load slide from disk */
144
gchar *filename; /* Filename of the image that slide represents */
145
gchar *original_filename; /* This is filled if the image has been rotated */
147
/* Fields that are filled if we create slide in memory */
148
gint gradient; /* Gradient type */
149
gdouble g_start_color[3]; /* RGB start color */
150
gdouble g_stop_color[3]; /* RGB stop color */
151
gdouble g_start_point[2]; /* x, y coordinates of start point */
152
gdouble g_stop_point[2]; /* x, y coordinates of stop point */
154
/* Still part of the slide params */
155
guint duration; /* Duration of still part */ /* NOTE: sub1 */
157
/* Transition params */
158
gchar *path; /* Transition model path to transition */
159
gint transition_id; /* Transition id */
160
ImgRender render; /* Transition render function */
161
guint speed; /* Transition speed */ /* NOTE: sub1 */
163
/* Ken Burns effect variables */
164
GList *points; /* List with stop points */
165
gint no_points; /* Number of stop points in list */
166
gint cur_point; /* Currently active stop point */
168
/* Subtitle variables */
169
gchar *subtitle; /* Subtitle text */
170
TextAnimationFunc anim; /* Animation functions */
171
gint anim_id; /* Animation id */
172
gint anim_duration; /* Duration of animation */
173
ImgSubPos position; /* Final position of subtitle */
174
ImgRelPlacing placing; /* Relative placing */
175
PangoFontDescription *font_desc; /* Font description */
176
gdouble font_color[4]; /* Font color (RGBA format) */
61
179
typedef struct _img_window_struct img_window_struct;
63
180
struct _img_window_struct
65
182
/* Main GUI related variables */
66
183
GtkWidget *imagination_window; // Main window
184
GtkAccelGroup *accel_group;
67
185
GtkWidget *open_menu;
68
186
GtkWidget *save_menu;
69
187
GtkWidget *save_as_menu;
70
GtkWidget *properties_menu;
71
GtkWidget *close_menu;
72
188
GtkWidget *open_button;
73
189
GtkWidget *save_button;
74
GtkWidget *import_menu;
75
GtkWidget *import_audio_menu;
76
193
GtkWidget *remove_menu;
77
GtkWidget *import_button;
78
GtkWidget *import_audio_button;
79
GtkWidget *remove_button;
80
194
GtkWidget *preview_menu;
81
195
GtkWidget *preview_button;
82
GtkWidget *export_menu;
83
GtkWidget *export_button;
84
196
GtkWidget *transition_type;
85
197
GtkWidget *random_button;
86
198
GtkWidget *duration; // Duration spin button
87
199
GtkWidget *trans_duration;
88
GtkWidget *slide_selected_data;
90
200
GtkWidget *total_time_data;
91
201
GtkWidget *filename_data;
92
GtkWidget *resolution_data;
93
GtkWidget *thumb_scrolledwindow;
202
GtkTextBuffer *slide_text_buffer;
203
GtkWidget *scrolled_win;
204
GtkWidget *expand_button;
205
GtkWidget *text_pos_button;
94
206
GtkWidget *thumbnail_iconview;
95
207
GtkWidget *statusbar;
96
208
GtkWidget *progress_bar;
98
209
GtkWidget *image_area;
100
211
GtkListStore *thumbnail_model;
101
212
gchar *current_dir;
213
GSList *rotated_files;
215
GtkWidget *paned; /* Main paned (used for saving/restoring geometry) */
218
gint mode; /* In what mode are we in: 0 - preview
220
gboolean auto_switch; /* Has been last mode switch made automatically? */
221
GtkWidget *prev_root; /* Preview mode root widget */
222
GtkWidget *over_root; /* Overview mode root widget */
223
GtkWidget *thum_root; /* Thumbnail root widget */
224
GtkWidget *over_icon; /* Overview iconview */
225
GtkWidget *active_icon; /* Currently active icon view */
226
GObject *over_cell; /* Overview cell renderer */
228
/* Ken Burns related controls */
229
GtkWidget *ken_left; /* Go to left stop point button */
230
GtkWidget *ken_entry; /* Jump to stop point entry */
231
GtkWidget *ken_right; /* Go to right stop point button */
232
GtkWidget *ken_duration; /* Stop point duration spin button */
233
GtkWidget *ken_zoom; /* Zoom slider */
234
GtkWidget *ken_add; /* Add stop point button */
235
GtkWidget *ken_update; /* Update stop point button */
236
GtkWidget *ken_remove; /* Remove stop point button */
238
/* Subtitle related controls */
239
GtkWidget *sub_textview; /* Text view */
240
GtkWidget *sub_font; /* Font button */
241
GtkWidget *sub_color; /* Color selector button */
242
GtkWidget *sub_anim; /* Animation combo box */
243
GtkWidget *sub_anim_duration; /* Animation duration spin button */
244
GtkWidget *sub_placing; /* Placing combo box */
245
GtkWidget *sub_pos; /* Position selector button */
103
247
/* Import slides dialog variables */
104
248
GtkWidget *dim_label;
105
249
GtkWidget *size_label;
106
250
GtkWidget *preview_image;
252
/* Current image position parameters */
253
gdouble x; /* Last button press coordinates */
255
gdouble bak_offx; /* Stored offset at button press */
257
gdouble maxoffx; /* Maximal offsets for current zoom */
259
ImgStopPoint current_point; /* Data for rendering current image */
260
slide_struct *current_slide;
263
gint subtitle_update_id; /* Update subtitle display */
264
gint total_dur_id; /* Update total duration */
108
266
/* Renderers and module stuff */
109
267
gint nr_transitions_loaded;
110
268
GSList *plugin_list;
113
271
gchar *project_filename; // project name for saving
114
272
gboolean distort_images;
115
273
gboolean project_is_modified;
116
guint32 background_color;
276
gdouble background_color[3];
118
278
gint total_music_secs;
120
280
slide_struct final_transition; /* Only speed, render and duration fields
121
of this structure are used (and duration is
281
of this structure are used (and duration
124
284
/* Variables common to export and preview functions */
125
slide_struct *current_slide;
126
GdkPixbuf *slide_pixbuf;
129
GtkTreeIter *cur_ss_iter;
285
slide_struct *work_slide;
286
cairo_surface_t *current_image; /* Image in preview area */
287
cairo_surface_t *exported_image; /* Image being exported */
288
cairo_surface_t *image1; /* Original images */
289
cairo_surface_t *image2;
290
cairo_surface_t *image_from; /* Images used in transition rendering */
291
cairo_surface_t *image_to;
292
ImgStopPoint *point1; /* Last stop point of image1 */
293
ImgStopPoint *point2; /* First stop point of image2 */
294
GtkTreeIter cur_ss_iter;
297
/* Counters that control animation flow */
298
guint total_nr_frames; /* Total number of frames */
299
guint displayed_frame; /* Current frame */
300
guint slide_nr_frames; /* Number of frames fo current slide */
301
guint slide_cur_frame; /* Current slide frame */
302
guint slide_trans_frames; /* Number of frames in transition */
303
guint slide_still_frames; /* Number of frames in still part */
304
guint next_slide_off; /* Time offset of next slide */
306
gint still_counter; /* Currently displayed still frame */
307
gint still_max; /* Number of frames per stop point */
308
gint still_offset; /* Offset in seconds for next stop point */
309
guint still_cmlt; /* Cumulative number of still frames */
310
GList *cur_point; /* Current stop point */
312
gint cur_text_frame; /* Current text frame being displayed */
313
gint no_text_frames; /* All text frames */
133
315
/* Preview related variables */
134
316
gboolean preview_is_running;
135
317
GtkWidget *import_slide_chooser;
136
GtkWidget *slide_number_entry;
318
GtkWidget *total_stop_points_label;
319
GtkWidget *total_slide_number_label;
320
GtkWidget *slide_number_entry;
138
322
/* Export dialog related stuff */
139
323
gint export_is_running; /* 0 - export is not running