Mercurial Hosting > editor
changeset 40:38bc1cdf77c8 default tip
add align windows
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 15 May 2025 19:12:46 -0600 |
parents | 2a3092ca528e |
children | |
files | src/luan_editor/menu.luan |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 2a3092ca528e -r 38bc1cdf77c8 src/luan_editor/menu.luan --- a/src/luan_editor/menu.luan Thu May 15 16:24:04 2025 -0600 +++ b/src/luan_editor/menu.luan Thu May 15 19:12:46 2025 -0600 @@ -1,5 +1,6 @@ local Luan = require "luan:Luan.luan" local error = Luan.error +local ipairs = Luan.ipairs or error() local String = require "luan:String.luan" local to_number = String.to_number or error() local new_menu_item = require("luan:swing/Menu_item.luan").new or error() @@ -11,6 +12,8 @@ local Option_pane = require "luan:swing/Option_pane.luan" local show_message_dialog = Option_pane.show_message_dialog or error() local show_input_dialog = Option_pane.show_input_dialog or error() +local Frame = require "luan:swing/Frame.luan" +local get_all_frames = Frame.get_all_frames or error() local Spell_checker = require "classpath:luan_editor/Spell_checker.luan" local spell_check = Spell_checker.spell_check or error() @@ -230,6 +233,18 @@ text = "Duplicate Window" action_listener = action_listener(window.duplicate) } + new_menu_item{ + text = "Align Windows" + action_listener = function(_) + local this_frame = window.frame + local location = this_frame.location + local size = this_frame.size + for _, frame in ipairs(get_all_frames()) do + frame.location = location + frame.size = size + end + end + } } } }