345
345
346
346
AutocompletePanel = defclass (AutocompletePanel , widgets .Panel )
347
347
AutocompletePanel .ATTRS {
348
+ frame_background = gui .CLEAR_PEN ,
348
349
on_autocomplete = DEFAULT_NIL ,
349
350
tag_filter_panel = DEFAULT_NIL ,
350
351
on_double_click = DEFAULT_NIL ,
@@ -459,8 +460,10 @@ function EditPanel:init()
459
460
self :addviews {
460
461
widgets .Label {
461
462
view_id = ' prefix' ,
462
- frame = {l = 0 , t = 0 },
463
+ frame = {l = 0 , t = 0 , r = 0 },
464
+ frame_background = gui .CLEAR_PEN ,
463
465
text = ' [DFHack]#' ,
466
+ auto_width = false ,
464
467
visible = self .prefix_visible },
465
468
widgets .EditField {
466
469
view_id = ' editfield' ,
@@ -480,6 +483,7 @@ function EditPanel:init()
480
483
frame = {l = 1 , t = 3 , w = 10 },
481
484
key = ' SELECT' ,
482
485
label = ' run' ,
486
+ disabled = self .prefix_visible ,
483
487
on_activate = function ()
484
488
if dfhack .internal .getModifiers ().shift then
485
489
self .on_submit2 (self .subviews .editfield .text )
@@ -495,7 +499,8 @@ function EditPanel:init()
495
499
on_activate = self .on_toggle_minimal },
496
500
widgets .EditField {
497
501
view_id = ' search' ,
498
- frame = {l = 13 , t = 3 , r = 1 },
502
+ frame = {l = 13 , b = 0 , r = 1 },
503
+ frame_background = gui .CLEAR_PEN ,
499
504
key = ' CUSTOM_ALT_S' ,
500
505
label_text = ' history search: ' ,
501
506
disabled = function () return selecting_filters end ,
@@ -508,7 +513,10 @@ function EditPanel:init()
508
513
end end ,
509
514
on_unfocus = function ()
510
515
self .subviews .search :setText (' ' )
511
- self .subviews .editfield :setFocus (true ) end ,
516
+ self .subviews .editfield :setFocus (true )
517
+ self .subviews .search .visible = not self .prefix_visible ()
518
+ gui .Screen .request_full_screen_refresh = true
519
+ end ,
512
520
on_submit = function ()
513
521
self .on_submit (self .subviews .editfield .text ) end ,
514
522
on_submit2 = function ()
@@ -567,6 +575,11 @@ function EditPanel:on_search_text(search_str, next_match)
567
575
end
568
576
569
577
function EditPanel :onInput (keys )
578
+ if self .prefix_visible () then
579
+ local search = self .subviews .search
580
+ search .visible = keys .CUSTOM_ALT_S or search .focus
581
+ end
582
+
570
583
if EditPanel .super .onInput (self , keys ) then return true end
571
584
572
585
if keys .STANDARDSCROLL_UP then
@@ -583,12 +596,28 @@ function EditPanel:onInput(keys)
583
596
end
584
597
end
585
598
599
+ function EditPanel :preUpdateLayout ()
600
+ local search = self .subviews .search
601
+ local minimized = self .prefix_visible ()
602
+ if minimized then
603
+ self .frame_background = nil
604
+ search .frame .l = 0
605
+ search .frame .r = 11
606
+ else
607
+ self .frame_background = gui .CLEAR_PEN
608
+ search .frame .l = 13
609
+ search .frame .r = 1
610
+ end
611
+ search .visible = not minimized or search .focus
612
+ end
613
+
586
614
---- ------------------------------
587
615
-- HelpPanel
588
616
--
589
617
590
618
HelpPanel = defclass (HelpPanel , widgets .Panel )
591
619
HelpPanel .ATTRS {
620
+ frame_background = gui .CLEAR_PEN ,
592
621
autoarrange_subviews = true ,
593
622
autoarrange_gap = 1 ,
594
623
frame_inset = {t = 0 , l = 1 , r = 1 , b = 0 },
@@ -725,10 +754,11 @@ end
725
754
-- MainPanel
726
755
--
727
756
728
- MainPanel = defclass (MainPanel , widgets .Window )
757
+ MainPanel = defclass (MainPanel , widgets .Panel )
729
758
MainPanel .ATTRS {
730
759
frame_title = TITLE ,
731
760
frame_inset = 0 ,
761
+ draggable = true ,
732
762
resizable = true ,
733
763
resize_min = {w = AUTOCOMPLETE_PANEL_WIDTH + 49 , h = EDIT_PANEL_HEIGHT + 20 },
734
764
get_minimal = DEFAULT_NIL ,
@@ -812,7 +842,7 @@ function LauncherUI:init(args)
812
842
new_frame .l = 0
813
843
new_frame .r = frame_r
814
844
new_frame .t = 0
815
- new_frame .h = 1
845
+ new_frame .h = 2
816
846
else
817
847
new_frame = config .data
818
848
if not next (new_frame ) then
@@ -831,7 +861,7 @@ function LauncherUI:init(args)
831
861
local edit_frame = self .subviews .edit .frame
832
862
edit_frame .r = self .minimal and
833
863
0 or AUTOCOMPLETE_PANEL_WIDTH + 2
834
- edit_frame .h = self .minimal and 1 or EDIT_PANEL_HEIGHT
864
+ edit_frame .h = self .minimal and 2 or EDIT_PANEL_HEIGHT
835
865
836
866
local editfield_frame = self .subviews .editfield .frame
837
867
editfield_frame .t = self .minimal and 0 or 1
0 commit comments