+HistogramSelect::HistogramSelect(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y)
+ : BC_GenericButton(x, y, xS(100), _("Frames"))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+ set_tooltip(_("Set frames to selection duration"));
+}
+int HistogramSelect::handle_event()
+{
+ MWindow *mwindow = plugin->server->mwindow;
+ if( mwindow ) {
+ EDL *edl = mwindow->edl;
+ double start = edl->local_session->get_selectionstart();
+ int64_t start_pos = edl->get_frame_rate() * start;
+ double end = edl->local_session->get_selectionend();
+ int64_t end_pos = edl->get_frame_rate() * end;
+ int64_t frames = end_pos - start_pos;
+ gui->frames->update(frames);
+ plugin->config.frames = frames;
+ plugin->send_configure_change();
+ }
+ return 1;
+}