let phrase_sep = ".";;
let blank_uri = "about:blank";;
let current_proof_uri = "about:current_proof";;
-let default_script_font = "Monospace 10";;
+let default_font_size = 10;;
+let script_font = "Monospace";;
let runtime_base_dir = "@RT_BASE_DIR@";;
let images_dir = runtime_base_dir ^ "/icons"
<key name="baseuri">cic:/matita/</key>
<key name="basedir">.matita/xml</key>
<key name="owner">mario</key>
-<!-- <key name="script_font">Monospace 10</key> -->
+<!-- <key name="font_size">10</key> -->
<key name="tactics_bar">false</key>
</section>
<section name="db">
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image318">
+ <widget class="GtkImage" id="image334">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
<accelerator key="o" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image319">
+ <widget class="GtkImage" id="image335">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
<accelerator key="s" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image320">
+ <widget class="GtkImage" id="image336">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image321">
+ <widget class="GtkImage" id="image337">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
<accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image322">
+ <widget class="GtkImage" id="image338">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
<widget class="GtkMenu" id="viewMenu_menu">
<child>
- <widget class="GtkMenuItem" id="newCicBrowserMenuItem">
+ <widget class="GtkCheckMenuItem" id="tacticsBarMenuItem">
<property name="visible">True</property>
- <property name="label" translatable="yes">New Cic Browser</property>
+ <property name="tooltip" translatable="yes">Show/Hide the tactics buttons bar</property>
+ <property name="label" translatable="yes">View Tactics Bar</property>
<property name="use_underline">True</property>
- <accelerator key="F3" modifiers="0" signal="activate"/>
+ <property name="active">True</property>
+ <accelerator key="F2" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
- <widget class="GtkCheckMenuItem" id="tacticsBarMenuItem">
+ <widget class="GtkMenuItem" id="newCicBrowserMenuItem">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Show/Hide the tactics buttons bar</property>
- <property name="label" translatable="yes">View Tactics Bar</property>
+ <property name="label" translatable="yes">New Cic Browser</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
- <accelerator key="F2" modifiers="0" signal="activate"/>
+ <accelerator key="F3" modifiers="0" signal="activate"/>
</widget>
</child>
<accelerator key="F11" modifiers="0" signal="activate"/>
</widget>
</child>
+
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separator1">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="increaseFontSizeMenuItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Increase Font Size</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_increaseFontSizeMenuItem_activate" last_modification_time="Wed, 15 Jun 2005 15:06:29 GMT"/>
+ <accelerator key="plus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="decreaseFontSizeMenuItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Decrease Font Size</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_decreaseFontSizeMenuItem_activate" last_modification_time="Wed, 15 Jun 2005 15:06:29 GMT"/>
+ <accelerator key="minus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="normalFontSizeMenuItem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Normal Font Size</property>
+ <property name="use_underline">True</property>
+ <accelerator key="equal" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
</widget>
</child>
</widget>
let _ =
ignore (gui#main#newCicBrowserMenuItem#connect#activate (fun _ ->
ignore (MatitaMathView.cicBrowser ())));
+ (* font sizes *)
+ ignore (gui#main#increaseFontSizeMenuItem#connect#activate (fun _ ->
+ gui#increaseFontSize ();
+ MatitaMathView.increase_font_size ();
+ MatitaMathView.update_font_sizes ()));
+ ignore (gui#main#decreaseFontSizeMenuItem#connect#activate (fun _ ->
+ gui#decreaseFontSize ();
+ MatitaMathView.decrease_font_size ();
+ MatitaMathView.update_font_sizes ()));
+ ignore (gui#main#normalFontSizeMenuItem#connect#activate (fun _ ->
+ gui#resetFontSize ();
+ MatitaMathView.reset_font_size ();
+ MatitaMathView.update_font_sizes ()));
(* disambiguator callback *)
MatitaDisambiguator.set_choose_uris_callback
(MatitaGui.interactive_uri_choice ());
~packing:main#scriptScrolledWin#add
()
in
+ let default_font_size =
+ Helm_registry.get_opt_default Helm_registry.int
+ ~default:BuildTimeConf.default_font_size "matita.font_size"
+ in
let source_buffer = source_view#source_buffer in
object (self)
val mutable chosen_file = None
val mutable _ok_not_exists = false
- val mutable script_fname = None
+ val mutable script_fname = None
+ val mutable font_size = default_font_size
initializer
(* glade's check widgets *)
"\n";
advance ());
(* script monospace font stuff *)
- let font =
- Helm_registry.get_opt_default Helm_registry.string
- ~default:BuildTimeConf.default_script_font "matita.script_font"
- in
-(* let monospace_tag =
- source_buffer#create_tag [`FONT_DESC font]
- in *)
- self#sourceView#misc#modify_font_by_name font;
-(* let _ =
- source_buffer#connect#changed ~callback:(fun _ ->
- let start, stop = source_buffer#bounds in
- source_buffer#apply_tag monospace_tag start stop)
- in *)
+ self#updateFontSize ();
(* debug menu *)
self#main#debugMenu#misc#hide ();
(* status bar *)
GtkThread.main ();
!text
+ method private updateFontSize () =
+ self#sourceView#misc#modify_font_by_name
+ (sprintf "%s %d" BuildTimeConf.script_font font_size)
+
+ method increaseFontSize () =
+ font_size <- font_size + 1;
+ self#updateFontSize ()
+
+ method decreaseFontSize () =
+ font_size <- font_size - 1;
+ self#updateFontSize ()
+
+ method resetFontSize () =
+ font_size <- default_font_size;
+ self#updateFontSize ()
+
end
let gui () =
method askText: ?title:string -> ?msg:string -> unit -> string option
method loadScript: string -> unit
+
+ (** {3 Fonts} *)
+ method increaseFontSize: unit -> unit
+ method decreaseFontSize: unit -> unit
+ method resetFontSize: unit -> unit
end
method private script = MatitaScript.instance ()
end
+let cicBrowsers = ref []
+
+let default_font_size () =
+ Helm_registry.get_opt_default Helm_registry.int
+ ~default:BuildTimeConf.default_font_size "matita.font_size"
+let current_font_size = ref ~-1
+let increase_font_size () = incr current_font_size
+let decrease_font_size () = decr current_font_size
+let reset_font_size () = current_font_size := default_font_size ()
+
class clickableMathView obj =
let href = Gdome.domString "href" in
let xref = Gdome.domString "xref" in
method set_href_callback f = href_callback <- f
initializer
+ current_font_size := default_font_size ();
+ self#set_font_size !current_font_size;
ignore (self#connect#selection_changed self#choose_selection);
ignore (self#connect#click (fun (gdome_elt, _, _, _) ->
match gdome_elt with
match gdome_elt with
| Some elt -> aux elt
| None -> self#set_selection None
+
+ method update_font_size =
+ self#set_font_size !current_font_size
+
end
let clickableMathView ?hadjustment ?vadjustment ?font_size ?log_verbosity =
inherit clickableMathView obj
val mutable current_infos = None
-
+
method get_selected_terms =
let selections = self#get_selections in
list_map_fail
exception Browser_failure of string
-let cicBrowsers = ref []
-
class type cicBrowser =
object
method load: MatitaTypes.mathViewer_entry -> unit
self#_historyAdd entry
end
+ (** {2 methods accessing underlying GtkMathView} *)
+
+ method updateFontSize = mathView#set_font_size !current_font_size
+
(** {2 methods used by constructor only} *)
method win = win
let history = new MatitaMisc.browser_history size (`About `Blank) in
aux history
-let refresh_all_browsers () = List.iter (fun b -> b#refresh ()) !cicBrowsers
-
let default_sequentViewer () = sequentViewer ~show:true ()
let sequentViewer_instance = MatitaMisc.singleton default_sequentViewer
method show_uri_list ?(reuse=false) ~entry l =
(self#get_browser reuse)#load entry
end
+
+let refresh_all_browsers () = List.iter (fun b -> b#refresh ()) !cicBrowsers
+
+let update_font_sizes () =
+ List.iter (fun b -> b#updateFontSize) !cicBrowsers;
+ (sequentViewer_instance ())#update_font_size
+
(** set hyperlink callback. None disable hyperlink handling *)
method set_href_callback: (string -> unit) option -> unit
+
+ method update_font_size: unit
end
class type sequentViewer =
val cicBrowser: unit -> cicBrowser
-val refresh_all_browsers: unit -> unit
+(** mathview wide functions *)
+
+val increase_font_size: unit -> unit
+val decrease_font_size: unit -> unit
+val reset_font_size: unit -> unit
+
+val refresh_all_browsers: unit -> unit (** act on all cicBrowsers *)
+val update_font_sizes: unit -> unit
(** {2 singleton instances} *)
record empty : Type \def {}.
+inductive True : Prop \def I: True.
+
record pippo : Type \def
{
a: Set ;