1. Jens Alfke
  2. Murky


Murky / Source / RepoController.h

//  RepoController.h
//  Murky
//  Copyright 2008-2009 Jens Alfke. All rights reserved.

#import <Cocoa/Cocoa.h>
#import <ScriptingBridge/ScriptingBridge.h>

@class HgRepository, HgFile, HgRevision, HgTempDir, HgOperation;

/** The controller for a repository window. */
@interface RepoController : NSWindowController 
    IBOutlet NSOutlineView *_outline;
    IBOutlet NSTableView *_revisionTable;
    IBOutlet NSTreeController *_tree;
    IBOutlet NSArrayController *_revisions;
    IBOutlet NSSegmentedControl *_infoChooser;
    IBOutlet NSTextView *_infoView;
    IBOutlet NSImageView *_infoImageView;
    IBOutlet NSPanel *_commitSheet;
    IBOutlet NSTextView *_commitMessageField;
    IBOutlet NSPanel *_pushSheet;
    IBOutlet NSComboBox *_pushURLField;
    IBOutlet NSTextField *_pushDescriptionField;
    IBOutlet NSButton *_pullUpdateCheckbox;
    IBOutlet NSButton *_pushButton;
    IBOutlet NSPanel *_progressSheet;
    IBOutlet NSTextField *_progressMessageField, *_progressOutputField;
    IBOutlet NSProgressIndicator *_progressIndicator;
    IBOutlet NSButton *_progressStopButton;

    IBOutlet NSSegmentedControl *_hideShowUnmodifiedToolbarItem;
    IBOutlet NSButton *_viewModeButton;
    HgRepository *_repo;
    HgFile *_selectedFile;
    HgTempDir *_tempDir;
    NSMutableDictionary *_settings;
    BOOL _settingsChanged;
    NSMutableArray *_expandedPaths;
    HgOperation *_currentOperation;

+ (NSArray*) allRepoControllers;
+ (RepoController*) existingRepoControllerWithDirectory: (NSString*)directory;
+ (RepoController*) existingRepoControllerWithRepository: (HgRepository*)repo;
+ (RepoController*) repoControllerWithDirectory: (NSString*)directory 
                                          error: (NSError**)error;
- (id) initWithDirectory: (NSString*)path 
                   error: (NSError**)error;
- (id) initWithRepository: (HgRepository*)repo;

@property (readonly,nonatomic) NSString* directory;
@property (readonly,nonatomic) HgRepository* repository;

- (HgFile*) selectedFile;
- (NSArray*) selectedFiles;
@property (retain) HgRevision* selectedRevision;

/** Returns the file that's actually selected in the file tree.
    This will be the same as -selectedFile, except while handling a right-click contextual menu
    (where -selectedFile returns the file right-clicked, but this returns the selected file.) */
- (HgFile*) actuallySelectedFile;

@property BOOL showsOnlyUncleanFiles;

- (void) setValue: (id)value forSetting: (NSString*)setting;
- (void) saveSettings;

- (IBAction) infoChooserChanged: (id)sender;

// internal:
@property (readonly) HgTempDir* tempDir;
@property (retain) HgOperation *currentOperation;
- (void) _updateInfoView;


/** These are implemented in RepoController_Actions.m. */
@interface RepoController (Actions)

- (IBAction) revealInFinder: (id) sender;
- (IBAction) openInTerminal: (id) sender;
- (IBAction) refreshStatus: (id)sender;
- (IBAction) toggleShowsOnlyUncleanFiles: (id)sender;   // sent by menu command
- (IBAction) viewModeSelectorChanged: (id)sender;       // sent by seg. control
- (IBAction) chooseRevisionFromPopUp: (id)sender;

- (IBAction) openSelectedFile: (id)sender;
- (IBAction) openSelectedFileInWindow: (id)sender;

- (IBAction) showRevision: (id)sender;
- (IBAction) showDiff: (id)sender;
- (IBAction) showComparison: (id)sender;

- (IBAction) addRemove: (id)sender;
- (IBAction) addToRepository: (id)sender;
- (IBAction) removeFromRepository: (id)sender;
- (IBAction) discardChanges: (id)sender;
- (IBAction) markResolved: (id)sender;

- (IBAction) commitChanges: (id)sender;
- (IBAction) commitAllChanges: (id)sender;
- (IBAction) pushPullRevisions: (id)sender;         // sender.tag is a HgTransferOp

- (IBAction) merge: (id)sender;
- (IBAction) remergeFiles: (id)sender;

- (IBAction) endCommitSheet: (id)sender;
- (IBAction) beginPushSheetFilePicker: (id)sender;

- (IBAction) updateToLatest: (id)sender;
- (IBAction) updateToSelectedRevision: (id)sender;

- (IBAction) stopProgress: (id)sender;