Commit 6a8c2f09f96f7ac5e840c0ef4935a5641e83fc18
1 parent
5a230ad0
add colspan and rowspan attributes for editor and form table lines
Showing
3 changed files
with
121 additions
and
9 deletions
Show diff stats
ds_files/ds_types.anubis
| ... | ... | @@ -258,8 +258,18 @@ public define List(DS_Type_File) hayamiki_lib_types_description = |
| 258 | 258 | ]) |
| 259 | 259 | ]), |
| 260 | 260 | |
| 261 | + ds_type("HK_Editor_Table_Line_Attribute", [ | |
| 262 | + alternative("colspan", [ | |
| 263 | + component(int, "number") | |
| 264 | + ]), | |
| 265 | + alternative("rowspan", [ | |
| 266 | + component(int, "number") | |
| 267 | + ]) | |
| 268 | + ]), | |
| 269 | + | |
| 261 | 270 | ds_type("HK_Editor_Table_Line", [ |
| 262 | 271 | alternative("line", [ |
| 272 | + component(list, ds_type("HK_Editor_Table_Line_Attribute"), "line_attr"), | |
| 263 | 273 | component(list, ds_type("HK_Editor_Table_Cell"), "cells") |
| 264 | 274 | ]) |
| 265 | 275 | ]), |
| ... | ... | @@ -282,8 +292,18 @@ public define List(DS_Type_File) hayamiki_lib_types_description = |
| 282 | 292 | ]) |
| 283 | 293 | ]), |
| 284 | 294 | |
| 295 | + ds_type("HK_Form_Table_Line_Attribute", no_message, [ | |
| 296 | + alternative("colspan", [ | |
| 297 | + component(int, "number") | |
| 298 | + ]), | |
| 299 | + alternative("rowspan", [ | |
| 300 | + component(int, "number") | |
| 301 | + ]) | |
| 302 | + ]), | |
| 303 | + | |
| 285 | 304 | ds_type("HK_Form_Table_Line", no_message, [ |
| 286 | 305 | alternative("hk_form_table_line", [ |
| 306 | + component(list, ds_type("HK_Form_Table_Line_Attribute"), "line_attr"), | |
| 287 | 307 | component(list, ds_type("HK_Form_Table_Cell"), "form_table_cells") |
| 288 | 308 | ]) |
| 289 | 309 | ]), | ... | ... |
view/types/hk_editor_table.anubis
| 1 | 1 | /* |
| 2 | 2 | * Created by 伝作 (Densaku). |
| 3 | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | - * Date: 2017-04-12 | |
| 5 | - * Time: 23:52:21 | |
| 4 | + * Date: 2017-04-19 | |
| 5 | + * Time: 16:17:58 | |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| ... | ... | @@ -41,9 +41,20 @@ public type HK_Editor_Table_Cell: |
| 41 | 41 | . |
| 42 | 42 | |
| 43 | 43 | |
| 44 | +public type HK_Editor_Table_Line_Attribute: | |
| 45 | + colspan( | |
| 46 | + Int number | |
| 47 | + ), | |
| 48 | + rowspan( | |
| 49 | + Int number | |
| 50 | + ) | |
| 51 | +. | |
| 52 | + | |
| 53 | + | |
| 44 | 54 | public type HK_Editor_Table_Line: |
| 45 | 55 | line( |
| 46 | - List(HK_Editor_Table_Cell) cells | |
| 56 | + List(HK_Editor_Table_Line_Attribute) line_attr, | |
| 57 | + List(HK_Editor_Table_Cell) cells | |
| 47 | 58 | ) |
| 48 | 59 | . |
| 49 | 60 | |
| ... | ... | @@ -136,6 +147,69 @@ public define Maybe(HK_Editor_Table_Cell) |
| 136 | 147 | |
| 137 | 148 | |
| 138 | 149 | |
| 150 | + HK_Editor_Table_Line_Attribute message format | |
| 151 | + ============================================= | |
| 152 | + | |
| 153 | + | |
| 154 | +public define Message | |
| 155 | + to_Message | |
| 156 | + ( | |
| 157 | + HK_Editor_Table_Line_Attribute _hk_editor_table_line_attribute | |
| 158 | + )= | |
| 159 | + with _hk_editor_table_line_attribute_message = message((Word32)0), // | |
| 160 | + forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE__", "HK_Editor_Table_Line_Attribute")); | |
| 161 | + if _hk_editor_table_line_attribute is | |
| 162 | + { | |
| 163 | + //Alternative colspan | |
| 164 | + colspan(_number) then | |
| 165 | + forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "colspan")); | |
| 166 | + // [type = Int] colspan.number | |
| 167 | + forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), | |
| 168 | + | |
| 169 | + //Alternative rowspan | |
| 170 | + rowspan(_number) then | |
| 171 | + forget(add_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__", "rowspan")); | |
| 172 | + // [type = Int] rowspan.number | |
| 173 | + forget(add_string(_hk_editor_table_line_attribute_message, "number", to_String(_number))), | |
| 174 | + | |
| 175 | + }; | |
| 176 | + _hk_editor_table_line_attribute_message | |
| 177 | +. | |
| 178 | + | |
| 179 | +public define Maybe(HK_Editor_Table_Line_Attribute) | |
| 180 | + from_Message | |
| 181 | + ( | |
| 182 | + Message _hk_editor_table_line_attribute_message | |
| 183 | + )= | |
| 184 | + if find_string(_hk_editor_table_line_attribute_message, "__TYPE__") is {failure then failure, success(__type__) then | |
| 185 | + if find_string(_hk_editor_table_line_attribute_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then | |
| 186 | + if __type__ = "HK_Editor_Table_Line_Attribute" then | |
| 187 | + //Alternative colspan | |
| 188 | + if __type_alt__ = "colspan" then //Alternative colspan | |
| 189 | + // [type = Int] colspan.number | |
| 190 | + if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then | |
| 191 | + if decimal_scan(__number_) is { failure then failure, success(_number_) then | |
| 192 | + | |
| 193 | + success(colspan(_number_)) | |
| 194 | + }} | |
| 195 | + else //Alternative rowspan | |
| 196 | + if __type_alt__ = "rowspan" then //Alternative rowspan | |
| 197 | + // [type = Int] rowspan.number | |
| 198 | + if find_string(_hk_editor_table_line_attribute_message, "number") is {failure then failure, success(__number_) then | |
| 199 | + if decimal_scan(__number_) is { failure then failure, success(_number_) then | |
| 200 | + | |
| 201 | + success(rowspan(_number_)) | |
| 202 | + }} | |
| 203 | + else | |
| 204 | + failure //No valid Alternative found ! | |
| 205 | + else | |
| 206 | + failure //Type not found in message ! | |
| 207 | + }} | |
| 208 | +. | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 139 | 213 | HK_Editor_Table_Line message format |
| 140 | 214 | =================================== |
| 141 | 215 | |
| ... | ... | @@ -150,8 +224,10 @@ public define Message |
| 150 | 224 | if _hk_editor_table_line is |
| 151 | 225 | { |
| 152 | 226 | //Alternative line |
| 153 | - line(__cells) then | |
| 227 | + line(__line_attr, __cells) then | |
| 154 | 228 | forget(add_string(_hk_editor_table_line_message, "__TYPE_ALT__", "line")); |
| 229 | + // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr | |
| 230 | + map_forget((HK_Editor_Table_Line_Attribute _line_attr) |-> add_message(_hk_editor_table_line_message, "line_attr", to_Message(_line_attr)), __line_attr); | |
| 155 | 231 | // [type = List(HK_Editor_Table_Cell)] line.cells |
| 156 | 232 | map_forget((HK_Editor_Table_Cell _cells) |-> add_message(_hk_editor_table_line_message, "cells", to_Message(_cells)), __cells), |
| 157 | 233 | |
| ... | ... | @@ -169,12 +245,15 @@ public define Maybe(HK_Editor_Table_Line) |
| 169 | 245 | if __type__ = "HK_Editor_Table_Line" then |
| 170 | 246 | //Alternative line |
| 171 | 247 | if __type_alt__ = "line" then //Alternative line |
| 248 | + // [type = List(HK_Editor_Table_Line_Attribute)] line.line_attr | |
| 249 | + with mb__line_attr_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Line_Attribute)) from_Message(msg), find_messages(_hk_editor_table_line_message, "line_attr")), | |
| 250 | + if mb__line_attr_ is {failure then failure, success(_line_attr_) then | |
| 172 | 251 | // [type = List(HK_Editor_Table_Cell)] line.cells |
| 173 | 252 | with mb__cells_ = map_escape(( Message msg ) |-> (Maybe(HK_Editor_Table_Cell)) from_Message(msg), find_messages(_hk_editor_table_line_message, "cells")), |
| 174 | 253 | if mb__cells_ is {failure then failure, success(_cells_) then |
| 175 | 254 | |
| 176 | - success(line(_cells_)) | |
| 177 | - } | |
| 255 | + success(line(_line_attr_, _cells_)) | |
| 256 | + }} | |
| 178 | 257 | else |
| 179 | 258 | failure //No valid Alternative found ! |
| 180 | 259 | else | ... | ... |
view/types/hk_form_table.anubis
| 1 | 1 | /* |
| 2 | 2 | * Created by 伝作 (Densaku). |
| 3 | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | - * Date: 2017-04-12 | |
| 5 | - * Time: 23:52:21 | |
| 4 | + * Date: 2017-04-19 | |
| 5 | + * Time: 15:54:06 | |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| ... | ... | @@ -38,9 +38,20 @@ public type HK_Form_Table_Cell: |
| 38 | 38 | . |
| 39 | 39 | |
| 40 | 40 | |
| 41 | +public type HK_Form_Line_Attribute: | |
| 42 | + colspan( | |
| 43 | + Int number | |
| 44 | + ), | |
| 45 | + rowspan( | |
| 46 | + Int number | |
| 47 | + ) | |
| 48 | +. | |
| 49 | + | |
| 50 | + | |
| 41 | 51 | public type HK_Form_Table_Line: |
| 42 | 52 | hk_form_table_line( |
| 43 | - List(HK_Form_Table_Cell) form_table_cells | |
| 53 | + List(HK_Form_Line_Attribute) line_attr, | |
| 54 | + List(HK_Form_Table_Cell) form_table_cells | |
| 44 | 55 | ) |
| 45 | 56 | . |
| 46 | 57 | |
| ... | ... | @@ -64,6 +75,8 @@ public type HK_Form_Table: |
| 64 | 75 | |
| 65 | 76 | |
| 66 | 77 | |
| 78 | + | |
| 79 | + | |
| 67 | 80 | HK_Form_Table_Attribute message format |
| 68 | 81 | ====================================== |
| 69 | 82 | ... | ... |