//
//  GSToolSelect.h
//  GlyphsCore
//
//  Created by Georg Seifert on 16.04.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSSelectableElementProtocol.h>
#import <GlyphsApp/GlyphsApp.h>

@class GSElement;
@class GSHandle;

NS_ASSUME_NONNULL_BEGIN

@interface GSToolSelect : GlyphsPathPlugin <GSShortcutCommandProtocol> {
	NSPoint _selectionDrag;
	CGFloat _selectionAngle;
	CGFloat _preciseSelectionAngle;
	CGFloat _grabbedPathTime;
	GSHandle *_referenceHandle;
	BOOL _drawHangulComponentCloud;
}
//@property (nonatomic, retain) GSHandle *selectionBoundsHandle;

- (void)mouseDoubleDown:(NSEvent *)theEvent;

- (void)selectGlyph:(NSEvent *)theEvent;

- (void)selectAtPoint:(NSPoint)point withModifier:(NSEventModifierFlags)modifierFlag;

- (void)selectInPath:(NSBezierPath *)path withModifier:(NSEventModifierFlags)modifierFlag;

- (nullable GSSelectableElement *)elementAtPoint:(NSPoint)loc atLayer:(GSLayer *)layer;

- (nullable GSSelectableElement *)elementAtPoint:(NSPoint)aPoint atLayer:(GSLayer *)layer ignoreLocked:(BOOL)ignoreLocked;

- (NSMutableArray *)elementsInPath:(NSBezierPath *)path atLayer:(GSLayer *)layer modifier:(NSEventModifierFlags)modifierFlag;

- (IBAction)makeCorner:(id)sender;
- (IBAction)makeCornerForAll:(id)sender;
- (void)doMakeCorner:(GSLayer *)activeLayer forAll:(BOOL)forAll;

- (IBAction)reconnectNodes:(id)sender;
- (IBAction)reconnectNodesForAll:(id)sender;
- (void)doReconnectNodes:(NSMenuItem *)sender forAll:(BOOL)forAll;

- (IBAction)openCorners:(id)sender;
- (IBAction)openCornersForAll:(id)sender;
- (void)doOpenCorners:(GSLayer *)activeLayer forAll:(BOOL)forAll;

- (IBAction)decomposeComponentsSelection:(id)sender;

- (IBAction)makeGlobal:(id)sender;

- (IBAction)setBackgroundImageCropToMetrics:(id)sender;

- (nullable GSHandle *)handleForPoint:(NSPoint)aPoint atBounds:(NSRect)bounds angle:(nullable NSAffineTransform *)transform;

#ifndef GLYPHS_LITE
- (IBAction)convertToCubic:(id)sender;
- (IBAction)convertToQuadratic:(id)sender;
- (IBAction)convertToBezier:(id)sender;
- (IBAction)convertToHobby:(id)sender;
- (IBAction)addQuadraticOffcurve:(id)sender;
- (IBAction)removeQuadraticOffcurve:(id)sender;
#endif

@end

NS_ASSUME_NONNULL_END
