kredki 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/kredki/core/application.rb +314 -0
- data/lib/kredki/core/color.rb +100 -0
- data/lib/kredki/core/event/block_event_reaction.rb +44 -0
- data/lib/kredki/core/event/composite_event_manager.rb +37 -0
- data/lib/kredki/core/event/event.rb +91 -0
- data/lib/kredki/core/event/event_manager.rb +60 -0
- data/lib/kredki/core/event/event_manager_jobs.rb +53 -0
- data/lib/kredki/core/event/event_reaction.rb +36 -0
- data/lib/kredki/core/event/family/drop_event.rb +40 -0
- data/lib/kredki/core/event/family/exit_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_enter_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_leave_event.rb +5 -0
- data/lib/kredki/core/event/family/hide_event.rb +5 -0
- data/lib/kredki/core/event/family/joystick_event.rb +102 -0
- data/lib/kredki/core/event/family/key_event.rb +40 -0
- data/lib/kredki/core/event/family/mouse_event.rb +190 -0
- data/lib/kredki/core/event/family/pastele_event.rb +11 -0
- data/lib/kredki/core/event/family/show_event.rb +5 -0
- data/lib/kredki/core/event/family/text_event.rb +23 -0
- data/lib/kredki/core/event/family/tick_event.rb +5 -0
- data/lib/kredki/core/event/family/update_complete_event.rb +5 -0
- data/lib/kredki/core/event/family/window_event.rb +108 -0
- data/lib/kredki/core/event/job_event_reaction.rb +44 -0
- data/lib/kredki/core/event/joystick_event_manager.rb +30 -0
- data/lib/kredki/core/event/keyboard_event_manager.rb +29 -0
- data/lib/kredki/core/event/method_event_reaction.rb +46 -0
- data/lib/kredki/core/event/mouse_event_manager.rb +27 -0
- data/lib/kredki/core/font.rb +53 -0
- data/lib/kredki/core/job/after_job.rb +59 -0
- data/lib/kredki/core/job/job.rb +108 -0
- data/lib/kredki/core/job/loop_job.rb +87 -0
- data/lib/kredki/core/job/play_animation_job.rb +44 -0
- data/lib/kredki/core/job/play_job.rb +41 -0
- data/lib/kredki/core/job/play_loop_animation_job.rb +98 -0
- data/lib/kredki/core/job/play_loop_job.rb +104 -0
- data/lib/kredki/core/job/side_job.rb +62 -0
- data/lib/kredki/core/kernel-path.rb +71 -0
- data/lib/kredki/core/kredki.rb +89 -0
- data/lib/kredki/core/linear_gradient.rb +43 -0
- data/lib/kredki/core/media/clipboard.rb +35 -0
- data/lib/kredki/core/media/joystick.rb +199 -0
- data/lib/kredki/core/media/keyboard.rb +84 -0
- data/lib/kredki/core/media/keyboard_modifiers_decoder.rb +154 -0
- data/lib/kredki/core/media/mouse.rb +197 -0
- data/lib/kredki/core/paint/animation.rb +247 -0
- data/lib/kredki/core/paint/area.rb +67 -0
- data/lib/kredki/core/paint/block_shape_area.rb +102 -0
- data/lib/kredki/core/paint/ellipse.rb +22 -0
- data/lib/kredki/core/paint/paint.rb +392 -0
- data/lib/kredki/core/paint/picture.rb +126 -0
- data/lib/kredki/core/paint/rectangle.rb +202 -0
- data/lib/kredki/core/paint/scene.rb +277 -0
- data/lib/kredki/core/paint/shape.rb +394 -0
- data/lib/kredki/core/paint/shape_area.rb +57 -0
- data/lib/kredki/core/paint/text.rb +222 -0
- data/lib/kredki/core/pastele/pastele-extern.rb +139 -0
- data/lib/kredki/core/pastele/pastele.rb +205 -0
- data/lib/kredki/core/radial_gradient.rb +45 -0
- data/lib/kredki/core/setup.rb +214 -0
- data/lib/kredki/core/window/pane.rb +178 -0
- data/lib/kredki/core/window/pane_event_manager.rb +44 -0
- data/lib/kredki/core/window/pane_events.rb +366 -0
- data/lib/kredki/core/window/window.rb +584 -0
- data/lib/kredki/core.rb +2 -0
- data/lib/kredki/hide.rb +9 -0
- data/lib/kredki/irb.rb +90 -0
- data/lib/kredki/module.rb +3 -0
- data/lib/kredki/pads/application.rb +13 -0
- data/lib/kredki/pads/button.rb +151 -0
- data/lib/kredki/pads/checkbox/checkbox.rb +68 -0
- data/lib/kredki/pads/checkbox/checkbox_button.rb +65 -0
- data/lib/kredki/pads/context/item.rb +65 -0
- data/lib/kredki/pads/context/item_group.rb +10 -0
- data/lib/kredki/pads/context/layer.rb +59 -0
- data/lib/kredki/pads/context/menu.rb +77 -0
- data/lib/kredki/pads/context/pad.rb +26 -0
- data/lib/kredki/pads/context/primary_layer.rb +51 -0
- data/lib/kredki/pads/context/secondary_layer.rb +60 -0
- data/lib/kredki/pads/item/item.rb +140 -0
- data/lib/kredki/pads/item/item_group.rb +44 -0
- data/lib/kredki/pads/item/item_x.rb +22 -0
- data/lib/kredki/pads/item/item_y.rb +31 -0
- data/lib/kredki/pads/label.rb +71 -0
- data/lib/kredki/pads/layer.rb +326 -0
- data/lib/kredki/pads/layout/align.rb +10 -0
- data/lib/kredki/pads/layout/layout.rb +88 -0
- data/lib/kredki/pads/layout/way.rb +99 -0
- data/lib/kredki/pads/layout/x_way.rb +119 -0
- data/lib/kredki/pads/layout/y_way.rb +120 -0
- data/lib/kredki/pads/list/item.rb +117 -0
- data/lib/kredki/pads/list/item_group.rb +36 -0
- data/lib/kredki/pads/list/pad.rb +74 -0
- data/lib/kredki/pads/list/tree/item.rb +138 -0
- data/lib/kredki/pads/list/tree/item_group.rb +86 -0
- data/lib/kredki/pads/list/tree/pad.rb +94 -0
- data/lib/kredki/pads/module.rb +11 -0
- data/lib/kredki/pads/note.rb +212 -0
- data/lib/kredki/pads/notes.rb +32 -0
- data/lib/kredki/pads/option/option.rb +121 -0
- data/lib/kredki/pads/option/option_item.rb +15 -0
- data/lib/kredki/pads/option/option_item_group.rb +16 -0
- data/lib/kredki/pads/option/option_layer.rb +81 -0
- data/lib/kredki/pads/pad/animation_pad.rb +106 -0
- data/lib/kredki/pads/pad/glyph_pad.rb +71 -0
- data/lib/kredki/pads/pad/pad.rb +1290 -0
- data/lib/kredki/pads/pad/pad_events.rb +358 -0
- data/lib/kredki/pads/pad/picture_pad.rb +89 -0
- data/lib/kredki/pads/pad/rectangle_pad.rb +181 -0
- data/lib/kredki/pads/pad/scroll_pad.rb +176 -0
- data/lib/kredki/pads/pad/shape_pad.rb +148 -0
- data/lib/kredki/pads/pad/space_pad.rb +33 -0
- data/lib/kredki/pads/pad/text_pad.rb +310 -0
- data/lib/kredki/pads/pane.rb +267 -0
- data/lib/kredki/pads/portal_layer.rb +94 -0
- data/lib/kredki/pads/radio/group.rb +45 -0
- data/lib/kredki/pads/radio/item.rb +69 -0
- data/lib/kredki/pads/radio/item_button.rb +143 -0
- data/lib/kredki/pads/service/event_queue.rb +79 -0
- data/lib/kredki/pads/service/service.rb +248 -0
- data/lib/kredki/pads/service/service_event_manager.rb +43 -0
- data/lib/kredki/pads/service/service_filter.rb +98 -0
- data/lib/kredki/pads/service/service_inherited.rb +48 -0
- data/lib/kredki/pads/setup.rb +36 -0
- data/lib/kredki/pads/slider/slider.rb +145 -0
- data/lib/kredki/pads/slider/slider_x.rb +41 -0
- data/lib/kredki/pads/slider/slider_y.rb +41 -0
- data/lib/kredki/pads/table/cell.rb +22 -0
- data/lib/kredki/pads/table/column.rb +63 -0
- data/lib/kredki/pads/table/column_layout.rb +88 -0
- data/lib/kredki/pads/table/pad.rb +116 -0
- data/lib/kredki/pads/table/row.rb +24 -0
- data/lib/kredki/pads/table/scroll_rows.rb +50 -0
- data/lib/kredki/pads/text/editable_text_verse.rb +77 -0
- data/lib/kredki/pads/text/editable_text_verses.rb +59 -0
- data/lib/kredki/pads/text/navigable_text_pad.rb +413 -0
- data/lib/kredki/pads/text/text_edition.rb +97 -0
- data/lib/kredki/pads/text/text_navigation.rb +109 -0
- data/lib/kredki/pads/toolbar/item.rb +62 -0
- data/lib/kredki/pads/toolbar/item_group.rb +22 -0
- data/lib/kredki/pads/toolbar/layer.rb +41 -0
- data/lib/kredki/pads/toolbar/pad.rb +51 -0
- data/lib/kredki/pads/toolbar/primary_layer.rb +64 -0
- data/lib/kredki/pads/window.rb +11 -0
- data/lib/kredki/script.rb +29 -0
- data/lib/kredki/setup.rb +2 -0
- data/lib/kredki/test.rb +35 -0
- data/lib/kredki.rb +10 -0
- data/lib/readme.md +31 -0
- data/stuff/config/config.rb +431 -0
- data/stuff/config/pads_config.rb +111 -0
- data/stuff/dll/SDL3.dll +0 -0
- data/stuff/dll/pastele.dll +0 -0
- data/stuff/dll/thorvg-1.dll +0 -0
- data/stuff/font/MartianMono-StdRg.ttf +0 -0
- data/stuff/font/MavenPro-Medium.ttf +0 -0
- data/stuff/font/MavenPro-Regular.ttf +0 -0
- data/stuff/glyph/alert-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/alert-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/archivebox-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-ccw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-cw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-rectangle-path-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-4-way-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-ccw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-cw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-from-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-right-arrow-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-to-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-trend-down-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-trend-up-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-turn-down-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-down-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-up-arrow-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/at-sign-svgrepo-com.svg +4 -0
- data/stuff/glyph/bag-svgrepo-com.svg +4 -0
- data/stuff/glyph/bell-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/bell-svgrepo-com.svg +5 -0
- data/stuff/glyph/book-open-svgrepo-com.svg +5 -0
- data/stuff/glyph/bookmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/box-svgrepo-com.svg +6 -0
- data/stuff/glyph/calendar-svgrepo-com.svg +5 -0
- data/stuff/glyph/camera-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cart-svgrepo-com.svg +6 -0
- data/stuff/glyph/chart-pie-svgrepo-com.svg +5 -0
- data/stuff/glyph/chartbar-2-svgrepo-com.svg +7 -0
- data/stuff/glyph/chartbar-svgrepo-com.svg +7 -0
- data/stuff/glyph/checkmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-double-svgrepo-com.svg +5 -0
- data/stuff/glyph/checkmark-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-left-chevron-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-up-chevron-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/clock-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-download-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-slash-svgrepo-com.svg +5 -0
- data/stuff/glyph/cloud-svgrepo-com.svg +4 -0
- data/stuff/glyph/columns-svgrepo-com.svg +5 -0
- data/stuff/glyph/command-svgrepo-com.svg +4 -0
- data/stuff/glyph/compass-svgrepo-com.svg +5 -0
- data/stuff/glyph/credit-card-svgrepo-com.svg +5 -0
- data/stuff/glyph/crop-svgrepo-com.svg +5 -0
- data/stuff/glyph/crown-svgrepo-com.svg +4 -0
- data/stuff/glyph/delete-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-desktop-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-mobile-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-tablet-svgrepo-com.svg +4 -0
- data/stuff/glyph/doc-svgrepo-com.svg +5 -0
- data/stuff/glyph/dot-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/dots-3-horizontal-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-3-vertical-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-6-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-6-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-9-svgrepo-com.svg +12 -0
- data/stuff/glyph/emoji-frown-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-meh-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-smile-svgrepo-com.svg +4 -0
- data/stuff/glyph/envelope-svgrepo-com.svg +5 -0
- data/stuff/glyph/external-link-svgrepo-com.svg +5 -0
- data/stuff/glyph/eye-slash-svgrepo-com.svg +15 -0
- data/stuff/glyph/eye-svgrepo-com.svg +4 -0
- data/stuff/glyph/filter-svgrepo-com.svg +4 -0
- data/stuff/glyph/flame-svgrepo-com.svg +4 -0
- data/stuff/glyph/floppy-disk-svgrepo-com.svg +4 -0
- data/stuff/glyph/folder-svgrepo-com.svg +4 -0
- data/stuff/glyph/fullscreen-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-svgrepo-com.svg +5 -0
- data/stuff/glyph/fullscreen-svgrepo-com.svg +5 -0
- data/stuff/glyph/gear-svgrepo-com.svg +4 -0
- data/stuff/glyph/giftbox-svgrepo-com.svg +6 -0
- data/stuff/glyph/half-star-svgrepo-com.svg +4 -0
- data/stuff/glyph/hashtag-svgrepo-com.svg +4 -0
- data/stuff/glyph/headphones-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-half-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-svgrepo-com.svg +4 -0
- data/stuff/glyph/house-svgrepo-com.svg +4 -0
- data/stuff/glyph/image-svgrepo-com.svg +4 -0
- data/stuff/glyph/info-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/key-svgrepo-com.svg +4 -0
- data/stuff/glyph/layers-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/layout-svgrepo-com.svg +6 -0
- data/stuff/glyph/line-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/link-alt-svgrepo-com.svg +5 -0
- data/stuff/glyph/link-svgrepo-com.svg +6 -0
- data/stuff/glyph/list-bullet-svgrepo-com.svg +9 -0
- data/stuff/glyph/location-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-open-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-svgrepo-com.svg +4 -0
- data/stuff/glyph/map-pin-svgrepo-com.svg +4 -0
- data/stuff/glyph/medal-svgrepo-com.svg +13 -0
- data/stuff/glyph/media-backward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-backward-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-play-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-play-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-2-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-svgrepo-com.svg +4 -0
- data/stuff/glyph/mic-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/mic-svgrepo-com.svg +5 -0
- data/stuff/glyph/minus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-svgrepo-com.svg +4 -0
- data/stuff/glyph/moon-svgrepo-com.svg +4 -0
- data/stuff/glyph/music-note-svgrepo-com.svg +4 -0
- data/stuff/glyph/nosign-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-clip-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-plane-svgrepo-com.svg +4 -0
- data/stuff/glyph/pen-tool-svgrepo-com.svg +4 -0
- data/stuff/glyph/pencil-svgrepo-com.svg +5 -0
- data/stuff/glyph/percent-svgrepo-com.svg +6 -0
- data/stuff/glyph/phone-incoming-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-missed-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-outgoing-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-slash-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-svgrepo-com.svg +4 -0
- data/stuff/glyph/power-svgrepo-com.svg +5 -0
- data/stuff/glyph/printer-svgrepo-com.svg +5 -0
- data/stuff/glyph/question-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/scissors-svgrepo-com.svg +5 -0
- data/stuff/glyph/search-svgrepo-com.svg +4 -0
- data/stuff/glyph/server-svgrepo-com.svg +5 -0
- data/stuff/glyph/shape-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-rhombus-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/share-svgrepo-com.svg +4 -0
- data/stuff/glyph/shield-slash-svgrepo-com.svg +13 -0
- data/stuff/glyph/shield-svgrepo-com.svg +4 -0
- data/stuff/glyph/shippingbox-svgrepo-com.svg +7 -0
- data/stuff/glyph/slider-3-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/slider-3-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/speaker-svgrepo-com.svg +4 -0
- data/stuff/glyph/speaker-wave-1-svgrepo-com.svg +5 -0
- data/stuff/glyph/speaker-wave-2-svgrepo-com.svg +6 -0
- data/stuff/glyph/speaker-xmark-svgrepo-com.svg +5 -0
- data/stuff/glyph/square-4-grid-svgrepo-com.svg +7 -0
- data/stuff/glyph/square-on-square-svgrepo-com.svg +5 -0
- data/stuff/glyph/star-svgrepo-com.svg +4 -0
- data/stuff/glyph/sun-svgrepo-com.svg +12 -0
- data/stuff/glyph/tag-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-align-center-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-justify-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-left-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-right-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-bold-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-heading-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-italic-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-underline-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/trash-svgrepo-com.svg +5 -0
- data/stuff/glyph/tray-svgrepo-com.svg +4 -0
- data/stuff/glyph/umbrela-svgrepo-com.svg +4 -0
- data/stuff/glyph/user-svgrepo-com.svg +5 -0
- data/stuff/glyph/users-svgrepo-com.svg +7 -0
- data/stuff/glyph/video-svgrepo-com.svg +12 -0
- data/stuff/glyph/waveform-ecg-svgrepo-com.svg +4 -0
- data/stuff/glyph/wi-fi-svgrepo-com.svg +7 -0
- data/stuff/glyph/xmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/zap-svgrepo-com.svg +4 -0
- data/stuff/glyph/zoom-in-svgrepo-com.svg +5 -0
- data/stuff/glyph/zoom-out-svgrepo-com.svg +5 -0
- data/stuff/readme.md +266 -0
- data/stuff/so/libSDL3.so +0 -0
- data/stuff/so/libpastele.so +0 -0
- data/stuff/so/libthorvg-1.so +0 -0
- metadata +427 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
module Pads
|
|
3
|
+
class NavigableTextPad < TextPad
|
|
4
|
+
|
|
5
|
+
# Set subject.
|
|
6
|
+
def set_subject subject = @subject, cursor_position = 0, &b
|
|
7
|
+
if super(subject, &b) && @selection.size != @verses.size
|
|
8
|
+
@selection.clear
|
|
9
|
+
@verses.each{ @selection.new_rectangle fill: :text_selection, size_x: 0 }
|
|
10
|
+
end
|
|
11
|
+
update_cursor cursor_position
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Set font.
|
|
15
|
+
def set_font font = @verses.first.font
|
|
16
|
+
return send_bundle :set_font, yield(self.font) if block_given?
|
|
17
|
+
@verses.count{ _1.set_font font }.nonzero?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# See #set_font.
|
|
21
|
+
def font= param
|
|
22
|
+
send_bundle :set_font, param
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Get font
|
|
26
|
+
def font
|
|
27
|
+
@verses.first.text.font
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Get whether any text is selected.
|
|
31
|
+
def any_selected
|
|
32
|
+
@selection_start != @selection_end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get selected content.
|
|
36
|
+
def selected_content
|
|
37
|
+
text[@selection_start...@selection_end]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Set select range.
|
|
41
|
+
def select min, max
|
|
42
|
+
@selection_start = min
|
|
43
|
+
@selection_end = @cursor_position = max
|
|
44
|
+
layer&.break_layout
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# :section: LEVEL 2
|
|
48
|
+
|
|
49
|
+
attr :selection_start, :selection_end, :cursor
|
|
50
|
+
attr_accessor :cursor_position
|
|
51
|
+
|
|
52
|
+
def update_cursor position = 0
|
|
53
|
+
@cursor_position = @selection_start = @selection_end = position
|
|
54
|
+
layer&.break_layout
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def drag x, y
|
|
58
|
+
cursor_position = cursor_position_for_coordinates x, y
|
|
59
|
+
if cursor_position != @cursor_position
|
|
60
|
+
if @cursor_position == @selection_start
|
|
61
|
+
if cursor_position <= @selection_end
|
|
62
|
+
@selection_start = @cursor_position = cursor_position
|
|
63
|
+
else
|
|
64
|
+
@selection_start = @selection_end
|
|
65
|
+
@selection_end = @cursor_position = cursor_position
|
|
66
|
+
end
|
|
67
|
+
elsif @cursor_position == @selection_end
|
|
68
|
+
if cursor_position >= @selection_start
|
|
69
|
+
@selection_end = @cursor_position = cursor_position
|
|
70
|
+
else
|
|
71
|
+
@selection_end = @selection_start
|
|
72
|
+
@selection_start = @cursor_position = cursor_position
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
layer&.break_layout
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def cursor_left shift
|
|
80
|
+
if shift
|
|
81
|
+
if @cursor_position > 0
|
|
82
|
+
if @cursor_position == @selection_start
|
|
83
|
+
@selection_start = @cursor_position -= 1
|
|
84
|
+
elsif @cursor_position == @selection_end
|
|
85
|
+
@selection_end = @cursor_position -= 1
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
else
|
|
89
|
+
if @selection_start == @selection_end
|
|
90
|
+
@cursor_position -= 1 if @cursor_position > 0
|
|
91
|
+
@selection_start = @selection_end = @cursor_position
|
|
92
|
+
else
|
|
93
|
+
@cursor_position = @selection_end = @selection_start
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
layer&.break_layout
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def cursor_right shift
|
|
100
|
+
length = text.length
|
|
101
|
+
if shift
|
|
102
|
+
if @cursor_position < length
|
|
103
|
+
if @cursor_position == @selection_end
|
|
104
|
+
@selection_end = @cursor_position += 1
|
|
105
|
+
elsif @cursor_position == @selection_start
|
|
106
|
+
@selection_start = @cursor_position += 1
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
else
|
|
110
|
+
if @selection_start == @selection_end
|
|
111
|
+
@cursor_position += 1 if @cursor_position < length
|
|
112
|
+
@selection_start = @selection_end = @cursor_position
|
|
113
|
+
else
|
|
114
|
+
@cursor_position = @selection_start = @selection_end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
layer&.break_layout
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
attr :selection
|
|
121
|
+
|
|
122
|
+
def initialize
|
|
123
|
+
super
|
|
124
|
+
|
|
125
|
+
@cursor_position = @selection_start = @selection_end = 0
|
|
126
|
+
@selection = @scene.new_scene
|
|
127
|
+
@cursor = @scene.new_rectangle fill: :text, size_x: 1, scenic: false
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def mouse_press e
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def fit_size_x
|
|
134
|
+
super + @cursor.size_x * 2
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def update_size x, y # update_size must be called before get_x/get_y
|
|
138
|
+
super
|
|
139
|
+
update_cursor_location if @cursor.displayed
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def get_x clip_size, size, ax
|
|
143
|
+
if @cursor.displayed
|
|
144
|
+
cx = @cursor.x + @cursor.size_x
|
|
145
|
+
if area_x + cx > size
|
|
146
|
+
size - cx - @cursor.size_x / 2
|
|
147
|
+
elsif area_x + @cursor.x < 0
|
|
148
|
+
@cursor.size_x / 2 - @cursor.x
|
|
149
|
+
else
|
|
150
|
+
area_x
|
|
151
|
+
end
|
|
152
|
+
else
|
|
153
|
+
super
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def get_y clip_size, size, ay
|
|
158
|
+
if @cursor.displayed
|
|
159
|
+
cy = cursor.y + cursor.size_y
|
|
160
|
+
if area_y + cy > size
|
|
161
|
+
size - cy
|
|
162
|
+
elsif area_y + cursor.y < 0
|
|
163
|
+
-cursor.y
|
|
164
|
+
else
|
|
165
|
+
area_y
|
|
166
|
+
end
|
|
167
|
+
else
|
|
168
|
+
super
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def align_x reference_size_x, size_x
|
|
173
|
+
case @verse_layout
|
|
174
|
+
when :yss, :ysc, :yse
|
|
175
|
+
@cursor.size_x
|
|
176
|
+
when :yes, :yec, :yee
|
|
177
|
+
size_x - reference_size_x - @cursor.size_x
|
|
178
|
+
when :ycs, :ycc, :yce
|
|
179
|
+
(size_x - reference_size_x + @cursor.size_x) * 0.5
|
|
180
|
+
else raise_is @verse_layout
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def cursor_position_for_coordinates x, y
|
|
185
|
+
total = 0
|
|
186
|
+
last = @verses.last
|
|
187
|
+
@verses.each do |verse|
|
|
188
|
+
if verse.y + verse.size_y < y && verse != last
|
|
189
|
+
total += verse.content.length + 1
|
|
190
|
+
else
|
|
191
|
+
return total + verse.nearest_character_index(x - verse.x + 2)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
total > 0 ? total - 1 : 0
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def arrange_verses
|
|
198
|
+
sx, sy = area_size
|
|
199
|
+
size_v, space = verse_metrics sy
|
|
200
|
+
@cursor.set_size_y size_v
|
|
201
|
+
if @verses.size > 0
|
|
202
|
+
size_t = (size_v + space) * @verses.size - space
|
|
203
|
+
y = align_y size_t, sy
|
|
204
|
+
@verses.each do |v|
|
|
205
|
+
v.set_size_y size_v
|
|
206
|
+
x = align_x v.size_x, sx
|
|
207
|
+
v.set_xy x.floor, y.floor
|
|
208
|
+
y += size_v + space
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
true
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def scroll x, y
|
|
215
|
+
if @verses.size > 0
|
|
216
|
+
sx, sy = area_size
|
|
217
|
+
|
|
218
|
+
scene_x = if x == 0
|
|
219
|
+
@scene.x
|
|
220
|
+
else
|
|
221
|
+
fit = fit_size_x
|
|
222
|
+
x0 = align_x fit, sx
|
|
223
|
+
fit > sx ? (@scene.x + x).clamp(sx - fit - x0..-x0) : @scene.x
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
scene_y = if y == 0
|
|
227
|
+
@scene.y
|
|
228
|
+
else
|
|
229
|
+
size_v, space = verse_metrics sy
|
|
230
|
+
reference_size_y = (size_v + space) * @verses.size - space
|
|
231
|
+
y0 = align_y reference_size_y, sy
|
|
232
|
+
reference_size_y > sy ? (@scene.y + y).clamp(sy - reference_size_y - y0..-y0) : @scene.y
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
@scene.set_xy scene_x.floor, scene_y.floor
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def process_drag e, speed = 1
|
|
240
|
+
sx, sy = area_size
|
|
241
|
+
|
|
242
|
+
reference_size_x = fit_size_x
|
|
243
|
+
x0 = align_x reference_size_x, sx
|
|
244
|
+
@sx0 = @scene.x if e.start? || !@sx0
|
|
245
|
+
scene_x = reference_size_x > sx ? (@sx0 + (e.x - layer.pin_xy[0]) * speed).clamp(sx - reference_size_x - x0..-x0) : @scene.x
|
|
246
|
+
|
|
247
|
+
size_v, space = verse_metrics sy
|
|
248
|
+
reference_size_y = (size_v + space) * @verses.size - space
|
|
249
|
+
y0 = align_y reference_size_y, sy
|
|
250
|
+
@sy0 = @scene.y if e.start? || !@sy0
|
|
251
|
+
scene_y = reference_size_y > sy ? (@sy0 + (e.y - layer.pin_xy[1]) * speed).clamp(sy - reference_size_y - y0..-y0) : @scene.y
|
|
252
|
+
|
|
253
|
+
@scene.set_xy scene_x.floor, scene_y.floor
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def update_cursor_location
|
|
257
|
+
total = -1
|
|
258
|
+
@cursor.set_xy align_x(@cursor.size_x * 0.5, area_size_x).floor, align_y(@cursor.size_y, area_size_y).floor
|
|
259
|
+
@verses.each do |verse|
|
|
260
|
+
total += 1
|
|
261
|
+
if @cursor_position <= total + verse.content.length
|
|
262
|
+
x = verse.substring_width @cursor_position - total
|
|
263
|
+
@cursor.set_xy (x + verse.x - @cursor.size_x * 0.5).floor, verse.y.floor
|
|
264
|
+
break
|
|
265
|
+
end
|
|
266
|
+
total += verse.content.length
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
total = -1
|
|
270
|
+
@verses.zip @selection.each_paint do |v, s|
|
|
271
|
+
total += 1
|
|
272
|
+
next_total = total + v.content.length
|
|
273
|
+
if @selection_start == @selection_end || @selection_start > next_total || @selection_end <= total
|
|
274
|
+
s.set_size_x 0
|
|
275
|
+
elsif @selection_start <= total && @selection_end >= next_total
|
|
276
|
+
s.set_size *v.size
|
|
277
|
+
s.set_xy *v.xy
|
|
278
|
+
elsif @selection_end >= next_total
|
|
279
|
+
x1 = v.substring_width @selection_start - total
|
|
280
|
+
s.set_size v.size_x - x1, v.size_y
|
|
281
|
+
s.set_xy v.x + x1, v.y
|
|
282
|
+
elsif @selection_start <= total
|
|
283
|
+
x1 = v.substring_width @selection_end - total
|
|
284
|
+
s.set_size x1, v.size_y
|
|
285
|
+
s.set_xy *v.xy
|
|
286
|
+
else
|
|
287
|
+
x1 = v.substring_width @selection_start - total
|
|
288
|
+
x2 = v.substring_width @selection_end - total
|
|
289
|
+
s.set_size x2 - x1, v.size_y
|
|
290
|
+
s.set_xy v.x + x1, v.y
|
|
291
|
+
end
|
|
292
|
+
total = next_total
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def cursor_up shift
|
|
297
|
+
prev_v = nil
|
|
298
|
+
cursor_position = @verses.reduce -1 do |total, v|
|
|
299
|
+
total += 1
|
|
300
|
+
if total + v.content.length >= @cursor_position
|
|
301
|
+
break prev_v ? total - prev_v.content.length + prev_v.nearest_character_index(@cursor.x - prev_v.x) - 1 : 0
|
|
302
|
+
end
|
|
303
|
+
prev_v = v
|
|
304
|
+
total + v.content.length
|
|
305
|
+
end
|
|
306
|
+
if shift
|
|
307
|
+
if @cursor_position == @selection_start
|
|
308
|
+
@selection_start = @cursor_position = cursor_position
|
|
309
|
+
elsif cursor_position >= @selection_start
|
|
310
|
+
@selection_end = @cursor_position = cursor_position
|
|
311
|
+
else
|
|
312
|
+
@selection_end = @selection_start
|
|
313
|
+
@selection_start = @cursor_position = cursor_position
|
|
314
|
+
end
|
|
315
|
+
else
|
|
316
|
+
if @selection_start == @selection_end
|
|
317
|
+
@selection_start = @selection_end = @cursor_position = cursor_position
|
|
318
|
+
else
|
|
319
|
+
@cursor_position = @selection_end = @selection_start
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
@scene.x = 0
|
|
323
|
+
layer&.break_layout
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
def cursor_down shift
|
|
327
|
+
cursor_position = @verses.reduce -1 do |total, v|
|
|
328
|
+
total += 1
|
|
329
|
+
if total > @cursor_position
|
|
330
|
+
break total + v.nearest_character_index(@cursor.x - v.x)
|
|
331
|
+
end
|
|
332
|
+
total + v.content.length
|
|
333
|
+
end
|
|
334
|
+
if shift
|
|
335
|
+
if @cursor_position == @selection_end
|
|
336
|
+
@selection_end = @cursor_position = cursor_position
|
|
337
|
+
elsif cursor_position <= @selection_end
|
|
338
|
+
@selection_start = @cursor_position = cursor_position
|
|
339
|
+
else
|
|
340
|
+
@selection_start = @selection_end
|
|
341
|
+
@selection_end = @cursor_position = cursor_position
|
|
342
|
+
end
|
|
343
|
+
else
|
|
344
|
+
if @selection_start == @selection_end
|
|
345
|
+
@selection_start = @selection_end = @cursor_position = cursor_position
|
|
346
|
+
else
|
|
347
|
+
@cursor_position = @selection_start = @selection_end
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
@scene.x = 0
|
|
351
|
+
layer&.break_layout
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
def cursor_home shift, ctrl
|
|
355
|
+
cursor_position = if ctrl
|
|
356
|
+
0
|
|
357
|
+
else
|
|
358
|
+
@verses.reduce -1 do |total, v|
|
|
359
|
+
length = v.content.length
|
|
360
|
+
total += 1
|
|
361
|
+
break total if total + length >= @cursor_position
|
|
362
|
+
total + length
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
if shift
|
|
367
|
+
if @cursor_position == @selection_end
|
|
368
|
+
if cursor_position <= @selection_start
|
|
369
|
+
@selection_end = @selection_start
|
|
370
|
+
@selection_start = cursor_position
|
|
371
|
+
else
|
|
372
|
+
@selection_end = cursor_position
|
|
373
|
+
end
|
|
374
|
+
else
|
|
375
|
+
@selection_start = cursor_position
|
|
376
|
+
end
|
|
377
|
+
@cursor_position = cursor_position
|
|
378
|
+
layer&.break_layout
|
|
379
|
+
else
|
|
380
|
+
update_cursor cursor_position
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def cursor_end shift, ctrl
|
|
385
|
+
cursor_position = if ctrl
|
|
386
|
+
text.length
|
|
387
|
+
else
|
|
388
|
+
@verses.reduce -1 do |total, v|
|
|
389
|
+
break total if total >= @cursor_position
|
|
390
|
+
total + 1 + v.content.length
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
if shift
|
|
395
|
+
if @cursor_position == @selection_start
|
|
396
|
+
if cursor_position >= @selection_end
|
|
397
|
+
@selection_start = @selection_end
|
|
398
|
+
@selection_end = cursor_position
|
|
399
|
+
else
|
|
400
|
+
@selection_start = cursor_position
|
|
401
|
+
end
|
|
402
|
+
else
|
|
403
|
+
@selection_end = cursor_position
|
|
404
|
+
end
|
|
405
|
+
@cursor_position = cursor_position
|
|
406
|
+
layer&.break_layout
|
|
407
|
+
else
|
|
408
|
+
update_cursor cursor_position
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
require_relative 'text_navigation'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pads
|
|
5
|
+
# Common event reactions for text edition.
|
|
6
|
+
module TextEdition
|
|
7
|
+
include TextNavigation
|
|
8
|
+
|
|
9
|
+
class EditEvent < Event
|
|
10
|
+
def param
|
|
11
|
+
string
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# :section: LEVEL 2
|
|
15
|
+
|
|
16
|
+
def initialize selection_start, selection_end, string, inset, action
|
|
17
|
+
super()
|
|
18
|
+
@selection_start = selection_start
|
|
19
|
+
@selection_end = selection_end
|
|
20
|
+
@string = string
|
|
21
|
+
@inset = inset
|
|
22
|
+
@action = action
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
attr_accessor :selection_start
|
|
26
|
+
attr_accessor :selection_end
|
|
27
|
+
attr_accessor :string
|
|
28
|
+
attr_accessor :inset
|
|
29
|
+
attr_accessor :action
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def on_edit ...
|
|
33
|
+
on(EditEvent, ...)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def text_edition text, multiline
|
|
37
|
+
text_navigation text
|
|
38
|
+
|
|
39
|
+
on_key_press :backspace do |e|
|
|
40
|
+
text.backspace
|
|
41
|
+
e.close
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
on_key_press :delete do |e|
|
|
45
|
+
text.delete
|
|
46
|
+
e.close
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
on_text_input do |e|
|
|
50
|
+
text.paste e.param
|
|
51
|
+
e.close
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
on_key_press :v do |e|
|
|
55
|
+
if e.ctrl?
|
|
56
|
+
text.paste Kredki.clipboard.content
|
|
57
|
+
e.close
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
on_key_press :x do |e|
|
|
62
|
+
if e.ctrl? && (text.any_selected || e.shift?)
|
|
63
|
+
s = e.shift? ? clipboard.content : ""
|
|
64
|
+
Kredki.clipboard.content = text.selected_content if text.any_selected
|
|
65
|
+
text.paste s
|
|
66
|
+
e.close
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
on_mouse_move do |e|
|
|
71
|
+
if e.drop?
|
|
72
|
+
text.drop_move *text.layer.translate(*e.xy, text)
|
|
73
|
+
e.close
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
on_drop do |e|
|
|
78
|
+
text.paste e.param
|
|
79
|
+
e.close
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
on_edit early: true do |e|
|
|
83
|
+
cursor_position = e.inset.length + e.selection_start
|
|
84
|
+
text.edit e.string, cursor_position
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
if multiline
|
|
88
|
+
on_key_press :enter do |e|
|
|
89
|
+
text.paste "\n"
|
|
90
|
+
e.close
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
module Pads
|
|
3
|
+
# Common event reactions for text navigation.
|
|
4
|
+
module TextNavigation
|
|
5
|
+
|
|
6
|
+
def text_navigation text
|
|
7
|
+
|
|
8
|
+
on_key_press :up do |e|
|
|
9
|
+
text.cursor_up e.shift?
|
|
10
|
+
e.close
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
on_key_press :down do |e|
|
|
14
|
+
text.cursor_down e.shift?
|
|
15
|
+
e.close
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
on_key_press :left do |e|
|
|
19
|
+
text.cursor_left e.shift?
|
|
20
|
+
e.close
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
on_key_press :right do |e|
|
|
24
|
+
text.cursor_right e.shift?
|
|
25
|
+
e.close
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
on_key_press :home do |e|
|
|
29
|
+
text.cursor_home e.shift?, e.ctrl?
|
|
30
|
+
e.close
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
on_key_press :keypad_seven do |e|
|
|
34
|
+
unless e.num_lock?
|
|
35
|
+
text.cursor_home e.shift?, e.ctrl?
|
|
36
|
+
e.close
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
on_key_press :end do |e|
|
|
41
|
+
text.cursor_end e.shift?, e.ctrl?
|
|
42
|
+
e.close
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
on_key_press :keypad_one do |e|
|
|
46
|
+
unless e.num_lock?
|
|
47
|
+
text.cursor_end e.shift?, e.ctrl?
|
|
48
|
+
e.close
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
on_key_press :a do |e|
|
|
53
|
+
if e.ctrl?
|
|
54
|
+
text.select 0, text.content.length
|
|
55
|
+
e.close
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
on_key_press :c do |e|
|
|
60
|
+
if e.ctrl? && text.any_selected
|
|
61
|
+
Kredki.clipboard.content = text.selected_content
|
|
62
|
+
e.close
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
on_mouse_press :primary do |e|
|
|
67
|
+
if Kredki.keyboard.shift?
|
|
68
|
+
text.drag *text.layer.translate(*e.xy, text)
|
|
69
|
+
else
|
|
70
|
+
if layer.mouse_click_combo(e) == 1
|
|
71
|
+
sl = text.text.to_s.length
|
|
72
|
+
unless text.cursor_position == sl && text.selection_start == 0 && sl == text.selection_end
|
|
73
|
+
text.select 0, sl
|
|
74
|
+
e.close
|
|
75
|
+
end
|
|
76
|
+
else
|
|
77
|
+
cursor_position = text.cursor_position_for_coordinates *text.layer.translate(*e.xy, text)
|
|
78
|
+
text.update_cursor cursor_position
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
on_mouse_move do |e|
|
|
84
|
+
if e.drag? && e.button == :primary
|
|
85
|
+
text.drag *text.layer.translate(*e.xy, text)
|
|
86
|
+
e.close
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
on_mouse_release do |e|
|
|
91
|
+
if e.drag
|
|
92
|
+
text.cursor_position = text.cursor_position_for_coordinates *text.layer.translate(*e.xy, text)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
on_focus_leave do |e|
|
|
97
|
+
text.cursor.set_scenic false
|
|
98
|
+
layer&.break_layout
|
|
99
|
+
e.close
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
on_focus_enter do |e|
|
|
103
|
+
text.cursor.set_scenic
|
|
104
|
+
e.close
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_relative '../item/item_x'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pads
|
|
5
|
+
module Toolbar
|
|
6
|
+
class Item < Pads::ItemX
|
|
7
|
+
|
|
8
|
+
# Add submenu item.
|
|
9
|
+
def item!(...)
|
|
10
|
+
dropdown!.item_group.item!(...)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Create/Update dropdown.
|
|
14
|
+
def dropdown! ...
|
|
15
|
+
(find PrimaryLayer or put PrimaryLayer).set(...)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# See #dropdown!.
|
|
19
|
+
def dropdown= param
|
|
20
|
+
send_bundle :dropdown!, param
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Get dropdown.
|
|
24
|
+
def dropdown
|
|
25
|
+
find PrimaryLayer
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# :section: LEVEL 2
|
|
29
|
+
|
|
30
|
+
def sketch
|
|
31
|
+
super
|
|
32
|
+
|
|
33
|
+
set_margin_x 5
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def behavior
|
|
37
|
+
super
|
|
38
|
+
|
|
39
|
+
on_key_press :down, :up, :enter, :space do |e|
|
|
40
|
+
layer = find PrimaryLayer
|
|
41
|
+
if layer
|
|
42
|
+
layer.load self unless layer.loaded
|
|
43
|
+
layer.find_upper(Context::Item)&.keyboard_request and e.close
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
on_mouse_click do |e|
|
|
48
|
+
layer = find_upper PrimaryLayer
|
|
49
|
+
layer.load self if layer && !layer.loaded
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def mouse_enter e
|
|
54
|
+
super
|
|
55
|
+
layer = find_upper PrimaryLayer
|
|
56
|
+
layer.update_keyboard_pad nil if layer&.loaded
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end#Item
|
|
60
|
+
end#Toolbar
|
|
61
|
+
end#Pads
|
|
62
|
+
end#Kredki
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative '../item/item_group'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pads
|
|
5
|
+
module Toolbar
|
|
6
|
+
# Toolbar menu item group.
|
|
7
|
+
class ItemGroup < Pads::ItemGroup
|
|
8
|
+
|
|
9
|
+
# Add menu item.
|
|
10
|
+
def item! *a, **ka, &b
|
|
11
|
+
put Item, __method__, *a, size_x: Fit, **ka, &b
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# :section: LEVEL 2
|
|
15
|
+
|
|
16
|
+
def mouse_enter pad
|
|
17
|
+
pad.keyboard_request if lower.keyboard_in && find_upper(Item){|it| it.keyboard_in } != pad
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|