本文整理汇总了C++中Fl_Group::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Group::begin方法的具体用法?C++ Fl_Group::begin怎么用?C++ Fl_Group::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Group
的用法示例。
在下文中一共展示了Fl_Group::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddStructure
void FolderWindow::AddStructure(const char* filename, const int index)
{
Fl_Pack* pack = folderPack;
pack->begin();
int vertPosn = pack->children() * 30 + pack->y();
Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), 30);
group->begin();
Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename);
label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
label->callback(FolderWindow::ShowFileCallback);
label->user_data((void*)index);
Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20);
removeButton->callback(FolderWindow::RemoveCallback);
removeButton->user_data((void*)index);
removeButton->label("@1+");
//printf("Added file: %s\n",label->label());
group->resizable(label);
group->end();
pack->end();
folderScroll->redraw();
}
示例2: box
Flx_Calendar::Flx_Calendar() :
Fl_Window( 0, 0,
TABLE_W + 2*MARGIN,
BAR_H + TABLE_H + BUTTONGROUP_H + 2*MARGIN )
, _isDragging(false)
{
//fl_register_images();
box(FL_DOWN_BOX);
clear_border();
//make a gray bar as a replacement for the title bar,
//containing 2 comboboxes for entering year and month
Fl_Group *pBarGrp = new Fl_Group( MARGIN, MARGIN, TABLE_W, BAR_H );
pBarGrp->box(FL_FLAT_BOX);
pBarGrp->begin();
_pMoCho = new Fl_Choice(18, 4, 55, BAR_H - 5);
_pMoCho->box(FL_FLAT_BOX);
_pMoCho->textsize(10);
_pMoCho->visible_focus( 0 );
_pYCho = new Fl_Choice(_pMoCho->x() + 2 + _pMoCho->w(), 4, 55, BAR_H - 5);
_pYCho->textsize(10);
_pYCho->visible_focus( 0 );
pBarGrp->color(FL_DARK3);
pBarGrp->end();
_pDayTable = new DayTable( MARGIN, MARGIN + BAR_H, TABLE_W, TABLE_H );
_pDayTable->end();
_pBtnOk = new Fl_Return_Button( 2*MARGIN,
this->h() - 2*MARGIN - BUTTON_H,
70,
BUTTON_H, "OK" );
_pBtnOk->labelsize( 10 );
_pBtnOk->callback( staticOnOkCancel, this );
_pBtnCancel = new Fl_Button( _pBtnOk->x() + _pBtnOk->w() + MARGIN,
_pBtnOk->y(), _pBtnOk->w(), _pBtnOk->h(),
"Abbrechen" );
_pBtnCancel->labelsize( _pBtnOk->labelsize() );
_pBtnCancel->callback( staticOnOkCancel, this );
end();
//controls all this stuff:
_pCalCtrl = new CalendarController( *_pMoCho, *_pYCho, *_pDayTable );
//make DayTable cells the right size:
_pDayTable->col_width_all( COLWIDTH );
_pDayTable->row_header_width( COLWIDTH );
_pDayTable->row_height_all( ROWHEIGHT );
}
示例3: createInfoBox
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;
}
示例4:
Scheme_Object*
spark_fltk_group::begin(int argc, Scheme_Object** argv)
{
DEFAULT_RET_INIT;
Fl_Group* group = _get_fl_group(argc, argv, 0);
if (group)
{
group->begin();
_ret_ = scheme_true;
}
DEFAULT_RET_FINISH;
}
示例5: createPreviewBox
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;
}
示例6: AddStructure
void FolderWindow::AddStructure(const char* filename, const int index)
{
Fl_Pack* pack = folderPack;
pack->begin();
int vertPosn = pack->children() * NAVBUTTONS_BHEIGHT; //+ pack->y() + 15;
Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), NAVBUTTONS_BHEIGHT);
group->begin();
Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename);
label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
label->callback(FolderWindow::ShowFileCallback);
label->user_data((void*)index);
label->labelcolor(GUI_BTEXT_COLOR);
char labelWithIcon[MAX_BUFFER_SIZE];
std::string spaceBuffer = string(" ");
int curLabelLen = 0;
char filePrefix[MAX_BUFFER_SIZE];
size_t fileNameBytes = strlen(filename);
snprintf(filePrefix, MAX_BUFFER_SIZE, "%-.20s%s", filename,
fileNameBytes > MAX_FOLDER_LABEL_CHARS ? "..." : "");
snprintf(labelWithIcon, MAX_BUFFER_SIZE - 1, "@filenew %s%s",
filePrefix, spaceBuffer.substr(0,
MAX(0, MAX_FOLDER_LABEL_CHARS - ((int ) strlen(filePrefix)))).c_str());
//strcat(labelWithIcon, " @|>");
label->copy_label(labelWithIcon);
label->tooltip(filename);
Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20);
removeButton->callback(FolderWindow::RemoveCallback);
removeButton->user_data((void*)index);
removeButton->label("@1+");
removeButton->labelcolor(GUI_TEXT_COLOR);
group->resizable(label);
group->end();
pack->end();
folderScroll->redraw();
}
示例7: createBottomBar
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;
}
示例8: createUpperBar
Fl_Group* gdSampleEditor::createUpperBar()
{
using namespace giada::m;
Fl_Group* g = new Fl_Group(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w()-16, G_GUI_UNIT);
g->begin();
grid = new geChoice(g->x(), g->y(), 50, G_GUI_UNIT);
snap = new geCheck(grid->x()+grid->w()+4, g->y()+3, 12, 12, "Snap");
sep1 = new geBox(snap->x()+snap->w()+4, g->y(), 506, G_GUI_UNIT);
zoomOut = new geButton(sep1->x()+sep1->w()+4, g->y(), G_GUI_UNIT, G_GUI_UNIT, "", zoomOutOff_xpm, zoomOutOn_xpm);
zoomIn = new geButton(zoomOut->x()+zoomOut->w()+4, g->y(), G_GUI_UNIT, G_GUI_UNIT, "", zoomInOff_xpm, zoomInOn_xpm);
g->end();
g->resizable(sep1);
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");
if (conf::sampleEditorGridVal == 0)
grid->value(0);
else
grid->value(grid->find_item(u::string::iToString(conf::sampleEditorGridVal).c_str()));
grid->callback(cb_changeGrid, (void*)this);
snap->value(conf::sampleEditorGridOn);
snap->callback(cb_enableSnap, (void*)this);
/* TODO - redraw grid if != (off) */
zoomOut->callback(cb_zoomOut, (void*)this);
zoomIn->callback(cb_zoomIn, (void*)this);
return g;
}
示例9: createOpTools
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;
}
示例10: TrainView
TrainWindow::TrainWindow(const int x, const int y) : Fl_Double_Window(x,y,800,600,"Train and Roller Coaster")
{
// make all of the widgets
begin(); // add to this widget
{
int pty=5; // where the last widgets were drawn. From top down
trainView = new TrainView(5,5,590,590);
trainView->tw = this;
trainView->world = &world;
this->resizable(trainView);
// to make resizing work better, put all the widgets in a group
widgets = new Fl_Group(600,5,190,590);
widgets->begin();
runButton = new Fl_Button(605,pty,60,20,"Run");
togglify(runButton);
Fl_Button* fb = new Fl_Button(700,pty,25,20,"@>>");
fb->callback((Fl_Callback*)forwCB,this);
Fl_Button* rb = new Fl_Button(670,pty,25,20,"@<<");
rb->callback((Fl_Callback*)backCB,this);
arcLength = new Fl_Button(730,pty,65,20,"ArcLength");
togglify(arcLength,1);
pty+=25;
speed = new Fl_Value_Slider(655,pty,140,20,"speed");
speed->range(0,10);
speed->value(2);
speed->align(FL_ALIGN_LEFT);
speed->type(FL_HORIZONTAL);
pty += 30;
// camera buttons - in a radio button group
Fl_Group* camGroup = new Fl_Group(600,pty,195,20);
camGroup->begin();
worldCam = new Fl_Button(605, pty, 60, 20, "World");
worldCam->type(FL_RADIO_BUTTON); // radio button
worldCam->value(1); // turned on
worldCam->selection_color((Fl_Color)3); // yellow when curpsed
worldCam->callback((Fl_Callback*)damageCB,this);
trainCam = new Fl_Button(670, pty, 60, 20, "Train");
trainCam->type(FL_RADIO_BUTTON);
trainCam->value(0);
trainCam->selection_color((Fl_Color)3);
trainCam->callback((Fl_Callback*)damageCB,this);
topCam = new Fl_Button(735, pty, 60, 20, "Top");
topCam->type(FL_RADIO_BUTTON);
topCam->value(0);
topCam->selection_color((Fl_Color)3);
topCam->callback((Fl_Callback*)damageCB,this);
camGroup->end();
pty += 30;
// browser to select spline types
// TODO: make sure these choices are the same as what the code supports
splineBrowser = new Fl_Browser(605,pty,120,75,"Spline Type");
splineBrowser->type(2); // select
splineBrowser->add("Linear");
splineBrowser->add("Cardinal Cubic");
splineBrowser->select(2);
splineBrowser->callback((Fl_Callback*)changeSmoothness,this);
pty += 110;
// add and delete points
Fl_Button* ap = new Fl_Button(605,pty,80,20,"Add Point");
ap->callback((Fl_Callback*)addPointCB,this);
Fl_Button* dp = new Fl_Button(690,pty,80,20,"Delete Point");
dp->callback((Fl_Callback*)deletePointCB,this);
pty += 25;
// reset the points
resetButton = new Fl_Button(735,pty,60,20,"Reset");
resetButton->callback((Fl_Callback*)resetCB,this);
Fl_Button* loadb = new Fl_Button(605,pty,60,20,"Load");
loadb->callback((Fl_Callback*) loadCB, this);
Fl_Button* saveb = new Fl_Button(670,pty,60,20,"Save");
saveb->callback((Fl_Callback*) saveCB, this);
pty += 25;
// roll the points
Fl_Button* rx = new Fl_Button(605,pty,30,20,"R+X");
rx->callback((Fl_Callback*)rpxCB,this);
Fl_Button* rxp = new Fl_Button(635,pty,30,20,"R-X");
rxp->callback((Fl_Callback*)rmxCB,this);
Fl_Button* rz = new Fl_Button(670,pty,30,20,"R+Z");
rz->callback((Fl_Callback*)rpzCB,this);
Fl_Button* rzp = new Fl_Button(700,pty,30,20,"R-Z");
rzp->callback((Fl_Callback*)rmzCB,this);
pty+=40;
// TODO: add widgets for all of your fancier features here
tension = new Fl_Value_Slider(670,pty,120,20,"tension s");
tension->range(0,6);
tension->value(2);
//.........这里部分代码省略.........
示例11: gWindow
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();
}
示例12: geMidiLearner
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();
}
示例13: if
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
//.........这里部分代码省略.........
示例14: main
int main(int argc, char **argv)
{
signal(SIGCHLD, SIG_IGN);
signal(SIGSEGV, terminationHandler);
fl_init_locale_support("eworkpanel", PREFIX"/share/locale");
fl_init_images_lib();
int X=0,Y=0,W=Fl::w(),H=Fl::h();
int substract;
// Get current workarea
Fl_WM::get_workarea(X,Y,W,H);
//printf("Free area: %d %d %d %d\n", X,Y,W,H);
// We expect that other docks are moving away from panel :)
mPanelWindow = new Fl_Update_Window(X, Y+H-30, W, 30, "Workpanel");
mPanelWindow->layout_spacing(0);
// Panel is type DOCK
mPanelWindow->window_type(Fl_WM::DOCK);
mPanelWindow->setAutoHide(0);
// Read config
bool doShowDesktop;
pGlobalConfig.get("Panel", "ShowDesktop", doShowDesktop, false);
bool doWorkspaces;
pGlobalConfig.get("Panel", "Workspaces", doWorkspaces, true);
bool doQLB;
pGlobalConfig.get("Panel", "QuickLaunchBar", doQLB, true);
bool doRunBrowser;
pGlobalConfig.get("Panel", "RunBrowser", doRunBrowser, true);
bool doSoundMixer;
pGlobalConfig.get("Panel", "SoundMixer", doSoundMixer, true);
bool doCpuMonitor;
pGlobalConfig.get("Panel", "CPUMonitor", doCpuMonitor, true);
bool doBatteryMonitor;
doBatteryMonitor=true; // blah
// Group that holds everything..
Fl_Group *g = new Fl_Group(0,0,0,0);
g->box(FL_DIV_UP_BOX);
g->layout_spacing(2);
g->layout_align(FL_ALIGN_CLIENT);
g->begin();
mSystemMenu = new MainMenu();
Fl_VertDivider *v = new Fl_VertDivider(0, 0, 5, 18, "");
v->layout_align(FL_ALIGN_LEFT);
substract = 5;
//this kind of if-else block is ugly
// - but users demand such features so...
if ((doShowDesktop) || (doWorkspaces) || (doQLB)) {
int size=0;
if ((doShowDesktop) && (doWorkspaces)) { size=48; } else { size=24; }
// Add size for QLB:
if (doQLB && qlb_create_toolbuttons(0)) size += (qlb_numbuttons * 24);
Fl_Group *g2 = new Fl_Group(0,0,size,22);
g2->box(FL_FLAT_BOX);
g2->layout_spacing(0);
g2->layout_align(FL_ALIGN_LEFT);
// Show desktop button
if (doShowDesktop) {
PanelButton *mShowDesktop;
mShowDesktop = new PanelButton(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, "ShowDesktop");
mShowDesktop->layout_align(FL_ALIGN_LEFT);
mShowDesktop->label_type(FL_NO_LABEL);
mShowDesktop->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
mShowDesktop->image(showdesktop_pix);
mShowDesktop->tooltip(_("Show desktop"));
mShowDesktop->callback( (Fl_Callback*)cb_showdesktop);
mShowDesktop->show();
substract += 26;
}
// Workspaces panel
mWorkspace=0; // so we can detect it later
if (doWorkspaces) {
mWorkspace = new PanelMenu(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, "WSMenu");
mWorkspace->layout_align(FL_ALIGN_LEFT);
mWorkspace->label_type(FL_NO_LABEL);
mWorkspace->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
mWorkspace->image(desktop_pix);
mWorkspace->tooltip(_("Workspaces"));
mWorkspace->end();
substract += 26;
}
// "Quick Lunch" buttons
for (int count=0; count<qlb_numbuttons; count++) {
qlb_buttons[count] = new PanelButton(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, qlb_tooltips[count]);
qlb_buttons[count]->layout_align(FL_ALIGN_LEFT);
qlb_buttons[count]->label_type(FL_NO_LABEL);
qlb_buttons[count]->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
//.........这里部分代码省略.........
示例15: createSystemArea
void createSystemArea(int32_t x, int32_t y, int32_t w, int32_t h){
tsconf::GameConfig *conf = tsconf::GetGameConfig();
int curH_L = y;
if((x+(tsconf::smallPadding<<1)+tsconf::largeWidgetWidth)>w){ //Enter no-space mode
}
else{ //We got space.
curH_L+=tsconf::smallPadding;
Fl_Group *startupGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Startup Directory");
startupGroup->box(FL_EMBOSSED_BOX);
startupGroup->begin();
Fl_Input *startupInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-76, tsconf::smallWidgetHeight);
startupInput->value(conf->startupdir);
startupInput->when(FL_WHEN_CHANGED);
startupInput->callback(startupCallback);
int newX = static_cast<Fl_Widget *>(startupInput)->x()+static_cast<Fl_Widget *>(startupInput)->w();
Fl_Button *chooseStartupButton = new Fl_Button(newX+12, curH_L+12, 40, tsconf::smallWidgetHeight, "...");
chooseStartupButton->callback(DirectoryChooser, startupInput);
startupGroup->end();
curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight;
Fl_Group *sgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "SGM File Name");
sgmnameGroup->box(FL_EMBOSSED_BOX);
sgmnameGroup->begin();
Fl_Input *sgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight);
sgmnameInput->value(conf->sgmname);
sgmnameInput->when(FL_WHEN_CHANGED);
sgmnameInput->callback(sgmnameCallback);
sgmnameGroup->end();
curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight;
Fl_Group *tsgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "TSGM File Name");
tsgmnameGroup->box(FL_EMBOSSED_BOX);
tsgmnameGroup->begin();
Fl_Input *tsgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight);
tsgmnameInput->value(conf->tsgmname);
tsgmnameInput->when(FL_WHEN_CHANGED);
tsgmnameInput->callback(tsgmnameCallback);
tsgmnameGroup->end();
curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight;
Fl_Group *mainfuncGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Main Function");
mainfuncGroup->box(FL_EMBOSSED_BOX);
mainfuncGroup->begin();
Fl_Input *mainfuncInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight);
mainfuncInput->value(conf->gamefunc);
mainfuncInput->when(FL_WHEN_CHANGED);
mainfuncInput->callback(mainfuncCallback);
mainfuncGroup->end();
}
}