1 /* 2 Project: Graphos 3 GRDocView.h 4 5 Copyright (C) 2000-2013 GNUstep Application Project 6 7 Author: Enrico Sersale (original GDraw implementation) 8 Author: Ing. Riccardo Mottola 9 10 This application is free software; you can redistribute it and/or 11 modify it under the terms of the GNU General Public 12 License as published by the Free Software Foundation; either 13 version 2 of the License, or (at your option) any later version. 14 15 This application is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 Library General Public License for more details. 19 20 You should have received a copy of the GNU General Public 21 License along with this library; if not, write to the Free 22 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 */ 24 25 #import <Foundation/Foundation.h> 26 #import <AppKit/AppKit.h> 27 28 #import "GRBezierPathEditor.h" 29 30 #ifndef ASSIGN 31 #define ASSIGN(object,value) ({\ 32 id __value = (id)(value); \ 33 id __object = (id)(object); \ 34 if (__value != __object) \ 35 { \ 36 if (__value != nil) \ 37 { \ 38 [__value retain]; \ 39 } \ 40 object = __value; \ 41 if (__object != nil) \ 42 { \ 43 [__object release]; \ 44 } \ 45 } \ 46 }) 47 #endif 48 49 @interface GRDocView : NSView 50 { 51 NSMutableArray *objects, *delObjects; 52 NSMutableArray *lastObjects; 53 int edind; 54 BOOL shiftclick, altclick, ctrlclick; 55 56 NSRect pageRect, a4Rect, zmdRect; 57 int zIndex; 58 CGFloat zFactor; 59 BOOL isDrawingForPrinting; 60 NSCursor *cur; 61 } 62 63 - (id)initWithFrame:(NSRect)aRect; 64 - (NSDictionary *) objectDictionary; 65 - (BOOL)createObjectsFromDictionary:(NSDictionary *)dict; 66 67 /** 68 * add a GRBezierPath 69 */ 70 - (void)addPath; 71 72 /** 73 * add a GRBox 74 */ 75 - (void)addBox; 76 77 /** 78 * add a GRCircle 79 */ 80 - (void)addCircle; 81 82 /** 83 * add a GRText at the specified point 84 */ 85 - (void)addTextAtPoint:(NSPoint)p; 86 87 /** 88 * make a copy of the objects invoking the object's duplicate method 89 */ 90 - (NSArray *)duplicateObjects:(NSArray *)objs andMoveTo:(NSPoint)p; 91 92 /** 93 * update the view orientation and size according to the new print info object 94 */ 95 - (void)updatePrintInfo: (NSPrintInfo *)pi; 96 97 - (void)deleteSelectedObjects; 98 - (void)startDrawingAtPoint:(NSPoint)p; 99 - (void)selectObjectAtPoint:(NSPoint)p; 100 - (void)editPathAtPoint:(NSPoint)p; 101 - (void)editTextAtPoint:(NSPoint)p; 102 103 - (void)editSelectedText; 104 105 - (void)moveSelectedObjects:(NSArray *)objs startingPoint:(NSPoint)startp; 106 107 - (BOOL)moveControlPointOfEditor:(GRPathEditor *)editor toPoint:(NSPoint)pos; 108 - (BOOL)moveBezierHandleOfEditor:(GRBezierPathEditor *)editor toPoint:(NSPoint)pos; 109 - (IBAction)changePointsOfCurrentPathToSymmetric:(id)sender; 110 - (IBAction)changePointsOfCurrentPathToCusp:(id)sender; 111 - (IBAction)changePointsOfCurrentPathByOverlap:(id)sender; 112 - (IBAction)changePointsOfCurrentPathByExtract:(id)sender; 113 - (IBAction)deletePointsOfCurrentPath:(id)sender; 114 - (void)subdividePathAtPoint:(NSPoint)p splitIt:(BOOL)split; 115 116 - (NSDictionary *)selectionProperties; 117 - (void)setSelectionProperties: (NSDictionary *)properties; 118 119 - (IBAction)moveSelectedObjectsToFront:(id)sender; 120 - (IBAction)moveSelectedObjectsToBack:(id)sender; 121 - (void)unselectOtherObjects:(GRDrawableObject *)anObject; 122 - (void)zoomOnPoint:(NSPoint)p zoomOut:(BOOL)isout; 123 - (void)zoomOnPoint:(NSPoint)p withFactor:(int)index; 124 - (void)movePageFromHandPoint:(NSPoint)handpos; 125 - (IBAction)zoom50:(id)sender; 126 - (IBAction)zoom100:(id)sender; 127 - (IBAction)zoom200:(id)sender; 128 - (IBAction)zoomFitPage:(id)sender; 129 - (IBAction)zoomFitWidth:(id)sender; 130 131 - (IBAction)cut:(id)sender; 132 - (IBAction)copy:(id)sender; 133 - (IBAction)paste:(id)sender; 134 135 - (void)saveCurrentObjects; 136 - (void)saveCurrentObjectsDeep; 137 - (void)restoreLastObjects; 138 139 - (void)verifyModifiersOfEvent:(NSEvent *)theEvent; 140 141 - (BOOL)shiftclick; 142 - (BOOL)altclick; 143 - (BOOL)ctrlclick; 144 145 @end 146