b6b5d334be745b68e12788e722a7d1c4a504d704
[sdk] / ide / src / dialogs / ActiveCompilerDialog.ec
1 import "IDESettings"
2
3 class ActiveCompilerDialog : Window
4 {
5    text = $"Active Compiler";
6    background = formColor;
7    borderStyle = fixed;
8    minClientSize = { 568, 40 };
9    hasClose = true;
10    tabCycle = true;
11    size = { 568, 40 };
12
13    IDESettings ideSettings;
14    String workspaceActiveCompiler;
15
16    Button ok
17    {
18       this, size = { 80 }, position = { 392, 8 };
19       text = $"OK", isDefault = true, id = DialogResult::ok;
20       NotifyClicked = ButtonCloseDialog;
21
22       /*bool NotifyClicked(Button button, int x, int y, Modifiers mods)
23       {
24          Destroy(DialogResult::ok);
25          return true;
26       }*/
27    };
28
29    Button cancel
30    {
31       this, size = { 80 }, position = { 480, 8 };
32       text = $"Cancel", hotKey = escape, id = DialogResult::cancel;
33       NotifyClicked = ButtonCloseDialog;
34    };
35
36    DropBox compilerDropBox
37    {
38       this, position = { 160, 8 }, size = { 220 };
39       text = $"Active Compiler", hotKey = altA;
40
41       bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
42       {
43          if(row)
44             workspaceActiveCompiler = row.string;
45          return true;
46       }
47    };
48    Label { this, position = { 20, 14 }, labeledWindow = compilerDropBox };
49
50    bool OnPostCreate()
51    {
52       for(compiler : ideSettings.compilerConfigs)
53       {
54          DataRow row = compilerDropBox.AddString(compiler.name);
55          if(workspaceActiveCompiler && !strcmp(compiler.name, workspaceActiveCompiler))
56             compilerDropBox.currentRow = row;
57       }
58       return true;
59    }
60 }