]>
Commit | Line | Data |
---|---|---|
32e219c2 | 1 | // $Header$ |
2 | ||
3 | #include "Scene.h" | |
4 | #include "Viewer.h" | |
5 | #include <Reve/ReveManager.h> | |
6 | ||
7 | #include <TList.h> | |
8 | #include <TGLScenePad.h> | |
9 | ||
10 | using namespace Reve; | |
11 | ||
12 | //______________________________________________________________________ | |
13 | // Reve::Scene | |
14 | // | |
15 | ||
16 | ClassImp(Scene) | |
17 | ||
18 | Scene::Scene(const Text_t* n, const Text_t* t) : | |
19 | RenderElementList(n, t), | |
20 | fPad (0), | |
21 | fGLScene(0), | |
22 | fChanged (kFALSE), | |
23 | fSmartRefresh (kTRUE) | |
24 | { | |
25 | fPad = new Pad; | |
26 | fPad->GetListOfPrimitives()->Add(this); | |
27 | fGLScene = new TGLScenePad(fPad); | |
28 | fGLScene->SetName(n); | |
29 | fGLScene->SetAutoDestruct(kFALSE); | |
30 | } | |
31 | ||
32 | Scene::~Scene() | |
33 | { | |
34 | gReve->GetViewers()->SceneDestructing(this); | |
35 | } | |
36 | ||
37 | /**************************************************************************/ | |
38 | ||
39 | void Scene::CollectSceneParents(List_t& scenes) | |
40 | { | |
41 | scenes.push_back(this); | |
42 | } | |
43 | ||
44 | /**************************************************************************/ | |
45 | ||
46 | void Scene::Repaint() | |
47 | { | |
48 | fGLScene->PadPaint(fPad); | |
49 | fChanged = kFALSE; | |
50 | } | |
51 | ||
52 | /**************************************************************************/ | |
53 | ||
54 | void Scene::SetName(const Text_t* n) | |
55 | { | |
56 | RenderElementList::SetName(n); | |
57 | fGLScene->SetName(n); | |
58 | } | |
59 | ||
60 | void Scene::Paint(Option_t* option) | |
61 | { | |
62 | if (fRnrChildren) | |
63 | { | |
64 | for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) | |
65 | (*i)->PadPaint(option); | |
66 | } | |
67 | } | |
68 | ||
69 | ||
70 | /**************************************************************************/ | |
71 | /**************************************************************************/ | |
72 | /**************************************************************************/ | |
73 | ||
74 | //______________________________________________________________________ | |
75 | // Reve::SceneList | |
76 | // | |
77 | ||
78 | ClassImp(SceneList) | |
79 | ||
80 | SceneList::SceneList(const Text_t* n, const Text_t* t) : | |
81 | RenderElementList(n, t) | |
82 | { | |
83 | SetChildClass(Scene::Class()); | |
84 | } | |
85 | ||
86 | SceneList::~SceneList() | |
87 | {} | |
88 | ||
89 | /**************************************************************************/ | |
90 | ||
91 | void SceneList::RepaintChangedScenes() | |
92 | { | |
93 | for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) | |
94 | { | |
95 | Scene* s = (Scene*) *i; | |
96 | if (s->IsChanged()) | |
97 | { | |
98 | // printf(" Scene '%s' changed ... repainting.\n", s->GetName()); | |
99 | s->Repaint(); | |
100 | } | |
101 | } | |
102 | } | |
103 | ||
104 | void SceneList::RepaintAllScenes() | |
105 | { | |
106 | for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) | |
107 | { | |
108 | Scene* s = (Scene*) *i; | |
109 | // printf(" Scene '%s' repainting.\n", s->GetName()); | |
110 | s->Repaint(); | |
111 | } | |
112 | } |