From: Good Guy Date: Thu, 13 Sep 2018 22:18:59 +0000 (-0600) Subject: motion51 incr line sz, shortcut tweaks, textbox numeric pad tweaks X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=667a32e310893e4df0412eb8e91263d4dc57e12e;p=goodguy%2Fhistory.git motion51 incr line sz, shortcut tweaks, textbox numeric pad tweaks --- diff --git a/cinelerra-5.1/guicast/bctextbox.C b/cinelerra-5.1/guicast/bctextbox.C index 57a8c5dd..8de77f4f 100644 --- a/cinelerra-5.1/guicast/bctextbox.C +++ b/cinelerra-5.1/guicast/bctextbox.C @@ -1128,25 +1128,28 @@ int BC_TextBox::repeat_event(int64_t duration) void BC_TextBox::default_keypress(int &dispatch_event, int &result) { int key = top_level->get_keypress(), len; - if( (key == RETURN) || ( key >= 32 && key <= 255 ) || - (key >= KP1 && key <= KP9) || key == KPINS ) { - wchar_t *wkeys = top_level->get_wkeystring(&len); - switch( key ) { - case RETURN: key = '\n'; goto kpchr; - case KPINS: key = '0'; goto kpchr; - case KP1: case KP2: case KP3: case KP4: case KP5: - case KP6: case KP7: case KP8: case KP9: - key = key - KP1 + '1'; - kpchr: - wkeys[0] = key; wkeys[1] = 0; len = 1; - break; - } - insert_text(wkeys, len); - find_ibeam(1); - draw(1); - dispatch_event = 1; - result = 1; - } + wchar_t *wkeys = top_level->get_wkeystring(&len); + switch( key ) { + case KPENTER: key = '\n'; goto kpchr; + case KPMINUS: key = '-'; goto kpchr; + case KPPLUS: key = '+'; goto kpchr; + case KPDEL: key = '.'; goto kpchr; + case RETURN: key = '\n'; goto kpchr; + case KPINS: key = '0'; goto kpchr; + case KP1: case KP2: case KP3: case KP4: case KP5: + case KP6: case KP7: case KP8: case KP9: + key = key - KP1 + '1'; goto kpchr; + default: + if( key < 32 || key > 255 ) return; + kpchr: { + wkeys[0] = key; wkeys[1] = 0; len = 1; + break; } + } + insert_text(wkeys, len); + find_ibeam(1); + draw(1); + dispatch_event = 1; + result = 1; } int BC_TextBox::keypress_event() diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 04188770..3eca6764 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -279,7 +279,6 @@ int VFrame::reset_parameters(int do_opengl) sequence_number = -1; timestamp = -1.; is_keyframe = 0; - draw_point = 0; pixel_rgb = 0x000000; // BLACK pixel_yuv = 0x008080; stipple = 0; @@ -1360,7 +1359,6 @@ void VFrame::set_stiple(int mask) int VFrame::draw_pixel(int x, int y) { if( x < 0 || y < 0 || x >= get_w() || y >= get_h() ) return 1; - if( draw_point ) return (this->*draw_point)(x, y); #define DRAW_PIXEL(type, r, g, b) { \ type **rows = (type**)get_rows(); \ diff --git a/cinelerra-5.1/guicast/vframe.h b/cinelerra-5.1/guicast/vframe.h index f9a05aef..da53bfdd 100644 --- a/cinelerra-5.1/guicast/vframe.h +++ b/cinelerra-5.1/guicast/vframe.h @@ -82,7 +82,7 @@ public: VFrame(VFrame &vframe); // Create new frame for compressed data. VFrame(); - ~VFrame(); + virtual ~VFrame(); // Return 1 if the colormodel and dimensions are the same // Used by FrameCache @@ -343,12 +343,11 @@ public: // This clears the stacks and the param table void clear_stacks(); - int (VFrame::*draw_point)(int x, int y); + virtual int draw_pixel(int x, int y); int pixel_rgb, pixel_yuv, stipple; void set_pixel_color(int rgb); void set_stiple(int mask); - int draw_pixel(int x, int y); void draw_line(int x1, int y1, int x2, int y2); void draw_smooth(int x1, int y1, int x2, int y2, int x3, int y3); void smooth_draw(int x1, int y1, int x2, int y2, int x3, int y3); diff --git a/cinelerra-5.1/plugins/motion51/motion51.C b/cinelerra-5.1/plugins/motion51/motion51.C index 9e4143f4..b16cdbc9 100644 --- a/cinelerra-5.1/plugins/motion51/motion51.C +++ b/cinelerra-5.1/plugins/motion51/motion51.C @@ -565,41 +565,64 @@ void Motion51Main::centroid(double *pix[3], double *ctr_v, double *ctr_x, double } } +Motion51VVFrame::Motion51VVFrame(VFrame *vfrm, int n) + : VFrame(vfrm->get_data(), -1, vfrm->get_y()-vfrm->get_data(), + vfrm->get_u()-vfrm->get_data(), vfrm->get_v()-vfrm->get_data(), + vfrm->get_w(), vfrm->get_h(), vfrm->get_color_model(), + vfrm->get_bytes_per_line()) +{ + this->n = n; +} + +int Motion51VVFrame::draw_pixel(int x, int y) +{ + VFrame::draw_pixel(x+0, y+0); + for( int i=1; idraw_arrow(rx, ry, rx+current_dx, ry+current_dy); + int iw = img->get_w(), ih = img->get_h(); + int mx = iw > ih ? iw : ih; + Motion51VVFrame vfrm(img, mx/800+1); -// img->draw_smooth(rx-rr,ry, rx-rr,ry+rr, rx,ry+rr); -// img->draw_smooth(rx,ry+rr, rx+rr,ry+rr, rx+rr,ry); -// img->draw_smooth(rx+rr,ry, rx+rr,ry-rr, rx,ry-rr); -// img->draw_smooth(rx,ry-rr, rx-rr,ry-rr, rx-rr,ry); + vfrm.draw_arrow(rx, ry, rx+current_dx, ry+current_dy); +// vfrm.draw_smooth(rx-rr,ry, rx-rr,ry+rr, rx,ry+rr); +// vfrm.draw_smooth(rx,ry+rr, rx+rr,ry+rr, rx+rr,ry); +// vfrm.draw_smooth(rx+rr,ry, rx+rr,ry-rr, rx,ry-rr); +// vfrm.draw_smooth(rx,ry-rr, rx-rr,ry-rr, rx-rr,ry); float rx1 = rx - 0.5*rw; float ry1 = ry - 0.5*rh; float rx2 = rx1 + rw; float ry2 = ry1 + rh; - img->draw_line(rx1, ry1, rx2, ry1); - img->draw_line(rx2, ry1, rx2, ry2); - img->draw_line(rx2, ry2, rx1, ry2); - img->draw_line(rx1, ry2, rx1, ry1); + vfrm.draw_line(rx1, ry1, rx2, ry1); + vfrm.draw_line(rx2, ry1, rx2, ry2); + vfrm.draw_line(rx2, ry2, rx1, ry2); + vfrm.draw_line(rx1, ry2, rx1, ry1); float sx1 = rx1 - rr, sy1 = ry1 - rr; float sx2 = rx2 + rr, sy2 = ry2 + rr; - img->draw_smooth(sx1, ry1, sx1, sy1, rx1, sy1); - img->draw_line(rx1, sy1, rx2, sy1); - img->draw_smooth(rx2, sy1, sx2, sy1, sx2, ry1); - img->draw_line(sx2, ry1, sx2, ry2); - img->draw_smooth(sx2, ry2, sx2, sy2, rx2, sy2); - img->draw_line(rx2, sy2, rx1, sy2); - img->draw_smooth(rx1, sy2, sx1, sy2, sx1, ry2); - img->draw_line(sx1, ry2, sx1, ry1); + vfrm.draw_smooth(sx1, ry1, sx1, sy1, rx1, sy1); + vfrm.draw_line(rx1, sy1, rx2, sy1); + vfrm.draw_smooth(rx2, sy1, sx2, sy1, sx2, ry1); + vfrm.draw_line(sx2, ry1, sx2, ry2); + vfrm.draw_smooth(sx2, ry2, sx2, sy2, rx2, sy2); + vfrm.draw_line(rx2, sy2, rx1, sy2); + vfrm.draw_smooth(rx1, sy2, sx1, sy2, sx1, ry2); + vfrm.draw_line(sx1, ry2, sx1, ry1); double *xp = xpts, *yp = ypts; for( int i=cir_sz; --i>=0; ++xp, ++yp ) - img->draw_pixel(rx+*xp, ry+*yp); + vfrm.draw_pixel(rx+*xp, ry+*yp); } int Motion51Main::open_cache_file() diff --git a/cinelerra-5.1/plugins/motion51/motion51.h b/cinelerra-5.1/plugins/motion51/motion51.h index bb93ef15..afd8bbad 100644 --- a/cinelerra-5.1/plugins/motion51/motion51.h +++ b/cinelerra-5.1/plugins/motion51/motion51.h @@ -42,6 +42,7 @@ class Motion51Main; class Motion51ScanUnit; class Motion51ScanPackage; class Motion51Scan; +class Motion51VVFrame; class Motion51Config { @@ -178,4 +179,12 @@ public: double compare(double cx, double cy, double ct); }; +class Motion51VVFrame : public VFrame +{ +public: + Motion51VVFrame(VFrame *vfrm, int n); + int draw_pixel(int x, int y); + int n; +}; + #endif