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 "app/pausemanager.h"
26 
27 #include <boost/filesystem.hpp>
28 
29 namespace fs = boost::filesystem;
30 
31 #include <string>
32 
33 class CEventQueue;
34 class CRobotMain;
35 class CScript;
36 class CSoundInterface;
37 
38 namespace Gfx {
39 class CEngine;
40 class CCamera;
41 };
42 
43 namespace Ui {
44 
45 class CEdit;
46 class CInterface;
47 
48 enum StudioDialog
49 {
50  SD_NULL,
51  SD_OPEN,
52  SD_SAVE,
53  SD_FIND,
54  SD_REPLACE,
55 };
56 
57 
58 
59 class CStudio
60 {
61 public:
62  CStudio();
63  ~CStudio();
64 
65  bool EventProcess(const Event &event);
66 
67  void StartEditScript(CScript *script, std::string name, int rank);
68  bool StopEditScript(bool bCancel);
69 
70 protected:
71  bool EventFrame(const Event &event);
72  void SearchToken(CEdit* edit);
73  void ColorizeScript(CEdit* edit);
74  void AdjustEditScript();
75  void SetInfoText(std::string text, bool bClickable);
76  void ViewEditScript();
77  void UpdateFlux();
78  void UpdateButtons();
79 
80  void StartDialog(StudioDialog type);
81  void StopDialog();
82  void AdjustDialog();
83  bool EventDialog(const Event &event);
84  void UpdateChangeList();
85  void UpdateChangeEdit();
86  void UpdateDialogAction();
87  void UpdateDialogPublic();
88  void UpdateDialogList();
89  std::string SearchDirectory(bool bCreate);
90  bool ReadProgram();
91  bool WriteProgram();
92 
93 protected:
94  Gfx::CEngine* m_engine;
95  CEventQueue* m_event;
96  CRobotMain* m_main;
97  Gfx::CCamera* m_camera;
98  CSoundInterface* m_sound;
99  CInterface* m_interface;
100  CApplication* m_app;
101  CPauseManager* m_pause;
102 
103  int m_rank;
104  CScript* m_script;
105  Gfx::CameraType m_editCamera;
106 
107  bool m_bEditMaximized;
108  bool m_bEditMinimized;
109 
110  Math::Point m_editActualPos;
111  Math::Point m_editActualDim;
112  Math::Point m_editFinalPos;
113  Math::Point m_editFinalDim;
114 
115  float m_time;
116  float m_fixInfoTextTime;
117  bool m_bRunning;
118  bool m_bRealTime;
119  PauseType m_bInitPause;
120  std::string m_helpFilename;
121 
122  StudioDialog m_dialog;
123 };
124 
125 
126 } // namespace Ui
127