X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Ftracer%2Ftracerwindow.C;h=ccc04709814e9d08eb7a93e791f41ffe714ee13f;hb=HEAD;hp=e9b730fc8a2b1f72dc1781c38a1864d9ccf612d5;hpb=9fed7535470aa37781733db836068da3b4c17a0d;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/tracer/tracerwindow.C b/cinelerra-5.1/plugins/tracer/tracerwindow.C index e9b730fc..653f8624 100644 --- a/cinelerra-5.1/plugins/tracer/tracerwindow.C +++ b/cinelerra-5.1/plugins/tracer/tracerwindow.C @@ -36,11 +36,11 @@ #include "theme.h" #include "track.h" -#define COLOR_W 50 -#define COLOR_H 30 +#define COLOR_W xS(50) +#define COLOR_H yS(30) TracerNum::TracerNum(TracerWindow *gui, int x, int y, float output) - : BC_TumbleTextBox(gui, output, -32767.0f, 32767.0f, x, y, 120) + : BC_TumbleTextBox(gui, output, -32767.0f, 32767.0f, x, y, xS(120)) { this->gui = gui; set_increment(1); @@ -85,7 +85,7 @@ int TracerPointY::handle_event() } TracerWindow::TracerWindow(Tracer *plugin) - : PluginClientWindow(plugin, 400, 420, 400, 420, 0) + : PluginClientWindow(plugin, xS(460), yS(420), xS(460), yS(420), 0) { this->plugin = plugin; this->title_x = 0; this->point_x = 0; @@ -108,56 +108,58 @@ TracerWindow::~TracerWindow() void TracerWindow::create_objects() { - int x = 10, y = 10; + int x = xS(10), y = yS(10); int margin = plugin->get_theme()->widget_border; - int hot_point = plugin->config.selected; + int hot_point = plugin->selected; add_subwindow(title_x = new BC_Title(x, y, _("X:"))); int x1 = x + title_x->get_w() + margin; - TracerPoint *pt = hot_point >= 0 ? plugin->config.points[hot_point] : 0; + TracerPoints &points = plugin->config.points; + TracerPoint *pt = hot_point >= 0 && hot_pointx); point_x->create_objects(); - x1 += point_x->get_w() + margin; + x1 += point_x->get_w() + margin + xS(20); add_subwindow(new_point = new TracerNewPoint(this, plugin, x1, y)); - x1 += new_point->get_w() + margin; + x1 += new_point->get_w() + margin + xS(30); add_subwindow(point_up = new TracerPointUp(this, x1, y)); y += point_x->get_h() + margin; add_subwindow(title_y = new BC_Title(x, y, _("Y:"))); x1 = x + title_y->get_w() + margin; point_y = new TracerPointY(this, x1, y, !pt ? 0 : pt->y); point_y->create_objects(); - x1 += point_y->get_w() + margin; + x1 += point_y->get_w() + margin + xS(20); add_subwindow(del_point = new TracerDelPoint(this, plugin, x1, y)); - x1 += del_point->get_w() + margin; + x1 += del_point->get_w() + margin + xS(30); add_subwindow(point_dn = new TracerPointDn(this, x1, y)); - y += point_y->get_h() + margin + 10; + y += point_y->get_h() + margin + yS(10); add_subwindow(drag = new TracerDrag(this, x, y)); - if( plugin->config.drag ) { + if( plugin->drag ) { if( !grab(plugin->server->mwindow->cwindow->gui) ) eprintf("drag enabled, but compositor already grabbed\n"); } - x1 = x + drag->get_w() + margin + 20; + x1 = x + drag->get_w() + margin + xS(20); add_subwindow(draw = new TracerDraw(this, x1, y)); - x1 += draw->get_w() + margin + 20; + x1 += draw->get_w() + margin + xS(20); add_subwindow(fill = new TracerFill(this, x1, y)); - x1 += drag->get_w() + margin + 20; - int y1 = y + 3; + x1 += drag->get_w() + margin + xS(20); + int y1 = y + yS(3); add_subwindow(reset = new TracerReset(this, plugin, x1, y1)); y1 += reset->get_h() + margin; add_subwindow(invert = new TracerInvert(this, plugin, x1, y1)); - y += drag->get_h() + margin + 15; + y += drag->get_h() + margin + yS(15); - x1 = x + 80; + x1 = x + xS(80); add_subwindow(title_r = new BC_Title(x, y, _("Feather:"))); - add_subwindow(feather = new TracerFeather(this, x1, y, 150)); + add_subwindow(feather = new TracerFeather(this, x1, y, xS(150))); y += feather->get_h() + margin; add_subwindow(title_s = new BC_Title(x, y, _("Radius:"))); - add_subwindow(radius = new TracerRadius(this, x1, y, 150)); - y += radius->get_h() + margin + 5; + add_subwindow(radius = new TracerRadius(this, x1, y, xS(150))); + y += radius->get_h() + margin + yS(5); add_subwindow(point_list = new TracerPointList(this, plugin, x, y)); - point_list->update(plugin->config.selected); - y += point_list->get_h() + 10; + point_list->update(plugin->selected); + y += point_list->get_h() + yS(10); add_subwindow(new BC_Title(x, y, _( "Btn1: select/drag point\n" @@ -355,12 +357,12 @@ void TracerWindow::done_event(int result) } TracerPointList::TracerPointList(TracerWindow *gui, Tracer *plugin, int x, int y) - : BC_ListBox(x, y, 360, 130, LISTBOX_TEXT) + : BC_ListBox(x, y, xS(360), yS(130), LISTBOX_TEXT) { this->gui = gui; this->plugin = plugin; - titles[PT_X] = _("X"); widths[PT_X] = 90; - titles[PT_Y] = _("Y"); widths[PT_Y] = 90; + titles[PT_X] = _("X"); widths[PT_X] = xS(90); + titles[PT_Y] = _("Y"); widths[PT_Y] = yS(90); } TracerPointList::~TracerPointList() { @@ -438,7 +440,7 @@ void TracerPointList::update_list(int k) { int sz = plugin->config.points.size(); if( k < 0 || k >= sz ) k = -1; - plugin->config.selected = k; + plugin->selected = k; update_selection(&cols[0], k); int xpos = get_xposition(), ypos = get_yposition(); BC_ListBox::update(&cols[0], &titles[0],&widths[0],PT_SZ, xpos,ypos,k); @@ -465,7 +467,7 @@ void TracerPointList::update(int k) void TracerWindow::update_gui() { TracerConfig &config = plugin->config; - drag->update(config.drag); + drag->update(plugin->drag); draw->update(config.draw); fill->update(config.fill); feather->update(config.feather); @@ -525,7 +527,7 @@ int TracerPointDn::handle_event() } TracerDrag::TracerDrag(TracerWindow *gui, int x, int y) - : BC_CheckBox(x, y, gui->plugin->config.drag, _("Drag")) + : BC_CheckBox(x, y, gui->plugin->drag, _("Drag")) { this->gui = gui; } @@ -541,10 +543,21 @@ int TracerDrag::handle_event() } else gui->ungrab(cwindow_gui); - gui->plugin->config.drag = value; + gui->plugin->drag = value; gui->send_configure_change(); return 1; } +int TracerWindow::handle_ungrab() +{ + CWindowGUI *cwindow_gui = plugin->server->mwindow->cwindow->gui; + int ret = ungrab(cwindow_gui); + if( ret ) { + drag->update(0); + plugin->drag = 0; + } + return ret; +} + TracerDraw::TracerDraw(TracerWindow *gui, int x, int y) : BC_CheckBox(x, y, gui->plugin->config.draw, _("Draw")) @@ -595,7 +608,7 @@ int TracerRadius::handle_event() } TracerNewPoint::TracerNewPoint(TracerWindow *gui, Tracer *plugin, int x, int y) - : BC_GenericButton(x, y, 80, _("New")) + : BC_GenericButton(x, y, xS(100), _("New")) { this->gui = gui; this->plugin = plugin; @@ -612,7 +625,7 @@ int TracerNewPoint::handle_event() } TracerDelPoint::TracerDelPoint(TracerWindow *gui, Tracer *plugin, int x, int y) - : BC_GenericButton(x, y, 80, C_("Del")) + : BC_GenericButton(x, y, xS(100), C_("Del")) { this->gui = gui; this->plugin = plugin; @@ -644,11 +657,11 @@ TracerReset::~TracerReset() int TracerReset::handle_event() { TracerConfig &config = plugin->config; - if( !config.drag ) { + if( !plugin->drag ) { MWindow *mwindow = plugin->server->mwindow; CWindowGUI *cwindow_gui = mwindow->cwindow->gui; if( gui->grab(cwindow_gui) ) - config.drag = 1; + plugin->drag = 1; else gui->drag->flicker(10,50); } @@ -657,7 +670,7 @@ int TracerReset::handle_event() config.invert = 0; config.feather = 0; config.radius = 1; - config.selected = -1; + plugin->selected = -1; TracerPoints &points = plugin->config.points; points.remove_all_objects(); gui->point_list->update(-1);