mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
use board_canFlip() to prototype disabling flip button when useless.
This commit is contained in:
parent
43c34aa466
commit
e150db29ee
2 changed files with 14 additions and 0 deletions
|
@ -68,6 +68,7 @@ static void setCtrlsForTray( GtkAppGlobals* globals );
|
||||||
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
static void new_game( GtkWidget* widget, GtkAppGlobals* globals );
|
||||||
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
static void new_game_impl( GtkAppGlobals* globals, XP_Bool fireConnDlg );
|
||||||
static void setZoomButtons( GtkAppGlobals* globals, XP_Bool* inOut );
|
static void setZoomButtons( GtkAppGlobals* globals, XP_Bool* inOut );
|
||||||
|
static void disenable_buttons( GtkAppGlobals* globals );
|
||||||
|
|
||||||
|
|
||||||
#define GTK_TRAY_HT_ROWS 3
|
#define GTK_TRAY_HT_ROWS 3
|
||||||
|
@ -128,6 +129,7 @@ button_press_event( GtkWidget* XP_UNUSED(widget), GdkEventButton *event,
|
||||||
event->x, event->y, &handled );
|
event->x, event->y, &handled );
|
||||||
if ( redraw ) {
|
if ( redraw ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
disenable_buttons( globals );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -146,6 +148,7 @@ motion_notify_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
|
||||||
event->y );
|
event->y );
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
disenable_buttons( globals );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handled = XP_FALSE;
|
handled = XP_FALSE;
|
||||||
|
@ -168,6 +171,7 @@ button_release_event( GtkWidget* XP_UNUSED(widget), GdkEventMotion *event,
|
||||||
event->y );
|
event->y );
|
||||||
if ( redraw ) {
|
if ( redraw ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
disenable_buttons( globals );
|
||||||
}
|
}
|
||||||
globals->mouseDown = XP_FALSE;
|
globals->mouseDown = XP_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -988,6 +992,13 @@ makeMenus( GtkAppGlobals* globals, int XP_UNUSED(argc),
|
||||||
return menubar;
|
return menubar;
|
||||||
} /* makeMenus */
|
} /* makeMenus */
|
||||||
|
|
||||||
|
static void
|
||||||
|
disenable_buttons( GtkAppGlobals* globals )
|
||||||
|
{
|
||||||
|
XP_Bool canFlip = board_canFlip( globals->cGlobals.game.board );
|
||||||
|
gtk_widget_set_sensitive( globals->flip_button, canFlip );
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_flip_button( GtkWidget* XP_UNUSED(widget), gpointer _globals )
|
handle_flip_button( GtkWidget* XP_UNUSED(widget), gpointer _globals )
|
||||||
{
|
{
|
||||||
|
@ -1018,6 +1029,7 @@ handle_hint_button( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* globals )
|
||||||
#endif
|
#endif
|
||||||
&redo ) ) {
|
&redo ) ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
disenable_buttons( globals );
|
||||||
}
|
}
|
||||||
} /* handle_hint_button */
|
} /* handle_hint_button */
|
||||||
|
|
||||||
|
@ -1667,6 +1679,7 @@ makeVerticalBar( GtkAppGlobals* globals, GtkWidget* XP_UNUSED(window) )
|
||||||
button = makeShowButtonFromBitmap( globals, "../flip.xpm", "f",
|
button = makeShowButtonFromBitmap( globals, "../flip.xpm", "f",
|
||||||
G_CALLBACK(handle_flip_button) );
|
G_CALLBACK(handle_flip_button) );
|
||||||
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 );
|
gtk_box_pack_start( GTK_BOX(vbox), button, FALSE, TRUE, 0 );
|
||||||
|
globals->flip_button = button;
|
||||||
|
|
||||||
button = makeShowButtonFromBitmap( globals, "../value.xpm", "v",
|
button = makeShowButtonFromBitmap( globals, "../value.xpm", "v",
|
||||||
G_CALLBACK(handle_value_button) );
|
G_CALLBACK(handle_value_button) );
|
||||||
|
|
|
@ -87,6 +87,7 @@ typedef struct GtkAppGlobals {
|
||||||
/* GdkPixmap* pixmap; */
|
/* GdkPixmap* pixmap; */
|
||||||
GtkWidget* drawing_area;
|
GtkWidget* drawing_area;
|
||||||
|
|
||||||
|
GtkWidget* flip_button;
|
||||||
GtkWidget* zoomin_button;
|
GtkWidget* zoomin_button;
|
||||||
GtkWidget* zoomout_button;
|
GtkWidget* zoomout_button;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue