Skip to content

Commit 4559fc9

Browse files
committed
Rewrote ScreenEditMenu in lua to give it a better layout and usability.
Removed old ScreenEditMenu and EditMenu translation strings. Removed old ScreenEditMenu and EditMenu metrics. Added LongStepsType translation section for including the game type. Added foreach_ordered to 00 init.lua because it was removed when ThemePrefs was removed. Added on_focus and on_unfocus functions to nesty menu items. Added page_down and page_up functions to nesty menu navigation. Added a way to set the back element text for a submenu. Changed AutoKeysounds to print an error message when it can't load the music because no steps are set. Fixed bugs in GameState:SetStepsForEditMode lua function. Changed NotesLoaderSM and SSC to treat a blank difficulty string as Edit. Changed RollingNumbers to print an error if the target number is not finite. Added prompt_screen lua function for activating ScreenPrompt from lua with a function to call after the prompt. Updated changelog.
1 parent 43cdf5f commit 4559fc9

22 files changed

+762
-1657
lines changed

Docs/Changelog_sm5_1.txt

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ StepMania 5.1 and StepMania 5.0 have separate changelogs so that devs working
77
on the different branches don't have conflicts on the changelog file.
88
________________________________________________________________________________
99

10+
2016/07/25
11+
----------
12+
* [ScreenEditMenu] Complete rewrite removes the old ScreenEditMenu and
13+
EditMenu classes with their metrics and language strings. See
14+
Docs/Themerdocs/5.1_incompatibilities/ScreenEditMenu_rewrite.md for details.
15+
[kyzentun]
16+
1017
2016/07/18
1118
----------
1219
* [Player] Removed HoldJudgment class. Hold judgments should be displayed by
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Removed metrics:
2+
Everything in the ScreenEditMenu section.
3+
4+
Everything in the EditMenu section.
5+
6+
## Removed language entries:
7+
Everything in the EditMenuAction section.
8+
Everything in the EditMenu section.
9+
Everything in the EditMenuRow section.
10+
Everything in the ScreenEditMenu section.
11+
12+
## New language entries:
13+
See ScreenEditMenu section in _fallback.
14+
15+
16+
## bug Kyzentun to finish this explanation

Themes/_fallback/Languages/en.ini

+67-42
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,6 @@ Survival=Survival
9292
You must type a program directory before clicking Add.=You must type a program directory before clicking Add.
9393
'%s' is not a valid installation directory.='%s' is not a valid installation directory.
9494

95-
[EditMenuAction]
96-
Create=Create New
97-
Delete=Delete Existing
98-
Edit=Edit Existing
99-
Practice=Practice
100-
LoadAutosave=Load Autosave
101-
102-
[EditMenu]
103-
Blank=Blank
104-
No Group Selected.=No Group Selected.
105-
No StepsType selected.=No StepsType selected.
106-
No Steps selected.=No Steps selected.
107-
No valid action.=No valid action.
108-
109-
[EditMenuRow]
110-
Action=Action
111-
Group=Group
112-
Song=Song
113-
SourceSteps=Fill Steps
114-
SourceStepsType=Fill Type
115-
Steps=Steps
116-
StepsType=Type
117-
11895
[GameButton]
11996
Back=Back
12097
Down=Down
@@ -1830,25 +1807,32 @@ New Sound=New Sound
18301807
Enter New Keysound File=Enter the name of the new keysound file.\nPlease make sure it is spelt right.
18311808

