| 164 | } |
| 165 | |
| 166 | void Timeline::updateUsingEditor(Editor* editor) |
| 167 | { |
| 168 | m_aniControls.updateUsingEditor(editor); |
| 169 | |
| 170 | detachDocument(); |
| 171 | |
| 172 | if (m_range.enabled()) { |
| 173 | m_range.disableRange(); |
| 174 | invalidate(); |
| 175 | } |
| 176 | |
| 177 | // We always update the editor. In this way the timeline keeps in |
| 178 | // sync with the active editor. |
| 179 | m_editor = editor; |
| 180 | |
| 181 | if (m_editor) |
| 182 | m_editor->addObserver(this); |
| 183 | else |
| 184 | return; // No editor specified. |
| 185 | |
| 186 | Site site; |
| 187 | DocumentView* view = m_editor->getDocumentView(); |
| 188 | view->getSite(&site); |
| 189 | |
| 190 | site.document()->addObserver(this); |
| 191 | |
| 192 | // If we are already in the same position as the "editor", we don't |
| 193 | // need to update the at all timeline. |
| 194 | if (m_document == site.document() && |
| 195 | m_sprite == site.sprite() && |
| 196 | m_layer == site.layer() && |
| 197 | m_frame == site.frame()) |
| 198 | return; |
| 199 | |
| 200 | m_document = static_cast<app::Document*>(site.document()); |
| 201 | m_sprite = site.sprite(); |
| 202 | m_layer = site.layer(); |
| 203 | m_frame = site.frame(); |
| 204 | m_state = STATE_STANDBY; |
| 205 | m_hot.part = PART_NOTHING; |
| 206 | m_clk.part = PART_NOTHING; |
| 207 | |
| 208 | setFocusStop(true); |
| 209 | regenerateLayers(); |
| 210 | setViewScroll(viewScroll()); |
| 211 | showCurrentCel(); |
| 212 | } |
| 213 | |
| 214 | void Timeline::detachDocument() |
| 215 | { |
no test coverage detected