Skip to content

Commit

Permalink
Win-installer: embedding the Windows GTK theme
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGr committed Jul 4, 2013
1 parent 0cd8812 commit b73bbe1
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Makefile.win32
Expand Up @@ -10,6 +10,7 @@ else
endif

WINLIBS=/cygdrive/c/usr/bin
GTK_MODULES=/cygdrive/c/usr/lib/gtk-2.0/2.10.0/

utils/mkwinapp$(EXEEXT): utils/mkwinapp.ml
ocamlfind ocamlopt -package unix -linkpkg -o $@ $^
Expand All @@ -28,7 +29,7 @@ clean:
rm -rf inst
rm -f ocaml-top$(EXEEXT) ocaml-top.msi

RESOURCES = data/ocaml.lang data/def.lang data/cobalt.xml data/language2.rng data/toplevel_init.ml data/logo.png data/logo.ico
RESOURCES = data/ocaml.lang data/def.lang data/cobalt.xml data/language2.rng data/toplevel_init.ml data/logo.png data/logo.ico data/gtkrc
ICONS = $(wildcard data/icons/*.png)
.PHONY: inst/ocaml-top
inst/ocaml-top: ocaml-top$(EXEEXT) $(RESOURCES) $(ICONS)
Expand All @@ -39,6 +40,8 @@ inst/ocaml-top: ocaml-top$(EXEEXT) $(RESOURCES) $(ICONS)
cp $(ICONS) inst/ocaml-top/data/icons
cp $$(PATH=$(WINLIBS):$$PATH ldd ocaml-top.exe | awk '/usr\/bin/ { print $$3 }') \
inst/ocaml-top
mkdir -p inst/ocaml-top/data/engines
cp $(GTK_MODULES)/engines/libwimp.dll inst/ocaml-top/data/engines

ocaml-top.zip: inst/ocaml-top
cd inst && zip -r ../ocaml-top.zip ocaml-top
Expand Down
66 changes: 66 additions & 0 deletions data/gtkrc
@@ -0,0 +1,66 @@
gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32"
gtk-toolbar-icon-size = small-toolbar

# disable images in buttons. i've only seen ugly delphi apps use this feature.
gtk-button-images = 0

# enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly.
# the office apps use them heavily, though.
gtk-menu-images = 1

# use the win32 button ordering instead of the GNOME HIG one, where applicable
gtk-alternative-button-order = 1

# use the win32 sort indicators direction, as in Explorer
gtk-alternative-sort-arrows = 1

# Windows users don't expect the PC Speaker beeping at them when they backspace in an empty textview and stuff like that
gtk-error-bell = 0

style "msw-default"
{
GtkWidget::interior-focus = 1
GtkOptionMenu::indicator-size = { 9, 5 }
GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 }
GtkSpinButton::shadow-type = in

# Owen and I disagree that these should be themable
#GtkUIManager::add-tearoffs = 0
#GtkComboBox::add-tearoffs = 0

GtkComboBox::appears-as-list = 1
GtkComboBox::focus-on-click = 0

GOComboBox::add_tearoffs = 0

GtkTreeView::allow-rules = 0
GtkTreeView::expander-size = 12

GtkExpander::expander-size = 12

GtkScrolledWindow::scrollbar_spacing = 1

GtkSeparatorMenuItem::horizontal-padding = 2

engine "wimp"
{
}
}
class "*" style "msw-default"

binding "ms-windows-tree-view"
{
bind "Right" { "expand-collapse-cursor-row" (1,1,0) }
bind "Left" { "expand-collapse-cursor-row" (1,0,0) }
}

class "GtkTreeView" binding "ms-windows-tree-view"

style "msw-combobox-thickness" = "msw-default"
{
xthickness = 0
ythickness = 0
}

widget_class "*TreeView*ComboBox*" style "msw-combobox-thickness"
widget_class "*ComboBox*GtkFrame*" style "msw-combobox-thickness"
6 changes: 6 additions & 0 deletions src/main.ml
Expand Up @@ -230,6 +230,12 @@ let _ =
output_string ch s)
"ok"
;
let _reloc_gtk_conf_on_windows =
if Sys.os_type <> "Unix" then
let gtkrc = Filename.concat !Cfg.datadir "gtkrc" in
(try Glib.setenv "GTK_PATH" !Cfg.datadir true with Not_found -> ());
if Sys.file_exists gtkrc then GtkMain.Rc.parse gtkrc
in
let main_window = Gui.main_window ()
in
let create () =
Expand Down
5 changes: 2 additions & 3 deletions src/ocamlBuffer.ml
Expand Up @@ -15,16 +15,15 @@
open Tools.Ops

module GSourceView_params = struct
let syntax_mgr = GSourceView2.source_language_manager ~default:true
let style_mgr = GSourceView2.source_style_scheme_manager ~default:true

let syntax () =
let syntax_mgr = GSourceView2.source_language_manager ~default:true in
syntax_mgr#set_search_path [!Cfg.datadir];
let syn = syntax_mgr#language "ocp-edit-ocaml" in
if syn = None then Tools.debug "WARNING: ocaml language def not found";
syn

let style () =
let style_mgr = GSourceView2.source_style_scheme_manager ~default:true in
style_mgr#set_search_path [!Cfg.datadir];
let sty = style_mgr#style_scheme "cobalt" in
if sty = None then Tools.debug "WARNING: style def not found";
Expand Down

0 comments on commit b73bbe1

Please sign in to comment.