Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
studio.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 // studio.h
21 
22 #pragma once
23 #include "common/event.h"
24 
25 #include "graphics/engine/camera.h"
26 
27 #include "app/pausemanager.h"
28 
29 #include <boost/filesystem.hpp>
30 
31 namespace fs = boost::filesystem;
32 
33 #include <string>
34 
35 class CEventQueue;
36 class CRobotMain;
37 class CScript;
38 class CSoundInterface;
39 
40 namespace Gfx {
41 class CEngine;
42 class CCamera;
43 };
44 
45 struct Program;
46 
47 namespace Ui {
48 
49 class CEdit;
50 class CInterface;
51 
52 enum StudioDialog
53 {
54  SD_NULL,
55  SD_OPEN,
56  SD_SAVE,
57  SD_FIND,
58  SD_REPLACE,
59 };
60 
61 
62 
63 class CStudio
64 {
65 public:
66  CStudio();
67  ~CStudio();
68 
69  bool EventProcess(const Event &event);
70 
71  void StartEditScript(CScript *script, std::string name, Program* program);
72  bool StopEditScript(bool bCancel);
73 
74  void SetInfoText(std::string text, bool bClickable);
75 
76 protected:
77  bool EventFrame(const Event &event);
78  void SearchToken(CEdit* edit);
79  void ColorizeScript(CEdit* edit);
80  void AdjustEditScript();
81  void ViewEditScript();
82  void UpdateFlux();
83  void UpdateButtons();
84 
85  void StartDialog(StudioDialog type);
86  void StopDialog();
87  void AdjustDialog();
88  bool EventDialog(const Event &event);
89  void UpdateChangeList();
90  void UpdateChangeEdit();
91  void UpdateDialogAction();
92  void UpdateDialogPublic();
93  void UpdateDialogList();
94  std::string SearchDirectory(bool bCreate);
95  bool ReadProgram();
96  bool WriteProgram();
97 
98  void SetFilenameField(CEdit* edit, const std::string& filename);
99 
100 protected:
101  Gfx::CEngine* m_engine;
102  CEventQueue* m_event;
103  CRobotMain* m_main;
104  Gfx::CCamera* m_camera;
105  CSoundInterface* m_sound;
106  CInterface* m_interface;
107  CApplication* m_app;
108  CPauseManager* m_pause;
109 
110  Program* m_program;
111  CScript* m_script;
112  Gfx::CameraType m_editCamera;
113 
114  bool m_bEditMaximized;
115  bool m_bEditMinimized;
116 
117  Math::Point m_editActualPos;
118  Math::Point m_editActualDim;
119  Math::Point m_editFinalPos;
120  Math::Point m_editFinalDim;
121 
122  float m_time;
123  float m_fixInfoTextTime;
124  bool m_bRunning;
125  bool m_bRealTime;
126  PauseType m_bInitPause;
127  std::string m_helpFilename;
128 
129  StudioDialog m_dialog;
130 };
131 
132 
133 } // namespace Ui
134 
CameraType
Type of camera.
Definition: camera.h:45
Definition: controller.h:32
Camera handling - CCamera class.
Global event queue.
Definition: event.h:751
Definition: robotmain.h:172
2D point
Definition: point.h:49
Main application.
Definition: app.h:187
Camera moving in 3D scene.
Definition: camera.h:133
Management of pause modes.
Namespace for (new) graphics code.
Definition: app.h:49
The graphics engine.
Definition: engine.h:684
Event types, structs and event queue.
Definition: script.h:58
Definition: edit.h:131
Event sent by system, interface or game.
Definition: event.h:678
Definition: pausemanager.h:44
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:151
Definition: studio.h:63
Definition: brain.h:77