Importing EDE2 code to svn... NOTE: It doesn't compile! Stuff thats broken: edewm, eworkpanel, eiconman,

emenueditor
This commit is contained in:
Vedran Ljubovic
2006-08-20 18:43:09 +00:00
commit 65018f75b7
1004 changed files with 88271 additions and 0 deletions

22
evolume/Makefile Executable file
View File

@ -0,0 +1,22 @@
CPPFILES = evolume.cpp prefs.cpp ../edelib2/about_dialog.cpp ../edelib2/Util.cpp ../edelib2/Config.cpp ../edelib2/process.cpp ../edelib2/pty.cpp ../edelib2/Run.cpp
TARGET = evolume
POFILES = locale/ru.po\
locale/sk.po\
locale/hu.po
include ../makeinclude
install:
$(INSTALL_PROGRAM) $(TARGET) $(bindir)
$(INSTALL_LOCALE)
uninstall:
$(RM) $(bindir)/$(TARGET)
clean:
$(RM) $(TARGET)
$(RM) *.o

624
evolume/evolume.cpp Executable file
View File

@ -0,0 +1,624 @@
/*
* $Id$
*
* Volume control application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2006 EDE Authors.
*
* This program is licenced under terms of the
* GNU General Public Licence version 2 or newer.
* See COPYING for details.
*/
// TODO:
// At the moment evolume is ALSA only - patches for OSS support
// are welcome
#include "prefs.h"
#include "evolume.h"
#include "../edeconf.h"
#include "../edelib2/about_dialog.h"
#include <fltk/events.h>
#include <fltk/run.h>
using namespace fltk;
using namespace edelib;
// Global variables
char device[1024]={0};
Window *main_window=0;
Config globalConfig("EDE Team", "evolume");
bool simplemode = true;
// Main ALSA device functions
void set_device(int mixer_fd, int device, Slider *device_sl, Slider *balance)
{
int l = (unsigned int) ((1.0-(balance->value()) ) * device_sl->value() );
int r = (unsigned int) ( (balance->value()) * device_sl->value());
int v = (r << 8) | l;
if (ioctl (mixer_fd, MIXER_WRITE (device), &v) < 0)
alert(_("Cannot setup device, sorry."));
}
void get_device_info(int mixer_dev, Slider *sl, Slider *bal,
CheckButton *ck, int device)
{
unsigned int devmask, recmask, recsrc, stereo;
volume real_volume;
real_volume.left = real_volume.right = 0;
devmask = recmask = recsrc = stereo = 0;
if (ioctl(mixer_dev, SOUND_MIXER_READ_DEVMASK, &devmask) == -1)
fprintf(stderr, "Read devmask failed.\n");
if (devmask & (1 << (device)))
sl->activate();
else
sl->deactivate();
if (ioctl(mixer_dev, SOUND_MIXER_READ_STEREODEVS, &stereo) == -1)
fprintf(stderr, "Read recsrc failed.\n");
if ( stereo & (1 << (device) ) ) bal->activate();
else ck->deactivate();
if (ioctl(mixer_dev, SOUND_MIXER_READ_RECMASK, &recmask) == -1)
fprintf(stderr, "Read recmask failed.\n");
if ( recmask & (1 << (device) ) ) ck->activate();
else ck->deactivate();
if (ioctl(mixer_dev, SOUND_MIXER_READ_RECSRC, &recsrc) == -1)
fprintf(stderr, "Read recsrc failed.\n");
if ( recsrc & (1 << (device) ) ) ck->set();
else ck->clear();
if ( ioctl(mixer_dev, MIXER_READ(device), &real_volume) < 0 ) {
fprintf(stderr, "Can't obtain current volume settings.\n");
}
float volume = real_volume.left + real_volume.right;
float balance = 0;
balance = ( (1.0 * (unsigned char)real_volume.right ) /
(1.0 * ((unsigned char)real_volume.left + (unsigned char)real_volume.right)) );
if (volume == 0)
volume=1;
if (balance < 0)
balance=0.5;
sl->value(volume);
bal->value(balance);
}
void set_mute(int mixer_fd, int device, Slider *device_sl, Slider *balance, CheckButton *check_button)
{
int vol = 0;
if ( check_button->value() )
{
if (ioctl(mixer_fd, MIXER_WRITE(device), &vol) < 0 )
fprintf(stderr, "Cannot set mute.\n");
}
else {
volume real_volume;
double old_volume = device_sl->value();
double old_balance = balance->value();
real_volume.left = (unsigned char) ( (1.0 - (old_balance)) * old_volume );
real_volume.right = (unsigned char) ( (old_balance) * old_volume);
if ( ioctl(mixer_fd, MIXER_WRITE(device), &real_volume) < 0 )
{
fprintf(stderr, "Cannot setup volume, sorry.\n");
}
}
}
void set_rec(int mixer_fd, int device, CheckButton *ck)
{
unsigned int recsrc;
if (ioctl(mixer_fd, SOUND_MIXER_READ_RECSRC, &recsrc) == -1)
printf("read recsrc failed\n");
unsigned int new_recsrc = recsrc ^ ( 1 << device );
if (ioctl(mixer_fd, SOUND_MIXER_WRITE_RECSRC, &new_recsrc) == -1)
printf("oh no\n");
}
void update_info()
{
mixer_info minfo;
if (ioctl(mixer_device, SOUND_MIXER_INFO, &minfo) < 0)
fprintf(stderr, "Read device info failed.\n");
else
{
char *title = (char*)malloc(strlen(_("Volume control: [%s]"))+strlen(minfo.name));
sprintf(title,_("Volume control: [%s]"), minfo.name);
main_window->label(title);
}
}
// These functions set parameters for default look of sliders
void default_look(Slider* slider)
{
slider->type(Slider::TICK_BOTH);
slider->set_vertical();
slider->minimum(-100);
slider->maximum(100);
slider->value(1);
slider->step(1);
slider->align(ALIGN_TOP);
}
void default_look_b(Slider* balance_slider)
{
balance_slider->type(1);
balance_slider->minimum(0.00);
balance_slider->maximum(1.00);
balance_slider->step(0.01);
balance_slider->value(0.01);
}
// Functions for various control groups - this is mostly copy-paste
void cb_volume(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance, volume_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_VOLUME, volume_rec);
}
void cb_cd(Slider* o, void *i) {
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance, cd_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_CD, cd_rec);
}
void cb_pcm(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance, pcm_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_PCM, pcm_rec);
}
void cb_synth(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance, synth_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_SYNTH, synth_rec);
}
void cb_line(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance, line_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_LINE, line_rec);
}
void cb_bass(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance, bass_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_BASS, bass_rec);
}
void cb_treble(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance, treble_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_TREBLE, treble_rec);
}
void cb_mic(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance, mic_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_MIC, mic_rec);
}
void cb_speaker(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance, speaker_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_SPEAKER, speaker_rec);
}
void cb_imix(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance, imix_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_IMIX, imix_rec);
}
void cb_igain(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_IGAIN, igain_slider, igain_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_IGAIN, igain_slider, igain_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_IGAIN, igain_slider, igain_balance, igain_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_IGAIN, igain_rec);
}
void cb_ogain(Slider* o, void *i)
{
int x = (int) i;
if (x == 1) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
if (x == 2) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
if (x == 3) set_mute(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance, ogain_mute);
if (x == 4) set_rec(mixer_device, SOUND_MIXER_OGAIN, ogain_rec);
}
// Menu callback functions
void cb_Quit(Widget*, void*)
{
main_window->hide();
}
static void cb_About(Item*, void*) {
about_dialog("Volume Control","1.0","");
}
void cb_SimpleMode(Widget*, void*) {
if (!simplemode) {
simplemode = true;
synth_slider->hide();
synth_balance->hide();
synth_mute->hide();
synth_rec->hide();
bass_slider->hide();
bass_balance->hide();
bass_mute->hide();
bass_rec->hide();
treble_slider->hide();
treble_balance->hide();
treble_mute->hide();
treble_rec->hide();
mic_slider->hide();
mic_balance->hide();
mic_mute->hide();
mic_rec->hide();
speaker_slider->hide();
speaker_balance->hide();
speaker_mute->hide();
speaker_rec->hide();
imix_slider->hide();
imix_balance->hide();
imix_mute->hide();
imix_rec->hide();
igain_slider->hide();
igain_balance->hide();
igain_mute->hide();
igain_rec->hide();
ogain_slider->hide();
ogain_balance->hide();
ogain_mute->hide();
ogain_rec->hide();
main_window->resize(250,205);
} else {
simplemode = false;
synth_slider->show();
synth_balance->show();
synth_mute->show();
synth_rec->show();
bass_slider->show();
bass_balance->show();
bass_mute->show();
bass_rec->show();
treble_slider->show();
treble_balance->show();
treble_mute->show();
treble_rec->show();
mic_slider->show();
mic_balance->show();
mic_mute->show();
mic_rec->show();
speaker_slider->show();
speaker_balance->show();
speaker_mute->show();
speaker_rec->show();
imix_slider->show();
imix_balance->show();
imix_mute->show();
imix_rec->show();
igain_slider->show();
igain_balance->show();
igain_mute->show();
igain_rec->show();
ogain_slider->show();
ogain_balance->show();
ogain_mute->show();
ogain_rec->show();
main_window->resize(720,205);
}
globalConfig.set("Sound mixer", "Simplemode", simplemode);
}
// Main window design
int main (int argc, char **argv)
{
// fl_init_locale_support("evolume", PREFIX"/share/locale");
globalConfig.get("Sound mixer", "Device", device, "/dev/mixer", sizeof(device));
globalConfig.get("Sound mixer", "Simplemode", simplemode, true);
main_window = new Window(720, 205, _("Volume control"));
if (simplemode) main_window->resize(250,205);
main_window->begin();
MenuBar *vc_menubar = new MenuBar(0, 0, 724, 25);
vc_menubar->begin();
ItemGroup file(_("&File"));
file.begin();
Item* pref_item = new Item(_("Preferences"));
pref_item->shortcut(CTRL+'p');
pref_item->callback(PreferencesDialog);
Item* quit_item = new Item(_("Quit"));
quit_item->shortcut(CTRL+'q');
quit_item->callback(cb_Quit);
file.end();
ItemGroup view(_("&View"));
view.begin();
Item* mode_item = new Item(_("Simple mode"));
mode_item->shortcut(CTRL+'s');
mode_item->type(Item::TOGGLE);
mode_item->callback(cb_SimpleMode);
if (simplemode) mode_item->set();
view.end();
ItemGroup help(_("&Help"));
help.begin();
Item* about_item = new Item(_("About"));
about_item->shortcut(CTRL+'a');
about_item->callback((Callback*)cb_About);
help.end();
vc_menubar->end();
{Divider* o = new Divider();
o->resize(0, 24, 724, 3);
}
volume_slider = new Slider(20, 50, 20, 80, "VOL");
default_look(volume_slider);
volume_balance = new Slider(10, 135, 40, 15, "Balance");
default_look_b(volume_balance);
volume_mute = new CheckButton(5, 165, 20, 20, "Mute");
volume_mute->align(ALIGN_BOTTOM);
volume_rec = new CheckButton(35, 165, 20, 20, "Rec");
volume_rec->align(ALIGN_BOTTOM);
cd_slider = new Slider(80, 50, 20, 80, "CD");
default_look(cd_slider);
cd_balance = new Slider(70, 135, 40, 15, "Balance");
default_look_b(cd_balance);
cd_mute = new CheckButton(65, 165, 20, 20, "Mute");
cd_mute->align(ALIGN_BOTTOM);
cd_rec = new CheckButton(95, 165, 20, 20, "Rec");
cd_rec->align(ALIGN_BOTTOM);
pcm_slider = new Slider(140, 50, 20, 80, "PCM");
default_look(pcm_slider);
pcm_balance = new Slider(130, 135, 40, 15, "Balance");
default_look_b(pcm_balance);
pcm_mute = new CheckButton(125, 165, 20, 20, "Mute");
pcm_mute->align(ALIGN_BOTTOM);
pcm_rec = new CheckButton(155, 165, 20, 20, "Rec");
pcm_rec->align(ALIGN_BOTTOM);
line_slider = new Slider(200, 50, 20, 80, "LINE");
default_look(line_slider);
line_balance = new Slider(190, 135, 40, 15, "Balance");
default_look_b(line_balance);
line_mute = new CheckButton(185, 165, 20, 20, "Mute");
line_mute->align(ALIGN_BOTTOM);
line_rec = new CheckButton(215, 165, 20, 20, "Rec");
line_rec->align(ALIGN_BOTTOM);
synth_slider = new Slider(260, 50, 20, 80, "SYNTH");
default_look(synth_slider);
synth_balance = new Slider(250, 135, 40, 15, "Balance");
default_look_b(synth_balance);
synth_mute = new CheckButton(245, 165, 20, 20, "Mute");
synth_mute->align(ALIGN_BOTTOM);
synth_rec = new CheckButton(275, 165, 20, 20, "Rec");
synth_rec->align(ALIGN_BOTTOM);
bass_slider = new Slider(320, 50, 20, 80, "BASS");
default_look(bass_slider);
bass_balance = new Slider(310, 135, 40, 15, "Balance");
default_look_b(bass_balance);
bass_mute = new CheckButton(305, 165, 20, 20, "Mute");
bass_mute->align(ALIGN_BOTTOM);
bass_rec = new CheckButton(335, 165, 20, 20, "Rec");
bass_rec->align(ALIGN_BOTTOM);
treble_slider = new Slider(380, 50, 20, 80, "TREBLE");
default_look(treble_slider);
treble_balance = new Slider(370, 135, 40, 15, "Balance");
default_look_b(treble_balance);
treble_mute = new CheckButton(365, 165, 20, 20, "Mute");
treble_mute->align(ALIGN_BOTTOM);
treble_rec = new CheckButton(395, 165, 20, 20, "Rec");
treble_rec->align(ALIGN_BOTTOM);
mic_slider = new Slider(440, 50, 20, 80, "MIC");
default_look(mic_slider);
mic_balance = new Slider(430, 135, 40, 15, "Balance");
default_look_b(mic_balance);
mic_mute = new CheckButton(425, 165, 20, 20, "Mute");
mic_mute->align(ALIGN_BOTTOM);
mic_rec = new CheckButton(455, 165, 20, 20, "Rec");
mic_rec->align(ALIGN_BOTTOM);
speaker_slider = new Slider(500, 50, 20, 80, "SPK");
default_look(speaker_slider);
speaker_balance = new Slider(490, 135, 40, 15, "Balance");
default_look_b(speaker_balance);
speaker_mute = new CheckButton(485, 165, 20, 20, "Mute");
speaker_mute->align(ALIGN_BOTTOM);
speaker_rec = new CheckButton(515, 165, 20, 20, "Rec");
speaker_rec->align(ALIGN_BOTTOM);
imix_slider = new Slider(560, 50, 20, 80, "IMIX");
default_look(imix_slider);
imix_balance = new Slider(550, 135, 40, 15, "Balance");
default_look_b(imix_balance);
imix_mute = new CheckButton(545, 165, 20, 20, "Mute");
imix_mute->align(ALIGN_BOTTOM);
imix_rec = new CheckButton(575, 165, 20, 20, "Rec");
imix_rec->align(ALIGN_BOTTOM);
igain_slider = new Slider(620, 50, 20, 80, "IGAIN");
default_look(igain_slider);
igain_balance = new Slider(610, 135, 40, 15, "Balance");
default_look_b(igain_balance);
igain_mute = new CheckButton(605, 165, 20, 20, "Mute");
igain_mute->align(ALIGN_BOTTOM);
igain_rec = new CheckButton(635, 165, 20, 20, "Rec");
igain_rec->align(ALIGN_BOTTOM);
ogain_slider = new Slider(680, 50, 20, 80, "OGAIN");
default_look(ogain_slider);
ogain_balance = new Slider(670, 135, 40, 15, "Balance");
default_look_b(ogain_balance);
ogain_mute = new CheckButton(665, 165, 20, 20, "Mute");
ogain_mute->align(ALIGN_BOTTOM);
ogain_rec = new CheckButton(695, 165, 20, 20, "Rec");
ogain_rec->align(ALIGN_BOTTOM);
mixer_device = open(device, O_RDWR);
if (mixer_device == -1)
{
alert(_("Opening mixer device %s failed. Setup correct device in configuration dialog."), device);
volume_slider->deactivate(); cd_slider->deactivate();
pcm_slider->deactivate(); synth_slider->deactivate();
line_slider->deactivate(); bass_slider->deactivate();
treble_slider->deactivate(); mic_slider->deactivate();
speaker_slider->deactivate(); imix_slider->deactivate();
igain_slider->deactivate(); ogain_slider->deactivate();
}
update_info();
volume_slider->callback( (Callback*) cb_volume, (void*) 1 );
volume_balance->callback( (Callback*) cb_volume,(void *) 2 );
volume_mute->callback( (Callback*) cb_volume,(void *) 3 );
volume_rec->callback( (Callback*) cb_volume,(void *) 4 );
get_device_info(mixer_device, volume_slider, volume_balance, volume_rec, SOUND_MIXER_VOLUME);
cd_slider->callback( (Callback*) cb_cd, (void *) 1 );
cd_balance->callback( (Callback*) cb_cd,(void *) 2 );
cd_mute->callback( (Callback*) cb_cd,(void *) 3 );
cd_rec->callback( (Callback*) cb_cd,(void *) 4 );
get_device_info(mixer_device, cd_slider, cd_balance, cd_rec, SOUND_MIXER_CD);
pcm_slider->callback( (Callback*) cb_pcm, (void *) 1 );
pcm_balance->callback( (Callback*) cb_pcm,(void *) 2 );
pcm_mute->callback( (Callback*) cb_pcm,(void *) 3 );
pcm_rec->callback( (Callback*) cb_pcm,(void *) 4 );
get_device_info(mixer_device, pcm_slider, pcm_balance, pcm_rec, SOUND_MIXER_PCM);
synth_slider->callback( (Callback*) cb_synth, (void *) 1 );
synth_balance->callback( (Callback*) cb_synth,(void *) 2 );
synth_mute->callback( (Callback*) cb_synth,(void *) 3 );
synth_rec->callback( (Callback*) cb_synth,(void *) 4 );
get_device_info(mixer_device, synth_slider, synth_balance, synth_rec, SOUND_MIXER_SYNTH);
line_slider->callback( (Callback*) cb_line, (void *) 1 );
line_balance->callback( (Callback*) cb_line,(void *) 2 );
line_mute->callback( (Callback*) cb_line,(void *) 3 );
line_rec->callback( (Callback*) cb_line,(void *) 4 );
get_device_info(mixer_device, line_slider, line_balance, line_rec, SOUND_MIXER_LINE);
bass_slider->callback( (Callback*) cb_bass, (void *) 1 );
bass_balance->callback( (Callback*) cb_bass,(void *) 2 );
bass_mute->callback( (Callback*) cb_bass,(void *) 3 );
bass_rec->callback( (Callback*) cb_bass,(void *) 4 );
get_device_info(mixer_device, bass_slider, bass_balance, bass_rec, SOUND_MIXER_BASS);
treble_slider->callback( (Callback*) cb_treble, (void *) 1 );
treble_balance->callback( (Callback*) cb_treble,(void *) 2 );
treble_mute->callback( (Callback*) cb_treble,(void *) 3 );
treble_rec->callback( (Callback*) cb_treble,(void *) 4 );
get_device_info(mixer_device, treble_slider, treble_balance, treble_rec, SOUND_MIXER_TREBLE);
mic_slider->callback( (Callback*) cb_mic, (void *) 1 );
mic_balance->callback( (Callback*) cb_mic,(void *) 2 );
mic_mute->callback( (Callback*) cb_mic,(void *) 3 );
mic_rec->callback( (Callback*) cb_mic,(void *) 4 );
get_device_info(mixer_device, mic_slider, mic_balance, mic_rec, SOUND_MIXER_MIC);
speaker_slider->callback( (Callback*) cb_speaker, (void *) 1 );
speaker_balance->callback( (Callback*) cb_speaker,(void *) 2 );
speaker_mute->callback( (Callback*) cb_speaker,(void *) 3 );
speaker_rec->callback( (Callback*) cb_speaker,(void *) 4 );
get_device_info(mixer_device, speaker_slider, speaker_balance, speaker_rec, SOUND_MIXER_SPEAKER);
imix_slider->callback( (Callback*) cb_imix, (void *) 1 );
imix_balance->callback( (Callback*) cb_imix,(void *) 2 );
imix_mute->callback( (Callback*) cb_imix,(void *) 3 );
imix_rec->callback( (Callback*) cb_imix,(void *) 4 );
get_device_info(mixer_device, imix_slider, imix_balance, imix_rec, SOUND_MIXER_IMIX);
igain_slider->callback( (Callback*) cb_igain, (void *) 1 );
igain_balance->callback( (Callback*) cb_igain,(void *) 2 );
igain_mute->callback( (Callback*) cb_igain,(void *) 3 );
igain_rec->callback( (Callback*) cb_igain,(void *) 4 );
get_device_info(mixer_device, igain_slider, igain_balance, igain_rec, SOUND_MIXER_IGAIN);
ogain_slider->callback( (Callback*) cb_ogain, (void *) 1 );
ogain_balance->callback( (Callback*) cb_ogain,(void *) 2 );
ogain_mute->callback( (Callback*) cb_ogain,(void *) 3 );
ogain_rec->callback( (Callback*) cb_ogain,(void *) 4 );
get_device_info(mixer_device, ogain_slider, ogain_balance, ogain_rec, SOUND_MIXER_OGAIN);
main_window->end();
main_window->show(argc, argv);
simplemode = !simplemode; // cb_SimpleMode inverts meaning
cb_SimpleMode(0,0);
return run();
}

