[gnome-games] Don't show a preview when "Choose difficult blocks" is switched on



commit 7868fe1b2f4580877e0a746ac84adca82f1cdc4f
Author: Craig Duncan <bugzilla duncanc co uk>
Date:   Thu Aug 19 10:25:56 2010 +0100

    Don't show a preview when "Choose difficult blocks" is switched on
    
    I've added a check during the preview generation,
    and if the bastard_mode flag is on then it sets the entire preview area as empty.
    
    I've also indicated on the preferences dialog that previews are unavailable.
    
    (Minor modifications for D_SEAL by jclinton)

 quadrapassel/preview.cpp |    3 ++-
 quadrapassel/tetris.cpp  |   13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/quadrapassel/preview.cpp b/quadrapassel/preview.cpp
index c758db8..d5f9bdf 100644
--- a/quadrapassel/preview.cpp
+++ b/quadrapassel/preview.cpp
@@ -108,7 +108,8 @@ Preview::previewBlock(gint bnr, gint bcol)
 	for (x = 0; x < PREVIEW_WIDTH; x++) {
 		for (y = 0; y < PREVIEW_HEIGHT; y++) {
 			if ((blocknr != -1) &&
-			    blockTable[blocknr][rot_next][x][y]) {
+			    blockTable[blocknr][rot_next][x][y] &&
+			    !bastard_mode) {
 				blocks[x][y].emptyCell ();
 				blocks[x][y].what = LAYING;
 				blocks[x][y].createActor (piece,
diff --git a/quadrapassel/tetris.cpp b/quadrapassel/tetris.cpp
index 111568c..80d1c87 100644
--- a/quadrapassel/tetris.cpp
+++ b/quadrapassel/tetris.cpp
@@ -504,6 +504,12 @@ Tetris::setBastardMode(GtkWidget *widget, void *d)
 {
 	games_conf_set_boolean (KEY_OPTIONS_GROUP, KEY_BASTARD_MODE,
 				gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
+
+	/* Disable the preview option to indicate that it is
+		unavailable in bastard mode */
+	Tetris *t = (Tetris*) d;
+	gtk_widget_set_sensitive(t->do_preview_toggle,
+		gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ? FALSE : TRUE);
 }
 
 void
@@ -696,6 +702,13 @@ Tetris::gameProperties(GtkAction *action, void *d)
 			  G_CALLBACK (setBastardMode), d);
 	gtk_box_pack_start (GTK_BOX (fvbox), t->bastard_mode_toggle, 0, 0, 0);
 
+	/* If bastard mode is active then disable the preview option
+		to indicate that it is unavailable in bastard mode */
+	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (t->bastard_mode_toggle)))
+	{
+		gtk_widget_set_sensitive(t->do_preview_toggle, FALSE);
+	}
+
 	/* rotate counter clock wise */
  	t->rotate_counter_clock_wise_toggle =
 		gtk_check_button_new_with_mnemonic (_("_Rotate blocks counterclockwise"));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]