annotate lisp/play/bubbles.el @ 87332:4a1edf137bff

John J Foerch <jjfoerch at earthlink.net> (tiny change) (compilation-start): Don't pass a FRAME argument to display-buffer.
author Glenn Morris <rgm@gnu.org>
date Wed, 19 Dec 2007 02:54:53 +0000
parents 329f1482e2d6
children b9e8ab94c460
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1 ;;; bubbles.el --- Puzzle game for Emacs.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
2
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
3 ;; Copyright (C) 2007 Free Software Foundation, Inc.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
4
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
6 ;; URL: http://ulf.epplejasper.de/
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
7 ;; Created: 5. Feb. 2007
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
8 ;; Keywords: games
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
9
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
10 ;; This file is part of GNU Emacs.
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
11
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
14 ;; the Free Software Foundation; either version 3, or (at your option)
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
15 ;; any later version.
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
16
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
20 ;; GNU General Public License for more details.
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
21
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
25 ;; Boston, MA 02110-1301, USA.
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
26
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
27 ;;; Commentary:
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
28
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
29 ;; Bubbles is a puzzle game. Its goal is to remove as many bubbles as
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
30 ;; possible in as few moves as possible.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
31
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
32 ;; Bubbles is an implementation of the "Same Game", similar to "Same
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
33 ;; GNOME" and many others, see <http://en.wikipedia.org/wiki/SameGame>.
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
34
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
35 ;; Installation
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
36 ;; ------------
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
37
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
38 ;; Add the following lines to your Emacs startup file (`~/.emacs').
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
39 ;; (add-to-list 'load-path "/path/to/bubbles/")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
40 ;; (autoload 'bubbles "bubbles" "Play Bubbles" t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
41
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
42 ;; ======================================================================
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
43
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
44 ;;; History:
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
45
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
46 ;; 0.5 (2007-09-14)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
47 ;; - Minor bugfixes.
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
48
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
49 ;; 0.4 (2007-08-27)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
50 ;; - Allow for undoing last move.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
51 ;; - Bonus for removing all bubbles.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
52 ;; - Speed improvements.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
53 ;; - Animation enhancements.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
54 ;; - Added `bubbles-mode-hook'.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
55 ;; - Fixes: Don't move point.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
56 ;; - New URL.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
57
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
58 ;; 0.3 (2007-03-11)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
59 ;; - Renamed shift modes and thus names of score files. All
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
60 ;; highscores are lost, unless you rename the score files from
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
61 ;; bubbles-shift-... to bubbles-...!
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
62 ;; - Bugfixes: Check for successful image creation.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
63 ;; Disable menus and counter when game is over.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
64 ;; Tested with GNU Emacs 22.0.93
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
65
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
66 ;; 0.2 (2007-02-24)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
67 ;; - Introduced game themes.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
68 ;; - Introduced graphics themes (changeable while playing).
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
69 ;; - Added menu.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
70 ;; - Customization: grid size, colors, chars, shift mode.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
71 ;; - More keybindings.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
72 ;; - Changed shift direction from to-right to to-left.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
73 ;; - Bugfixes: Don't remove single-bubble regions;
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
74 ;; Animation glitches fixed.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
75 ;; Tested with GNU Emacs 22.0.93 and 21.4.1.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
76
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
77 ;; 0.1 (2007-02-11)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
78 ;; Initial release. Tested with GNU Emacs 22.0.93 and 21.4.1.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
79
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
80 ;; ======================================================================
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
81
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
82 ;;; Code:
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
83
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
84 (defconst bubbles-version "0.5" "Version number of bubbles.el.")
82922
16c56e4babd8 Comments munging; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82921
diff changeset
85
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
86 (require 'gamegrid)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
87 (require 'cl)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
88
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
89 ;; User options
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
90
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
91 ;; Careful with that axe, Eugene! Order does matter in the custom
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
92 ;; section below.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
93
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
94 (defcustom bubbles-game-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
95 'easy
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
96 "Overall game theme.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
97 The overall game theme specifies a grid size, a set of colors,
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
98 and a shift mode."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
99 :type '(radio (const :tag "Easy" easy)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
100 (const :tag "Medium" medium)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
101 (const :tag "Difficult" difficult)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
102 (const :tag "Hard" hard)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
103 (const :tag "User defined" user-defined))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
104 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
105
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
106 (defun bubbles-set-game-easy ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
107 "Set game theme to 'easy'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
108 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
109 (setq bubbles-game-theme 'easy)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
110 (bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
111
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
112 (defun bubbles-set-game-medium ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
113 "Set game theme to 'medium'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
114 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
115 (setq bubbles-game-theme 'medium)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
116 (bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
117
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
118 (defun bubbles-set-game-difficult ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
119 "Set game theme to 'difficult'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
120 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
121 (setq bubbles-game-theme 'difficult)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
122 (bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
123
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
124 (defun bubbles-set-game-hard ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
125 "Set game theme to 'hard'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
126 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
127 (setq bubbles-game-theme 'hard)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
128 (bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
129
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
130 (defun bubbles-set-game-userdefined ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
131 "Set game theme to 'user-defined'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
132 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
133 (setq bubbles-game-theme 'user-defined)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
134 (bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
135
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
136 (defgroup bubbles nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
137 "Bubbles, a puzzle game."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
138 :group 'games)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
139
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
140 (defcustom bubbles-graphics-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
141 'circles
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
142 "Graphics theme.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
143 It is safe to choose a graphical theme. If Emacs cannot display
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
144 images the `ascii' theme will be used."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
145 :type '(radio (const :tag "Circles" circles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
146 (const :tag "Squares" squares)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
147 (const :tag "Diamonds" diamonds)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
148 (const :tag "Balls" balls)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
149 (const :tag "Emacs" emacs)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
150 (const :tag "ASCII (no images)" ascii))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
151 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
152
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
153 (defconst bubbles--grid-small '(10 . 10)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
154 "Predefined small bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
155
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
156 (defconst bubbles--grid-medium '(15 . 10)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
157 "Predefined medium bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
158
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
159 (defconst bubbles--grid-large '(20 . 15)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
160 "Predefined large bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
161
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
162 (defconst bubbles--grid-huge '(30 . 20)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
163 "Predefined huge bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
164
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
165 (defcustom bubbles-grid-size
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
166 bubbles--grid-medium
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
167 "Size of bubbles grid."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
168 :type `(radio (const :tag "Small" ,bubbles--grid-small)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
169 (const :tag "Medium" ,bubbles--grid-medium)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
170 (const :tag "Large" ,bubbles--grid-large)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
171 (const :tag "Huge" ,bubbles--grid-huge)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
172 (cons :tag "User defined"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
173 (integer :tag "Width")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
174 (integer :tag "Height")))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
175 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
176
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
177 (defconst bubbles--colors-2 '("orange" "violet")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
178 "Predefined bubbles color list with two colors.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
179
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
180 (defconst bubbles--colors-3 '("lightblue" "palegreen" "pink")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
181 "Predefined bubbles color list with three colors.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
182
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
183 (defconst bubbles--colors-4 '("firebrick" "sea green" "steel blue" "chocolate")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
184 "Predefined bubbles color list with four colors.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
185
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
186 (defconst bubbles--colors-5 '("firebrick" "sea green" "steel blue"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
187 "sandy brown" "bisque3")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
188 "Predefined bubbles color list with five colors.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
189
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
190 (defcustom bubbles-colors
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
191 bubbles--colors-3
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
192 "List of bubble colors.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
193 The length of this list determines how many different bubble
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
194 types are present."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
195 :type `(radio (const :tag "Red, darkgreen" ,bubbles--colors-2)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
196 (const :tag "Red, darkgreen, blue" ,bubbles--colors-3)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
197 (const :tag "Red, darkgreen, blue, orange" ,bubbles--colors-4)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
198 (const :tag "Red, darkgreen, blue, orange, violet"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
199 ,bubbles--colors-5)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
200 (repeat :tag "User defined" color))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
201 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
202
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
203 (defcustom bubbles-chars
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
204 '(?+ ?O ?# ?X ?. ?* ?& ?§)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
205 "Characters used for bubbles.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
206 Note that the actual number of different bubbles is determined by
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
207 the number of colors, see `bubbles-colors'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
208 :type '(repeat character)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
209 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
210
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
211 (defcustom bubbles-shift-mode
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
212 'default
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
213 "Shift mode.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
214 Available modes are `shift-default' and`shift-always'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
215 :type '(radio (const :tag "Default" default)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
216 (const :tag "Shifter" always)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
217 ;;(const :tag "Mega Shifter" 'mega)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
218 )
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
219 :group 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
220
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
221 (defcustom bubbles-mode-hook nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
222 "Hook run by Bubbles mode."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
223 :group 'bubbles
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
224 :type 'hook)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
225
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
226 (defun bubbles-customize ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
227 "Open customization buffer for bubbles."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
228 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
229 (customize-group 'bubbles))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
230
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
231 ;; ======================================================================
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
232 ;; internal variables
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
233
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
234 (defvar bubbles--score 0
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
235 "Current Bubbles score.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
236
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
237 (defvar bubbles--neighbourhood-score 0
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
238 "Score of active bubbles neighbourhood.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
239
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
240 (defvar bubbles--faces nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
241 "List of currently used faces.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
242
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
243 (defvar bubbles--playing nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
244 "Play status indicator.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
245
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
246 (defvar bubbles--empty-image nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
247 "Image used for removed bubbles (empty grid cells).")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
248
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
249 (defvar bubbles--images nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
250 "List of images for bubbles.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
251
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
252 (defvar bubbles--images-ok nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
253 "Indicate whether images have been created successfully.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
254
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
255 (defvar bubbles--col-offset 0
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
256 "Horizontal offset for centering the bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
257
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
258 (defvar bubbles--row-offset 0
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
259 "Vertical offset for centering the bubbles grid.")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
260
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
261 (defvar bubbles--save-data nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
262 "List containing bubbles save data (SCORE BUFFERCONTENTS).")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
263
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
264 (defconst bubbles--image-template-circle
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
265 "/* XPM */
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
266 static char * dot_xpm[] = {
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
267 \"20 20 2 1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
268 \" c None\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
269 \". c #FFFFFF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
270 \" ...... \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
271 \" .......... \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
272 \" .............. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
273 \" ................ \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
274 \" ................ \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
275 \" .................. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
276 \" .................. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
277 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
278 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
279 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
280 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
281 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
282 \"....................\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
283 \" .................. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
284 \" .................. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
285 \" ................ \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
286 \" ................ \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
287 \" .............. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
288 \" .......... \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
289 \" ...... \"};")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
290
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
291 (defconst bubbles--image-template-square
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
292 "/* XPM */
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
293 static char * dot_xpm[] = {
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
294 \"20 20 2 1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
295 \"0 c None\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
296 \"1 c #FFFFFF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
297 \"00000000000000000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
298 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
299 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
300 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
301 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
302 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
303 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
304 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
305 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
306 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
307 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
308 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
309 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
310 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
311 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
312 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
313 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
314 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
315 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
316 \"00000000000000000000\"};")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
317
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
318 (defconst bubbles--image-template-diamond
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
319 "/* XPM */
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
320 static char * dot_xpm[] = {
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
321 \"20 20 2 1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
322 \"0 c None\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
323 \"1 c #FFFFFF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
324 \"00000000011000000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
325 \"00000000111100000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
326 \"00000001111110000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
327 \"00000011111111000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
328 \"00000111111111100000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
329 \"00001111111111110000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
330 \"00011111111111111000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
331 \"00111111111111111100\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
332 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
333 \"11111111111111111111\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
334 \"01111111111111111110\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
335 \"00111111111111111100\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
336 \"00011111111111111000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
337 \"00001111111111110000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
338 \"00000111111111100000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
339 \"00000011111111000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
340 \"00000001111110000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
341 \"00000000111100000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
342 \"00000000011000000000\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
343 \"00000000000000000000\"};")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
344
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
345 (defconst bubbles--image-template-emacs
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
346 "/* XPM */
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
347 static char * emacs_24_xpm[] = {
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
348 \"24 24 129 2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
349 \" c None\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
350 \". c #837DA4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
351 \"+ c #807AA0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
352 \"@ c #9894B2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
353 \"# c #CCCAD9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
354 \"$ c #C2C0D2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
355 \"% c #B6B3C9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
356 \"& c #A19DB9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
357 \"* c #8681A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
358 \"= c #7D779B\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
359 \"- c #B6B3C7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
360 \"; c #ABA7BE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
361 \"> c #9792AF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
362 \", c #AAA6BD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
363 \"' c #CBC9D7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
364 \") c #AAA7BE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
365 \"! c #908BAA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
366 \"~ c #797397\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
367 \"{ c #948FAC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
368 \"] c #9A95B1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
369 \"^ c #EBEAEF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
370 \"/ c #F1F1F5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
371 \"( c #BCB9CB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
372 \"_ c #A9A5BD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
373 \": c #757093\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
374 \"< c #918DA9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
375 \"[ c #DDDBE4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
376 \"} c #FFFFFF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
377 \"| c #EAE9EF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
378 \"1 c #A7A4BA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
379 \"2 c #716C8F\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
380 \"3 c #8D89A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
381 \"4 c #9C98B1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
382 \"5 c #DBDAE3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
383 \"6 c #A4A1B7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
384 \"7 c #6E698A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
385 \"8 c #8B87A1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
386 \"9 c #928EA7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
387 \"0 c #C5C3D1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
388 \"a c #F8F8F9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
389 \"b c #CCCAD6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
390 \"c c #A29FB4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
391 \"d c #6A6585\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
392 \"e c #88849D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
393 \"f c #B5B2C2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
394 \"g c #F0F0F3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
395 \"h c #E1E0E6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
396 \"i c #A5A2B5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
397 \"j c #A09DB1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
398 \"k c #676281\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
399 \"l c #85819A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
400 \"m c #9591A7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
401 \"n c #E1E0E5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
402 \"o c #F0EFF2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
403 \"p c #B3B0C0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
404 \"q c #9D9AAE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
405 \"r c #635F7C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
406 \"s c #827F96\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
407 \"t c #9997AA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
408 \"u c #F7F7F9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
409 \"v c #C8C7D1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
410 \"w c #89869D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
411 \"x c #9B99AB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
412 \"y c #5F5B78\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
413 \"z c #7F7C93\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
414 \"A c #CFCDD6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
415 \"B c #B7B5C2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
416 \"C c #9996A9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
417 \"D c #5C5873\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
418 \"E c #7A778D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
419 \"F c #F5F5F6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
420 \"G c #8E8C9E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
421 \"H c #7D798F\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
422 \"I c #58546F\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
423 \"J c #6C6981\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
424 \"K c #D5D4DB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
425 \"L c #F5F4F6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
426 \"M c #9794A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
427 \"N c #625F78\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
428 \"O c #79768C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
429 \"P c #55516A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
430 \"Q c #605C73\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
431 \"R c #CAC9D1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
432 \"S c #EAE9EC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
433 \"T c #B4B3BE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
434 \"U c #777488\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
435 \"V c #514E66\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
436 \"W c #DEDEE2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
437 \"X c #F4F4F5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
438 \"Y c #9D9BA9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
439 \"Z c #747185\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
440 \"` c #4E4B62\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
441 \" . c #DEDDE1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
442 \".. c #A6A5B0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
443 \"+. c #716F81\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
444 \"@. c #4A475D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
445 \"#. c #A4A3AE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
446 \"$. c #F4F3F5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
447 \"%. c #777586\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
448 \"&. c #6E6C7D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
449 \"*. c #464358\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
450 \"=. c #514E62\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
451 \"-. c #B9B8C0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
452 \";. c #D1D0D5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
453 \">. c #747282\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
454 \",. c #6B6979\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
455 \"'. c #434054\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
456 \"). c #5A5769\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
457 \"!. c #D0CFD4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
458 \"~. c #5B5869\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
459 \"{. c #696676\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
460 \"]. c #403D50\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
461 \"^. c #DBDADE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
462 \"/. c #F3F3F4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
463 \"(. c #646271\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
464 \"_. c #666473\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
465 \":. c #3D3A4C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
466 \"<. c #555362\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
467 \"[. c #9E9DA6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
468 \"}. c #9E9CA5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
469 \"|. c #646170\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
470 \"1. c #393647\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
471 \"2. c #514E5D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
472 \"3. c #83818C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
473 \"4. c #A8A7AE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
474 \"5. c #E6E6E8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
475 \"6. c #DAD9DC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
476 \"7. c #353343\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
477 \"8. c #32303E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
478 \" . . . . . . . . . . . . . . . . . . \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
479 \" + @ # $ % % % % % % % % % % % % % % & * + + \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
480 \" = - ; > > > > > > > > , ' ) > > > > > > ! = \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
481 \"~ ~ { { { { { { { { { { { ] ^ / ( { { { { _ ~ ~ \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
482 \": : < < < < < < < < < < < < [ } } | < < < 1 : : \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
483 \"2 2 3 3 3 3 3 3 3 3 3 3 4 5 } } } 5 3 3 3 6 2 2 \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
484 \"7 7 8 8 8 8 8 8 8 8 9 0 a } } } b 8 8 8 8 c 7 7 \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
485 \"d d e e e e e e e f g } } } h i e e e e e j d d \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
486 \"k k l l l l l m n } } } o p l l l l l l l q k k \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
487 \"r r s s s s t u } } } v w s s s s s s s s x r r \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
488 \"y y z z z z A } } } B z z z z z z z z z z C y y \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
489 \"D D D D D D E F } } G D D D D D D D D D D H D D \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
490 \"I I I I I I I J K } L M N I I I I I I I I O I I \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
491 \"P P P P P P Q R } } } S T P P P P P P P P U P P \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
492 \"V V V V V V W } } X Y V V V V V V V V V V Z V V \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
493 \"` ` ` ` ` ` .} } ..` ` ` ` ` ` ` ` ` ` ` +.` ` \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
494 \"@.@.@.@.@.@.@.#.$.$.%.@.@.@.@.@.@.@.@.@.@.&.@.@.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
495 \"*.*.*.*.*.*.*.*.=.-.} ;.>.*.*.*.*.*.*.*.*.,.*.*.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
496 \"'.'.'.'.'.'.'.'.'.'.).!.} !.~.'.'.'.'.'.'.{.'.'.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
497 \"].].].].].].].].].].].].^.} /.(.].].].].]._.].].\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
498 \":.:.:.:.:.:.:.:.:.:.<.[./.} } }.:.:.:.:.:.|.:.:.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
499 \" 1.1.1.1.1.1.1.1.2.3.4.5.6.3.1.1.1.1.1.1.1.1. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
500 \" 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
501 \" 8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8. \"};")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
502
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
503 (defconst bubbles--image-template-ball
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
504 "/* XPM */
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
505 static char * dot3d_xpm[] = {
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
506 \"20 20 190 2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
507 \" c None\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
508 \". c #F9F6F6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
509 \"+ c #D6D0D0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
510 \"@ c #BFBBBB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
511 \"# c #AAA4A4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
512 \"$ c #ABAAAB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
513 \"% c #A8A8A8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
514 \"& c #A29D9D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
515 \"* c #B5B2B2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
516 \"= c #CDC9C9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
517 \"- c #D7D0D0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
518 \"; c #B3AFAF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
519 \"> c #B5B5B5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
520 \", c #B7B7B7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
521 \"' c #B8B8B8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
522 \") c #B6B6B6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
523 \"! c #B3B3B3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
524 \"~ c #AFAFAF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
525 \"{ c #A9A9A9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
526 \"] c #A2A2A2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
527 \"^ c #9C9A9A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
528 \"/ c #C9C5C5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
529 \"( c #FDFBFB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
530 \"_ c #C3BCBC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
531 \": c #BBBBBB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
532 \"< c #C0C0C0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
533 \"[ c #C3C2C2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
534 \"} c #C3C3C3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
535 \"| c #C2C2C2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
536 \"1 c #BEBEBE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
537 \"2 c #B9B9B9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
538 \"3 c #B2B2B2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
539 \"4 c #ABAAAA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
540 \"5 c #999999\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
541 \"6 c #ACA7A7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
542 \"7 c #C2BBBB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
543 \"8 c #C5C5C5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
544 \"9 c #CACBCB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
545 \"0 c #CECECE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
546 \"a c #CFCFCF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
547 \"b c #CDCDCD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
548 \"c c #C8C9C9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
549 \"d c #9F9F9F\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
550 \"e c #959595\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
551 \"f c #A9A5A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
552 \"g c #D5CFCE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
553 \"h c #BDBDBD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
554 \"i c #C6C6C6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
555 \"j c #D5D5D5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
556 \"k c #D9D9D9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
557 \"l c #DADADA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
558 \"m c #D8D8D8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
559 \"n c #D2D2D2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
560 \"o c #CBCBCB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
561 \"p c #A4A4A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
562 \"q c #9A9A9A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
563 \"r c #8F8F8F\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
564 \"s c #C3BFBF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
565 \"t c #AFACAB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
566 \"u c #CCCCCC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
567 \"v c #D6D6D6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
568 \"w c #DEDEDE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
569 \"x c #E4E4E4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
570 \"y c #E5E5E5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
571 \"z c #E2E2E2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
572 \"A c #DBDBDB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
573 \"B c #C9C8C8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
574 \"C c #A8A9A8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
575 \"D c #9D9E9D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
576 \"E c #929292\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
577 \"F c #8A8888\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
578 \"G c #D3CECE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
579 \"H c #B0B0B0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
580 \"I c #D1D1D1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
581 \"J c #DCDCDC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
582 \"K c #E6E6E6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
583 \"L c #EEEEEE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
584 \"M c #F1F1F0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
585 \"N c #EBEBEB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
586 \"O c #D7D7D8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
587 \"P c #ABABAB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
588 \"Q c #A0A0A0\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
589 \"R c #949494\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
590 \"S c #898989\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
591 \"T c #C0BDBD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
592 \"U c #B9B6B6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
593 \"V c #B1B1B1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
594 \"W c #BCBCBC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
595 \"X c #C8C8C8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
596 \"Y c #D3D3D3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
597 \"Z c #DFDFDE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
598 \"` c #EAEAEA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
599 \" . c #F5F5F5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
600 \".. c #FAFAFA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
601 \"+. c #F1F1F1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
602 \"@. c #CECFCF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
603 \"#. c #ACACAC\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
604 \"$. c #A1A1A1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
605 \"%. c #8A8A8A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
606 \"&. c #9B9999\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
607 \"*. c #C7C7C7\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
608 \"=. c #DDDDDD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
609 \"-. c #E8E8E8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
610 \";. c #F2F2F2\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
611 \">. c #898A89\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
612 \",. c #7A7878\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
613 \"'. c #AEAEAE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
614 \"). c #C4C4C4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
615 \"!. c #CBCBCA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
616 \"~. c #AAAAAA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
617 \"{. c #939393\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
618 \"]. c #888888\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
619 \"^. c #7C7C7C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
620 \"/. c #AAAAAB\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
621 \"(. c #BFBFBF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
622 \"_. c #C9C9C9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
623 \":. c #DFDEDF\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
624 \"<. c #A6A6A6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
625 \"[. c #9B9B9B\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
626 \"}. c #909191\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
627 \"|. c #858586\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
628 \"1. c #797979\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
629 \"2. c #989494\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
630 \"3. c #A5A6A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
631 \"4. c #B9B9B8\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
632 \"5. c #C1C1C1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
633 \"6. c #CFCFCE\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
634 \"7. c #979797\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
635 \"8. c #8D8D8D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
636 \"9. c #828282\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
637 \"0. c #747171\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
638 \"a. c #ADAAAA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
639 \"b. c #A9A8A9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
640 \"c. c #B8B9B9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
641 \"d. c #A5A5A5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
642 \"e. c #9C9C9C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
643 \"f. c #7E7E7D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
644 \"g. c #929191\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
645 \"h. c #C9C4C4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
646 \"i. c #989898\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
647 \"j. c #ADADAD\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
648 \"k. c #9D9D9D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
649 \"l. c #8C8C8C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
650 \"m. c #787878\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
651 \"n. c #B8B6B6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
652 \"o. c #939191\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
653 \"p. c #A5A5A6\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
654 \"q. c #ABABAA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
655 \"r. c #A8A8A9\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
656 \"s. c #A3A3A3\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
657 \"t. c #858585\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
658 \"u. c #757474\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
659 \"v. c #C5C1C1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
660 \"w. c #969696\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
661 \"x. c #9B9B9C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
662 \"y. c #A4A4A4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
663 \"z. c #9E9E9E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
664 \"A. c #939394\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
665 \"B. c #7D7D7D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
666 \"C. c #747474\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
667 \"D. c #B7B5B5\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
668 \"E. c #A5A1A1\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
669 \"F. c #919191\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
670 \"G. c #9A9999\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
671 \"H. c #838383\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
672 \"I. c #757575\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
673 \"J. c #939090\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
674 \"K. c #A29E9E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
675 \"L. c #868686\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
676 \"M. c #8D8D8C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
677 \"N. c #8E8E8E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
678 \"O. c #8D8D8E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
679 \"P. c #8B8C8C\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
680 \"Q. c #848485\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
681 \"R. c #7F7F80\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
682 \"S. c #7A7A7A\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
683 \"T. c #737373\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
684 \"U. c #929090\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
685 \"V. c #828080\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
686 \"W. c #818181\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
687 \"X. c #808080\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
688 \"Y. c #7E7E7E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
689 \"Z. c #737272\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
690 \"`. c #B7B4B4\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
691 \" + c #BCBABA\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
692 \".+ c #959494\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
693 \"++ c #747172\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
694 \"@+ c #767676\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
695 \"#+ c #6F6D6D\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
696 \"$+ c #8F8E8E\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
697 \" . + @ # $ % & * = . \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
698 \" - ; > , ' ) ! ~ { ] ^ / \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
699 \" ( _ > : < [ } | 1 2 3 4 ] 5 6 ( \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
700 \" 7 ) 1 8 9 0 a b c | : 3 { d e f \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
701 \" g ! h i 0 j k l m n o | 2 ~ p q r s \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
702 \". t ' | u v w x y z A n B 1 ! C D E F . \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
703 \"G H : i I J K L M N z O b | ) P Q R S T \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
704 \"U V W X Y Z ` ...+.y l @.} ' #.$.e %.&.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
705 \"& H W *.n =.-.;. .L x k 0 [ , #.Q e >.,.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
706 \"] '.2 ).a k z -.` K w j !.< > ~.d {.].^.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
707 \"d /.> (._.I k =.:.J v 0 8 : V <.[.}.|.1.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
708 \"2.3.~ 4.5._.6.n Y I u i 1 > P $.7.8.9.0.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
709 \"a.d b.V c.(.).*.X i | h ) '.d.e.E ].f.g.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
710 \"h.i.$.C ~ > 2 W W : ' ! j.d.k.e l.9.m.n.\",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
711 \". o.i.d p.q.'.H V H j.r.s.k.e 8.t.^.u.. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
712 \" v.r w.x.Q s.d.d.y.] z.5 A.8.t.B.C.D. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
713 \" E.l.F.e i.G.q 5 7.{.r %.H.^.I.J. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
714 \" ( K.L.%.M.N.N.O.P.S Q.R.S.T.U.( \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
715 \" @ V.W.H.H.9.X.Y.S.I.Z.`. \",
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
716 \" . +.+++@+C.#+$+D.. \"};")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
717
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
718 ;; ======================================================================
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
719 ;; Functions
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
720
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
721 (defsubst bubbles--grid-width ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
722 "Return the grid width for the current game theme."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
723 (car (case bubbles-game-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
724 ('easy
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
725 bubbles--grid-small)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
726 ('medium
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
727 bubbles--grid-medium)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
728 ('difficult
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
729 bubbles--grid-large)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
730 ('hard
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
731 bubbles--grid-huge)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
732 ('user-defined
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
733 bubbles-grid-size))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
734
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
735 (defsubst bubbles--grid-height ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
736 "Return the grid height for the current game theme."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
737 (cdr (case bubbles-game-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
738 ('easy
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
739 bubbles--grid-small)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
740 ('medium
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
741 bubbles--grid-medium)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
742 ('difficult
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
743 bubbles--grid-large)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
744 ('hard
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
745 bubbles--grid-huge)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
746 ('user-defined
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
747 bubbles-grid-size))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
748
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
749 (defsubst bubbles--colors ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
750 "Return the color list for the current game theme."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
751 (case bubbles-game-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
752 ('easy
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
753 bubbles--colors-2)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
754 ('medium
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
755 bubbles--colors-3)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
756 ('difficult
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
757 bubbles--colors-4)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
758 ('hard
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
759 bubbles--colors-5)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
760 ('user-defined
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
761 bubbles-colors)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
762
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
763 (defsubst bubbles--shift-mode ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
764 "Return the shift mode for the current game theme."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
765 (case bubbles-game-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
766 ('easy
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
767 'default)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
768 ('medium
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
769 'default)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
770 ('difficult
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
771 'always)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
772 ('hard
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
773 'always)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
774 ('user-defined
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
775 bubbles-shift-mode)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
776
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
777 (defun bubbles-save-settings ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
778 "Save current customization settings."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
779 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
780 (custom-set-variables
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
781 (list 'bubbles-game-theme `(quote ,bubbles-game-theme) t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
782 (list 'bubbles-graphics-theme `(quote ,bubbles-graphics-theme) t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
783 (customize-save-customized))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
784
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
785 (defsubst bubbles--empty-char ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
786 "The character used for removed bubbles (empty grid cells)."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
787 ? )
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
788
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
789 (defun bubbles-set-graphics-theme-ascii ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
790 "Set graphics theme to `ascii'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
791 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
792 (setq bubbles-graphics-theme 'ascii)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
793 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
794
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
795 (defun bubbles-set-graphics-theme-circles ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
796 "Set graphics theme to `circles'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
797 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
798 (setq bubbles-graphics-theme 'circles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
799 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
800 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
801
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
802 (defun bubbles-set-graphics-theme-squares ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
803 "Set graphics theme to `squares'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
804 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
805 (setq bubbles-graphics-theme 'squares)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
806 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
807 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
808
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
809 (defun bubbles-set-graphics-theme-diamonds ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
810 "Set graphics theme to `diamonds'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
811 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
812 (setq bubbles-graphics-theme 'diamonds)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
813 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
814 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
815
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
816 (defun bubbles-set-graphics-theme-balls ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
817 "Set graphics theme to `balls'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
818 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
819 (setq bubbles-graphics-theme 'balls)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
820 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
821 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
822
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
823 (defun bubbles-set-graphics-theme-emacs ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
824 "Set graphics theme to `emacs'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
825 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
826 (setq bubbles-graphics-theme 'emacs)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
827 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
828 (bubbles--update-faces-or-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
829
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
830 ;; game theme menu
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
831 (defvar bubbles-game-theme-menu
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
832 (let ((menu (make-sparse-keymap "Game Theme")))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
833 (define-key menu [bubbles-set-game-userdefined]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
834 (list 'menu-item "User defined" 'bubbles-set-game-userdefined
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
835 :button '(:radio . (eq bubbles-game-theme 'user-defined))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
836 (define-key menu [bubbles-set-game-hard]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
837 (list 'menu-item "Hard" 'bubbles-set-game-hard
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
838 :button '(:radio . (eq bubbles-game-theme 'hard))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
839 (define-key menu [bubbles-set-game-difficult]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
840 (list 'menu-item "Difficult" 'bubbles-set-game-difficult
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
841 :button '(:radio . (eq bubbles-game-theme 'difficult))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
842 (define-key menu [bubbles-set-game-medium]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
843 (list 'menu-item "Medium" 'bubbles-set-game-medium
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
844 :button '(:radio . (eq bubbles-game-theme 'medium))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
845 (define-key menu [bubbles-set-game-easy]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
846 (list 'menu-item "Easy" 'bubbles-set-game-easy
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
847 :button '(:radio . (eq bubbles-game-theme 'easy))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
848 menu)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
849 "Map for bubbles game theme menu.")
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
850
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
851 ;; graphics theme menu
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
852 (defvar bubbles-graphics-theme-menu
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
853 (let ((menu (make-sparse-keymap "Graphics Theme")))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
854 (define-key menu [bubbles-set-graphics-theme-ascii]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
855 (list 'menu-item "ASCII" 'bubbles-set-graphics-theme-ascii
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
856 :button '(:radio . (eq bubbles-graphics-theme 'ascii))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
857 (define-key menu [bubbles-set-graphics-theme-emacs]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
858 (list 'menu-item "Emacs" 'bubbles-set-graphics-theme-emacs
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
859 :button '(:radio . (eq bubbles-graphics-theme 'emacs))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
860 (define-key menu [bubbles-set-graphics-theme-balls]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
861 (list 'menu-item "Balls" 'bubbles-set-graphics-theme-balls
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
862 :button '(:radio . (eq bubbles-graphics-theme 'balls))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
863 (define-key menu [bubbles-set-graphics-theme-diamonds]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
864 (list 'menu-item "Diamonds" 'bubbles-set-graphics-theme-diamonds
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
865 :button '(:radio . (eq bubbles-graphics-theme 'diamonds))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
866 (define-key menu [bubbles-set-graphics-theme-squares]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
867 (list 'menu-item "Squares" 'bubbles-set-graphics-theme-squares
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
868 :button '(:radio . (eq bubbles-graphics-theme 'squares))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
869 (define-key menu [bubbles-set-graphics-theme-circles]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
870 (list 'menu-item "Circles" 'bubbles-set-graphics-theme-circles
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
871 :button '(:radio . (eq bubbles-graphics-theme 'circles))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
872 menu)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
873 "Map for bubbles graphics theme menu.")
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
874
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
875 ;; menu
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
876 (defvar bubbles-menu
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
877 (let ((menu (make-sparse-keymap "Bubbles")))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
878 (define-key menu [bubbles-quit]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
879 (list 'menu-item "Quit" 'bubbles-quit))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
880 (define-key menu [bubbles]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
881 (list 'menu-item "New game" 'bubbles))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
882 (define-key menu [bubbles-separator-1]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
883 '("--"))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
884 (define-key menu [bubbles-save-settings]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
885 (list 'menu-item "Save all settings" 'bubbles-save-settings))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
886 (define-key menu [bubbles-customize]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
887 (list 'menu-item "Edit all settings" 'bubbles-customize))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
888 (define-key menu [bubbles-game-theme-menu]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
889 (list 'menu-item "Game Theme" bubbles-game-theme-menu))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
890 (define-key menu [bubbles-graphics-theme-menu]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
891 (list 'menu-item "Graphics Theme" bubbles-graphics-theme-menu
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
892 :enable 'bubbles--playing))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
893 (define-key menu [bubbles-separator-2]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
894 '("--"))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
895 (define-key menu [bubbles-undo]
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
896 (list 'menu-item "Undo last move" 'bubbles-undo
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
897 :enable '(and bubbles--playing (listp buffer-undo-list))))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
898 menu)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
899 "Map for bubbles menu.")
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
900
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
901 ;; bubbles mode map
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
902 (defvar bubbles-mode-map
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
903 (let ((map (make-sparse-keymap 'bubbles-mode-map)))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
904 ;; (suppress-keymap map t)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
905 (define-key map "q" 'bubbles-quit)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
906 (define-key map "\n" 'bubbles-plop)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
907 (define-key map " " 'bubbles-plop)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
908 (define-key map [double-down-mouse-1] 'bubbles-plop)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
909 (define-key map [mouse-2] 'bubbles-plop)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
910 (define-key map "\C-m" 'bubbles-plop)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
911 (define-key map "u" 'bubbles-undo)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
912 (define-key map "p" 'previous-line)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
913 (define-key map "n" 'next-line)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
914 (define-key map "f" 'forward-char)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
915 (define-key map "b" 'backward-char)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
916 ;; bind menu to mouse
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
917 (define-key map [down-mouse-3] bubbles-menu)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
918 ;; Put menu in menu-bar
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
919 (define-key map [menu-bar Bubbles] (cons "Bubbles" bubbles-menu))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
920 map)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
921 "Mode map for bubbles.")
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
922
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
923 (defun bubbles-mode ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
924 "Major mode for playing bubbles.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
925 \\{bubbles-mode-map}"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
926 (kill-all-local-variables)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
927 (use-local-map bubbles-mode-map)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
928 (setq major-mode 'bubbles-mode)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
929 (setq mode-name "Bubbles")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
930 (setq buffer-read-only t)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
931 (buffer-disable-undo)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
932 (setq buffer-undo-list t)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
933 (force-mode-line-update)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
934 (redisplay)
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
935 (add-hook 'post-command-hook 'bubbles--mark-neighbourhood t t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
936 (run-hooks 'bubbles-mode-hook))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
937
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
938 ;;;###autoload
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
939 (defun bubbles ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
940 "Play Bubbles game."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
941 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
942 (switch-to-buffer (get-buffer-create "*bubbles*"))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
943 (when (or (not bubbles--playing)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
944 (y-or-n-p "Start new game? "))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
945 (setq bubbles--save-data nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
946 (setq bubbles--playing t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
947 (bubbles--initialize)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
948
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
949 (defun bubbles-quit ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
950 "Quit Bubbles."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
951 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
952 (message "bubbles-quit")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
953 (bury-buffer))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
954
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
955 (defun bubbles--compute-offsets ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
956 "Update horizontal and vertical offsets for centering the bubbles grid.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
957 Set `bubbles--col-offset' and `bubbles--row-offset'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
958 (cond ((and (display-images-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
959 bubbles--images-ok
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
960 (not (eq bubbles-graphics-theme 'ascii))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
961 (fboundp 'window-inside-pixel-edges))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
962 ;; compute offset in units of pixels
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
963 (let ((bubbles--image-size
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
964 (car (image-size (car bubbles--images) t))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
965 (setq bubbles--col-offset
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
966 (list
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
967 (max 0 (/ (- (nth 2 (window-inside-pixel-edges))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
968 (nth 0 (window-inside-pixel-edges))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
969 (* ( + bubbles--image-size 2) ;; margin
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
970 (bubbles--grid-width))) 2))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
971 (setq bubbles--row-offset
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
972 (list
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
973 (max 0 (/ (- (nth 3 (window-inside-pixel-edges))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
974 (nth 1 (window-inside-pixel-edges))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
975 (* (+ bubbles--image-size 1) ;; margin
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
976 (bubbles--grid-height))) 2))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
977 (t
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
978 ;; compute offset in units of chars
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
979 (setq bubbles--col-offset
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
980 (max 0 (/ (- (window-width)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
981 (bubbles--grid-width)) 2)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
982 (setq bubbles--row-offset
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
983 (max 0 (/ (- (window-height)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
984 (bubbles--grid-height) 2) 2))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
985
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
986 (defun bubbles--remove-overlays ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
987 "Remove all overlays."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
988 (if (fboundp 'remove-overlays)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
989 (remove-overlays)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
990
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
991 (defun bubbles--initialize ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
992 "Initialize Bubbles game."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
993 (bubbles--initialize-faces)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
994 (bubbles--initialize-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
995 (bubbles--remove-overlays)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
996
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
997 (switch-to-buffer (get-buffer-create "*bubbles*"))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
998 (bubbles--compute-offsets)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
999 (let ((inhibit-read-only t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1000 (set-buffer-modified-p nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1001 (erase-buffer)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1002 (insert " ")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1003 (add-text-properties
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1004 (point-min) (point) (list 'intangible t 'display
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1005 (cons 'space
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1006 (list :height bubbles--row-offset))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1007 (insert "\n")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1008 (let ((max-char (length (bubbles--colors))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1009 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1010 (let ((p (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1011 (insert " ")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1012 (add-text-properties
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1013 p (point) (list 'intangible t
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1014 'display (cons 'space
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1015 (list :width
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1016 bubbles--col-offset)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1017 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1018 (let* ((index (random max-char))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1019 (char (nth index bubbles-chars)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1020 (insert char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1021 (add-text-properties (1- (point)) (point) (list 'index index))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1022 (insert "\n"))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1023 (insert "\n ")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1024 (add-text-properties
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1025 (1- (point)) (point) (list 'intangible t 'display
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1026 (cons 'space
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1027 (list :width bubbles--col-offset)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1028 (put-text-property (point-min) (point-max) 'pointer 'arrow))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1029 (bubbles-mode)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1030 (bubbles--reset-score)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1031 (bubbles--update-faces-or-images)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1032 (bubbles--goto 0 0)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1033 (setq buffer-undo-list t)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1034 (force-mode-line-update)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1035 (redisplay))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1036
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1037 (defun bubbles--initialize-faces ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1038 "Prepare faces for playing `bubbles'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1039 (copy-face 'default 'bubbles--highlight-face)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1040 (set-face-background 'bubbles--highlight-face "#8080f4")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1041 (when (display-color-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1042 (setq bubbles--faces
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1043 (mapcar (lambda (color)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1044 (let ((fname (intern (format "bubbles--face-%s" color))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1045 (unless (facep fname)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1046 (copy-face 'default fname)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1047 (set-face-foreground fname color))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1048 fname))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1049 (bubbles--colors)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1050
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1051 (defsubst bubbles--row (pos)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1052 "Return row of point POS."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1053 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1054 (goto-char pos)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1055 (beginning-of-line)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1056 (1- (count-lines (point-min) (point)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1057
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1058 (defsubst bubbles--col (pos)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1059 "Return column of point POS."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1060 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1061 (goto-char pos)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1062 (1- (current-column))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1063
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1064 (defun bubbles--goto (row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1065 "Move point to bubble at coordinates ROW and COL."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1066 (if (or (< row 0)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1067 (< col 0)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1068 (>= row (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1069 (>= col (bubbles--grid-width)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1070 ;; Error! return nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1071 nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1072 ;; go
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1073 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1074 (forward-line (1+ row))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1075 (forward-char (1+ col))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1076 (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1077
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1078 (defun bubbles--char-at (row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1079 "Return character at bubble ROW and COL."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1080 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1081 (if (bubbles--goto row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1082 (char-after (point))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1083 nil)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1084
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1085 (defun bubbles--mark-direct-neighbours (row col char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1086 "Mark direct neighbours of bubble at ROW COL with same CHAR."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1087 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1088 (let ((count 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1089 (when (and (bubbles--goto row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1090 (eq char (char-after (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1091 (not (get-text-property (point) 'active)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1092 (add-text-properties (point) (1+ (point))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1093 '(active t face 'bubbles--highlight-face))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1094 (setq count (+ 1
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1095 (bubbles--mark-direct-neighbours row (1+ col) char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1096 (bubbles--mark-direct-neighbours row (1- col) char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1097 (bubbles--mark-direct-neighbours (1+ row) col char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1098 (bubbles--mark-direct-neighbours (1- row) col char))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1099 count)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1100
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1101 (defun bubbles--mark-neighbourhood (&optional pos)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1102 "Mark neighbourhood of point.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1103 Use optional parameter POS instead of point if given."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1104 (when bubbles--playing
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1105 (unless pos (setq pos (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1106 (condition-case err
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1107 (let ((char (char-after pos))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1108 (inhibit-read-only t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1109 (row (bubbles--row (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1110 (col (bubbles--col (point))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1111 (add-text-properties (point-min) (point-max)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1112 '(face default active nil))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1113 (let ((count 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1114 (when (and row col (not (eq char (bubbles--empty-char))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1115 (setq count (bubbles--mark-direct-neighbours row col char))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1116 (unless (> count 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1117 (add-text-properties (point-min) (point-max)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1118 '(face default active nil))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1119 (setq count 0)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1120 (bubbles--update-neighbourhood-score count))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1121 (put-text-property (point-min) (point-max) 'pointer 'arrow)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1122 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1123 (sit-for 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1124 (error (message "Bubbles: Internal error %s" err)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1125
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1126 (defun bubbles--neighbourhood-available ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1127 "Return t if another valid neighbourhood is available."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1128 (catch 'found
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1129 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1130 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1131 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1132 (let ((c (bubbles--char-at i j)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1133 (if (and (not (eq c (bubbles--empty-char)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1134 (or (eq c (bubbles--char-at (1+ i) j))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1135 (eq c (bubbles--char-at i (1+ j)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1136 (throw 'found t)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1137 nil)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1138
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1139 (defun bubbles--count ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1140 "Count remaining bubbles."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1141 (let ((count 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1142 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1143 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1144 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1145 (let ((c (bubbles--char-at i j)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1146 (if (not (eq c (bubbles--empty-char)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1147 (setq count (1+ count)))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1148 count))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1149
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1150 (defun bubbles--reset-score ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1151 "Reset bubbles score."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1152 (setq bubbles--neighbourhood-score 0
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1153 bubbles--score 0)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1154 (bubbles--update-score))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1155
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1156 (defun bubbles--update-score ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1157 "Calculate and display new bubble score."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1158 (setq bubbles--score (+ bubbles--score bubbles--neighbourhood-score))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1159 (bubbles--show-scores))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1160
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1161 (defun bubbles--update-neighbourhood-score (size)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1162 "Calculate and display score of active neighbourhood from its SIZE."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1163 (if (> size 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1164 (setq bubbles--neighbourhood-score (expt (- size 1) 2))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1165 (setq bubbles--neighbourhood-score 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1166 (bubbles--show-scores))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1167
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1168 (defun bubbles--show-scores ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1169 "Display current scores."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1170 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1171 (goto-char (or (next-single-property-change (point-min) 'status)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1172 (point-max)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1173 (let ((inhibit-read-only t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1174 (pos (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1175 (delete-region (point) (point-max))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1176 (insert (format "Selected: %4d\n" bubbles--neighbourhood-score))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1177 (insert " ")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1178 (add-text-properties (1- (point)) (point)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1179 (list 'intangible t 'display
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1180 (cons 'space
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1181 (list :width bubbles--col-offset))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1182 (insert (format "Score: %4d" bubbles--score))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1183 (put-text-property pos (point) 'status t))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1184
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1185 (defun bubbles--game-over ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1186 "Finish bubbles game."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1187 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1188 (setq bubbles--playing nil
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1189 bubbles--save-data nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1190 ;; add bonus if all bubbles were removed
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1191 (when (= 0 (bubbles--count))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1192 (setq bubbles--score (+ bubbles--score (* (bubbles--grid-height)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1193 (bubbles--grid-width))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1194 (bubbles--show-scores))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1195 ;; Game over message
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1196 (goto-char (point-max))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1197 (let* ((inhibit-read-only t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1198 (insert "\n ")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1199 (add-text-properties (1- (point)) (point)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1200 (list 'intangible t 'display
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1201 (cons 'space
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1202 (list :width bubbles--col-offset))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1203 (insert "Game Over!"))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1204 ;; save score
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1205 (gamegrid-add-score (format "bubbles-%s-%d-%d-%d-scores"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1206 (symbol-name (bubbles--shift-mode))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1207 (length (bubbles--colors))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1208 (bubbles--grid-width) (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1209 bubbles--score))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1210
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1211 (defun bubbles-plop ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1212 "Remove active bubbles region."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1213 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1214 (when (and bubbles--playing
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1215 (> bubbles--neighbourhood-score 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1216 (setq bubbles--save-data (list bubbles--score (buffer-string)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1217 (let ((inhibit-read-only t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1218 ;; blank out current neighbourhood
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1219 (let ((row (bubbles--row (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1220 (col (bubbles--col (point))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1221 (goto-char (point-max))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1222 (while (not (bobp))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1223 (backward-char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1224 (while (get-text-property (point) 'active)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1225 (delete-char 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1226 (insert (bubbles--empty-char))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1227 (add-text-properties (1- (point)) (point) (list 'removed t
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1228 'index -1))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1229 (bubbles--goto row col))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1230 ;; show new score
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1231 (bubbles--update-score)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1232 ;; update display and wait
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1233 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1234 (sit-for 0)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1235 (sleep-for 0.2)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1236 (discard-input)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1237 ;; drop down
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1238 (let ((something-dropped nil))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1239 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1240 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1241 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1242 (bubbles--goto i j)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1243 (while (get-text-property (point) 'removed)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1244 (setq something-dropped (or (bubbles--shift 'top i j)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1245 something-dropped))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1246 ;; update display and wait
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1247 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1248 (when something-dropped
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1249 (sit-for 0)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1250 (discard-input)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1251 ;; shift to left
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1252 (put-text-property (point-min) (point-max) 'removed nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1253 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1254 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1255 (let ((removed-string (format "%c" (bubbles--empty-char))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1256 (while (search-forward removed-string nil t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1257 (put-text-property (1- (point)) (point) 'removed t))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1258 (let ((shifted nil))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1259 (cond ((eq (bubbles--shift-mode) 'always)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1260 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1261 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1262 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1263 (bubbles--goto i j)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1264 (while (get-text-property (point) 'removed)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1265 (setq shifted (or (bubbles--shift 'right i j)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1266 shifted))))))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1267 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1268 (sleep-for 0.5))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1269 (t ;; default shift-mode
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1270 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1271 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1272 (bubbles--goto (1- (bubbles--grid-height)) j)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1273 (let ((shifted-cols 0))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1274 (while (get-text-property (point) 'removed)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1275 (setq shifted-cols (1+ shifted-cols))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1276 (bubbles--shift 'right (1- (bubbles--grid-height)) j))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1277 (dotimes (k shifted-cols)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1278 (let ((i (- (bubbles--grid-height) 2)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1279 (while (>= i 0)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1280 (setq shifted (or (bubbles--shift 'right i j)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1281 shifted))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1282 (setq i (1- i))))))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1283 (when shifted
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1284 ;;(sleep-for 0.5)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1285 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1286 (sit-for 0)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1287 (put-text-property (point-min) (point-max) 'removed nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1288 (unless (bubbles--neighbourhood-available)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1289 (bubbles--game-over)))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1290 ;; undo
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1291 (setq buffer-undo-list '((apply bubbles-undo . nil)))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1292 (force-mode-line-update)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1293 (redisplay)))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1294
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1295 (defun bubbles-undo ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1296 "Undo last move."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1297 (interactive)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1298 (when bubbles--save-data
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1299 (let ((inhibit-read-only t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1300 (pos (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1301 (erase-buffer)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1302 (insert (cadr bubbles--save-data))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1303 (bubbles--update-faces-or-images)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1304 (setq bubbles--score (car bubbles--save-data))
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1305 (goto-char pos))
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1306 (setq buffer-undo-list t)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1307 (force-mode-line-update)
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1308 (redisplay)))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1309
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1310 (defun bubbles--shift (from row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1311 "Move bubbles FROM one side to position ROW COL.
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1312 Return t if new char is non-empty."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1313 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1314 (when (bubbles--goto row col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1315 (let ((char-org (char-after (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1316 (char-new (bubbles--empty-char))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1317 (removed nil)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1318 (trow row)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1319 (tcol col)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1320 (index -1))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1321 (cond ((eq from 'top)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1322 (setq trow (1- row)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1323 ((eq from 'left)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1324 (setq tcol (1- col)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1325 ((eq from 'right)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1326 (setq tcol (1+ col))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1327 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1328 (when (bubbles--goto trow tcol)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1329 (setq char-new (char-after (point)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1330 (setq removed (get-text-property (point) 'removed))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1331 (setq index (get-text-property (point) 'index))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1332 (bubbles--shift from trow tcol)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1333 (insert char-new)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1334 (delete-char 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1335 (add-text-properties (1- (point)) (point) (list 'index index
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1336 'removed removed))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1337 (not (eq char-new (bubbles--empty-char)))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1338
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1339 (defun bubbles--initialize-images ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1340 "Prepare images for playing `bubbles'."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1341 (when (and (display-images-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1342 (not (eq bubbles-graphics-theme 'ascii)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1343 (let ((template (case bubbles-graphics-theme
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1344 ('circles bubbles--image-template-circle)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1345 ('balls bubbles--image-template-ball)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1346 ('squares bubbles--image-template-square)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1347 ('diamonds bubbles--image-template-diamond)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1348 ('emacs bubbles--image-template-emacs))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1349 (setq bubbles--empty-image
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1350 (create-image (replace-regexp-in-string
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1351 "^\"\\(.*\\)\t.*c .*\",$"
84539
94bc57977861 (bubbles--initialize-images): Fix bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 82929
diff changeset
1352 "\"\\1\tc None\"," template)
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1353 'xpm t
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1354 ;;:mask 'heuristic
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1355 :margin '(2 . 1)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1356 (setq bubbles--images
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1357 (mapcar (lambda (color)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1358 (let* ((rgb (color-values color))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1359 (red (nth 0 rgb))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1360 (green (nth 1 rgb))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1361 (blue (nth 2 rgb)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1362 (with-temp-buffer
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1363 (insert template)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1364 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1365 (re-search-forward
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1366 "^\"[0-9]+ [0-9]+ \\(.*?\\) .*\",$" nil t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1367 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1368 (while (re-search-forward
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1369 "^\"\\(.*\\)\t.*c \\(#.*\\)\",$" nil t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1370 (let* ((crgb (color-values (match-string 2)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1371 (r (nth 0 crgb))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1372 (g (nth 1 crgb))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1373 (b (nth 2 crgb))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1374 (brightness (/ (+ r g b) 3.0 256 256))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1375 (val (sin (* brightness (/ pi 2))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1376 (rr (* red val))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1377 (gg (* green val))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1378 (bb (* blue val))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1379 ;;(rr (/ (+ red r) 2))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1380 ;;(gg (/ (+ green g) 2))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1381 ;;(bb (/ (+ blue b) 2))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1382 (color (format "#%02x%02x%02x"
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1383 (/ rr 256) (/ gg 256)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1384 (/ bb 256))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1385 (replace-match (format "\"\\1\tc %s\","
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1386 (upcase color)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1387 (create-image (buffer-string) 'xpm t
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1388 :margin '(2 . 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1389 ;;:mask 'heuristic
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1390 ))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1391 (bubbles--colors))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1392 ;; check images
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1393 (setq bubbles--images-ok bubbles--empty-image)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1394 (mapc (lambda (elt)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1395 (setq bubbles--images-ok (and bubbles--images-ok elt)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1396 bubbles--images)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1397
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1398 (defun bubbles--update-faces-or-images ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1399 "Update faces and/or images, depending on graphics mode."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1400 (bubbles--set-faces)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1401 (bubbles--show-images))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1402
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1403 (defun bubbles--set-faces ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1404 "Update faces in the bubbles buffer."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1405 (unless (and (display-images-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1406 bubbles--images-ok
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1407 (not (eq bubbles-graphics-theme 'ascii)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1408 (when (display-color-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1409 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1410 (let ((inhibit-read-only t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1411 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1412 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1413 (bubbles--goto i j)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1414 (let* ((index (get-text-property (point) 'index))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1415 (face (nth index bubbles--faces))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1416 (fg-col (face-foreground face)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1417 (when (get-text-property (point) 'active)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1418 (set-face-foreground 'bubbles--highlight-face "#ff0000")
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1419 (setq face 'bubbles--highlight-face))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1420 (put-text-property (point) (1+ (point))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1421 'face face)))))))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1422
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1423 (defun bubbles--show-images ()
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1424 "Update images in the bubbles buffer."
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1425 (bubbles--remove-overlays)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1426 (if (and (display-images-p)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1427 bubbles--images-ok
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1428 (not (eq bubbles-graphics-theme 'ascii)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1429 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1430 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1431 (forward-line 1)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1432 (let ((inhibit-read-only t)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1433 char)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1434 (dotimes (i (bubbles--grid-height))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1435 (dotimes (j (bubbles--grid-width))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1436 (forward-char 1)
84565
329f1482e2d6 (bubbles-version): Bump value to "0.5".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 84539
diff changeset
1437 (let ((index (or (get-text-property (point) 'index) -1)))
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1438 (let ((img bubbles--empty-image))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1439 (if (>= index 0)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1440 (setq img (nth index bubbles--images)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1441 (put-text-property (point) (1+ (point))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1442 'display (cons img nil)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1443 (forward-line 1))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1444 (save-excursion
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1445 (let ((inhibit-read-only t))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1446 (goto-char (point-min))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1447 (while (not (eobp))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1448 (let ((disp-prop (get-text-property (point) 'display)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1449 (if (and (listp disp-prop)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1450 (listp (car disp-prop))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1451 (eq (caar disp-prop) 'image))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1452 (put-text-property (point) (1+ (point)) 'display nil))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1453 (forward-char 1)))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1454 (put-text-property (point-min) (point-max) 'pointer 'arrow)))))
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1455
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1456 (provide 'bubbles)
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1457
82929
bb20f4e17041 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 82922
diff changeset
1458 ;; arch-tag: 2cd7237a-b0ad-400d-a7fd-75f676dceb70
82921
d6f5e792bbb2 Initial revision
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
diff changeset
1459 ;;; bubbles.el ends here