Skip to content

Modern table views - #103

Merged
tiennou merged 45 commits into
gitx:masterfrom
mangerlahn:feature/fluent-ui
Sep 1, 2018
Merged

tiennou merged 45 commits into
gitx:masterfrom
mangerlahn:feature/fluent-ui

Conversation

@mangerlahn

Copy link
Copy Markdown
Contributor

This PR enables layer backing, which results in 60 FPS scrolling of the historyList. This list was also converted into a view based tableView for modernization reasons.

As a side effect, changing the pane sizes using the split view divider or by resizing the window itself is also more fluent.

@mangerlahn mangerlahn changed the title More fluent UI Modern table views Oct 28, 2017

@tiennou tiennou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, I quite like it.
I found one regression, and I'd like to investigate the awakeFromNib issue you've found.

return;
}

_wokeUpFromNib = YES;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭. Okay, I'll have to investigate this…

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look at this as well. I am sure there is a better solution to this..

NSArray *refs = self.objectValue.refs;
PBGitRef *ref = [refs objectAtIndex:index];

NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this breaks the checked-out-branch-as-orange UI label.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint! The parameter of this method was never used, so I removed it. The regression was created due to a missing outlet connection to the history controller.

@mangerlahn

Copy link
Copy Markdown
Contributor Author

I am glad you like it! 😊

I forgot to mention that this is not ready for merging yet. There are more table views (commit view) that can be updated. I plan to do this as well..

@mangerlahn

Copy link
Copy Markdown
Contributor Author

Ok, I have migrated the sidebar and commit lists.. Three small things besides the awakeFromNib thing:

• Text seems to be blurry on my non-retina in the sidebar
• Fast scrolling causes layout glitches for a split second in history list
• I made the text in the history list slightly bigger.. Opinions?

@mangerlahn

Copy link
Copy Markdown
Contributor Author

I ironed out the two bugs.
This leaves us with the awakeFromNib fail. It seems that awakeFromNib is probably called due to its integration with the revCells. But I have not found the issue yet

@ksuther

ksuther commented Dec 30, 2017

Copy link
Copy Markdown
Contributor

Is it just me, or does like the vertical alignment of the text look off? It looks a little too low.

text vertical alignment

@ksuther

ksuther commented Dec 30, 2017

Copy link
Copy Markdown
Contributor

Regarding awakeFromNib, what if you change awakeFromNib to loadView and call -[super loadView] at the top of the method? That seems like it would avoid the problem.

drawLineFromColumn:toColumn:inRect:offset:color: uses NSRectFill instead of NSBezierPath when drawing a straight line.
drawCircleInRect: caches the two versions of the commit circles as NSImages and redraws the cached version rather than drawing with new bezier paths each time.
Comment thread Classes/Views/PBGitRevisionCell.m Outdated
frame.origin.y = (self.bounds.size.height - frame.size.height) / 2;
frame.size.width = self.bounds.size.width - frame.origin.x;

self.textField.frame = frame;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little strange to be calling setFrame: on a view inside of drawRect:. It might be better to do this in layout or setObjectValue:. You could split drawRefsInRect: into drawRefsInRect and rectForTextField: so the roles of drawing and calculating view frames are separated.

@tiennou tiennou Feb 15, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍edit for clarity This is about @ksuther's comment above, that re-framing while display is in progress feels strange.

Optimizations in PBGitRevisionCell drawing
- Move historyController’s awakeFromNib to loadView
- Move textField layout to layout method
@mangerlahn

Copy link
Copy Markdown
Contributor Author

Thank you very much for the review @ksuther !

@ksuther

ksuther commented Dec 30, 2017

Copy link
Copy Markdown
Contributor

👍 Looks good!

I get a little bit of choppy scrolling if I try to scroll hundreds of commits at a time, not sure if there's much that can be done about that though. I'm not seeing any obvious targets in Instruments right now (text drawing is taking the fast path and table view row background drawing is taking as much time as anything else). Maybe going 100% layer-backed instead of using drawRect: in PBGitRevisionCell would help, as that would avoid having to call drawRect on the entire table view column. That's probably outside the scope of this PR though :)

@tiennou

tiennou commented Feb 25, 2018

