From abc3c31415ca75889914a2b7053274857a3ac3a8 Mon Sep 17 00:00:00 2001 From: yekolia Date: Fri, 19 Oct 2012 08:12:23 +0000 Subject: [PATCH] New: - Adding support of euDock lib for fisheyes menu in native JS. --- web/CXM_jquery_eudock.anubis | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/CXM_jquery_eudock_types.anubis | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 390 insertions(+), 0 deletions(-) create mode 100644 web/CXM_jquery_eudock.anubis create mode 100644 web/CXM_jquery_eudock_types.anubis diff --git a/web/CXM_jquery_eudock.anubis b/web/CXM_jquery_eudock.anubis new file mode 100644 index 0000000..ed2821f --- /dev/null +++ b/web/CXM_jquery_eudock.anubis @@ -0,0 +1,196 @@ +/* + * Created by PyramIDE. + * User: Jeremy + * Date: 18/09/2012 + * Time: 17:28 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +read calexium_lib/web/CXM_making_a_web_site.anubis +read calexium_lib/web/CXM_jquery.anubis +read calexium_lib/web/CXM_jquery_eudock_types.anubis +read tools/basis.anubis +read system/string.anubis +read system/convert.anubis + +/********************************************************************************************************/ +/********************************************************************************************************/ +/********************************************************************************************************/ +/********************************************************************************************************/ +/**************************************** ATTENTION !!! *******************************************/ +/************* Le mode 'object_alignment' n'est pas fonctionnel : NE PAS L'UTILISER ! ****************/ +/************************ Un recodage en jQuery de la lib JS est à prévoir **************************/ +/********************************************************************************************************/ +/********************************************************************************************************/ +/********************************************************************************************************/ +/********************************************************************************************************/ + +/* jQuery euDock initialization */ +public define List(HTML_Head_Tag) + jquery_eudock_init + ( + String web_dir, + ) + = + [ + js(js_file("/js/jquery/euDock.2.0.js")), + //js(js_file("/js/jquery/euDock.Blank.js")), // not needed for now + //js(js_file("/js/jquery/euDock.DivMousePos.js")), // not needed for now + //js(js_file("/js/jquery/euDock.Ghost.js")), // not needed for now + js(js_file("/js/jquery/euDock.Image.js")), + //js(js_file("/js/jquery/euDock.Label.js")) // not needed for now + ] + . + +/* Recursive format of the bar */ +define String + _jquery_eudock_format_bar + ( + List(JQ_eudock_imagebar) bar_images, + String formatted + ) + = + if bar_images is + { + [] then formatted, + [ h . t ] then + if h is + { + jq_eudock_bar_top(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"top :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"top :{euImage:{image:'"+image.image_url+"'}},") + }, + jq_eudock_bar_vertical(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"vertical :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"vertical :{euImage:{image:'"+image.image_url+"'}},") + }, + jq_eudock_bar_bottom(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"bottom :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"bottom :{euImage:{image:'"+image.image_url+"'}},") + }, + jq_eudock_bar_left(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"left :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"left :{euImage:{image:'"+image.image_url+"'}},") + }, + jq_eudock_bar_horizontal(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"horizontal :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"horizontal :{euImage:{image:'"+image.image_url+"'}},") + }, + jq_eudock_bar_right(image) then + if t is + { + [] then _jquery_eudock_format_bar(t, formatted+"right :{euImage:{image:'"+image.image_url+"'}}"), + [ h . t] then _jquery_eudock_format_bar(t, formatted+"right :{euImage:{image:'"+image.image_url+"'}},") + } + } + } + . + +/* Format the bar */ +define String + jquery_eudock_format_bar + ( + String dockname, + JQ_eudock_bar bar + ) + = + dockname+".setBar({"+ + _jquery_eudock_format_bar(bar.bar_images, "")+ + "});" + . + +/* Format 1 icon */ +define String + _jquery_eudock_format_icon + ( + String dockname, + JQ_euDock_Icon icon + ) + = + if icon is jq_eudock_icon(icon_image, link) then + " "+dockname+".addIcon(new Array({euImage:{image:'"+icon_image.image_url+"'}}), {link:'"+link+"'});\n" // space added at the beginning to avoid any js syntax error + . + +/* Format icons */ +define String + _jquery_eudock_format_icons + ( + String dockname, + List(JQ_euDock_Icon) icons, + String formatted + ) + = + if icons is + { + [] then formatted, + [ h . t ] then + _jquery_eudock_format_icons(dockname, t, formatted+ _jquery_eudock_format_icon(dockname, h)) + } + . + +/* Format icons */ +define String + jquery_eudock_format_icons + ( + String dockname, + List(JQ_euDock_Icon) icons + ) + = + _jquery_eudock_format_icons(dockname, icons, "") + . + +/* Format alignment */ +define String + jquery_eudock_format_alignment + ( + String dockname, + JQ_euDock_alignment alignment + ) + = + if alignment is + { + jq_eudock_screen_alignment(a, o) then + dockname+".setScreenAlign("+jq_eudock_align_to_string(a)+", "+o+");", + jq_eudock_object_alignment(o_id, o_al, o, p) then + dockname+".setObjectAlign('"+o_id+"', "+jq_eudock_object_align_to_string(o_al)+", "+o+", "+jq_eudock_position_to_string(p)+");", + jq_eudock_fixed_alignment(x, y, p) then + dockname+".setPointAlign("+x+", "+y+", "+jq_eudock_position_to_string(p)+");" + } + // "+dockname+".setScreenAlign("+jq_eudock_position_to_string(position)+",0); + . + +/* Creation of an euDock */ +public define HTML_Partial_Content + jquery_eudock + ( + JQ_euDock dock + ) + = + with dockname="dock_"+now, // dock name is suffixed with a timestamp to guarantee its uniqueness + if dock is jq_eudock(bar, icons, icon_offset, alignment) then + partial_content + ( + [ + js_inline(script("", " + euEnv.imageBasePath=\"\"; + var "+dockname+"=new euDock(); + "+jquery_eudock_format_alignment(dockname, alignment)+" + "+jquery_eudock_format_bar(dockname, bar)+" + "+dockname+".setIconsOffset("+icon_offset+"); + "+jquery_eudock_format_icons(dockname, icons)+" + ")) + ], + literal("") // euDock does not need to return HTML content => it's javascript only ! + ) + . diff --git a/web/CXM_jquery_eudock_types.anubis b/web/CXM_jquery_eudock_types.anubis new file mode 100644 index 0000000..b6dd0bd --- /dev/null +++ b/web/CXM_jquery_eudock_types.anubis @@ -0,0 +1,194 @@ +/* + * Created by PyramIDE. + * User: Jeremy + * Date: 18/09/2012 + * Time: 17:48 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +read calexium_lib/web/CXM_making_a_web_site.anubis +read calexium_lib/web/CXM_jquery.anubis +read tools/basis.anubis +read system/string.anubis +read system/convert.anubis + +/* jQuery euDock "euImage" type */ +public type JQ_euDock_euImage: + jq_eudock_euimage(String image_url) // url must be set from web server root. example: "/images/mydock/icon-1.png" +. + +/* jQuery euDock image bar type */ +public type JQ_eudock_imagebar: + jq_eudock_bar_top(JQ_euDock_euImage image), + jq_eudock_bar_vertical(JQ_euDock_euImage image), + jq_eudock_bar_bottom(JQ_euDock_euImage image), + jq_eudock_bar_left(JQ_euDock_euImage image), + jq_eudock_bar_horizontal(JQ_euDock_euImage image), + jq_eudock_bar_right(JQ_euDock_euImage image) +. + +/* jQuery euDock bar type */ +public type JQ_eudock_bar: + jq_eudock_bar(List(JQ_eudock_imagebar) bar_images) +. + +/* jQuery euDock align type */ +public type JQ_eudock_align: + jq_eudock_align_top, + jq_eudock_align_left, + jq_eudock_align_bottom, + jq_eudock_align_right +. + +/* JQ_eudock_align to string */ +public define String + jq_eudock_align_to_string + ( + JQ_eudock_align a + ) + = + if a is + { + jq_eudock_align_top then "euUP", + jq_eudock_align_left then "euLEFT", + jq_eudock_align_bottom then "euDOWN", + jq_eudock_align_right then "euRIGHT" + } + . + +/* string to JQ_eudock_align */ +public define JQ_eudock_align + string_to_jq_eudock_align + ( + String s + ) + = + if s="euUP" then jq_eudock_align_top + else if s="euLEFT" then jq_eudock_align_left + else if s="euDOWN" then jq_eudock_align_bottom + else if s="euRIGHT" then jq_eudock_align_right + else jq_eudock_align_top // we decide that top position is default. + . + +/* jQuery euDock position type */ +public type JQ_eudock_position: + jq_eudock_position_top, + jq_eudock_position_left, + jq_eudock_position_bottom, + jq_eudock_position_right, + jq_eudock_position_horizontal, + jq_eudock_position_vertical +. + +/* JQ_eudock_position to string */ +public define String + jq_eudock_position_to_string + ( + JQ_eudock_position p + ) + = + if p is + { + jq_eudock_position_top then "euUP", + jq_eudock_position_left then "euLEFT", + jq_eudock_position_bottom then "euDOWN", + jq_eudock_position_right then "euRIGHT", + jq_eudock_position_horizontal then "euHORIZONTAL", + jq_eudock_position_vertical then "euVERTICAL" + } + . + +/* string to JQ_eudock_position */ +public define JQ_eudock_position + string_to_jq_eudock_position + ( + String s + ) + = + if s="euUP" then jq_eudock_position_top + else if s="euLEFT" then jq_eudock_position_left + else if s="euDOWN" then jq_eudock_position_bottom + else if s="euRIGHT" then jq_eudock_position_right + else if s="euHORIZONTAL" then jq_eudock_position_horizontal + else if s="euVERTICAL" then jq_eudock_position_vertical + else jq_eudock_position_top // we decide that top position is default. + . + +/* jQuery euDock objectAlign type */ +public type JQ_eudock_object_align: + jq_eudock_object_align_top, + jq_eudock_object_align_left, + jq_eudock_object_align_bottom, + jq_eudock_object_align_right, + jq_eudock_object_align_center +. + +/* JQ_eudock_object_align to string */ +public define String + jq_eudock_object_align_to_string + ( + JQ_eudock_object_align oa + ) + = + if oa is + { + jq_eudock_object_align_top then "euUP", + jq_eudock_object_align_left then "euLEFT", + jq_eudock_object_align_bottom then "euDOWN", + jq_eudock_object_align_right then "euRIGHT", + jq_eudock_object_align_center then "euCENTER" + } + . + +/* string to JQ_eudock_object_align */ +public define JQ_eudock_object_align + string_to_jq_eudock_object_align + ( + String s + ) + = + if s="euUP" then jq_eudock_object_align_top + else if s="euLEFT" then jq_eudock_object_align_left + else if s="euDOWN" then jq_eudock_object_align_bottom + else if s="euRIGHT" then jq_eudock_object_align_right + else if s="euCENTER" then jq_eudock_object_align_center + else jq_eudock_object_align_top // we decide that top position is default. + . + +/* jQuery euDock alignment */ +public type JQ_euDock_alignment: + jq_eudock_screen_alignment( + JQ_eudock_align align, + Int offset /* see icon_offset in JQ_euDock type definition */ + ), + jq_eudock_object_alignment( + String object_id, + JQ_eudock_object_align object_align, + Int offset, /* see icon_offset in JQ_euDock type definition */ + JQ_eudock_position position + ), + jq_eudock_fixed_alignment( + Int x, + Int y, + JQ_eudock_position position + ) +. + +/* jQuery euDock icon type */ +public type JQ_euDock_Icon: + jq_eudock_icon( + JQ_euDock_euImage icon_image, + String link + ) +. + +/* jQuery "euDock" type */ +public type JQ_euDock: + jq_eudock( + JQ_eudock_bar bar, // it's the "graphical bar" under icons. + List(JQ_euDock_Icon) icons, + Int icon_offset, // number of icons should be let in "blank space". Example: if icon size is 32px and icon_offset is 2 => the first icon is displayed 64px from the "left" border of the dock and the last icon is displayed 64px from the "right" border of the dock + JQ_euDock_alignment alignment // dock position + ) +. -- libgit2 0.21.4