Text no longer jitters
[Mograsim.git] / net.mograsim.preferences / src / net / mograsim / preferences / DefaultPreferences.java
1 package net.mograsim.preferences;
2
3 import net.mograsim.preferences.ColorDefinition.BuiltInColor;
4
5 public class DefaultPreferences extends Preferences
6 {
7         @Override
8         public boolean getBoolean(String name)
9         {
10                 switch (name)
11                 {
12                 case "net.mograsim.logic.model.improvetext":
13                         return true;
14                 default:
15                         throw new IllegalArgumentException("Unknown boolean preference name: " + name);
16                 }
17         }
18
19         @Override
20         public int getInt(String name)
21         {
22                 switch (name)
23                 {
24                 default:
25                         throw new IllegalArgumentException("Unknown int preference name: " + name);
26                 }
27         }
28
29         @Override
30         public double getDouble(String name)
31         {
32                 switch (name)
33                 {
34                 case "net.mograsim.logic.model.linewidth":
35                         return 0.5;
36                 default:
37                         throw new IllegalArgumentException("Unknown double preference name: " + name);
38                 }
39         }
40
41         @Override
42         public ColorDefinition getColorDefinition(String name)
43         {
44                 switch (name)
45                 {
46                 case "net.mograsim.logic.model.color.bit.one":
47                         return new ColorDefinition(BuiltInColor.COLOR_GREEN);
48                 case "net.mograsim.logic.model.color.bit.u":
49                         return new ColorDefinition(BuiltInColor.COLOR_CYAN);
50                 case "net.mograsim.logic.model.color.bit.x":
51                         return new ColorDefinition(BuiltInColor.COLOR_RED);
52                 case "net.mograsim.logic.model.color.bit.z":
53                         return new ColorDefinition(BuiltInColor.COLOR_YELLOW);
54                 case "net.mograsim.logic.model.color.bit.zero":
55                         return new ColorDefinition(BuiltInColor.COLOR_GRAY);
56                 case "net.mograsim.logic.model.color.background":
57                         return new ColorDefinition(BuiltInColor.COLOR_WHITE);
58                 case "net.mograsim.logic.model.color.foreground":
59                         return new ColorDefinition(BuiltInColor.COLOR_BLACK);
60                 case "net.mograsim.logic.model.color.text":
61                         return new ColorDefinition(BuiltInColor.COLOR_BLACK);
62                 default:
63                         throw new IllegalArgumentException("Unknown color preference name: " + name);
64                 }
65         }
66 }