MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / updateUsingEditor

Method updateUsingEditor

src/app/ui/timeline.cpp:166–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void 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
214void Timeline::detachDocument()
215{

Callers 3

setActiveViewMethod · 0.45
onStateChangedMethod · 0.45
onMouseUpMethod · 0.45

Calls 9

disableRangeMethod · 0.80
getDocumentViewMethod · 0.80
enabledMethod · 0.45
addObserverMethod · 0.45
getSiteMethod · 0.45
documentMethod · 0.45
spriteMethod · 0.45
layerMethod · 0.45
frameMethod · 0.45

Tested by

no test coverage detected