aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-13 17:35:40 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-13 17:35:40 +0000
commit34e9b74b66e82276516881254bea4611a87cea1d (patch)
treea23d08e65370ddd46701a2156fdd420fbc576e19
parenteb8d201cc4a641f68cb5049d525b3f094a2008a2 (diff)
downloadsequelpro-34e9b74b66e82276516881254bea4611a87cea1d.tar.gz
sequelpro-34e9b74b66e82276516881254bea4611a87cea1d.tar.bz2
sequelpro-34e9b74b66e82276516881254bea4611a87cea1d.zip
• Extended Table Info printing
- set create table syntax string temporarily to 10pt for printing - before gathering print data set focus to createTableSyntaxView to update possible pending comment changes
-rw-r--r--Source/SPExtendedTableInfo.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m
index 30741424..216057e0 100644
--- a/Source/SPExtendedTableInfo.m
+++ b/Source/SPExtendedTableInfo.m
@@ -372,6 +372,10 @@
*/
- (NSDictionary *)tableInformationForPrinting
{
+
+ // Update possible pending comment changes by set the focus to create table syntax view
+ [[NSApp keyWindow] makeFirstResponder:tableCreateSyntaxTextView];
+
NSMutableDictionary *tableInfo = [NSMutableDictionary dictionary];
NSDictionary *statusFields = [tableDataInstance statusValues];
@@ -396,7 +400,19 @@
NSArray *HTMLExcludes = [NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body", @"xml", nil];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType, NSDocumentTypeDocumentAttribute, HTMLExcludes, NSExcludedElementsDocumentAttribute, nil];
+
+ // Set tableCreateSyntaxTextView's font size temporarily to 10pt for printing
+ NSFont *oldFont = [tableCreateSyntaxTextView font];
+ BOOL editableStatus = [tableCreateSyntaxTextView isEditable];
+ [tableCreateSyntaxTextView setEditable:YES];
+ [tableCreateSyntaxTextView setFont:[NSFont fontWithName:[oldFont fontName] size:10.0]];
+
+ // Convert tableCreateSyntaxTextView to HTML
NSData *HTMLData = [[tableCreateSyntaxTextView textStorage] dataFromRange:NSMakeRange(0, [[tableCreateSyntaxTextView string] length]) documentAttributes:attributes error:&error];
+
+ // Restore original font settings
+ [tableCreateSyntaxTextView setFont:oldFont];
+ [tableCreateSyntaxTextView setEditable:editableStatus];
if (error != nil) {
NSLog(@"Error generating table's create syntax HTML for printing. Excluding from print out. Error was: %@", [error localizedDescription]);