}
Option commentOptions[] = {
-{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 250, NULL, (void*) &commentText, "", (MemoCallback *) &CommentClick, TextBox, "" },
+{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 250, NULL, (void*) &commentText, "", (char **) &CommentClick, TextBox, "" },
{ 0, 0, 50, NULL, (void*) &ClearComment, NULL, NULL, Button, N_("clear") },
{ 0, SAME_ROW, 100, NULL, (void*) &SaveChanges, NULL, NULL, Button, N_("save changes") },
{ 0, SAME_ROW, 0, NULL, (void*) &NewComCallback, "", NULL, EndMark , "" }
{ 2, COMBO_CALLBACK, 0, NULL, (void*) &PMSelect, NULL, pieceMenuStrings[0], PopUp, "menuW" },
{ 2, COMBO_CALLBACK, 0, NULL, (void*) &PMSelect, NULL, pieceMenuStrings[1], PopUp, "menuB" },
{ -1, COMBO_CALLBACK, 0, NULL, (void*) &PMSelect, NULL, dropMenuStrings, PopUp, "menuD" },
-{ 0, 0, 0, NULL, (void*) &appData.saveGameFile, ".pgn .game", NULL, FileName, N_("Save Tourney Games on:") },
-//{ 0, 0, 0, NULL, NULL, "", NULL, EndMark , "" },
{ 0, NO_OK, 0, NULL, NULL, "", NULL, EndMark , "" }
};
{
w += marginW + 1; // [HGM] not sure why the +1 is (sometimes) needed...
h += marginH;
-// gtk_window_resize(GTK_WINDOW(shellWidget), w, h);
+ gtk_window_resize(GTK_WINDOW(shellWidget), w, h);
#ifdef TODO_GTK
w += marginW + 1; // [HGM] not sure why the +1 is (sometimes) needed...
h += marginH;
GtkAllocation a;
gtk_widget_get_allocation(shells[BoardWindow], &a);
w = a.width; h = a.height;
-printf("start size (%d,%d), %dx%d\n", a.x, a.y, w, h);
+//printf("start size (%d,%d), %dx%d\n", a.x, a.y, w, h);
+ gtk_widget_get_allocation(boardWidget, &a);
+ marginW = w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board
+ marginH = h - a.height - 25; // subtract 25, because GTK seems to insert this amount of extra empty space
+ gtk_window_resize(GTK_WINDOW(shellWidget), marginW + boardWidth, marginH + boardHeight);
+//printf("margins h=%d v=%d\n", marginW, marginH);
}
- marginW = w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board
- marginH = h - boardHeight;
CreateAnyPieces();
CreateGrid();
busy = 1;
// GetActualPlacement(shellWidget, &wpNew);
-printf("drag proc (%d,%d) %dx%d\n", wpNew.x, wpNew.y, wpNew.width, wpNew.height);
+//printf("drag proc (%d,%d) %dx%d\n", wpNew.x, wpNew.y, wpNew.width, wpNew.height);
if(wpNew.x == wpMain.x && wpNew.y == wpMain.y && // not moved
wpNew.width == wpMain.width && wpNew.height == wpMain.height) { // not sized
busy = 0; return; // false alarm
void
DelayedDrag ()
{
-printf("old timr = %d\n", delayedDragTag);
+//printf("old timr = %d\n", delayedDragTag);
if(delayedDragTag) g_source_remove(delayedDragTag);
delayedDragTag = g_timeout_add( 200, (GSourceFunc) DragProc, NULL);
-printf("new timr = %d\n", delayedDragTag);
+//printf("new timr = %d\n", delayedDragTag);
}
static gboolean
EventProc (GtkWidget *widget, GdkEvent *event, gpointer g)
{
-printf("event proc (%d,%d) %dx%d\n", event->configure.x, event->configure.y, event->configure.width, event->configure.height);
+//printf("event proc (%d,%d) %dx%d\n", event->configure.x, event->configure.y, event->configure.width, event->configure.height);
// immediately
wpNew.x = event->configure.x;
wpNew.y = event->configure.y;
// to give drawing routines opportunity to use it before first expose event
// (which are only processed when main gets to the event loop, so after all init!)
// so only change when size is no longer good
-#ifdef TODO_GTK
if(graph->choice) cairo_surface_destroy((cairo_surface_t *) graph->choice);
graph->choice = (char**) cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
-#endif
break;
}
w = eevent->area.width;
if(eevent->area.x + w > graph->max) w--; // cut off fudge pixel
cr = gdk_cairo_create(((GtkWidget *) (graph->handle))->window);
cairo_set_source_surface(cr, (cairo_surface_t *) graph->choice, 0, 0);
+//cairo_set_source_rgb(cr, 1, 0, 0);
cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
cairo_rectangle(cr, eevent->area.x, eevent->area.y, w, eevent->area.height);
cairo_fill(cr);
for (i=0;option[i].type != EndMark;i++) {
if(option[i].type == -1) continue;
top++;
-printf("option =%2d, top =%2d\n", i, top);
+//printf("option =%2d, top =%2d\n", i, top);
if (top >= height) {
gtk_table_resize(GTK_TABLE(table), height, r);
if(!pane) { // multi-column: put tables in intermediate hbox
break;
case Graph:
option[i].handle = (void*) (graph = gtk_drawing_area_new());
- gtk_widget_set_size_request(graph, option[i].max, option[i].value);
- Pack(hbox, table, graph, left, left+r, top, GTK_EXPAND);
+// gtk_widget_set_size_request(graph, option[i].max, option[i].value);
+ if(0){ GtkAllocation a;
+ a.x = 0; a.y = 0; a.width = option[i].max, a.height = option[i].value;
+ gtk_widget_set_allocation(graph, &a);
+ }
g_signal_connect (graph, "expose-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
gtk_widget_add_events(GTK_WIDGET(graph), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK);
g_signal_connect (graph, "button-press-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "button-release-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "motion-notify-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
+ if(0) {
+ GtkWidget *frame = gtk_aspect_frame_new(NULL, 0, 0, 1, FALSE);
+// gtk_frame_set_shadow_type(frame, GTK_SHADOW_NONE);
+ gtk_container_add(GTK_CONTAINER(frame), graph);
+ graph = frame;
+ }
+ Pack(hbox, table, graph, left, left+r, top, GTK_EXPAND);
#ifdef TODO_GTK
if(option[i].min & SAME_ROW) last = forelast, forelast = lastrow;