#include "clip.h"
#include "clipedit.h"
#include "commercials.h"
+#include "convert.h"
#include "cplayback.h"
#include "ctimebar.h"
#include "cwindow.h"
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
}
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
save_backup();
}
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
save_backup();
}
}
}
-
+#ifdef GLx4
if( ((edl->session->output_w % 4) ||
(edl->session->output_h % 4)) &&
edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
_("This project's dimensions are not multiples of 4 so\n"
"it can't be rendered by OpenGL."));
}
-
+#endif
// Get aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
create_aspect_ratio(
h = indexable->get_h();
edl->session->output_w = w;
edl->session->output_h = h;
-
+#ifdef GLx4
if( ((edl->session->output_w % 4) ||
(edl->session->output_h % 4)) &&
edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
_("This project's dimensions are not multiples of 4 so\n"
"it can't be rendered by OpenGL."));
}
-
+#endif
// Get aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
create_aspect_ratio(edl->session->aspect_w,
int MWindow::clear_labels(double start, double end)
{
+ if( start == end ) {
+ start = 0;
+ end = edl->tracks->total_length();
+ }
edl->labels->clear(start, end, 0);
return 0;
}
+void MWindow::clear_hard_edges()
+{
+ undo_before();
+ clear_hard_edges(edl->local_session->get_selectionstart(),
+ edl->local_session->get_selectionend());
+ edl->optimize();
+ save_backup();
+ undo_after(_("clear hard edges"), LOAD_EDITS);
+ restart_brender();
+ gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
+ cwindow->refresh_frame(CHANGE_EDL);
+}
+
+int MWindow::clear_hard_edges(double start, double end)
+{
+ if( start == end ) {
+ start = 0;
+ end = edl->tracks->total_length();
+ }
+ edl->clear_hard_edges(start, end);
+ return 0;
+}
+
+void MWindow::clear_select()
+{
+ edl->tracks->clear_selected_edits();
+ gui->draw_overlays(1);
+}
+
void MWindow::concatenate_tracks()
{
undo_before();
return 0;
}
-
// Uses cropping coordinates in edl session to crop and translate video.
// We modify the projector since camera automation depends on the track size.
-void MWindow::crop_video()
+void MWindow::crop_video(int mode)
{
-
undo_before();
// Clamp EDL crop region
if( edl->session->crop_x1 > edl->session->crop_x2 ) {
edl->session->crop_y2 ^= edl->session->crop_y1;
edl->session->crop_y1 ^= edl->session->crop_y2;
}
-
- float old_projector_x = (float)edl->session->output_w / 2;
- float old_projector_y = (float)edl->session->output_h / 2;
- float new_projector_x = (float)(edl->session->crop_x1 + edl->session->crop_x2) / 2;
- float new_projector_y = (float)(edl->session->crop_y1 + edl->session->crop_y2) / 2;
- float projector_offset_x = -(new_projector_x - old_projector_x);
- float projector_offset_y = -(new_projector_y - old_projector_y);
-
- edl->tracks->translate_projector(projector_offset_x, projector_offset_y);
-
- edl->session->output_w = edl->session->crop_x2 - edl->session->crop_x1;
- edl->session->output_h = edl->session->crop_y2 - edl->session->crop_y1;
- edl->session->crop_x1 = 0;
- edl->session->crop_y1 = 0;
- edl->session->crop_x2 = edl->session->output_w;
- edl->session->crop_y2 = edl->session->output_h;
+ switch( mode ) {
+ case CROP_REFORMAT: {
+ float ctr_x = edl->session->output_w / 2.;
+ float ctr_y = edl->session->output_h / 2.;
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ float dx = -(new_x - ctr_x), dy = -(new_y - ctr_y);
+ edl->tracks->translate_projector(dx, dy, 1);
+
+ edl->session->output_w = edl->session->crop_x2 - edl->session->crop_x1;
+ edl->session->output_h = edl->session->crop_y2 - edl->session->crop_y1;
+ edl->session->crop_x1 = edl->session->crop_y1 = 0;
+ edl->session->crop_x2 = edl->session->output_w;
+ edl->session->crop_y2 = edl->session->output_h;
+ break; }
+ case CROP_RESIZE: {
+ float old_w = edl->session->output_w;
+ float old_h = edl->session->output_h;
+ float new_w = edl->session->crop_x2 - edl->session->crop_x1;
+ float new_h = edl->session->crop_y2 - edl->session->crop_y1;
+ if( !new_w ) new_w = 1;
+ if( !new_h ) new_h = 1;
+ float xzoom = old_w / new_w, yzoom = old_h / new_h;
+ float new_z = bmin(xzoom, yzoom);
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ edl->tracks->crop_resize(new_x, new_y, new_z);
+
+ edl->session->crop_x1 = 0;
+ edl->session->crop_y1 = 0;
+ edl->session->crop_x2 = edl->session->output_w;
+ edl->session->crop_y2 = edl->session->output_h;
+ break; }
+ case CROP_SHRINK: {
+ float old_w = edl->session->output_w;
+ float old_h = edl->session->output_h;
+ float new_w = edl->session->crop_x2 - edl->session->crop_x1;
+ float new_h = edl->session->crop_y2 - edl->session->crop_y1;
+ if( !new_w ) new_w = 1;
+ if( !new_h ) new_h = 1;
+ float xzoom = old_w / new_w, yzoom = old_h / new_h;
+ float new_z = bmin(xzoom, yzoom);
+
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ edl->tracks->crop_shrink(new_x, new_y, new_z);
+ break; }
+ }
// Recalculate aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
default:
continue;
}
+// re-label only if not already labeled
+ if( new_edl->local_session->asset2edl )
+ strcpy(current->title, edl->tracks->last->title);
destination_tracks.append(edl->tracks->last);
}
edl->rescale_proxy(orig_scale, new_scale);
}
-void MWindow::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+void MWindow::add_proxy(ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
{
- edl->add_proxy(use_scaler, orig_assets, proxy_assets);
+ edl->add_proxy(orig_assets, proxy_assets);
+}
+
+void MWindow::start_convert(Asset *format_asset, const char *suffix,
+ float beep, int remove_originals)
+{
+ if( !convert_render )
+ convert_render = new ConvertRender(this, suffix);
+ convert_render->set_format(format_asset);
+ int found = convert_render->find_convertable_assets(edl);
+ if( convert_render->needed_idxbls.size() > 0 )
+ convert_render->start_convert(beep, remove_originals);
+ else if( found > 0 )
+ finish_convert(remove_originals);
+ else {
+ eprintf(_("No convertable assets found"));
+ }
+}
+
+void MWindow::finish_convert(int remove_originals)
+{
+ gui->lock_window("MWindow::finish_convert");
+ undo_before();
+ edl->replace_assets(
+ convert_render->orig_idxbls,
+ convert_render->orig_copies);
+ if( remove_originals ) {
+ remove_assets_from_project(0, 0, 0,
+ &convert_render->orig_idxbls, 0);
+ }
+ save_backup();
+ undo_after(_("convert"), LOAD_ALL);
+
+ update_plugin_guis();
+ gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
+ cwindow->update(1, 0, 0, 0, 1);
+ awindow->gui->async_update_assets();
+ cwindow->refresh_frame(CHANGE_EDL);
+ gui->unlock_window();
}
void MWindow::cut_commercials()