X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fperspective%2Fperspective.C;h=39c63d43ce407a42865ef3e829bacc01f533dc64;hb=1180ebf94abe64513c184997927634ef20ea9075;hp=fc39159715b902ccd35208c95eb28af47b4d3744;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/perspective/perspective.C b/cinelerra-5.1/plugins/perspective/perspective.C index fc391597..39c63d43 100644 --- a/cinelerra-5.1/plugins/perspective/perspective.C +++ b/cinelerra-5.1/plugins/perspective/perspective.C @@ -24,8 +24,8 @@ #include "language.h" #include "perspective.h" -#define PERSPECTIVE_WIDTH 400 -#define PERSPECTIVE_HEIGHT 600 +#define PERSPECTIVE_WIDTH xS(400) +#define PERSPECTIVE_HEIGHT yS(600) REGISTER_PLUGIN(PerspectiveMain) @@ -120,63 +120,73 @@ PerspectiveWindow::~PerspectiveWindow() void PerspectiveWindow::create_objects() { - int x = 10, y = 10; + int xs10 = xS(10), xs20 = xS(20), xs100 = xS(100), xs120 = xS(120); + int ys5 = yS(5), ys10 = yS(10), ys30 = yS(30), ys40 = yS(40); + int x = xs10, y = ys10; add_subwindow(canvas = new PerspectiveCanvas(this, - x, y, get_w() - 20, get_h() - 290)); + x, y, get_w() - xs20, get_h() - yS(290))); canvas->set_cursor(CROSS_CURSOR, 0, 0); - y += canvas->get_h() + 10; - add_subwindow(new BC_Title(x, y, _("Current X:"))); - x += 80; + y += canvas->get_h() + ys10; + int x1 = x; + BC_Title *title; + add_subwindow(title = new BC_Title(x1, y, _("Current: "))); + x1 += title->get_w() + xs10; + char string[BCSTRLEN]; + sprintf(string, "%d", plugin->config.current_point+1); + add_subwindow(curr_point = new BC_Title(x1, y, string)); + x1 += xs20; + add_subwindow(title = new BC_Title(x1, y, _("X:"))); + x1 += title->get_w() + xs10; this->x = new PerspectiveCoord(this, - x, y, plugin->get_current_x(), 1); + x1, y, plugin->get_current_x(), 1); this->x->create_objects(); - x += 140; - add_subwindow(new BC_Title(x, y, _("Y:"))); - x += 20; + x1 += this->x->get_w() + xs20; + add_subwindow(new BC_Title(x1, y, _("Y:"))); + x1 += title->get_w() + xs10; this->y = new PerspectiveCoord(this, - x, y, plugin->get_current_y(), 0); + x1, y, plugin->get_current_y(), 0); this->y->create_objects(); - x = 10; y += 30; + x = xs10; y += ys30; add_subwindow(mode_perspective = new PerspectiveMode(this, x, y, AffineEngine::PERSPECTIVE, _("Perspective"))); - x += 120; + x += xs120; add_subwindow(mode_sheer = new PerspectiveMode(this, x, y, AffineEngine::SHEER, _("Sheer"))); - x += 100; + x += xs100; add_subwindow(affine = new PerspectiveAffine(this, x, y)); affine->create_objects(); - x = 10; y += 30; + x = xs10; y += ys30; add_subwindow(mode_stretch = new PerspectiveMode(this, x, y, AffineEngine::STRETCH, _("Stretch"))); - x += 120; + x += xs120; add_subwindow(new PerspectiveReset(this, x, y)); update_canvas(); - x = 10; y += 30; - BC_Title *title; + x = xs10; y += ys30; add_subwindow(title = new BC_Title(x, y, _("Zoom view:"))); - int x1 = x + title->get_w() + 10, w1 = get_w() - x1 - 10; + x1 = x + title->get_w() + xs10; + int w1 = get_w() - x1 - xs10; add_subwindow(zoom_view = new PerspectiveZoomView(this, x1, y, w1)); - y += 30; + y += ys30; add_subwindow(new BC_Title(x, y, _("Perspective direction:"))); - x += 170; + x += xS(170); add_subwindow(forward = new PerspectiveDirection(this, x, y, 1, _("Forward"))); - x += 100; + x += xs100; add_subwindow(reverse = new PerspectiveDirection(this, x, y, 0, _("Reverse"))); - x = 10; y += 40; + x = xs10; y += ys40; add_subwindow(title = new BC_Title(x, y, _("Alt/Shift:"))); - add_subwindow(new BC_Title(x+100, y, _("Button1 Action:"))); - y += title->get_h() + 5; + add_subwindow(new BC_Title(x+xs100, y, _("Button1 Action:"))); + y += title->get_h() + ys5; add_subwindow(new BC_Title(x, y, " 0 / 0\n" " 0 / 1\n" " 1 / 0\n" " 1 / 1")); - add_subwindow(new BC_Title(x+100, y, + add_subwindow(new BC_Title(x+xs100, y, _("Translate endpoint\n" "Zoom image\n" "Translate image\n" @@ -264,6 +274,12 @@ void PerspectiveWindow::update_canvas() canvas->draw_line(vx2, vy2, vx1, vy2); canvas->draw_line(vx1, vy2, vx1, vy1); + canvas->set_color(YELLOW); + canvas->draw_text(x1, y1,"1"); + canvas->draw_text(x2, y2,"2"); + canvas->draw_text(x3, y3,"3"); + canvas->draw_text(x4, y4,"4"); + //printf("PerspectiveWindow::update_canvas %d,%d %d,%d %d,%d %d,%d\n", // x1, y1, x2, y2, x3, y3, x4, y4); // Draw divisions @@ -319,6 +335,9 @@ void PerspectiveWindow::update_mode() void PerspectiveWindow::update_coord() { + char string[BCSTRLEN]; + sprintf(string, "%d", plugin->config.current_point+1); + curr_point->update(string); x->update(plugin->get_current_x()); y->update(plugin->get_current_y()); } @@ -515,10 +534,11 @@ int PerspectiveCanvas::cursor_motion_event() PerspectiveCoord::PerspectiveCoord(PerspectiveWindow *gui, int x, int y, float value, int is_x) - : BC_TumbleTextBox(gui, value, (float)-100, (float)200, x, y, 100) + : BC_TumbleTextBox(gui, value, -100.f, 200.f, x, y, xS(70)) { this->gui = gui; this->is_x = is_x; + set_precision(2); } int PerspectiveCoord::handle_event() @@ -598,7 +618,7 @@ int PerspectiveAffineItem::handle_event() } PerspectiveAffine::PerspectiveAffine(PerspectiveWindow *gui, int x, int y) - : BC_PopupMenu(x, y, 100, "", 1) + : BC_PopupMenu(x, y, xS(100), "", 1) { this->gui = gui; affine_modes[AffineEngine::AF_DEFAULT] = _("default"); @@ -807,6 +827,12 @@ int PerspectiveMain::process_buffer(VFrame *frame, EQUIV(config.x3, 100) && EQUIV(config.y3, 100) && EQUIV(config.x4, 0) && EQUIV(config.y4, 100) ) return 1; + if( config.mode == AffineEngine::PERSPECTIVE && + ( (EQUIV(config.x1, config.x2) && EQUIV(config.x3, config.x4)) || + (EQUIV(config.y1, config.y3) && EQUIV(config.y2, config.y4)) ) ) { + frame->clear_frame(); + return 0; + } if( !engine ) { int cpus = get_project_smp() + 1;