예제 #1
0
파일: framedraw.c 프로젝트: nanu-c/LiVES
void framedraw_add_reset(LiVESVBox *box, lives_special_framedraw_rect_t *framedraw) {
  LiVESWidget *hbox_rst;

  framedraw_add_label(box);

  mainw->framedraw_reset = lives_button_new_from_stock(LIVES_STOCK_REFRESH,NULL);
  hbox_rst = lives_hbox_new(FALSE, 0);
  lives_box_pack_start(LIVES_BOX(box), hbox_rst, FALSE, FALSE, 0);

  lives_button_set_label(LIVES_BUTTON(mainw->framedraw_reset),_("_Reset Values"));
  lives_button_set_use_underline(LIVES_BUTTON(mainw->framedraw_reset), TRUE);
  lives_box_pack_start(LIVES_BOX(hbox_rst), mainw->framedraw_reset, TRUE, FALSE, 0);
  lives_widget_set_sensitive(mainw->framedraw_reset,FALSE);

  lives_signal_connect(mainw->framedraw_reset, LIVES_WIDGET_CLICKED_SIGNAL,LIVES_GUI_CALLBACK(on_framedraw_reset_clicked),framedraw);
}
예제 #2
0
파일: framedraw.c 프로젝트: tbe/LiVES
void widget_add_framedraw(LiVESVBox *box, int start, int end, boolean add_preview_button, int width, int height) {
  // adds the frame draw widget to box
  // the redraw button should be connected to an appropriate redraw function
  // after calling this function

  // an example of this is in 'trim frames'

  LiVESWidget *vseparator;
  LiVESWidget *vbox;
  LiVESWidget *hbox;
  LiVESWidget *label;
  LiVESAdjustment *spinbutton_adj;
  LiVESWidget *frame;

  lives_rfx_t *rfx;

  double fd_scale;

  b1_held=FALSE;

  mainw->framedraw_reset=NULL;

  vseparator = lives_vseparator_new();
  lives_box_pack_start(LIVES_BOX(lives_widget_get_parent(LIVES_WIDGET(box))), vseparator, FALSE, FALSE, 0);
  lives_widget_show(vseparator);

  vbox = lives_vbox_new(FALSE, 0);
  lives_box_pack_start(LIVES_BOX(lives_widget_get_parent(LIVES_WIDGET(box))), vbox, FALSE, FALSE, 0);
  lives_container_set_border_width(LIVES_CONTAINER(vbox), widget_opts.border_width);

  fd_scale=calc_fd_scale(width,height);
  width/=fd_scale;
  height/=fd_scale;

  hbox = lives_hbox_new(FALSE, 0);
  lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, 0);

  fbord_eventbox=lives_event_box_new();
  lives_container_set_border_width(LIVES_CONTAINER(fbord_eventbox),widget_opts.border_width);

  frame = lives_frame_new(NULL);

  lives_box_pack_start(LIVES_BOX(hbox), frame, FALSE, FALSE, 0);

  if (palette->style&STYLE_1) {
    lives_widget_set_bg_color(fbord_eventbox, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
    lives_widget_set_bg_color(frame, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
    lives_widget_set_fg_color(frame, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
  }

  mainw->fd_frame=frame;

  label = lives_standard_label_new(_("Preview"));
  lives_frame_set_label_widget(LIVES_FRAME(frame), label);

  lives_frame_set_shadow_type(LIVES_FRAME(frame), LIVES_SHADOW_NONE);

  mainw->framedraw=lives_event_box_new();
  lives_widget_set_size_request(mainw->framedraw, width, height);
  lives_container_set_border_width(LIVES_CONTAINER(mainw->framedraw),1);

  lives_widget_set_events(mainw->framedraw, LIVES_BUTTON1_MOTION_MASK | LIVES_BUTTON_RELEASE_MASK |
                          LIVES_BUTTON_PRESS_MASK| LIVES_ENTER_NOTIFY_MASK | LIVES_LEAVE_NOTIFY_MASK);

  mainw->framedraw_frame=start;

  lives_container_add(LIVES_CONTAINER(frame), fbord_eventbox);
  lives_container_add(LIVES_CONTAINER(fbord_eventbox), mainw->framedraw);

  if (palette->style&STYLE_1) {
    lives_widget_set_bg_color(mainw->framedraw, LIVES_WIDGET_STATE_NORMAL, &palette->normal_back);
    lives_widget_set_fg_color(mainw->framedraw, LIVES_WIDGET_STATE_NORMAL, &palette->normal_fore);
  }

  lives_signal_connect_after(LIVES_GUI_OBJECT(mainw->framedraw), LIVES_WIDGET_EXPOSE_EVENT,
                             LIVES_GUI_CALLBACK(expose_fd_event), NULL);


  hbox = lives_hbox_new(FALSE, 2);
  lives_box_pack_start(LIVES_BOX(vbox), hbox, FALSE, FALSE, 0);

  mainw->framedraw_spinbutton = lives_standard_spin_button_new(_("_Frame"),
                                TRUE,start,start,end,1.,10.,0,LIVES_BOX(hbox),NULL);

  spinbutton_adj=lives_spin_button_get_adjustment(LIVES_SPIN_BUTTON(mainw->framedraw_spinbutton));

  mainw->framedraw_scale=lives_hscale_new(LIVES_ADJUSTMENT(spinbutton_adj));
  lives_box_pack_start(LIVES_BOX(hbox), mainw->framedraw_scale, TRUE, TRUE, 0);
  lives_scale_set_draw_value(LIVES_SCALE(mainw->framedraw_scale),FALSE);

  rfx=(lives_rfx_t *)lives_widget_object_get_data(LIVES_WIDGET_OBJECT(lives_widget_get_toplevel(LIVES_WIDGET(box))),"rfx");
  mainw->framedraw_preview = lives_button_new_from_stock(LIVES_STOCK_REFRESH);
  lives_button_set_label(LIVES_BUTTON(mainw->framedraw_preview),_("_Preview"));
  lives_button_set_use_underline(LIVES_BUTTON(mainw->framedraw_preview), TRUE);
  lives_box_pack_start(LIVES_BOX(hbox), mainw->framedraw_preview, TRUE, FALSE, 0);
  lives_widget_set_sensitive(mainw->framedraw_spinbutton,FALSE);
  lives_widget_set_sensitive(mainw->framedraw_scale,FALSE);
  lives_signal_connect(mainw->framedraw_preview, LIVES_WIDGET_CLICKED_SIGNAL,LIVES_GUI_CALLBACK(start_preview),rfx);

  lives_widget_show_all(vbox);

  if (!add_preview_button) {
    lives_widget_hide(mainw->framedraw_preview);
  }

}