1 // interface.h
2 // LiVES
3 // (c) G. Finch 2003 - 2020 <salsaman+lives@gmail.com>
4 // Released under the GNU GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 #ifndef HAS_LIVES_INTERFACE_H
8 #define HAS_LIVES_INTERFACE_H
9 
10 // CE timeline bars
11 #define OVERDRAW_MARGIN 16
12 
13 /// clip editor hrule height
14 #define CE_HRULE_HEIGHT ((int)(20. * widget_opts.scale))
15 
16 /// clip edit vid/aud bar height
17 #define CE_VIDBAR_HEIGHT ((int)(4. * widget_opts.scale))
18 
19 /// clip edit vid/aud bar height
20 #define CE_AUDBAR_HEIGHT ((int)(48. * widget_opts.scale))
21 
22 #define MSG_AREA_VMARGIN 0
23 #define LAYOUT_SIZE_MIN 0
24 
25 #define SCRN_BRDR 2.
26 
27 boolean update_dsu(void *lab);
28 
29 void draw_little_bars(double ptrtime, int which);
30 double lives_ce_update_timeline(frames_t frame, double x);  ///< pointer position in timeline
31 void update_timer_bars(int posx, int posy, int width, int height, int which); ///< draw the timer bars
32 void redraw_timer_bars(double oldx, double newx, int which); ///< paint a damage region
33 void show_playbar_labels(int clipno);
34 void redraw_timeline(int clipno);
35 
36 void msg_area_scroll(LiVESAdjustment *, livespointer userdata);
37 void msg_area_scroll_to_end(LiVESWidget *, LiVESAdjustment *);
38 boolean on_msg_area_scroll(LiVESWidget *, LiVESXEventScroll *, livespointer user_data);
39 boolean expose_msg_area(LiVESWidget *, lives_painter_t *, livespointer user_data);
40 boolean msg_area_config(LiVESWidget *);
41 boolean reshow_msg_area(LiVESWidget *, lives_painter_t *, livespointer user_data);
42 
43 boolean expose_vid_draw(LiVESWidget *, lives_painter_t *, livespointer psurf);
44 boolean expose_laud_draw(LiVESWidget *, lives_painter_t *, livespointer psurf);
45 boolean expose_raud_draw(LiVESWidget *, lives_painter_t *, livespointer psurf);
46 
47 boolean config_vid_draw(LiVESWidget *, LiVESXEventConfigure *, livespointer user_data);
48 boolean config_laud_draw(LiVESWidget *, LiVESXEventConfigure *, livespointer user_data);
49 boolean config_raud_draw(LiVESWidget *, LiVESXEventConfigure *, livespointer user_data);
50 
51 void clear_tbar_bgs(int posx, int posy, int width, int height, int which);
52 
53 boolean redraw_tl_idle(void *data);
54 
55 LiVESWidget *create_opensel_dialog(int frames, double fps);
56 
57 LiVESWidget *create_encoder_prep_dialog(const char *text1, const char *text2, boolean opt_resize);
58 
59 void widget_add_preview(LiVESWidget *, LiVESBox *for_preview, LiVESBox *for_button,
60                         LiVESBox *for_deinterlace, int preview_type);  ///< for fileselector preview
61 
62 /// window change speed from Tools menu
63 void create_new_pb_speed(short type);
64 
65 boolean do_audio_choice_dialog(short startup_phase);
66 
67 void do_keys_window(void);
68 
69 void do_mt_keys_window(void);
70 
71 LiVESWidget *create_cleardisk_advanced_dialog(void);
72 
73 LiVESWidget *make_autoreload_check(LiVESHBox *parent, boolean is_active);
74 
75 LiVESWidget *add_list_expander(LiVESBox *, const char *title, int width, int height, LiVESList *xlist);
76 
77 typedef struct {
78   LiVESWidget *dialog;
79   LiVESWidget *textview_type;
80   LiVESWidget *textview_fps;
81   LiVESWidget *textview_size;
82   LiVESWidget *textview_frames;
83   LiVESWidget *textview_vtime;
84   LiVESWidget *textview_fsize;
85   LiVESWidget *textview_ltime;
86   LiVESWidget *textview_rtime;
87   LiVESWidget *textview_lrate;
88   LiVESWidget *textview_rrate;
89 } lives_clipinfo_t;
90 
91 lives_clipinfo_t *create_clip_info_window(int audio_channels, boolean is_mt);
92 
93 typedef struct {
94   LiVESWidget *dialog;
95   LiVESWidget *entry;
96   LiVESWidget *dir_entry;
97   LiVESWidget *name_entry;
98   LiVESWidget *warn_checkbutton;
99   LiVESWidget *okbutton;
100   LiVESWidget *cancelbutton;
101   LiVESWidget *expander;
102   LiVESWidget *exp_label;
103   LiVESWidget *exp_vbox;
104   LiVESWidget *layouts_layout;
105   LiVESWidget *clips_layout;
106   LiVESWidget *parent;
107 } _entryw;
108 
109 _entryw *create_rename_dialog(int type);
110 _entryw *create_location_dialog(void);
111 _entryw *create_cds_dialog(int type);
112 
113 typedef struct __insertw {
114   LiVESWidget *insert_dialog;
115   LiVESWidget *with_sound;
116   LiVESWidget *without_sound;
117   LiVESWidget *spinbutton_times;
118   LiVESWidget *fit_checkbutton;
119 } _insertw;
120 
121 _insertw *create_insert_dialog(void);
122 
123 typedef struct __commentsw {
124   LiVESWidget *comments_dialog;
125   LiVESWidget *title_entry;
126   LiVESWidget *author_entry;
127   LiVESWidget *comment_entry;
128   LiVESWidget *subt_checkbutton;
129   LiVESWidget *subt_entry;
130 } _commentsw;
131 
132 _commentsw *create_comments_dialog(lives_clip_t *, char *filename);
133 
134 typedef struct {
135   LiVESWidget *dialog;
136   LiVESWidget *clear_button;
137   LiVESWidget *delete_button;
138   LiVESWidget *textview;
139   LiVESWidget *table;
140   LiVESWidget *button;
141   LiVESWidget *vbox;
142   LiVESWidget *scrolledwindow;
143 } text_window;
144 
145 
146 text_window *create_text_window(const char *title_part, const char *text, LiVESTextBuffer *,
147                                 boolean add_buttons);
148 
149 LiVESWidget *scrolled_textview(const char *text, LiVESTextBuffer *, int window_width,
150                                LiVESWidget **ptextview);
151 typedef struct {
152   LiVESWidget *dialog;
153   LiVESWidget *time_spin;
154   boolean is_sel;
155 } aud_dialog_t;
156 
157 typedef struct {
158   boolean use_advanced;
159   LiVESWidget *advbutton;
160   LiVESWidget *adv_vbox;
161   LiVESWidget *combod;
162   LiVESWidget *comboo;
163   LiVESWidget *spinbuttoni;
164   LiVESWidget *spinbuttonw;
165   LiVESWidget *spinbuttonh;
166   LiVESWidget *spinbuttonf;
167   LiVESWidget *radiobuttond;
168 } lives_tvcardw_t;
169 
170 #define LIVES_PREVIEW_TYPE_VIDEO_AUDIO 1
171 #define LIVES_PREVIEW_TYPE_VIDEO_ONLY 2
172 #define LIVES_PREVIEW_TYPE_AUDIO_ONLY 3
173 #define LIVES_PREVIEW_TYPE_RANGE 4
174 #define LIVES_PREVIEW_TYPE_IMAGE_ONLY 5
175 
176 #define LIVES_FILE_SELECTION_UNDEFINED 0
177 #define LIVES_FILE_SELECTION_VIDEO_AUDIO 1
178 #define LIVES_FILE_SELECTION_AUDIO_ONLY 2
179 #define LIVES_FILE_SELECTION_VIDEO_AUDIO_MULTI 3
180 #define LIVES_FILE_SELECTION_VIDEO_RANGE 4
181 #define LIVES_FILE_SELECTION_IMAGE_ONLY 5
182 #define LIVES_FILE_SELECTION_SAVE 6
183 #define LIVES_FILE_SELECTION_OPEN 7
184 
185 #define LIVES_DIR_SELECTION_CREATE_FOLDER 1024
186 #define LIVES_DIR_SELECTION_SELECT_FOLDER 1025
187 #define LIVES_DIR_SELECTION_WORKDIR 1026
188 #define LIVES_DIR_SELECTION_DEVICES 1027
189 
190 aud_dialog_t *create_audfade_dialog(int type);
191 LiVESWidget *create_combo_dialog(int type, LiVESList *list);
192 
193 xprocess *create_processing(const char *text);
194 xprocess *create_threaded_dialog(char *text, boolean has_cancel, boolean *td_had_focus);
195 void add_to_clipmenu(void);
196 void remove_from_clipmenu(void);
197 
198 boolean get_play_screen_size(int *opwidth, int *opheight); /// actually in gui.c
199 void make_play_window(void);
200 void resize_play_window(void);
201 void kill_play_window(void);
202 void make_preview_box(void);
203 void play_window_set_title(void);
204 void add_to_playframe(void);
205 LiVESWidget *create_cdtrack_dialog(int type, livespointer user_data);
206 
207 typedef struct {
208   LiVESWidget *dialog;
209   LiVESWidget *atrigger_button;
210   LiVESWidget *atrigger_spin;
211   LiVESWidget *apb_button;
212   LiVESWidget *mute_button;
213   LiVESWidget *debug_button;
214 } autolives_window;
215 
216 autolives_window *autolives_pre_dialog(void);
217 
218 LiVESTextView *create_output_textview(void);
219 
220 void on_filesel_button_clicked(LiVESButton *, livespointer);
221 
222 char *choose_file(const char *dir, const char *fname, char **const filt, LiVESFileChooserAction act, const char *title,
223                   LiVESWidget *extra);
224 char *choose_file_bg(const char *dir, const char *fname, char **const filt, LiVESFileChooserAction act, const char *title,
225                      LiVESWidget *extra);
226 LiVESWidget *choose_file_with_preview(const char *dir, const char *title, char **const filt, int preview_type);
227 
228 void add_suffix_check(LiVESBox *, const char *ext);
229 
230 const lives_special_aspect_t *add_aspect_ratio_button(LiVESSpinButton *sp_width, LiVESSpinButton *sp_height,
231     LiVESBox *container);
232 
233 #define DEF_AUD_FADE_SECS 10. ///< default time to offer fade audio in/out for
234 
235 #define MIN_MSGBOX_WIDTH ((int)(620. * widget_opts.scale))
236 
237 // textboxes for clip info
238 #define TB_WIDTH ((int)(300. * widget_opts.scale))
239 #define TB_HEIGHT_VID ((int)(80. * widget_opts.scale))
240 #define TB_HEIGHT_AUD ((int)(50. * widget_opts.scale))
241 
242 typedef enum {
243   LIVES_MATCH_UNDEFINED = 0,
244   LIVES_MATCH_NEAREST,
245   LIVES_MATCH_AT_LEAST,
246   LIVES_MATCH_AT_MOST,
247   LIVES_MATCH_HIGHEST,
248   LIVES_MATCH_LOWEST,
249   LIVES_MATCH_CHOICE,
250   LIVES_MATCH_SPECIFIED
251 } lives_size_match_t;
252 
253 typedef struct {
254   char URI[8192];
255   char save_dir[PATH_MAX];
256   char fname[PATH_MAX];
257   char format[256];
258   char ext[16];
259   int desired_width;
260   int desired_height;
261   float desired_fps;  // unused for now
262   lives_size_match_t matchsize;
263   boolean do_update;
264   boolean allownf;
265   boolean debug;
266   char vidchoice[512];
267   char audchoice[512];
268   // TODO: add audio bitrate ?, audio_lang, get_sub, sub_format, sub_language, etc.
269 } lives_remote_clip_request_t;
270 
271 lives_remote_clip_request_t *run_youtube_dialog(lives_remote_clip_request_t *);
272 boolean youtube_select_format(lives_remote_clip_request_t *);
273 
274 typedef struct {
275   boolean scanning;
276   LiVESWidget *top_label;
277   LiVESWidget *dsu_label;
278   LiVESWidget *used_label;
279   LiVESWidget *inst_label;
280   LiVESWidget *note_label;
281   LiVESWidget *checkbutton;
282   LiVESWidget *vlabel;
283   LiVESWidget *vvlabel;
284   LiVESWidget *pculabel;
285   LiVESWidget *slider;
286   LiVESWidget *button;
287   LiVESWidget *abort_button;
288   LiVESWidget *resbutton;
289   LiVESWidget *expander;
290   LiVESWidget *exp_vbox;
291   LiVESWidget *exp_layout;
292   boolean setting, visible;
293   uint64_t sliderfunc, checkfunc;
294   lives_painter_surface_t *dsu_surface;
295   boolean crit_dism;
296   char *ext;
297 } _dsquotaw;
298 
299 void run_diskspace_dialog(void);
300 void run_diskspace_dialog_cb(LiVESWidget *, livespointer data);
301 boolean run_diskspace_dialog_idle(livespointer data);
302 
303 LiVESResponseType filter_cleanup(const char *trashdir, LiVESList **rec_list, LiVESList **rem_list,
304                                  LiVESList **left_list);
305 
306 LiVESWidget *trash_rb(LiVESButtonBox *parent);
307 
308 void draw_dsu_widget(LiVESWidget *dsu_widget);
309 
310 _commentsw *commentsw;
311 _entryw *renamew;
312 _entryw *locw;
313 _insertw *insertw;
314 text_window *textwindow;
315 
316 #endif
317