[go: up one dir, main page]

File: iris.h

package info (click to toggle)
iris 0.12-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,664 kB
  • ctags: 602
  • sloc: sh: 7,836; ansic: 5,632; makefile: 59
file content (198 lines) | stat: -rw-r--r-- 5,638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*  Iris - visualization plugin for XMMS
 *  Copyright (C) 2000-2002 Cdric DELFOSSE (cdelfosse@free.fr)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef IRIS_H

#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <xmms/configfile.h>
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>

typedef struct
{

  GLfloat bgc_red;
  GLfloat bgc_green;
  GLfloat bgc_blue;

  GLfloat color_red;
  GLfloat color_green;
  GLfloat color_blue;

  GLfloat color1_red;
  GLfloat color1_green;
  GLfloat color1_blue;

  GLfloat color2_red;
  GLfloat color2_green;
  GLfloat color2_blue;

  GLfloat color_flash_red;
  GLfloat color_flash_green;
  GLfloat color_flash_blue;

  gint color_mode;
  gint flash_speed;
  gint fps;

  // in fullscreen, we are only interested in width and height
  gint fs_width;
  gint fs_height;

  gint window_width;
  gint window_height;

  gboolean bgc_random;
  gboolean color_random;
  gboolean color12_random;
  gboolean flash_random;
  gboolean color_beat;
  gboolean change_theme_on_beat;

  gboolean fullscreen;
  gboolean wireframe;

  gboolean transition;
  gfloat trans_duration;
}
iris_config;

typedef struct
{ 
  gfloat priority; /* priority of the theme */
  int transparency; /* transparency can be off (0), on (1) or random (-1) */
  int wireframe; /* wireframe can be off (0), on (1) or random (-1) */
}
config_global; /* options implemented by all the themes */

typedef struct
{
  config_global *global;
  void *private; /* private config of the theme */
}
config_theme;

typedef struct
{
  char *name; /* the name of the theme */
  char *description; /* what the theme does */
  char *author; /* who did the theme */
  char *key; /* key used to get config items in ~/.xmms/config */
  config_theme *config; /* where the theme config is */
  config_theme *config_new; /* copy of the theme config used by the configuration widgets */
  int config_private_size; /* size of the private theme config structure (we can't get it dynamically) */
  void (*config_read) (ConfigFile * f, char *); /* read the private theme config and put it into the privateconfig */
  void (*config_write) (ConfigFile * f, char *); /* write the private config into ~/.xmms/config */
  void (*config_default) (void); /* put default values into private config */
  void (*config_create) (GtkWidget *); /* create the Gtk widget (into a vbox) to configure the theme */
  void (*init) (void); /* called once at iris init */
  void (*cleanup) (void); /* called once at iris cleanup */
  void (*init_draw_mode) (void); /* called once when iris switch to this theme */
  GLfloat (*get_x_angle) (void); /* called once when iris switch to this theme to get a camera position to move */
  void (*draw_one_frame) (gboolean beat); /* draw one frame of the theme */
}
iris_theme;

#define NUM_BANDS 16
typedef struct {
  GLfloat data360[360][NUM_BANDS];
  GLfloat data1[NUM_BANDS];
  GLfloat loudness;
}
datas_t;

typedef struct
{
  GLfloat x;
  GLfloat z;
}
xz;

/* stuff about our window grouped together */
typedef struct
{
  // X stuff
  Display *dpy;
  int screen;
  Window window;
  GLXContext ctx;
  XSetWindowAttributes attr;
  Bool fs;
  XF86VidModeModeInfo deskMode;
  unsigned int window_x, window_y;
  unsigned int window_width, window_height;
  unsigned int fs_width, fs_height;

  // rendering info
  int glxMajorVersion;
  int glxMinorVersion;
  int vidModeMajorVersion;
  int vidModeMinorVersion;
  XF86VidModeModeInfo **modes;
  int modeNum;
  unsigned int depth;
  gboolean DRI;
  gboolean DoubleBuffered;
  GList *glist;
}
GLWindow;

/* config.c */
extern GtkWidget *config_window;
extern iris_config config;
extern iris_config newconfig;
extern GLWindow GLWin;
extern datas_t datas;
extern void iris_first_init (void);
extern void iris_configure (void);
extern void iris_config_read (void);
extern void iris_config_write (iris_config *);
extern void iris_set_default_prefs (void);
extern void iris_save_window_attributes (void);
extern GLvoid init_gl (GLvoid);

/* color.c */
extern void get_color (GLfloat *, GLfloat *, GLfloat *, GLfloat *);

/* 3Dstuff.c */
extern void bar_top_or_bottom (GLfloat height, xz * xz1, xz * xz2, xz * xz3,
			       xz * xz4);
extern void bar_side (GLfloat height, xz * xz1, xz * xz2);
extern void bar_full (GLfloat height, xz * xz1, xz * xz2, xz * xz3, xz * xz4);

/* theme.c */
#define THEME_NUMBER 12
extern void theme_register (void);
extern iris_theme theme[THEME_NUMBER];
extern void theme_config_init (void);
extern void theme_config_global_default (int);
extern void theme_config_global_read (ConfigFile *, char *, int);
extern void theme_config_global_write (ConfigFile *, char *, int);
extern void theme_config_apply(int num);
extern void theme_config_global_widgets(GtkWidget *, int);
extern void theme_about(GtkWidget *, int);

/* transition.c */
extern void init_theme_transition ();
extern void theme_transition ();

#endif