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::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; }
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; }
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(); }
Fl_Group* gdSampleEditor::createOpTools(int x, int y, int h) { Fl_Group* g = new Fl_Group(x, y, 572, h); g->begin(); g->resizable(0); volumeTool = new geVolumeTool(g->x(), g->y(), ch); boostTool = new geBoostTool(volumeTool->x()+volumeTool->w()+4, g->y(), ch); panTool = new gePanTool(boostTool->x()+boostTool->w()+4, g->y(), ch); pitchTool = new gePitchTool(g->x(), panTool->y()+panTool->h()+8, ch); rangeTool = new geRangeTool(g->x(), pitchTool->y()+pitchTool->h()+8, ch); shiftTool = new geShiftTool(rangeTool->x()+rangeTool->w()+4, pitchTool->y()+pitchTool->h()+8, ch); reload = new geButton(g->x()+g->w()-70, shiftTool->y(), 70, 20, "Reload"); g->end(); if (ch->wave->isLogical()) // Logical samples (aka takes) cannot be reloaded. reload->deactivate(); reload->callback(cb_reload, (void*)this); return g; }
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(); }
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; }
ClusterView2D::ClusterView2D(int x, int y, int w, int h, int inResolution, cxVolume * pVolume) : Fl_Gl_Window(x, y, w, h-COLOR_CHOOSER_HEIGHT){ //mode(FL_ALPHA | FL_DEPTH | FL_DOUBLE | FL_RGB8 ); // Fl::add_idle(&idle_cp, (void*)this); opacityDisp = 0; histogram1D = 0; m_dataPts = NULL; m_cluster = NULL; m_ctrs = NULL; m_pVolume = pVolume; m_percentHeight = (float)COLOR_CHOOSER_HEIGHT / (float) h; m_percentWidth = (float)COLOR_CHOOSER_WIDTH / (float) w; ClusterView2D *ihateptrs = this; // this is necessary because &this doesnt work. //m_buttonA = new Fl_Button(x+MARGIN+COLOR_CHOOSER_WIDTH, y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN, BUTTON_WIDTH,BUTTON_HEIGHT, "Reset"); //m_buttonA->callback((Fl_Callback*)cb_buttonA, this); //m_buttonA->resizable(0); Fl_Group* o = new Fl_Group( 2, y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN, COLOR_CHOOSER_WIDTH*3, COLOR_CHOOSER_HEIGHT*4,"K-Means settings"); o->box(FL_ENGRAVED_FRAME); o->align(FL_ALIGN_TOP_LEFT); m_pInputA = new Fl_Input( o->x()+3, o->y()+MARGIN, BUTTON_WIDTH*2 + 3*2, BUTTON_HEIGHT,"Filename"); m_pInputA->value(""); m_pInputA->align(FL_ALIGN_RIGHT); m_pButtonChooser = new Fl_Button( (m_pInputA->x()+m_pInputA->w()), o->y()+ MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT,"Browse.."); m_pButtonChooser->callback((Fl_Callback *)cb_ButtonChooser, this); m_pFileChooser = NULL; m_inp_tch = new Fl_Input(o->x() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, BUTTON_WIDTH, BUTTON_HEIGHT, "timesteps intervals"); m_inp_tch->align(FL_ALIGN_TOP_LEFT); m_inp_tch->value("12"); m_inp_t = new Fl_Input(o->x() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "algorithm"); m_inp_t->align(FL_ALIGN_TOP_LEFT); m_inp_t->value("0"); m_inp_k = new Fl_Input(m_inp_tch->x()+m_inp_tch->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, BUTTON_WIDTH, BUTTON_HEIGHT, "clusters"); m_inp_k->align(FL_ALIGN_TOP_LEFT); m_inp_k->value("3"); m_inp_s = new Fl_Input(m_inp_t->x()+m_inp_t->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "stages"); m_inp_s->align(FL_ALIGN_TOP_LEFT); m_inp_s->value("300"); m_inp_start_time = new Fl_Input(m_inp_k->x()+m_inp_k->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*2, BUTTON_WIDTH, BUTTON_HEIGHT, "start timestep"); m_inp_start_time->align(FL_ALIGN_TOP_LEFT); m_inp_start_time->value("0"); m_inp_total_time = new Fl_Input(m_inp_s->x()+m_inp_s->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*3 + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT, "number of timesteps"); m_inp_total_time->align(FL_ALIGN_TOP_LEFT); m_inp_total_time->value("120"); Fl_Button* bt_save = new Fl_Button( m_inp_tch->x()+m_inp_tch->w() + 3, m_pInputA->y()+ BUTTON_HEIGHT*5 + MARGIN*3, BUTTON_WIDTH, BUTTON_HEIGHT,"Create new cluster"); bt_save->callback((Fl_Callback *)cb_ButtonSave, this); Fl_Button* bt_load = new Fl_Button( bt_save->x()+bt_save->w()+3, m_pInputA->y()+ BUTTON_HEIGHT*5 + MARGIN*3, BUTTON_WIDTH, BUTTON_HEIGHT,"Load cluster"); bt_load->callback((Fl_Callback *)cb_ButtonLoad, this); o->end(); m_pLB = new Fl_Light_Button(o->x() + o->w() + 3, (y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN), BUTTON_WIDTH,BUTTON_HEIGHT, "Show all clusters"); //m_pLB->labelsize(TEXTSIZE); m_pLB->callback((Fl_Callback *)cb_LB, this); m_pLB->set(); m_bshowall = true; m_pButtonNext = new Fl_Button( o->x() + o->w() + 3, (y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN + BUTTON_HEIGHT + 3), BUTTON_WIDTH, BUTTON_HEIGHT,"Next Cluster"); m_pButtonNext->callback((Fl_Callback *)cb_ButtonNext, this); #ifdef CHANGES m_pButtonClear = new Fl_Light_Button( o->x() + o->w() + 3, (y+(h-COLOR_CHOOSER_HEIGHT)+MARGIN + BUTTON_HEIGHT*2 + 6), BUTTON_WIDTH, BUTTON_HEIGHT,"Clear Cluster"); m_pButtonClear->callback((Fl_Callback *)cb_ButtonClear, this); m_pButtonClear->set(); m_bClear = true; #endif /* int tch = 0; // use all timesteps in calculating KMeans (use only 1 chunk) -tch int alg = 0; // use Lloyd by default -t option int k = 4; // number of centers -k option int dim = 2; // dimension int stages = 1000; // number of stages -s option strcpy(params[0],""); strcpy(params[1],"-t"); strcpy(params[2],"3"); strcpy(params[3],"-tch"); strcpy(params[4],"12"); strcpy(params[5],"-tac"); strcpy(params[6],filename); strcpy(params[7],"-k"); strcpy(params[8],"3"); strcpy(params[9],"-s"); strcpy(params[10],"300"); main_cluster(nparams, params); */ m_total_size = 0; m_dim = 0; m_selcluster = 0; m_bInit = false; m_nClusters = 0; m_xblock = 1; m_yblock = 1; m_zblock = 1; m_datamin = -100; m_datamax = 100; #ifdef SHOW_CLUSTER pVolume->SetClusterView(this); #endif srand((unsigned)time( NULL )); }
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); }