Mercurial Hosting > editor
comparison editor.luan @ 2:f38f6e903369
word wrap in menu
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 31 Mar 2025 17:00:20 -0600 |
| parents | 9aa38deb5883 |
| children | a79a840691b1 |
comparison
equal
deleted
inserted
replaced
| 1:9aa38deb5883 | 2:f38f6e903369 |
|---|---|
| 9 local new_scroll_pane = require("luan:swing/Scroll_pane.luan").new or error() | 9 local new_scroll_pane = require("luan:swing/Scroll_pane.luan").new or error() |
| 10 local new_list = require("luan:swing/List.luan").new or error() | 10 local new_list = require("luan:swing/List.luan").new or error() |
| 11 local new_menu_bar = require("luan:swing/Menu_bar.luan").new or error() | 11 local new_menu_bar = require("luan:swing/Menu_bar.luan").new or error() |
| 12 local new_menu = require("luan:swing/Menu.luan").new or error() | 12 local new_menu = require("luan:swing/Menu.luan").new or error() |
| 13 local new_menu_item = require("luan:swing/Menu_item.luan").new or error() | 13 local new_menu_item = require("luan:swing/Menu_item.luan").new or error() |
| 14 local new_check_box_menu_item = require("luan:swing/Check_box_menu_item.luan").new or error() | |
| 14 local Logging = require "luan:logging/Logging.luan" | 15 local Logging = require "luan:logging/Logging.luan" |
| 15 local logger = Logging.logger "editor" | 16 local logger = Logging.logger "editor" |
| 16 | 17 |
| 17 | 18 |
| 18 local new_window | 19 local new_window |
| 42 new_window(file) | 43 new_window(file) |
| 43 end | 44 end |
| 44 end) | 45 end) |
| 45 file_menu.add(open) | 46 file_menu.add(open) |
| 46 menu_bar.add(file_menu) | 47 menu_bar.add(file_menu) |
| 48 local view_menu = new_menu() | |
| 49 view_menu.text = "View" | |
| 50 local word_wrap = new_check_box_menu_item() | |
| 51 word_wrap.text = "Word Wrap" | |
| 52 word_wrap.state = window.text_area.line_wrap | |
| 53 word_wrap.add_action_listener(function() | |
| 54 window.text_area.line_wrap = word_wrap.state | |
| 55 end) | |
| 56 view_menu.add(word_wrap) | |
| 57 menu_bar.add(view_menu) | |
| 47 return menu_bar | 58 return menu_bar |
| 48 end | 59 end |
| 49 | 60 |
| 50 local n_windows = 0 | 61 local n_windows = 0 |
| 51 | 62 |
| 78 --scroll_pane.set_row_header_view(list) | 89 --scroll_pane.set_row_header_view(list) |
| 79 frame.add(scroll_pane) | 90 frame.add(scroll_pane) |
| 80 local window = { | 91 local window = { |
| 81 frame = frame | 92 frame = frame |
| 82 file = file | 93 file = file |
| 94 text_area = text_area | |
| 83 } | 95 } |
| 84 local menu_bar = make_menu_bar(window) | 96 local menu_bar = make_menu_bar(window) |
| 85 frame.set_menu_bar(menu_bar) | 97 frame.set_menu_bar(menu_bar) |
| 86 frame.pack() | 98 frame.pack() |
| 87 frame.visible = true | 99 frame.visible = true |
