You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Synfig version & platform:
Building from master branch
Debian sid
Issue description:
To ease UI designers, it's wise to separate the handwritten UI code from canvasproperties.cpp to its own glade (UI) file
And implement only the logic inside the .cpp file
That way it'll be much easier to focus only on the design aspects without having to refer to GTKMM API docs all the time
Synfig Custom widgets should support GtkBuilder (it should be Gtk::Buildable). I made something here 025eec2 for Widget_Time - this allow us to refer to them on Glade too (but with a placeholder - not the real appearance)
Ideally, we would have a library (.so/dll/dynlib) for collecting custom widgets to be able to preview better the dialogs on Glade.
I don't know if it would be possible as they're in C++ though.
@ice0 Thanks! How stupid of me. I did not notice that I inserted using namespace synfig in the .cpp implementation file and I missed the error message indicating .h
I was too tired and a bit desperate ;P
AFAIK, WrapNewFunction passed in void Glib::wrap_register(GType type, WrapNewFunction func) takes the allocated C object into a new C++ object, calling the YourClass(BaseObjectType* cobject) constructor (I'm calling it C-wrap constructor).
In this case, BaseObjectType is GtkToggleButton, that doesn't take those parameters in current single C++ constructor of Widget_Link.
Workaround here is easy: create a default constructor (without any parameters): it's "just" tooltips anyway.
So the C-wrap constructor can work normally.
Then, via glade/gtkbuilder properties, you load the custom tooltips. I don't remember know how to do it, if I did it before XD
// .cppWidget_X::Widget_X() :
Glib::ObjectBase("widget_x"), // name in glade: gtkmm__CustomObject_widget_x
property_mine_(*this, "property_name_for_glade", "My default") // third argument is optional
{
init();
}
Widget_X::Widget_X(BaseObjectType* cobject) :
Glib::ObjectBase("widget_x"), // name in glade: gtkmm__CustomObject_widget_x
Gtk::Entry(cobject),
property_mine_(*this, "property_name_for_glade", "My default") // third argument is optional
{
init();
}
voidWidget_X::init()
{
set_tooltip_text(property_mine_.get_value());
}
Glade file is too ugly now with lots of custom widgets
Derived GtkToggleButton implemented in synfig ie., Widget_Link is too simple
No special added feature at all
I feel it's better adding the standard GtkToggleButton from Glade options and programmatically manipulating the icons
Haven't tried it yet
And here's how the loaded glade dialog looks after building and running
For CanvasProperties I'm duplicating the notebook container all over again
That way I don't have to modify three separate classes which would be tedious
The only modification made to Widget_Render is separating out GammaPattern to its own file so both Widget_Render and CanvasProperties class can instantiate GammaPattern object by including it as a header file
One invokes it with pure C++ code and the other invokes it as a custom widget inside the glade file
Once this issue is done, Widget_Render (notebook container) can be safely deprecated and new Render dialog #721 can be implemented in the future
Implementation is done but I haven't modified the build script for Autotools yet
On CMake, a new build target is implemented called build_resource, this time our resource (glade file) is generated to a C file using glib-compile-resources tool and later compiled with synfigstudio. That way we don't have to ship the .glade file because the UI is loaded as library.
There is a bug (and maybe more) with the newly implemented CanvasPorperties class. I'm working on fixing it before submitting the PR
PS: For compiling gresource on Autotools, I might ditch it if the above pending issue persists. It's new to me :(
Activity
Keyikedalube commentedon Jul 13, 2020
I'm experimenting/working on this issue ;)
rodolforg commentedon Jul 13, 2020
@Keyikedalube Great :D
Synfig Custom widgets should support GtkBuilder (it should be Gtk::Buildable). I made something here 025eec2 for Widget_Time - this allow us to refer to them on Glade too (but with a placeholder - not the real appearance)
I converted a dialog to UI here 9207c07 .
Ideally, we would have a library (.so/dll/dynlib) for collecting custom widgets to be able to preview better the dialogs on Glade.
I don't know if it would be possible as they're in C++ though.
Keyikedalube commentedon Jul 15, 2020
I'm trying to separate GammaPattern from renddesc.cpp to its own source file but I'm stuck with this error
I believe this include is the correct one to successfully build GammaPattern class
synfig/synfig-studio/src/gui/renddesc.h
Line 40 in a74530f
Here's how I implemented the gammapattern.h file
I'm using CMake to build synfig for now. I've included the definition file in target_sources(synfigstudio ...)
What am I missing?
ice0 commentedon Jul 15, 2020
You need to use
synfig::Gamma, it added indirectly viausing namespace synfig;Keyikedalube commentedon Jul 16, 2020
@ice0 Thanks! How stupid of me. I did not notice that I inserted
using namespace synfigin the .cpp implementation file and I missed the error message indicating .hI was too tired and a bit desperate ;P
Anyway, so much thanks for the pointer!
rodolforg commentedon Jul 16, 2020
Why are you including
synfig/renddesc.hinstead ofsynfig/gamma.h(in the header file) ?Keyikedalube commentedon Jul 16, 2020
Thanks @rodolforg :)
Had to use
synfig/color/gamma.hthoughmake couldn't find
synfig/gamma.hKeyikedalube commentedon Jul 16, 2020
synfig/synfig-studio/src/gui/dialogs/canvasproperties.cpp
Lines 93 to 102 in a74530f
Is the

