Mercurial Hosting > editor
comparison editor.luan @ 26:ba895419fb04
work
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 10 Apr 2025 18:49:26 -0600 |
| parents | ce3d1dc406a8 |
| children | 32232df78246 |
comparison
equal
deleted
inserted
replaced
| 25:ce3d1dc406a8 | 26:ba895419fb04 |
|---|---|
| 26 local new_check_box_menu_item = require("luan:swing/Check_box_menu_item.luan").new or error() | 26 local new_check_box_menu_item = require("luan:swing/Check_box_menu_item.luan").new or error() |
| 27 local int_to_color = require("luan:swing/Color.luan").int_to_color or error() | 27 local int_to_color = require("luan:swing/Color.luan").int_to_color or error() |
| 28 local Border = require "luan:swing/Border.luan" | 28 local Border = require "luan:swing/Border.luan" |
| 29 local create_empty_border = Border.create_empty_border or error() | 29 local create_empty_border = Border.create_empty_border or error() |
| 30 local create_line_border = Border.create_line_border or error() | 30 local create_line_border = Border.create_line_border or error() |
| 31 local no_border = Border.no_border or error() | |
| 31 local Layout = require "luan:swing/Layout.luan" | 32 local Layout = require "luan:swing/Layout.luan" |
| 32 local new_flow_layout = Layout.new_flow_layout or error() | |
| 33 local new_box_layout = Layout.new_box_layout or error() | |
| 34 local new_mig_layout = Layout.new_mig_layout or error() | 33 local new_mig_layout = Layout.new_mig_layout or error() |
| 35 local Option_pane = require "luan:swing/Option_pane.luan" | 34 local Option_pane = require "luan:swing/Option_pane.luan" |
| 36 local show_message_dialog = Option_pane.show_message_dialog or error() | 35 local show_message_dialog = Option_pane.show_message_dialog or error() |
| 37 local show_input_dialog = Option_pane.show_input_dialog or error() | 36 local show_input_dialog = Option_pane.show_input_dialog or error() |
| 38 local new_dialog = require("luan:swing/Dialog.luan").new or error() | 37 local new_dialog = require("luan:swing/Dialog.luan").new or error() |
| 192 end | 191 end |
| 193 | 192 |
| 194 local function make_find_dialog(window) | 193 local function make_find_dialog(window) |
| 195 local dialog = new_dialog{ | 194 local dialog = new_dialog{ |
| 196 owner_frame = window.frame | 195 owner_frame = window.frame |
| 197 --[[ | |
| 198 content_pane = new_panel{ | 196 content_pane = new_panel{ |
| 199 layout = function(this) return new_box_layout(this,"y_axis") end | 197 layout = new_mig_layout("debug","[][grow]","[][grow,top]") |
| 200 children = { | 198 children = { |
| 199 new_label{ | |
| 200 text = "Find Next:" | |
| 201 } | |
| 202 new_text_field{ | |
| 203 constraints = "wrap,growx" | |
| 204 columns = 20 | |
| 205 } | |
| 201 new_panel{ | 206 new_panel{ |
| 202 layout = new_flow_layout() | 207 constraints = "span,wrap" |
| 203 children = { | 208 layout = new_mig_layout("debug,insets 0") |
| 204 new_text_field{ | |
| 205 columns = 10 | |
| 206 } | |
| 207 } | |
| 208 } | |
| 209 new_panel{ | |
| 210 layout = new_flow_layout("left") | |
| 211 --border = create_empty_border(8,8,8,8) | 209 --border = create_empty_border(8,8,8,8) |
| 212 border = create_line_border(int_to_color(0)) | 210 --border = create_line_border(int_to_color(0)) |
| 213 children = { | 211 children = { |
| 214 new_button{ | 212 new_button{ |
| 215 text = "Find Next" | 213 text = "Find Next" |
| 216 } | 214 } |
| 217 new_button{ | 215 new_button{ |
| 219 } | 217 } |
| 220 } | 218 } |
| 221 } | 219 } |
| 222 } | 220 } |
| 223 } | 221 } |
| 224 ]] | |
| 225 --[[ | |
| 226 content_pane = new_panel{ | |
| 227 layout = new_grid_bag_layout() | |
| 228 alignment_x = "left" | |
| 229 border = create_line_border(int_to_color(0)) | |
| 230 children = { | |
| 231 new_text_field{ | |
| 232 constraints = new_grid_bag_constraints{ | |
| 233 gridx = 1 | |
| 234 gridy = 1 | |
| 235 } | |
| 236 columns = 10 | |
| 237 border = create_line_border(int_to_color(0)) | |
| 238 } | |
| 239 new_panel{ | |
| 240 constraints = new_grid_bag_constraints{ | |
| 241 gridx = 1 | |
| 242 gridy = 2 | |
| 243 } | |
| 244 layout = new_flow_layout("left") | |
| 245 --border = create_empty_border(8,8,8,8) | |
| 246 border = create_line_border(int_to_color(0)) | |
| 247 children = { | |
| 248 new_button{ | |
| 249 text = "Find Next" | |
| 250 } | |
| 251 new_button{ | |
| 252 text = "Find Previous" | |
| 253 } | |
| 254 } | |
| 255 } | |
| 256 } | |
| 257 } | |
| 258 ]] | |
| 259 ---[[ | |
| 260 content_pane = new_panel{ | |
| 261 layout = new_mig_layout("debug","[][grow]","[][grow,top]") | |
| 262 children = { | |
| 263 new_label{ | |
| 264 text = "Find Next:" | |
| 265 } | |
| 266 new_text_field{ | |
| 267 constraints = "wrap,growx" | |
| 268 columns = 20 | |
| 269 } | |
| 270 new_panel{ | |
| 271 constraints = "span,wrap" | |
| 272 layout = new_mig_layout("debug,insets 0") | |
| 273 --border = create_empty_border(8,8,8,8) | |
| 274 --border = create_line_border(int_to_color(0)) | |
| 275 children = { | |
| 276 new_button{ | |
| 277 constraints = "pad 0 -6 0 -6" | |
| 278 text = "Find Next" | |
| 279 } | |
| 280 new_button{ | |
| 281 constraints = "pad 0 -18 0 -6, gap unrelated" | |
| 282 text = "Find Previous" | |
| 283 } | |
| 284 } | |
| 285 } | |
| 286 new_panel{ | |
| 287 constraints = "span" | |
| 288 layout = function(this) return new_box_layout(this,"x_axis") end | |
| 289 children = { | |
| 290 new_button{ | |
| 291 text = "Find Next" | |
| 292 } | |
| 293 new_button{ | |
| 294 text = "Find Previous" | |
| 295 } | |
| 296 } | |
| 297 } | |
| 298 } | |
| 299 } | |
| 300 --]] | |
| 301 } | 222 } |
| 302 dialog.pack() | 223 dialog.pack() |
| 303 local was_shown = false | 224 local was_shown = false |
| 304 function window.show_find_dialog() | 225 function window.show_find_dialog() |
| 305 if not was_shown then | 226 if not was_shown then |
| 341 end | 262 end |
| 342 text_area.set_selection(0) | 263 text_area.set_selection(0) |
| 343 local frame = new_frame{ | 264 local frame = new_frame{ |
| 344 content_pane = new_scroll_pane{ | 265 content_pane = new_scroll_pane{ |
| 345 view = text_area | 266 view = text_area |
| 267 border = no_border | |
| 346 row_header_view = new_text_area_line_numbers{ | 268 row_header_view = new_text_area_line_numbers{ |
| 347 text_area = text_area | 269 text_area = text_area |
| 348 foreground_color = int_to_color(0x888888) | 270 foreground_color = int_to_color(0x888888) |
| 349 border = create_empty_border(0,8,0,8) | 271 border = create_empty_border(0,8,0,8) |
| 350 } | 272 } |
