aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPHistoryController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-09-12 16:19:51 +0000
committerstuconnolly <stuart02@gmail.com>2009-09-12 16:19:51 +0000
commitf4bede9def108d8fd25334871ca00971687c4e51 (patch)
tree9e744ffcceb07993d5865181c9df7a5ae0d4f407 /Source/SPHistoryController.m
parent9a0951a7dc44f93226e096423b76de48df2d50a0 (diff)
downloadsequelpro-f4bede9def108d8fd25334871ca00971687c4e51.tar.gz
sequelpro-f4bede9def108d8fd25334871ca00971687c4e51.tar.bz2
sequelpro-f4bede9def108d8fd25334871ca00971687c4e51.zip
Add back/forward history menu items to the view menu with the assigned shortcuts of cmd+[ and cmd+].
Diffstat (limited to 'Source/SPHistoryController.m')
-rw-r--r--Source/SPHistoryController.m32
1 files changed, 26 insertions, 6 deletions
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index d602d8d4..e3fbb9cf 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -30,6 +30,8 @@
@implementation SPHistoryController
+@synthesize history;
+@synthesize historyPosition;
@synthesize modifyingHistoryState;
#pragma mark Setup and teardown
@@ -102,23 +104,41 @@
}
/**
+ * Go backward in the history.
+ */
+- (void)goBackwardInHistory
+{
+ if (historyPosition == NSNotFound || !historyPosition) return;
+
+ [self loadEntryAtPosition:historyPosition - 1];
+}
+
+/**
+ * Go forward in the history.
+ */
+- (void)goForwardInHistory
+{
+ if (historyPosition == NSNotFound || historyPosition + 1 >= [history count]) return;
+
+ [self loadEntryAtPosition:historyPosition + 1];
+}
+
+/**
* Trigger a navigation action in response to a click
*/
- (IBAction) historyControlClicked:(NSSegmentedControl *)theControl
{
- switch ([theControl selectedSegment]) {
-
+ switch ([theControl selectedSegment])
+ {
// Back button clicked:
case 0:
- if (historyPosition == NSNotFound || !historyPosition) return;
- [self loadEntryAtPosition:historyPosition - 1];
+ [self goBackwardInHistory];
break;
// Forward button clicked:
case 1:
- if (historyPosition == NSNotFound || historyPosition + 1 >= [history count]) return;
- [self loadEntryAtPosition:historyPosition + 1];
+ [self goForwardInHistory];
break;
}
}