18321809
[ScreenEditMenu]
1833-
HeaderText=Edit Song/Steps
1834-
HeaderSubText=Make your songs perfect
1835-
Continue with delete?=Continue with delete?
1836-
Enter a description for this edit.=Enter a description for this edit.
1837-
ExplanationAction=Choose the action to perform using the values selected above.
1838-
ExplanationGroup=Choose the group of songs you want to select from.
1839-
ExplanationSong=Choose which song you want to edit.
1840-
ExplanationSteps=Choose the steps you want to edit.\nSelect "New Edit" to create a new edit file.
1841-
ExplanationStepsType=Choose the type of steps that you want to edit.
1842-
ExplanationSourceSteps=Choose the steps you want to fill into a new edit.
1843-
ExplanationSourceStepsType=Choose the type of steps that you want to use fill into a new edit.\nChoose "Blank" to create a new edit with no initial steps.
1844-
One of the selected things is invalid. Pick something valid instead.=One of the selected things is invalid. Pick something valid instead.
1845-
Profile name cannot be blank.=Profile name can not be blank.
1846-
The name you chose conflicts with another profile. Please use a different name.=The name you chose conflicts with another profile. Please use a different name.
1847-
These steps are produced by autogen. You do not need to delete them.=These steps are produced by autogen. You do not need to delete them.
1848-
These steps will be lost permanently.=These steps will be lost permanently.
1849-
This song is missing a music file and cannot be edited.=This song is missing a music file and can not be edited.
1850-
The song directory is read-only and cannot be edited.=The song directory is read-only and cannot be edited.
1851-
Blank=Blank
1810+
edit_description_prompt=Enter a description for this edit.
1811+
delete_chart_prompt=Are you sure you want to delete this chart?
1812+
1813+
steps_action_back=Back to steps
1814+
copy_dest_slot_back=Back to pick style
1815+
copy_dest_style_back=Back to pick chart to copy
1816+
copy_from_back=Back to pick chart to edit
1817+
new_chart_slot_back=Back to pick stepstype
1818+
new_chart_stype_back=Back to pick chart to edit
1819+
steps_list_back=Back to pick song
1820+
song_list_back=Back to pick group
1821+
exit_edit_menu=Exit edit menu
1822+
1823+
edit_chart=Edit chart
1824+
delete_chart=Delete chart
1825+
new_chart=New chart
1826+
copy_from=New copy of chart
1827+
1828+
copy_to_slot_format=Copy to %s %s
1829+
new_chart_slot_format=New %s %s
1830+
1831+
copy_dest_slot_menu=Pick difficulty for new chart
1832+
copy_dest_stype_menu=Pick stepstype for new chart
1833+
copy_from_menu=Pick chart to copy from
1834+
new_chart_slot_menu=Pick difficulty for new chart
1835+
new_chart_stype_menu=Pick stepstype for new chart
18521836

18531837
[ScreenPracticeMenu]
18541838
HeaderText=Practice Songs
@@ -2372,6 +2356,47 @@ Kickbox_Quadarm=Quadarm
23722356
Kickbox_Insect=Insect
23732357
Kickbox_Arachnid=Arachnid
23742358
2359+
[LongStepsType]
2360+
Dance_Single=Dance Single
2361+
Dance_Double=Dance Double
2362+
Dance_Couple=Dance Couple
2363+
Dance_Solo=Dance Solo
2364+
Dance_Routine=Dance Routine
2365+
Dance_Threepanel=Dance 3 Panels
2366+
Pump_Single=Pump Single
2367+
Pump_Double=Pump Double
2368+
Pump_Halfdouble=Pump Half-Double
2369+
Pump_Couple=Pump Couple
2370+
Pump_Routine=Pump Routine
2371+
Kb7_Single=KB7
2372+
Ez2_Single=Ez2 Single
2373+
Ez2_Double=Ez2 Double
2374+
Ez2_Real=Ez2 Real
2375+
Para_Single=Para Single
2376+
Ds3ddx_Single=DS3DDX Single
2377+
Bm_Single5=BM 5 Keys
2378+
Bm_Double5=BM 10 Keys
2379+
Bm_Single7=BM 7 Keys
2380+
Bm_Double7=BM 14 Keys
2381+
Maniax_Single=Maniax Single
2382+
Maniax_Double=Maniax Double
2383+
Techno_Single4=Techno Single 4
2384+
Techno_Single5=Techno Single 5
2385+
Techno_Single8=Techno Single 8
2386+
Techno_Double4=Techno Double 4
2387+
Techno_Double5=Techno Double 5
2388+
Techno_Double8=Techno Double 8
2389+
Pnm_Five=PNM 5 Button
2390+
Pnm_Nine=PNM 9 Button
2391+
Guitar_Five=Guitar 5 Frets
2392+
Karaoke=Karaoke
2393+
Lights_Cabinet=Lights
2394+
Kickbox_Human=Kickbox Human
2395+
Kickbox_Quadarm=Kickbox Quadarm
2396+
Kickbox_Insect=Kickbox Insect
2397+
Kickbox_Arachnid=Kickbox Arachnid
2398+
2399+
23752400
[StyleType]
23762401
StyleType_OnePlayerOneSide=1 Player
23772402
StyleType_TwoPlayersTwoSides=2 Players - Versus

Themes/_fallback/Scripts/00 init.lua

