forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.cpp
More file actions
65 lines (52 loc) · 1.01 KB
/
context.cpp
File metadata and controls
65 lines (52 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Aseprite Document Library
// Copyright (c) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "doc/context.h"
#include "base/debug.h"
#include "doc/site.h"
namespace doc {
Context::Context()
: m_docs(this)
, m_activeDoc(NULL)
{
m_docs.add_observer(this);
}
Context::~Context()
{
m_docs.remove_observer(this);
}
Site Context::activeSite() const
{
Site site;
onGetActiveSite(&site);
return site;
}
Document* Context::activeDocument() const
{
Site site;
onGetActiveSite(&site);
return site.document();
}
void Context::notifyActiveSiteChanged()
{
Site site = activeSite();
notify_observers<const Site&>(&ContextObserver::onActiveSiteChange, site);
}
void Context::onGetActiveSite(Site* site) const
{
ASSERT(false);
}
void Context::onAddDocument(Document* doc)
{
// Do nothing
}
void Context::onRemoveDocument(Document* doc)
{
// Do nothing
}
} // namespace doc