klayout icon indicating copy to clipboard operation
klayout copied to clipboard

Use enhanced tab widget for file tabs to easily navigate through larg…

Open EugeneZelenko opened this issue 3 years ago • 6 comments

…e number of opened files.

EugeneZelenko avatar Sep 23 '22 01:09 EugeneZelenko

Only missing piece is icon. Looks like KLayout is in the middle of refactoring icons handling, so I'll need guidance on that. Icon I have in mind: https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/menu/default/48px.svg.

EugeneZelenko avatar Sep 23 '22 01:09 EugeneZelenko

Thanks a lot for this PR. I'll take a look.

You're right, there is refactoring going on with the goal to support High-DPI icons. I will produce SVG for the new icon as well.

Matthias

klayoutmatthias avatar Sep 23 '22 20:09 klayoutmatthias

Thanks again for providing this PR. I really like this feature :)

However, after taking a look I have some modification proposals. Specifically, I'm slightly worried about the implications of switching to QTabWidget. I made an alternative proposal in this branch: enhanced-tab-widget

I cannot modify your PR, but maybe you want to take a look.

For the rationale see here: https://github.com/KLayout/klayout/commit/ab9fe57ec3363554c435163db7771ab00029e7a7

Best regards,

Matthias

klayoutmatthias avatar Sep 23 '22 21:09 klayoutmatthias

Your branch looks OK for me. QTabBar/QTabWidget switch was not trivial because of life-time management, but somehow QTabWidget worked for me :-)

I noticed that you added context menu for tabs, so it may be useful also to add Close to the Left/Right like Visual Studio Code of Firefox. Clone command also seems to be good fit to context menu.

EugeneZelenko avatar Sep 23 '22 22:09 EugeneZelenko

Makes sense, yes.

I have added these features (also for the macro editor tabs except for "clone") to the branch if you like to take a look.

Matthias

klayoutmatthias avatar Sep 24 '22 18:09 klayoutmatthias

Just build and tested your branch. Looks OK for me, except there is different between KLayout and VS Code/Firefox how to treat context menu. In KLayout currently selected tab is base one, but in VS Code/Firefox base tab is where mouse was right-clicked (i.e. QTabBar::tabAt). Theoretically right click could be made outside bars, so -1 return value should be handled too (no menu displayed).

EugeneZelenko avatar Sep 26 '22 17:09 EugeneZelenko

I see ... it's not trivial to detect the tab the mouse clicked appeared at, but I'll try.

klayoutmatthias avatar Oct 04 '22 21:10 klayoutmatthias

I may be just change current tab on right-click?

EugeneZelenko avatar Oct 04 '22 21:10 EugeneZelenko

That was easier than I thought. I have updated the branch accordingly. I cannot avoid however that the selected tab switches to the one the mouse points at. But I think that makes sense considering that otherwise the selected tab might become invisible.

klayoutmatthias avatar Oct 05 '22 20:10 klayoutmatthias

I tried current version of branch and it works fine. Thank you!

EugeneZelenko avatar Oct 05 '22 21:10 EugeneZelenko

Thanks! I merged this PR.

klayoutmatthias avatar Oct 09 '22 19:10 klayoutmatthias

Thank you!

EugeneZelenko avatar Oct 09 '22 21:10 EugeneZelenko