From 8f71a1318d77f4e11550cc9df1cc7190cf72b136 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 13 Jan 2011 13:51:00 +0100 Subject: [PATCH] [#129] Replaced details, power marker and delta values button by one segmented control on OS X. --- cocoa/base/DetailsPanel.h | 1 + cocoa/base/DetailsPanel.m | 7 +- cocoa/base/ResultWindow.h | 6 +- cocoa/base/ResultWindow.m | 50 +-- cocoa/base/xib/MainMenu.xib | 397 +++++++------------- cocoa/se/dupeguru.xcodeproj/project.pbxproj | 4 - 6 files changed, 163 insertions(+), 302 deletions(-) diff --git a/cocoa/base/DetailsPanel.h b/cocoa/base/DetailsPanel.h index 50bcef87..cd7858a3 100644 --- a/cocoa/base/DetailsPanel.h +++ b/cocoa/base/DetailsPanel.h @@ -18,6 +18,7 @@ http://www.hardcoded.net/licenses/bsd_license - (id)initWithPy:(PyApp *)aPy; - (PyDetailsPanel *)py; +- (BOOL)isVisible; - (void)toggleVisibility; /* Python --> Cocoa */ diff --git a/cocoa/base/DetailsPanel.m b/cocoa/base/DetailsPanel.m index 95cbbecb..dfb8388d 100644 --- a/cocoa/base/DetailsPanel.m +++ b/cocoa/base/DetailsPanel.m @@ -34,9 +34,14 @@ http://www.hardcoded.net/licenses/bsd_license [detailsTable reloadData]; } +- (BOOL)isVisible +{ + return [[self window] isVisible]; +} + - (void)toggleVisibility { - if ([[self window] isVisible]) { + if ([self isVisible]) { [[self window] close]; } else { diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index 3290f38b..164581a8 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -18,9 +18,8 @@ http://www.hardcoded.net/licenses/bsd_license @protected IBOutlet PyDupeGuruBase *py; IBOutlet id app; - IBOutlet NSSegmentedControl *deltaSwitch; + IBOutlet NSSegmentedControl *optionsSwitch; IBOutlet HSTableView *matches; - IBOutlet NSSegmentedControl *pmSwitch; IBOutlet NSTextField *stats; IBOutlet NSMenu *columnsMenu; IBOutlet NSSearchField *filterField; @@ -42,8 +41,7 @@ http://www.hardcoded.net/licenses/bsd_license /* Actions */ - (IBAction)clearIgnoreList:(id)sender; -- (IBAction)changeDelta:(id)sender; -- (IBAction)changePowerMarker:(id)sender; +- (IBAction)changeOptions:(id)sender; - (IBAction)copyMarked:(id)sender; - (IBAction)deleteMarked:(id)sender; - (IBAction)hardlinkMarked:(id)sender; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index cdd40666..a071fb13 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -25,8 +25,6 @@ http://www.hardcoded.net/licenses/bsd_license problemDialog = [[ProblemDialog alloc] initWithPy:py]; [self initResultColumns]; [self fillColumnsMenu]; - [deltaSwitch setSelectedSegment:0]; - [pmSwitch setSelectedSegment:0]; [matches setTarget:self]; [matches setDoubleAction:@selector(openClicked:)]; @@ -147,6 +145,13 @@ http://www.hardcoded.net/licenses/bsd_license } } +- (void)updateOptionSegments +{ + [optionsSwitch setSelected:[[(AppDelegateBase *)app detailsPanel] isVisible] forSegment:0]; + [optionsSwitch setSelected:[table powerMarkerMode] forSegment:1]; + [optionsSwitch setSelected:[table deltaValuesMode] forSegment:2]; +} + /* Actions */ - (IBAction)clearIgnoreList:(id)sender { @@ -158,14 +163,18 @@ http://www.hardcoded.net/licenses/bsd_license [py clearIgnoreList]; } -- (IBAction)changeDelta:(id)sender +- (IBAction)changeOptions:(id)sender { - [table setDeltaValuesMode:[deltaSwitch selectedSegment] == 1]; -} - -- (IBAction)changePowerMarker:(id)sender -{ - [table setPowerMarkerMode:[pmSwitch selectedSegment] == 1]; + NSInteger seg = [optionsSwitch selectedSegment]; + if (seg == 0) { + [self toggleDetailsPanel:sender]; + } + else if (seg == 1) { + [self togglePowerMarker:sender]; + } + else if (seg == 2) { + [self toggleDelta:sender]; + } } - (IBAction)copyMarked:(id)sender @@ -380,27 +389,22 @@ http://www.hardcoded.net/licenses/bsd_license } } -- (IBAction)toggleDelta:(id)sender -{ - if ([deltaSwitch selectedSegment] == 1) - [deltaSwitch setSelectedSegment:0]; - else - [deltaSwitch setSelectedSegment:1]; - [self changeDelta:sender]; -} - - (IBAction)toggleDetailsPanel:(id)sender { [[(AppDelegateBase *)app detailsPanel] toggleVisibility]; + [self updateOptionSegments]; +} + +- (IBAction)toggleDelta:(id)sender +{ + [table setDeltaValuesMode:![table deltaValuesMode]]; + [self updateOptionSegments]; } - (IBAction)togglePowerMarker:(id)sender { - if ([pmSwitch selectedSegment] == 1) - [pmSwitch setSelectedSegment:0]; - else - [pmSwitch setSelectedSegment:1]; - [self changePowerMarker:sender]; + [table setPowerMarkerMode:![table powerMarkerMode]]; + [self updateOptionSegments]; } /* Notifications */ diff --git a/cocoa/base/xib/MainMenu.xib b/cocoa/base/xib/MainMenu.xib index b6a97463..6a292305 100644 --- a/cocoa/base/xib/MainMenu.xib +++ b/cocoa/base/xib/MainMenu.xib @@ -50,76 +50,24 @@ YES YES YES - 1 + 2 1 YES YES - 05CA01D3-49FE-42B7-B043-791FFDF37644 3E17CA47-6688-44FC-963C-CF22D780305F + 4BD1D94E-8A70-48E1-AF8A-CEDC80CD0A5E 8021CD05-A38E-4F80-99DD-7771914CEE06 8E5ADD0F-24AD-452A-BE68-464FE9E5E240 BA65FFF2-9E56-4E88-AB2E-8FBE2B3D030F - DAF37663-5062-4BEC-809F-0F335CC144ED F37510C7-955F-4141-9D09-AC2881ADCCFA - F813A7D3-0C98-4465-A6F8-799EF380A59F NSToolbarFlexibleSpaceItem NSToolbarSeparatorItem NSToolbarSpaceItem YES - - - 05CA01D3-49FE-42B7-B043-791FFDF37644 - - Power Marker - Power Marker - - - - 256 - {{7, 14}, {67, 25}} - YES - - 67239424 - 0 - - LucidaGrande - 11 - 16 - - - - YES - - 30 - Off - 2 - - - 30 - On - 1 - 2 - - - 1 - 2 - - - - - - {67, 24} - {67, 25} - YES - YES - 0 - YES - 0 - 3E17CA47-6688-44FC-963C-CF22D780305F @@ -142,6 +90,64 @@ YES 0 + + + 4BD1D94E-8A70-48E1-AF8A-CEDC80CD0A5E + + Options + Options + + + + 268 + {{0, 14}, {195, 23}} + + + YES + + 67239424 + 0 + + LucidaGrande + 11 + 16 + + + + YES + + 57 + Details + 0 + + + 82 + Dupes Only + 1 + 0 + + + 48 + Delta + 0 + + + 2 + 1 + 5 + + + + + + {195, 23} + {195, 25} + YES + YES + 0 + YES + 0 + 8021CD05-A38E-4F80-99DD-7771914CEE06 @@ -172,9 +178,11 @@ Filter - + 258 {{0, 14}, {81, 22}} + + YES 343014976 @@ -257,7 +265,7 @@ {81, 22} - {9999, 22} + {200, 22} YES YES 0 @@ -286,28 +294,6 @@ YES 0 - - - DAF37663-5062-4BEC-809F-0F335CC144ED - - Details - Details - - - - NSImage - details32 - - - - {0, 0} - {0, 0} - YES - YES - -1 - YES - 0 - F37510C7-955F-4141-9D09-AC2881ADCCFA @@ -316,9 +302,11 @@ Action - + 256 {{1, 14}, {40, 25}} + + YES -2076049856 @@ -522,52 +510,6 @@ YES 0 - - - F813A7D3-0C98-4465-A6F8-799EF380A59F - - Delta Values - Delta Values - - - - 256 - {{4, 14}, {67, 25}} - YES - - 67239424 - 0 - - - - YES - - 30 - Off - 2 - - - 30 - On - 1 - 2 - - - 1 - 2 - - - - - - {67, 24} - {67, 25} - YES - YES - 0 - YES - 0 - NSToolbarFlexibleSpaceItem @@ -658,21 +600,18 @@ - - - + YES - - - + + @@ -911,7 +850,7 @@ {{0, 0}, {1440, 878}} - {340, 418} + {340, 402} {1.79769e+308, 1.79769e+308} MainWindow @@ -1929,22 +1868,6 @@ 873 - - - changeDelta: - - - - 882 - - - - deltaSwitch - - - - 883 - ignoreSelected: @@ -2041,22 +1964,6 @@ 951 - - - changePowerMarker: - - - - 956 - - - - pmSwitch - - - - 957 - togglePowerMarker: @@ -2161,14 +2068,6 @@ 1166 - - - toggleDetailsPanel: - - - - 1167 - showPreferencesPanel: @@ -2273,6 +2172,22 @@ 1233 + + + optionsSwitch + + + + 1237 + + + + changeOptions: + + + + 1238 + @@ -2830,12 +2745,10 @@ - - - + @@ -2864,11 +2777,6 @@ - - 1159 - - - 1160 @@ -2988,52 +2896,6 @@ - - 1171 - - - YES - - - - - - 955 - - - YES - - - - - - 1138 - - - - - 1172 - - - YES - - - - - - 880 - - - YES - - - - - - 1137 - - - 1173 @@ -3177,6 +3039,29 @@ + + 1236 + + + YES + + + + + + 1234 + + + YES + + + + + + 1235 + + + @@ -3208,18 +3093,13 @@ 111.ImportedFromIB2 1116.IBPluginDependency 1136.IBPluginDependency - 1137.IBPluginDependency - 1138.IBPluginDependency 1139.IBPluginDependency 1147.IBEditorWindowLastContentRect 1147.IBPluginDependency 1156.IBPluginDependency 1158.IBPluginDependency - 1159.IBPluginDependency 1160.IBPluginDependency 1170.IBPluginDependency - 1171.IBPluginDependency - 1172.IBPluginDependency 1173.IBPluginDependency 1177.IBPluginDependency 1203.IBPluginDependency @@ -3241,6 +3121,9 @@ 1227.ImportedFromIB2 1230.IBPluginDependency 1230.ImportedFromIB2 + 1234.IBPluginDependency + 1235.IBPluginDependency + 1235.IBSegmentedControlInspectorSelectedSegmentMetadataKey 134.IBPluginDependency 134.ImportedFromIB2 136.IBPluginDependency @@ -3367,8 +3250,6 @@ 740.ImportedFromIB2 872.IBPluginDependency 872.ImportedFromIB2 - 880.IBPluginDependency - 880.ImportedFromIB2 92.IBPluginDependency 92.ImportedFromIB2 920.IBPluginDependency @@ -3398,8 +3279,6 @@ 949.ImportedFromIB2 950.IBPluginDependency 950.ImportedFromIB2 - 955.IBPluginDependency - 955.ImportedFromIB2 959.IBPluginDependency 959.ImportedFromIB2 960.IBEditorWindowLastContentRect @@ -3449,12 +3328,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{294, 689}, {617, 0}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + {{294, 705}, {617, 0}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3482,6 +3356,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3501,9 +3378,9 @@ - {{324, 289}, {557, 400}} + {{324, 305}, {557, 400}} com.apple.InterfaceBuilder.CocoaPlugin - {{324, 289}, {557, 400}} + {{324, 305}, {557, 400}} @@ -3633,10 +3510,6 @@ com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3678,7 +3551,7 @@ - 1233 + 1238 @@ -4088,8 +3961,7 @@ YES YES - changeDelta: - changePowerMarker: + changeOptions: clearIgnoreList: copyMarked: deleteMarked: @@ -4152,15 +4024,13 @@ id id id - id YES YES - changeDelta: - changePowerMarker: + changeOptions: clearIgnoreList: copyMarked: deleteMarked: @@ -4194,11 +4064,7 @@ YES - changeDelta: - id - - - changePowerMarker: + changeOptions: id @@ -4325,10 +4191,9 @@ YES app columnsMenu - deltaSwitch filterField matches - pmSwitch + optionsSwitch py stats @@ -4336,7 +4201,6 @@ YES id NSMenu - NSSegmentedControl NSSearchField HSTableView NSSegmentedControl @@ -4350,10 +4214,9 @@ YES app columnsMenu - deltaSwitch filterField matches - pmSwitch + optionsSwitch py stats @@ -4367,10 +4230,6 @@ columnsMenu NSMenu - - deltaSwitch - NSSegmentedControl - filterField NSSearchField @@ -4380,7 +4239,7 @@ HSTableView - pmSwitch + optionsSwitch NSSegmentedControl @@ -5046,7 +4905,6 @@ NSMenuCheckmark NSMenuMixedState NSSwitch - details32 folder32 preferences32 @@ -5057,7 +4915,6 @@ {9, 8} {7, 2} {15, 15} - {48, 48} {32, 32} {32, 32} diff --git a/cocoa/se/dupeguru.xcodeproj/project.pbxproj b/cocoa/se/dupeguru.xcodeproj/project.pbxproj index d943bcda..fe32070c 100644 --- a/cocoa/se/dupeguru.xcodeproj/project.pbxproj +++ b/cocoa/se/dupeguru.xcodeproj/project.pbxproj @@ -44,7 +44,6 @@ CEEFC0F810945D9F001F3A39 /* DirectoryPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEEFC0F710945D9F001F3A39 /* DirectoryPanel.xib */; }; CEEFC0FB10945E37001F3A39 /* DetailsPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEEFC0FA10945E37001F3A39 /* DetailsPanel.xib */; }; CEFC294609C89E3D00D9F998 /* folder32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC294509C89E3D00D9F998 /* folder32.png */; }; - CEFC295509C89FF200D9F998 /* details32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC295309C89FF200D9F998 /* details32.png */; }; CEFC295609C89FF200D9F998 /* preferences32.png in Resources */ = {isa = PBXBuildFile; fileRef = CEFC295409C89FF200D9F998 /* preferences32.png */; }; CEFC7F9E0FC9517500CD5728 /* Dialogs.m in Sources */ = {isa = PBXBuildFile; fileRef = CEFC7F8B0FC9517500CD5728 /* Dialogs.m */; }; CEFC7F9F0FC9517500CD5728 /* HSErrorReportWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = CEFC7F8D0FC9517500CD5728 /* HSErrorReportWindow.m */; }; @@ -139,7 +138,6 @@ CEEFC0F710945D9F001F3A39 /* DirectoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DirectoryPanel.xib; path = ../base/xib/DirectoryPanel.xib; sourceTree = ""; }; CEEFC0FA10945E37001F3A39 /* DetailsPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DetailsPanel.xib; path = ../base/xib/DetailsPanel.xib; sourceTree = ""; }; CEFC294509C89E3D00D9F998 /* folder32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = folder32.png; path = ../../images/folder32.png; sourceTree = SOURCE_ROOT; }; - CEFC295309C89FF200D9F998 /* details32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = details32.png; path = ../../images/details32.png; sourceTree = SOURCE_ROOT; }; CEFC295409C89FF200D9F998 /* preferences32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = preferences32.png; path = ../../images/preferences32.png; sourceTree = SOURCE_ROOT; }; CEFC7F8A0FC9517500CD5728 /* Dialogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Dialogs.h; path = ../../cocoalib/Dialogs.h; sourceTree = SOURCE_ROOT; }; CEFC7F8B0FC9517500CD5728 /* Dialogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Dialogs.m; path = ../../cocoalib/Dialogs.m; sourceTree = SOURCE_ROOT; }; @@ -333,7 +331,6 @@ CEFC294309C89E0000D9F998 /* images */ = { isa = PBXGroup; children = ( - CEFC295309C89FF200D9F998 /* details32.png */, CEFC295409C89FF200D9F998 /* preferences32.png */, CEFC294509C89E3D00D9F998 /* folder32.png */, ); @@ -461,7 +458,6 @@ CE073F6309CAE1A3005C1D2F /* help in Resources */, CEEB135209C837A2004D2330 /* dupeguru.icns in Resources */, CEFC294609C89E3D00D9F998 /* folder32.png in Resources */, - CEFC295509C89FF200D9F998 /* details32.png in Resources */, CEFC295609C89FF200D9F998 /* preferences32.png in Resources */, CE6E0DFE1054E9EF008D9390 /* dsa_pub.pem in Resources */, CEEFC0F810945D9F001F3A39 /* DirectoryPanel.xib in Resources */,