2
Copyright (C) 2003-2005 Fons Adriaensen <fons.adriaensen@skynet.be>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#include "callbacks.h"
25
Midiwin::Midiwin (X_window *parent, X_callback *callb, int xp, int yp, X_resman *xresm) :
26
X_window (parent, xp, yp, XSIZE, YSIZE, Colors.main_bg),
33
_atom = XInternAtom (dpy (), "WM_DELETE_WINDOW", True);
34
XSetWMProtocols (dpy (), win (), &_atom, 1);
35
_atom = XInternAtom (dpy (), "WM_PROTOCOLS", True);
39
Midiwin::~Midiwin (void)
44
void Midiwin::handle_event (XEvent *E)
49
handle_xmesg ((XClientMessageEvent *) E);
55
void Midiwin::handle_xmesg (XClientMessageEvent *E)
57
if (E->message_type == _atom) x_unmap ();
61
void Midiwin::handle_callb (int k, X_window *W, XEvent *E)
65
case BUTTON | X_button::PRESS:
67
X_button *B = (X_button *) W;
68
XButtonEvent *X = (XButtonEvent *) E;
70
set_butt (B->cbid ());
71
if (X->state & ShiftMask) _callb->handle_callb (CB_MIDI_SETCONF, this, 0);
72
else _callb->handle_callb (CB_MIDI_GETCONF, this, 0);
77
_callb->handle_callb (CB_MIDI_SETCONF, this, 0);
83
void Midiwin::setup (M_ifc_init *M)
89
_matrix = new Midimatrix (this, this, 10, 10);
93
y = _matrix->ysize () + 20;
96
for (i = 0; i < 8; i++)
98
sprintf (s, "%d", i + 1);
99
_bpres [i] = new X_tbutton (this, this, &but1, x, y, s, 0, i);
100
_bpres [i]->x_map ();
104
add_text (x, y, 200, 20, "Shift-click to store preset", &text0, -1);
105
_xs = _matrix->xsize () + 20;
106
_ys = _matrix->ysize () + 60;
107
H.position (_xp, _yp);
108
H.minsize (_xs, _ys);
109
H.maxsize (_xs, _ys);
110
H.rname (_xresm->rname ());
111
H.rclas (_xresm->rclas ());
115
sprintf (s, "%s Aeolus-%s Midi settings", M->_appid, VERSION);
120
void Midiwin::setconf (M_ifc_chconf *M)
130
_matrix->set_chconf (M->_bits);
134
void Midiwin::set_butt (int i)
138
if (_preset >= 0) _bpres [_preset]->set_stat (0);
140
if (_preset >= 0) _bpres [_preset]->set_stat (1);
145
void Midiwin::add_text (int xp, int yp, int xs, int ys, const char *text, X_textln_style *style, int align)
147
(new X_textln (this, style, xp, yp, xs, ys, text, align))->x_map ();