| 207 | } |
| 208 | |
| 209 | void |
| 210 | RedrawThread::do_start (bool clear, const db::Vector *shift_vector, const std::vector <lay::RedrawLayerInfo> *layers, const std::vector<int> &restart, int nworkers) |
| 211 | { |
| 212 | // change the number of workers if required. |
| 213 | if (nworkers >= 0 && nworkers != num_workers ()) { |
| 214 | set_num_workers (nworkers); |
| 215 | } |
| 216 | |
| 217 | m_initial_update = true; |
| 218 | |
| 219 | // We need this recursion sentinel because start may be called recursively |
| 220 | // via Layout::update which may open a progress widget and do processEvents. |
| 221 | // This may result in a repaint for example issuing a "start" call. |
| 222 | // Recursion however is forbidden because of the deadlocking locks used originally |
| 223 | // to lock out the redraw thread. |
| 224 | if (m_start_recursion_sentinel) { |
| 225 | return; |
| 226 | } |
| 227 | m_start_recursion_sentinel = true; |
| 228 | |
| 229 | { |
| 230 | if (tl::verbosity () >= 40) { |
| 231 | tl::info << tl::to_string (tr ("Preparing to draw")); |
| 232 | } |
| 233 | tl::SelfTimer timer (tl::verbosity () >= 41, tl::to_string (tr ("Preparing to draw"))); |
| 234 | |
| 235 | // detach from all layout objects |
| 236 | tl::Object::detach_from_all_events (); |
| 237 | |
| 238 | // Update all relevant layout objects. |
| 239 | for (unsigned int i = 0; i < mp_view->cellviews (); ++i) { |
| 240 | const lay::CellView &cv = mp_view->cellview (i); |
| 241 | if (cv.is_valid () && ! cv->layout ().under_construction () && ! (cv->layout ().manager () && cv->layout ().manager ()->transacting ())) { |
| 242 | cv->layout ().update (); |
| 243 | // attach to the layout object to receive change notifications to stop the redraw thread |
| 244 | cv->layout ().hier_changed_event.add (this, &RedrawThread::layout_changed); |
| 245 | cv->layout ().bboxes_changed_any_event.add (this, &RedrawThread::layout_changed); |
| 246 | } |
| 247 | } |
| 248 | mp_view->annotation_shapes ().update (); |
| 249 | // attach to the layout object to receive change notifications to stop the redraw thread |
| 250 | mp_view->annotation_shapes ().hier_changed_event.add (this, &RedrawThread::layout_changed); // not really required, since the shapes have no hierarchy, but for completeness .. |
| 251 | mp_view->annotation_shapes ().bboxes_changed_any_event.add (this, &RedrawThread::layout_changed); |
| 252 | mp_view->cellviews_about_to_change_event.add (this, &RedrawThread::layout_changed); |
| 253 | mp_view->cellview_about_to_change_event.add (this, &RedrawThread::layout_changed_with_int); |
| 254 | |
| 255 | m_initial_update = true; |
| 256 | |
| 257 | if (clear) { |
| 258 | m_layers = *layers; |
| 259 | } |
| 260 | |
| 261 | m_nlayers = int (m_layers.size ()); |
| 262 | |
| 263 | if (mp_view->cellviews () > 0) { |
| 264 | |
| 265 | if (clear) { |
| 266 |
nothing calls this directly
no test coverage detected