@@ -33,7 +33,7 @@ BoxDraw::BoxDraw()
3333 , Y(" <b>Y Coordinate:</b>" , LockMode::UNLOCK_WHILE_RUNNING, 0.3 , 0.0 , 1.0 )
3434 , WIDTH(" <b>Width:</b>" , LockMode::UNLOCK_WHILE_RUNNING, 0.4 , 0.0 , 1.0 )
3535 , HEIGHT(" <b>Height:</b>" , LockMode::UNLOCK_WHILE_RUNNING, 0.4 , 0.0 , 1.0 )
36- , BOX_COORDINATES(false , " ImageFloatBox coordinates" , LockMode::LOCK_WHILE_RUNNING , " 0.3, 0.3, 0.4, 0.4" , " 0.3, 0.3, 0.4, 0.4" )
36+ , BOX_COORDINATES(false , " ImageFloatBox coordinates" , LockMode::UNLOCK_WHILE_RUNNING , " 0.3, 0.3, 0.4, 0.4" , " 0.3, 0.3, 0.4, 0.4" )
3737{
3838 PA_ADD_OPTION (X);
3939 PA_ADD_OPTION (Y);
@@ -59,23 +59,23 @@ class BoxDraw::DrawnBox : public ConfigOption::Listener, public VideoOverlay::Mo
5959 m_parent.Y .add_listener (*this );
6060 m_parent.WIDTH .add_listener (*this );
6161 m_parent.HEIGHT .add_listener (*this );
62- // m_parent.BOX_COORDINATES.add_listener(*this);
62+ m_parent.BOX_COORDINATES .add_listener (*this );
6363 overlay.add_listener (*this );
6464 }catch (...){
6565 detach ();
6666 throw ;
6767 }
6868 }
6969 virtual void on_config_value_changed (void * object) override {
70- std::lock_guard<std::mutex> lg (m_lock);
70+ // std::lock_guard<std::mutex> lg(m_lock);
7171 m_overlay_set.clear ();
7272 m_overlay_set.add (COLOR_RED, {m_parent.X , m_parent.Y , m_parent.WIDTH , m_parent.HEIGHT });
7373 if (object == &m_parent.X || object == &m_parent.Y || object == &m_parent.WIDTH || object == &m_parent.HEIGHT ){
7474 m_parent.update_box_coordinates ();
7575 }
76- // else if(object == &m_parent.BOX_COORDINATES){
77- // // m_parent.update_individual_coordinates();
78- // }
76+ else if (object == &m_parent.BOX_COORDINATES ){
77+ m_parent.update_individual_coordinates ();
78+ }
7979
8080
8181 }
@@ -112,7 +112,7 @@ class BoxDraw::DrawnBox : public ConfigOption::Listener, public VideoOverlay::Mo
112112 m_parent.Y .set (yl);
113113 m_parent.WIDTH .set (xh - xl);
114114 m_parent.HEIGHT .set (yh - yl);
115- m_parent.update_box_coordinates ();
115+ // m_parent.update_box_coordinates();
116116 }
117117
118118private:
@@ -122,6 +122,7 @@ class BoxDraw::DrawnBox : public ConfigOption::Listener, public VideoOverlay::Mo
122122 m_parent.Y .remove_listener (*this );
123123 m_parent.WIDTH .remove_listener (*this );
124124 m_parent.HEIGHT .remove_listener (*this );
125+ m_parent.BOX_COORDINATES .remove_listener (*this );
125126 }
126127
127128private:
@@ -134,7 +135,8 @@ class BoxDraw::DrawnBox : public ConfigOption::Listener, public VideoOverlay::Mo
134135};
135136
136137void BoxDraw::update_box_coordinates (){
137- BOX_COORDINATES.set (std::to_string (X) + " , " + std::to_string (Y) + " , " + std::to_string (WIDTH) + " , " + std::to_string (HEIGHT));
138+ std::string box_coord_string = std::to_string (X) + " , " + std::to_string (Y) + " , " + std::to_string (WIDTH) + " , " + std::to_string (HEIGHT);
139+ BOX_COORDINATES.set (box_coord_string);
138140}
139141
140142std::vector<std::string> split (const std::string& str, const std::string& delimiter) {
@@ -167,11 +169,11 @@ void BoxDraw::update_individual_coordinates(){
167169 double width_coord = std::stod (width_string);
168170 double height_coord = std::stod (height_string);
169171
170- cout << box_coord_string << endl;
171- cout << std::to_string (x_coord) << endl;
172- cout << std::to_string (y_coord) << endl;
173- cout << std::to_string (width_coord) << endl;
174- cout << std::to_string (height_coord) << endl;
172+ // cout << box_coord_string << endl;
173+ // cout << std::to_string(x_coord) << endl;
174+ // cout << std::to_string(y_coord) << endl;
175+ // cout << std::to_string(width_coord) << endl;
176+ // cout << std::to_string(height_coord) << endl;
175177
176178 X.set (x_coord);
177179 Y.set (y_coord);
0 commit comments