aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-07-23 20:53:23 +0000
committerstuconnolly <stuart02@gmail.com>2011-07-23 20:53:23 +0000
commitfa5a9c1ab00bdd35952a2934016e243c633131b0 (patch)
tree716e97abfeffb7ccd7212f93c30dbe67732bd4e2
parent56dfd953fc8c4e59b2d9ddbce2cc7f89d13ac0f3 (diff)
downloadsequelpro-fa5a9c1ab00bdd35952a2934016e243c633131b0.tar.gz
sequelpro-fa5a9c1ab00bdd35952a2934016e243c633131b0.tar.bz2
sequelpro-fa5a9c1ab00bdd35952a2934016e243c633131b0.zip
Tidy up.
-rw-r--r--Source/SPPrintController.m29
1 files changed, 14 insertions, 15 deletions
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index 199513f8..425c1247 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -211,8 +211,10 @@
NSMutableDictionary *printData = [NSMutableDictionary dictionary];
+ NSUInteger view = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
+
// Table source view
- if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0) {
+ if (view == 0) {
NSDictionary *tableSource = [tableSourceInstance tableSourceForPrinting];
@@ -249,7 +251,7 @@
[indexes release];
}
// Table content view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1) {
+ else if (view == 1) {
NSArray *data = [tableContentInstance currentDataResult];
@@ -266,7 +268,7 @@
[rows release];
}
// Custom query view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2) {
+ else if (view == 2) {
NSArray *data = [customQueryInstance currentResult];
@@ -283,7 +285,7 @@
[rows release];
}
// Table relations view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 4) {
+ else if (view == 4) {
NSArray *data = [tableRelationsInstance relationDataForPrinting];
@@ -299,7 +301,7 @@
[rows release];
}
// Table triggers view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 5) {
+ else if (view == 5) {
NSArray *data = [tableTriggersInstance triggerDataForPrinting];
@@ -384,33 +386,30 @@
{
NSArray *columns = nil;
+ NSUInteger view = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
+
// Table source view
- if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
- && [[tableSourceInstance tableSourceForPrinting] count] > 0) {
+ if ((view == 0) && ([[tableSourceInstance tableSourceForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[[tableSourceInstance tableSourceForPrinting] objectForKey:@"structure"] objectAtIndex:0] copyItems:YES];
}
// Table content view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1
- && [[tableContentInstance currentResult] count] > 0) {
+ else if ((view == 1) && ([[tableContentInstance currentResult] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableContentInstance currentResult] objectAtIndex:0] copyItems:YES];
}
// Custom query view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2
- && [[customQueryInstance currentResult] count] > 0) {
+ else if ((view == 2) && ([[customQueryInstance currentResult] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[customQueryInstance currentResult] objectAtIndex:0] copyItems:YES];
}
// Table relations view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 4
- && [[tableRelationsInstance relationDataForPrinting] count] > 0) {
+ else if ((view == 4) && ([[tableRelationsInstance relationDataForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableRelationsInstance relationDataForPrinting] objectAtIndex:0] copyItems:YES];
}
// Table triggers view
- else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 5
- && [[tableTriggersInstance triggerDataForPrinting] count] > 0) {
+ else if ((view == 5) && ([[tableTriggersInstance triggerDataForPrinting] count] > 0)) {
columns = [[NSArray alloc] initWithArray:[[tableTriggersInstance triggerDataForPrinting] objectAtIndex:0] copyItems:YES];
}