LiVES  3.2.0
ldvinterface.c
Go to the documentation of this file.
1 // ldvinterface.c
2 // LiVES
3 // (c) G. Finch 2006-2018 <salsaman+lives@gmail.com>
4 // released under the GNU GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 #include "main.h"
8 #include "ldvcallbacks.h"
9 #include "ldvinterface.h"
10 #include "callbacks.h"
11 
12 struct _dvgrabw *create_camwindow(s_cam *cam, int type) {
13  LiVESWidget *hbuttonbox1;
14  LiVESWidget *button3;
15  LiVESWidget *button4;
16  LiVESWidget *vbox;
17  LiVESWidget *hbox;
18  LiVESWidget *label;
19 
20  char *tmp;
21 
22  struct _dvgrabw *dvgrabw = (struct _dvgrabw *)lives_malloc(sizeof(struct _dvgrabw));
23 
24  dvgrabw->filename = NULL;
25 
26  dvgrabw->dialog = lives_standard_dialog_new(_("DVGrab"), FALSE, -1, -1);
28 
29  vbox = lives_dialog_get_content_area(LIVES_DIALOG(dvgrabw->dialog));
30 
31  hbox = lives_hbox_new(FALSE, 0);
32  lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, widget_opts.packing_height);
33 
34  dvgrabw->dirname = lives_filename_to_utf8((tmp = lives_get_current_dir()), -1, NULL, NULL, NULL);
36  LIVES_BOX(hbox), NULL);
37  lives_free(tmp);
38 
40 
41  hbox = lives_hbox_new(FALSE, 0);
42  lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, widget_opts.packing_height);
43 
44  dvgrabw->filent = lives_standard_entry_new(_("File_name:"), type == CAM_FORMAT_DV ? "dvgrab-" : "hdvgrab-", -1, -1,
45  LIVES_BOX(hbox), NULL);
46 
47  if (type == CAM_FORMAT_DV) label = lives_standard_label_new("%d.dv");
48  else label = lives_standard_label_new("%d.mpg");
49  lives_box_pack_start(LIVES_BOX(hbox), label, FALSE, FALSE, 0);
50 
51  label = lives_standard_label_new(_("(files will not be overwritten)"));
52  lives_box_pack_end(LIVES_BOX(hbox), label, FALSE, FALSE, widget_opts.packing_width);
53 
54  hbox = lives_hbox_new(FALSE, 0);
55  lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, widget_opts.packing_height);
56 
57  dvgrabw->split = lives_standard_check_button_new(_("_Split into scenes"), FALSE, LIVES_BOX(hbox), NULL);
58 
59  // TODO - widget_opts.editable
61 
63  lives_entry_set_text(LIVES_ENTRY(dvgrabw->status_entry), _("Status: Ready"));
65 
66  add_hsep_to_box(LIVES_BOX(vbox));
67 
68  hbuttonbox1 = lives_hbutton_box_new();
69 
70  lives_box_pack_start(LIVES_BOX(vbox), hbuttonbox1, FALSE, FALSE, widget_opts.packing_height);
71 
72  // TODO: use lives_dialog_add_button_from_stock()
73 
74  button3 = lives_standard_button_new_from_stock(LIVES_STOCK_MEDIA_REWIND, LIVES_STOCK_LABEL_MEDIA_REWIND,
76 
77  lives_container_add(LIVES_CONTAINER(hbuttonbox1), button3);
79 
80  button4 = lives_standard_button_new_from_stock(LIVES_STOCK_MEDIA_FORWARD, LIVES_STOCK_LABEL_MEDIA_FORWARD,
82 
83  lives_container_add(LIVES_CONTAINER(hbuttonbox1), button4);
85 
88 
89  lives_container_add(LIVES_CONTAINER(hbuttonbox1), dvgrabw->stop);
92 
95 
96  lives_container_add(LIVES_CONTAINER(hbuttonbox1), dvgrabw->play);
98 
99  dvgrabw->grab = lives_standard_button_new_from_stock(LIVES_STOCK_MEDIA_RECORD, _("_Grab"),
101 
102  lives_container_add(LIVES_CONTAINER(hbuttonbox1), dvgrabw->grab);
104 
105  label = lives_standard_label_new(
106  _("\nUse this tool to control your camera and grab clips.\n"
107  "After grabbing your clips, you can close this window \nand then load them into LiVES.\n"));
108  lives_box_pack_start(LIVES_BOX(vbox), label, FALSE, FALSE, widget_opts.packing_height * 4);
109 
110  dvgrabw->quit =
112  LIVES_STOCK_CLOSE, LIVES_STOCK_LABEL_CLOSE_WINDOW,
113  LIVES_RESPONSE_ACCEPT);
114 
116 
118 
119  lives_signal_sync_connect(button3, LIVES_WIDGET_CLICKED_SIGNAL, LIVES_GUI_CALLBACK(on_camrew_clicked), (livespointer)cam);
120  lives_signal_sync_connect(button4, LIVES_WIDGET_CLICKED_SIGNAL, LIVES_GUI_CALLBACK(on_camff_clicked), (livespointer)cam);
121  lives_signal_sync_connect(dvgrabw->stop, LIVES_WIDGET_CLICKED_SIGNAL,
122  LIVES_GUI_CALLBACK(on_camstop_clicked), (livespointer)cam);
123  lives_signal_sync_connect(dvgrabw->play, LIVES_WIDGET_CLICKED_SIGNAL,
124  LIVES_GUI_CALLBACK(on_camplay_clicked), (livespointer)cam);
125  lives_signal_sync_connect(dvgrabw->grab, LIVES_WIDGET_CLICKED_SIGNAL,
126  LIVES_GUI_CALLBACK(on_camgrab_clicked), (livespointer)cam);
127  lives_signal_sync_connect(dvgrabw->quit, LIVES_WIDGET_CLICKED_SIGNAL,
128  LIVES_GUI_CALLBACK(on_camquit_clicked), (livespointer)cam);
129  return dvgrabw;
130 }
131 
widget_opts_t::packing_width
int packing_width
horizontal pixels between widgets
Definition: widget-helper.h:1410
s_cam
Definition: ldvgrab.h:17
lives_dialog_add_button_from_stock
LiVESWidget * lives_dialog_add_button_from_stock(LiVESDialog *dialog, const char *stock_id, const char *label, int response_id)
Definition: widget-helper.c:9892
lives_free
#define lives_free
Definition: machinestate.h:52
lives_box_pack_end
WIDGET_HELPER_GLOBAL_INLINE boolean lives_box_pack_end(LiVESBox *box, LiVESWidget *child, boolean expand, boolean fill, uint32_t padding)
Definition: widget-helper.c:3291
_dvgrabw
Definition: ldvgrab.h:43
lives_malloc
#define lives_malloc
Definition: machinestate.h:46
on_camff_clicked
void on_camff_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:82
lives_dialog_get_content_area
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_dialog_get_content_area(LiVESDialog *dialog)
Definition: widget-helper.c:2479
lives_standard_direntry_new
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_standard_direntry_new(const char *labeltext, const char *txt, int dispwidth, int maxchars, LiVESBox *box, const char *tooltip)
Definition: widget-helper.c:10164
lives_standard_dialog_new
LiVESWidget * lives_standard_dialog_new(const char *title, boolean add_std_buttons, int width, int height)
Definition: widget-helper.c:9971
_dvgrabw::dirent
LiVESWidget * dirent
Definition: ldvgrab.h:46
lives_editable_set_editable
WIDGET_HELPER_GLOBAL_INLINE boolean lives_editable_set_editable(LiVESEditable *editable, boolean is_editable)
Definition: widget-helper.c:6121
add_hsep_to_box
LiVESWidget * add_hsep_to_box(LiVESBox *box)
Definition: widget-helper.c:12355
lives_hbutton_box_new
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_hbutton_box_new(void)
Definition: widget-helper.c:3329
lives_entry_new
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_entry_new(void)
Definition: widget-helper.c:6140
lives_standard_entry_new
LiVESWidget * lives_standard_entry_new(const char *labeltext, const char *txt, int dispwidth, int maxchars, LiVESBox *box, const char *tooltip)
Definition: widget-helper.c:9688
_dvgrabw::grab
LiVESWidget * grab
Definition: ldvgrab.h:48
TRUE
#define TRUE
Definition: videoplugin.h:59
ldvcallbacks.h
_dvgrabw::dirname
char * dirname
Definition: ldvgrab.h:55
_dvgrabw::quit
LiVESWidget * quit
Definition: ldvgrab.h:50
callbacks.h
_dvgrabw::split
LiVESWidget * split
Definition: ldvgrab.h:52
_dvgrabw::status_entry
LiVESWidget * status_entry
Definition: ldvgrab.h:51
LIVES_STOCK_LABEL_CLOSE_WINDOW
char LIVES_STOCK_LABEL_CLOSE_WINDOW[32]
Definition: widget-helper.h:1400
on_camrew_clicked
void on_camrew_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:75
_dvgrabw::cam
s_cam * cam
Definition: ldvgrab.h:57
lives_standard_label_new
LiVESWidget * lives_standard_label_new(const char *text)
Definition: widget-helper.c:8601
CAM_FORMAT_DV
#define CAM_FORMAT_DV
Definition: ldvgrab.h:14
_dvgrabw::dialog
LiVESWidget * dialog
Definition: ldvgrab.h:44
lives_widget_set_can_focus_and_default
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_can_focus_and_default(LiVESWidget *widget)
Definition: widget-helper.c:12300
widget_opts_t::packing_height
int packing_height
vertical pixels between widgets
Definition: widget-helper.h:1411
lives_hbox_new
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_hbox_new(boolean homogeneous, int spacing)
Definition: widget-helper.c:3253
_dvgrabw::playing
boolean playing
Definition: ldvgrab.h:54
DEF_BUTTON_WIDTH
#define DEF_BUTTON_WIDTH
Definition: mainwindow.h:182
ldvinterface.h
LIVES_STOCK_LABEL_MEDIA_FORWARD
char LIVES_STOCK_LABEL_MEDIA_FORWARD[32]
Definition: widget-helper.h:1393
LIVES_STOCK_LABEL_MEDIA_REWIND
char LIVES_STOCK_LABEL_MEDIA_REWIND[32]
Definition: widget-helper.h:1394
lives_widget_set_sensitive
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_sensitive(LiVESWidget *widget, boolean state)
Definition: widget-helper.c:1477
DEF_BUTTON_HEIGHT
#define DEF_BUTTON_HEIGHT
Definition: mainwindow.h:183
on_camplay_clicked
void on_camplay_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:61
lives_widget_set_can_focus
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_can_focus(LiVESWidget *widget, boolean state)
Definition: widget-helper.c:4789
on_camquit_clicked
void on_camquit_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:95
_dvgrabw::filent
LiVESWidget * filent
Definition: ldvgrab.h:45
main.h
lives_entry_set_text
WIDGET_HELPER_GLOBAL_INLINE boolean lives_entry_set_text(LiVESEntry *entry, const char *text)
Definition: widget-helper.c:6211
lives_container_add
WIDGET_HELPER_GLOBAL_INLINE boolean lives_container_add(LiVESContainer *container, LiVESWidget *widget)
Definition: widget-helper.c:4929
LIVES_STOCK_LABEL_MEDIA_STOP
char LIVES_STOCK_LABEL_MEDIA_STOP[32]
Definition: widget-helper.h:1395
LONG_ENTRY_WIDTH
#define LONG_ENTRY_WIDTH
Definition: widget-helper.h:29
widget_opts
widget_opts_t widget_opts
Definition: widget-helper.h:1442
PATH_MAX
#define PATH_MAX
Definition: main.h:255
lives_standard_button_new_from_stock
LiVESWidget * lives_standard_button_new_from_stock(const char *stock_id, const char *label, int width, int height)
Definition: widget-helper.c:4215
create_camwindow
struct _dvgrabw * create_camwindow(s_cam *cam, int type)
Definition: ldvinterface.c:12
_dvgrabw::play
LiVESWidget * play
Definition: ldvgrab.h:49
on_camgrab_clicked
void on_camgrab_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:11
lives_standard_check_button_new
LiVESWidget * lives_standard_check_button_new(const char *labeltext, boolean active, LiVESBox *box, const char *tooltip)
Definition: widget-helper.c:9048
on_camstop_clicked
void on_camstop_clicked(LiVESButton *button, livespointer user_data)
Definition: ldvcallbacks.c:40
FALSE
#define FALSE
Definition: videoplugin.h:60
_
#define _(String)
Definition: support.h:44
_dvgrabw::filename
char * filename
Definition: ldvgrab.h:56
dvgrabw
struct _dvgrabw * dvgrabw
Definition: ldvgrab.h:61
_dvgrabw::stop
LiVESWidget * stop
Definition: ldvgrab.h:47
LIVES_STOCK_LABEL_MEDIA_PLAY
char LIVES_STOCK_LABEL_MEDIA_PLAY[32]
Definition: widget-helper.h:1396
lives_box_pack_start
WIDGET_HELPER_GLOBAL_INLINE boolean lives_box_pack_start(LiVESBox *box, LiVESWidget *child, boolean expand, boolean fill, uint32_t padding)
Definition: widget-helper.c:3281