Revision: 14533
http://sourceforge.net/p/skim-app/code/14533
Author: hofman
Date: 2024-10-09 14:34:44 +0000 (Wed, 09 Oct 2024)
Log Message:
-----------
Reset transitions array when unsetting separate flag, so the when setting it
will build the tranisitions from the single transitions. Use transitions array
with single transition when not using separate transitions, so we don't need a
separate currentTransitions property. Only observe transitions that are active.
Modified Paths:
--------------
trunk/Base.lproj/TransitionSheet.xib
trunk/SKPresentationOptionsSheetController.h
trunk/SKPresentationOptionsSheetController.m
trunk/SKTransitionInfo.h
Modified: trunk/Base.lproj/TransitionSheet.xib
===================================================================
--- trunk/Base.lproj/TransitionSheet.xib 2024-10-08 22:44:31 UTC (rev
14532)
+++ trunk/Base.lproj/TransitionSheet.xib 2024-10-09 14:34:44 UTC (rev
14533)
@@ -443,7 +443,7 @@
<string>title</string>
</declaredKeys>
<connections>
- <binding destination="-2" name="contentArray"
keyPath="currentTransitions" id="491"/>
+ <binding destination="-2" name="contentArray"
keyPath="transitions" id="he9-eu-FOh"/>
</connections>
</arrayController>
</objects>
Modified: trunk/SKPresentationOptionsSheetController.h
===================================================================
--- trunk/SKPresentationOptionsSheetController.h 2024-10-08 22:44:31 UTC
(rev 14532)
+++ trunk/SKPresentationOptionsSheetController.h 2024-10-09 14:34:44 UTC
(rev 14533)
@@ -72,7 +72,6 @@
@property (nonatomic) BOOL separate;
@property (nonatomic, readonly) SKLabeledTransitionInfo *transition;
@property (nonatomic, nullable, copy) NSArray<SKLabeledTransitionInfo *>
*transitions;
-@property (nonatomic, nullable, readonly) NSArray<SKLabeledTransitionInfo *>
*currentTransitions;
@property (nonatomic, nullable, readonly) NSDocument *notesDocument;
@property (nonatomic, readonly) NSInteger notesDocumentOffset;
@property (nonatomic, readonly) NSUndoManager *undoManager;
Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m 2024-10-08 22:44:31 UTC
(rev 14532)
+++ trunk/SKPresentationOptionsSheetController.m 2024-10-09 14:34:44 UTC
(rev 14533)
@@ -66,8 +66,6 @@
#define PROPERTIES_KEY @"properties"
#define INFO_KEY @"info"
#define SEPARATE_KEY @"separate"
-#define TRANSITIONS_KEY @"transitions"
-#define CURRENTTRANSITIONS_KEY @"currentTransitions"
#define MAX_PAGE_COLUMN_WIDTH 100.0
@@ -84,15 +82,8 @@
@implementation SKPresentationOptionsSheetController
@synthesize notesDocumentPopUpButton, tableView, stylePopUpButton, okButton,
cancelButton, previewButton, tableWidthConstraint, boxLeadingConstraint,
arrayController, separate, transition, transitions, undoManager;
-@dynamic currentTransitions, notesDocument, notesDocumentOffset;
+@dynamic notesDocument, notesDocumentOffset;
-+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
- NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
- if ([key isEqualToString:CURRENTTRANSITIONS_KEY])
- keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet
setWithObjects:SEPARATE_KEY, TRANSITIONS_KEY, nil]];
- return keyPaths;
-}
-
- (instancetype)initForController:(SKMainWindowController *)aController {
self = [super init];
if (self) {
@@ -99,7 +90,7 @@
controller = aController;
separate = NO;
transition = [[SKLabeledTransitionInfo alloc] init];
- transitions = nil;
+ transitions = @[transition];
}
return self;
}
@@ -106,7 +97,6 @@
- (void)dealloc {
SKENSURE_MAIN_THREAD(
- [self stopObservingTransitions:@[transition]];
[self stopObservingTransitions:transitions];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[self window] setDelegate:nil];
@@ -164,7 +154,7 @@
SKTransitionInfo *info = [transitionController transition];
if (info)
[transition setInfo:info];
- [self startObservingTransitions:@[transition]];
+ [self startObservingTransitions:transitions];
// collapse the table, it is already hidden
[boxLeadingConstraint setConstant:BOX_OFFSET];
@@ -200,9 +190,7 @@
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
}
-- (void)makeTransitions {
- if (transitions) return;
-
+- (void)makeTransitions:(BOOL)initial {
// determine the table width by getting the largest page label
NSTableColumn *tableColumn = [tableView
tableColumnWithIdentifier:PAGE_COLUMNID];
id cell = [[tableColumn dataCell] copy];
@@ -211,13 +199,16 @@
[cell setFont:[[NSFontManager sharedFontManager] convertFont:[cell font]
toHaveTrait:NSBoldFontMask]];
NSMutableArray *array = [NSMutableArray array];
- NSDictionary *dictionary = [transition properties];
- NSEnumerator *ptEnum = [[[controller transitionControllerCreating:NO]
pageTransitions] objectEnumerator];
+ NSEnumerator *ptEnum = initial ? [[[controller
transitionControllerCreating:NO] pageTransitions] objectEnumerator] : nil;
SKThumbnail *tn = nil;
+ SKLabeledTransitionInfo *info;
for (SKThumbnail *next in [controller thumbnails]) {
if (tn) {
- SKLabeledTransitionInfo *info = [[SKLabeledTransitionInfo alloc]
initWithProperties:([ptEnum nextObject] ?: dictionary)];
+ if (initial)
+ info = [[SKLabeledTransitionInfo alloc]
initWithProperties:[ptEnum nextObject]];
+ else
+ info = [[SKLabeledTransitionInfo alloc]
initWithTransitionInfo:transition];
[info setThumbnail:tn];
[info setToThumbnail:next];
[array addObject:info];
@@ -425,9 +416,17 @@
[window makeFirstResponder:firstResponder];
if (separate) {
- [self makeTransitions];
width += [tableWidthConstraint constant] + TABLE_OFFSET;
}
+
+ // when undo or redo will also set the transitions
+ if ([[self undoManager] isUndoing] == NO && [[self undoManager]
isRedoing] == NO) {
+ if (separate)
+ [self makeTransitions:isVisible == NO];
+ else
+ [self setTransitions:@[transition]];
+ }
+
if (isVisible && [NSView shouldShowSlideAnimation]) {
[NSAnimationContext runAnimationGroup:^(NSAnimationContext
*context){
[[boxLeadingConstraint animator] setConstant:width];
@@ -458,10 +457,6 @@
}
}
-- (NSArray *)currentTransitions {
- return separate ? transitions : @[transition];
-}
-
- (NSDocument *)notesDocument {
[self window];
return [[notesDocumentPopUpButton selectedItem] representedObject];
Modified: trunk/SKTransitionInfo.h
===================================================================
--- trunk/SKTransitionInfo.h 2024-10-08 22:44:31 UTC (rev 14532)
+++ trunk/SKTransitionInfo.h 2024-10-09 14:34:44 UTC (rev 14533)
@@ -52,6 +52,7 @@
BOOL shouldRestrict;
}
+- (instancetype)initWithTransitionInfo:(SKTransitionInfo *)info;
- (instancetype)initWithProperties:(NSDictionary *)dictionary;
@property (nonatomic) SKTransitionStyle style;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit