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

Improved css #1789

Merged
merged 1 commit into from Oct 28, 2020
Merged

Improved css #1789

merged 1 commit into from Oct 28, 2020

Conversation

Keyikedalube
Copy link
Contributor

@Keyikedalube Keyikedalube commented Oct 19, 2020

Fixes #1061
Fixes #1390

  • Compile OS X specific code only in its environment
  • Use classes to apply changes to multiple widgets
  • Use ids to apply changes to specific widgets
  • Don't style dialogs

Use Windows gtk3 theme to have a proper global look and feel instead of modifying UI by hand.

In my opinion, synfigstudio main window toolbar buttons need to be scaled down for every platform for space efficiency. But not the other parts of GUI ie., dialogs and their buttons. These things should be left alone. Or let third-party themes do the trick. Like this Windows 8 theme.

I need help with styling timeslider. Couldn't figure out how to increase its height with CSS. Or is it even possible?

@ice0
Copy link
Collaborator

ice0 commented Oct 21, 2020

I am thinking maybe making the css loadable from a file?
This will allow anyone to edit the design without knowing the code.
In addition, it will allow you to switch design/theme, for example, from regular to compact.

@Keyikedalube
Copy link
Contributor Author

Keyikedalube commented Oct 21, 2020

Yeah, but there's OS X specific code about insensitive context menus. And I don't want to waste more time on build scripts like in my other PRs.

I think I'd have to modify both build scripts to intelligently insert OS X stylesheet code using a configuration file (just like my previous attempt with *.xml.in file). I'm not really sure but I'm trying to save more time on my side here too. Hacking synfig is not the only thing I'm doing 24/7 :(

Anyway, if you think it's simple then I could try implementing loadable css file...

@ice0
Copy link
Collaborator

ice0 commented Oct 21, 2020

I think for the first iteration, we can just do #ifdef for file loading function. For example:

#ifdef _WIN32
  load_style("synfig.win.css");
#elseif _APPLE
  load_style("synfig.mac.css");
#else 
  load_style("synifg.css");
#endif

I am not sure, but it looks like there aren't many CSS styles out there, so you don't have to worry about duplicating code. In total there will be 3 almost identical css files with some OS-specific elements.

@rodolforg
Copy link
Contributor

@ice0 , What about:

  load_style("synfig.css");
#ifdef _WIN32
  load_style("synfig.win.css");
#elseif _APPLE
  load_style("synfig.mac.css");
#else 
  load_style("synfig.lin.css");
#endif

Load a generic one, and maybe an OS-specific.

And, @Keyikedalube , you can add it in a new share/css folder, just like ui, sound, etc. (and provide an easy way to use it with that helper functions for path).

@Keyikedalube
Copy link
Contributor Author

Guys, I was reading this post

https://www.geeksforgeeks.org/how-to-include-one-css-file-in-another/

Write once and import :)

No need to duplicate code by hand multiple times...

👍 👍 👍 your suggestions. Thanks!

@ice0
Copy link
Collaborator

ice0 commented Oct 21, 2020

Looks like Gnome CSS also support this feature (https://developer.gnome.org/gtk3/stable/chap-css-overview.html)
Awesome!

@Keyikedalube

This comment has been minimized.

@Keyikedalube
Copy link
Contributor Author

Need help with why OS X build is failing...

@Keyikedalube
Copy link
Contributor Author

If I'm not able to figure out how to fix the time slider padding by this week (today and tomorrow)
I'm marking this PR as "Ready for review"
It's draining all my time away

BTW, here are some things I tried:

  • Manually set the height from widget_timeslider (was 20, tried 40)
    But this is risky because the last time I tried to fix this issue Add extra time track space at start and end #1145 I broke other widgets; graph and sound

  • Gtk::DrawingArea inherits Gtk::Widget so I tried manipulating min-height using CSS

Both of them didn't work

Anyway, here's how the time slider looks now after this PR:

Screenshot from 2020-10-23 06-44-53

And before this PR:

Screenshot from 2020-10-23 06-45-24

@rodolforg
Copy link
Contributor

rodolforg commented Oct 23, 2020

If I'm not able to figure out how to fix the time slider padding by this week (today and tomorrow)
I'm marking this PR as "Ready for review"
It's draining all my time away

BTW, here are some things I tried:

* Manually set the height from widget_timeslider (was 20, tried 40)
  _But this is risky because the last time I tried to fix this issue #1145 I broke other widgets; graph and sound_

* `Gtk::DrawingArea` inherits `Gtk::Widget` so I tried manipulating min-height using CSS

Both of them didn't work

AS far as I remember, the height of timeslider is related to the height of the header of Parameters panel treeview.

@rodolforg
Copy link
Contributor

And that is reason indeed.
Captura de tela de 2020-10-23 17-06-00
See? They're aligned.

The treeview header has buttons (for column sort) and somehow they style were affected.
Captura de tela de 2020-10-23 17-08-02
(picture from GtkInspector)

@rodolforg
Copy link
Contributor

Will all commits be squashed?

@Keyikedalube
Copy link
Contributor Author

Will all commits be squashed?

Yes

And if I remember correctly, Telegram repo has a policy of keeping only one commit per PR. Contributors are supposed to squash their commits.
I prefer their style too. One PR one commit.
But that depends on how other projects want to organize their changes :)

@Keyikedalube
Copy link
Contributor Author

Keyikedalube commented Oct 24, 2020

And that is reason indeed.
Captura de tela de 2020-10-23 17-06-00
See? They're aligned.

The treeview header has buttons (for column sort) and somehow they style were affected.
Captura de tela de 2020-10-23 17-08-02
(picture from GtkInspector)

And I thought OOP design was to compartmentalize...

Those two are connected and I would never have suspected that strange behavior.

Anyway thanks for the heads up! Investigating right away...

UPDATE: You were right! Fixed it :)

@rodolforg
Copy link
Contributor

rodolforg commented Oct 24, 2020 via email

@Keyikedalube Keyikedalube marked this pull request as ready for review October 24, 2020 07:21
@ice0 ice0 merged commit dd2d919 into synfig:master Oct 28, 2020
@ice0
Copy link
Collaborator

ice0 commented Oct 28, 2020

Merged. Thank you!

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.

Some labels in dialog buttons are not correctly aligned Inconsistent Synfig UI on GNOME desktop
3 participants