Change size and ratio of Gimp Preview

View: New views
7 Messages — Rating Filter:   Alert me  

Change size and ratio of Gimp Preview

by Nicolás Serrano Martínez Santos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi! I'm trying to develop an interface of a plugin and I would like to use a rectangular gimp preview widget. Despite I've been looking over the documentation of this class and the parents in GTK+ the widgets is always square.

In the code of gimppreview at gimp_preview_init i've find this:

  if (gtk_widget_get_direction (GTK_WIDGET (preview)) == GTK_TEXT_DIR_RTL)
    xalign = 1.0;

  preview->frame = gtk_aspect_frame_new (NULL, xalign, 0.0, 1.0, TRUE);
  gtk_frame_set_shadow_type (GTK_FRAME (preview->frame), GTK_SHADOW_NONE);
  gtk_box_pack_start (GTK_BOX (preview), preview->frame, TRUE, TRUE, 0);
  gtk_widget_show (preview->frame);

Can I access to "preview->frame" from the plugin and change the aspect of the preview widget? Is there any way of doing this from another way?



_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Change size and ratio of Gimp Preview

by Torsten Neuer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> Can I access to "preview->frame" from the plugin and change the
> aspect of the preview widget? Is there any way of doing this from
> another way?

It depends on what you are planning to do (and why).

From my point of view, I would simply use the GimpZoomPreview widget.
This would adopt to the images aspect ratio and you can also see the
whole image with it as well as zoom into a specific subregion.

If you just want the aspect ratio to be the same, you could look at the code
for the zoom-preview widget and see how it does that trick.


  Torsten


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

signature.asc (196 bytes) Download Attachment

Re: Change size and ratio of Gimp Preview

by Nicolás Serrano Martínez Santos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the advice. I've tried using ZoomPreview and it adjust to  
the drawable ratio. If i create a rectangular drawable the widget  
will be rectangular, what i want (let's see if i can be clear) is to  
adjust the width and height of the preview widget. It's adjusted to  
the drawable ratio and the i don't managed to change it.
_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Change size and ratio of Gimp Preview

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Wed, 2008-04-16 at 11:15 +0200, Nicolás Serrano Martínez Santos
wrote:
> Hi! I'm trying to develop an interface of a plugin and I would like to
> use a rectangular gimp preview widget. Despite I've been looking over
> the documentation of this class and the parents in GTK+ the widgets is
> always square.

This is a design decision of the GimpPreview widget. If this doesn't fit
your needs, then you can't use GimpPreview.


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Change size and ratio of Gimp Preview

by Torsten Neuer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Mittwoch, 16. April 2008 22:03:06 schrieb Nicol�s_Serrano_Mart�
nez_Santos:
> Thanks for the advice. I've tried using ZoomPreview and it adjust to
> the drawable ratio. If i create a rectangular drawable the widget
> will be rectangular, what i want (let's see if i can be clear) is to
> adjust the width and height of the preview widget. It's adjusted to
> the drawable ratio and the i don't managed to change it.

As far as I can see, the width and height of the widget can't be adjusted
manually.  If that is what you want, I would take GimpZoomPreview as a
starting point to write a new GimpPreview class.  It probably would be just a
copy of GimpZoomPreview with an additional constructor that allows setting
the maximum width and height of the widget (which are hardcoded into
GimpZoomPreview as it is now).


  Torsten


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

signature.asc (196 bytes) Download Attachment

Re: Change size and ratio of Gimp Preview

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, 2008-04-18 at 09:57 +0200, Torsten Neuer wrote:

> As far as I can see, the width and height of the widget can't be adjusted
> manually.  If that is what you want, I would take GimpZoomPreview as a
> starting point to write a new GimpPreview class.  It probably would be just a
> copy of GimpZoomPreview with an additional constructor that allows setting
> the maximum width and height of the widget (which are hardcoded into
> GimpZoomPreview as it is now).

Hey, this is not proprietary software. You don't need to do such
terrible things. You can as well suggest changes to the widgets and
submit patches.


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: Change size and ratio of Gimp Preview

by Nicolás Serrano Martínez Santos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a design decision of the GimpPreview widget. If this doesn't fit

your needs, then you can't use GimpPreview.


In the end I used GimpPreviewArea directly (i don't see it at the documentationt at first) and if i put it inside a GtkAspectFrame i can adjust the aspect.

Thanks!!

_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer