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

Port to GtkSharp 3 all the Gtk# 2 dock system #148

Closed
wants to merge 0 commits into from

Conversation

Dadoum
Copy link

@Dadoum Dadoum commented Oct 2, 2020

No description provided.

@cameronwhite
Copy link
Member

Thanks for working on this! I'll look through it later this weekend and give it a test

@Dadoum
Copy link
Author

Dadoum commented Oct 3, 2020

I have some improvement I've done for Windows style if needed
But it will remove native-like titlebars on Linux?

@cameronwhite
Copy link
Member

I'd be interested to see the changes! Most likely it would be safest to stick with the default GTK style / behaviors where possible though

@Dadoum
Copy link
Author

Dadoum commented Oct 3, 2020

All colours are taken from GTK+ 3 theme. The icon are drawn, but we can mix up both code if native decorations are preferred.

@Dadoum
Copy link
Author

Dadoum commented Oct 3, 2020

It also fixes some bugs, but there is still some features that could be miss-implemented. The tool stays mostly usable tho.

@Dadoum
Copy link
Author

Dadoum commented Oct 3, 2020

If I don't answer, and if you prefer the old version, you can revert the last commit.

@cameronwhite
Copy link
Member

Gave it a test on my Mac and it's working pretty well!
A few issues I noticed (see screenshot below)

  • Some of the dock items have a close button but the dock item isn't supposed to be closeable. This seems to go away after minimizing and restoring the panel
  • There is some extra padding around all of the dock items, but that might be coming from the GTK3 theme?
  • The text for the dock item's title seems small and kind of blurry
  • The toolbars in the history pad and layers pad are showing up at the top instead of the bottom

Screen Shot 2020-10-05 at 6 28 42 PM

@Dadoum
Copy link
Author

Dadoum commented Oct 21, 2020

Just an update: I am actually porting the docking library of master Pinta branch. Should not take too long; almost everything works great except appearance.

@cameronwhite
Copy link
Member

OK, sounds good!

@Dadoum Dadoum changed the title Port to gtk3 all docking of MonoDevelop 2.3 Port to GtkSharp 3 all the Gtk# 2 dock system Oct 23, 2020
@Dadoum
Copy link
Author

Dadoum commented Oct 23, 2020

