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
;
19 [Widget
] CheckButton ProgressButton
;
21 [Widget
] CheckButton ChangeBackgroundButton
;
22 [Widget
] Label RedLabel
;
23 [Widget
] Label GreenLabel
;
24 [Widget
] Label BlueLabel
;
25 [Widget
] Label AlphaLabel
;
26 [Widget
] Scale RedSlider
;
27 [Widget
] Scale GreenSlider
;
28 [Widget
] Scale BlueSlider
;
29 [Widget
] Scale AlphaSlider
;
32 [Widget
] SpinButton ThreadSpin
;
33 [Widget
] CheckButton BlockThreadButton
;
37 Glade
.XML gxml
= new Glade
.XML("Preferences.glade", "PreferencesWindow");
38 gxml
.BindFields(this);
40 PreferencesWindow
.IconList
= new Gdk
.Pixbuf
[2] {new Gdk.Pixbuf(null, "preferences-desktop-48.png"), new Gdk.Pixbuf(null, "preferences-desktop.png")}
;
42 PreferencesWindow
.DeleteEvent
+= CloseWindow
;
43 CloseButton
.Clicked
+= CloseWindow
;
45 RoundButton
.Active
= Config
.Get("block/round", true);
46 RoundButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/round", RoundButton.Active); }
;
48 InnerPathButton
.Active
= Config
.Get("block/innerpath", true);
49 InnerPathButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/innerpath", InnerPathButton.Active); }
;
51 GradientButton
.Active
= Config
.Get("block/gradient", true);
52 GradientButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/gradient", GradientButton.Active); }
;
54 SmoothConnectionsButton
.Active
= Config
.Get("block/smoothconnections", true);
55 SmoothConnectionsButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/smoothconnections", SmoothConnectionsButton.Active); }
;
57 AntialiasingButton
.Active
= Config
.Get("schematic/antialias", true);
58 AntialiasingButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/antialias", AntialiasingButton.Active); }
;
60 ProgressButton
.Active
= Config
.Get("block/progress", true);
61 ProgressButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("block/progress", ProgressButton.Active); }
;
63 ThreadSpin
.Value
= Config
.Get("engine/threads", 1);
64 ThreadSpin
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("engine/threads", ThreadSpin.ValueAsInt); }
;
66 BlockThreadButton
.Active
= Config
.Get("engine/blockthreads", false);
67 BlockThreadButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("engine/blockthreads", BlockThreadButton.Active); }
;
69 ChangeBackgroundButton
.Active
= Config
.Get("schematic/changebackground", false);
70 SetBackgroundControlsStatus(ChangeBackgroundButton
.Active
);
71 ChangeBackgroundButton
.Toggled
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/changebackground", ChangeBackgroundButton.Active); SetBackgroundControlsStatus(ChangeBackgroundButton.Active); }
;
73 RedSlider
.Value
= Config
.Get("schematic/red", 128);
74 RedSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/red", (int)RedSlider.Value); }
;
76 GreenSlider
.Value
= Config
.Get("schematic/green", 128);
77 GreenSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/green", (int)GreenSlider.Value); }
;
79 BlueSlider
.Value
= Config
.Get("schematic/blue", 128);
80 BlueSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/blue", (int)BlueSlider.Value); }
;
82 AlphaSlider
.Value
= Config
.Get("schematic/alpha", 255);
83 AlphaSlider
.ValueChanged
+= delegate(object o
, EventArgs args
) { Config.Set("schematic/alpha", (int)AlphaSlider.Value); }
;
86 PreferencesWindow
.ShowAll();
89 private void CloseWindow(object o
, EventArgs args
)
91 PreferencesWindow
.Destroy();
94 private void SetBackgroundControlsStatus(bool status
)
96 RedLabel
.Sensitive
= status
;
97 GreenLabel
.Sensitive
= status
;
98 BlueLabel
.Sensitive
= status
;
100 RedSlider
.Sensitive
= status
;
101 GreenSlider
.Sensitive
= status
;
102 BlueSlider
.Sensitive
= status
;
104 if(MainWindow
.HaveAlpha
)
106 AlphaLabel
.Sensitive
= status
;
107 AlphaSlider
.Sensitive
= status
;
111 AlphaLabel
.Sensitive
= false;
112 AlphaSlider
.Sensitive
= false;