@@ -38,16 +38,19 @@ public void Reset()
38
38
39
39
public void DrawContent ( )
40
40
{
41
- using var child = ImUtf8 . Child ( "##settings"u8 , default ) ;
42
- if ( ! child )
41
+ using var table = ImUtf8 . Table ( "##settings"u8 , 1 , ImGuiTableFlags . ScrollY , ImGui . GetContentRegionAvail ( ) ) ;
42
+ if ( ! table )
43
43
return ;
44
44
45
45
_inherited = selection . Collection != collectionManager . Active . Current ;
46
46
_temporary = selection . TemporarySettings != null ;
47
47
_locked = ( selection . TemporarySettings ? . Lock ?? 0 ) > 0 ;
48
+
49
+ ImGui . TableSetupScrollFreeze ( 0 , 1 ) ;
50
+ ImGui . TableNextColumn ( ) ;
48
51
DrawTemporaryWarning ( ) ;
49
52
DrawInheritedWarning ( ) ;
50
- UiHelpers . DefaultLineSpace ( ) ;
53
+ ImGui . Dummy ( Vector2 . Zero ) ;
51
54
communicator . PreSettingsPanelDraw . Invoke ( selection . Mod ! . Identifier ) ;
52
55
DrawEnabledInput ( ) ;
53
56
tutorial . OpenTutorial ( BasicTutorialSteps . EnablingMods ) ;
@@ -56,6 +59,7 @@ public void DrawContent()
56
59
tutorial . OpenTutorial ( BasicTutorialSteps . Priority ) ;
57
60
DrawRemoveSettings ( ) ;
58
61
62
+ ImGui . TableNextColumn ( ) ;
59
63
communicator . PostEnabledDraw . Invoke ( selection . Mod ! . Identifier ) ;
60
64
61
65
modGroupDrawer . Draw ( selection . Mod ! , selection . Settings , selection . TemporarySettings ) ;
@@ -71,7 +75,8 @@ private void DrawTemporaryWarning()
71
75
72
76
using var color = ImRaii . PushColor ( ImGuiCol . Button , ImGuiCol . Button . Tinted ( ColorId . TemporaryModSettingsTint ) ) ;
73
77
var width = new Vector2 ( ImGui . GetContentRegionAvail ( ) . X , 0 ) ;
74
- if ( ImUtf8 . ButtonEx ( $ "These settings are temporary from { selection . TemporarySettings ! . Source } { ( _locked ? " and locked." : "." ) } ", width ,
78
+ if ( ImUtf8 . ButtonEx ( $ "These settings are temporarily set by { selection . TemporarySettings ! . Source } { ( _locked ? " and locked." : "." ) } ",
79
+ width ,
75
80
_locked ) )
76
81
collectionManager . Editor . SetTemporarySettings ( collectionManager . Active . Current , selection . Mod ! , null ) ;
77
82
@@ -174,23 +179,45 @@ private void DrawPriorityInput()
174
179
/// </summary>
175
180
private void DrawRemoveSettings ( )
176
181
{
177
- if ( _inherited || selection . Settings == ModSettings . Empty )
182
+ var drawInherited = ! _inherited && selection . Settings != ModSettings . Empty ;
183
+ if ( ! drawInherited && _temporary )
178
184
return ;
179
185
180
- var scroll = ImGui . GetScrollMaxY ( ) > 0 ? ImGui . GetStyle ( ) . ScrollbarSize : 0 ;
181
- ImGui . SameLine ( ImGui . GetWindowWidth ( ) - ImUtf8 . CalcTextSize ( "Inherit Settings"u8 ) . X - ImGui . GetStyle ( ) . FramePadding . X * 2 - scroll ) ;
182
- if ( ! ImUtf8 . ButtonEx ( "Inherit Settings"u8 , "Remove current settings from this collection so that it can inherit them.\n "u8
183
- + "If no inherited collection has settings for this mod, it will be disabled."u8 , default , _locked ) )
184
- return ;
185
-
186
- if ( _temporary )
186
+ var scroll = ImGui . GetScrollMaxY ( ) > 0 ? ImGui . GetStyle ( ) . ScrollbarSize + ImGui . GetStyle ( ) . ItemInnerSpacing . X : 0 ;
187
+ var offset = ( drawInherited , _temporary ) switch
187
188
{
188
- selection . TemporarySettings ! . ForceInherit = true ;
189
- collectionManager . Editor . SetTemporarySettings ( collectionManager . Active . Current , selection . Mod ! , selection . TemporarySettings ) ;
190
- }
191
- else
189
+ ( true , true ) => ImUtf8 . CalcTextSize ( "Inherit Settings"u8 ) . X + ImGui . GetStyle ( ) . FramePadding . X * 2 ,
190
+ ( false , false ) => ImUtf8 . CalcTextSize ( "Turn Temporary"u8 ) . X + ImGui . GetStyle ( ) . FramePadding . X * 2 ,
191
+ ( true , false ) => ImUtf8 . CalcTextSize ( "Inherit Settings"u8 ) . X
192
+ + ImUtf8 . CalcTextSize ( "Turn Temporary"u8 ) . X
193
+ + ImGui . GetStyle ( ) . FramePadding . X * 4
194
+ + ImGui . GetStyle ( ) . ItemSpacing . X ,
195
+ ( false , true ) => 0 , // can not happen
196
+ } ;
197
+
198
+ ImGui . SameLine ( ImGui . GetWindowWidth ( ) - offset - scroll ) ;
199
+ if ( ! _temporary
200
+ && ImUtf8 . ButtonEx ( "Turn Temporary"u8 , "Copy the current settings over to temporary settings to experiment with them."u8 ) )
201
+ collectionManager . Editor . SetTemporarySettings ( collectionManager . Active . Current , selection . Mod ! ,
202
+ new TemporaryModSettings ( selection . Settings , "yourself" ) ) ;
203
+ if ( drawInherited )
192
204
{
193
- collectionManager . Editor . SetModInheritance ( collectionManager . Active . Current , selection . Mod ! , true ) ;
205
+ if ( ! _temporary )
206
+ ImGui . SameLine ( 0 , ImGui . GetStyle ( ) . ItemSpacing . X ) ;
207
+ if ( ImUtf8 . ButtonEx ( "Inherit Settings"u8 , "Remove current settings from this collection so that it can inherit them.\n "u8
208
+ + "If no inherited collection has settings for this mod, it will be disabled."u8 , default , _locked ) )
209
+ {
210
+ if ( _temporary )
211
+ {
212
+ selection . TemporarySettings ! . ForceInherit = true ;
213
+ collectionManager . Editor . SetTemporarySettings ( collectionManager . Active . Current , selection . Mod ! ,
214
+ selection . TemporarySettings ) ;
215
+ }
216
+ else
217
+ {
218
+ collectionManager . Editor . SetModInheritance ( collectionManager . Active . Current , selection . Mod ! , true ) ;
219
+ }
220
+ }
194
221
}
195
222
}
196
223
}
0 commit comments