93
evolume/evolume.h Executable file
View File

@ -0,0 +1,93 @@
/*
* $Id$
*
* Volume control application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2006 EDE Authors.
*
* This program is licenced under terms of the
* GNU General Public Licence version 2 or newer.
* See COPYING for details.
*/
#ifndef EVOLUME_H_
#define EVOLUME_H_
extern "C" {
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/errno.h>
#include <fcntl.h>
#include <linux/soundcard.h>
#include <sys/ioctl.h>
}
/*#include <efltk/Fl.h>
#include <efltk/Fl_Window.h>
#include <efltk/Fl_Slider.h>
#include <efltk/Fl_Menu_Bar.h>
#include <efltk/Fl_Box.h>
#include <efltk/Fl_Button.h>
#include <efltk/Fl_Item.h>
#include <efltk/Fl_Item_Group.h>
#include <efltk/Fl_Divider.h>
#include <efltk/Fl_Check_Button.h>
#include <efltk/x.h>
#include <efltk/fl_ask.h>
#include <efltk/Fl_Config.h>
#include <efltk/Fl_Locale.h>
#include <efltk/Fl_Util.h>
#include <efltk/Fl_Divider.h>*/
#include <fltk/Window.h>
#include <fltk/Slider.h>
#include <fltk/MenuBar.h>
#include <fltk/Box.h>
#include <fltk/Button.h>
#include <fltk/Item.h>
#include <fltk/ItemGroup.h>
#include <fltk/Divider.h>
#include <fltk/CheckButton.h>
#include <fltk/x.h>
#include <fltk/ask.h>
#include <fltk/Divider.h>
#include "../edelib2/Config.h"
#include "../edelib2/NLS.h"
typedef struct
volume
{
unsigned char left;
unsigned char right;
} volume;
int mixer_device;
fltk::Slider *volume_slider, *cd_slider, *pcm_slider, *synth_slider,
*line_slider, *bass_slider, *treble_slider, *mic_slider,
*speaker_slider, *imix_slider, *igain_slider, *ogain_slider;
fltk::Slider *volume_balance, *cd_balance, *pcm_balance, *synth_balance,
*line_balance, *bass_balance, *treble_balance, *mic_balance,
*speaker_balance, *imix_balance, *igain_balance, *ogain_balance;
fltk::CheckButton *volume_mute, *cd_mute, *pcm_mute, *synth_mute,
*line_mute, *bass_mute, *treble_mute, *mic_mute,
*speaker_mute, *imix_mute, *igain_mute, *ogain_mute;
fltk::CheckButton *volume_rec, *cd_rec, *pcm_rec, *synth_rec,
*line_rec, *bass_rec, *treble_rec, *mic_rec,
*speaker_rec, *imix_rec, *igain_rec, *ogain_rec;
void get_device_info(int mixer_dev, fltk::Slider *sl, fltk::Slider *bal, fltk::CheckButton *ck, int device);
void set_device(int mixer_fd, int device, fltk::Slider *device_sl, fltk::Slider *balance);
void set_mute(int mixer_fd, int device, fltk::Slider *device_sl, fltk::Slider *balance, fltk::CheckButton *check_button);
void set_rec(int mixer_fd, int device, fltk::CheckButton *ck);
void update_info();
#endif

