Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some patch code for tab and table #56

Closed
wants to merge 1 commit into from
Closed

some patch code for tab and table #56

wants to merge 1 commit into from

Conversation

ddkwork
Copy link

@ddkwork ddkwork commented May 10, 2024

No description provided.

Copy link
Owner

@richardwilkes richardwilkes left a comment

Choose a reason for hiding this comment

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

Currently, I'm not seeing anything in this PR that I'd want to accept. Happy to discuss why you think you need these additions, though.

@@ -68,6 +69,10 @@ type Panel struct {
TooltipImmediate bool
}

func (p *Panel) SetParent(panel *Panel) {
Copy link
Owner

Choose a reason for hiding this comment

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

As I think I've stated before, I will not add a .SetParent(*Panel) method. If you want to set the parent, call .AddChild(Paneler) or .AddChildAtIndex(Paneler,int) on the parent instead. This will ensure all of the other things that clients expect to happen, do happen, unlike with what this method is doing.

@@ -15,6 +15,7 @@ import (
"strings"

"github.com/richardwilkes/toolbox"

Copy link
Owner

Choose a reason for hiding this comment

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

Remove this empty line.

@@ -13,6 +13,7 @@ import (
"strconv"

"github.com/richardwilkes/toolbox/i18n"

Copy link
Owner

Choose a reason for hiding this comment

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

Remove this empty line.

Copy link
Author

Choose a reason for hiding this comment

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

This is goland's import grouping, it will also automatically separate it if you change it manually

@@ -49,6 +50,11 @@ type dockHeader struct {
dragInsertIndex int
}

func (d *dockHeader) CurrentDockTabLabel() *Label {
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this needed? If you want to know the title of the current tab, you can call .CurrentDockable().Title(). There is no need to access it from here.

Copy link
Author

@ddkwork ddkwork May 24, 2024

Choose a reason for hiding this comment

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

No, title is just a string not a panel, we need to get the label where the title is located in order to add a context menu in its coordinates to close all the tabs with one click.

@@ -50,6 +50,9 @@ func NewDockContainer(dock *Dock, dockable Dockable) *DockContainer {
d.AddChild(d.content)
return d
}
func (d *DockContainer) Header() *dockHeader {
Copy link
Owner

Choose a reason for hiding this comment

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

Returning a private struct from a public API is not acceptable. Why do you feel you need to get access to this private, internal, field? It is being protected specifically to help prevent unexpected changes to its state and as such, I'm unlikely to want it exposed.

Copy link
Author

Choose a reason for hiding this comment

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

Without this action there is no way to fetch the dock title's panel

@ddkwork
Copy link
Author

ddkwork commented May 24, 2024

The reason for implementing the ability to close all tabs with one click is because I often have a lot of tabs open, like looking at gcs engineering, and while I don't understand what game that is, it's too much of a hassle to close them one by one when I have a lot of forms open within the gcs interface. In addition, code display widgets or edit widgets may also open a lot of tabs, if the function is improved later, it is possible to open a lot of tabs like using goland. So the context menu to close all tabs with one click is very useful for me. Anyway, I tested it on my side and it works fine, so I will close this pr if you think it's not working.

@richardwilkes
Copy link
Owner

While I won't take the changes in this PR, I did add a contextual menu into the dock tabs which has two options when more than one tab is present in a dock container:

  • Close Other Tabs
  • Close All Tabs

Note that these options only apply to the current dock container and not to any others that may be present elsewhere in the dock.

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.

2 participants