-
-
Notifications
You must be signed in to change notification settings - Fork 206
/
AppController.h
executable file
·129 lines (113 loc) · 4.32 KB
/
AppController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// AppController.m
// Flycut
//
// Flycut by Gennadiy Potapov and contributors. Based on Jumpcut by Steve Cook.
// Copyright 2011 General Arcade. All rights reserved.
//
// This code is open-source software subject to the MIT License; see the homepage
// at <https://github.com/TermiT/Flycut> for details.
//
// AppController owns and interacts with the FlycutOperator, providing a user
// interface and platform-specific mechanisms.
#import <Cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
#import "BezelWindow.h"
#import "SRRecorderControl.h"
#import "SRKeyCodeTransformer.h"
#import "FlycutOperator.h"
#import "SGHotKey.h"
@class SGHotKey;
@interface AppController : NSObject <NSMenuDelegate, NSApplicationDelegate, FlycutStoreDelegate, FlycutOperatorDelegate, BezelWindowDelegate> {
BezelWindow *bezel;
SGHotKey *mainHotKey;
IBOutlet SRRecorderControl *mainRecorder;
IBOutlet NSPanel *prefsPanel;
IBOutlet NSTextView *acknowledgementsView;
IBOutlet NSBox *appearancePanel;
int mainHotkeyModifiers;
SRKeyCodeTransformer *srTransformer;
BOOL isBezelDisplayed;
BOOL isBezelPinned; // Currently not used
NSString *currentKeycodeCharacter;
NSDateFormatter* dateFormat;
NSArray *settingsSyncList;
FlycutOperator *flycutOperator;
// Status item -- the little icon in the menu bar
NSStatusItem *statusItem;
NSString *statusItemText;
NSImage *statusItemImage;
IBOutlet NSTextField *savingSectionLabel;
IBOutlet NSTextField *saveFromBezelToLabel;
IBOutlet NSTextField *forgottenItemLabel;
IBOutlet NSButton *forgottenFavoritesCheckbox;
IBOutlet NSButton *forgottenClippingsCheckbox;
IBOutlet NSButton *saveToLocationButton;
IBOutlet NSButton *autoSaveToLocationButton;
// The menu attatched to same
IBOutlet NSMenu *jcMenu;
int jcMenuBaseItemsCount;
IBOutlet NSSearchField *searchBox;
NSResponder *menuFirstResponder;
dispatch_queue_t menuQueue;
NSRunningApplication *currentRunningApplication;
NSEvent *menuOpenEvent;
IBOutlet NSSlider * heightSlider;
IBOutlet NSSlider * widthSlider;
// A timer which will let us check the pasteboard;
// this should default to every .5 seconds but be user-configurable
NSTimer *pollPBTimer;
// We want an interface to the pasteboard
NSPasteboard *jcPasteboard;
// Track the clipboard count so we only act when its contents change
NSNumber *pbCount;
//stores PasteboardCount for internal Flycut pasteboard actions so they don't trigger any events
NSNumber *pbBlockCount;
//Preferences
NSDictionary *standardPreferences;
int jcDisplayNum;
BOOL needBezelUpdate;
BOOL needMenuUpdate;
}
+ (BOOL)isAppSandboxed;
// Basic functionality
-(void) pollPB:(NSTimer *)timer;
-(void) addClipToPasteboard:(NSString*)pbFullText;
-(void) setPBBlockCount:(NSNumber *)newPBBlockCount;
-(void) hideApp;
-(void) fakeCommandV;
-(IBAction)clearClippingList:(id)sender;
-(IBAction)mergeClippingList:(id)sender;
-(void)controlTextDidChange:(NSNotification *)aNotification;
-(BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector;
-(IBAction)searchItems:(id)sender;
// Hotkey related
-(void)hitMainHotKey:(SGHotKey *)hotKey;
// Bezel related
-(void) updateBezel;
-(void) showBezel;
-(void) hideBezel;
-(void) processBezelKeyDown:(NSEvent *)theEvent;
-(void) processBezelMouseEvents:(NSEvent *)theEvent;
-(void) metaKeysReleased;
-(void) windowDidResignKey:(NSNotification *)notification;
// Menu related
-(void) updateMenu;
-(IBAction) processMenuClippingSelection:(id)sender;
-(IBAction) activateAndOrderFrontStandardAboutPanel:(id)sender;
// Preference related
-(IBAction) showPreferencePanel:(id)sender;
-(IBAction) setRememberNumPref:(id)sender;
-(IBAction) setFavoritesRememberNumPref:(id)sender;
-(IBAction) setDisplayNumPref:(id)sender;
-(IBAction) setBezelAlpha:(id)sender;
-(IBAction) setBezelHeight:(id)sender;
-(IBAction) setBezelWidth:(id)sender;
-(IBAction) switchMenuIcon:(id)sender;
-(IBAction) toggleLoadOnStartup:(id)sender;
-(IBAction) toggleMainHotKey:(id)sender;
-(IBAction) toggleICloudSyncSettings:(id)sender;
-(IBAction) toggleICloudSyncClippings:(id)sender;
-(IBAction) setSavePreference:(id)sender;
-(void) setHotKeyPreferenceForRecorder:(SRRecorderControl *)aRecorder;
@end