more scalable option-group;
authorwenzelm
Fri, 14 Sep 2012 12:29:02 +0200
changeset 49354 65c6a1d62dbc
parent 49353 023be49d7fb8
child 49355 7d1af0a6e797
more scalable option-group;
src/Tools/jEdit/src/Isabelle.props
src/Tools/jEdit/src/isabelle_options.scala
--- a/src/Tools/jEdit/src/Isabelle.props	Fri Sep 14 10:01:42 2012 +0200
+++ b/src/Tools/jEdit/src/Isabelle.props	Fri Sep 14 12:29:02 2012 +0200
@@ -20,9 +20,11 @@
 plugin.isabelle.jedit.Plugin.depend.4=plugin sidekick.SideKickPlugin 0.8
 
 #options
-plugin.isabelle.jedit.Plugin.option-pane=isabelle
-options.isabelle.label=Isabelle
-options.isabelle.code=new isabelle.jedit.Isabelle_Options();
+plugin.isabelle.jedit.Plugin.option-group=isabelle-general isabelle-rendering
+options.isabelle-general.label=General
+options.isabelle-general.code=new isabelle.jedit.Isabelle_Options1();
+options.isabelle-rendering.label=Rendering
+options.isabelle-rendering.code=new isabelle.jedit.Isabelle_Options2();
 
 #actions
 isabelle.check-buffer.label=Commence full proof checking of current buffer
--- a/src/Tools/jEdit/src/isabelle_options.scala	Fri Sep 14 10:01:42 2012 +0200
+++ b/src/Tools/jEdit/src/isabelle_options.scala	Fri Sep 14 12:29:02 2012 +0200
@@ -12,25 +12,9 @@
 import org.gjt.sp.jedit.{jEdit, AbstractOptionPane}
 
 
-class Isabelle_Options extends AbstractOptionPane("isabelle")
+abstract class Isabelle_Options(name: String) extends AbstractOptionPane(name)
 {
-  // FIXME avoid hard-wired stuff
-  private val relevant_options =
-    Set("jedit_logic", "jedit_auto_start", "jedit_font_scale", "jedit_tooltip_font_size",
-      "jedit_tooltip_margin", "jedit_tooltip_dismiss_delay", "editor_load_delay",
-      "editor_input_delay", "editor_output_delay", "editor_update_delay")
-
-  relevant_options.foreach(Isabelle.options.value.check_name _)
-
-  private val predefined =
-    Isabelle_Logic.logic_selector(false) ::
-      (for {
-        (name, opt) <- Isabelle.options.value.options.toList
-        // FIXME avoid hard-wired stuff
-        if (name.startsWith("color_") && opt.section == "Rendering of Document Content")
-      } yield Isabelle.options.make_color_component(opt))
-
-  private val components = Isabelle.options.make_components(predefined, relevant_options)
+  protected val components: List[(String, List[Option_Component])]
 
   override def _init()
   {
@@ -51,3 +35,34 @@
     for ((_, cs) <- components) cs.foreach(_.save())
   }
 }
+
+
+class Isabelle_Options1 extends Isabelle_Options("isabelle-general")
+{
+  // FIXME avoid hard-wired stuff
+  private val relevant_options =
+    Set("jedit_logic", "jedit_auto_start", "jedit_font_scale", "jedit_tooltip_font_size",
+      "jedit_tooltip_margin", "jedit_tooltip_dismiss_delay", "editor_load_delay",
+      "editor_input_delay", "editor_output_delay", "editor_update_delay")
+
+  relevant_options.foreach(Isabelle.options.value.check_name _)
+
+  protected val components =
+    Isabelle.options.make_components(List(Isabelle_Logic.logic_selector(false)), relevant_options)
+}
+
+
+class Isabelle_Options2 extends Isabelle_Options("isabelle-rendering")
+{
+  // FIXME avoid hard-wired stuff
+  private val predefined =
+    (for {
+      (name, opt) <- Isabelle.options.value.options.toList
+      if (name.startsWith("color_") && opt.section == "Rendering of Document Content")
+    } yield Isabelle.options.make_color_component(opt))
+
+  assert(!predefined.isEmpty)
+
+  protected val components = Isabelle.options.make_components(predefined, _ => false)
+}
+