Revision: 27432
          http://sourceforge.net/p/bibdesk/svn/27432
Author:   hofman
Date:     2022-05-18 21:26:54 +0000 (Wed, 18 May 2022)
Log Message:
-----------
Use formatter from expanded value field to parse bibtex string, no need to keep 
assigned reference to owning formatter

Modified Paths:
--------------
    trunk/bibdesk/BDSKComplexStringEditor.h
    trunk/bibdesk/BDSKComplexStringEditor.m
    trunk/bibdesk/BDSKComplexStringFormatter.m

Modified: trunk/bibdesk/BDSKComplexStringEditor.h
===================================================================
--- trunk/bibdesk/BDSKComplexStringEditor.h     2022-05-18 15:16:25 UTC (rev 
27431)
+++ trunk/bibdesk/BDSKComplexStringEditor.h     2022-05-18 21:26:54 UTC (rev 
27432)
@@ -44,12 +44,9 @@
     NSTextField *expandedValueTextField;
     NSImageView *focusRingView;
     NSBox *box;
-    NSFormatter *formatter;
     NSText *editor;
 }
 
-- (id)initWithFormatter:(NSFormatter *)aFormatter;
-
 - (void)attachToEditor:(NSText *)textObj withValue:(NSString *)value;
 
 - (void)remove;

Modified: trunk/bibdesk/BDSKComplexStringEditor.m
===================================================================
--- trunk/bibdesk/BDSKComplexStringEditor.m     2022-05-18 15:16:25 UTC (rev 
27431)
+++ trunk/bibdesk/BDSKComplexStringEditor.m     2022-05-18 21:26:54 UTC (rev 
27432)
@@ -64,21 +64,7 @@
 @synthesize expandedValueTextField, focusRingView, box;
 @dynamic attached;
 
-- (id)initWithFormatter:(NSFormatter *)aFormatter {
-    self = [super initWithWindowNibName:@"ComplexStringEditor"];
-    if (self) {
-        editor = nil;
-        formatter = aFormatter; // not retained as it owns us
-       }
-       return self;
-}
-
-- (id)init {
-    return [self initWithFormatter:nil];
-}
-
 - (void)dealloc {
-    formatter = nil;
     BDSKDESTROY(editor);
     [super dealloc];
 }
@@ -179,9 +165,13 @@
 @implementation BDSKComplexStringEditor (Private)
 
 - (void)windowDidLoad {
+    [super windowDidLoad];
+    
     [[self window] setOpaque:NO];
     [[self window] setBackgroundColor:[NSColor clearColor]];
     [[self window] setAlphaValue:0.9];
+    
+    [(BDSKComplexStringFormatter *)[expandedValueTextField formatter] 
setEditAsComplexString:YES];
 }
 
 - (void)displayValue:(NSString *)string isError:(BOOL)isError {
@@ -296,7 +286,7 @@
 - (void)editorTextDidChange:(NSNotification *)notification {
        NSString *string = [editor string];
     NSString *error = nil;
-    if ([formatter getObjectValue:&string forString:string 
errorDescription:&error])
+    if ([[expandedValueTextField formatter] getObjectValue:&string 
forString:string errorDescription:&error])
         [self displayValue:string isError:NO];
     else
         [self displayValue:error isError:YES];

Modified: trunk/bibdesk/BDSKComplexStringFormatter.m
===================================================================
--- trunk/bibdesk/BDSKComplexStringFormatter.m  2022-05-18 15:16:25 UTC (rev 
27431)
+++ trunk/bibdesk/BDSKComplexStringFormatter.m  2022-05-18 21:26:54 UTC (rev 
27432)
@@ -150,7 +150,7 @@
 - (void)didStartEditor:(NSText *)textObj withObjectValue:(id)value {
     if (editAsComplexString) {
         if (complexStringEditor == nil)
-            complexStringEditor = [[BDSKComplexStringEditor alloc] 
initWithFormatter:self];
+            complexStringEditor = [[BDSKComplexStringEditor alloc] init];
         [complexStringEditor attachToEditor:textObj withValue:value];
     }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to