aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldEditorController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-17 15:53:59 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-17 15:53:59 +0000
commitdbefc2d0e374b9279289b313adf814187b26882c (patch)
tree2320fc9b29f0f3a9fd1a3a01007e3fe4af3a3c96 /Source/SPFieldEditorController.m
parent155e66d1b9a6d1108ba4b29397fe3b04a77737f0 (diff)
downloadsequelpro-dbefc2d0e374b9279289b313adf814187b26882c.tar.gz
sequelpro-dbefc2d0e374b9279289b313adf814187b26882c.tar.bz2
sequelpro-dbefc2d0e374b9279289b313adf814187b26882c.zip
• Field Editor Sheet class
- added the feature to set "isEditable"; according to "isEditable" GUI elements will be hidden or renamed - if no blob data reduce the minimal sheet size since no segment or quicklook control is needed
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r--Source/SPFieldEditorController.m24
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 1a5a19a3..af5addf9 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -50,7 +50,7 @@
}
- (id)editWithObject:(id)data usingEncoding:(NSStringEncoding)anEncoding
- isObjectBlob:(BOOL)isFieldBlob withWindow:(NSWindow *)tableWindow
+ isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow
{
prefs = [NSUserDefaults standardUserDefaults];
@@ -70,6 +70,16 @@
[editTextView setHidden:YES];
[editTextScrollView setHidden:YES];
+ if(!isEditable) {
+ [editSheetOkButton setTitle:NSLocalizedString(@"Close", @"close button title")];
+ [editSheetCancelButton setHidden:YES];
+ [editSheetOpenButton setEnabled:NO];
+ } else {
+ [editSheetOkButton setTitle:NSLocalizedString(@"OK", @"ok button title")];
+ [editSheetCancelButton setHidden:NO];
+ [editSheetOpenButton setEnabled:YES];
+ }
+
editSheetWillBeInitialized = YES;
encoding = anEncoding;
@@ -88,6 +98,15 @@
// Hide QuickLook button and text/iamge/hex control for text data
[editSheetQuickLookButton setHidden:(!isBlob)];
[editSheetSegmentControl setHidden:(!isBlob)];
+
+ // Set window's min size since no segment and quicklook buttons are hidden
+ if(isBlob)
+ [editSheet setMinSize:NSMakeSize(560, 200)];
+ else
+ [editSheet setMinSize:NSMakeSize(340, 150)];
+
+ [editTextView setEditable:isEditable];
+ [editImage setEditable:isEditable];
[NSApp beginSheet:editSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
@@ -173,7 +192,7 @@
// For safety reasons inform QuickLook to quit
quickLookCloseMarker = 1;
- return ( code ) ? [sheetEditData retain] : nil;
+ return ( code && isEditable ) ? [sheetEditData retain] : nil;
}
@@ -473,6 +492,7 @@
-(void)processPasteImageData
{
+
editSheetWillBeInitialized = YES;
NSImage *image = nil;