Skip to content

Commit

Permalink
The 3.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Hoel committed Nov 19, 2018
1 parent fed7431 commit 0db03b9
Show file tree
Hide file tree
Showing 63 changed files with 2,972 additions and 396 deletions.
79 changes: 76 additions & 3 deletions Brushes-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Brushes Redux</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon-64x64</string>
<string>export_brushes_icon-modern@2x</string>
<string>Icon-64x64</string>
<string>Icon-320x320</string>
<string>export_brushes_icon-modern@2x</string>
</array>
<key>CFBundleTypeName</key>
<string>Brushes Redux Painting</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>dk.holi.brushes-dev.packed</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
Expand Down Expand Up @@ -37,21 +60,22 @@
<string>AppIcon72x72</string>
<string>AppIcon60x60</string>
<string>AppIcon57x57</string>
<string>AppIcon167x167</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>dk.holi.brushes</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.1.2</string>
<string>3.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -66,11 +90,36 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>3.1.2.1</string>
<string>3.2</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string></string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-2</string>
<string>dbapi-8-emm</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>UIAppFonts</key>
<array>
<string>MaterialDesignIcons.ttf</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIStatusBarHidden</key>
Expand All @@ -91,5 +140,29 @@
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Brushes Redux Painting</string>
<key>UTTypeIdentifier</key>
<string>dk.holi.brushes-dev.packed</string>
<key>UTTypeSize320IconFile</key>
<string>Icon-320x320</string>
<key>UTTypeSize64IconFile</key>
<string>Icon-64x64</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>brushes</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
105 changes: 75 additions & 30 deletions Brushes.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Classes/WDBezierSegment.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <Foundation/Foundation.h>

extern const float kDefaultFlatness;
extern unsigned long long BezierSegmentRecusionCounter;

@class WDBezierNode;
@class WD3DPoint;
Expand Down
31 changes: 31 additions & 0 deletions Classes/WDBezierSegment.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
#import "WD3DPoint.h"
#import "WDBezierSegment.h"
#import "WDBezierNode.h"
#import <Crashlytics/Crashlytics.h>
#import "WDActiveState.h"
#import "WDBrush.h"
#import "WDTool.h"

const float kDefaultFlatness = 1;
unsigned long long BezierSegmentRecusionCounter;

@implementation WDBezierSegment

