Skip to content

Commit 2863e5e

Browse files
authored
Make the OSARA Configuration dialog and its controls bigger so they aren't cut off visually. (#1106)
The width is now hard-coded to a larger value. Since the build system auto calculates the y coordinates for this dialog, we now use that information to auto calculate the height of the dialog too.
1 parent 500a781 commit 2863e5e

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

site_scons/makeConfigRc.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ def makeConfigRc(target, source, env):
1111
resourceH = open(source[0].path, "rt", encoding="UTF-8")
1212
for line in resourceH:
1313
if line.startswith("#define ID_CONFIG_DLG "):
14-
cid = int(line.strip().rsplit(" ")[-1])
14+
cid = dialogCid = int(line.strip().rsplit(" ")[-1])
1515
break
16-
out.write(
17-
"""#include <windows.h>
18-
{cid} DIALOGEX 250, 125, 185, 212
19-
CAPTION "OSARA Configuration"
20-
BEGIN
21-
""".format(cid=cid))
16+
lines = []
17+
lines.append("#include <windows.h>\n")
18+
# We can't generate the DIALOGEX header yet because we don't know the height
19+
# yet. Add a placeholder here and generate that below.
20+
lines.append(None)
21+
lines.append('\tCAPTION "OSARA Configuration"\n')
22+
lines.append('BEGIN\n')
2223
y = 6
2324
settingsH = open(source[1].path, "rt", encoding="UTF-8")
2425
setting = None
@@ -33,11 +34,14 @@ def makeConfigRc(target, source, env):
3334
continue # Setting is split across multiple lines.
3435
m = RE_BOOL_SETTING.match(setting)
3536
cid += 1
36-
out.write(
37-
'\tCONTROL {displayName}, {cid}, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, {y}, 200, 14\n'
38-
.format(displayName=m.group("displayName"), cid=cid, y=y))
37+
displayName = m.group("displayName")
38+
lines.append(
39+
f'\tCONTROL {displayName}, {cid}, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, {y}, 390, 14\n')
3940
y += 20
40-
out.write('\tDEFPUSHBUTTON "OK", IDOK, 10, {y}, 30, 14\n'
41-
'\tPUSHBUTTON "Cancel", IDCANCEL, 137, {y}, 40, 14\n'
42-
.format(y=y))
43-
out.write('END\n')
41+
lines.append(f'\tDEFPUSHBUTTON "OK", IDOK, 10, {y}, 30, 14\n'
42+
f'\tPUSHBUTTON "Cancel", IDCANCEL, 137, {y}, 40, 14\n')
43+
y += 20
44+
# We know the height now. Generate the DIALOGEX header.
45+
lines[1] = f"{dialogCid} DIALOGEX 250, 125, 400, {y}\n"
46+
lines.append('END\n')
47+
out.writelines(lines)

0 commit comments

Comments
 (0)