Skip to content

Commit f093db1

Browse files
committed
Add a scm commit window to tm_dialog
1 parent f0f5c22 commit f093db1

18 files changed

+4515
-2
lines changed

Commands/commit/CWTextView.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CWTextView.m
3+
// CommitWindow
4+
//
5+
// Created by Chris Thomas on 3/7/05.
6+
// Copyright 2005-2006 Chris Thomas. All rights reserved.
7+
// MIT license.
8+
//
9+
10+
#import <Cocoa/Cocoa.h>
11+
12+
13+
@interface CWTextView : NSTextView
14+
{
15+
}
16+
@end

Commands/commit/CWTextView.mm

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// CWTextView.m
3+
// CommitWindow
4+
//
5+
// Created by Chris Thomas on 3/7/05.
6+
// Copyright 2005-2006 Chris Thomas. All rights reserved.
7+
// MIT license.
8+
//
9+
10+
#import "CWTextView.h"
11+
12+
@implementation CWTextView
13+
#if 0
14+
#pragma mark -
15+
#pragma mark Do not eat the enter key
16+
#endif
17+
18+
- (void) keyDown:(NSEvent *)event
19+
{
20+
// don't let the textview eat the enter key
21+
if( [[event characters] isEqualToString:@"\x03"] )
22+
{
23+
[[self nextResponder] keyDown:event];
24+
}
25+
else
26+
{
27+
NSEventType t = [event type];
28+
29+
if(t == NSKeyDown)
30+
{
31+
32+
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
33+
if(key == NSTabCharacter) {
34+
if (([event modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask) {
35+
[super keyDown:event];
36+
return;
37+
}
38+
[[self window] selectKeyViewFollowingView:self];
39+
return;
40+
}
41+
else if(key == NSBackTabCharacter) {
42+
[[self window] selectPreviousKeyView:self];
43+
return;
44+
}
45+
}
46+
[super keyDown:event];
47+
}
48+
}
49+
50+
@end

Commands/commit/CXMenuButton.h

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// CXMenuButton.h
3+
//
4+
// Created by Chris Thomas on 2006-10-09.
5+
// Copyright 2006 Chris Thomas. All rights reserved.
6+
// MIT license.
7+
//
8+
9+
@interface CXMenuButton : NSButton
10+
{
11+
IBOutlet NSMenu * menu;
12+
}
13+
14+
- (NSMenu *)menu;
15+
- (void)setMenu:(NSMenu *)aValue;
16+
17+
18+
@end

Commands/commit/CXMenuButton.mm

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//
2+
// CXMenuButton.m
3+
//
4+
// Created by Chris Thomas on 2006-10-09.
5+
// Copyright 2006 Chris Thomas. All rights reserved.
6+
// MIT license.
7+
//
8+
9+
#import "CXMenuButton.h"
10+
11+
@implementation CXMenuButton
12+
13+
// Initialization
14+
15+
- (void) commonInit
16+
{
17+
// Use alternateImage for pressed state
18+
[[self cell] setHighlightsBy:NSCellLightsByContents];
19+
}
20+
21+
- (void) awakeFromNib
22+
{
23+
[self commonInit];
24+
}
25+
26+
// Events
27+
28+
- (void) mouseDown:(NSEvent *)event
29+
{
30+
[self highlight:YES];
31+
[NSMenu popUpContextMenu:menu withEvent:event forView:self withFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
32+
[self highlight:NO];
33+
}
34+
35+
// Accessors
36+
37+
- (NSMenu *)menu
38+
{
39+
return menu;
40+
}
41+
42+
- (void)setMenu:(NSMenu *)aValue
43+
{
44+
NSMenu *oldMenu = menu;
45+
menu = [aValue retain];
46+
[oldMenu release];
47+
}
48+
49+
@end
50+
51+
52+
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// CXTextWithButtonStripCell.m
3+
// NSCell supporting row action buttons aligned to one side of a text table column.
4+
//
5+
// Created by Chris Thomas on 2006-10-11.
6+
// Copyright 2006 Chris Thomas. All rights reserved.
7+
//
8+
9+
@interface CXTextWithButtonStripCell : NSTextFieldCell
10+
{
11+
// buttons contains a set of button definitions to draw at the right (or left) side of the cell.
12+
//
13+
// Each item is a dictionary with the following entries:
14+
// • either @"title" NSString -- localized name of button
15+
// OR @"icon" -- NSImage -- icon
16+
// • @"menu" -- NSMenu -- if present, indicates that this button is a menu button
17+
// • @"invocation" -- NSInvocation -- required if this is a push button, useless for menu buttons
18+
//
19+
NSMutableArray * fButtons;
20+
UInt32 fButtonPressedIndex;
21+
float fButtonStripWidth;
22+
BOOL fRightToLeft;
23+
24+
}
25+
26+
- (NSArray *)buttonDefinitions;
27+
- (void)setButtonDefinitions:(NSArray *)newButtonDefinitions;
28+
29+
@end

0 commit comments

Comments
 (0)