Skip to content

Commit

Permalink
App setup - Fixed scheme menus
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-venugopal committed Nov 10, 2024
1 parent fad549a commit dae3f24
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Aural.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4827,9 +4827,9 @@
3E9792E226A24EFF0010BE99 /* AppModeController.swift */,
3E9E590125DB6B150064EB5F /* ModularAppModeController.swift */,
3E7638AE2857DA3F00461F4D /* UnifiedAppModeController.swift */,
3EBFF5A42B52C0670056D5B4 /* CompactAppModeController.swift */,
3E9E58FF25DB6B150064EB5F /* MenuBarAppModeController.swift */,
3E4322742687C96E009E8ADB /* WidgetAppModeController.swift */,
3EBFF5A42B52C0670056D5B4 /* CompactAppModeController.swift */,
3E62979926A3CD3800C96AB8 /* Destroyable.swift */,
3E62979C26A3CEBF00C96AB8 /* Restorable.swift */,
);
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/UI/AppModeManagement/CompactAppModeController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CompactAppModeController: AppModeController {
NSApp.menu = appDelegate.mainMenu

windowController = CompactPlayerWindowController()
windowController?.showWindow(self)
windowController?.theWindow.showCenteredOnScreen()

// Build Library if not already built or building
// Always give it a low priority (not user-interactive through any UI components).
Expand Down
2 changes: 1 addition & 1 deletion Source/UI/AppModeManagement/UnifiedAppModeController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class UnifiedAppModeController: AppModeController {
windowController?.window?.setFrame(frame, display: true)
}

windowController?.showWindow(self)
windowController?.theWindow.showCenteredOnScreen()

reactivateApp(previousMode: previousMode)

Expand Down
65 changes: 4 additions & 61 deletions Source/UI/AppSetup/ThemeSetup/ThemeSetup.xib
Original file line number Diff line number Diff line change
Expand Up @@ -118,40 +118,10 @@
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iBF-V9-N0r" userLabel="Fnot Schemes Menu">
<rect key="frame" x="203" y="73" width="338" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Standard" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="oen-3k-4Z8" id="vrr-Am-cTF">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="vrr-Am-cTF">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="rNK-0P-5AF">
<items>
<menuItem title="Standard" state="on" indentationLevel="1" id="oen-3k-4Z8">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Rounded" indentationLevel="1" id="Fz4-e1-UPH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Programmer" indentationLevel="1" id="CnR-4F-5WI">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Futuristic" indentationLevel="1" id="jrc-7K-s4Y">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Novelist" indentationLevel="1" id="2Xy-jd-imI">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Soy Sauce" indentationLevel="1" id="NvX-ec-xCO">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Gothic" indentationLevel="1" id="93q-zQ-f8S">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Papyrus" indentationLevel="1" id="dpV-1R-hF6">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Poolside.fm" indentationLevel="1" id="M77-yA-m4f">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
<menu key="menu" id="rNK-0P-5AF"/>
</popUpButtonCell>
<connections>
<action selector="fontSchemeSelectionAction:" target="-2" id="Yz2-1D-mYN"/>
Expand All @@ -160,37 +130,10 @@
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="J7D-cD-M0c" userLabel="Color Schemes Menu">
<rect key="frame" x="203" y="30" width="338" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Lava" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="6D2-fS-6eM" id="XU0-T5-otZ">
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="XU0-T5-otZ">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="KFF-Fq-uvh">
<items>
<menuItem title="Lava" state="on" indentationLevel="1" id="6D2-fS-6eM">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Brownie" indentationLevel="1" id="faO-vJ-Dii">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Black &amp; green" indentationLevel="1" id="k9n-pq-XWo">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Poolside.fm" indentationLevel="1" id="KVe-Fs-jfa">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Gloomy day" indentationLevel="1" id="QhA-9T-TDF">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Black &amp; aqua" indentationLevel="1" id="HAF-Gw-eG6">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="The blues" indentationLevel="1" id="VDf-j1-bZ3">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="White blight" indentationLevel="1" id="T0P-43-O8v">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
<menu key="menu" id="KFF-Fq-uvh"/>
</popUpButtonCell>
<connections>
<action selector="colorSchemeSelectionAction:" target="-2" id="ev7-C1-VFC"/>
Expand Down
20 changes: 14 additions & 6 deletions Source/UI/AppSetup/ThemeSetup/ThemeSetupViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ class ThemeSetupViewController: NSViewController {
override func viewDidLoad() {

super.viewDidLoad()

btnFontScheme.menu?.removeAllItems()

for scheme in FontScheme.allSystemDefinedSchemes {
btnFontScheme.menu?.addItem(withTitle: scheme.name)
}

btnColorScheme.menu?.removeAllItems()

for scheme in ColorScheme.allSystemDefinedSchemes {
btnColorScheme.menu?.addItem(withTitle: scheme.name)
}

let fontSchemeName = appSetup.fontSchemePreset.name
let colorSchemeName = appSetup.colorSchemePreset.name
Expand All @@ -37,12 +49,10 @@ class ThemeSetupViewController: NSViewController {

guard let selSchemeName = btnColorScheme.titleOfSelectedItem,
let scheme = colorSchemesManager.systemDefinedObject(named: selSchemeName),
let colorSchemePreset = ColorSchemePreset.presetByName(selSchemeName) else {return}
let preset = ColorSchemePreset.presetByName(selSchemeName) else {return}

previewView.colorScheme = scheme

appSetup.colorSchemePreset = colorSchemePreset
print("Set color scheme to: \(appSetup.colorSchemePreset.rawValue)")
appSetup.colorSchemePreset = preset
}

@IBAction func fontSchemeSelectionAction(_ sender: Any) {
Expand All @@ -52,8 +62,6 @@ class ThemeSetupViewController: NSViewController {
let preset = FontSchemePreset.presetByName(selSchemeName) else {return}

previewView.fontScheme = scheme

appSetup.fontSchemePreset = preset
print("Set font scheme to: \(appSetup.fontSchemePreset.rawValue)")
}
}
2 changes: 1 addition & 1 deletion Source/UI/ColorSchemes/Domain/ColorScheme+Presets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,5 @@ extension ColorScheme {
inactiveControlColor: .white50Percent,
suppressedControlColor: .white25Percent)

static let allPresets: [ColorScheme] = [.lava, .blackAqua, .blackGreen, .grayRed, .whiteBlight, .gloomyDay, .brownie, .poolsideFM]
static let allSystemDefinedSchemes: [ColorScheme] = [.lava, .blackAqua, .blackGreen, .grayRed, .whiteBlight, .gloomyDay, .brownie, .poolsideFM]
}
2 changes: 1 addition & 1 deletion Source/UI/ColorSchemes/Manager/ColorSchemesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ColorSchemesManager: UserManagedObjects<ColorScheme> {

init(persistentState: ColorSchemesPersistentState?) {

let systemDefinedSchemes: [ColorScheme] = ColorScheme.allPresets
let systemDefinedSchemes: [ColorScheme] = ColorScheme.allSystemDefinedSchemes
let userDefinedSchemes = (persistentState?.userSchemes ?? []).map {ColorScheme($0, false)}

if let persistentSystemScheme = persistentState?.systemScheme {
Expand Down

0 comments on commit dae3f24

Please sign in to comment.