/* ***************************************************************************
General Default-Configuration Interface for Fonts, Events, Matcher and Colours
Author: bu, cxl
(C) 1999, Bremen Institute for Safe Systems, Universitaet Bremen
(C) 1999, Albert-Ludwigs-Universitaet Freiburg
************************************************************************** */
# Compiled by:
#
src/lib/tk/src/tk.sublibapi Events_Api {
config: {
abort_event: Ref( tk::Event ),
activate_event: Ref( tk::Event ),
cancel_event: Ref( tk::Event ),
close_event: Ref( tk::Event ),
confirm_event: Ref( tk::Event ),
copy_event: Ref( tk::Event ),
delete_event: Ref( tk::Event ),
drag_event: Ref( tk::Event ),
drop_event: Ref( tk::Event ),
dd_motion_event: Ref( tk::Event ),
dd_enter_event: Ref( tk::Event ),
dd_leave_event: Ref( tk::Event ),
object_menu_event: Ref( tk::Event ),
duplicate_event: Ref( tk::Event ),
find_event: Ref( tk::Event ),
help_event: Ref( tk::Event ),
info_event: Ref( tk::Event ),
kill_event: Ref( tk::Event ),
new_event: Ref( tk::Event ),
paste_event: Ref( tk::Event ),
quit_event: Ref( tk::Event ),
sel_all: Ref( tk::Event ),
sel_elem_event: Ref( tk::Event ),
sel_group_elem_event: Ref( tk::Event ),
sel_range_event: Ref( tk::Event ),
show_event: Ref( tk::Event ),
update_event: Ref( tk::Event )
};
abort_event: Void -> tk::Event;
activate_event: Void -> tk::Event;
cancel_event: Void -> tk::Event;
close_event: Void -> tk::Event;
confirm_event: Void -> tk::Event;
copy_event: Void -> tk::Event;
delete_event: Void -> tk::Event;
drag_event: Void -> tk::Event;
drop_event: Void -> tk::Event;
dd_motion_event: Void -> tk::Event;
dd_leave_event: Void -> tk::Event;
dd_enter_event: Void -> tk::Event;
object_menu_event: Void -> tk::Event;
duplicate_event: Void -> tk::Event;
find_event: Void -> tk::Event;
help_event: Void -> tk::Event;
info_event: Void -> tk::Event;
kill_event: Void -> tk::Event;
new_event: Void -> tk::Event;
paste_event: Void -> tk::Event;
quit_event: Void -> tk::Event;
sel_all: Void -> tk::Event;
sel_elem_event: Void -> tk::Event;
sel_group_elem_event: Void -> tk::Event;
sel_range_event: Void -> tk::Event;
show_event: Void -> tk::Event;
update_event: Void -> tk::Event;
init: Void -> Void;
};
api Colors_Api {
config: {
background: Ref( tk::Color ),
background_act: Ref( tk::Color ),
background_sel: Ref( tk::Color ),
foreground: Ref( tk::Color ),
foreground_act: Ref( tk::Color ),
foreground_sel: Ref( tk::Color )
};
init: Void -> Void;
};
api Local_Configuration_Manager_Api {
Part_Ilk = Exception;
Object_Id;
make_object_id: String -> Object_Id;
get_string_id: Object_Id -> String;
id_kinds: Void -> List( String );
get_data: Object_Id -> Null_Or( Part_Ilk );
put_data: (Object_Id, Part_Ilk) -> Void;
};
api Matcher_Sig {
config: { matcher: Ref( String -> String -> Bool ) };
};
package global_configuration: (weak) api {
package fonts: Fonts; # Fonts is from
src/lib/tk/src/fonts.api package events: Events_Api; # Events_Api is from
src/lib/tk/src/global_config.pkg package colors: Colors_Api; # Colors_Api is from
src/lib/tk/src/global_config.pkg package matcher: Matcher_Sig; # Matcher_Sig is from
src/lib/tk/src/global_config.pkg package local_config_mgr: Local_Configuration_Manager_Api; # Local_Configuration_Manager_Api is from
src/lib/tk/src/global_config.pkg }
{
include package tk;
package fonts: (weak) Fonts # Fonts is from
src/lib/tk/src/fonts.api = fonts;
package events: (weak) Events_Api { # Events_Api is from
src/lib/tk/src/global_config.pkg config =
{ sel_elem_event => REF (BUTTON_PRESS (THE 1)),
sel_group_elem_event=> REF (CONTROL (BUTTON_PRESS (THE 1))),
sel_range_event => REF (SHIFT (BUTTON_PRESS (THE 1))),
sel_all => REF (META (KEY_PRESS "A")),
activate_event => REF (DOUBLE (BUTTON_PRESS (THE 1))),
object_menu_event => REF (BUTTON_PRESS (THE 3)),
info_event => REF (META (KEY_PRESS "I")),
/* does not work for strange Tcl reasons . . .
show_event = REF (META (KEY_PRESS "S")),
*/
show_event => REF (BUTTON_PRESS (THE 3)),
find_event => REF (META (KEY_PRESS "F")),
help_event => REF (META (KEY_PRESS "H")),
update_event => REF (META (KEY_PRESS "U")),
new_event => REF (META (KEY_PRESS "N")),
delete_event => REF (META (KEY_PRESS "D")),
copy_event => REF (META (KEY_PRESS "C")),
paste_event => REF (META (KEY_PRESS "V")),
drag_event => REF (BUTTON_PRESS (THE 1)),
drop_event => REF (BUTTON_RELEASE (THE 1)),
dd_motion_event => REF (MODIFIER_BUTTON (1, MOTION)),
dd_enter_event => REF (MODIFIER_BUTTON (1, ENTER)),
dd_leave_event => REF (MODIFIER_BUTTON (1, LEAVE)),
duplicate_event => REF (META (KEY_PRESS "D")),
confirm_event => REF (KEY_PRESS "Y"),
cancel_event => REF (KEY_PRESS "N"),
quit_event => REF (META (KEY_PRESS "Q")),
abort_event => REF (META (KEY_PRESS ".")),
kill_event => REF (META (KEY_PRESS ".")),
close_event => REF (KEY_PRESS "Q") };
fun sel_elem_event () = *config.sel_elem_event;
fun sel_group_elem_event () = *config.sel_group_elem_event;
fun sel_range_event () = *config.sel_range_event;
fun sel_all () = *config.sel_all;
fun activate_event () = *config.activate_event;
fun info_event () = *config.info_event;
fun show_event () = *config.show_event;
fun find_event () = *config.find_event;
fun help_event () = *config.help_event;
fun update_event () = *config.update_event;
fun new_event () = *config.new_event;
fun delete_event () = *config.delete_event;
fun copy_event () = *config.copy_event;
fun paste_event () = *config.paste_event;
fun drag_event () = *config.drag_event;
fun drop_event () = *config.drop_event;
fun dd_motion_event () = *config.dd_motion_event;
fun dd_leave_event () = *config.dd_leave_event;
fun dd_enter_event () = *config.dd_enter_event;
fun object_menu_event () = *config.object_menu_event;
fun duplicate_event () = *config.duplicate_event;
fun confirm_event () = *config.confirm_event;
fun cancel_event () = *config.cancel_event;
fun quit_event () = *config.quit_event;
fun abort_event () = *config.abort_event;
fun kill_event () = *config.kill_event;
fun close_event () = *config.close_event;
fun init () = ();
};
package colors: (weak) Colors_Api { # Colors_Api is from
src/lib/tk/src/global_config.pkg config =
{ background => REF (MIX { red=>200, blue=>240, green=>240 } ),
foreground => REF (BLACK),
background_sel => REF (MIX { red=>300, blue=>150, green=>300 } ),
foreground_sel => REF (BLACK),
background_act => REF (RED),
foreground_act => REF (BLACK)
};
fun init () = ();
};
package matcher {
config = { matcher => REF string::is_prefix };
};
package local_config_mgr {
Part_Ilk = Exception;
Object_Id = (Int, String);
id_ctr = REF (0);
fun make_object_id s
=
(*id_ctr, s);
fun get_string_id (oid: Object_Id)
=
#2 oid;
fun compare (x: Object_Id, y: Object_Id)
=
int::compare(#1 x, #1 y);
package om = binary_map_g (package {
Key = Object_Id;
compare = compare;
});
config_tab = REF (om::empty: om::Map( Part_Ilk ));
fun id_kinds ()
=
list::map
(\\((x, y), _) = y)
(om::keyvals_list *config_tab);
fun get_data oid
=
om::find (*config_tab, oid);
fun put_data (oid, obj)
=
config_tab := om::set (*config_tab, oid, obj);
};
};