Project

General

Profile

TH3-Color themes » History » Version 2

Wil van Antwerpen, 06/03/2019 01:53 PM

1 1 Wil van Antwerpen
# Color themes
2
3
The Hammer comes with the following default color themes:
4
5
* White
6
* Black
7
* Blue
8
* Lime
9
* Sahara
10
* Serene
11
12
In order to select a different theme you go in the menu to: File -> Hammer Options -> Editor tab page -> Colorer
13
You can select from the predefined color schemes via the Color Scheme name comboform
14
15
It is also possible to create your own theme and save it under your own name. For this use the "New" button.
16
17
## Adding a custom theme as a new default
18
19
If you created your own theme and you like it a lot then we would love to add it as another default theme to the list.
20
21 2 Wil van Antwerpen
Below are the steps needed to do so yourself. They are also notes for us :) 
22
23
### Locate your new theme details
24 1 Wil van Antwerpen
When you create a theme or customize it, the details for that theme are saved in the Hammer configuration file which can be found under the Hammer\Data folder.
25
The filename is CODEMAXEDIT<username>.ini where username is your windows login name. 
26
If your windows login is "John" then the filename will be CODEMAXEDITJohn.ini
27
28
Open that file and search for a line that starts with "PSCOLOR,"
29
30 2 Wil van Antwerpen
Copy the text after "PCSCOLOR," from that line.
31 1 Wil van Antwerpen
32 2 Wil van Antwerpen
### Change the Hammer source to include the new theme
33
34 1 Wil van Antwerpen
Now in the Hammer source files look for a file Hammer\Pkg\THColorer.h and search for the following line:
35
36
~~~
37
Define TH_DEFSCHEMA_SAHARA_STR  for "Default (Sahara)"
38
~~~
39
40
You can add your own code name for the new theme there, in a new line underneath, let's call our new theme "DEMO", so that it looks like this:
41
42
~~~
43
Define TH_DEFSCHEMA_SAHARA_STR  for "Default (Sahara)"
44
Define TH_DEFSCHEMA_DEMO_STR  for "Default (Demo)"
45
~~~
46
47
Then look for the actual theme data a few lines down:
48
49
~~~
50
Define TH_COLORSCHEMA_SAHARA    for "255255187000220225240000255255255255255255187000000000000000255255187000255000255000255255187000000000255000255255187000255000000000255255187000000000255000255255187000000128000000255255187000255000128000255255187000000128128000255255187000255000000000255255187000000000255000255255187000128000000000255255187000105105105000190200225000255255255255192192192000220225240000128128128000255215215000000000000000200225255000255255000000255035035000000128128000255255187000170195240000215107000000255255187000000,000000000000000000000000000000000000000000000001000000"
51
~~~
52
53
and copy the line of data from your config file in there like so:
54
55
~~~
56
Define TH_COLORSCHEMA_SAHARA    for "255255187000220225240000255255255255255255187000000000000000255255187000255000255000255255187000000000255000255255187000255000000000255255187000000000255000255255187000000128000000255255187000255000128000255255187000000128128000255255187000255000000000255255187000000000255000255255187000128000000000255255187000105105105000190200225000255255255255192192192000220225240000128128128000255215215000000000000000200225255000255255000000255035035000000128128000255255187000170195240000215107000000255255187000000,000000000000000000000000000000000000000000000001000000"
57
Define TH_COLORSCHEMA_DEMO      for "025025025000120120120000255255255255255255255255255255255000025025025000255185255000025025025000140215240000025025025000255108108000025025025000140215240000025025025000187255187000025025025000192192192000025025025000000128128000255255255255255000000000255255255255000000255000255255255255128000000000255255255255192192192000080080080000255255255255192192192000105105105000090090090000255215215000000000000000200225255000255255000000255000000000202255255000025025025000000000170000255190120000025025025000000"
58
~~~
59
60 2 Wil van Antwerpen
As you see our demo theme is shorter. This is fine, it just means that we didn't set a custom font.
61
62
Adding the new defaults to the header file is the first step, next up is adding this new theme to the UI.
63 1 Wil van Antwerpen
64
For that go to file Hammer\AppSrc\Tools\THParameters.dg
65
66
In Object oSchemaSelect, procedure Combo_Fill_List
67
68
Under line:
69
70
~~~
71
  Send Combo_Add_Item TH_DEFSCHEMA_SAHARA_STR
72
~~~
73
74
add the new theme:
75
76
~~~
77
  Send Combo_Add_Item TH_DEFSCHEMA_SAHARA_STR
78
  Send Combo_Add_Item TH_DEFSCHEMA_DEMO_STR
79
~~~
80
81
also Object oSchemaSelect, procedure OnChange
82
83
Under line:
84
85
~~~
86
  Else If (sName=TH_DEFSCHEMA_SAHARA_STR) Move TH_COLORSCHEMA_SAHARA   To sSchema
