X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fmotion-cv%2Fmotionwindow-cv.C;h=eeadec0c2bef68d8602db432f978cc59b9bb0eb2;hb=ccd23c15fae578be22d48b1a1e8b09cb43d593ae;hp=e0e2b109b3abf5ecd62d9fadd42b6798509f8258;hpb=1e154071bd323f756625f8172ef67133a561450a;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C b/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C index e0e2b109..eeadec0c 100644 --- a/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C +++ b/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C @@ -2,41 +2,38 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include "bcdisplayinfo.h" #include "clip.h" +#include "edl.h" +#include "fonts.h" +#include "edlsession.h" #include "language.h" #include "motion-cv.h" #include "motionwindow-cv.h" - - - - - - - - +#include "mwindow.h" +#include "pluginserver.h" MotionCVWindow::MotionCVWindow(MotionCVMain *plugin) - : PluginClientWindow(plugin, 815, 650, 815, 650, 0) + : PluginClientWindow(plugin, 815, 600, 815, 600, 0) { - this->plugin = plugin; + this->plugin = plugin; } MotionCVWindow::~MotionCVWindow() @@ -49,207 +46,143 @@ void MotionCVWindow::create_objects() int x2 = 410; BC_Title *title; - - - add_subwindow(global = new MotionCVGlobal(plugin, - this, - x1, - y)); - - add_subwindow(rotate = new MotionCVRotate(plugin, - this, - x2, - y)); + add_subwindow(global = new MotionCVGlobal(plugin, this, x1, y)); + add_subwindow(rotate = new MotionCVRotate(plugin, this, x2, y)); y += 50; - add_subwindow(title = new BC_Title(x1, - y, + add_subwindow(title = new BC_Title(x1, y, _("Translation search radius:\n(W/H Percent of image)"))); - add_subwindow(global_range_w = new GlobalRange(plugin, - x1 + title->get_w() + 10, - y, - &plugin->config.global_range_w)); - add_subwindow(global_range_h = new GlobalRange(plugin, - x1 + title->get_w() + 30 + global_range_w->get_w(), - y, - &plugin->config.global_range_h)); - - add_subwindow(title = new BC_Title(x2, - y, + add_subwindow(global_range_w = new GlobalRange(plugin, + x1 + title->get_w() + 10, y, + &plugin->config.global_range_w)); + add_subwindow(global_range_h = new GlobalRange(plugin, + x1 + title->get_w() + 30 + global_range_w->get_w(), y, + &plugin->config.global_range_h)); + + add_subwindow(title = new BC_Title(x2, y, _("Rotation search radius:\n(Degrees)"))); - add_subwindow(rotation_range = new RotationRange(plugin, - x2 + title->get_w() + 10, - y)); + add_subwindow(rotation_range = + new RotationRange(plugin, x2 + title->get_w() + 10, y)); y += 50; - add_subwindow(title = new BC_Title(x1, - y, + add_subwindow(title = new BC_Title(x1, y, _("Translation block size:\n(W/H Percent of image)"))); - add_subwindow(global_block_w = new BlockSize(plugin, - x1 + title->get_w() + 10, - y, - &plugin->config.global_block_w)); - add_subwindow(global_block_h = new BlockSize(plugin, - x1 + title->get_w() + 30 + global_block_w->get_w(), - y, - &plugin->config.global_block_h)); - - add_subwindow(title = new BC_Title(x2, - y, + add_subwindow(global_block_w = new BlockSize(plugin, + x1 + title->get_w() + 10, y, + &plugin->config.global_block_w)); + add_subwindow(global_block_h = new BlockSize(plugin, + x1 + title->get_w() + 30 + global_block_w->get_w(), y, + &plugin->config.global_block_h)); + + add_subwindow(title = new BC_Title(x2, y, _("Rotation block size:\n(W/H Percent of image)"))); - add_subwindow(rotation_block_w = new BlockSize(plugin, - x2 + title->get_w() + 10, - y, - &plugin->config.rotation_block_w)); - add_subwindow(rotation_block_h = new BlockSize(plugin, - x2 + title->get_w() + 30 + rotation_block_w->get_w(), - y, - &plugin->config.rotation_block_h)); + add_subwindow(rotation_block_w = new BlockSize(plugin, + x2 + title->get_w() + 10, y, + &plugin->config.rotation_block_w)); + add_subwindow(rotation_block_h = new BlockSize(plugin, + x2 + title->get_w() + 30 + rotation_block_w->get_w(), y, + &plugin->config.rotation_block_h)); y += 50; add_subwindow(title = new BC_Title(x1, y, _("Translation search steps:"))); - add_subwindow(global_search_positions = new GlobalSearchPositions(plugin, - x1 + title->get_w() + 10, - y, - 80)); + add_subwindow(global_search_positions = new GlobalSearchPositions(plugin, + x1 + title->get_w() + 10, y, 80)); global_search_positions->create_objects(); add_subwindow(title = new BC_Title(x2, y, _("Rotation search steps:"))); - add_subwindow(rotation_search_positions = new RotationSearchPositions(plugin, - x2 + title->get_w() + 10, - y, - 80)); + add_subwindow(rotation_search_positions = new RotationSearchPositions(plugin, + x2 + title->get_w() + 10, y, 80)); rotation_search_positions->create_objects(); y += 50; add_subwindow(title = new BC_Title(x, y, _("Translation direction:"))); - add_subwindow(mode3 = new Mode3(plugin, - this, - x + title->get_w() + 10, - y)); + add_subwindow(mode3 = new Mode3(plugin, + this, x + title->get_w() + 10, y)); mode3->create_objects(); - y += 40; + y += 40; int y1 = y; + add_subwindow(title = new BC_Title(x2, y, _("Tracking file:"))); + add_subwindow(tracking_file = new MotionCVTrackingFile(plugin, + plugin->config. tracking_file, this, + x2 + title->get_w() + 20, y)); + y1 += tracking_file->get_h() + 10; + add_subwindow(title = new BC_Title(x, y + 10, _("Block X:"))); - add_subwindow(block_x = new MotionCVBlockX(plugin, - this, - x + title->get_w() + 10, - y)); - add_subwindow(block_x_text = new MotionCVBlockXText(plugin, - this, - x + title->get_w() + 10 + block_x->get_w() + 10, - y + 10)); + add_subwindow(block_x = new MotionCVBlockX(plugin, this, + x + title->get_w() + 10, y)); + add_subwindow(block_x_text = new MotionCVBlockXText(plugin, + this, x + title->get_w() + 10 + block_x->get_w() + 10, y + 10)); y += 40; add_subwindow(title = new BC_Title(x, y + 10, _("Block Y:"))); - add_subwindow(block_y = new MotionCVBlockY(plugin, - this, - x + title->get_w() + 10, - y)); - add_subwindow(block_y_text = new MotionCVBlockYText(plugin, - this, - x + title->get_w() + 10 + block_y->get_w() + 10, - y + 10)); + add_subwindow(block_y = new MotionCVBlockY(plugin, this, + x + title->get_w() + 10, y)); + add_subwindow(block_y_text = new MotionCVBlockYText(plugin, this, + x + title->get_w() + 10 + block_y->get_w() + 10, y + 10)); - y += 50; - add_subwindow(title = new BC_Title(x, y + 10, _("Maximum absolute offset:"))); - add_subwindow(magnitude = new MotionCVMagnitude(plugin, - x + title->get_w() + 10, - y)); + add_subwindow(title = new BC_Title(x2, y1 + 10, _("Maximum absolute offset:"))); + add_subwindow(magnitude = new MotionCVMagnitude(plugin, + x2 + title->get_w() + 10, y1)); - y += 40; - add_subwindow(title = new BC_Title(x, y + 10, _("Settling speed:"))); + y1 += 40; + add_subwindow(title = new BC_Title(x2, y1 + 10, _("Settling speed:"))); add_subwindow(return_speed = new MotionCVReturnSpeed(plugin, - x + title->get_w() + 10, - y)); - - - - y += 40; - add_subwindow(vectors = new MotionCVDrawVectors(plugin, - this, - x, - y)); - - add_subwindow(title = new BC_Title(x2, y, _("Tracking file:"))); - add_subwindow(tracking_file = new MotionCVTrackingFile(plugin, - plugin->config.tracking_file, this, x2+title->get_w() + 20, y)); - - y += 40; - add_subwindow(track_single = new TrackSingleFrame(plugin, - this, - x, - y)); - add_subwindow(title = new BC_Title(x + track_single->get_w() + 20, - y, - _("Frame number:"))); - add_subwindow(track_frame_number = new TrackFrameNumber(plugin, - this, - x + track_single->get_w() + title->get_w() + 20, - y)); - add_subwindow(addtrackedframeoffset = new AddTrackedFrameOffset(plugin, - this, - x + track_single->get_w() + title->get_w() + 30, - y + track_single->get_h())); + x2 + title->get_w() + 10, y1)); + y1 += 40; + add_subwindow(vectors = new MotionCVDrawVectors(plugin, this, x2, y1)); + y = y1 + vectors->get_h() + 10; + x1 = x; y1 = y; + add_subwindow(track_single = + new TrackSingleFrame(plugin, this, x1, y1)); y += 20; - add_subwindow(track_previous = new TrackPreviousFrame(plugin, - this, - x, - y)); - + add_subwindow(track_previous = new TrackPreviousFrame(plugin, this, x, y)); y += 20; - add_subwindow(previous_same = new PreviousFrameSameBlock(plugin, - this, - x, - y)); + add_subwindow(previous_same = new PreviousFrameSameBlock(plugin, this, x, y)); y += 40; - //int y1 = y; add_subwindow(title = new BC_Title(x, y, _("Master layer:"))); - add_subwindow(master_layer = new MasterLayer(plugin, - this, - x + title->get_w() + 10, - y)); + add_subwindow(master_layer = new MasterLayer(plugin, this, + x + title->get_w() + 10, y)); master_layer->create_objects(); - y += 30; - + add_subwindow(title = + new BC_Title(x1=x2, y1=y, _("Frame number:"))); + add_subwindow(track_frame_number = + new TrackFrameNumber(plugin, this, x1 += title->get_w(), y1)); + if( plugin->config.mode3 != MotionCVConfig::TRACK_SINGLE ) + track_frame_number->disable(); + + add_subwindow(addtrackedframeoffset = + new AddTrackedFrameOffset(plugin, this, x1=x2, y1+=track_frame_number->get_h())); + int pef = client->server->mwindow->edl->session->video_every_frame; + add_subwindow(pef_title = new BC_Title(x1=x2+50, y1+=addtrackedframeoffset->get_h() + 5, + !pef ? _("For best results\n" + " Set: Play every frame\n" + " Preferences-> Playback-> Video Out") : + _("Currently using: Play every frame"), MEDIUMFONT, + !pef ? RED : GREEN)); + y += 30; add_subwindow(title = new BC_Title(x, y, _("Action:"))); - add_subwindow(mode1 = new Mode1(plugin, - this, - x + title->get_w() + 10, - y)); + add_subwindow(mode1 = new Mode1(plugin, this, + x + title->get_w() + 10, y)); mode1->create_objects(); - y += 30; - - - + y += 30; add_subwindow(title = new BC_Title(x, y, _("Calculation:"))); - add_subwindow(mode2 = new Mode2(plugin, - this, - x + title->get_w() + 10, - y)); + add_subwindow(mode2 = new Mode2(plugin, this, + x + title->get_w() + 10, y)); mode2->create_objects(); - - show_window(1); } void MotionCVWindow::update_mode() { - global_range_w->update(plugin->config.global_range_w, - MIN_RADIUS, - MAX_RADIUS); - global_range_h->update(plugin->config.global_range_h, - MIN_RADIUS, - MAX_RADIUS); - rotation_range->update(plugin->config.rotation_range, - MIN_ROTATION, - MAX_ROTATION); + global_range_w->update(plugin->config.global_range_w, MIN_RADIUS, MAX_RADIUS); + global_range_h->update(plugin->config.global_range_h, MIN_RADIUS, MAX_RADIUS); + rotation_range->update(plugin->config.rotation_range, MIN_ROTATION, MAX_ROTATION); vectors->update(plugin->config.draw_vectors); tracking_file->update(plugin->config.tracking_file); global->update(plugin->config.global); @@ -257,32 +190,13 @@ void MotionCVWindow::update_mode() addtrackedframeoffset->update(plugin->config.addtrackedframeoffset); } - - - - - - - - - - - -GlobalRange::GlobalRange(MotionCVMain *plugin, - int x, - int y, - int *value) - : BC_IPot(x, - y, - (int64_t)*value, - (int64_t)MIN_RADIUS, - (int64_t)MAX_RADIUS) +GlobalRange::GlobalRange(MotionCVMain *plugin, int x, int y, int *value) +:BC_IPot(x, y, (int64_t) * value, (int64_t) MIN_RADIUS, (int64_t) MAX_RADIUS) { this->plugin = plugin; this->value = value; } - int GlobalRange::handle_event() { *value = (int)get_value(); @@ -290,22 +204,15 @@ int GlobalRange::handle_event() return 1; } - - - -RotationRange::RotationRange(MotionCVMain *plugin, - int x, - int y) - : BC_IPot(x, - y, - (int64_t)plugin->config.rotation_range, - (int64_t)MIN_ROTATION, - (int64_t)MAX_ROTATION) +RotationRange::RotationRange(MotionCVMain *plugin, int x, int y) + : +BC_IPot(x, + y, (int64_t) plugin->config.rotation_range, + (int64_t) MIN_ROTATION, (int64_t) MAX_ROTATION) { this->plugin = plugin; } - int RotationRange::handle_event() { plugin->config.rotation_range = (int)get_value(); @@ -313,28 +220,13 @@ int RotationRange::handle_event() return 1; } - - - - - - - -BlockSize::BlockSize(MotionCVMain *plugin, - int x, - int y, - int *value) - : BC_IPot(x, - y, - (int64_t)*value, - (int64_t)MIN_BLOCK, - (int64_t)MAX_BLOCK) +BlockSize::BlockSize(MotionCVMain *plugin, int x, int y, int *value) + : BC_IPot(x, y, (int64_t) * value, (int64_t) MIN_BLOCK, (int64_t) MAX_BLOCK) { this->plugin = plugin; this->value = value; } - int BlockSize::handle_event() { *value = (int)get_value(); @@ -342,30 +234,13 @@ int BlockSize::handle_event() return 1; } - - - - - - - - - - - - -GlobalSearchPositions::GlobalSearchPositions(MotionCVMain *plugin, - int x, - int y, - int w) - : BC_PopupMenu(x, - y, - w, - "", - 1) +GlobalSearchPositions::GlobalSearchPositions(MotionCVMain *plugin, + int x, int y, int w) + : BC_PopupMenu(x, y, w, "", 1) { this->plugin = plugin; } + void GlobalSearchPositions::create_objects() { add_item(new BC_MenuItem("64")); @@ -392,24 +267,13 @@ int GlobalSearchPositions::handle_event() return 1; } - - - - - - -RotationSearchPositions::RotationSearchPositions(MotionCVMain *plugin, - int x, - int y, - int w) - : BC_PopupMenu(x, - y, - w, - "", - 1) +RotationSearchPositions::RotationSearchPositions(MotionCVMain *plugin, + int x, int y, int w) + : BC_PopupMenu(x, y, w, "", 1) { this->plugin = plugin; } + void RotationSearchPositions::create_objects() { add_item(new BC_MenuItem("4")); @@ -428,21 +292,8 @@ int RotationSearchPositions::handle_event() return 1; } - - - - - - - -MotionCVMagnitude::MotionCVMagnitude(MotionCVMain *plugin, - int x, - int y) - : BC_IPot(x, - y, - (int64_t)plugin->config.magnitude, - (int64_t)0, - (int64_t)100) +MotionCVMagnitude::MotionCVMagnitude(MotionCVMain *plugin, int x, int y) + : BC_IPot(x, y, (int64_t) plugin->config.magnitude, (int64_t) 0, (int64_t) 100) { this->plugin = plugin; } @@ -454,15 +305,8 @@ int MotionCVMagnitude::handle_event() return 1; } - -MotionCVReturnSpeed::MotionCVReturnSpeed(MotionCVMain *plugin, - int x, - int y) - : BC_IPot(x, - y, - (int64_t)plugin->config.return_speed, - (int64_t)0, - (int64_t)100) +MotionCVReturnSpeed::MotionCVReturnSpeed(MotionCVMain *plugin, int x, int y) + : BC_IPot(x, y, (int64_t) plugin->config.return_speed, (int64_t) 0, (int64_t) 100) { this->plugin = plugin; } @@ -474,15 +318,9 @@ int MotionCVReturnSpeed::handle_event() return 1; } - - -AddTrackedFrameOffset::AddTrackedFrameOffset(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_CheckBox(x, - y, - plugin->config.addtrackedframeoffset, +AddTrackedFrameOffset::AddTrackedFrameOffset(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_CheckBox(x, y, plugin->config.addtrackedframeoffset, _("Add (loaded) offset from tracked frame")) { this->plugin = plugin; @@ -497,7 +335,7 @@ int AddTrackedFrameOffset::handle_event() } MotionCVTrackingFile::MotionCVTrackingFile(MotionCVMain *plugin, - const char *filename, MotionCVWindow *gui, int x, int y) + const char *filename, MotionCVWindow *gui, int x, int y) : BC_TextBox(x, y, 250, 1, filename) { this->plugin = plugin; @@ -511,14 +349,9 @@ int MotionCVTrackingFile::handle_event() return 1; } -MotionCVGlobal::MotionCVGlobal(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_CheckBox(x, - y, - plugin->config.global, - _("Track translation")) +MotionCVGlobal::MotionCVGlobal(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + :BC_CheckBox(x, y, plugin->config.global, _("Track translation")) { this->plugin = plugin; this->gui = gui; @@ -531,14 +364,9 @@ int MotionCVGlobal::handle_event() return 1; } -MotionCVRotate::MotionCVRotate(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_CheckBox(x, - y, - plugin->config.rotate, - _("Track rotation")) +MotionCVRotate::MotionCVRotate(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_CheckBox(x, y, plugin->config.rotate, _("Track rotation")) { this->plugin = plugin; this->gui = gui; @@ -551,19 +379,9 @@ int MotionCVRotate::handle_event() return 1; } - - - - -MotionCVBlockX::MotionCVBlockX(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_FPot(x, - y, - plugin->config.block_x, - (float)0, - (float)100) +MotionCVBlockX::MotionCVBlockX(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_FPot(x, y, plugin->config.block_x, (float)0, (float)100) { this->plugin = plugin; this->gui = gui; @@ -577,18 +395,9 @@ int MotionCVBlockX::handle_event() return 1; } - - - -MotionCVBlockY::MotionCVBlockY(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_FPot(x, - y, - (float)plugin->config.block_y, - (float)0, - (float)100) +MotionCVBlockY::MotionCVBlockY(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_FPot(x, y, (float)plugin->config.block_y, (float)0, (float)100) { this->plugin = plugin; this->gui = gui; @@ -602,15 +411,9 @@ int MotionCVBlockY::handle_event() return 1; } -MotionCVBlockXText::MotionCVBlockXText(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_TextBox(x, - y, - 75, - 1, - (float)plugin->config.block_x) +MotionCVBlockXText::MotionCVBlockXText(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_TextBox(x, y, 75, 1, (float)plugin->config.block_x) { this->plugin = plugin; this->gui = gui; @@ -625,18 +428,9 @@ int MotionCVBlockXText::handle_event() return 1; } - - - -MotionCVBlockYText::MotionCVBlockYText(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_TextBox(x, - y, - 75, - 1, - (float)plugin->config.block_y) +MotionCVBlockYText::MotionCVBlockYText(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_TextBox(x, y, 75, 1, (float)plugin->config.block_y) { this->plugin = plugin; this->gui = gui; @@ -651,29 +445,9 @@ int MotionCVBlockYText::handle_event() return 1; } - - - - - - - - - - - - - - - -MotionCVDrawVectors::MotionCVDrawVectors(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_CheckBox(x, - y, - plugin->config.draw_vectors, - _("Draw vectors")) +MotionCVDrawVectors::MotionCVDrawVectors(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : BC_CheckBox(x, y, plugin->config.draw_vectors, _("Draw vectors")) { this->gui = gui; this->plugin = plugin; @@ -686,21 +460,12 @@ int MotionCVDrawVectors::handle_event() return 1; } - - - - - - - -TrackSingleFrame::TrackSingleFrame(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_Radial(x, - y, - plugin->config.mode3 == MotionCVConfig::TRACK_SINGLE, - _("Track single frame")) +TrackSingleFrame::TrackSingleFrame(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : +BC_Radial(x, + y, plugin->config.mode3 == MotionCVConfig::TRACK_SINGLE, + _("Track single frame")) { this->plugin = plugin; this->gui = gui; @@ -716,22 +481,12 @@ int TrackSingleFrame::handle_event() return 1; } - - - - - - - -TrackFrameNumber::TrackFrameNumber(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) +TrackFrameNumber::TrackFrameNumber(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) : BC_TextBox(x, y, 100, 1, plugin->config.track_frame) { this->plugin = plugin; this->gui = gui; - if(plugin->config.mode3 != MotionCVConfig::TRACK_SINGLE) disable(); } int TrackFrameNumber::handle_event() @@ -741,24 +496,17 @@ int TrackFrameNumber::handle_event() return 1; } - - - - - - -TrackPreviousFrame::TrackPreviousFrame(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_Radial(x, - y, - plugin->config.mode3 == MotionCVConfig::TRACK_PREVIOUS, - _("Track previous frame")) +TrackPreviousFrame::TrackPreviousFrame(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : +BC_Radial(x, + y, plugin->config.mode3 == MotionCVConfig::TRACK_PREVIOUS, + _("Track previous frame")) { this->plugin = plugin; this->gui = gui; } + int TrackPreviousFrame::handle_event() { plugin->config.mode3 = MotionCVConfig::TRACK_PREVIOUS; @@ -769,25 +517,17 @@ int TrackPreviousFrame::handle_event() return 1; } - - - - - - - -PreviousFrameSameBlock::PreviousFrameSameBlock(MotionCVMain *plugin, - MotionCVWindow *gui, - int x, - int y) - : BC_Radial(x, - y, - plugin->config.mode3 == MotionCVConfig::PREVIOUS_SAME_BLOCK, - _("Previous frame same block")) +PreviousFrameSameBlock::PreviousFrameSameBlock(MotionCVMain *plugin, + MotionCVWindow *gui, int x, int y) + : +BC_Radial(x, + y, plugin->config.mode3 == MotionCVConfig::PREVIOUS_SAME_BLOCK, + _("Previous frame same block")) { this->plugin = plugin; this->gui = gui; } + int PreviousFrameSameBlock::handle_event() { plugin->config.mode3 = MotionCVConfig::PREVIOUS_SAME_BLOCK; @@ -798,16 +538,10 @@ int PreviousFrameSameBlock::handle_event() return 1; } - - - - - - - -MasterLayer::MasterLayer(MotionCVMain *plugin, MotionCVWindow *gui, int x, int y) +MasterLayer::MasterLayer(MotionCVMain *plugin, MotionCVWindow *gui, int x, + int y) : BC_PopupMenu(x, y, calculate_w(gui), - to_text(plugin->config.bottom_is_master)) + to_text(plugin->config.bottom_is_master)) { this->plugin = plugin; this->gui = gui; @@ -828,11 +562,11 @@ void MasterLayer::create_objects() int MasterLayer::from_text(char *text) { - if(!strcmp(text, _("Top"))) return 0; + if( !strcmp(text, _("Top")) ) return 0; return 1; } -const char* MasterLayer::to_text(int mode) +const char *MasterLayer::to_text(int mode) { return mode ? _("Bottom") : _("Top"); } @@ -845,16 +579,8 @@ int MasterLayer::calculate_w(MotionCVWindow *gui) return result + 50; } - - - - - - - Mode1::Mode1(MotionCVMain *plugin, MotionCVWindow *gui, int x, int y) - : BC_PopupMenu(x, y, calculate_w(gui), - to_text(plugin->config.mode1)) + : BC_PopupMenu(x, y, calculate_w(gui), to_text(plugin->config.mode1)) { this->plugin = plugin; this->gui = gui; @@ -878,22 +604,22 @@ void Mode1::create_objects() int Mode1::from_text(char *text) { - if(!strcmp(text, _("Track Subpixel"))) return MotionCVConfig::TRACK; - if(!strcmp(text, _("Track Pixel"))) return MotionCVConfig::TRACK_PIXEL; - if(!strcmp(text, _("Stabilize Subpixel"))) return MotionCVConfig::STABILIZE; - if(!strcmp(text, _("Stabilize Pixel"))) return MotionCVConfig::STABILIZE_PIXEL; - //if(!strcmp(text, _("Do Nothing"))) return MotionCVConfig::NOTHING; + if( !strcmp(text, _("Track Subpixel")) ) return MotionCVConfig::TRACK; + if( !strcmp(text, _("Track Pixel")) ) return MotionCVConfig::TRACK_PIXEL; + if( !strcmp(text, _("Stabilize Subpixel")) ) return MotionCVConfig::STABILIZE; + if( !strcmp(text, _("Stabilize Pixel")) ) return MotionCVConfig::STABILIZE_PIXEL; + //if( !strcmp(text, _("Do Nothing")) ) return MotionCVConfig::NOTHING; return MotionCVConfig::NOTHING; } -const char* Mode1::to_text(int mode) +const char *Mode1::to_text(int mode) { - switch(mode) { - case MotionCVConfig::TRACK: return _("Track Subpixel"); - case MotionCVConfig::TRACK_PIXEL: return _("Track Pixel"); - case MotionCVConfig::STABILIZE: return _("Stabilize Subpixel"); + switch( mode ) { + case MotionCVConfig::TRACK: return _("Track Subpixel"); + case MotionCVConfig::TRACK_PIXEL: return _("Track Pixel"); + case MotionCVConfig::STABILIZE: return _("Stabilize Subpixel"); case MotionCVConfig::STABILIZE_PIXEL: return _("Stabilize Pixel"); - case MotionCVConfig::NOTHING: return _("Do Nothing"); + case MotionCVConfig::NOTHING: return _("Do Nothing"); } return ""; } @@ -909,13 +635,8 @@ int Mode1::calculate_w(MotionCVWindow *gui) return result + 50; } - - - - Mode2::Mode2(MotionCVMain *plugin, MotionCVWindow *gui, int x, int y) - : BC_PopupMenu(x, y, calculate_w(gui), - to_text(plugin->config.mode2)) + : BC_PopupMenu(x, y, calculate_w(gui), to_text(plugin->config.mode2)) { this->plugin = plugin; this->gui = gui; @@ -930,24 +651,24 @@ int Mode2::handle_event() void Mode2::create_objects() { - add_item(new BC_MenuItem(to_text(MotionCVConfig::NO_CALCULATE))); - add_item(new BC_MenuItem(to_text(MotionCVConfig::RECALCULATE))); add_item(new BC_MenuItem(to_text(MotionCVConfig::SAVE))); add_item(new BC_MenuItem(to_text(MotionCVConfig::LOAD))); + add_item(new BC_MenuItem(to_text(MotionCVConfig::RECALCULATE))); + add_item(new BC_MenuItem(to_text(MotionCVConfig::NO_CALCULATE))); } int Mode2::from_text(char *text) { - if(!strcmp(text, _("Recalculate"))) return MotionCVConfig::RECALCULATE; - if(!strcmp(text, _("Save coords to tracking file"))) return MotionCVConfig::SAVE; - if(!strcmp(text, _("Load coords from tracking file"))) return MotionCVConfig::LOAD; - //if(!strcmp(text, _("Don't Calculate"))) return MotionCVConfig::NO_CALCULATE; + if( !strcmp(text, _("Recalculate")) ) return MotionCVConfig::RECALCULATE; + if( !strcmp(text, _("Save coords to tracking file")) ) return MotionCVConfig::SAVE; + if( !strcmp(text, _("Load coords from tracking file")) ) return MotionCVConfig::LOAD; + //if( !strcmp(text, _("Don't Calculate")) ) return MotionCVConfig::NO_CALCULATE; return MotionCVConfig::NO_CALCULATE; } -const char* Mode2::to_text(int mode) +const char *Mode2::to_text(int mode) { - switch(mode) { + switch( mode ) { case MotionCVConfig::NO_CALCULATE: return _("Don't Calculate"); case MotionCVConfig::RECALCULATE: return _("Recalculate"); case MotionCVConfig::SAVE: return _("Save coords to tracking file"); @@ -966,18 +687,10 @@ int Mode2::calculate_w(MotionCVWindow *gui) return result + 50; } - - - - - - - - - Mode3::Mode3(MotionCVMain *plugin, MotionCVWindow *gui, int x, int y) - : BC_PopupMenu(x, y, calculate_w(gui), - to_text(plugin->config.horizontal_only, plugin->config.vertical_only)) + : +BC_PopupMenu(x, y, calculate_w(gui), + to_text(plugin->config.horizontal_only, plugin->config.vertical_only)) { this->plugin = plugin; this->gui = gui; @@ -985,7 +698,8 @@ Mode3::Mode3(MotionCVMain *plugin, MotionCVWindow *gui, int x, int y) int Mode3::handle_event() { - from_text(&plugin->config.horizontal_only, &plugin->config.vertical_only, get_text()); + from_text(&plugin->config.horizontal_only, + &plugin->config.vertical_only, get_text()); plugin->send_configure_change(); return 1; } @@ -1001,14 +715,14 @@ void Mode3::from_text(int *horizontal_only, int *vertical_only, char *text) { *horizontal_only = 0; *vertical_only = 0; - if(!strcmp(text, to_text(1, 0))) *horizontal_only = 1; - if(!strcmp(text, to_text(0, 1))) *vertical_only = 1; + if( !strcmp(text, to_text(1, 0)) ) *horizontal_only = 1; + if( !strcmp(text, to_text(0, 1)) ) *vertical_only = 1; } -const char* Mode3::to_text(int horizontal_only, int vertical_only) +const char *Mode3::to_text(int horizontal_only, int vertical_only) { - if(horizontal_only) return _("Horizontal only"); - if(vertical_only) return _("Vertical only"); + if( horizontal_only ) return _("Horizontal only"); + if( vertical_only ) return _("Vertical only"); return _("Both"); } @@ -1021,3 +735,4 @@ int Mode3::calculate_w(MotionCVWindow *gui) return result + 50; } +