66
evolume/locale/hu.po Executable file
View File

@ -0,0 +1,66 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2005-02-09 11:23+0100\n"
"Last-Translator: Nemeth Otto <otto_nemeth@freemail.hu>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: evolume.cpp:158
msgid "Cannot setup device, sorry."
msgstr "Az eszköz beállítása sikertelen."
#: evolume.cpp:256
#, c-format
msgid "Volume control: [%s]"
msgstr "Hangerőszabályzó: [%s]"
#: evolume.cpp:269
msgid "Volume control"
msgstr "Hangerőszabályzó"
#: evolume.cpp:274
msgid "&File"
msgstr "&Fájl"
#: evolume.cpp:275
#: prefs.cpp:63
msgid "Preferencies"
msgstr "Beállítások"
#: evolume.cpp:279
msgid "Quit"
msgstr "Kilépés"
#: evolume.cpp:285
msgid "&Help"
msgstr "Se&gítség"
#: evolume.cpp:286
msgid "About"
msgstr "Magamról"
#: evolume.cpp:406
#, c-format
msgid "Opening mixer device %s failed. Setup correct device in configuration dialog."
msgstr "A %s keverő eszköz megnyitása sikertelen. Állítsd be a megfelelő eszközt a beállításoknál!"
#: prefs.cpp:66
msgid "Sound device"
msgstr "Keverő eszköz"
#: prefs.cpp:68
msgid "Device name:"
msgstr "Eszköz neve:"
#: prefs.cpp:80
msgid "&OK"
msgstr "&OK"
#: prefs.cpp:84
msgid "&Cancel"
msgstr "Mégs&em"

