Revision: 12982 http://sourceforge.net/p/skim-app/code/12982 Author: hofman Date: 2022-07-06 16:18:04 +0000 (Wed, 06 Jul 2022) Log Message: ----------- Access properties of status bar components through these components
Modified Paths: -------------- trunk/SKBookmarkController.m trunk/SKMainWindowController.m trunk/SKMainWindowController_UI.m trunk/SKNoteWindowController.m trunk/SKNotesDocument.m trunk/SKStatusBar.h trunk/SKStatusBar.m Modified: trunk/SKBookmarkController.m =================================================================== --- trunk/SKBookmarkController.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKBookmarkController.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -245,7 +245,7 @@ message = count == 1 ? NSLocalizedString(@"1 item", @"Bookmark folder description") : [NSString stringWithFormat:NSLocalizedString(@"%ld items", @"Bookmark folder description"), (long)count]; } } - [statusBar setLeftStringValue:message ?: @""]; + [[statusBar leftField] setStringValue:message ?: @""]; } - (void)saveBookmarksData { @@ -1099,12 +1099,12 @@ } - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString { - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; } - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper updateSearchString:(NSString *)searchString { if (searchString) - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]]; else [self updateStatus]; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKMainWindowController.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -421,8 +421,8 @@ [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; - [statusBar setRightAction:@selector(statusBarClicked:)]; - [statusBar setRightTarget:self]; + [[statusBar rightField] setAction:@selector(statusBarClicked:)]; + [[statusBar rightField] setTarget:self]; if ([sud boolForKey:SKShowStatusBarKey] == NO) [self toggleStatusBar:nil]; @@ -737,7 +737,7 @@ - (void)updateLeftStatus { NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Page %ld of %ld", @"Status message"), (long)([[[self pdfView] currentPage] pageIndex] + 1), (long)[[pdfView document] pageCount]]; - [statusBar setLeftStringValue:message]; + [[statusBar leftField] setStringValue:message]; } #define CM_PER_POINT 0.035277778 @@ -755,7 +755,7 @@ rect = [[pdfView currentPage] boundsForBox:[pdfView displayBox]]; if (NSEqualRects(rect, NSZeroRect) == NO) { - if ([statusBar rightState] == NSOnState) { + if ([[[statusBar rightField] cell] state] == NSOnState) { BOOL useMetric = [[[NSLocale currentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue]; NSString *units = useMetric ? NSLocalizedString(@"cm", @"size unit") : NSLocalizedString(@"in", @"size unit"); CGFloat factor = useMetric ? CM_PER_POINT : INCH_PER_POINT; @@ -768,7 +768,7 @@ } else { message = @""; } - [statusBar setRightStringValue:message]; + [[statusBar rightField] setStringValue:message]; } - (void)updatePageColumnWidthForTableViews:(NSArray *)tvs { @@ -2037,9 +2037,9 @@ [self setSearchResults:nil]; [self setGroupedSearchResults:nil]; [statusBar setProgressIndicatorStyle:SKProgressIndicatorStyleDeterminate]; - [statusBar setProgressIndicatorMaxValue:[[note object] pageCount]]; - [statusBar setProgressIndicatorValue:0.0]; - [statusBar startProgressAnimation:self]; + [[statusBar progressIndicator] setMaxValue:[[note object] pageCount]]; + [[statusBar progressIndicator] setDoubleValue:0.0]; + [[statusBar progressIndicator] startAnimation:self]; [self willChangeValueForKey:SEARCHRESULTS_KEY]; [self willChangeValueForKey:GROUPEDSEARCHRESULTS_KEY]; } @@ -2055,13 +2055,13 @@ [self didChangeValueForKey:GROUPEDSEARCHRESULTS_KEY]; [self didChangeValueForKey:SEARCHRESULTS_KEY]; mwcFlags.updatingFindResults = 0; - [statusBar stopProgressAnimation:self]; + [[statusBar progressIndicator] stopAnimation:self]; [statusBar setProgressIndicatorStyle:SKProgressIndicatorStyleNone]; } - (void)documentDidEndPageFind:(NSNotification *)note { NSNumber *pageIndex = [[note userInfo] objectForKey:@"PDFDocumentPageIndex"]; - [statusBar setProgressIndicatorValue:[pageIndex doubleValue] + 1.0]; + [[statusBar progressIndicator] setDoubleValue:[pageIndex doubleValue] + 1.0]; if ([pageIndex unsignedIntegerValue] % 50 == 0) { mwcFlags.updatingFindResults = 1; [self didChangeValueForKey:GROUPEDSEARCHRESULTS_KEY]; Modified: trunk/SKMainWindowController_UI.m =================================================================== --- trunk/SKMainWindowController_UI.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKMainWindowController_UI.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -636,7 +636,7 @@ - (void)tableView:(NSTableView *)tv typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString { if ([tv isEqual:leftSideController.thumbnailTableView]) { - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; } } @@ -643,7 +643,7 @@ - (void)tableView:(NSTableView *)tv typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper updateSearchString:(NSString *)searchString { if ([tv isEqual:leftSideController.thumbnailTableView]) { if (searchString) - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Go to page: %@", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Go to page: %@", @"Status message"), searchString]]; else [self updateLeftStatus]; } @@ -1015,9 +1015,9 @@ - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString { if ([ov isEqual:rightSideController.noteOutlineView]) { - [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; + [[statusBar rightField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; } else if ([ov isEqual:leftSideController.tocOutlineView]) { - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; } } @@ -1024,12 +1024,12 @@ - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper updateSearchString:(NSString *)searchString { if ([ov isEqual:rightSideController.noteOutlineView]) { if (searchString) - [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]]; + [[statusBar rightField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]]; else [self updateRightStatus]; } else if ([ov isEqual:leftSideController.tocOutlineView]) { if (searchString) - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]]; else [self updateLeftStatus]; } Modified: trunk/SKNoteWindowController.m =================================================================== --- trunk/SKNoteWindowController.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKNoteWindowController.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -182,7 +182,7 @@ - (void)updateStatusMessage { NSRect bounds = [note bounds]; - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Page %@ at (%ld, %ld)", @"Status message"), [[note page] displayLabel], (long)NSMidX(bounds), (long)NSMidY(bounds)]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Page %@ at (%ld, %ld)", @"Status message"), [[note page] displayLabel], (long)NSMidX(bounds), (long)NSMidY(bounds)]]; } - (void)windowDidLoad { @@ -242,8 +242,8 @@ NSValueTransformer *transformer = [NSValueTransformer valueTransformerForName:SKTypeImageTransformerName]; - [statusBar setLeftAction:@selector(statusBarClicked:)]; - [statusBar setLeftTarget:self]; + [[statusBar leftField] setAction:@selector(statusBarClicked:)]; + [[statusBar leftField] setTarget:self]; [statusBar setIcon:[transformer transformedValue:[note type]]]; [self updateStatusMessage]; Modified: trunk/SKNotesDocument.m =================================================================== --- trunk/SKNotesDocument.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKNotesDocument.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -857,14 +857,14 @@ } - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString { - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]]; } - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper updateSearchString:(NSString *)searchString { if (searchString) - [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]]; + [[statusBar leftField] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]]; else - [statusBar setLeftStringValue:@""]; + [[statusBar leftField] setStringValue:@""]; } #pragma mark Contextual menu Modified: trunk/SKStatusBar.h =================================================================== --- trunk/SKStatusBar.h 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKStatusBar.h 2022-07-06 16:18:04 UTC (rev 12982) @@ -55,10 +55,8 @@ @property (nonatomic, readonly, getter=isVisible) BOOL visible; @property (nonatomic, readonly, getter=isAnimating) BOOL animating; -@property (nonatomic, copy) NSString *leftStringValue, *rightStringValue; -@property (nonatomic) SEL leftAction, rightAction; -@property (nonatomic, assign) id leftTarget, rightTarget; -@property (nonatomic) NSInteger leftState, rightState; +@property (nonatomic, readonly) NSTextField *leftField, *rightField; +@property (nonatomic, readonly) NSProgressIndicator *progressIndicator; @property (nonatomic, retain) NSImage *icon; @property (nonatomic) SKProgressIndicatorStyle progressIndicatorStyle; @property (nonatomic) double progressIndicatorValue, progressIndicatorMaxValue; @@ -65,7 +63,4 @@ - (void)toggleBelowView:(NSView *)view animate:(BOOL)animate; -- (void)startProgressAnimation:(id)sender; -- (void)stopProgressAnimation:(id)sender; - @end Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2022-07-06 15:56:51 UTC (rev 12981) +++ trunk/SKStatusBar.m 2022-07-06 16:18:04 UTC (rev 12982) @@ -62,8 +62,8 @@ @implementation SKStatusBar -@synthesize animating; -@dynamic visible, leftStringValue, rightStringValue, leftAction, leftTarget, rightAction, rightTarget, leftState, rightState, icon, progressIndicatorStyle, progressIndicatorValue, progressIndicatorMaxValue; +@synthesize animating, leftField, rightField, progressIndicator; +@dynamic visible, icon, progressIndicatorStyle, progressIndicatorValue, progressIndicatorMaxValue; - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; @@ -333,30 +333,6 @@ } } -- (double)progressIndicatorValue { - return progressIndicator ? [progressIndicator doubleValue] : 0.0; -} - -- (void)setProgressIndicatorValue:(double)value { - [progressIndicator setDoubleValue:value]; -} - -- (double)progressIndicatorMaxValue { - return progressIndicator ? [progressIndicator maxValue] : 0.0; -} - -- (void)setProgressIndicatorMaxValue:(double)maxValue { - [progressIndicator setMaxValue:maxValue]; -} - -- (void)startProgressAnimation:(id)sender { - [progressIndicator startAnimation:sender]; -} - -- (void)stopProgressAnimation:(id)sender { - [progressIndicator stopAnimation:sender]; -} - #pragma mark Accessibility - (BOOL)accessibilityIsIgnored { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit