Colobot
studio.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.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 #pragma once
21 
22 #include "common/event.h"
23 
24 #include "graphics/engine/camera.h"
25 
26 #include <string>
27 
28 class CEventQueue;
29 class CScript;
30 class CSoundInterface;
31 class CSettings;
32 struct Program;
33 class CPauseManager;
34 struct ActivePause;
35 
36 namespace Ui
37 {
38 
39 class CEdit;
40 class CInterface;
41 
42 enum StudioDialog
43 {
44  SD_NULL,
45  SD_OPEN,
46  SD_SAVE,
47  SD_FIND,
48  SD_REPLACE,
49 };
50 
51 
52 
53 class CStudio
54 {
55 public:
56  CStudio();
57  ~CStudio();
58 
59  bool EventProcess(const Event &event);
60 
61  void StartEditScript(CScript *script, std::string name, Program* program);
62  bool StopEditScript(bool bCancel);
63 
64  void SetInfoText(std::string text, bool bClickable);
65 
66 protected:
67  bool EventFrame(const Event &event);
68  void SearchToken(CEdit* edit);
69  void ColorizeScript(CEdit* edit);
70  void AdjustEditScript();
71  void ViewEditScript();
72  void UpdateFlux();
73  void UpdateButtons();
74 
75  void StartDialog(StudioDialog type);
76  void StopDialog();
77  void AdjustDialog();
78  bool EventDialog(const Event &event);
79  void UpdateChangeList();
80  void UpdateChangeEdit();
81  void UpdateDialogAction();
82  void UpdateDialogPublic();
83  void UpdateDialogList();
84  std::string SearchDirectory(bool bCreate);
85  bool ReadProgram();
86  bool WriteProgram();
87 
88  void SetFilenameField(CEdit* edit, const std::string& filename);
89 
90 protected:
91  Gfx::CEngine* m_engine;
92  CEventQueue* m_event;
93  CRobotMain* m_main;
94  Gfx::CCamera* m_camera;
95  CSoundInterface* m_sound;
96  CInterface* m_interface;
97  CApplication* m_app;
98  CPauseManager* m_pause;
99  CSettings* m_settings;
100 
101  Program* m_program;
102  CScript* m_script;
103  Gfx::CameraType m_editCamera;
104 
105  bool m_bEditMaximized;
106  bool m_bEditMinimized;
107 
108  Math::Point m_editActualPos;
109  Math::Point m_editActualDim;
110  Math::Point m_editFinalPos;
111  Math::Point m_editFinalDim;
112 
113  float m_time;
114  float m_fixInfoTextTime;
115  bool m_bRunning;
116  bool m_bRealTime;
117  ActivePause* m_editorPause = nullptr;
118  std::string m_helpFilename;
119 
120  StudioDialog m_dialog;
121 };
122 
123 
124 } // namespace Ui
CameraType
Type of camera.
Definition: camera.h:46
Definition: pausemanager.h:45
Definition: robotmain.h:107
Camera handling - CCamera class.
Global event queue.
Definition: event.h:840
Definition: robotmain.h:151
Definition: settings.h:31
2D point
Definition: point.h:50
Main application.
Definition: app.h:191
Camera moving in 3D scene.
Definition: camera.h:134
The graphics engine.
Definition: engine.h:620
Event types, structs and event queue.
Definition: script.h:58
Definition: edit.h:112
Event sent by system, interface or game.
Definition: event.h:709
Definition: pausemanager.h:60
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:57
Definition: studio.h:53
Definition: program_storage_object.h:31