Flycut/AppController.h

119 lines
3.9 KiB
C
Raw Normal View History

2011-03-20 15:16:13 +08:00
//
// AppController.m
// Flycut
2011-03-20 15:16:13 +08:00
//
// 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.
2011-03-20 15:16:13 +08:00
//
// AppController owns and interacts with the FlycutOperator, providing a user
// interface and platform-specific mechanisms.
2011-03-20 15:16:13 +08:00
#import <Cocoa/Cocoa.h>
#import <ApplicationServices/ApplicationServices.h>
#import "BezelWindow.h"
#import "SRRecorderControl.h"
#import "SRKeyCodeTransformer.h"
#import "FlycutOperator.h"
2011-08-01 21:43:33 +08:00
#import "SGHotKey.h"
2011-03-20 15:16:13 +08:00
@class SGHotKey;
2011-03-20 15:16:13 +08:00
@interface AppController : NSObject <NSMenuDelegate, NSApplicationDelegate, FlycutStoreDelegate> {
2011-03-20 15:16:13 +08:00
BezelWindow *bezel;
2011-08-01 21:43:33 +08:00
SGHotKey *mainHotKey;
2011-03-20 15:16:13 +08:00
IBOutlet SRRecorderControl *mainRecorder;
IBOutlet NSPanel *prefsPanel;
IBOutlet NSBox *appearancePanel;
2011-03-20 15:16:13 +08:00
int mainHotkeyModifiers;
SRKeyCodeTransformer *srTransformer;
BOOL isBezelDisplayed;
BOOL isBezelPinned; // Currently not used
NSString *currentKeycodeCharacter;
2016-01-17 12:16:55 +08:00
NSDateFormatter* dateFormat;
2017-09-03 11:13:52 +08:00
NSArray *settingsSyncList;
FlycutOperator *flycutOperator;
2011-03-20 15:16:13 +08:00
// Status item -- the little icon in the menu bar
NSStatusItem *statusItem;
NSString *statusItemText;
NSImage *statusItemImage;
2011-03-20 15:16:13 +08:00
// 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;
2011-03-20 15:16:13 +08:00
// 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
2011-03-20 15:16:13 +08:00
NSNumber *pbBlockCount;
//Preferences
NSDictionary *standardPreferences;
int jcDisplayNum;
BOOL issuedRememberResizeWarning;
BOOL needBezelUpdate;
BOOL needMenuUpdate;
2011-03-20 15:16:13 +08:00
}
// Basic functionality
-(void) pollPB:(NSTimer *)timer;
-(void) addClipToPasteboard:(NSString*)pbFullText;
2011-03-20 15:16:13 +08:00
-(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;
2011-03-20 15:16:13 +08:00
// Hotkey related
-(void)hitMainHotKey:(SGHotKey *)hotKey;
2011-03-20 15:16:13 +08:00
// Bezel related
-(void) updateBezel;
2011-03-20 15:16:13 +08:00
-(void) showBezel;
-(void) hideBezel;
-(void) processBezelKeyDown:(NSEvent *)theEvent;
-(void) processBezelMouseEvents:(NSEvent *)theEvent;
2011-03-20 15:16:13 +08:00
-(void) metaKeysReleased;
// 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;
2011-03-20 15:16:13 +08:00
-(IBAction) setDisplayNumPref:(id)sender;
-(IBAction) setBezelAlpha:(id)sender;
-(IBAction) setBezelHeight:(id)sender;
-(IBAction) setBezelWidth:(id)sender;
2011-03-20 15:16:13 +08:00
-(IBAction) switchMenuIcon:(id)sender;
-(IBAction) toggleLoadOnStartup:(id)sender;
-(IBAction) toggleMainHotKey:(id)sender;
2017-09-03 11:13:52 +08:00
-(IBAction) toggleICloudSyncSettings:(id)sender;
-(IBAction) toggleICloudSyncClippings:(id)sender;
-(IBAction) setSavePreference:(id)sender;
2011-03-20 15:16:13 +08:00
-(void) setHotKeyPreferenceForRecorder:(SRRecorderControl *)aRecorder;
@end