Skip to content

Instantly share code, notes, and snippets.

@cheesequake
Last active August 20, 2024 11:11
Show Gist options
  • Select an option

  • Save cheesequake/c5381fca202b5a60e5eab9b8d085b63f to your computer and use it in GitHub Desktop.

Select an option

Save cheesequake/c5381fca202b5a60e5eab9b8d085b63f to your computer and use it in GitHub Desktop.
Google Summer of Code 2024 with GNU Image Manipulation Program

Google Summer of Code 2024 : Porting from GTKTreeView to GimpTreeView

Stage 0: Hello GIMP?

List of merge requests since February: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests?author_username=cheesequake&scope=all&sort=created_date&state=all

Stage 1 : Community Bonding and initial research

With my final exams ending, I began researching on the project. At this stage, these are the features I think I want to implement:

  • A base GTK level widget which implements Tree widget according to GTK4's recommended way
  • It would have a GListModel and have GtkListBox as the main widget

While researching about GtkExpanders, I stumbled across this dialog and saw that upon closing the expander, the whole label widget would go down instead of staying in place.

A random bug I came across, which introduced me to how crop works, and also how undo history works.

There was an error in the way I solved the bug previously, which caused issues in operations which required a lot of options. So, instead of making the scrolled window fixed in size, I made the toplevel resize when the expander is closed/opened.

Stage 2 : Rethinking and re-implementation

After talks with my mentor, I learnt about design patterns and thought of an idea of 'decorating' based on the type of items it holds. Further discussions with Jehan also got me to narrow down what exactly I want to make. The final decision was to not make a basic widget in GTK's style which would be an all purpose widget. The decision was to only and only focus on getting the Layer/Channel/Vector tree views right. Back to more ideas :)

This was another bug I solved when I got tired of the tree view :D. A fun little exercise, debugging my way through how brush dynamics work and was also one of the first times I solved a bug for 2.10 as well

At this point, I am in love with solving bugs, and it gives me great joy haha. This was another small patch which fixed filter duplication while exporting.

While looking at the ItemTreeView issues, I came across this one. Although I am still unsure how this works, but it seemed to fix this, currently waiting for a review.

I am proud of this one, also kinda related to the Tree View, but mainly how layer selections move up and down inside the tree view. It involved a decent bit of debugging, but finally I was able to visualise what the issue was and how they layers were being moved. Luckily we came through.

It is after working with this issue that I get the idea that GimpItemTree could also be used as a "store".

Similar procedure repeated for channels and paths as well.

A very silly mistake was committed by me in not checking for null before performing functions. Luckily, ajonsson was quick to point out my mistake and thanks to them, I was able to finally put this issue to sleep.

This is still a work in progress, but even after a lot of debugging, it has been difficult to come up with how to deal with "compose-crop" node. Hopefully in the future I or someone else will find the resolution, and many people will get a chance to learn.

Current Branch : GimpTreeView

This is going to be my working directory (for a long time), but it does look promising. Following are some different implementations I tried, each with its own failures.

image

This implementation put an expander inside a list box row, but it allowed for the whole group to be selected when any layer inside is selected. So, this is not it.

image

This implementation has no expander yet, but illustrates how the end widget should look. It is not adequete as it's only a label, but does inspire new ideas

Moving Forward

Next, I want to explore a GtkRevealer and see if I can use it to show listbox rows. Basically, we are trying to move from GtkTreeView, which was a column based widget, to a GimpTreeView, which is going to be a row based widget. The scope of the project was a bit more than I expected for me, and I prioritised solving bugs for release 3.0, because I enjoy fixing bugs. I have time till 3.2 release, so till then, I will be able to finish the project as a whole. I also want to work on the GTK4 port in the coming years.

Ending Notes

I am thankful to the entire GIMP community for not only welcoming me with open arms, but also being extremely supportive. I wish to meet you all some day when I also have enough money to travel to any of the events :D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment