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