ide/licensing; documentor/SettingsDialog: clientSize fixes
[sdk] / documentor / src / SettingsDialog.ec
1 import "ecere"
2 import "Documentor"
3
4 class SettingsDialog : Window
5 {
6    text = $"Settings";
7    background = activeBorder;
8    borderStyle = fixed;
9    hasMaximize = true;
10    hasMinimize = true;
11    hasClose = true;
12    tabCycle = true;
13    clientSize = { 436, 92 };
14    anchor = { horz = -83, vert = -104 };
15
16    Label docLabel { this, text = $"Documentation Path:", anchor = { left = 16, top = 16 }, labeledWindow = pathEditBox };
17
18    Button browseBtn
19    {
20       this, text = "...", font = { $"Tahoma", 8.25f, bold = true }, hotKey = f2;
21       anchor = { right = 20, top = 16 };
22       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
23       {
24          if(settingsFileDialog.Modal() == ok) // open the file dialog box, and wait for confirmation that all is okay.
25          {
26             pathEditBox.contents = settingsFileDialog.filePath; // display the selected directory in the edit box
27          }
28          return true;
29       }
30    };
31
32    FileDialog settingsFileDialog
33    {
34       type = selectDir, text = $"Select a path"; // set the file dialog box to choose a directory instead of a file.
35    };
36
37    Button saveBtn
38    {
39       this, text = $"Save", size = { 68, 21 }, position = { 224, 56 }, isDefault = true;
40
41       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
42       {
43          settings.docDir = pathEditBox.contents; // Store the path entered into the edit box
44          settingsContainer.Save(); // write that path to the ini file
45          Destroy(DialogResult::ok); // close the window
46          return true;
47       }
48    };
49
50    Button cancelBtn
51    {
52       this, text = $"Cancel", size = { 68, 21 }, position = { 304, 56 }, hotKey = escape;
53
54       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
55       {
56          Destroy(DialogResult::cancel); // close the window without making any changes
57          return true;
58       }
59    };
60    EditBox pathEditBox { this, size = { 214, 19 }, contents = settings.docDir, anchor = { right = 41, top = 16 } };
61 }