gmic-qt
gmic-qt copied to clipboard
Bad aspect ratio in error messages
There are inconsistencies regarding how certain error messages are displayed in the preview widget.
For instance, if I add these two filters Error1 and Error2:
#@gui Error 1 : unknown_command, unknown_command
#@gui Error 2 : known_command, known_command
known_command :
gui_error_preview "Une belle erreur !"
and I try to "apply" them on a square image, I get this preview error for Error1 (filter that calls an unknown command) :
and this one for Error2 (a filter that calls the gui_error_preview command from the stdlib):
The first screenshot clearly exhibits a problem with the aspect ratio that makes it harder to actually read the error message.
Fixed (from the stdlib side), with https://github.com/GreycLab/gmic/commit/e897652a74cf2e6072dc541fdca8f5bc36ff6761
Anyway, I'd recommend changing (at least) these two lines in Widgets/PreviewWidget.cpp:
fullCommandLine += QString(" _preview_width=%1").arg(width());
fullCommandLine += QString(" _preview_height=%1").arg(height());
by
fullCommandLine += QString(" _preview_area_width=%1").arg(width());
fullCommandLine += QString(" _preview_area_height=%1").arg(height());
Optionnally: for better coherence between the different calls to G'MIC done by the plug-in, it would be interesting to have also all the other variables defined with their correct values, s.a _preview_width, _preview_height, _preview_x0, _preview_y0, _preview_x1, _preview_y1, and so on. Not a big deal for the moment though.