OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ToolsDlg.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Drawing tools dialog for landscape editing in console mode */
19 
20 #ifndef INC_C4ToolsDlg
21 #define INC_C4ToolsDlg
22 
23 
24 #include "config/C4Constants.h"
25 #include "landscape/C4Landscape.h"
26 
27 const int32_t
33 
34 const int32_t
38 
39 #define C4TLS_MatSky "Sky"
40 
41 enum class LandscapeMode;
43 {
44  friend class C4ConsoleGUI;
45  private:
46  class State;
47  State *state;
48 public:
49  C4ToolsDlg();
50  ~C4ToolsDlg();
51 public:
52  bool Active;
53  int32_t Tool, SelectedTool;
54  int32_t Grade;
55  bool ModeIFT;
58  bool ModeBack; // If true, IFT is ignored and background material/texture is always used
61 public:
62  void Default();
63  void Clear();
64  bool PopTextures();
65  bool PopMaterial();
66  bool ChangeGrade(int32_t iChange);
67  void NeedPreviewUpdate();
68  bool Open();
69  bool SetGrade(int32_t iGrade);
70  bool SetTool(int32_t iTool, bool fTemp);
71  bool ToggleTool() { return !!SetTool((Tool+1)%4, false); }
72  bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false);
73  bool SetIFT(bool fIFT);
74  bool ToggleIFT() { return !!SetIFT(!ModeIFT); }
75  bool SelectTexture(const char *szTexture, bool by_console_gui=false);
76  bool SelectMaterial(const char *szMaterial, bool by_console_gui = false);
77  bool SelectBackTexture(const char *szTexture, bool by_console_gui = false);
78  bool SelectBackMaterial(const char *szMaterial, bool by_console_gui = false);
79  void SetAlternateTool();
80  void ResetAlternateTool();
81  bool IsGradedTool() const { return Tool == C4TLS_Brush || Tool == C4TLS_Line || Tool == C4TLS_Fill; } // return whether Grade measure affects selected tool
82 protected:
83  void AssertValidTexture();
85  void LoadBitmaps();
86  void EnableControls();
87  void UpdateIFTControls();
88  void InitGradeCtrl();
89  void InitMaterialCtrls();
90  void UpdateToolCtrls();
91  void UpdateTextures();
92  void SetColorPattern(const char *szMaterial, const char *szTexture);
93 public:
95  void SetTexture(const char *szTexture);
96  void SetMaterial(const char *szMaterial);
97  void SetBackTexture(const char *szTexture);
98  void SetBackMaterial(const char *szMaterial);
99 };
100 
101 #endif //INC_C4ToolsDlg
bool ToggleTool()
Definition: C4ToolsDlg.h:71
bool SetGrade(int32_t iGrade)
Definition: C4ToolsDlg.cpp:166
bool PopMaterial()
Definition: C4Console.cpp:703
void SetColorPattern(const char *szMaterial, const char *szTexture)
Definition: C4ToolsDlg.cpp:162
void SetAlternateTool()
Definition: C4ToolsDlg.cpp:284
void AssertValidTexture()
Definition: C4ToolsDlg.cpp:216
void SetTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:71
void InitMaterialCtrls()
Definition: C4ToolsDlg.cpp:52
bool Active
Definition: C4ToolsDlg.h:52
const int32_t C4TLS_Rect
Definition: C4ToolsDlg.h:30
const int C4M_MaxName
Definition: C4Constants.h:49
int32_t Grade
Definition: C4ToolsDlg.h:54
bool IsGradedTool() const
Definition: C4ToolsDlg.h:81
char Texture[C4M_MaxName+1]
Definition: C4ToolsDlg.h:57
const int32_t C4TLS_Picker
Definition: C4ToolsDlg.h:32
void AssertValidBackTexture()
Definition: C4ToolsDlg.cpp:236
bool SetIFT(bool fIFT)
Definition: C4ToolsDlg.cpp:131
void ResetAlternateTool()
Definition: C4ToolsDlg.cpp:290
char Material[C4M_MaxName+1]
Definition: C4ToolsDlg.h:56
const int32_t C4TLS_GradeMin
Definition: C4ToolsDlg.h:36
const int32_t C4TLS_GradeMax
Definition: C4ToolsDlg.h:35
void SetBackMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:106
void InitGradeCtrl()
Definition: C4Console.cpp:701
void UpdateIFTControls()
Definition: C4Console.cpp:705
bool SelectBackTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:270
bool ModeBack
Definition: C4ToolsDlg.h:58
bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false)
Definition: C4ToolsDlg.cpp:181
LandscapeMode
Definition: C4Landscape.h:29
void NeedPreviewUpdate()
Definition: C4Console.cpp:702
bool SelectBackMaterial(const char *szMaterial, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:277
const int32_t C4TLS_Brush
Definition: C4ToolsDlg.h:28
void SetBackTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:116
void UpdateToolCtrls()
Definition: C4Console.cpp:708
const int32_t C4TLS_Fill
Definition: C4ToolsDlg.h:31
void UpdateLandscapeModeCtrls()
Definition: C4Console.cpp:706
bool PopTextures()
Definition: C4Console.cpp:704
char BackMaterial[C4M_MaxName+1]
Definition: C4ToolsDlg.h:59
const int32_t C4TLS_GradeDefault
Definition: C4ToolsDlg.h:37
bool ToggleIFT()
Definition: C4ToolsDlg.h:74
bool Open()
Definition: C4ToolsDlg.cpp:28
bool SelectMaterial(const char *szMaterial, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:263
int32_t SelectedTool
Definition: C4ToolsDlg.h:53
bool ChangeGrade(int32_t iChange)
Definition: C4ToolsDlg.cpp:173
bool SelectTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:256
char BackTexture[C4M_MaxName+1]
Definition: C4ToolsDlg.h:60
const int32_t C4TLS_Line
Definition: C4ToolsDlg.h:29
bool SetTool(int32_t iTool, bool fTemp)
Definition: C4ToolsDlg.cpp:43
void LoadBitmaps()
void SetMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:60
void UpdateTextures()
Definition: C4Console.cpp:707
int32_t Tool
Definition: C4ToolsDlg.h:53
bool ModeIFT
Definition: C4ToolsDlg.h:55
void EnableControls()
Definition: C4Console.cpp:700