87
~~~
88
89
add your new theme
90
91
~~~
92
  Else If (sName=TH_DEFSCHEMA_SAHARA_STR) Move TH_COLORSCHEMA_SAHARA   To sSchema
93
  Else If (sName=TH_DEFSCHEMA_DEMO_STR) Move TH_COLORSCHEMA_DEMO   To sSchema
94
~~~
95
96
same method, but a few lines down:
97
98
~~~
99
                                    Move (not((sName=TH_DEFSCHEMA_BLACK_STR) or ;
100
                                              (sName=TH_DEFSCHEMA_WHITE_STR) or ;
101
                                              (sName=TH_DEFSCHEMA_BLUE_STR)  or ;
102
                                              (sName=TH_DEFSCHEMA_SERENE_STR) or ;
103
                                              (sName=TH_DEFSCHEMA_SAHARA_STR) or ;
104
                                              (sName=TH_DEFSCHEMA_LIME_STR))) ;
105
                                                                        to iDisableManageButtons
106
~~~
107
108
change into:
109
110
~~~
111
                                    Move (not((sName=TH_DEFSCHEMA_BLACK_STR) or ;
112
                                              (sName=TH_DEFSCHEMA_WHITE_STR) or ;
113
                                              (sName=TH_DEFSCHEMA_BLUE_STR)  or ;
114
                                              (sName=TH_DEFSCHEMA_SERENE_STR) or ;
115
                                              (sName=TH_DEFSCHEMA_SAHARA_STR) or ;
116
                                              (sName=TH_DEFSCHEMA_DEMO_STR) or ;
117
                                              (sName=TH_DEFSCHEMA_LIME_STR))) ;
118
                                                                        to iDisableManageButtons
119
~~~
120
121
Then in oSchemaDelete,  procedure onClick
122
123
~~~
124
 If (sName=TH_DEFSCHEMA_BLACK_STR or sName=TH_DEFSCHEMA_WHITE_STR or sName=TH_DEFSCHEMA_BLUE_STR or sName=TH_DEFSCHEMA_LIME_STR or sName=TH_DEFSCHEMA_SERENE_STR or sName=TH_DEFSCHEMA_SAHARA_STR) Begin
125
~~~
126
127
add your theme:
128
129
~~~
130
 If (sName=TH_DEFSCHEMA_BLACK_STR or sName=TH_DEFSCHEMA_WHITE_STR or sName=TH_DEFSCHEMA_BLUE_STR or sName=TH_DEFSCHEMA_LIME_STR or sName=TH_DEFSCHEMA_SERENE_STR or sName=TH_DEFSCHEMA_SAHARA_STR or sName=TH_DEFSCHEMA_DEMO_STR) Begin
131
~~~
132
133
Next in oSchemaDefault button, procedure onClick
134
135
add under line:
136
137
~~~
138
  Else If (sName=TH_DEFSCHEMA_SAHARA_STR) Move TH_COLORSCHEMA_SAHARA To sColors
139
~~~
140
141
your own colors:
142
143
~~~
144
  Else If (sName=TH_DEFSCHEMA_SAHARA_STR) Move TH_COLORSCHEMA_SAHARA To sColors
145
  Else If (sName=TH_DEFSCHEMA_DEMO_STR) Move TH_COLORSCHEMA_DEMO To sColors
146
~~~
147
148
And finally in Procedure SaveEntries:
149
150
locate this part:
151
152
~~~
153
  If ((sSchemaName<>TH_DEFSCHEMA_BLACK_STR) and ;
154
    (sSchemaName<>TH_DEFSCHEMA_WHITE_STR) and ;
155
    (sSchemaName<>TH_DEFSCHEMA_BLUE_STR)  and ;
156
    (sSchemaName<>TH_DEFSCHEMA_SERENE_STR) and ;
157
    (sSchemaName<>TH_DEFSCHEMA_SAHARA_STR) and ;
158
    (sSchemaName<>TH_DEFSCHEMA_LIME_STR)) Begin
159
~~~
160
161
and add your own:
162
163
~~~
164
  If ((sSchemaName<>TH_DEFSCHEMA_BLACK_STR) and ;
165
    (sSchemaName<>TH_DEFSCHEMA_WHITE_STR) and ;
166
    (sSchemaName<>TH_DEFSCHEMA_BLUE_STR)  and ;
167
    (sSchemaName<>TH_DEFSCHEMA_SERENE_STR) and ;
168
    (sSchemaName<>TH_DEFSCHEMA_SAHARA_STR) and ;
169
    (sSchemaName<>TH_DEFSCHEMA_DEMO_STR) and ;
170
    (sSchemaName<>TH_DEFSCHEMA_LIME_STR)) Begin
171
~~~
172
173
Congratulations!
174
If you now close the Hammer and recompile your new color theme should show up and you can select it as a default theme.