]> gitweb @ CieloNegro.org - task-reporter.git/blob - src/main/scala/jp/ymir/taskReporter/Preferences.scala
wip
[task-reporter.git] / src / main / scala / jp / ymir / taskReporter / Preferences.scala
1 package jp.ymir.taskReporter;
2 import java.awt.Dimension
3 import java.io._
4 import sbinary._
5 import sbinary.DefaultProtocol._
6 import sbinary.Operations._
7 import preferscala._
8
9 object AWTProtocol extends DefaultProtocol {
10   implicit object DimensionFormat extends Format[Dimension] {
11     def reads(in: Input) = read[(Int, Int)](in) match {
12       case (width, height) =>
13         new Dimension(width, height)
14     }
15     def writes(out: Output, value: Dimension) =
16       write[(Int, Int)](out, (value.width, value.height))
17   }
18 }
19
20 object Preferences extends PackageGroup(PreferenceType.User) {
21   import AWTProtocol._
22
23   val lookAndFeel =
24     new Preference("ui/lookAndFeel", "javax.swing.plaf.metal.MetalLookAndFeel");
25
26   val mainFrameSize =
27     new Preference("ui/MainFrame/size", new Dimension(640, 480));
28
29   val lastChosenDir =
30     new Preference("ui/lastChosenDir", new File(System.getProperty("user.dir")))
31 }