SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
HexFiend/HFTextRepresenter_KeyBinding.m
1 //
2 // HFTextRepresenter_KeyBinding.m
3 // HexFiend_2
4 //
5 // Copyright 2007 ridiculous_fish. All rights reserved.
6 //
7
8 #import <HexFiend/HFTextRepresenter.h>
9 #import <HexFiend/HFRepresenterTextView.h>
10 #import <HexFiend/HFController.h>
11
12 #define FORWARD(x) - (void)x : sender { USE(sender); UNIMPLEMENTED_VOID(); }
13
14 @implementation HFTextRepresenter (HFKeyBinding)
15
16 - (void)moveRight:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementByte andModifySelection:NO]; }
17 - (void)moveLeft:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementByte andModifySelection:NO]; }
18 - (void)moveUp:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementLine andModifySelection:NO]; }
19 - (void)moveDown:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementLine andModifySelection:NO]; }
20 - (void)moveWordRight:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementColumn andModifySelection:NO]; }
21 - (void)moveWordLeft:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementColumn andModifySelection:NO]; }
22
23 - (void)moveRightAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementByte andModifySelection:YES]; }
24 - (void)moveLeftAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementByte andModifySelection:YES]; }
25 - (void)moveUpAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementLine andModifySelection:YES]; }
26 - (void)moveDownAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementLine andModifySelection:YES]; }
27 - (void)moveWordRightAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementColumn andModifySelection:YES]; }
28 - (void)moveWordLeftAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementColumn andModifySelection:YES]; }
29
30 - (void)moveForward:unused { USE(unused); [self moveRight:unused]; }
31 - (void)moveBackward:unused { USE(unused); [self moveLeft:unused]; }
32
33 - (void)moveWordForward:unused { USE(unused); [self moveWordRight:unused]; }
34 - (void)moveWordBackward:unused { USE(unused); [self moveWordLeft:unused]; }
35 - (void)moveForwardAndModifySelection:unused { USE(unused); [self moveRightAndModifySelection:unused]; }
36 - (void)moveBackwardAndModifySelection:unused { USE(unused); [self moveLeftAndModifySelection:unused]; }
37 - (void)moveWordForwardAndModifySelection:unused { USE(unused); [self moveForwardAndModifySelection:unused]; }
38 - (void)moveWordBackwardAndModifySelection:unused { USE(unused); [self moveBackwardAndModifySelection:unused]; }
39
40 - (void)deleteBackward:unused { USE(unused); [[self controller] deleteDirection:HFControllerDirectionLeft]; }
41 - (void)deleteForward:unused { USE(unused); [[self controller] deleteDirection:HFControllerDirectionRight]; }
42 - (void)deleteWordForward:unused { USE(unused); [self deleteForward:unused]; }
43 - (void)deleteWordBackward:unused { USE(unused); [self deleteBackward:unused]; }
44
45 - (void)delete:unused { USE(unused); [self deleteForward:unused]; }
46
47 //todo: implement these
48
49 - (void)deleteToBeginningOfLine:(id)sender { USE(sender); }
50 - (void)deleteToEndOfLine:(id)sender { USE(sender); }
51 - (void)deleteToBeginningOfParagraph:(id)sender { USE(sender); }
52 - (void)deleteToEndOfParagraph:(id)sender { USE(sender); }
53
54 - (void)moveToBeginningOfLine:unused { USE(unused); [[self controller] moveToLineBoundaryInDirection:HFControllerDirectionLeft andModifySelection:NO]; }
55 - (void)moveToEndOfLine:unused { USE(unused); [[self controller] moveToLineBoundaryInDirection:HFControllerDirectionRight andModifySelection:NO]; }
56 - (void)moveToBeginningOfDocument:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementDocument andModifySelection:NO]; }
57 - (void)moveToEndOfDocument:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementDocument andModifySelection:NO]; }
58
59 - (void)moveToBeginningOfLineAndModifySelection:unused { USE(unused); [[self controller] moveToLineBoundaryInDirection:HFControllerDirectionLeft andModifySelection:YES]; }
60 - (void)moveToEndOfLineAndModifySelection:unused { USE(unused); [[self controller] moveToLineBoundaryInDirection:HFControllerDirectionRight andModifySelection:YES]; }
61 - (void)moveToBeginningOfDocumentAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionLeft withGranularity:HFControllerMovementDocument andModifySelection:YES]; }
62 - (void)moveToEndOfDocumentAndModifySelection:unused { USE(unused); [[self controller] moveInDirection:HFControllerDirectionRight withGranularity:HFControllerMovementDocument andModifySelection:YES]; }
63
64 - (void)moveToBeginningOfParagraph:unused { USE(unused); [self moveToBeginningOfLine:unused]; }
65 - (void)moveToEndOfParagraph:unused { USE(unused); [self moveToEndOfLine:unused]; }
66 - (void)moveToBeginningOfParagraphAndModifySelection:unused { USE(unused); [self moveToBeginningOfLineAndModifySelection:unused]; }
67 - (void)moveToEndOfParagraphAndModifySelection:unused { USE(unused); [self moveToEndOfLineAndModifySelection:unused]; }
68
69 - (void)scrollPageDown:unused { USE(unused); [[self controller] scrollByLines:[[self controller] displayedLineRange].length]; }
70 - (void)scrollPageUp:unused { USE(unused); [[self controller] scrollByLines: - [[self controller] displayedLineRange].length]; }
71 - (void)pageDown:unused { USE(unused); [self scrollPageDown:unused]; }
72 - (void)pageUp:unused { USE(unused); [self scrollPageUp:unused]; }
73
74 - (void)centerSelectionInVisibleArea:unused {
75 USE(unused);
76 HFController *controller = [self controller];
77 NSArray *selection = [controller selectedContentsRanges];
78 unsigned long long min = ULLONG_MAX, max = 0;
79 HFASSERT([selection count] >= 1);
80 FOREACH(HFRangeWrapper *, wrapper, selection) {
81 HFRange range = [wrapper HFRange];
82 min = MIN(min, range.location);
83 max = MAX(max, HFMaxRange(range));
84 }
85 HFASSERT(max >= min);
86 [controller maximizeVisibilityOfContentsRange:HFRangeMake(min, max - min)];
87 }
88
89 - (void)insertTab:unused {
90 USE(unused);
91 [[[self view] window] selectNextKeyView:nil];
92 }
93
94 - (void)insertBacktab:unused {
95 USE(unused);
96 [[[self view] window] selectPreviousKeyView:nil];
97 }
98
99 FORWARD(scrollLineUp)
100 FORWARD(scrollLineDown)
101 FORWARD(transpose)
102 FORWARD(transposeWords)
103
104 FORWARD(selectParagraph)
105 FORWARD(selectLine)
106 FORWARD(selectWord)
107 FORWARD(indent)
108 //FORWARD(insertNewline)
109 FORWARD(insertParagraphSeparator)
110 FORWARD(insertNewlineIgnoringFieldEditor)
111 FORWARD(insertTabIgnoringFieldEditor)
112 FORWARD(insertLineBreak)
113 FORWARD(insertContainerBreak)
114 FORWARD(changeCaseOfLetter)
115 FORWARD(uppercaseWord)
116 FORWARD(lowercaseWord)
117 FORWARD(capitalizeWord)
118 FORWARD(deleteBackwardByDecomposingPreviousCharacter)
119 FORWARD(yank)
120 FORWARD(complete)
121 FORWARD(setMark)
122 FORWARD(deleteToMark)
123 FORWARD(selectToMark)
124 FORWARD(swapWithMark)
125 //FORWARD(cancelOperation)
126
127 @end
128
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.