gdSampleEditor::gdSampleEditor(m::SampleChannel* ch) : gdWindow(640, 480), ch(ch) { using namespace giada::m; Fl_Group* upperBar = createUpperBar(); waveTools = new geWaveTools(G_GUI_OUTER_MARGIN, upperBar->y()+upperBar->h()+G_GUI_OUTER_MARGIN, w()-16, h()-128, ch); Fl_Group* bottomBar = createBottomBar(G_GUI_OUTER_MARGIN, waveTools->y()+waveTools->h()+G_GUI_OUTER_MARGIN, h()-waveTools->h()-upperBar->h()-32); add(upperBar); add(waveTools); add(bottomBar); resizable(waveTools); u::gui::setFavicon(this); set_non_modal(); copy_label(ch->name.c_str()); size_range(720, 480); if (conf::sampleEditorX) resize(conf::sampleEditorX, conf::sampleEditorY, conf::sampleEditorW, conf::sampleEditorH); show(); }
void Keyboard::updateChannels(char side) { Fl_Group *group; gClick *add; if (side == 0) { group = gChannelsL; add = addChannelL; } else { group = gChannelsR; add = addChannelR; } //printf("[keyboard::updateChannels] side %d has %d widgets\n", side, group->children()); for (int i=0; i<group->children(); i++) { gChannel *gch = (gChannel*) group->child(i); gch->position(gch->x(), group->y()+(i*24)); } group->size(group->w(), group->children()*24); add->position(add->x(), group->y()+group->h()); redraw(); }
Fl_Group* gdSampleEditor::createPreviewBox(int x, int y, int h) { Fl_Group* g = new Fl_Group(x, y, 110, h); g->begin(); rewind = new geButton(g->x(), g->y()+(g->h()/2)-12, 25, 25, "", rewindOff_xpm, rewindOn_xpm); play = new geButton(rewind->x()+rewind->w()+4, g->y()+(g->h()/2)-12, 25, 25, "", play_xpm, pause_xpm); loop = new geCheck(play->x()+play->w()+6, g->y()+(g->h()/2)-6, 12, 12, "Loop"); g->end(); play->callback(cb_togglePreview, (void*)this); rewind->callback(cb_rewindPreview, (void*)this); ch->onPreviewEnd = [this] { play->value(0); }; return g; }
Fl_Group* gdSampleEditor::createBottomBar(int x, int y, int h) { Fl_Group* g = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, h); g->begin(); Fl_Group* previewBox = createPreviewBox(g->x(), g->y(), g->h()); geBox* divisor1 = new geBox(previewBox->x()+previewBox->w()+8, g->y(), 1, g->h()); divisor1->box(FL_BORDER_BOX); Fl_Group* opTools = createOpTools(divisor1->x()+divisor1->w()+12, g->y(), g->h()); geBox* divisor2 = new geBox(opTools->x()+opTools->w()+8, g->y(), 1, g->h()); divisor2->box(FL_BORDER_BOX); createInfoBox(divisor2->x()+divisor2->w()+8, g->y(), g->h()); g->end(); g->resizable(0); return g; }
Fl_Group* gdSampleEditor::createInfoBox(int x, int y, int h) { Fl_Group* g = new Fl_Group(x, y, 400, h); g->begin(); info = new geBox(g->x(), g->y(), g->w(), g->h()); g->end(); info->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_TOP); updateInfo(); return g; }
uiBasis:: uiBasis( Fl_Group &tabs, const BasisInfo &bi ) : name( bi.name ), group( new Fl_Group( tabs.x(), tabs.y()+24, tabs.w(), tabs.h()-24, bi.name.c_str() ) ), input() { //-------------------------------------------------------------------------- // record the new tab //-------------------------------------------------------------------------- tabs.add(group); group->labelfont( FL_COURIER ); group->labelsize( 14 ); static const int bh = 23; //-------------------------------------------------------------------------- // create the parameters //-------------------------------------------------------------------------- const int h = group->h(); const size_t nb = bi.param.size(); const int hfree = h - nb * bh; const int hskip = hfree/(nb+1); int y = group->y(); const int x = group->x() + 8; for( size_t i=1; i <= nb; ++i ) { y += hskip; const string ¶m = bi.param[i]; Fl_Input *box = new Fl_Input(x,y,100,bh,param.c_str()); box->input_type(FL_FLOAT_INPUT); box->labeltype( FL_NORMAL_LABEL ); box->align(FL_ALIGN_RIGHT); box->labelfont(FL_HELVETICA); box->labelsize(12); box->textsize(12); box->textfont(FL_HELVETICA); group->add(box); box->value("0.0"); y += bh; input.push_back(box); box->callback(ChangeCB); box->when(FL_WHEN_RELEASE); } }
//callback for add Community void OnAddCommunity(Fl_Widget* pWidget,void * pParam) { const char * scName=fl_input("New Community Name", ""); if(scName==NULL) return ; char * sName = new char[strlen(scName)*2]; strcpy(sName,scName); Fl_Tabs* pTab = (Fl_Tabs*)(pParam); Fl_Group* pG = (Fl_Group*)pTab->value(); pTab->begin(); MakeCommunityPane(10,30,pG->w()-20,pG->h()-10,sName); pTab->end(); }
gChannel *Keyboard::addChannel(char side, Channel *ch) { Fl_Group *group; gClick *add; if (side == 0) { group = gChannelsL; add = addChannelL; } else { group = gChannelsR; add = addChannelR; } gChannel *gch = NULL; if (ch->type == CHANNEL_SAMPLE) gch = (gSampleChannel*) new gSampleChannel( group->x(), group->y() + group->children() * 24, group->w(), 20, (SampleChannel*) ch); else gch = (gMidiChannel*) new gMidiChannel( group->x(), group->y() + group->children() * 24, group->w(), 20, (MidiChannel*) ch); group->add(gch); group->size(group->w(), group->children() * 24); add->position(group->x(), group->y()+group->h()); fixRightColumn(); redraw(); return gch; }
gdEditor::gdEditor(SampleChannel *ch) : gWindow(640, 480), ch(ch) { set_non_modal(); if (G_Conf.sampleEditorX) resize(G_Conf.sampleEditorX, G_Conf.sampleEditorY, G_Conf.sampleEditorW, G_Conf.sampleEditorH); /* top bar: grid and zoom tools */ Fl_Group *bar = new Fl_Group(8, 8, w()-16, 20); bar->begin(); grid = new gChoice(bar->x(), bar->y(), 50, 20); snap = new gCheck(grid->x()+grid->w()+4, bar->y()+4, 12, 12); zoomOut = new gClick(bar->x()+bar->w()-20, bar->y(), 20, 20, "", zoomOutOff_xpm, zoomOutOn_xpm); zoomIn = new gClick(zoomOut->x()-24, bar->y(), 20, 20, "", zoomInOff_xpm, zoomInOn_xpm); bar->end(); bar->resizable(new gBox(grid->x()+grid->w()+4, bar->y(), 80, bar->h())); /* waveform */ waveTools = new gWaveTools(8, 36, w()-16, h()-120, ch); waveTools->end(); /* other tools */ Fl_Group *tools = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, 130); tools->begin(); volume = new gDial (tools->x()+50, tools->y(), 20, 20, "Volume"); volumeNum = new gInput(volume->x()+volume->w()+4, tools->y(), 46, 20, "dB"); boost = new gDial (volumeNum->x()+volumeNum->w()+108, tools->y(), 20, 20, "Boost"); boostNum = new gInput(boost->x()+boost->w()+4, tools->y(), 44, 20, "dB"); normalize = new gClick(boostNum->x()+boostNum->w()+54, tools->y(), 70, 20, "Normalize"); pan = new gDial (normalize->x()+normalize->w()+40, tools->y(), 20, 20, "Pan"); panNum = new gInput(pan->x()+pan->w()+4, tools->y(), 45, 20, "%"); pitch = new gDial (tools->x()+50, volume->y()+volume->h()+4, 20, 20, "Pitch"); pitchNum = new gInput(pitch->x()+pitch->w()+4, volume->y()+volume->h()+4, 46, 20); pitchToBar = new gClick(pitchNum->x()+pitchNum->w()+4, volume->y()+volume->h()+4, 60, 20, "To bar"); pitchToSong = new gClick(pitchToBar->x()+pitchToBar->w()+4, volume->y()+volume->h()+4, 60, 20, "To song"); pitchHalf = new gClick(pitchToSong->x()+pitchToSong->w()+4, volume->y()+volume->h()+4, 20, 20, "", divideOff_xpm, divideOn_xpm); pitchDouble = new gClick(pitchHalf->x()+pitchHalf->w()+4, volume->y()+volume->h()+4, 20, 20, "", multiplyOff_xpm, multiplyOn_xpm); pitchReset = new gClick(pitchDouble->x()+pitchDouble->w()+4, volume->y()+volume->h()+4, 46, 20, "Reset"); reload = new gClick(pitchReset->x()+pitchReset->w()+4, volume->y()+volume->h()+4, 70, 20, "Reload"); chanStart = new gInput(tools->x()+60, pitch->y()+pitch->h()+4, 60, 20, "Range"); chanEnd = new gInput(chanStart->x()+chanStart->w()+4, pitch->y()+pitch->h()+4, 60, 20, ""); resetStartEnd = new gClick(chanEnd->x()+chanEnd->w()+4, pitch->y()+pitch->h()+4, 60, 20, "Reset"); tools->end(); tools->resizable(new gBox(panNum->x()+panNum->w()+4, tools->y(), 80, tools->h())); /* grid tool setup */ grid->add("(off)"); grid->add("2"); grid->add("3"); grid->add("4"); grid->add("6"); grid->add("8"); grid->add("16"); grid->add("32"); grid->add("64"); grid->value(G_Conf.sampleEditorGridVal); grid->callback(cb_changeGrid, (void*)this); snap->value(G_Conf.sampleEditorGridOn); snap->callback(cb_enableSnap, (void*)this); /* TODO - redraw grid if != (off) */ char buf[16]; sprintf(buf, "%d", ch->begin / 2); // divided by 2 because stereo chanStart->value(buf); chanStart->type(FL_INT_INPUT); chanStart->callback(cb_setChanPos, this); /* inputs callback: fire when they lose focus or Enter is pressed. */ chanStart->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); chanEnd ->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); sprintf(buf, "%d", ch->end / 2); // divided by 2 because stereo chanEnd->value(buf); chanEnd->type(FL_INT_INPUT); chanEnd->callback(cb_setChanPos, this); resetStartEnd->callback(cb_resetStartEnd, this); volume->callback(cb_setVolume, (void*)this); volume->value(ch->guiChannel->vol->value()); float dB = 20*log10(ch->volume); // dB = 20*log_10(linear value) if (dB > -INFINITY) sprintf(buf, "%.2f", dB); else sprintf(buf, "-inf"); volumeNum->value(buf); volumeNum->align(FL_ALIGN_RIGHT); volumeNum->callback(cb_setVolumeNum, (void*)this); boost->range(1.0f, 10.0f); boost->callback(cb_setBoost, (void*)this); if (ch->boost > 10.f) boost->value(10.0f); else boost->value(ch->boost); boost->when(FL_WHEN_CHANGED | FL_WHEN_RELEASE); float boost = 20*log10(ch->boost); // dB = 20*log_10(linear value) sprintf(buf, "%.2f", boost); boostNum->value(buf); boostNum->align(FL_ALIGN_RIGHT); boostNum->callback(cb_setBoostNum, (void*)this); normalize->callback(cb_normalize, (void*)this); pan->range(0.0f, 2.0f); pan->callback(cb_panning, (void*)this); pitch->range(0.01f, 4.0f); pitch->value(ch->pitch); pitch->callback(cb_setPitch, (void*)this); pitch->when(FL_WHEN_RELEASE); sprintf(buf, "%.4f", ch->pitch); // 4 digits pitchNum->value(buf); pitchNum->align(FL_ALIGN_RIGHT); pitchNum->callback(cb_setPitchNum, (void*)this); pitchNum->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); pitchToBar->callback(cb_setPitchToBar, (void*)this); pitchToSong->callback(cb_setPitchToSong, (void*)this); pitchHalf->callback(cb_setPitchHalf, (void*)this); pitchDouble->callback(cb_setPitchDouble, (void*)this); pitchReset->callback(cb_resetPitch, (void*)this); reload->callback(cb_reload, (void*)this); zoomOut->callback(cb_zoomOut, (void*)this); zoomIn->callback(cb_zoomIn, (void*)this); /* logical samples (aka takes) cannot be reloaded. So far. */ if (ch->wave->isLogical) reload->deactivate(); if (ch->panRight < 1.0f) { char buf[8]; sprintf(buf, "%d L", (int) std::abs((ch->panRight * 100.0f) - 100)); pan->value(ch->panRight); panNum->value(buf); } else if (ch->panRight == 1.0f && ch->panLeft == 1.0f) { pan->value(1.0f); panNum->value("C"); } else { char buf[8]; sprintf(buf, "%d R", (int) std::abs((ch->panLeft * 100.0f) - 100)); pan->value(2.0f - ch->panLeft); panNum->value(buf); } panNum->align(FL_ALIGN_RIGHT); panNum->readonly(1); panNum->cursor_color(FL_WHITE); gu_setFavicon(this); size_range(640, 480); resizable(waveTools); label(ch->wave->name.c_str()); show(); }
gdEditor::gdEditor(SampleChannel *ch) : gWindow(640, 480), ch(ch) { set_non_modal(); if (G_Conf.sampleEditorX) resize(G_Conf.sampleEditorX, G_Conf.sampleEditorY, G_Conf.sampleEditorW, G_Conf.sampleEditorH); Fl_Group *bar = new Fl_Group(8, 8, w()-16, 20); bar->begin(); reload = new gClick(bar->x(), bar->y(), 50, 20, "Reload"); zoomOut = new gClick(bar->x()+bar->w()-20, bar->y(), 20, 20, "-"); zoomIn = new gClick(zoomOut->x()-24, bar->y(), 20, 20, "+"); bar->end(); bar->resizable(new gBox(reload->x()+reload->w()+4, bar->y(), 80, bar->h())); waveTools = new gWaveTools(8, 36, w()-16, h()-120, ch); waveTools->end(); Fl_Group *tools = new Fl_Group(8, waveTools->y()+waveTools->h()+8, w()-16, 130); tools->begin(); volume = new gDial (tools->x()+42, tools->y(), 20, 20, "Volume"); volumeNum = new gInput(volume->x()+volume->w()+4, tools->y(), 46, 20, "dB"); boost = new gDial (volumeNum->x()+volumeNum->w()+80, tools->y(), 20, 20, "Boost"); boostNum = new gInput(boost->x()+boost->w()+4, tools->y(), 46, 20, "dB"); normalize = new gClick(boostNum->x()+boostNum->w()+40, tools->y(), 70, 20, "Normalize"); pan = new gDial (normalize->x()+normalize->w()+40, tools->y(), 20, 20, "Pan"); panNum = new gInput(pan->x()+pan->w()+4, tools->y(), 45, 20, "%"); pitch = new gDial (tools->x()+42, volume->y()+volume->h()+4, 20, 20, "Pitch"); pitchNum = new gInput (pitch->x()+pitch->w()+4, volume->y()+volume->h()+4, 46, 20); pitchToBar = new gClick (pitchNum->x()+pitchNum->w()+4, volume->y()+volume->h()+4, 46, 20, "To bar"); pitchToSong = new gClick (pitchToBar->x()+pitchToBar->w()+4, volume->y()+volume->h()+4, 46, 20, "To song"); pitchReset = new gClick (pitchToSong->x()+pitchToSong->w()+4, volume->y()+volume->h()+4, 46, 20, "Reset"); chanStart = new gInput(tools->x()+52, pitch->y()+pitch->h()+4, 60, 20, "Start"); chanEnd = new gInput(chanStart->x()+chanStart->w()+40, pitch->y()+pitch->h()+4, 60, 20, "End"); resetStartEnd = new gClick(chanEnd->x()+chanEnd->w()+4, pitch->y()+pitch->h()+4, 46, 20, "Reset"); tools->end(); tools->resizable(new gBox(chanStart->x()+chanStart->w()+4, tools->y(), 80, tools->h())); char buf[16]; ///sprintf(buf, "%d", ch->beginTrue / 2); // divided by 2 because stereo sprintf(buf, "%d", ch->begin / 2); // divided by 2 because stereo chanStart->value(buf); chanStart->type(FL_INT_INPUT); chanStart->callback(cb_setChanPos, this); /* inputs callback: fire when they lose focus or Enter is pressed. */ chanStart->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); chanEnd ->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); ///sprintf(buf, "%d", ch->endTrue / 2); // divided by 2 because stereo sprintf(buf, "%d", ch->end / 2); // divided by 2 because stereo chanEnd->value(buf); chanEnd->type(FL_INT_INPUT); chanEnd->callback(cb_setChanPos, this); resetStartEnd->callback(cb_resetStartEnd, this); volume->callback(cb_setVolume, (void*)this); volume->value(ch->guiChannel->vol->value()); float dB = 20*log10(ch->volume); // dB = 20*log_10(linear value) if (dB > -INFINITY) sprintf(buf, "%.2f", dB); else sprintf(buf, "-inf"); volumeNum->value(buf); volumeNum->align(FL_ALIGN_RIGHT); volumeNum->callback(cb_setVolumeNum, (void*)this); boost->range(1.0f, 10.0f); boost->callback(cb_setBoost, (void*)this); if (ch->boost > 10.f) boost->value(10.0f); else boost->value(ch->boost); boost->when(FL_WHEN_CHANGED | FL_WHEN_RELEASE); float boost = 20*log10(ch->boost); // dB = 20*log_10(linear value) sprintf(buf, "%.2f", boost); boostNum->value(buf); boostNum->align(FL_ALIGN_RIGHT); boostNum->callback(cb_setBoostNum, (void*)this); normalize->callback(cb_normalize, (void*)this); pan->range(0.0f, 2.0f); pan->callback(cb_panning, (void*)this); pitch->range(0.01f, 4.0f); pitch->value(ch->pitch); pitch->callback(cb_setPitch, (void*)this); pitch->when(FL_WHEN_RELEASE); sprintf(buf, "%.4f", ch->pitch); // 4 digits pitchNum->value(buf); pitchNum->align(FL_ALIGN_RIGHT); pitchNum->callback(cb_setPitchNum, (void*)this); pitchNum->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); pitchToBar->callback(cb_setPitchToBar, (void*)this); pitchToSong->callback(cb_setPitchToSong, (void*)this); pitchReset->callback(cb_resetPitch, (void*)this); reload->callback(cb_reload, (void*)this); zoomOut->callback(cb_zoomOut, (void*)this); zoomIn->callback(cb_zoomIn, (void*)this); /* logical samples (aka takes) cannot be reloaded. So far. */ if (ch->wave->isLogical) reload->deactivate(); if (ch->panRight < 1.0f) { char buf[8]; sprintf(buf, "%d L", abs((ch->panRight * 100.0f) - 100)); pan->value(ch->panRight); panNum->value(buf); } else if (ch->panRight == 1.0f && ch->panLeft == 1.0f) { pan->value(1.0f); panNum->value("C"); } else { char buf[8]; sprintf(buf, "%d R", abs((ch->panLeft * 100.0f) - 100)); pan->value(2.0f - ch->panLeft); panNum->value(buf); } panNum->align(FL_ALIGN_RIGHT); panNum->readonly(1); panNum->cursor_color(FL_WHITE); gu_setFavicon(this); size_range(640, 480); resizable(waveTools); label(ch->wave->name.c_str()); show(); }
gdMidiInputMaster::gdMidiInputMaster() : gdMidiInputBase(0, 0, 300, 284, "MIDI Input Setup (global)") { set_modal(); Fl_Group* groupHeader = new Fl_Group(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w(), 20); groupHeader->begin(); enable = new geCheck(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT, "enable MIDI input"); channel = new geChoice(enable->x()+enable->w()+44, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT); groupHeader->resizable(nullptr); groupHeader->end(); Fl_Pack* pack = new Fl_Pack(G_GUI_OUTER_MARGIN, groupHeader->y()+groupHeader->h()+G_GUI_OUTER_MARGIN, LEARNER_WIDTH, 212); pack->spacing(G_GUI_INNER_MARGIN); pack->begin(); new geMidiLearner(0, 0, LEARNER_WIDTH, "rewind", &cb_learn, &conf::midiInRewind, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "play/stop", &cb_learn, &conf::midiInStartStop, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "action recording", &cb_learn, &conf::midiInActionRec, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "input recording", &cb_learn, &conf::midiInInputRec, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "metronome", &cb_learn, &conf::midiInMetronome, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "input volume", &cb_learn, &conf::midiInVolumeIn, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "output volume", &cb_learn, &conf::midiInVolumeOut, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ×2", &cb_learn, &conf::midiInBeatDouble, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ÷2", &cb_learn, &conf::midiInBeatHalf, nullptr); pack->end(); ok = new geButton(w()-88, pack->y()+pack->h()+G_GUI_OUTER_MARGIN, 80, G_GUI_UNIT, "Close"); end(); ok->callback(cb_close, (void*)this); enable->value(conf::midiIn); enable->callback(cb_enable, (void*)this); channel->add("Channel (any)"); channel->add("Channel 1"); channel->add("Channel 2"); channel->add("Channel 3"); channel->add("Channel 4"); channel->add("Channel 5"); channel->add("Channel 6"); channel->add("Channel 7"); channel->add("Channel 8"); channel->add("Channel 9"); channel->add("Channel 10"); channel->add("Channel 11"); channel->add("Channel 12"); channel->add("Channel 13"); channel->add("Channel 14"); channel->add("Channel 15"); channel->add("Channel 16"); channel->value(conf::midiInFilter -1 ? 0 : conf::midiInFilter + 1); channel->callback(cb_setChannel, (void*)this); u::gui::setFavicon(this); show(); }
gdActionEditor::gdActionEditor(channel *chan) : gWindow(640, 284), chan(chan), zoom(100) { if (G_Conf.actionEditorW) { resize(G_Conf.actionEditorX, G_Conf.actionEditorY, G_Conf.actionEditorW, G_Conf.actionEditorH); zoom = G_Conf.actionEditorZoom; } /* compute values */ calc(); /* container with zoom buttons and the action type selector. Scheme of * the resizable boxes: |[--b1--][actionType][--b2--][+][-]| */ Fl_Group *upperArea = new Fl_Group(8, 8, w()-16, 20); upperArea->begin(); if (chan->type == CHANNEL_SAMPLE) { actionType = new gChoice(8, 8, 80, 20); gridTool = new gGridTool(actionType->x()+actionType->w()+4, 8, this); } else gridTool = new gGridTool(8, 8, this); gBox *b1 = new gBox(gridTool->x()+gridTool->w()+4, 8, 300, 20); // padding actionType - zoomButtons zoomIn = new gClick(w()-8-40-4, 8, 20, 20, "+"); zoomOut = new gClick(w()-8-20, 8, 20, 20, "-"); upperArea->end(); upperArea->resizable(b1); if (chan->type == CHANNEL_SAMPLE) { actionType->add("key press"); actionType->add("key release"); actionType->add("kill chan"); actionType->value(0); } gridTool->init(G_Conf.actionEditorGridVal, G_Conf.actionEditorGridOn); gridTool->calc(); if (chan->type == CHANNEL_SAMPLE && (chan->mode == SINGLE_PRESS || chan->mode & LOOP_ANY)) actionType->deactivate(); zoomIn->callback(cb_zoomIn, (void*)this); zoomOut->callback(cb_zoomOut, (void*)this); /* main scroller: contains all widgets */ scroller = new gScroll(8, 36, this->w()-16, this->h()-44); if (chan->type == CHANNEL_SAMPLE) { ac = new gActionChannel (scroller->x(), upperArea->y()+upperArea->h()+8, this); mc = new gMuteChannel (scroller->x(), ac->y()+ac->h()+8, this); vc = new gEnvelopeChannel (scroller->x(), mc->y()+mc->h()+8, this, ACTION_VOLUME, RANGE_FLOAT, "volume"); scroller->add(ac); //scroller->add(new gResizerBar(ac->x(), ac->y()+ac->h(), scroller->w(), 8)); scroller->add(mc); //scroller->add(new gResizerBar(mc->x(), mc->y()+mc->h(), scroller->w(), 8)); scroller->add(vc); //scroller->add(new gResizerBar(vc->x(), vc->y()+vc->h(), scroller->w(), 8)); /* fill volume envelope with actions from recorder */ vc->fill(); /* if channel is LOOP_ANY, deactivate it: a loop mode channel cannot * hold keypress/keyrelease actions */ if (chan->mode & LOOP_ANY) ac->deactivate(); } else { pr = new gPianoRollContainer(scroller->x(), upperArea->y()+upperArea->h()+8, this); scroller->add(pr); scroller->add(new gResizerBar(pr->x(), pr->y()+pr->h(), scroller->w(), 8)); } end(); gu_setFavicon(this); char buf[256]; sprintf(buf, "Edit Actions in Channel %d", chan->index+1); label(buf); set_non_modal(); size_range(640, 284); resizable(scroller); show(); }
Fl_Double_Window* ResonanceUI::make_window() { { resonancewindow = new Fl_Double_Window(780, 305, "Resonance"); resonancewindow->user_data((void*)(this)); { khzvalue = new Fl_Value_Output(415, 264, 45, 18, "kHz"); khzvalue->labelsize(12); khzvalue->minimum(0.001); khzvalue->maximum(48); khzvalue->step(0.01); khzvalue->textfont(1); khzvalue->textsize(12); khzvalue->align(FL_ALIGN_RIGHT); //this widget must be before the calling widgets } // Fl_Value_Output* khzvalue { dbvalue = new Fl_Value_Output(415, 282, 45, 18, "dB"); dbvalue->labelsize(12); dbvalue->minimum(-150); dbvalue->maximum(150); dbvalue->step(0.1); dbvalue->textfont(1); dbvalue->textsize(12); dbvalue->align(FL_ALIGN_RIGHT); //this widget must be before the calling widgets } // Fl_Value_Output* dbvalue { Fl_Group* o = new Fl_Group(6, 5, 768, 256); o->box(FL_BORDER_BOX); rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),""); rg->init(respar,khzvalue,dbvalue); rg->show(); o->end(); } // Fl_Group* o { Fl_Button* o = new Fl_Button(690, 283, 84, 17, "Close"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)cb_Close); } // Fl_Button* o { Fl_Button* o = new Fl_Button(491, 264, 66, 15, "Zero"); o->tooltip("Clear the resonance function"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(12); o->callback((Fl_Callback*)cb_Zero); } // Fl_Button* o { Fl_Button* o = new Fl_Button(491, 282, 66, 18, "Smooth"); o->tooltip("Smooth the resonance function"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(12); o->callback((Fl_Callback*)cb_Smooth); } // Fl_Button* o { Fl_Check_Button* o = enabled = new Fl_Check_Button(6, 270, 78, 27, "Enable"); enabled->box(FL_THIN_UP_BOX); enabled->down_box(FL_DOWN_BOX); enabled->callback((Fl_Callback*)cb_enabled); o->value(respar->Penabled); } // Fl_Check_Button* enabled { maxdb = new Fl_Roller(90, 282, 84, 15); maxdb->type(1); maxdb->minimum(1); maxdb->maximum(90); maxdb->step(1); maxdb->value(30); maxdb->callback((Fl_Callback*)cb_maxdb); } // Fl_Roller* maxdb { Fl_Value_Output* o = maxdbvo = new Fl_Value_Output(126, 264, 24, 18, "Max."); maxdbvo->tooltip("The Maximum amplitude (dB)"); maxdbvo->labelsize(12); maxdbvo->minimum(1); maxdbvo->maximum(127); maxdbvo->step(1); maxdbvo->value(30); maxdbvo->textfont(1); maxdbvo->textsize(12); maxdbvo->callback((Fl_Callback*)cb_maxdbvo); o->value(respar->PmaxdB); } // Fl_Value_Output* maxdbvo { new Fl_Box(150, 264, 24, 18, "dB"); } // Fl_Box* o { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(210, 264, 33, 18, "C.f."); centerfreqvo->tooltip("Center Frequency (kHz)"); centerfreqvo->labelsize(12); centerfreqvo->minimum(1); centerfreqvo->maximum(10); centerfreqvo->step(0.01); centerfreqvo->value(1); centerfreqvo->textfont(1); centerfreqvo->textsize(12); centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo); centerfreqvo->when(3); o->value(respar->getcenterfreq()/1000.0); } // Fl_Value_Output* centerfreqvo { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(210, 282, 33, 18, "Oct."); octavesfreqvo->tooltip("No. of octaves"); octavesfreqvo->labelsize(12); octavesfreqvo->minimum(1); octavesfreqvo->maximum(127); octavesfreqvo->step(1); octavesfreqvo->value(30); octavesfreqvo->textfont(1); octavesfreqvo->textsize(12); octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo); octavesfreqvo->when(3); o->value(respar->getoctavesfreq()); } // Fl_Value_Output* octavesfreqvo { Fl_Button* o = new Fl_Button(566, 276, 42, 12, "RND2"); o->tooltip("Randomize the resonance function"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(10); o->callback((Fl_Callback*)cb_RND2); } // Fl_Button* o { Fl_Button* o = new Fl_Button(566, 264, 42, 12, "RND1"); o->tooltip("Randomize the resonance function"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(10); o->callback((Fl_Callback*)cb_RND1); } // Fl_Button* o { Fl_Button* o = new Fl_Button(566, 288, 42, 12, "RND3"); o->tooltip("Randomize the resonance function"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(10); o->callback((Fl_Callback*)cb_RND3); } // Fl_Button* o { Fl_Check_Button* o = p1st = new Fl_Check_Button(365, 285, 45, 15, "P.1st"); p1st->tooltip("Protect the fundamental frequency (do not damp the first harmonic)"); p1st->down_box(FL_DOWN_BOX); p1st->labelsize(10); p1st->callback((Fl_Callback*)cb_p1st); o->value(respar->Pprotectthefundamental); } // Fl_Check_Button* p1st { Fl_Button* o = new Fl_Button(365, 265, 46, 15, "InterpP"); o->tooltip("Interpolate the peaks"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(10); o->callback((Fl_Callback*)cb_InterpP); } // Fl_Button* o { WidgetPDial* o = centerfreq = new WidgetPDial(master, 245, 265, 30, 30, "C.f."); centerfreq->box(FL_ROUND_UP_BOX); centerfreq->color(FL_BACKGROUND_COLOR); centerfreq->selection_color(FL_INACTIVE_COLOR); centerfreq->labeltype(FL_NORMAL_LABEL); centerfreq->labelfont(0); centerfreq->labelsize(10); centerfreq->labelcolor(FL_FOREGROUND_COLOR); centerfreq->maximum(127); centerfreq->step(1); centerfreq->callback((Fl_Callback*)cb_centerfreq); centerfreq->align(FL_ALIGN_BOTTOM); centerfreq->when(FL_WHEN_CHANGED); o->value(respar->Pcenterfreq); } // WidgetPDial* centerfreq { WidgetPDial* o = octavesfreq = new WidgetPDial(master, 280, 265, 30, 30, "Oct."); octavesfreq->box(FL_ROUND_UP_BOX); octavesfreq->color(FL_BACKGROUND_COLOR); octavesfreq->selection_color(FL_INACTIVE_COLOR); octavesfreq->labeltype(FL_NORMAL_LABEL); octavesfreq->labelfont(0); octavesfreq->labelsize(10); octavesfreq->labelcolor(FL_FOREGROUND_COLOR); octavesfreq->maximum(127); octavesfreq->step(1); octavesfreq->callback((Fl_Callback*)cb_octavesfreq); octavesfreq->align(FL_ALIGN_BOTTOM); octavesfreq->when(FL_WHEN_CHANGED); o->value(respar->Poctavesfreq); } // WidgetPDial* octavesfreq { Fl_Button* o = new Fl_Button(625, 275, 25, 15, "C"); o->box(FL_THIN_UP_BOX); o->color((Fl_Color)179); o->labelfont(1); o->labelsize(11); o->labelcolor(FL_BACKGROUND2_COLOR); o->callback((Fl_Callback*)cb_C); } // Fl_Button* o { Fl_Button* o = new Fl_Button(655, 275, 25, 15, "P"); o->box(FL_THIN_UP_BOX); o->color((Fl_Color)179); o->labelfont(1); o->labelsize(11); o->labelcolor(FL_BACKGROUND2_COLOR); o->callback((Fl_Callback*)cb_P); } // Fl_Button* o { applybutton = new Fl_Button(690, 265, 85, 15, "Apply"); applybutton->box(FL_THIN_UP_BOX); applybutton->labelfont(1); applybutton->labelsize(11); applybutton->callback((Fl_Callback*)cb_applybutton); } // Fl_Button* applybutton resonancewindow->end(); } // Fl_Double_Window* resonancewindow return resonancewindow; }
void Fl_File_Dialog::make_group(int w, int h) { { Fl_Group* o = new Fl_Group(5, 5, w-10, 35); o->box(FL_THIN_UP_BOX); up_ = new Fl_Highlight_Button(5, 5, 25, 25); up_->image(up_pix); home_ = new Fl_Highlight_Button(35, 5, 25, 25); home_->image(home_pix); refresh_ = new Fl_Highlight_Button(65, 5, 25, 25); refresh_->image(refresh_pix); new_folder_ = new Fl_Highlight_Button(95, 5, 25, 25); new_folder_->image(new_pix); path_ = new Fl_Input_Browser(125, 5, w-140, 25); path_->type(Fl_Input_Browser::NONEDITABLE); path_->end(); Fl_Group::current()->resizable(path_); o->end(); } //end top { Fl_Group* o = new Fl_Group(5, 45, w-10, h-140); o->box(FL_FLAT_BOX); int W=o->w(), H=o->h(); listview_ = new Fl_ListView(0, 0, W-5, H); listview_->add_column("File"); listview_->add_column("Size",80); listview_->add_column("Type",80); listview_->add_column("Modified",120); listview_->column_flags(0,FL_ALIGN_LEFT); listview_->column_flags(1,FL_ALIGN_LEFT); listview_->column_flags(2,FL_ALIGN_LEFT); listview_->column_flags(3,FL_ALIGN_LEFT); listview_->end(); preview_ = new PreviewBox(0, 0, 0, 0); preview_->label(preview_text); preview_->hide(); preview_->box(FL_THIN_DOWN_BOX); preview_info_ = new Fl_Box(0, 0, 0, 0); preview_info_->label(preview_info); preview_info_->hide(); preview_info_->box(FL_FLAT_BOX); preview_info_->label_size(11); preview_info_->label_font(FL_HELVETICA); preview_info_->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE|FL_ALIGN_LEFT|FL_ALIGN_TOP); o->resizable(o); o->end(); resizable(o); // Outside of group preview_but_ = new Fl_Check_Button(5, 45+H, W, 18, "Show Preview"); preview_but_->text_size(10); preview_but_->value(Fl_File_Dialog::initial_preview); if(mode()==DIRECTORY) preview_but_->deactivate(); } { Fl_Group* o = new Fl_Group(5, h-70, w-10, 30); //location_ = new Fl_FileInput(55, 0, w-120, 25, "Location:"); location_ = new Fl_Input_Browser(55, 0, w-120, 25, "Location:"); location_->maxh(200); location_->callback(cb_location, this); location_->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS); Fl_Group::current()->resizable(location_); ok_ = new Fl_Return_Button(w-60, 0, 50, 25, "OK"); ok_->shortcut(0xff0d); o->end(); } //loc, ok { Fl_Group* o = new Fl_Group(5, h-35, w-10, 30); filter_ = new Fl_Input_Browser(40, 0, w-105, 25, "Filter:"); filter_->type(Fl_Input_Browser::NONEDITABLE); filter_->end(); Fl_Group::current()->resizable(filter_); cancel_ = new Fl_Button(w-60, 0, 50, 25, "&Cancel"); o->end(); } preview(Fl_File_Dialog::initial_preview); }