Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
studio.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // * Copyright (C) 2012 Polish Portal of Colobot (PPC)
4 // *
5 // * This program is free software: you can redistribute it and/or modify
6 // * it under the terms of the GNU General Public License as published by
7 // * the Free Software Foundation, either version 3 of the License, or
8 // * (at your option) any later version.
9 // *
10 // * This program is distributed in the hope that it will be useful,
11 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // * GNU General Public License for more details.
14 // *
15 // * You should have received a copy of the GNU General Public License
16 // * along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 // studio.h
19 
20 #pragma once
21 #include "common/event.h"
22 
23 #include "graphics/engine/camera.h"
24 
25 #include <boost/filesystem.hpp>
26 
27 namespace fs = boost::filesystem;
28 
29 #include <string>
30 
31 class CEventQueue;
32 class CRobotMain;
33 class CScript;
34 class CSoundInterface;
35 
36 namespace Gfx {
37 class CEngine;
38 class CCamera;
39 };
40 
41 namespace Ui {
42 
43 class CEdit;
44 class CInterface;
45 
46 enum StudioDialog
47 {
48  SD_NULL,
49  SD_OPEN,
50  SD_SAVE,
51  SD_FIND,
52  SD_REPLACE,
53 };
54 
55 
56 
57 class CStudio
58 {
59 public:
60  CStudio();
61  ~CStudio();
62 
63  bool EventProcess(const Event &event);
64 
65  void StartEditScript(CScript *script, std::string name, int rank);
66  bool StopEditScript(bool bCancel);
67 
68 protected:
69  bool EventFrame(const Event &event);
70  void SearchToken(CEdit* edit);
71  void ColorizeScript(CEdit* edit);
72  void AdjustEditScript();
73  void SetInfoText(std::string text, bool bClickable);
74  void ViewEditScript();
75  void UpdateFlux();
76  void UpdateButtons();
77 
78  void StartDialog(StudioDialog type);
79  void StopDialog();
80  void AdjustDialog();
81  bool EventDialog(const Event &event);
82  void UpdateChangeList();
83  void UpdateChangeEdit();
84  void UpdateDialogAction();
85  void UpdateDialogPublic();
86  void UpdateDialogList();
87  std::string SearchDirectory(bool bCreate);
88  bool ReadProgram();
89  bool WriteProgram();
90 
91 protected:
92  Gfx::CEngine* m_engine;
93  CEventQueue* m_event;
94  CRobotMain* m_main;
95  Gfx::CCamera* m_camera;
96  CSoundInterface* m_sound;
97  CInterface* m_interface;
98  CApplication* m_app;
99 
100  int m_rank;
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  bool m_bInitPause;
117  std::string m_helpFilename;
118 
119  StudioDialog m_dialog;
120 };
121 
122 
123 } // namespace Ui
124 
CameraType
Type of camera.
Definition: camera.h:42
Camera handling - CCamera class.
Global event queue.
Definition: event.h:765
Definition: robotmain.h:191
2D point
Definition: point.h:46
Main application.
Definition: app.h:200
Camera moving in 3D scene.
Definition: camera.h:130
The graphics engine.
Definition: engine.h:681
Event types, structs and event queue.
Definition: script.h:50
Definition: edit.h:129
Event sent by system, interface or game.
Definition: event.h:687
Definition: interface.h:56
Sound plugin interface.
Definition: sound.h:149
Definition: studio.h:57