Permalink
Browse files

WIP restoring visual effects support. We now hand the information dow…

…n to the window's content view, but we seem to be doing something wrong setting up the CATransition. But at least we do see implicit animations, even if it's not yet the right ones.
  • Loading branch information...
uliwitness committed Apr 24, 2016
1 parent 1f804f0 commit 67705ba3e11b79bdccfbcee27485b811f62ae089
@@ -88,7 +88,7 @@ void WILDGoBackInstruction( LEOContext* inContext )
// +++ Should we set the result here to indicate success?
LEOContextRelease(inContext);
} );
}, userData->GetVisualEffectType(), userData->GetVisualEffectSpeed() );
}
if( canGoThere )
userData->SetStack( destinationObject->GetStack() );
@@ -178,7 +178,7 @@ void WILDGoInstruction( LEOContext* inContext )
// +++ Should we set the result here to indicate success?
LEOContextRelease(inContext);
});
}, userData->GetVisualEffectType(), userData->GetVisualEffectSpeed());
LEOCleanUpStackToPtr( inContext, inContext->stackEndPtr -1 );
return;
@@ -190,7 +190,7 @@ void WILDGoInstruction( LEOContext* inContext )
CStack * theStack = destinationObject->GetStack();
if( theStack && theStack->GetStyle() == EStackStylePopup && overPartObject )
openInMode |= EOpenInNewWindow;
LEOPauseContext( inContext );
LEOContextRetain( inContext );
@@ -202,17 +202,13 @@ void WILDGoInstruction( LEOContext* inContext )
// +++ Should we set the result here to indicate success?
LEOContextRelease(inContext);
} );
}, userData->GetVisualEffectType(), userData->GetVisualEffectSpeed() );
}
if( canGoThere )
userData->SetStack( destinationObject->GetStack() );
LEOCleanUpStackToPtr( inContext, inContext->stackEndPtr -1 );
// CStack * frontStack = userData->GetStack();
// CCard * currentCard = frontStack->GetCurrentCard();
// currentCard->SetTransitionTypeAndSpeed( std::string(), EVisualEffectSpeedNormal );
if( !canGoThere )
{
LEOResumeContext( inContext );
@@ -27,7 +27,7 @@ class CDocumentManagerMac : public CDocumentManager
public:
virtual ~CDocumentManagerMac() {};
virtual void OpenDocumentFromURL( const std::string& inURL, std::function<void(CDocument*)> inCompletionBlock );
virtual void OpenDocumentFromURL( const std::string& inURL, std::function<void(CDocument*)> inCompletionBlock, const std::string& inEffectType, TVisualEffectSpeed inSpeed );
virtual void Quit();
};
@@ -23,7 +23,7 @@
}
void CDocumentManagerMac::OpenDocumentFromURL( const std::string& inURL, std::function<void(CDocument*)> inCompletionBlock )
void CDocumentManagerMac::OpenDocumentFromURL( const std::string& inURL, std::function<void(CDocument*)> inCompletionBlock, const std::string& inEffectType, TVisualEffectSpeed inSpeed )
{
try
{
@@ -59,7 +59,7 @@
{
if( currDoc->GetURL().compare( slashlessFileURL ) == 0 )
{
currDoc->GetStack(0)->GetCard(0)->GoThereInNewWindow( EOpenInNewWindow, NULL, NULL, [currDoc,inCompletionBlock](){ inCompletionBlock(currDoc); } );
currDoc->GetStack(0)->GetCard(0)->GoThereInNewWindow( EOpenInNewWindow, NULL, NULL, [currDoc,inCompletionBlock](){ inCompletionBlock(currDoc); }, inEffectType, inSpeed );
[NSDocumentController.sharedDocumentController noteNewRecentDocumentURL: [NSURL URLWithString: [NSString stringWithUTF8String: inURL.c_str()]]];
return;
}
@@ -69,7 +69,7 @@
mOpenDocuments.push_back( new CDocumentMac() );
CDocumentRef currDoc( mOpenDocuments.back(), true ); // Take over ownership of the pointer we just 'new'ed, mOpenDocuments retains it by itself.
currDoc->LoadFromURL( fileURL, [inCompletionBlock,inURL](Carlson::CDocument * inDocument)
currDoc->LoadFromURL( fileURL, [inCompletionBlock,inURL,inEffectType,inSpeed](Carlson::CDocument * inDocument)
{
NSString* urlStr = [[[NSBundle mainBundle] bundleURL] absoluteString];
if( [urlStr characterAtIndex: urlStr.length -1] != '/' )
@@ -89,7 +89,7 @@
inCompletionBlock(NULL);
return;
}
theCppStack->Load( [inDocument,inCompletionBlock,inURL](Carlson::CStack* inStack)
theCppStack->Load( [inDocument,inCompletionBlock,inURL,inEffectType,inSpeed](Carlson::CStack* inStack)
{
//UKLog(@"Stack completion entered %p", inStack);
//inStack->Dump();
@@ -101,12 +101,12 @@
}
CCard * firstCard = (inStack ? inStack->GetCard(0) : NULL);
//UKLog(@"Stack completion entered (2) %p in %p", firstCard, inStack);
firstCard->Load( [inDocument,inStack,inCompletionBlock,inURL](Carlson::CLayer*inCard)
firstCard->Load( [inDocument,inStack,inCompletionBlock,inURL,inEffectType,inSpeed](Carlson::CLayer*inCard)
{
//UKLog(@"Card completion entered %p",inCard);
if( inCard )
{
inCard->GoThereInNewWindow( EOpenInNewWindow, NULL, NULL, [inDocument,inCompletionBlock,inURL](){ [NSDocumentController.sharedDocumentController noteNewRecentDocumentURL: [NSURL URLWithString: [NSString stringWithUTF8String: inURL.c_str()]]]; inCompletionBlock(inDocument); } );
inCard->GoThereInNewWindow( EOpenInNewWindow, NULL, NULL, [inDocument,inCompletionBlock,inURL,inEffectType,inSpeed](){ [NSDocumentController.sharedDocumentController noteNewRecentDocumentURL: [NSURL URLWithString: [NSString stringWithUTF8String: inURL.c_str()]]]; inCompletionBlock(inDocument); }, inEffectType, inSpeed );
}
else
{
@@ -23,7 +23,7 @@
[mView removeFromSuperview];
if( mView )
{
[inSuperView addSubview: mView]; // Make sure we show up in right layering order.
[inSuperView.animator addSubview: mView]; // Make sure we show up in right layering order.
}
return;
}
@@ -55,7 +55,7 @@
[mView.layer setShadowOffset: CGSizeMake(mShadowOffsetWidth, -mShadowOffsetHeight)];
[mView.layer setShadowRadius: mShadowBlurRadius];
[mView.layer setShadowOpacity: mShadowColorAlpha == 0 ? 0.0 : 1.0];
[inSuperView addSubview: mView];
[inSuperView.animator addSubview: mView];
}
@@ -43,12 +43,12 @@ class CStackMac : public CStack, public CMacScriptableObjectBase
CStackMac( const std::string& inURL, ObjectID inID, const std::string& inName, const std::string& inFileName, CDocument * inDocument );
virtual ~CStackMac();
virtual bool GoThereInNewWindow( TOpenInMode inOpenInMode, CStack* oldStack, CPart* overPart, std::function<void()> completionHandler );
virtual bool GoThereInNewWindow( TOpenInMode inOpenInMode, CStack* oldStack, CPart* overPart, std::function<void()> completionHandler, const std::string& inEffectType, TVisualEffectSpeed inSpeed );
virtual void SetPeeking( bool inState );
virtual void SetStyle( TStackStyle inStyle );
virtual void SetResizable( bool n );
virtual void SetCurrentCard( CCard* inCard );
virtual void SetCurrentCard( CCard* inCard, const std::string& inEffectType = "", TVisualEffectSpeed inSpeed = EVisualEffectSpeedNormal );
virtual void SetEditingBackground( bool inState );
virtual void SetTool( TTool inTool );
virtual void SetName( const std::string& inName );
@@ -64,16 +64,16 @@
}
bool CStackMac::GoThereInNewWindow( TOpenInMode inOpenInMode, CStack* oldStack, CPart* overPart, std::function<void()> completionHandler )
bool CStackMac::GoThereInNewWindow( TOpenInMode inOpenInMode, CStack* oldStack, CPart* overPart, std::function<void()> completionHandler, const std::string& inEffectType, TVisualEffectSpeed inSpeed )
{
Load([this,oldStack,inOpenInMode,overPart,completionHandler](CStack *inStack)
Load([this,oldStack,inOpenInMode,overPart,completionHandler,inEffectType,inSpeed](CStack *inStack)
{
if( GetCurrentCard() == NULL )
{
CCard * theCard = inStack->GetCard(0);
theCard->Load([inOpenInMode,oldStack,overPart,completionHandler]( CLayer *inCard )
theCard->Load([inOpenInMode,oldStack,overPart,completionHandler,inEffectType,inSpeed]( CLayer *inCard )
{
inCard->GoThereInNewWindow( inOpenInMode, oldStack, overPart, completionHandler );
inCard->GoThereInNewWindow( inOpenInMode, oldStack, overPart, completionHandler, inEffectType, inSpeed);
});
}
else
@@ -153,20 +153,22 @@
}
void CStackMac::SetCurrentCard( CCard* inCard )
void CStackMac::SetCurrentCard( CCard* inCard, const std::string& inEffectType, TVisualEffectSpeed inSpeed )
{
if( inCard && !mMacWindowController )
mMacWindowController = [[WILDStackWindowController alloc] initWithCppStack: this];
if( mMacWindowController )
{
[CATransaction begin];
[CATransaction setAnimationDuration: 0.0];
if( inEffectType.empty() )
[CATransaction setAnimationDuration: 0.0];
else
[mMacWindowController setVisualEffectType: [NSString stringWithUTF8String: inEffectType.c_str()] speed: inSpeed];
[mMacWindowController removeAllViews];
}
CStack::SetCurrentCard(inCard);
CStack::SetCurrentCard(inCard, inEffectType, inSpeed);
if( mMacWindowController )
{
@@ -204,7 +204,7 @@ -(void) distributedView: (UKDistributedView*)distributedView cellDoubleClickedAt
{
currStack->Show(EEvenIfVisible);
currStack->SetEditingBackground( shouldEditBg );
} );
}, "", EVisualEffectSpeedNormal );
}
}
@@ -10,6 +10,7 @@
#define __Stacksmith__WILDStackWindowController__
#import <Cocoa/Cocoa.h>
#include "CScriptableObjectValue.h"
namespace Carlson {
@@ -39,6 +40,7 @@ class CPart;
-(void) removeAllViews;
-(void) createAllViews;
-(void) setVisualEffectType: (NSString*)inEffectType speed: (Carlson::TVisualEffectSpeed)inSpeed;
-(void) drawBoundingBoxes;
-(void) refreshExistenceAndOrderOfAllViews;
Oops, something went wrong.

0 comments on commit 67705ba

Please sign in to comment.