using the GtkAspectFrame seems to be working. The whole board is displayed now and the resizing works kind of ;)
gtk_widget_size_request(GTK_WIDGET(GUI_Buttonbar), &w);
totalh += w.height;
- ratio = (totalh+boardHeight)/(boardWidth) ;
+ ratio = ((float)totalh+boardHeight)/((float)boardWidth) ;
gtk_widget_set_size_request(GTK_WIDGET(GUI_Board),
boardWidth,boardHeight);
- GUI_SetAspectRatio(ratio);
+ gtk_aspect_frame_set (GTK_ASPECT_FRAME(GUI_Aspect),0,0,ratio,TRUE);
+
/* recreate pieces with new size... TODO: keep svg in memory and just recreate pixmap instead of reloading files */
CreatePieces();
}
<signal name="button_release_event" handler="UserMoveProc"/>
</object>
<packing>
+ <property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
}
return image;
}
-
-void GUI_SetAspectRatio(ratio)
- int ratio;
-{
- /* sets the aspect ration of the main window */
- GdkGeometry hints;
- extern GtkWidget *GUI_Window;
-
- hints.min_aspect = ratio;
- hints.max_aspect = ratio;
-
- gtk_window_set_geometry_hints (GTK_WINDOW (GUI_Window),
- GTK_WIDGET (GUI_Window),
- &hints,
- GDK_HINT_ASPECT);
- return;
-}
GtkBuilder *builder=NULL;
GtkWidget *GUI_Window=NULL;
+GtkWidget *GUI_Aspect=NULL;
GtkWidget *GUI_History=NULL;
GtkWidget *GUI_Board=NULL;
GtkWidget *GUI_Whiteclock=NULL;
GdkPixbuf *load_pixbuf(char *filename,int size);
-void GUI_SetAspectRatio(int ratio);
GUI_Window = GTK_WIDGET (gtk_builder_get_object (builder, "MainWindow"));
if(!GUI_Window) printf("Error: gtk_builder didn't work!\n");
+ GUI_Aspect = GTK_WIDGET (gtk_builder_get_object (builder, "Aspectframe"));
+ if(!GUI_Aspect) printf("Error: gtk_builder didn't work!\n");
+
GUI_History = GTK_WIDGET (gtk_builder_get_object (builder, "MoveHistory"));
if(!GUI_History) printf("Error: gtk_builder didn't work!\n");