annotate lisp/play/bubbles.el @ 101720:02a61aa59953

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