8 public class Preferences
10 [Widget
] Window PreferencesWindow
;
11 [Widget
] Button CloseButton
;
14 [Widget
] CheckButton RoundButton
;
15 [Widget
] CheckButton InnerPathButton
;
16 [Widget
] CheckButton GradientButton
;
17 [Widget
] CheckButton SmoothConnectionsButton
;
18 [Widget
] CheckButton AntialiasingButton
;
20 [Widget
] CheckButton ChangeBackgroundButton
;
21 [Widget
] Label RedLabel
;
22 [Widget
] Label GreenLabel
;
23 [Widget
] Label BlueLabel
;
24 [Widget
] Label AlphaLabel
;
25 [Widget
] Scale RedSlider
;
26 [Widget
] Scale GreenSlider
;
27 [Widget
] Scale BlueSlider
;
28 [Widget
] Scale AlphaSlider
;
31 [Widget
] SpinButton ThreadSpin
;
32 [Widget
] CheckButton BlockThreadButton
;
36 Glade
.XML gxml
= new Glade
.XML("Preferences.glade", "PreferencesWindow");
37 gxml
.BindFields(this);
39 PreferencesWindow
.IconList
= new Gdk
.Pixbuf
[2] {new Gdk.Pixbuf(null, "preferences-desktop-48.png"), new Gdk.Pixbuf(null, "preferences-desktop.png")}
;
41 PreferencesWindow
.DeleteEvent
+= CloseWindow
;
42 CloseButton
.Clicked
+= CloseWindow
;
44 RoundButton
.Active
= Config
.Get("block/round", true);
45 RoundButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/round", RoundButton.Active); }
;
47 InnerPathButton
.Active
= Config
.Get("block/innerpath", true);
48 InnerPathButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/innerpath", InnerPathButton.Active); }
;
50 GradientButton
.Active
= Config
.Get("block/gradient", true);
51 GradientButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/gradient", GradientButton.Active); }
;
53 SmoothConnectionsButton
.Active
= Config
.Get("block/smoothconnections", true);
54 SmoothConnectionsButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/smoothconnections", SmoothConnectionsButton.Active); }
;
56 AntialiasingButton
.Active
= Config
.Get("schematic/antialias", true);
57 AntialiasingButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/antialias", AntialiasingButton.Active); }
;
59 ThreadSpin
.Value
= Config
.Get("engine/threads", 1);
60 ThreadSpin
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("engine/threads", ThreadSpin.ValueAsInt); }
;
62 BlockThreadButton
.Active
= Config
.Get("engine/blockthreads", false);
63 BlockThreadButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("engine/blockthreads", BlockThreadButton.Active); }
;
65 ChangeBackgroundButton
.Active
= Config
.Get("schematic/changebackground", false);
66 SetBackgroundControlsStatus(ChangeBackgroundButton
.Active
);
67 ChangeBackgroundButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/changebackground", ChangeBackgroundButton.Active); SetBackgroundControlsStatus(ChangeBackgroundButton.Active); }
;
69 RedSlider
.Value
= Config
.Get("schematic/red", 128);
70 RedSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/red", (int)RedSlider.Value); }
;
72 GreenSlider
.Value
= Config
.Get("schematic/green", 128);
73 GreenSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/green", (int)GreenSlider.Value); }
;
75 BlueSlider
.Value
= Config
.Get("schematic/blue", 128);
76 BlueSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/blue", (int)BlueSlider.Value); }
;
78 AlphaSlider
.Value
= Config
.Get("schematic/alpha", 255);
79 AlphaSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/alpha", (int)AlphaSlider.Value); }
;
82 PreferencesWindow
.ShowAll();
85 private void CloseWindow(object o
, EventArgs args
)
87 PreferencesWindow
.Destroy();
90 private void SetBackgroundControlsStatus(bool status
)
92 RedLabel
.Sensitive
= status
;
93 GreenLabel
.Sensitive
= status
;
94 BlueLabel
.Sensitive
= status
;
96 RedSlider
.Sensitive
= status
;
97 GreenSlider
.Sensitive
= status
;
98 BlueSlider
.Sensitive
= status
;
100 if(MainWindow
.HaveAlpha
)
102 AlphaLabel
.Sensitive
= status
;
103 AlphaSlider
.Sensitive
= status
;
107 AlphaLabel
.Sensitive
= false;
108 AlphaSlider
.Sensitive
= false;