Revision: 26231 http://sourceforge.net/p/bibdesk/svn/26231 Author: hofman Date: 2021-06-15 09:29:00 +0000 (Tue, 15 Jun 2021) Log Message: ----------- Validate field name to check for duplicates
Modified Paths: -------------- trunk/bibdesk/Base.lproj/BibPref_Defaults.xib trunk/bibdesk/BibPref_Defaults.m Modified: trunk/bibdesk/Base.lproj/BibPref_Defaults.xib =================================================================== --- trunk/bibdesk/Base.lproj/BibPref_Defaults.xib 2021-06-15 09:26:19 UTC (rev 26230) +++ trunk/bibdesk/Base.lproj/BibPref_Defaults.xib 2021-06-15 09:29:00 UTC (rev 26231) @@ -251,7 +251,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <tableView toolTip="These are custom BibTeX fields that are handled specially. Checking Default will add them to all entries when they are created." verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="sequential" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" headerView="336" viewBased="YES" translatesAutoresizingMaskIntoConstraints="NO" id="25"> - <rect key="frame" x="0.0" y="25" width="402" height="73"/> + <rect key="frame" x="0.0" y="25" width="392" height="73"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> @@ -269,11 +269,11 @@ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <prototypeCellViews> <tableCellView id="Bu9-NQ-sdx"> - <rect key="frame" x="11" y="1" width="205" height="14"/> + <rect key="frame" x="11" y="1" width="204" height="14"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textField horizontalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ksE-K5-UwC"> - <rect key="frame" x="-2" y="0.0" width="209" height="14"/> + <rect key="frame" x="-2" y="0.0" width="208" height="14"/> <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" id="eg9-ky-gk9"> <customFormatter key="formatter" id="bAN-oc-udb" customClass="BDSKFieldNameFormatter"/> <font key="font" metaFont="smallSystem"/> @@ -282,6 +282,7 @@ </textFieldCell> <connections> <action selector="changeFieldName:" target="-2" id="6TC-GQ-czm"/> + <outlet property="delegate" destination="-2" id="ZIs-0k-zKi"/> </connections> </textField> </subviews> @@ -310,17 +311,17 @@ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <prototypeCellViews> <tableCellView id="Mr2-IN-bqY" customClass="BDSKControlTableCellView"> - <rect key="frame" x="218" y="1" width="116" height="14"/> + <rect key="frame" x="218" y="1" width="115" height="14"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <popUpButton horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ObZ-Wb-EZu"> - <rect key="frame" x="-5" y="0.0" width="121" height="14"/> - <popUpButtonCell key="cell" type="bevel" title="Textual" bezelStyle="rounded" controlSize="small" lineBreakMode="truncatingTail" imageScaling="proportionallyDown" inset="2" selectedItem="174" id="gIj-FD-Amk"> + <rect key="frame" x="-5" y="0.0" width="120" height="14"/> + <popUpButtonCell key="cell" type="bevel" title="Textual" bezelStyle="rounded" controlSize="small" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="174" id="gIj-FD-Amk"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="smallSystem"/> <menu key="menu" id="4jH-jh-yx9"> <items> - <menuItem title="Textual" id="174"/> + <menuItem title="Textual" state="on" id="174"/> <menuItem title="Local File" id="175"/> <menuItem title="Remote URL" id="173"/> <menuItem title="Boolean" id="191"/> @@ -360,11 +361,11 @@ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <prototypeCellViews> <tableCellView id="VFR-1v-zAf" customClass="BDSKControlTableCellView"> - <rect key="frame" x="336" y="1" width="74" height="14"/> + <rect key="frame" x="336" y="1" width="73" height="14"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <button horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ZUV-ng-GFc"> - <rect key="frame" x="-1" y="-2" width="76" height="18"/> + <rect key="frame" x="-1" y="-2" width="75" height="18"/> <buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="only" controlSize="small" state="on" inset="2" id="9Xn-VK-l59"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> @@ -410,7 +411,7 @@ <autoresizingMask key="autoresizingMask"/> </scroller> <tableHeaderView key="headerView" wantsLayer="YES" id="336"> - <rect key="frame" x="0.0" y="0.0" width="402" height="25"/> + <rect key="frame" x="0.0" y="0.0" width="392" height="25"/> <autoresizingMask key="autoresizingMask"/> </tableHeaderView> </scrollView> @@ -535,7 +536,7 @@ <textField horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="b7u-bT-lFM"> <rect key="frame" x="-2" y="0.0" width="346" height="17"/> <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" id="8fG-jp-L1K" customClass="BDSKFilePathCell"> - <font key="font" metaFont="system" size="12"/> + <font key="font" metaFont="cellTitle"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> Modified: trunk/bibdesk/BibPref_Defaults.m =================================================================== --- trunk/bibdesk/BibPref_Defaults.m 2021-06-15 09:26:19 UTC (rev 26230) +++ trunk/bibdesk/BibPref_Defaults.m 2021-06-15 09:29:00 UTC (rev 26231) @@ -466,6 +466,10 @@ [alert beginSheetModalForWindow:globalMacroFileSheet completionHandler:NULL]; return NO; } + } else if ([defaultFieldsTableView rowForView:control] != -1) { + // don't add duplicate fields + if ([customFieldsSet containsObject:object]) + return NO; } return YES; } @@ -476,8 +480,6 @@ NSInteger row = [defaultFieldsTableView rowForView:sender]; NSString *field = [sender objectValue]; - if ([customFieldsSet containsObject:field]) - return; // don't add duplicate fields [customFieldsSet removeObject:[customFieldsArray objectAtIndex:row]]; if ([field isEqualToString:@""]) { [customFieldsArray removeObjectAtIndex:row]; @@ -491,6 +493,7 @@ - (IBAction)changeFieldType:(id)sender { NSInteger row = [defaultFieldsTableView rowForView:sender]; NSNumber *fieldType = [sender objectValue]; + [[customFieldsArray objectAtIndex:row] setObject:fieldType forKey:TYPE_KEY]; [self updatePrefs]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit