From 6858036c6d12d77df2da9643b04f56733428be13 Mon Sep 17 00:00:00 2001
From: pboutill
Date: Fri, 10 Jun 2011 18:35:06 +0000
Subject: Coqide Menubar integration in MacOS
Because of lablgtk issues, accel_maps can't be customized well on MacOS
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14180 85f007b7-540e-0410-9357-904b9bb8a0f7
---
Makefile.build | 5 +-
config/Makefile.template | 2 +-
configure | 8 +-
ide/coqide.ml | 7 +-
ide/coqide_main.ml4 | 8 +-
ide/coqide_ui.ml | 3 +-
ide/ide_mac_stubs.c | 42 +++++-
ide/mac_default_accel_map | 372 ++++++++++++++++++++++++++++++++++++++++++++++
ide/preferences.ml | 3 +-
9 files changed, 431 insertions(+), 19 deletions(-)
create mode 100644 ide/mac_default_accel_map
diff --git a/Makefile.build b/Makefile.build
index 587be3bd79..852ce0042e 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -329,7 +329,7 @@ install-coqide:: install-ide-$(HASCOQIDE) install-ide-files install-ide-info
install-ide-no:
-install-ide-byte:
+install-ide-byte:
$(MKDIR) $(FULLBINDIR)
$(INSTALLBIN) $(COQIDEBYTE) $(FULLBINDIR)
$(INSTALLSH) $(FULLCOQLIB) $(IDECMA) \
@@ -346,6 +346,7 @@ install-ide-opt:
install-ide-files:
$(MKDIR) $(FULLIDELIB)
$(INSTALLLIB) $(IDEFILES) $(FULLIDELIB)
+ if [ $(IDEOPTINT) = "MacInt" ] ; then $(INSTALLLIB) ide/mac_default_accel_map $(INSTALLLIB)/ide/default_accel_map ; fi
install-ide-info:
$(MKDIR) $(FULLIDELIB)
@@ -707,7 +708,7 @@ ide/coqide_main.ml: ide/coqide_main.ml4
ide/coqide_main_opt.ml: ide/coqide_main.ml4 config/Makefile # no camlp4deps here
$(SHOW)'CAMLP4O $<'
- $(HIDE)$(CAMLP4O) $(CAMLP4USE) $(IDEOPTP4) -impl $< -o $@
+ $(HIDE)$(CAMLP4O) $(CAMLP4USE) -D$(IDEOPTINT) -impl $< -o $@
# pretty printing of the revision number when compiling a checked out
diff --git a/config/Makefile.template b/config/Makefile.template
index c5d81c9d05..e9067e98f7 100644
--- a/config/Makefile.template
+++ b/config/Makefile.template
@@ -140,7 +140,7 @@ STRIP=STRIPCOMMAND
HASCOQIDE=COQIDEOPT
IDEOPTFLAGS=IDEARCHFLAGS
IDEOPTDEPS=IDEARCHFILE
-IDEOPTP4=IDEARCHDEF
+IDEOPTINT=IDEARCHDEF
# Defining REVISION
CHECKEDOUT=CHECKEDOUTSOURCETREE
diff --git a/configure b/configure
index b43a998aad..87b773f379 100755
--- a/configure
+++ b/configure
@@ -599,7 +599,7 @@ esac
IDEARCHFLAGS=
IDEARCHFILE=
-IDEARCHDEF=
+IDEARCHDEF=No
# -byte-only should imply -coqide byte, unless the user decides otherwise
@@ -647,12 +647,12 @@ else
cflags=$cflags" `pkg-config --cflags ige-mac-integration`"
IDEARCHFLAGS='-ccopt "`pkg-config --libs ige-mac-integration`"'
IDEARCHFILE=ide/ide_mac_stubs.o
- IDEARCHDEF=-DMacInt
+ IDEARCHDEF=MacInt
elif [ "$ARCH" = "win32" ];
then
IDEARCHFLAGS=
IDEARCHFILE=ide/ide_win32_stubs.o
- IDEARCHDEF=-DWin32
+ IDEARCHDEF=Win32
fi
fi
fi
@@ -881,7 +881,7 @@ fi
if test "$COQIDE" != "no"; then
echo " Lablgtk2 library in : $LABLGTKLIB"
fi
-if test "$IDEARCHDEF" = "-DMacInt"; then
+if test "$IDEARCHDEF" = "MacInt"; then
echo " Mac OS integration is on"
fi
if test "$with_doc" = "all"; then
diff --git a/ide/coqide.ml b/ide/coqide.ml
index b0fadaca2c..a57551b807 100644
--- a/ide/coqide.ml
+++ b/ide/coqide.ml
@@ -2537,7 +2537,8 @@ let main files =
Coqide_ui.ui_m#insert_action_group windows_actions 0;
Coqide_ui.ui_m#insert_action_group help_actions 0;
w#add_accel_group Coqide_ui.ui_m#get_accel_group ;
- vbox#pack (Coqide_ui.ui_m#get_widget "/CoqIde MenuBar");
+ if Gdk.Windowing.platform <> `QUARTZ
+ then vbox#pack (Coqide_ui.ui_m#get_widget "/CoqIde MenuBar");
let tbar = GtkButton.Toolbar.cast ((Coqide_ui.ui_m#get_widget "/CoqIde ToolBar")#as_widget)
in let () = GtkButton.Toolbar.set ~orientation:`HORIZONTAL ~style:`ICONS
~tooltips:true tbar in
@@ -2811,9 +2812,7 @@ let main files =
end;
initial_about session_notebook#current_term.proof_view#buffer;
!show_toolbar !current.show_toolbar;
- session_notebook#current_term.script#misc#grab_focus ()
-
-;;
+ session_notebook#current_term.script#misc#grab_focus ();;
(* This function check every half of second if GeoProof has send
something on his private clipboard *)
diff --git a/ide/coqide_main.ml4 b/ide/coqide_main.ml4
index 9a9a0a0edb..0f99648147 100644
--- a/ide/coqide_main.ml4
+++ b/ide/coqide_main.ml4
@@ -10,13 +10,14 @@ IFDEF MacInt THEN
external gtk_mac_init : (string -> unit) -> (unit -> bool) -> unit
= "caml_gtk_mac_init"
-external gtk_mac_ready : unit -> unit
+external gtk_mac_ready : ([> Gtk.widget ] as 'a) Gtk.obj -> ([> Gtk.widget ] as 'a) Gtk.obj ->
+ ([> Gtk.widget ] as 'a) Gtk.obj -> unit
= "caml_gtk_mac_ready"
END
let initmac () = IFDEF MacInt THEN gtk_mac_init Coqide.do_load Coqide.forbid_quit_to_save ELSE () END
-let macready () = IFDEF MacInt THEN gtk_mac_ready () ELSE () END
+let macready x y z = IFDEF MacInt THEN gtk_mac_ready x#as_widget y#as_widget z#as_widget ELSE () END
(* On win32, we add the directory of coqide to the PATH at launch-time
(this used to be done in a .bat script). *)
@@ -89,7 +90,8 @@ let () =
else failwith ("Coqide internal error: " ^ msg)));
Coqide.main files;
if !Coq_config.with_geoproof then ignore (Thread.create Coqide.check_for_geoproof_input ());
- macready () ;
+ macready (Coqide_ui.ui_m#get_widget "/CoqIde MenuBar") (Coqide_ui.ui_m#get_widget "/CoqIde MenuBar/Edit/Prefs")
+ (Coqide_ui.ui_m#get_widget "/CoqIde MenuBar/Help/Abt");
while true do
try
GtkThread.main ()
diff --git a/ide/coqide_ui.ml b/ide/coqide_ui.ml
index 0ea018fc4d..d3543cf2ce 100644
--- a/ide/coqide_ui.ml
+++ b/ide/coqide_ui.ml
@@ -38,7 +38,7 @@ let init () =
-
+ %s