idLabel&entry_idoutput for the above code like this? (But hidden)Because I haven't seen an actual dialog with that idLabel and entry_id on it...
rodolforg commentedon Jul 17, 2020
As far as I understood reading the code, this field is for rendering exported canvas.
However, I don't know a GUI way to call this dialog for those canvases
rodolforg commentedon Jul 17, 2020
Ok, I got it.
You must open the exported canvas via Canvas Navigator panel. :)
You can export canvas by exporting value of the "canvas" (¬¬) parameter of a Group Layer, for example.
Keyikedalube commentedon Jul 17, 2020
Thanks! Tested it and got ID output in the top :)

Keyikedalube commentedon Jul 18, 2020
Implementing Widget_Link as custom widget
The constructor for Widget_Link takes two std::string arguments
I don't really know how to pass those args to Glib::wrap part
Glib::wrap_register(gtype, Widget_Link::wrap);Web is not helping much either. Can't even find the doc about it
Keyikedalube commentedon Jul 18, 2020
I think there's no way to send tooltip message string when we try to
widget_link->get_widget("widget_name", widget)from glade fileInstead, we would have to set the tooltip message directly on the glade file using
I guess the only downside to this would be static message instead of the dynamic one synfig has right now
rodolforg commentedon Jul 18, 2020
AFAIK,
WrapNewFunctionpassed invoid Glib::wrap_register(GType type, WrapNewFunction func)takes the allocated C object into a new C++ object, calling theYourClass(BaseObjectType* cobject)constructor (I'm calling it C-wrap constructor).In this case,
BaseObjectTypeisGtkToggleButton, that doesn't take those parameters in current single C++ constructor ofWidget_Link.Workaround here is easy: create a default constructor (without any parameters): it's "just" tooltips anyway.
So the C-wrap constructor can work normally.
Then, via glade/gtkbuilder properties, you load the custom tooltips. I don't remember know how to do it, if I did it before XD
Yes, it's very poorly documented.
Here's some related info around the web:
1 remaining item
rodolforg commentedon Jul 18, 2020
@Keyikedalube that's the way: you'll implement Glib::Property ;)
Keyikedalube commentedon Jul 19, 2020
About 80% done...
Glade file is too ugly now with lots of custom widgets

Derived GtkToggleButton implemented in synfig ie., Widget_Link is too simple
No special added feature at all
I feel it's better adding the standard GtkToggleButton from Glade options and programmatically manipulating the icons
Haven't tried it yet
And here's how the loaded glade dialog looks after building and running

rodolforg commentedon Jul 19, 2020
Did you try to add the custom widgets in synfig glade catalog xml?
Keyikedalube commentedon Jul 19, 2020
Yes
So far
gammapatternandwidget_linkhave been implemented as custom widgetsrodolforg commentedon Jul 20, 2020
Did you see that notebook container is a separated widget? It's also used in other dialogs, like Render.
Keyikedalube commentedon Jul 20, 2020
Yes, I noticed that
For CanvasProperties I'm duplicating the notebook container all over again
That way I don't have to modify three separate classes which would be tedious
The only modification made to Widget_Render is separating out GammaPattern to its own file so both Widget_Render and CanvasProperties class can instantiate GammaPattern object by including it as a header file
One invokes it with pure C++ code and the other invokes it as a custom widget inside the glade file
Once this issue is done, Widget_Render (notebook container) can be safely deprecated and new Render dialog #721 can be implemented in the future
Keyikedalube commentedon Jul 21, 2020
Implementation is done but I haven't modified the build script for Autotools yet
On CMake, a new build target is implemented called
build_resource, this time our resource (glade file) is generated to a C file using glib-compile-resources tool and later compiled with synfigstudio. That way we don't have to ship the .glade file because the UI is loaded as library.There is a bug (and maybe more) with the newly implemented CanvasPorperties class. I'm working on fixing it before submitting the PR
PS: For compiling gresource on Autotools, I might ditch it if the above pending issue persists. It's new to me :(
Implemented canvasproperties dialog glade file
Keyikedalube commentedon Jul 22, 2020
Made the PR
Couldn't solve the above post-issue... More info on the PR
Keyikedalube commentedon Jul 23, 2020
Behavior issue solved in commit d1ebfd8
Whew..!
Need help with updating the Autotools build script
rodolforg commentedon Jul 23, 2020
I can help with that, but not right now…
Implemented canvasproperties dialog glade file
Implemented canvasproperties dialog glade file
Keyikedalube commentedon Nov 2, 2020
Closed in favor of #777
Reason discussed here and here