101
evolume/locale/id.po Executable file
View File

@ -0,0 +1,101 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: evolume\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-04 11:54+0100\n"
"PO-Revision-Date: 2002-12-18 14:34+0700\n"
"Last-Translator: Bambang Purnomosidi D. P. <i-am-the-boss@bpdp.org>\n"
"Language-Team: id <i-am-the-boss@bpdp.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
#: evolume.cpp:158
msgid "Cannot setup device, sorry."
msgstr "Tidak bisa mensetup devais, maaf."
#: evolume.cpp:256
#, c-format
msgid "Volume control: [%s]"
msgstr "Pengendali volume: [%s]"
#: evolume.cpp:269
msgid "Volume control"
msgstr "Pengendali volume"
#: evolume.cpp:274
msgid "&File"
msgstr "&File"
#: evolume.cpp:275 prefs.cpp:63
msgid "Preferencies"
msgstr "Preferensi"
#: evolume.cpp:279
msgid "Quit"
msgstr "Keluar"
#: evolume.cpp:285
msgid "&Help"
msgstr "&Pertolongan"
#: evolume.cpp:286
msgid "About"
msgstr "Tentang"
#: evolume.cpp:406
#, c-format
msgid ""
"Opening mixer device %s failed. Setup correct device in configuration dialog."
msgstr ""
"Gagal membuka devais mixer %s. Setup devais yang benar pada dialog "
"konfigurasi."
#: prefs.cpp:66
msgid "Sound device"
msgstr "Devais suara"
#: prefs.cpp:68
msgid "Device name:"
msgstr "Nama devais:"
#: prefs.cpp:80
msgid "&OK"
msgstr "&OK"
#: prefs.cpp:84
msgid "&Cancel"
msgstr "&Batal"
#~ msgid "About Volume control"
#~ msgstr "Tentang pengendali volume"
#~ msgid "&Close"
#~ msgstr "&Tutup"
#~ msgid ""
#~ "This program is based in part on the work of FLTK project (www.fltk.org). "
#~ "This program is free software, you can redistribute it and/or modify it "
#~ "under the terms of 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 Licence along with this program; if not, write to the "
#~ "Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA"
#~ msgstr ""
#~ "Program ini berbasis pada hasil pekerjaan proyek FLTK (www.fltk.org). "
#~ "Program ini adalah free software, anda bisa mendistribusikan kembali dan/"
#~ "atau memodifikasinya dengan syarat-syarat yang diatur pada GNU General "
#~ "Public License, versi 2 atau versi yang lebih baru. Program ini "
#~ "didistribusikan dengan harapan akan berguna, tetapi TANPA JAMINAN; bahkan "
#~ "tanpa jaminan daya jual dan tujuan-tujuan tertentu. Lihat GNU General "
#~ "Public License untuk lebih jelasnya. Anda seharusnya telah menerima "
#~ "salinan GNU General Public License bersama dengan program ini; jikat "
#~ "tidak, silahkan minta ke Free Software Foundation, Inc., 675 Mass Ave, "
#~ "Cambridge, MA 02139, USA."

72
evolume/locale/messages.pot Executable file
View File

@ -0,0 +1,72 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-04 11:54+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: evolume.cpp:158
msgid "Cannot setup device, sorry."
msgstr ""
#: evolume.cpp:256
#, c-format
msgid "Volume control: [%s]"
msgstr ""
#: evolume.cpp:269
msgid "Volume control"
msgstr ""
#: evolume.cpp:274
msgid "&File"
msgstr ""
#: evolume.cpp:275 prefs.cpp:63
msgid "Preferencies"
msgstr ""
#: evolume.cpp:279
msgid "Quit"
msgstr ""
#: evolume.cpp:285
msgid "&Help"
msgstr ""
#: evolume.cpp:286
msgid "About"
msgstr ""
#: evolume.cpp:406
#, c-format
msgid ""
"Opening mixer device %s failed. Setup correct device in configuration dialog."
msgstr ""
#: prefs.cpp:66
msgid "Sound device"
msgstr ""
#: prefs.cpp:68
msgid "Device name:"
msgstr ""
#: prefs.cpp:80
msgid "&OK"
msgstr ""
#: prefs.cpp:84
msgid "&Cancel"
msgstr ""

78
evolume/locale/ru.po Executable file
View File

@ -0,0 +1,78 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-04 11:54+0100\n"
"PO-Revision-Date: 2002-11-28 HO:MI+ZONE\n"
"Last-Translator: aabbvv <null@list.ru>\n"
"Language-Team: RUSSIAN <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=koi8-r\n"
"Content-Transfer-Encoding: 8bit\n"
#: evolume.cpp:158
msgid "Cannot setup device, sorry."
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
#: evolume.cpp:256
#, c-format
msgid "Volume control: [%s]"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: [%s]"
#: evolume.cpp:269
msgid "Volume control"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#: evolume.cpp:274
msgid "&File"
msgstr "<22><><EFBFBD><EFBFBD>"
#: evolume.cpp:275 prefs.cpp:63
msgid "Preferencies"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#: evolume.cpp:279
msgid "Quit"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>"
#: evolume.cpp:285
msgid "&Help"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#: evolume.cpp:286
msgid "About"
msgstr "<22> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#: evolume.cpp:406
#, c-format
msgid ""
"Opening mixer device %s failed. Setup correct device in configuration dialog."
msgstr ""
"<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
#: prefs.cpp:66
msgid "Sound device"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#: prefs.cpp:68
msgid "Device name:"
msgstr "<22><><EFBFBD>:"
#: prefs.cpp:80
msgid "&OK"
msgstr "&OK"
#: prefs.cpp:84
msgid "&Cancel"
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#~ msgid "About Volume control"
#~ msgstr "<22> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
#~ msgid "&Close"
#~ msgstr "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"

102
evolume/locale/sk.po Executable file
View File

@ -0,0 +1,102 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: evolume 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-04 11:54+0100\n"
"PO-Revision-Date: 2002-04-21 14:50+0200\n"
"Last-Translator: Martin Pekar <cortex@nextra.sk>\n"
"Language-Team: Slovak <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: evolume.cpp:158
msgid "Cannot setup device, sorry."
msgstr "Nemôžem nastaviť zariadenie, ľutujem."
#: evolume.cpp:256
#, c-format
msgid "Volume control: [%s]"
msgstr "Ovládanie hlasitosti: [%s]"
#: evolume.cpp:269
msgid "Volume control"
msgstr "Ovládanie hlasitosti"
#: evolume.cpp:274
msgid "&File"
msgstr "&Súbor"
#: evolume.cpp:275 prefs.cpp:63
msgid "Preferencies"
msgstr "Nastavenia"
#: evolume.cpp:279
msgid "Quit"
msgstr "Koniec"
#: evolume.cpp:285
msgid "&Help"
msgstr "&Nápoveda"
#: evolume.cpp:286
msgid "About"
msgstr "O programe"
#: evolume.cpp:406
#, c-format
msgid ""
"Opening mixer device %s failed. Setup correct device in configuration dialog."
msgstr ""
"Otvorenie zariadenia mixéra %s zlyhalo. Nastavte správne zariadenie v "
"konfiguračnom dialógu."
#: prefs.cpp:66
msgid "Sound device"
msgstr "Zvukové zariadenie"
#: prefs.cpp:68
msgid "Device name:"
msgstr "Meno zariadenia:"
#: prefs.cpp:80
msgid "&OK"
msgstr "&OK"
#: prefs.cpp:84
msgid "&Cancel"
msgstr "&Zrušiť"
#~ msgid "About Volume control"
#~ msgstr "O Ovládaní hlasitosti"
#~ msgid "&Close"
#~ msgstr "&Zavrieť"
#~ msgid ""
#~ "This program is based in part on the work of FLTK project (www.fltk.org). "
#~ "This program is free software, you can redistribute it and/or modify it "
#~ "under the terms of 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 Licence along with this program; if not, write to the "
#~ "Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA"
#~ msgstr ""
#~ "Tento program je z časti založený na práci projektu FLTK (www.fltk.org)."
#~ "Tento program je voľný softvér, môžete ho redistribuovať a/alebo "
#~ "modifikovať podľa podmienok licencie GNU General Public License "
#~ "publikovanej nadáciou the Free Software Foundation, buď verzie 2 tejto "
#~ "licencie, alebo (podľa vášho uváženia) ľubovoľnej novšej verzie. Tento "
#~ "program je distribuovaný v nádeji, že bude užitočný, ale BEZ AKEJKOĽVEK "
#~ "ZÁRUKY; dokonca bez obsiahnutej záruky OBCHODOVATEĽNOSTI alebo VÝHOD PRE "
#~ "URČITÝ ÚČEL. Ďalšie podrobnosti hľadajte v licencii GNU General Public "
#~ "License. S týmto programom by ste mali dostať kópiu licencie GNU General "
#~ "Public Licence; ak nie, napíšte do nadácie the Free Software Foundation, "
#~ "Inc., 675 Mass Ave, Cambridge, MA 02139, USA."

115
evolume/prefs.cpp Executable file
View File

@ -0,0 +1,115 @@
/*
* $Id$
*
* Volume control application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2006 EDE Authors.
*
* This program is licenced under terms of the
* GNU General Public Licence version 2 or newer.
* See COPYING for details.
*/
#include "prefs.h"
#include <malloc.h>
#include <fltk/Item.h>//#include <efltk/Fl_Item.h>
#include <fltk/filename.h>//#include <efltk/filename.h>
#include "../edelib2/NLS.h"//#include <efltk/Fl_Locale.h>
#include "../edelib2/Config.h"//#include <efltk/Fl_Config.h>
using namespace fltk;
using namespace edelib;
extern char device[1024];
extern int mixer_device;
void choice_items(char *path) {
Item *new_Item;
dirent **files;
int num_Files = 0;
num_Files = filename_list(path, &files);
if (num_Files > 0) {
for (int i = 0; i < num_Files; i ++) {
if (strcmp(files[i]->d_name, ".") != 0 &&
strcmp(files[i]->d_name, "..") != 0) {
char filename[PATH_MAX];
snprintf(filename, sizeof(filename)-1, "%s/%s", path, files[i]->d_name);
struct stat s;
if (!stat(filename, &s)==0) break;
if (!S_ISDIR(s.st_mode) && strncmp(files[i]->d_name, "mixer", 5)==0) {
new_Item = new Item();
new_Item->copy_label(filename);
}
}
free(files[i]);
}
free(files);
}
}
Window* preferencesWindow;
InputBrowser* deviceNameInput;
static void cb_OK(Button*, void*) {
Config globalConfig("EDE Team", "evolume");
globalConfig.set("Sound mixer", "Device", deviceNameInput->value());
snprintf(device, sizeof(device)-1, "%s", (char*)deviceNameInput->value());
mixer_device = open(device, O_RDWR);
update_info();
preferencesWindow->hide();
}
static void cb_Cancel(Button*, void*) {
preferencesWindow->hide();
}
void PreferencesDialog(Widget *, void *) {
Window* w;
{Window* o = preferencesWindow = new Window(265, 290, _("Preferences"));
w = o;
preferencesWindow->begin();
{TabGroup* o = new TabGroup(10, 10, 245, 240);
o->begin();
{Group* o = new Group(0, 25, 255, 215, _("Sound device"));
o->align(ALIGN_TOP | ALIGN_LEFT);
o->begin();
{InputBrowser* o = deviceNameInput = new InputBrowser(10, 30, 155, 25, _("Device name:"));
o->begin();
o->align(ALIGN_TOP | ALIGN_LEFT);
o->text(device);
choice_items("/dev");
choice_items("/dev/sound");
o->end();
}
o->end();
}
o->end();
o->selection_color(o->color());
o->selection_textcolor(o->textcolor());
}
{Button* o = new Button(65, 255, 90, 25, _("&OK"));
o->callback((Callback*)cb_OK);
}
{Button* o = new Button(165, 255, 90, 25, _("&Cancel"));
o->callback((Callback*)cb_Cancel);
}
o->end();
}
preferencesWindow->end();
preferencesWindow->set_modal();
preferencesWindow->show();
}

132
evolume/prefs.fld Executable file
View File

@ -0,0 +1,132 @@
# data file for the FLTK User Interface Designer (FLUID)
version 2,0003
images_dir ./
i18n
header_name {.h}
code_name {.cpp}
gridx 5
gridy 5
snap 3
decl {// Volume control for EDE is (C) Copyright 2000-2002 by Martin Pekar, this program is provided under the terms of GNU GPL v.2, see file COPYING for more information.} {}
decl {\#include <malloc.h>} {}
decl {\#include <efltk/Fl_Item.h>} {selected
}
decl {\#include <efltk/filename.h>} {}
decl {\#include <efltk/Fl_Locale.h>} {}
decl {\#include <efltk/Fl_Config.h>} {}
decl {extern char device[1024];} {}
decl {extern int mixer_device;} {}
Function {choice_items(char *path)} {return_type void
} {
code {Fl_Item *new_Item;
dirent **files;
int num_Files = 0;
num_Files = fl_filename_list(path, &files);
if (num_Files > 0) {
for (int i = 0; i < num_Files; i ++) {
if (strcmp(files[i]->d_name, ".") != 0 &&
strcmp(files[i]->d_name, "..") != 0) {
char filename[FL_PATH_MAX];
snprintf(filename, sizeof(filename)-1, "%s/%s", path, files[i]->d_name);
if (!fl_is_dir(filename) && fl_file_match(files[i]->d_name, "mixer*")) {
new_Item = new Fl_Item();
new_Item->copy_label(filename);
}
}
free(files[i]);
}
free(files);
}} {}
}
Function {PreferencesDialog(Fl_Widget *, void *)} {return_type void
} {
Fl_Window preferenciesWindow {
label Preferencies open
xywh {249 86 265 289} hide
} {
Fl_Tabs {} {open
xywh {5 5 255 245}
} {
Fl_Group {} {
label {Sound device} open
private xywh {0 23 255 221} align 5
} {
Fl_Input_Browser deviceNameInput {
label {Device name:} open
xywh {90 27 155 23} align 132
extra_code {\#include <efltk/Fl_Input_Browser.h>
o->value(device);
choice_items("/dev");
choice_items("/dev/sound");}
class Fl_Input_Browser
} {}
}
}
Fl_Button {} {
label {&OK}
callback {Fl_Config globalConfig("EDE Team", "evolume");
globalConfig.set("Sound mixer", "Device", deviceNameInput->value());
snprintf(device, sizeof(device)-1, "%s", (char*)deviceNameInput->value());
mixer_device = open(device, O_RDWR);
update_info();
preferenciesWindow->hide();}
private xywh {95 260 80 25}
extra_code {\#include <fcntl.h>
extern void update_info();}
}
Fl_Button {} {
label {&Cancel}
callback {preferenciesWindow->hide();}
private xywh {180 260 80 25}
}
}
code {preferenciesWindow->end();
preferenciesWindow->show();} {}
}
Function {AboutDialog(Fl_Widget *, void *)} {return_type void
} {
Fl_Window aboutWindow {
label {About Volume control} open
xywh {270 82 285 301} hide
} {
Fl_Button {} {
label {&Close}
callback {aboutWindow->hide();}
private xywh {110 270 80 25}
}
Fl_Box {} {
label {Volume control for Equinox Desktop Environment v. 1.0}
private xywh {5 5 275 45} align 145 label_size 18
}
Fl_Box {} {
label {This program is based in part on the work of FLTK project (www.fltk.org). This program is free software, you can redistribute it and/or modify it under the terms of 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 Licence along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA}
xywh {5 75 275 185} align 145 label_size 10
extra_code {;}
}
Fl_Box {} {
label {(C) Copyright 2000-2002 by Martin Pekar}
xywh {5 50 275 25}
}
}
code {aboutWindow->end();
aboutWindow->show();} {}
}

28
evolume/prefs.h Executable file
View File

@ -0,0 +1,28 @@
/*
* $Id$
*
* Volume control application
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2000-2006 EDE Authors.
*
* This program is licenced under terms of the
* GNU General Public Licence version 2 or newer.
* See COPYING for details.
*/
#ifndef prefs_h
#define prefs_h
//#include <efltk/Fl.h>
#include "../edelib2/NLS.h" //#include <efltk/Fl_Locale.h>
void choice_items(char *path);
#include <fltk/Window.h>//#include <efltk/Fl_Window.h>
extern fltk::Window* preferencesWindow;
#include <fltk/TabGroup.h>//#include <efltk/Fl_Tabs.h>
#include <fltk/Group.h>//#include <efltk/Fl_Group.h>
#include <fltk/InputBrowser.h>//#include <efltk/Fl_Input_Browser.h>
extern fltk::InputBrowser* deviceNameInput;
#include <fltk/Button.h>//#include <efltk/Fl_Button.h>
#include <fcntl.h>
extern void update_info();
void PreferencesDialog(fltk::Widget *, void *);
#endif