From 5ce7a777259ba2dec699c97634ece9213802713c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 1 Feb 2010 14:20:55 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Added=20basic=20print=20support=20for=20eac?= =?UTF-8?q?h=20CMTextView=20=E2=80=A2=20first=20steps=20to=20renew=20the?= =?UTF-8?q?=20field=20mapper=20sheet=20for=20CSV=20Import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/DataMigrationDialog.xib | 1160 +++++++++++++++++++++- Source/CMTextView.m | 95 +- Source/TableDocument.m | 7 +- 3 files changed, 1170 insertions(+), 92 deletions(-) diff --git a/Interfaces/English.lproj/DataMigrationDialog.xib b/Interfaces/English.lproj/DataMigrationDialog.xib index bfc57c98..2beee8cd 100644 --- a/Interfaces/English.lproj/DataMigrationDialog.xib +++ b/Interfaces/English.lproj/DataMigrationDialog.xib @@ -1,23 +1,26 @@ - + 1050 - 9G55 - 677 - 949.43 - 353.00 + 10C540 + 740 + 1038.25 + 458.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 740 + YES - + YES - com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin YES - + YES @@ -35,22 +38,650 @@ NSApplication - + 15 2 - {{196, 240}, {480, 270}} - 603979776 - Window + {{262, 452}, {465, 311}} + 1886912512 + CSV Field Mapping NSWindow - + + View + {3.40282e+38, 3.40282e+38} - + {465, 311} + - 256 - {480, 270} + 274 + + YES + + + 10 + + YES + + + 256 + {{1, 1}, {465, 34}} + + + + {{-1, 276}, {467, 36}} + + {0, 0} + + 67239424 + 0 + Box + + LucidaGrande + 11 + 3100 + + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 3 + MCAwLjgwMDAwMDAxMTkAA + + + + 1 + 4 + 0 + NO + + 2 + MC45NDUwOTgxMDIxIDAuOTQ1MDk4MTAyMSAwLjk0NTA5ODEwMjEAA + + + + + 274 + + YES + + + 2304 + + YES + + + 256 + {423, 141} + + YES + + + 256 + {423, 17} + + + + + + -2147483392 + {{-22, 0}, {12, 17}} + + + + YES + + value + 202 + 15 + 1000 + + 75628096 + 67110912 + + + + 3 + MC4zMzMzMzI5ODU2AA + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 338820672 + 132096 + Text Cell + + + + + 6 + System + controlTextColor + + + + 3 + YES + YES + + + + operator + 20 + 20 + 1000 + + 75628096 + 134219776 + + + + + + + -2076049856 + 134350848 + + + 100679935 + 129 + + + 400 + 75 + + YES + + OtherViews + + YES + + + + -1 + 3 + YES + YES + + YES + + + + field + 192 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + + + + 6 + System + headerColor + + + + + + 69336641 + 137216 + Text Cell + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2ODY1AA + + + + + 3 + YES + + + + 3 + 2 + + 6 + System + _sourceListBackgroundColor + + 1 + MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA + + + + 6 + System + gridColor + + 3 + MC41AA + + + 20 + 1379958784 + + + 1 + 1 + 15 + 0 + YES + 1 + 1 + + + {{1, 17}, {423, 141}} + + + + + 6 + + + + -2147483392 + {{413, 18}, {11, 140}} + + 256 + + _doScroller: + 0.9929078221321106 + + + + -2147483392 + {{-100, -100}, {227, 11}} + + 257 + + _doScroller: + 0.037825059145689011 + 0.99047619104385376 + + + + 2304 + + YES + + + {{1, 0}, {423, 17}} + + + + + 4 + + + + {{20, 76}, {425, 159}} + + + 530 + + + + + + QSAAAEEgAABBsAAAQbAAAA + + + + 289 + {{286, 12}, {82, 32}} + + YES + + 67239424 + 137887744 + Cancel + + LucidaGrande + 13 + 1044 + + + -2038284033 + 1 + + Helvetica + 13 + 16 + + + Gw + 200 + 25 + + + + + 289 + {{368, 12}, {83, 32}} + + 1 + YES + + 67239424 + 137887744 + Import + + + 1 + -2038284033 + 1 + + + DQ + 200 + 25 + + + + + 292 + {{20, 17}, {32, 24}} + + YES + + 604110336 + 134217728 + + + + -2030812929 + 34 + + NSImage + NSGoLeftTemplate + + + + 400 + 75 + + + + + 292 + {{51, 17}, {32, 24}} + + 1 + YES + + 67239424 + 134217728 + + + + 1 + -2030812929 + 34 + + NSImage + NSGoRightTemplate + + + + 400 + 75 + + + + + 290 + {{88, 22}, {199, 14}} + + YES + + 67239488 + 272763136 + x of y records + + + + 6 + System + controlColor + + + + + + + + 265 + {{288, 238}, {160, 22}} + + YES + + -2076049856 + 133120 + + + 109199615 + 129 + + + 400 + 75 + + YES + + OtherViews + + YES + + + -1 + 1 + YES + YES + 2 + + + + + 292 + {{102, 47}, {126, 22}} + + YES + + -2076049856 + 133120 + + + 109199615 + 129 + + + 400 + 75 + + + INSERT + + 2147483647 + 1 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + REPLACE + + 2147483647 + + + _popUpItemAction: + 1 + + + + + UPDATE + + 2147483647 + + + _popUpItemAction: + 2 + + + + + 1 + YES + YES + 2 + + + + + 292 + {{17, 51}, {94, 14}} + + YES + + 68288064 + 272761856 + Import Method: + + + + + + + + + 265 + {{245, 243}, {43, 14}} + + YES + + 68288064 + 272761856 + Target: + + + + + + + + + 268 + {{17, 244}, {44, 14}} + + YES + + 68288064 + 272761856 + Source: + + + + + + + + + 270 + + YES + + YES + Apple URL pasteboard type + NSFilenamesPboardType + + + {{60, 240}, {184, 20}} + + YES + + 69336577 + 163840 + + + file://localhost/Applications/ + + + + + 2 + MC45Mjk0MTE4Mjg1IDAuOTI5NDExODI4NSAwLjkyOTQxMTgyODUAA + + + YES + + 67239488 + 132096 + Leopard + + + + + + file://localhost// + + + + 67239488 + 132096 + Applications + + + + + + file://localhost/Applications + + + + + + + + {465, 311} - {{0, 0}, {1920, 1178}} + {{0, 0}, {1280, 1002}} + {465, 333} {3.40282e+38, 3.40282e+38} @@ -63,79 +694,495 @@ YES 0 - - YES - + -2 - - RmlsZSdzIE93bmVyA + + File's Owner -1 - + First Responder -3 - + Application - 1 - + 11 + + + YES + + + + CSV Field Mapping Sheet New + + + 12 + + + YES + + + + + + + + + + + + + + + + + + 13 + + + YES + + + + + + + + + 14 + + + + + 15 + + + YES + + + + + + 16 + + + YES + + + + + + 17 + + + YES + + + + + + 18 + + + YES + + + + + + 19 + + + YES + + + + + + 20 + YES - + - + - 2 - + 21 + YES + - + + + + 22 + + + YES + + + + + + 23 + + + YES + + + + + + 24 + + + YES + + + + + + 25 + + + YES + + + + + + 26 + + + + + 27 + + + YES + + + + + + 28 + + + YES + + + + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 33 + + + + + 34 + + + + + 35 + + + YES + + + + + + 36 + + + + + 37 + + + + + 38 + + + + + 39 + + + + + 40 + + + + + 41 + + + + + 42 + + + YES + + + + + + + + 43 + + + + + 44 + + + + + 45 + + + + + 46 + + + YES + + + + + + 47 + + + YES + + + + + + 48 + + + YES + + + + + + 49 + + + + + 50 + + + + + 51 + + + YES + + + + + + 52 + + + YES + + YES - + YES - -1.IBPluginDependency - -2.IBPluginDependency -3.IBPluginDependency - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 2.IBPluginDependency + 11.IBEditorWindowLastContentRect + 11.IBPluginDependency + 11.IBWindowTemplateEditedContentRect + 11.ImportedFromIB2 + 11.editorWindowContentRectSynchronizationRect + 11.windowTemplate.hasMaxSize + 11.windowTemplate.hasMinSize + 11.windowTemplate.maxSize + 11.windowTemplate.minSize + 12.IBPluginDependency + 12.ImportedFromIB2 + 13.IBPluginDependency + 13.ImportedFromIB2 + 14.IBPluginDependency + 15.IBPluginDependency + 15.ImportedFromIB2 + 16.IBPluginDependency + 16.ImportedFromIB2 + 17.IBPluginDependency + 17.ImportedFromIB2 + 18.IBPluginDependency + 18.ImportedFromIB2 + 19.IBPluginDependency + 20.IBPluginDependency + 21.IBPluginDependency + 22.IBPluginDependency + 23.IBPluginDependency + 24.IBPluginDependency + 25.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 28.IBEditorWindowLastContentRect + 28.IBPluginDependency + 29.IBPluginDependency + 30.IBPluginDependency + 31.IBPluginDependency + 32.IBPluginDependency + 33.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBEditorWindowLastContentRect + 36.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 40.IBPluginDependency + 41.IBPluginDependency + 42.IBPluginDependency + 42.ImportedFromIB2 + 43.IBPluginDependency + 43.IBShouldRemoveOnLegacySave + 44.IBPluginDependency + 44.IBShouldRemoveOnLegacySave + 45.IBPluginDependency + 46.IBPluginDependency + 46.ImportedFromIB2 + 47.IBPluginDependency + 47.ImportedFromIB2 + 48.IBPluginDependency + 49.IBPluginDependency + 50.IBPluginDependency + 50.IBShouldRemoveOnLegacySave + 51.IBPluginDependency + 52.IBEditorWindowLastContentRect + 52.IBPluginDependency YES com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilderKit - com.apple.InterfaceBuilderKit - {{675, 314}, {480, 270}} + {{143, 340}, {465, 311}} + com.apple.InterfaceBuilder.CocoaPlugin + {{143, 340}, {465, 311}} + + {{387, 725}, {432, 282}} + + + {3.40282e+38, 3.40282e+38} + {465, 311} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{234, 355}, {126, 54}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{675, 314}, {480, 270}} - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{611, 880}, {113, 4}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{153, 554}, {423, 4}} com.apple.InterfaceBuilder.CocoaPlugin YES - - YES - + YES @@ -143,15 +1190,13 @@ YES - - YES - + YES - 10 + 55 @@ -182,7 +1227,7 @@ NSDocument YES - + YES addDatabase: analyzeTable: @@ -253,7 +1298,7 @@ YES - + YES addDatabaseButton chooseDatabaseButton @@ -342,6 +1387,15 @@ 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES ../sequel-pro.xcodeproj 3 diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 98bcebcd..2e82480a 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -780,6 +780,20 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) #pragma mark - #pragma mark user actions +- (IBAction)printDocument:(id)sender +{ + + // This will scale the view to fit the page without centering it. + [[NSPrintInfo sharedPrintInfo] setHorizontalPagination:NSFitPagination]; + [[NSPrintInfo sharedPrintInfo] setHorizontallyCentered:NO]; + [[NSPrintInfo sharedPrintInfo] setVerticallyCentered:NO]; + + // Setup the print operation with the print info and view + NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:self printInfo:[NSPrintInfo sharedPrintInfo]]; + [printOperation runOperationModalForWindow:[self window] delegate:nil didRunSelector:NULL contextInfo:NULL]; + +} + /* * Search for the current selection or current word in the MySQL Help */ @@ -2903,49 +2917,54 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) - (void)drawRect:(NSRect)rect { - // Draw textview's background since due to the snippet highlighting we're responsible for it. - [[self queryEditorBackgroundColor] setFill]; - NSRectFill(rect); - - if([[self delegate] isKindOfClass:[CustomQuery class]]) { - - // Highlightes the current query if set in the Pref and no snippet session - // and if nothing is selected in the text view - if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length) { - NSUInteger rectCount; - [[self textStorage] ensureAttributesAreFixedInRange:[self queryRange]]; - NSRectArray queryRects = [[self layoutManager] rectArrayForCharacterRange: [self queryRange] - withinSelectedCharacterRange: [self queryRange] - inTextContainer: [self textContainer] - rectCount: &rectCount ]; - [[self queryHiliteColor] setFill]; - NSRectFillList(queryRects, rectCount); - } - // Highlight snippets coming from the Query Favorite text macro - if(snippetControlCounter > -1) { - // Is the caret still inside a snippet - if([self checkForCaretInsideSnippet]) { - for(NSUInteger i=0; i -1) { - // choose the colors for the snippet parts - if(i == currentSnippetIndex) { - [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.4] setFill]; - [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.8] setStroke]; - } else { - [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.2] setFill]; - [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.5] setStroke]; + // Draw background only for screen display but not while printing + if([NSGraphicsContext currentContextDrawingToScreen]) { + + // Draw textview's background since due to the snippet highlighting we're responsible for it. + [[self queryEditorBackgroundColor] setFill]; + NSRectFill(rect); + + if([[self delegate] isKindOfClass:[CustomQuery class]]) { + + // Highlightes the current query if set in the Pref and no snippet session + // and if nothing is selected in the text view + if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length) { + NSUInteger rectCount; + [[self textStorage] ensureAttributesAreFixedInRange:[self queryRange]]; + NSRectArray queryRects = [[self layoutManager] rectArrayForCharacterRange: [self queryRange] + withinSelectedCharacterRange: [self queryRange] + inTextContainer: [self textContainer] + rectCount: &rectCount ]; + [[self queryHiliteColor] setFill]; + NSRectFillList(queryRects, rectCount); + } + + // Highlight snippets coming from the Query Favorite text macro + if(snippetControlCounter > -1) { + // Is the caret still inside a snippet + if([self checkForCaretInsideSnippet]) { + for(NSUInteger i=0; i -1) { + // choose the colors for the snippet parts + if(i == currentSnippetIndex) { + [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.4] setFill]; + [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.8] setStroke]; + } else { + [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.2] setFill]; + [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.5] setStroke]; + } + NSBezierPath *snippetPath = [self roundedBezierPathAroundRange: NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) ]; + [snippetPath fill]; + [snippetPath stroke]; } - NSBezierPath *snippetPath = [self roundedBezierPathAroundRange: NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) ]; - [snippetPath fill]; - [snippetPath stroke]; } + } else { + [self endSnippetSession]; } - } else { - [self endSnippetSession]; } - } + } } [super drawRect:rect]; @@ -3104,7 +3123,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) || [menuItem tag] == MENU_EDIT_COPY_AS_SQL ) { return NO; } - + return YES; } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index c8834af3..2502f984 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2926,7 +2926,12 @@ } if ([menuItem action] == @selector(printDocument:)) { - return ([self database] != nil && [[tablesListInstance valueForKeyPath:@"tablesListView"] numberOfSelectedRows] == 1); + return ( + ( + [self database] != nil + && [[tablesListInstance valueForKeyPath:@"tablesListView"] numberOfSelectedRows] == 1 + ) + || [tableWindow firstResponder] == customQueryInstance); } if ([menuItem action] == @selector(chooseEncoding:)) { -- cgit v1.2.3