Blame hdspmixer/src/HDSPMixerMaster.cxx

Packit Service b98cfc
/*
Packit Service b98cfc
 *   HDSPMixer
Packit Service b98cfc
 *    
Packit Service b98cfc
 *   Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
Packit Service b98cfc
 *    
Packit Service b98cfc
 *   This program is free software; you can redistribute it and/or modify
Packit Service b98cfc
 *   it under the terms of the GNU General Public License as published by
Packit Service b98cfc
 *   the Free Software Foundation; either version 2 of the License, or
Packit Service b98cfc
 *   (at your option) any later version.
Packit Service b98cfc
 *
Packit Service b98cfc
 *   This program is distributed in the hope that it will be useful,
Packit Service b98cfc
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service b98cfc
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service b98cfc
 *   GNU General Public License for more details.
Packit Service b98cfc
 *
Packit Service b98cfc
 *   You should have received a copy of the GNU General Public License
Packit Service b98cfc
 *   along with this program; if not, write to the Free Software
Packit Service b98cfc
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit Service b98cfc
 */
Packit Service b98cfc
Packit Service b98cfc
#pragma implementation
Packit Service b98cfc
#include "HDSPMixerMaster.h"
Packit Service b98cfc
Packit Service b98cfc
HDSPMixerMaster::HDSPMixerMaster(int x, int y, int w, int h):Fl_Widget(x, y, 62, 12)
Packit Service b98cfc
{
Packit Service b98cfc
    basew = (HDSPMixerWindow *)window();
Packit Service b98cfc
    solo = mute = solo_active = mute_active = 0;
Packit Service b98cfc
}
Packit Service b98cfc
Packit Service b98cfc
Packit Service b98cfc
void HDSPMixerMaster::draw() 
Packit Service b98cfc
{
Packit Service b98cfc
    if (mute && mute_active) {
Packit Service b98cfc
	fl_push_clip(x(), y(), 30, 11);
Packit Service b98cfc
	fl_draw_pixmap(b_mute_xpm, x(), y());
Packit Service b98cfc
	fl_pop_clip();
Packit Service b98cfc
    } else if (mute) {
Packit Service b98cfc
	fl_push_clip(x(), y(), 30, 11);
Packit Service b98cfc
	fl_draw_pixmap(b_mute_xpm, x(), y()-11);
Packit Service b98cfc
	fl_pop_clip();
Packit Service b98cfc
    }	
Packit Service b98cfc
    if (solo && solo_active) {
Packit Service b98cfc
	fl_push_clip(x()+32, y(), 30, 11);
Packit Service b98cfc
	fl_draw_pixmap(b_solo_xpm, x()+32, y());
Packit Service b98cfc
	fl_pop_clip();
Packit Service b98cfc
    } else if (solo) {
Packit Service b98cfc
	fl_push_clip(x()+32, y(), 30, 11);
Packit Service b98cfc
	fl_draw_pixmap(b_solo_xpm, x()+32, y()-11);
Packit Service b98cfc
	fl_pop_clip();
Packit Service b98cfc
    }	
Packit Service b98cfc
}
Packit Service b98cfc
Packit Service b98cfc
int HDSPMixerMaster::handle(int e)
Packit Service b98cfc
{
Packit Service b98cfc
    int xpos = Fl::event_x()-x();
Packit Service b98cfc
    switch (e) {
Packit Service b98cfc
	case FL_PUSH:
Packit Service b98cfc
	    if (xpos >= 0 && xpos <= 30) {
Packit Service b98cfc
		if (mute) {
Packit Service b98cfc
		    mute = 0;
Packit Service b98cfc
		} else {
Packit Service b98cfc
		    mute = 1;
Packit Service b98cfc
		}
Packit Service b98cfc
		for (int i = 0; i < basew->cards[basew->current_card]->channels_input; i++) {
Packit Service b98cfc
		    basew->inputs->strips[i]->mutesolo->redraw();
Packit Service b98cfc
		}
Packit Service b98cfc
		for (int i = 0; i < basew->cards[basew->current_card]->channels_playback; i++) {
Packit Service b98cfc
		    basew->playbacks->strips[i]->mutesolo->redraw();
Packit Service b98cfc
		}
Packit Service b98cfc
		basew->refreshMixer();
Packit Service b98cfc
		redraw();
Packit Service b98cfc
		basew->checkState();
Packit Service b98cfc
		return 1;
Packit Service b98cfc
	    }
Packit Service b98cfc
	    if (xpos >= 32) {
Packit Service b98cfc
		if (solo) {
Packit Service b98cfc
		    solo = 0;
Packit Service b98cfc
		} else {
Packit Service b98cfc
		    solo = 1;
Packit Service b98cfc
		}
Packit Service b98cfc
		for (int i = 0; i < basew->cards[basew->current_card]->channels_input; i++) {
Packit Service b98cfc
		    basew->inputs->strips[i]->mutesolo->redraw();
Packit Service b98cfc
		}
Packit Service b98cfc
		for (int i = 0; i < basew->cards[basew->current_card]->channels_playback; i++) {
Packit Service b98cfc
		    basew->playbacks->strips[i]->mutesolo->redraw();
Packit Service b98cfc
		}
Packit Service b98cfc
		basew->refreshMixer();
Packit Service b98cfc
		redraw();
Packit Service b98cfc
		basew->checkState();
Packit Service b98cfc
		return 1;
Packit Service b98cfc
	    }
Packit Service b98cfc
	default:
Packit Service b98cfc
	    return Fl_Widget::handle(e);
Packit Service b98cfc
    }    
Packit Service b98cfc
}
Packit Service b98cfc