mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-24 06:12:45 +03:00
Add dummy tabbar to main window
This commit is contained in:
parent
7afcec5b98
commit
99709b223f
@ -18,15 +18,12 @@ extension MainWindow {
|
||||
|
||||
self.window.titlebarAppearsTransparent = true
|
||||
|
||||
self.neoVimView.tabBar?.removeFromSuperview()
|
||||
self.workspace.removeFromSuperview()
|
||||
|
||||
self.set(repUrl: self.window.representedURL, themed: true)
|
||||
|
||||
self.window.contentView?.addSubview(self.workspace)
|
||||
self.workspace.autoPinEdge(toSuperviewEdge: ALEdge.top, withInset: 22)
|
||||
self.workspace.autoPinEdge(toSuperviewEdge: ALEdge.right)
|
||||
self.workspace.autoPinEdge(toSuperviewEdge: ALEdge.bottom)
|
||||
self.workspace.autoPinEdge(toSuperviewEdge: ALEdge.left)
|
||||
self.addViews(withTopInset: 22)
|
||||
|
||||
self.titlebarThemed = true
|
||||
|
||||
|
@ -193,7 +193,7 @@ class MainWindow: NSObject,
|
||||
self.windowController.window?.delegate = self
|
||||
self.workspace.delegate = self
|
||||
|
||||
self.addViews()
|
||||
self.addViews(withTopInset: 0)
|
||||
|
||||
self.neoVimView.trackpadScrollResistance = CGFloat(
|
||||
state.trackpadScrollResistance
|
||||
@ -509,9 +509,43 @@ class MainWindow: NSObject,
|
||||
)
|
||||
}
|
||||
|
||||
private func addViews() {
|
||||
self.window.contentView?.addSubview(self.workspace)
|
||||
self.workspace.autoPinEdgesToSuperviewEdges()
|
||||
func addViews(withTopInset topInset: CGFloat) {
|
||||
if self.neoVimView.usesCustomTabBar {
|
||||
self.addViewsWithTabBar(withTopInset: topInset)
|
||||
} else {
|
||||
self.addViewsWithoutTabBar(withTopInset: topInset)
|
||||
}
|
||||
}
|
||||
|
||||
private func addViewsWithTabBar(withTopInset topInset: CGFloat) {
|
||||
guard let tabBar = self.neoVimView.tabBar else {
|
||||
self.log.error("Could not get the TabBar from NvimView!")
|
||||
self.addViewsWithoutTabBar(withTopInset: 0)
|
||||
return
|
||||
}
|
||||
let ws = self.workspace
|
||||
|
||||
self.window.contentView?.addSubview(tabBar)
|
||||
self.window.contentView?.addSubview(ws)
|
||||
|
||||
tabBar.autoPinEdge(toSuperviewEdge: .top, withInset: topInset)
|
||||
tabBar.autoPinEdge(toSuperviewEdge: .left)
|
||||
tabBar.autoPinEdge(toSuperviewEdge: .right)
|
||||
|
||||
ws.autoPinEdge(.top, to: .bottom, of: tabBar)
|
||||
ws.autoPinEdge(toSuperviewEdge: .left)
|
||||
ws.autoPinEdge(toSuperviewEdge: .right)
|
||||
ws.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
}
|
||||
|
||||
private func addViewsWithoutTabBar(withTopInset topInset: CGFloat) {
|
||||
let ws = self.workspace
|
||||
|
||||
self.window.contentView?.addSubview(ws)
|
||||
ws.autoPinEdge(toSuperviewEdge: .top, withInset: topInset)
|
||||
ws.autoPinEdge(toSuperviewEdge: .right)
|
||||
ws.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
ws.autoPinEdge(toSuperviewEdge: .left)
|
||||
}
|
||||
|
||||
private func showInitError() {
|
||||
|
Loading…
Reference in New Issue
Block a user