Expand Down Expand Up @@ -101,6 +106,32 @@ - (WD3DPoint *) splitAtT:(float)t left:(WDBezierSegment **)L right:(WDBezierSegm

- (void) flattenIntoArray:(NSMutableArray *)points
{
// Debug comming up

if (BezierSegmentRecusionCounter > 100)
CLSNSLog(@"BezierSegmentRecusionCounter > 100");

if (BezierSegmentRecusionCounter > 200)
CLSNSLog(@"BezierSegmentRecusionCounter > 200");

if (BezierSegmentRecusionCounter > 300)
CLSNSLog(@"BezierSegmentRecusionCounter > 300");

if (BezierSegmentRecusionCounter > 400)
CLSNSLog(@"BezierSegmentRecusionCounter > 400");

if (BezierSegmentRecusionCounter > 500)
{
CLSNSLog(@"BezierSegmentRecusionCounter > 500 - bailing out of flattenIntoArray:");
CLSNSLog(@"Brushes count: %lu", (unsigned long)[WDActiveState sharedInstance].brushesCount);
CLSNSLog(@"Brush data: %@", [[WDActiveState sharedInstance].brush allProperties]);
CLSNSLog(@"Active tool (icon name): %@", [WDActiveState sharedInstance].activeTool.iconName);
CLSNSLog(@"Paint color: %@", [WDActiveState sharedInstance].paintColor);
return;
}

BezierSegmentRecusionCounter++;

if ([self isFlatWithTolerance:kDefaultFlatness]) {
if (points.count == 0) {
[points addObject:self.start];
Expand Down
7 changes: 6 additions & 1 deletion Classes/WDBrowserController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
UIPopoverController *popoverController_;
UIBarButtonItem *selectItem_;
UIBarButtonItem *deleteItem_;
UIBarButtonItem *shareItem_;

NSMutableSet *selectedPaintings_;

Expand All @@ -56,15 +55,21 @@
@property (nonatomic, weak) UIViewController *currentPopoverViewController;
@property (nonatomic) UIActivityIndicatorView *activityIndicator;
@property (nonatomic) WDGridView *gridView;
@property (nonatomic) UIBarButtonItem *shareItem;

- (void) openDocument:(WDDocument *)document editing:(BOOL)editing;
- (void) showOpenFailure:(WDDocument *)document;

- (void) properlyEnableNavBarItems;

- (void) sharePaintings:(NSString *)format;
- (void) emailPaintings:(NSString *)format;
- (void) sendToDropbox:(NSString *)format;

- (void) createNewPainting:(CGSize)size;

- (void) showExportPanel:(id)sender;

- (void) showController:(UIViewController *)controller from:(id)sender;

@end
92 changes: 84 additions & 8 deletions Classes/WDBrowserController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "WDThumbnailView.h"
#import "WDUtilities.h"
#import "WDPaintingIterator.h"
#import "MaterialDesignIcons.h"

#define ALLOW_CAMERA_IMPORT NO

Expand Down Expand Up @@ -99,6 +100,58 @@ - (void) hidePopovers
}
}

- (void) sharePaintings: (NSString *)format
{
[self dismissPopoverAnimated:YES];

NSString *contentType = [WDDocument contentTypeForFormat:format];
[self startExportActivity:contentType];

NSMutableArray* urls = [NSMutableArray arrayWithCapacity:[selectedPaintings_ count]];

WDPaintingIterator *iterator = [[WDPaintingIterator alloc] init];
iterator.paintings = [selectedPaintings_ allObjects];

iterator.block = ^void(WDDocument *document) {
NSError *err = nil;
NSData *data = [document contentsForType:contentType error:&err];

NSString *extension = nil;
if ([contentType isEqualToString:kWDBrushesFileType])
extension = kWDBrushesFileType;
else
extension = [document fileNameExtensionForType:contentType saveOperation:UIDocumentSaveForCreating];

NSString *fullName = [document.displayName stringByAppendingPathExtension:extension];
NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:fullName];
// Save the file to the temp path
[data writeToFile:path atomically:YES];

[activities_ removeActivityWithFilepath:path];

[urls addObject:[NSURL fileURLWithPath:path]];

};

iterator.completed = ^void(NSArray* paintings){
UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:urls applicationActivities:nil];
activityViewController.completionHandler = ^(NSString* activityType, BOOL completed) {
if (completed)
{
for(NSURL * url in urls)
{
// Remove the file again
[[NSFileManager defaultManager] removeItemAtURL:url error:nil];
}
}
};

[self showController:activityViewController from:self.shareItem];
};

[iterator processNext];
}

- (void) emailPaintings:(NSString *)format
{
[self dismissPopoverAnimated:YES];
Expand Down Expand Up @@ -224,13 +277,27 @@ - (void) buildEditingNavBar
action:@selector(showDeleteMenu:)];
}

if (!shareItem_) {
shareItem_ = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
action:@selector(showExportPanel:)];
if (!self.shareItem) {
self.shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showExportPanel:)];
}
/*
if (!cloudItem_) {
NSShadow *shadow = [NSShadow new];
[shadow setShadowColor : [UIColor colorWithWhite:0.0f alpha:0.0f]];
[shadow setShadowOffset : CGSizeMake(0.0f, -8.0f)];
cloudItem_ = [[UIBarButtonItem alloc] initWithTitle:MaterialDesignIconsCloudUpload style:UIBarButtonItemStylePlain target:self action:@selector(showCloudExportPanel:)];
NSDictionary *attributes = @{
NSFontAttributeName: [UIFont fontWithName:MaterialDesignIconsFontName size:30.0],
NSShadowAttributeName: shadow
};
[cloudItem_ setTitleTextAttributes:attributes forState:UIControlStateNormal];
[cloudItem_ setTitleTextAttributes:attributes forState:UIControlStateDisabled];
}
*/

self.navigationItem.rightBarButtonItems = @[shareItem_, deleteItem_];
self.navigationItem.rightBarButtonItems = @[self.shareItem, deleteItem_];

UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
Expand Down Expand Up @@ -626,7 +693,7 @@ - (NSString*) appFolderPath
- (void) properlyEnableNavBarItems
{
deleteItem_.enabled = [selectedPaintings_ count] == 0 ? NO : YES;
shareItem_.enabled = [selectedPaintings_ count] == 0 ? NO : YES;
self.shareItem.enabled = [selectedPaintings_ count] == 0 ? NO : YES;
}

- (void)restClient:(DBRestClient*)client uploadedFile:(NSString*)destPath from:(NSString*)srcPath
Expand Down Expand Up @@ -760,7 +827,8 @@ - (BOOL) dropboxIsLinked
return YES;
} else {
[self dismissPopoverAnimated:NO];
[[DBSession sharedSession] linkUserId:nil fromController:self];
//[[DBSession sharedSession] linkUserId:nil fromController:self];
[[DBSession sharedSession] linkFromController:self];
return NO;
}
}
Expand Down Expand Up @@ -807,7 +875,7 @@ - (void) showController:(UIViewController *)controller from:(id)sender
// embed in a nav controller
UIViewController *presentedController;

if ([controller isKindOfClass:[UIImagePickerController class]]) {
if ([controller isKindOfClass:[UIImagePickerController class]] || [controller isKindOfClass:[UIActivityViewController class]]) {
presentedController = controller;
} else {
presentedController = [[UINavigationController alloc] initWithRootViewController:controller];
Expand Down Expand Up @@ -840,6 +908,14 @@ - (void) showController:(UIViewController *)controller from:(id)sender

- (void) showExportPanel:(id)sender
{
/*
NSData *imageData = [canvas_.painting PNGRepresentationForCurrentState];
UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[imageData] applicationActivities:nil];
activityViewController.completionHandler = ^(NSString* activityType, BOOL completed) {
// do whatever you want to do after the activity view controller is finished
};
*/

WDExportController *controller = nil;

if (![self.currentPopoverViewController isKindOfClass:[WDExportController class]]) {
Expand Down
5 changes: 5 additions & 0 deletions Classes/WDBrushController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
action:@selector(randomize:)];
self.navigationItem.rightBarButtonItem = randomizeItem;

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}

return self;
}

Expand Down
12 changes: 10 additions & 2 deletions Classes/WDBrushesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

self.title = NSLocalizedString(@"Brushes", @"Brushes");


[self configureNavBar];

return self;
Expand Down Expand Up @@ -87,15 +88,22 @@ - (void) scrollToSelectedRowIfNotVisible
}

- (void) selectActiveBrush
{
{
NSUInteger activeRow = [[WDActiveState sharedInstance] indexOfActiveBrush];

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:activeRow inSection:0];

if (activeRow == 0)
{
[brushTable selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionTop];
return;
}

if ([[brushTable indexPathForSelectedRow] isEqual:[NSIndexPath indexPathForRow:activeRow inSection:0]]) {
[self scrollToSelectedRowIfNotVisible];
return;
}

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:activeRow inSection:0];
// in selectRowAtIndex, "None" means no scrolling; in scrollToNearest, "None" means do minimal scrolling
[brushTable selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[brushTable scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionNone animated:NO];
Expand Down
Loading

0 comments on commit 0db03b9

Please sign in to comment.