Done ! Can you try on macOS everything ? (don't own any mac)
Should work better too on dark gtk theme.

@Dadoum
Copy link
Author

Dadoum commented Oct 24, 2020

After more search for issues, I found 2 issues/differences with Gtk#2:

  • No radial effect when hovering dockbar button
  • Bad colours on tab strip with some gtk theme
    Will fix when I will find time

@Dadoum
Copy link
Author

Dadoum commented Oct 24, 2020

Another big issues:

  • TabBar is horrible.
  • shares a bug with gtk#2 implementation, it cannot be moved from dock title bar (not window one) on another undocked place.

@Dadoum
Copy link
Author

Dadoum commented Oct 26, 2020

All known issues are now fixed.

@cameronwhite
Copy link
Member

Great, I'll have a look soon!

@Dadoum
Copy link
Author

Dadoum commented Oct 27, 2020

Some screens on Linux:

image

Screenshot on Gnome with Arc-Darker

image

Screenshot on Gnome with Arc-Dark

image

Screenshot on Gnome with Adwaita-Dark

@cameronwhite
Copy link
Member

The screenshots look very good! In the third screenshot, is the black text on black background for "Unsaved image 1" something that can be fixed, or is it a problem with the theme?

@Dadoum
Copy link
Author

Dadoum commented Oct 27, 2020

I don't know why, I try to get "text_color" property. The only fix I see is to change this text by a Label.

But it works with most themes. I tested with Yaru (ubuntu theme), its dark varient and it works too.

I also tested with Gtk's win32 theme (on Windows), and if there will be Windows distribution, there should be a theme with it because everything is ugly on Windows.

Copy link
Member

@cameronwhite cameronwhite left a comment

Choose a reason for hiding this comment

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

Thanks for all this work!
I've left a few questions and suggestions in the comments

From testing on macOS (see screenshot below) the only issues I noticed were the missing icons (black squares beside the dock pad titles) and the inactive tab being drawn in black
I think the icon issue is from the changes to use themed icons in the GTK3 branch - my comment in HistoryPad.cs has a fix that should probably work

Screen Shot 2020-10-28 at 5 50 44 PM

using System.Windows.Input;
#endif

namespace Hexadock
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for this Hexadock namespace rather than e.g. Pinta.Docking? I'm not clear what its origin is

Copy link
Author

Choose a reason for hiding this comment

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

This come from one of my side projects, since when I ported Gtk#2 Docking, it was first for my side project named Hexacode. Will rename it


// Hide menuitem
if ((Behavior & DockItemBehavior.CantClose) == 0) {
MenuItem mitem = new MenuItem (("Hide"));
Copy link
Member

Choose a reason for hiding this comment

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

I think this were translatable strings in the master branch? (using Catalog.GetString()). In the GTK3 build you can use Pinta.Core.Translations, but we could move that elsewhere if needed for Pinta.Docking to depend on it.

Copy link
Author

Choose a reason for hiding this comment

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

I referenced now Pinta.Core (for peaople that would want to use Pinta.Docking, it will not be so hard to remove it)

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds good!

btnDock = new ImageButton ();
btnDock.Image = pixAutoHide;
btnDock.InactiveImage = pixAutoHide.WithAlpha (.5);
btnDock.TooltipText = ("Auto Hide");
Copy link
Member

Choose a reason for hiding this comment

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

The tooltips here should also be translatable.

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
Copy link
Member

Choose a reason for hiding this comment

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

I think this file should be removed?


<!-- References -->
<ItemGroup>
<Reference Condition=" '$(PINTA_MONO_POSIX_2)' != '' " Include="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL" />
Copy link
Member

Choose a reason for hiding this comment

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

This might have been copied over from the master branch, but isn't necessary for GTK3
Could you revert some of this file to match the current gtk3-v2 branch? e.g. adding back the

    <Version>1.8.0.0</Version>
    <Authors>PintaProject</Authors>
    <Company />
    <Product />


// TODO-GTK3 (docking)
#if false
history_item.Label = ("History");
Copy link
Member

Choose a reason for hiding this comment

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

This string should be translatable (Translations.GetString())

history_item.Icon = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerDuplicate, 16);
history_item.DefaultWidth = 100;
history_item.Content = history;
history_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png");
Copy link
Member

Choose a reason for hiding this comment

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

In the GTK3 build we now use themed icons, so I think this should be Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerDuplicate, 16); from the deleted line above?

layers_item.DefaultWidth = 100;
layers_item.Label = ("Layers");
layers_item.Content = layers;
layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png");
Copy link
Member

Choose a reason for hiding this comment

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

Similar issues with label and icon as the other dock pads.

open_images_item.DefaultLocation = "Layers/Bottom";
open_images_item.Label = ("Images");
open_images_item.Content = new OpenImagesListWidget ();
open_images_item.Icon = PintaCore.Resources.GetIcon ("Menu.Effects.Default.png");
Copy link
Member

Choose a reason for hiding this comment

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

Similar issues with label and icon as the other dock pads.

toolbox_item.Content = toolbox;
toolbox_item.Icon = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.ToolPencil, 16);
toolbox_item.Icon = PintaCore.Resources.GetIcon ("Tools.Pencil.png");
Copy link
Member

Choose a reason for hiding this comment

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

Similar issues with label and icon as the other dock pads.

@Dadoum
Copy link
Author

Dadoum commented Oct 29, 2020

image
Translations now fully working, setupping a macOS KVM to start debugging background system.

@darkdragon-001
Copy link
Contributor

This looks very promising. Anything still blocking this from being merged?

@Dadoum
Copy link
Author

Dadoum commented Feb 10, 2021

Yes, it is still ugly on macOS, I had a working branch but I lost it with a disk corruption.

@darkdragon-001
Copy link
Contributor

@Dadoum Sad to hear that! Hopefully you can still remember the important twists such that you can quickly redo your work. Looking forward to your changes!

@Dadoum
Copy link
Author

Dadoum commented Feb 12, 2021

Going to rearchitect DockNotebook to make it use native components. This is the preferred approach in gtk 4

@Dadoum
Copy link
Author

Dadoum commented Feb 27, 2021

Just need some details about how it should be reimplemented. Now, the gtk3-v2 branch uses panels for 2 elements only (history and layers) and the notebook. It is maybe overkill to use it just for two panels ? Or should I recreate panels ? This would be a big rollback.

@cameronwhite
Copy link
Member

I'd say try keeping the UI as-is with the latest version (so history / layers panel plus the notebook) and see how things look!

@Dadoum Dadoum closed this Apr 14, 2021
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.

None yet

3 participants