OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
preview.c File Reference
#include <stdlib.h>
#include <gtk/gtk.h>
#include "mape/preview.h"
#include "mape/preferences.h"
Include dependency graph for preview.c:

Go to the source code of this file.

Functions

MapePreViewmape_pre_view_new (MapeMatTexView *mat_tex, GError **error)
 
void mape_pre_view_destroy (MapePreView *view)
 
void mape_pre_view_update (MapePreView *view, GdkPixbuf *pixbuf)
 
void mape_pre_view_apply_preferences (MapePreView *view, MapePreferences *preferences)
 

Function Documentation

void mape_pre_view_apply_preferences ( MapePreView view,
MapePreferences preferences 
)

Definition at line 64 of file preview.c.

References MapePreView_::image, MapePreferences_::map_height, and MapePreferences_::map_width.

Referenced by mape_window_new().

66 {
67  gtk_widget_set_size_request(view->image, preferences->map_width, preferences->map_height);
68 }
unsigned int map_width
Definition: preferences.h:32
GtkWidget * image
Definition: preview.h:31
unsigned int map_height
Definition: preferences.h:33

Here is the caller graph for this function:

void mape_pre_view_destroy ( MapePreView view)

Definition at line 47 of file preview.c.

Referenced by mape_window_destroy(), and mape_window_new().

48 {
49  free(view);
50 }

Here is the caller graph for this function:

MapePreView* mape_pre_view_new ( MapeMatTexView mat_tex,
GError **  error 
)

Definition at line 21 of file preview.c.

References MapePreView_::event_box, MapePreView_::frame, MapePreView_::image, and MapePreView_::mat_tex.

Referenced by mape_window_new().

23 {
24  MapePreView* view;
25  view = malloc(sizeof(MapePreView) );
26 
27  view->mat_tex = mat_tex;
28 
29  view->image = gtk_image_new();
30  gtk_widget_show(view->image);
31 
32  view->event_box = gtk_event_box_new();
33  gtk_container_add(GTK_CONTAINER(view->event_box), view->image);
34  gtk_widget_add_events(view->event_box, GDK_BUTTON_PRESS_MASK);
35  gtk_widget_show(view->event_box);
36 
37  view->frame = gtk_frame_new(NULL);/*"Landscape preview");*/
38  gtk_frame_set_shadow_type(GTK_FRAME(view->frame), GTK_SHADOW_IN);
39  gtk_container_add(GTK_CONTAINER(view->frame), view->event_box);
40  gtk_widget_show(view->frame);
41 
42  /*gtk_widget_set_size_request(view->image, preferences->map_width, preferences->map_height);*/
43 
44  return view;
45 }
GtkWidget * frame
Definition: preview.h:29
MapeMatTexView * mat_tex
Definition: preview.h:34
GtkWidget * image
Definition: preview.h:31
GtkWidget * event_box
Definition: preview.h:30

Here is the caller graph for this function:

void mape_pre_view_update ( MapePreView view,
GdkPixbuf *  pixbuf 
)

Definition at line 52 of file preview.c.

References MapePreView_::image.

54 {
55  /* TODO: Unref old pixbuf */
56  /* TODO: ref new pixbuf? */
57  gtk_image_set_from_pixbuf(GTK_IMAGE(view->image), pixbuf);
58 
59  /* Update size from image, in case Map.c specifies different map dimensions */
60  if(pixbuf != NULL)
61  gtk_widget_set_size_request(view->image, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
62 }
GtkWidget * image
Definition: preview.h:31