All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Go to the documentation of this file.
1 /*
2  * OpenClonk,
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH,
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  */
18 /* Drawing tools dialog for landscape editing in console mode */
20 #ifndef INC_C4ToolsDlg
21 #define INC_C4ToolsDlg
24 #include "config/C4Constants.h"
25 #include "landscape/C4Landscape.h"
27 const int32_t
34 const int32_t
39 #define C4TLS_MatSky "Sky"
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 };
101 #endif //INC_C4ToolsDlg
bool ToggleTool()
Definition: C4ToolsDlg.h:71
bool SetGrade(int32_t iGrade)
Definition: C4ToolsDlg.cpp:165
bool PopMaterial()
Definition: C4Console.cpp:708
void SetColorPattern(const char *szMaterial, const char *szTexture)
Definition: C4ToolsDlg.cpp:161
void SetAlternateTool()
Definition: C4ToolsDlg.cpp:283
void AssertValidTexture()
Definition: C4ToolsDlg.cpp:215
void SetTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:70
void InitMaterialCtrls()
Definition: C4ToolsDlg.cpp:51
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:235
bool SetIFT(bool fIFT)
Definition: C4ToolsDlg.cpp:130
void ResetAlternateTool()
Definition: C4ToolsDlg.cpp:289
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:105
void InitGradeCtrl()
Definition: C4Console.cpp:706
void UpdateIFTControls()
Definition: C4Console.cpp:710
bool SelectBackTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:269
bool ModeBack
Definition: C4ToolsDlg.h:58
bool SetLandscapeMode(LandscapeMode iMode, bool flat_chunk_shapes, bool fThroughControl=false)
Definition: C4ToolsDlg.cpp:180
Definition: C4Landscape.h:30
void NeedPreviewUpdate()
Definition: C4Console.cpp:707
bool SelectBackMaterial(const char *szMaterial, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:276
const int32_t C4TLS_Brush
Definition: C4ToolsDlg.h:28
void SetBackTexture(const char *szTexture)
Definition: C4ToolsDlg.cpp:115
void UpdateToolCtrls()
Definition: C4Console.cpp:713
const int32_t C4TLS_Fill
Definition: C4ToolsDlg.h:31
void UpdateLandscapeModeCtrls()
Definition: C4Console.cpp:711
bool PopTextures()
Definition: C4Console.cpp:709
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:27
bool SelectMaterial(const char *szMaterial, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:262
int32_t SelectedTool
Definition: C4ToolsDlg.h:53
bool ChangeGrade(int32_t iChange)
Definition: C4ToolsDlg.cpp:172
bool SelectTexture(const char *szTexture, bool by_console_gui=false)
Definition: C4ToolsDlg.cpp:255
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:42
void LoadBitmaps()
void SetMaterial(const char *szMaterial)
Definition: C4ToolsDlg.cpp:59
void UpdateTextures()
Definition: C4Console.cpp:712
int32_t Tool
Definition: C4ToolsDlg.h:53
bool ModeIFT
Definition: C4ToolsDlg.h:55
void EnableControls()
Definition: C4Console.cpp:705