Commit abc3c31415ca75889914a2b7053274857a3ac3a8
1 parent
c8de5f4b
New:
- Adding support of euDock lib for fisheyes menu in native JS. Known bugs: - It doesn't work in 'object_alignment mode'. Amelioration: - Recode the entire with jQuery: it will permit to reduce size of code and make it simplier.
Showing
2 changed files
with
390 additions
and
0 deletions
Show diff stats
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: Jeremy | |
| 4 | + * Date: 18/09/2012 | |
| 5 | + * Time: 17:28 | |
| 6 | + * | |
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | +read calexium_lib/web/CXM_jquery.anubis | |
| 12 | +read calexium_lib/web/CXM_jquery_eudock_types.anubis | |
| 13 | +read tools/basis.anubis | |
| 14 | +read system/string.anubis | |
| 15 | +read system/convert.anubis | |
| 16 | + | |
| 17 | +/********************************************************************************************************/ | |
| 18 | +/********************************************************************************************************/ | |
| 19 | +/********************************************************************************************************/ | |
| 20 | +/********************************************************************************************************/ | |
| 21 | +/**************************************** ATTENTION !!! *******************************************/ | |
| 22 | +/************* Le mode 'object_alignment' n'est pas fonctionnel : NE PAS L'UTILISER ! ****************/ | |
| 23 | +/************************ Un recodage en jQuery de la lib JS est à prévoir **************************/ | |
| 24 | +/********************************************************************************************************/ | |
| 25 | +/********************************************************************************************************/ | |
| 26 | +/********************************************************************************************************/ | |
| 27 | +/********************************************************************************************************/ | |
| 28 | + | |
| 29 | +/* jQuery euDock initialization */ | |
| 30 | +public define List(HTML_Head_Tag) | |
| 31 | + jquery_eudock_init | |
| 32 | + ( | |
| 33 | + String web_dir, | |
| 34 | + ) | |
| 35 | + = | |
| 36 | + [ | |
| 37 | + js(js_file("/js/jquery/euDock.2.0.js")), | |
| 38 | + //js(js_file("/js/jquery/euDock.Blank.js")), // not needed for now | |
| 39 | + //js(js_file("/js/jquery/euDock.DivMousePos.js")), // not needed for now | |
| 40 | + //js(js_file("/js/jquery/euDock.Ghost.js")), // not needed for now | |
| 41 | + js(js_file("/js/jquery/euDock.Image.js")), | |
| 42 | + //js(js_file("/js/jquery/euDock.Label.js")) // not needed for now | |
| 43 | + ] | |
| 44 | + . | |
| 45 | + | |
| 46 | +/* Recursive format of the bar */ | |
| 47 | +define String | |
| 48 | + _jquery_eudock_format_bar | |
| 49 | + ( | |
| 50 | + List(JQ_eudock_imagebar) bar_images, | |
| 51 | + String formatted | |
| 52 | + ) | |
| 53 | + = | |
| 54 | + if bar_images is | |
| 55 | + { | |
| 56 | + [] then formatted, | |
| 57 | + [ h . t ] then | |
| 58 | + if h is | |
| 59 | + { | |
| 60 | + jq_eudock_bar_top(image) then | |
| 61 | + if t is | |
| 62 | + { | |
| 63 | + [] then _jquery_eudock_format_bar(t, formatted+"top :{euImage:{image:'"+image.image_url+"'}}"), | |
| 64 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"top :{euImage:{image:'"+image.image_url+"'}},") | |
| 65 | + }, | |
| 66 | + jq_eudock_bar_vertical(image) then | |
| 67 | + if t is | |
| 68 | + { | |
| 69 | + [] then _jquery_eudock_format_bar(t, formatted+"vertical :{euImage:{image:'"+image.image_url+"'}}"), | |
| 70 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"vertical :{euImage:{image:'"+image.image_url+"'}},") | |
| 71 | + }, | |
| 72 | + jq_eudock_bar_bottom(image) then | |
| 73 | + if t is | |
| 74 | + { | |
| 75 | + [] then _jquery_eudock_format_bar(t, formatted+"bottom :{euImage:{image:'"+image.image_url+"'}}"), | |
| 76 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"bottom :{euImage:{image:'"+image.image_url+"'}},") | |
| 77 | + }, | |
| 78 | + jq_eudock_bar_left(image) then | |
| 79 | + if t is | |
| 80 | + { | |
| 81 | + [] then _jquery_eudock_format_bar(t, formatted+"left :{euImage:{image:'"+image.image_url+"'}}"), | |
| 82 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"left :{euImage:{image:'"+image.image_url+"'}},") | |
| 83 | + }, | |
| 84 | + jq_eudock_bar_horizontal(image) then | |
| 85 | + if t is | |
| 86 | + { | |
| 87 | + [] then _jquery_eudock_format_bar(t, formatted+"horizontal :{euImage:{image:'"+image.image_url+"'}}"), | |
| 88 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"horizontal :{euImage:{image:'"+image.image_url+"'}},") | |
| 89 | + }, | |
| 90 | + jq_eudock_bar_right(image) then | |
| 91 | + if t is | |
| 92 | + { | |
| 93 | + [] then _jquery_eudock_format_bar(t, formatted+"right :{euImage:{image:'"+image.image_url+"'}}"), | |
| 94 | + [ h . t] then _jquery_eudock_format_bar(t, formatted+"right :{euImage:{image:'"+image.image_url+"'}},") | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 98 | + . | |
| 99 | + | |
| 100 | +/* Format the bar */ | |
| 101 | +define String | |
| 102 | + jquery_eudock_format_bar | |
| 103 | + ( | |
| 104 | + String dockname, | |
| 105 | + JQ_eudock_bar bar | |
| 106 | + ) | |
| 107 | + = | |
| 108 | + dockname+".setBar({"+ | |
| 109 | + _jquery_eudock_format_bar(bar.bar_images, "")+ | |
| 110 | + "});" | |
| 111 | + . | |
| 112 | + | |
| 113 | +/* Format 1 icon */ | |
| 114 | +define String | |
| 115 | + _jquery_eudock_format_icon | |
| 116 | + ( | |
| 117 | + String dockname, | |
| 118 | + JQ_euDock_Icon icon | |
| 119 | + ) | |
| 120 | + = | |
| 121 | + if icon is jq_eudock_icon(icon_image, link) then | |
| 122 | + " "+dockname+".addIcon(new Array({euImage:{image:'"+icon_image.image_url+"'}}), {link:'"+link+"'});\n" // space added at the beginning to avoid any js syntax error | |
| 123 | + . | |
| 124 | + | |
| 125 | +/* Format icons */ | |
| 126 | +define String | |
| 127 | + _jquery_eudock_format_icons | |
| 128 | + ( | |
| 129 | + String dockname, | |
| 130 | + List(JQ_euDock_Icon) icons, | |
| 131 | + String formatted | |
| 132 | + ) | |
| 133 | + = | |
| 134 | + if icons is | |
| 135 | + { | |
| 136 | + [] then formatted, | |
| 137 | + [ h . t ] then | |
| 138 | + _jquery_eudock_format_icons(dockname, t, formatted+ _jquery_eudock_format_icon(dockname, h)) | |
| 139 | + } | |
| 140 | + . | |
| 141 | + | |
| 142 | +/* Format icons */ | |
| 143 | +define String | |
| 144 | + jquery_eudock_format_icons | |
| 145 | + ( | |
| 146 | + String dockname, | |
| 147 | + List(JQ_euDock_Icon) icons | |
| 148 | + ) | |
| 149 | + = | |
| 150 | + _jquery_eudock_format_icons(dockname, icons, "") | |
| 151 | + . | |
| 152 | + | |
| 153 | +/* Format alignment */ | |
| 154 | +define String | |
| 155 | + jquery_eudock_format_alignment | |
| 156 | + ( | |
| 157 | + String dockname, | |
| 158 | + JQ_euDock_alignment alignment | |
| 159 | + ) | |
| 160 | + = | |
| 161 | + if alignment is | |
| 162 | + { | |
| 163 | + jq_eudock_screen_alignment(a, o) then | |
| 164 | + dockname+".setScreenAlign("+jq_eudock_align_to_string(a)+", "+o+");", | |
| 165 | + jq_eudock_object_alignment(o_id, o_al, o, p) then | |
| 166 | + dockname+".setObjectAlign('"+o_id+"', "+jq_eudock_object_align_to_string(o_al)+", "+o+", "+jq_eudock_position_to_string(p)+");", | |
| 167 | + jq_eudock_fixed_alignment(x, y, p) then | |
| 168 | + dockname+".setPointAlign("+x+", "+y+", "+jq_eudock_position_to_string(p)+");" | |
| 169 | + } | |
| 170 | + // "+dockname+".setScreenAlign("+jq_eudock_position_to_string(position)+",0); | |
| 171 | + . | |
| 172 | + | |
| 173 | +/* Creation of an euDock */ | |
| 174 | +public define HTML_Partial_Content | |
| 175 | + jquery_eudock | |
| 176 | + ( | |
| 177 | + JQ_euDock dock | |
| 178 | + ) | |
| 179 | + = | |
| 180 | + with dockname="dock_"+now, // dock name is suffixed with a timestamp to guarantee its uniqueness | |
| 181 | + if dock is jq_eudock(bar, icons, icon_offset, alignment) then | |
| 182 | + partial_content | |
| 183 | + ( | |
| 184 | + [ | |
| 185 | + js_inline(script("", " | |
| 186 | + euEnv.imageBasePath=\"\"; | |
| 187 | + var "+dockname+"=new euDock(); | |
| 188 | + "+jquery_eudock_format_alignment(dockname, alignment)+" | |
| 189 | + "+jquery_eudock_format_bar(dockname, bar)+" | |
| 190 | + "+dockname+".setIconsOffset("+icon_offset+"); | |
| 191 | + "+jquery_eudock_format_icons(dockname, icons)+" | |
| 192 | + ")) | |
| 193 | + ], | |
| 194 | + literal("") // euDock does not need to return HTML content => it's javascript only ! | |
| 195 | + ) | |
| 196 | + . | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: Jeremy | |
| 4 | + * Date: 18/09/2012 | |
| 5 | + * Time: 17:48 | |
| 6 | + * | |
| 7 | + * To change this template use Tools | Options | Coding | Edit Standard Headers. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | |
| 11 | +read calexium_lib/web/CXM_jquery.anubis | |
| 12 | +read tools/basis.anubis | |
| 13 | +read system/string.anubis | |
| 14 | +read system/convert.anubis | |
| 15 | + | |
| 16 | +/* jQuery euDock "euImage" type */ | |
| 17 | +public type JQ_euDock_euImage: | |
| 18 | + jq_eudock_euimage(String image_url) // url must be set from web server root. example: "/images/mydock/icon-1.png" | |
| 19 | +. | |
| 20 | + | |
| 21 | +/* jQuery euDock image bar type */ | |
| 22 | +public type JQ_eudock_imagebar: | |
| 23 | + jq_eudock_bar_top(JQ_euDock_euImage image), | |
| 24 | + jq_eudock_bar_vertical(JQ_euDock_euImage image), | |
| 25 | + jq_eudock_bar_bottom(JQ_euDock_euImage image), | |
| 26 | + jq_eudock_bar_left(JQ_euDock_euImage image), | |
| 27 | + jq_eudock_bar_horizontal(JQ_euDock_euImage image), | |
| 28 | + jq_eudock_bar_right(JQ_euDock_euImage image) | |
| 29 | +. | |
| 30 | + | |
| 31 | +/* jQuery euDock bar type */ | |
| 32 | +public type JQ_eudock_bar: | |
| 33 | + jq_eudock_bar(List(JQ_eudock_imagebar) bar_images) | |
| 34 | +. | |
| 35 | + | |
| 36 | +/* jQuery euDock align type */ | |
| 37 | +public type JQ_eudock_align: | |
| 38 | + jq_eudock_align_top, | |
| 39 | + jq_eudock_align_left, | |
| 40 | + jq_eudock_align_bottom, | |
| 41 | + jq_eudock_align_right | |
| 42 | +. | |
| 43 | + | |
| 44 | +/* JQ_eudock_align to string */ | |
| 45 | +public define String | |
| 46 | + jq_eudock_align_to_string | |
| 47 | + ( | |
| 48 | + JQ_eudock_align a | |
| 49 | + ) | |
| 50 | + = | |
| 51 | + if a is | |
| 52 | + { | |
| 53 | + jq_eudock_align_top then "euUP", | |
| 54 | + jq_eudock_align_left then "euLEFT", | |
| 55 | + jq_eudock_align_bottom then "euDOWN", | |
| 56 | + jq_eudock_align_right then "euRIGHT" | |
| 57 | + } | |
| 58 | + . | |
| 59 | + | |
| 60 | +/* string to JQ_eudock_align */ | |
| 61 | +public define JQ_eudock_align | |
| 62 | + string_to_jq_eudock_align | |
| 63 | + ( | |
| 64 | + String s | |
| 65 | + ) | |
| 66 | + = | |
| 67 | + if s="euUP" then jq_eudock_align_top | |
| 68 | + else if s="euLEFT" then jq_eudock_align_left | |
| 69 | + else if s="euDOWN" then jq_eudock_align_bottom | |
| 70 | + else if s="euRIGHT" then jq_eudock_align_right | |
| 71 | + else jq_eudock_align_top // we decide that top position is default. | |
| 72 | + . | |
| 73 | + | |
| 74 | +/* jQuery euDock position type */ | |
| 75 | +public type JQ_eudock_position: | |
| 76 | + jq_eudock_position_top, | |
| 77 | + jq_eudock_position_left, | |
| 78 | + jq_eudock_position_bottom, | |
| 79 | + jq_eudock_position_right, | |
| 80 | + jq_eudock_position_horizontal, | |
| 81 | + jq_eudock_position_vertical | |
| 82 | +. | |
| 83 | + | |
| 84 | +/* JQ_eudock_position to string */ | |
| 85 | +public define String | |
| 86 | + jq_eudock_position_to_string | |
| 87 | + ( | |
| 88 | + JQ_eudock_position p | |
| 89 | + ) | |
| 90 | + = | |
| 91 | + if p is | |
| 92 | + { | |
| 93 | + jq_eudock_position_top then "euUP", | |
| 94 | + jq_eudock_position_left then "euLEFT", | |
| 95 | + jq_eudock_position_bottom then "euDOWN", | |
| 96 | + jq_eudock_position_right then "euRIGHT", | |
| 97 | + jq_eudock_position_horizontal then "euHORIZONTAL", | |
| 98 | + jq_eudock_position_vertical then "euVERTICAL" | |
| 99 | + } | |
| 100 | + . | |
| 101 | + | |
| 102 | +/* string to JQ_eudock_position */ | |
| 103 | +public define JQ_eudock_position | |
| 104 | + string_to_jq_eudock_position | |
| 105 | + ( | |
| 106 | + String s | |
| 107 | + ) | |
| 108 | + = | |
| 109 | + if s="euUP" then jq_eudock_position_top | |
| 110 | + else if s="euLEFT" then jq_eudock_position_left | |
| 111 | + else if s="euDOWN" then jq_eudock_position_bottom | |
| 112 | + else if s="euRIGHT" then jq_eudock_position_right | |
| 113 | + else if s="euHORIZONTAL" then jq_eudock_position_horizontal | |
| 114 | + else if s="euVERTICAL" then jq_eudock_position_vertical | |
| 115 | + else jq_eudock_position_top // we decide that top position is default. | |
| 116 | + . | |
| 117 | + | |
| 118 | +/* jQuery euDock objectAlign type */ | |
| 119 | +public type JQ_eudock_object_align: | |
| 120 | + jq_eudock_object_align_top, | |
| 121 | + jq_eudock_object_align_left, | |
| 122 | + jq_eudock_object_align_bottom, | |
| 123 | + jq_eudock_object_align_right, | |
| 124 | + jq_eudock_object_align_center | |
| 125 | +. | |
| 126 | + | |
| 127 | +/* JQ_eudock_object_align to string */ | |
| 128 | +public define String | |
| 129 | + jq_eudock_object_align_to_string | |
| 130 | + ( | |
| 131 | + JQ_eudock_object_align oa | |
| 132 | + ) | |
| 133 | + = | |
| 134 | + if oa is | |
| 135 | + { | |
| 136 | + jq_eudock_object_align_top then "euUP", | |
| 137 | + jq_eudock_object_align_left then "euLEFT", | |
| 138 | + jq_eudock_object_align_bottom then "euDOWN", | |
| 139 | + jq_eudock_object_align_right then "euRIGHT", | |
| 140 | + jq_eudock_object_align_center then "euCENTER" | |
| 141 | + } | |
| 142 | + . | |
| 143 | + | |
| 144 | +/* string to JQ_eudock_object_align */ | |
| 145 | +public define JQ_eudock_object_align | |
| 146 | + string_to_jq_eudock_object_align | |
| 147 | + ( | |
| 148 | + String s | |
| 149 | + ) | |
| 150 | + = | |
| 151 | + if s="euUP" then jq_eudock_object_align_top | |
| 152 | + else if s="euLEFT" then jq_eudock_object_align_left | |
| 153 | + else if s="euDOWN" then jq_eudock_object_align_bottom | |
| 154 | + else if s="euRIGHT" then jq_eudock_object_align_right | |
| 155 | + else if s="euCENTER" then jq_eudock_object_align_center | |
| 156 | + else jq_eudock_object_align_top // we decide that top position is default. | |
| 157 | + . | |
| 158 | + | |
| 159 | +/* jQuery euDock alignment */ | |
| 160 | +public type JQ_euDock_alignment: | |
| 161 | + jq_eudock_screen_alignment( | |
| 162 | + JQ_eudock_align align, | |
| 163 | + Int offset /* see icon_offset in JQ_euDock type definition */ | |
| 164 | + ), | |
| 165 | + jq_eudock_object_alignment( | |
| 166 | + String object_id, | |
| 167 | + JQ_eudock_object_align object_align, | |
| 168 | + Int offset, /* see icon_offset in JQ_euDock type definition */ | |
| 169 | + JQ_eudock_position position | |
| 170 | + ), | |
| 171 | + jq_eudock_fixed_alignment( | |
| 172 | + Int x, | |
| 173 | + Int y, | |
| 174 | + JQ_eudock_position position | |
| 175 | + ) | |
| 176 | +. | |
| 177 | + | |
| 178 | +/* jQuery euDock icon type */ | |
| 179 | +public type JQ_euDock_Icon: | |
| 180 | + jq_eudock_icon( | |
| 181 | + JQ_euDock_euImage icon_image, | |
| 182 | + String link | |
| 183 | + ) | |
| 184 | +. | |
| 185 | + | |
| 186 | +/* jQuery "euDock" type */ | |
| 187 | +public type JQ_euDock: | |
| 188 | + jq_eudock( | |
| 189 | + JQ_eudock_bar bar, // it's the "graphical bar" under icons. | |
| 190 | + List(JQ_euDock_Icon) icons, | |
| 191 | + 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 | |
| 192 | + JQ_euDock_alignment alignment // dock position | |
| 193 | + ) | |
| 194 | +. | ... | ... |