+22
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ function join(delimiter, list)
5454
return table.concat(list, delimiter)
5555
end
5656

57+
function foreach_by_sorted_keys(tbl, keys, func)
58+
table.sort(keys)
59+
for _, key in ipairs(keys) do func(key, tbl[key]) end
60+
end
61+
62+
function foreach_ordered( tbl, func )
63+
local string_keys= {}
64+
local number_keys= {}
65+
-- First person to to use this on a table that uses something else as keys
66+
-- gets to extend this function to cover more types. And a beating. -Kyz
67+
for k,_ in pairs(tbl) do
68+
if type(k) == "string" then
69+
table.insert(string_keys, k)
70+
elseif type(k) == "number" then
71+
table.insert(number_keys, k)
72+
end
73+
end
74+
-- iterate in sorted order
75+
foreach_by_sorted_keys(tbl, number_keys, func)
76+
foreach_by_sorted_keys(tbl, string_keys, func)
77+
end
78+
5779
-- (c) 2006 Glenn Maynard
5880
-- All rights reserved.
5981
--

Themes/_fallback/Scripts/04 nested_options_menu.lua

+40-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ nesty_cursor_mt= {
131131
LoadActor(THEME:GetPathG(params.parts_name, "Right")) ..
132132
{InitCommand= function(subself) self.right= subself end},
133133
}
134-
return frame;
134+
return frame
135135
end,
136136
refit= function(self, nx, ny, nw, nh)
137137
nx= nx or self.container:GetX()
@@ -408,8 +408,18 @@ local value_item_mt= {
408408
get_cursor_fit= function(self)
409409
return {0, 0, self.width + 4, self.height + 4}
410410
end,
411-
gain_focus= play_gain_focus,
412-
lose_focus= play_lose_focus,
411+
gain_focus= function(self)
412+
play_gain_focus(self)
413+
if self.info and type(self.info.on_focus) == "function" then
414+
self.info.on_focus()
415+
end
416+
end,
417+
lose_focus= function(self)
418+
play_lose_focus(self)
419+
if self.info and type(self.info.on_unfocus) == "function" then
420+
self.info.on_unfocus()
421+
end
422+
end,
413423
}}
414424

415425
nesty_items= {
@@ -615,6 +625,30 @@ local general_menu_mt= {
615625
self:get_cursor_element():gain_focus()
616626
return true, false, "move_down"
617627
end,
628+
page_down= function(self)
629+
if self.cursor_pos < #self.info_set then
630+
unfocus_cursor(self)
631+
self.cursor_pos= self.cursor_pos + self.display.scroller.num_items
632+
if self.cursor_pos > #self.info_set then
633+
self.cursor_pos= #self.info_set
634+
end
635+
self.display:scroll(self.cursor_pos)
636+
self:get_cursor_element():gain_focus()
637+
end
638+
return true, false, "move_down"
639+
end,
640+
page_up= function(self)
641+
if self.cursor_pos > 1 then
642+
unfocus_cursor(self)
643+
self.cursor_pos= self.cursor_pos - self.display.scroller.num_items
644+
if self.cursor_pos < 1 then
645+
self.cursor_pos= 1
646+
end
647+
self.display:scroll(self.cursor_pos)
648+
self:get_cursor_element():gain_focus()
649+
end
650+
return true, false, "move_up"
651+
end,
618652
Start= function(self)
619653
if self.info_set[self.cursor_pos].text == nesty_menu_up_element.text then
620654
-- This position is the "up" element that moves the
@@ -694,6 +728,7 @@ nesty_option_menus.menu= {
694728
else
695729
self.menu_data= self.init_args
696730
end
731+
self.up_text= self.menu_data.up_text or self.up_text
697732
self:insert_up(self.menu_data)
698733
self.name= self.menu_data.name or ""
699734
self.recall_init_on_pop= self.menu_data.recall_init_on_pop
@@ -753,6 +788,8 @@ nesty_option_menus.menu= {
753788
end
754789
self.info_set[disp_slot].translatable= data.translatable
755790
self.info_set[disp_slot].translatable_value= data.translatable_value
791+
self.info_set[disp_slot].on_focus= data.on_focus
792+
self.info_set[disp_slot].on_unfocus= data.on_unfocus
756793
if data.args and type(data.args) == "table" then
757794
data.args.name= data.name
758795
end

0 commit comments

Comments
 (0)