prettify ui and insert corresponding items
This commit is contained in:
23
baRSS/Assets.xcassets/seperator.imageset/Contents.json
vendored
Normal file
23
baRSS/Assets.xcassets/seperator.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "separator.png",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "separator@2x.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "separator@3x.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
baRSS/Assets.xcassets/seperator.imageset/separator.png
vendored
Normal file
BIN
baRSS/Assets.xcassets/seperator.imageset/separator.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 109 B |
BIN
baRSS/Assets.xcassets/seperator.imageset/separator@2x.png
vendored
Normal file
BIN
baRSS/Assets.xcassets/seperator.imageset/separator@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 153 B |
BIN
baRSS/Assets.xcassets/seperator.imageset/separator@3x.png
vendored
Normal file
BIN
baRSS/Assets.xcassets/seperator.imageset/separator@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 171 B |
@@ -325,7 +325,7 @@
|
|||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
<tableColumns>
|
<tableColumns>
|
||||||
<tableColumn identifier="cellFeedConfigName" width="262" minWidth="40" maxWidth="1000" id="Lb1-9n-wlc">
|
<tableColumn identifier="" width="262" minWidth="40" maxWidth="1000" id="Lb1-9n-wlc">
|
||||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
|
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
|
||||||
<font key="font" metaFont="smallSystem"/>
|
<font key="font" metaFont="smallSystem"/>
|
||||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
@@ -338,30 +338,45 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="cellFeedConfigName" id="USO-Q1-NDq" userLabel="cellView">
|
<tableCellView identifier="cellFeedConfigName" id="xPj-mA-zCd">
|
||||||
<rect key="frame" x="1" y="1" width="262" height="17"/>
|
<rect key="frame" x="1" y="1" width="262" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Z4d-cK-DSP" userLabel="img">
|
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZkQ-CQ-77k">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="17" height="17"/>
|
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="qWz-Xe-Me7"/>
|
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="6xE-Sq-YVt"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9aj-WF-3MF" userLabel="str">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="v0D-kY-dKT">
|
||||||
<rect key="frame" x="23" y="0.0" width="239" height="17"/>
|
<rect key="frame" x="25" y="0.0" width="237" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Feed Title" id="Vp6-Ny-4XI">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="AQH-6L-dw6">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="USO-Q1-NDq" name="value" keyPath="objectValue.name" id="Ojs-Mi-qdl"/>
|
<binding destination="xPj-mA-zCd" name="value" keyPath="objectValue.name" id="0Dx-uS-rnx"/>
|
||||||
</connections>
|
</connections>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="textField" destination="9aj-WF-3MF" id="I4F-yK-Is7"/>
|
<outlet property="imageView" destination="ZkQ-CQ-77k" id="0A9-d2-BsO"/>
|
||||||
|
<outlet property="textField" destination="v0D-kY-dKT" id="gFH-Fi-20f"/>
|
||||||
|
</connections>
|
||||||
|
</tableCellView>
|
||||||
|
<tableCellView identifier="cellFeedConfigSeperator" id="IkM-wJ-Az7">
|
||||||
|
<rect key="frame" x="1" y="20" width="262" height="17"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ees-3B-mIa">
|
||||||
|
<rect key="frame" x="3" y="0.0" width="256" height="17"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
|
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="left" image="seperator" id="NRu-eZ-uh3"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
<connections>
|
||||||
|
<outlet property="imageView" destination="ees-3B-mIa" id="qFZ-vH-ATa"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableCellView>
|
</tableCellView>
|
||||||
</prototypeCellViews>
|
</prototypeCellViews>
|
||||||
@@ -410,6 +425,7 @@
|
|||||||
</tableColumns>
|
</tableColumns>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="dataSource" destination="1oZ-Uo-mIu" id="sch-o5-yEm"/>
|
<outlet property="dataSource" destination="1oZ-Uo-mIu" id="sch-o5-yEm"/>
|
||||||
|
<outlet property="delegate" destination="1oZ-Uo-mIu" id="Nye-dQ-vdy"/>
|
||||||
</connections>
|
</connections>
|
||||||
</outlineView>
|
</outlineView>
|
||||||
</subviews>
|
</subviews>
|
||||||
@@ -437,7 +453,7 @@
|
|||||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="add:" target="1oZ-Uo-mIu" id="9rc-sz-RXa"/>
|
<action selector="addFeed:" target="1oZ-Uo-mIu" id="wR9-Np-joC"/>
|
||||||
<binding destination="1oZ-Uo-mIu" name="enabled" keyPath="canInsert" id="1xq-Nj-Acq"/>
|
<binding destination="1oZ-Uo-mIu" name="enabled" keyPath="canInsert" id="1xq-Nj-Acq"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
@@ -502,5 +518,6 @@ CA
|
|||||||
<image name="NSRemoveTemplate" width="11" height="11"/>
|
<image name="NSRemoveTemplate" width="11" height="11"/>
|
||||||
<image name="NSShareTemplate" width="11" height="16"/>
|
<image name="NSShareTemplate" width="11" height="16"/>
|
||||||
<image name="NSUserAccounts" width="32" height="32"/>
|
<image name="NSUserAccounts" width="32" height="32"/>
|
||||||
|
<image name="seperator" width="198.5" height="2"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@@ -44,8 +44,18 @@ static NSString *dragNodeType = @"baRSS-feed-type";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
||||||
// this delegate method is only here to set owner to null and prohibit repeated awakeFromNib calls
|
// owner is nil to prohibit repeated awakeFromNib calls
|
||||||
return [self.outlineView makeViewWithIdentifier:tableColumn.identifier owner:nil];
|
NSTableCellView *cellView = [self.outlineView makeViewWithIdentifier:tableColumn.identifier owner:nil];
|
||||||
|
if (cellView)
|
||||||
|
return cellView; // is a refresh cell
|
||||||
|
|
||||||
|
FeedConfig *f = [(NSTreeNode*)item representedObject];
|
||||||
|
if (f.type == 2) { // Seperator
|
||||||
|
return [self.outlineView makeViewWithIdentifier:@"cellFeedConfigSeperator" owner:nil];
|
||||||
|
}
|
||||||
|
cellView = [self.outlineView makeViewWithIdentifier:@"cellFeedConfigName" owner:nil];
|
||||||
|
cellView.imageView.image = [NSImage imageNamed:NSImageNameFolder];
|
||||||
|
return cellView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)pauseUpdates:(NSMenuItem *)sender {
|
- (IBAction)pauseUpdates:(NSMenuItem *)sender {
|
||||||
@@ -90,19 +100,29 @@ static NSString *dragNodeType = @"baRSS-feed-type";
|
|||||||
|
|
||||||
- (IBAction)addFeed:(NSButton *)sender {
|
- (IBAction)addFeed:(NSButton *)sender {
|
||||||
NSLog(@"add feed");
|
NSLog(@"add feed");
|
||||||
|
[self.managedObjectContext.undoManager beginUndoGrouping];
|
||||||
|
FeedConfig *nf = [self insertSortedItemAtSelection];
|
||||||
|
nf.type = 1;
|
||||||
|
nf.name = [NSString stringWithFormat:@"%@", [NSDate date]];
|
||||||
|
nf.refresh = @"42s";
|
||||||
|
[self.managedObjectContext.undoManager endUndoGrouping];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)addGroup:(NSButton *)sender {
|
- (IBAction)addGroup:(NSButton *)sender {
|
||||||
FeedConfig *g = [[FeedConfig alloc] initWithEntity:FeedConfig.entity insertIntoManagedObjectContext:self.managedObjectContext];
|
[self.managedObjectContext.undoManager beginUndoGrouping];
|
||||||
|
FeedConfig *g = [self insertSortedItemAtSelection];
|
||||||
g.name = @"Group";
|
g.name = @"Group";
|
||||||
g.type = 0;
|
g.type = 0;
|
||||||
NSLog(@"add group");
|
[self.managedObjectContext.undoManager endUndoGrouping];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)addSeparator:(NSButton *)sender {
|
- (IBAction)addSeparator:(NSButton *)sender {
|
||||||
NSLog(@"add separator");
|
NSLog(@"add separator");
|
||||||
// [self.managedObjectContext.undoManager beginUndoGrouping];
|
[self.managedObjectContext.undoManager beginUndoGrouping];
|
||||||
// [self.managedObjectContext.undoManager endUndoGrouping];
|
FeedConfig *sp = [self insertSortedItemAtSelection];
|
||||||
|
sp.name = @"-------------";
|
||||||
|
sp.type = 2;
|
||||||
|
[self.managedObjectContext.undoManager endUndoGrouping];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)copyDescriptionOfSelectedItems {
|
- (NSString*)copyDescriptionOfSelectedItems {
|
||||||
@@ -130,13 +150,20 @@ static NSString *dragNodeType = @"baRSS-feed-type";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (FeedConfig*)insertNewItemAtCurrentSelection {
|
- (FeedConfig*)insertSortedItemAtSelection {
|
||||||
FeedConfig *selected = [[[self arrangedObjects] descendantNodeAtIndexPath:[self selectionIndexPath]] representedObject];
|
FeedConfig *selected = [[[self arrangedObjects] descendantNodeAtIndexPath:[self selectionIndexPath]] representedObject];
|
||||||
|
if (selected.type != 0) { // other than group
|
||||||
|
[self incrementIndicesBy:+1 forSubsequentNodes:[self selectionIndexPath]];
|
||||||
|
}
|
||||||
FeedConfig *newItem = [[FeedConfig alloc] initWithEntity:FeedConfig.entity insertIntoManagedObjectContext:self.managedObjectContext];
|
FeedConfig *newItem = [[FeedConfig alloc] initWithEntity:FeedConfig.entity insertIntoManagedObjectContext:self.managedObjectContext];
|
||||||
if (selected.type == 0) // a group
|
if (selected.type == 0) { // a group
|
||||||
newItem.sortIndex = (int32_t)selected.children.count;
|
newItem.sortIndex = (int32_t)selected.children.count;
|
||||||
else
|
newItem.parent = selected;
|
||||||
newItem.sortIndex = selected.sortIndex + 1;
|
} else {
|
||||||
|
newItem.sortIndex = selected.sortIndex;
|
||||||
|
newItem.parent = selected.parent;
|
||||||
|
--selected.sortIndex; // was increased before the new item is inserted
|
||||||
|
}
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user