removed X-version of buttonbar
[xboard.git] / interface.c
1 #include "config.h"
2
3 #include <stdio.h>
4 #include <ctype.h>
5 #include <signal.h>
6 #include <errno.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <pwd.h>
10
11 #include <gtk/gtk.h>
12 #include <gdk-pixbuf/gdk-pixbuf.h>
13
14 #include "common.h"
15 #include "frontend.h"
16 #include "backend.h"
17 #include "moves.h"
18 #include "xboard.h"
19 #include "childio.h"
20 #include "xgamelist.h"
21 #include "xhistory.h"
22 #include "xedittags.h"
23 #include "gettext.h"
24 #include "callback.h"
25
26 #ifdef ENABLE_NLS
27 # define  _(s) gettext (s)
28 # define N_(s) gettext_noop (s)
29 #else
30 # define  _(s) (s)
31 # define N_(s)  s
32 #endif
33
34
35
36 GdkPixbuf *load_pixbuf(char *filename,int size)
37 {
38   GdkPixbuf *image;
39
40   if(size)
41     image = gdk_pixbuf_new_from_file_at_size(filename,size,size,NULL);
42   else
43     image = gdk_pixbuf_new_from_file(filename,NULL);
44   
45   if(image == NULL)
46     {
47       fprintf(stderr,_("Error: couldn't load file: %s\n"),filename);
48       exit(1);
49     }
50   return image;
51 }
52
53 void GUI_SetAspectRatio(ratio)
54      int ratio;
55 {
56   /* sets the aspect ration of the main window */
57     GdkGeometry hints;
58     extern GtkWidget *GUI_Window;
59
60     hints.min_aspect = ratio;
61     hints.max_aspect = ratio;
62     
63     gtk_window_set_geometry_hints (GTK_WINDOW (GUI_Window),
64                                    GTK_WIDGET (GUI_Window),
65                                    &hints,
66                                    GDK_HINT_ASPECT);
67     return;
68 }