Copy link
Copy Markdown
Contributor

Okay, done for today 😉. I've made it "clean" against master because there were nib changes, and I fixed the branch label dragging. Haven't looked at the flickering/slowness though…

Note that I almost completely killed PBRefController (and what I left won't last), so be careful around it. This has the nice property of making the responder chain less convoluted, so maybe sometime we can switch to -validateMenuItem: instead of the wreck that is PBGitRefMenuItem.

…eature/fluent-ui

# Conflicts:
#	Classes/Controllers/PBGitHistoryController.m
@mangerlahn

Copy link
Copy Markdown
Contributor Author

I finally got around to setup an Sierra instance. The flickering seems to come from -[sourceView reloadData]. I guess there is some sort of AppKit bug, with reloading the table the second the user selected a cell, that was fixed in High Sierra.

I removed these reload statements for now. I am not sure under which circumstances they would be needed.

I assume that this is probably too easy to fix the problem, so I am going to do some deeper analysis on this.

@tiennou could you check out if this „solution“ works for you? That way I at least know that I am heading into the right direction..

# Conflicts:
#	Classes/Controllers/PBGitHistoryController.m
#	Classes/Controllers/PBGitSidebarController.m
#	Resources/XIBs/PBGitCommitView.xib
If the webview contains a lot of content, the frame rate during resize drops dramatically
This disables the webView redraw during live resizes
@tiennou

tiennou commented Apr 25, 2018

Copy link
Copy Markdown
Contributor

Sorry, I meant to reply yesterday after taking a look but forgot to do so. The flickering source view is gone (at least at the commit you've asked it), but it felt a little sluggish still (though it seems that master shared that behavior, so maybe arrowing through the list of refs triggers a perf breakdown; haven't investigated).

One thing I noticed (because I tried to fix the merge conflict you've now fixed) is that the box view around the Amend / Commit button is gone. I'd like to keep it, because sometime™ it will need to be hot-swapped with something else (like Merge, or Abort/Skip/Continue Rebase). It's pretty minor though.

Again, thanks for doing all that work, I like the performance improvement of the history view a lot !

@mangerlahn

Copy link
Copy Markdown
Contributor Author

Wow, I messed up the merge and overwrote Elia's changes (78e75b2)

I am very sorry about that!

@mangerlahn

Copy link
Copy Markdown
Contributor Author

Well, the Sierra fix turns out to be not a fix at all. When checking out a branch, the checkmark is not updated. I currently try to make reloadData work again with the sidebar/sourceList.

@mangerlahn

Copy link
Copy Markdown
Contributor Author

I was able to fix that now. The sidebar is behaving as expected on 10.12 and 10.13 for me

@mangerlahn

Copy link
Copy Markdown
Contributor Author

I can't think of any more changes that need to be done here. Feel free to review @tiennou!

@tiennou

tiennou commented Aug 19, 2018

Copy link
Copy Markdown
Contributor

I just found some UI glitches. Using the table headers results in a wonky layout in the Subject column.

Also, resetting the table view to the "normal" mode results in this the first time. It will fix itself on the next branch change though…

I'm tempted to merge this as is though, since it's a minor issue…

@tiennou

tiennou commented Aug 19, 2018

Copy link
Copy Markdown
Contributor

Also, I'm about to git reset --hard over this :

diff --git i/Classes/Views/PBGitRevisionCell.h w/Classes/Views/PBGitRevisionCell.h
index ab0053d3..2e4ab834 100644
--- i/Classes/Views/PBGitRevisionCell.h
+++ w/Classes/Views/PBGitRevisionCell.h
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (NSRect) rectAtIndex:(int)index;
 - (void) drawLabelAtIndex:(int)index inRect:(NSRect)rect;
 
-@property (copy) PBGitCommit* objectValue;
+@property (strong) PBGitCommit *objectValue;
 
 @end

@mangerlahn

Copy link
Copy Markdown
Contributor Author

Ouch, I might be able to fix these in the evening. Sorry for that!

@tiennou

tiennou commented Sep 1, 2018

Copy link
Copy Markdown
Contributor

Merging in ! Thank you for being patient, and thanks for the PR !

@tiennou
tiennou merged commit 0378e8e into gitx:master Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants