Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
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 );

}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
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();
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
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;
}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
0
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();
}
Ejemplo n.º 11
0
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);
		tension->align(FL_ALIGN_LEFT);
		tension->type(FL_HORIZONTAL);
		tension->callback((Fl_Callback*)damageCB,this);
		
		pty += 30;
		physics =  new Fl_Value_Slider(670,pty,120,20,"Physics");
		physics->range(2,15);
		physics->value(4.5);
		physics->align(FL_ALIGN_LEFT);
		physics->type(FL_HORIZONTAL);
		physics->callback((Fl_Callback*)damageCB,this);


		pty+=30;
		Physics = new Fl_Button(605, pty, 60, 20, "Physics");
		togglify(Physics);

		pty+=30;
		Fl_Button* at = new Fl_Button(605,pty,80,20,"Add Train");
		at->callback((Fl_Callback*)addTrainCB,this);

		Fl_Button* dt = new Fl_Button(690,pty,80,20,"Delete Train");
		dt->callback((Fl_Callback*)deleteTrainCB,this);
		
		pty+=20;
		carBrowser = new Fl_Browser(605,pty,120,55,"Train Type");
		carBrowser->type(2);		// select
		carBrowser->add("Classical");
		carBrowser->add("Roller Coaster");
		carBrowser->select(2);
		carBrowser->callback((Fl_Callback*)damageCB,this);
		
		pty+=80;
		Fog = new Fl_Button(605,pty,65,20,"Fog");
		togglify(Fog,0);

		pty+= 30;
		FOG_SLIDER =  new Fl_Value_Slider(655,pty,120,20,"density");
		FOG_SLIDER->range(0.5,6);
		FOG_SLIDER->value(1.5);
		FOG_SLIDER->align(FL_ALIGN_LEFT);
		FOG_SLIDER->type(FL_HORIZONTAL);
		FOG_SLIDER->callback((Fl_Callback*)damageCB,this);

		// we need to make a little phantom widget to have things resize correctly
		Fl_Box* resizebox = new Fl_Box(600,595,200,5);
		widgets->resizable(resizebox);

		widgets->end();
	}
	end();	// done adding to this widget
	// set up callback on idle
	Fl::add_idle((void (*)(void*))runButtonCB,this);
}
Ejemplo n.º 12
0
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();
}
Ejemplo n.º 13
0
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();
}
Ejemplo n.º 14
0
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();
}
Ejemplo n.º 15
0
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);
		qlb_images[count] = NULL;
		qlb_images[count] = Fl_Image::read(qlb_icons[count]);
		if (!qlb_images[count])
			fprintf(stderr, "skipping icon: %s\n", qlb_icons[count]);
		else
			qlb_buttons[count]->image(qlb_images[count]);
		qlb_buttons[count]->tooltip(qlb_tooltips[count]);
		qlb_buttons[count]->callback((Fl_Callback*)cb_qlb_taskbutton, (void *)qlb_commands[count]);
		qlb_buttons[count]->show();

		substract += 26;
  	}
	


	g2->end();
	g2->show();
	g2->resizable();

	v = new Fl_VertDivider(0, 0, 5, 18, "");
		v->layout_align(FL_ALIGN_LEFT);
	substract += 5;
	}
	
	// Run browser
	if (doRunBrowser) {
		Fl_Group *g3 = new Fl_Group(0,0,100,20);
		g3->box(FL_FLAT_BOX);
		g3->layout_spacing(0);
		g3->layout_align(FL_ALIGN_LEFT);
		runBrowser = new Fl_Input_Browser("",100,FL_ALIGN_LEFT,30);
		//runBrowser->image(run_pix);
		runBrowser->box(FL_THIN_DOWN_BOX); // This is the only box type which works :(

		// Added _ALWAYS so callback is in case:
		// 1) select old command from input browser
		// 2) press enter to execute. (this won't work w/o _ALWAYS)
//		  runBrowser->input()->when(FL_WHEN_ENTER_KEY_ALWAYS | FL_WHEN_RELEASE_ALWAYS); 
		// Vedran: HOWEVER, with _ALWAYS cb_run_app will be called way
		// too many times, causing fork-attack
		runBrowser->input()->when(FL_WHEN_ENTER_KEY); 
		runBrowser->input()->callback((Fl_Callback*)cb_run_app);
		runBrowser->callback((Fl_Callback*)cb_run_app2);
		g3->end();
		g3->show();
		g3->resizable();

		v = new Fl_VertDivider(0, 0, 5, 18, "");
		v->layout_align(FL_ALIGN_LEFT);
	substract += 105;
	}


	// Popup menu for the whole taskbar
	Fl_Menu_Button *mPopupPanelProp = new Fl_Menu_Button( 0, 0, W, 28 );
	mPopupPanelProp->type( Fl_Menu_Button::POPUP3 );
	mPopupPanelProp->anim_flags(Fl_Menu_::LEFT_TO_RIGHT);
	mPopupPanelProp->anim_speed(0.8);
	mPopupPanelProp->begin();

	Fl_Item *mPanelSettings = new Fl_Item(_("Settings"));
	mPanelSettings->x_offset(12);
	mPanelSettings->callback( (Fl_Callback*)runUtility, (void*)"epanelconf" );
	new Fl_Divider(10, 5);

	Fl_Item *mAboutItem = new Fl_Item(_("About EDE..."));
	mAboutItem->x_offset(12);
	mAboutItem->callback( (Fl_Callback *)AboutDialog );

	mPopupPanelProp->end();

	// Taskbar...
	tasks = new TaskBar();

	// Dock and various entries...
	dock = new Dock();

	v = new Fl_VertDivider(0, 0, 5, 18, "");
	v->layout_align(FL_ALIGN_RIGHT);

	{
		// MODEM
		mModemLeds = new Fl_Group(0, 0, 25, 18);
		mModemLeds->box(FL_FLAT_BOX);
		mModemLeds->hide();
		mLedIn = new Fl_Box(2, 5, 10, 10);
		mLedIn->box( FL_OVAL_BOX );
		mLedIn->color( (Fl_Color)968701184);
		mLedOut = new Fl_Box(12, 5, 10, 10);
		mLedOut->box( FL_OVAL_BOX);
		mLedOut->color( (Fl_Color)968701184);
		mModemLeds->end();
	}

	{
		// KEYBOARD SELECT
		mKbdSelect = new KeyboardChooser(0, 0, 20, 18, FL_NO_BOX, FL_DOWN_BOX, "us");
		mKbdSelect->hide();
		mKbdSelect->anim_speed(4);
		mKbdSelect->label_font(mKbdSelect->label_font()->bold());
		mKbdSelect->highlight_color(mKbdSelect->selection_color());
		mKbdSelect->highlight_label_color( mKbdSelect->selection_text_color());
	}

	{
		// CLOCK
		mClockBox = new Fl_Button(0, 0, 50, 20);
		mClockBox->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
		mClockBox->hide();
		mClockBox->box(FL_FLAT_BOX);
		mClockBox->callback( (Fl_Callback*)startUtility, (void*)"Time and date");
	}

	// SOUND applet
	if (doSoundMixer) {
		mSoundMixer = new Fl_Button(0, 0, 20, 18);
		mSoundMixer->hide();
		mSoundMixer->box(FL_NO_BOX);
		mSoundMixer->focus_box(FL_NO_BOX);
		mSoundMixer->image(sound_pix);
		mSoundMixer->tooltip(_("Volume control"));
		mSoundMixer->align(FL_ALIGN_INSIDE);
		mSoundMixer->callback( (Fl_Callback*)startUtility, (void*)"Volume Control" );
	}

	// CPU monitor
	if (doCpuMonitor) {
		cpumon = new CPUMonitor();
		cpumon->hide();
	}

	// Battery monitor
	if (doBatteryMonitor) {
		batmon = new BatteryMonitor(dock);
		batmon->hide();
	}


	dock->add_to_tray(new Fl_Box(0, 0, 5, 20));
	dock->add_to_tray(mClockBox);
	dock->add_to_tray(mKbdSelect);
	dock->add_to_tray(mSoundMixer);
	dock->add_to_tray(cpumon);
	dock->add_to_tray(batmon);

	// end Dock


	Fl::focus(mSystemMenu);

	mPanelWindow->end();
	mPanelWindow->show(argc, argv);

	Fl_WM::callback(FL_WM_handler, 0, Fl_WM::DESKTOP_COUNT | 
								   Fl_WM::DESKTOP_NAMES |
							   Fl_WM::DESKTOP_CHANGED|
							   Fl_WM::WINDOW_LIST|
							   Fl_WM::WINDOW_DESKTOP|
							   Fl_WM::WINDOW_ACTIVE|
							   Fl_WM::WINDOW_NAME|
							   Fl_WM::WINDOW_ICONNAME);

	updateWorkspaces(0,0);
	tasks->update();

	Fl::add_timeout(0, clockRefresh);
	Fl::add_timeout(0, updateStats);

	while(mPanelWindow->shown())
		Fl::wait();
}
Ejemplo n.º 16
0
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();
    }


}
Ejemplo n.º 17
0
gdActionEditor::gdActionEditor(int chan)
: gWindow(640, 176), 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;
	}

	framesPerBar   = G_Mixer.framesPerBar / 2;      // /2 = we don't care about stereo infos
	framesPerBeat  = G_Mixer.framesPerBeat / 2;
	framesPerBeats = framesPerBeat * G_Mixer.beats;
	totalFrames    = framesPerBeat * MAX_BEATS;
	beatWidth      = framesPerBeat / zoom;
	totalWidth     = (int) ceilf(totalFrames / (float) zoom);

	/* 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();
	  actionType = new gChoice(104, 8, 80, 20);
	  gridTool   = new gGridTool(188, 8, this);
		gBox *b1   = new gBox  (248, 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);

	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 (G_Mixer.chanMode[chan] == SINGLE_PRESS || G_Mixer.chanMode[chan] & LOOP_ANY)
		actionType->deactivate();

	zoomIn->callback(cb_zoomIn, (void*)this);
	zoomOut->callback(cb_zoomOut, (void*)this);

	/* side boxes with text infos for the channel (actions, mute, ...)
	 * Even here we need the padding box trick, otherwise when you enlarge
	 * the window vertically, text boxes strech. */

	Fl_Group *texts = new Fl_Group(8, 36, 92, 160);
		gBox *txtActions = new gBox(8, 36,  92, 20, "Actions");
		gBox *txtMutes   = new gBox(8, 80,  92, 20, "Mute");
		gBox *txtDist    = new gBox(8, 100, 92, 20);  // pading border - buttons

		txtActions->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
		txtMutes  ->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);

		if (G_Mixer.chanMode[chan] & LOOP_ANY) {
			gBox *txtDisabled = new gBox(8, 48, 92, 20, "disabled");
			txtDisabled->labelsize(9);
			txtDisabled->labelcolor(COLOR_BD_0);
			txtDisabled->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
		}
	texts->end();
	texts->resizable(txtDist);

	/* main scroller: contains all widgets */

	scroller = new Fl_Scroll(104, 36, this->w()-112, this->h()-44);
	scroller->type(Fl_Scroll::HORIZONTAL);
	scroller->hscrollbar.color(COLOR_BG_0);
	scroller->hscrollbar.selection_color(COLOR_BG_1);
	scroller->hscrollbar.labelcolor(COLOR_BD_1);
	scroller->hscrollbar.slider(G_BOX);

	scroller->begin();
		ac = new gActionChannel(scroller->x(), 36, this);
		mc = new gMuteChannel  (scroller->x(), 84, this);
	scroller->end();

	end();

	/* if channel is LOOP_ANY, deactivate it: a loop mode channel cannot
	 * hold keypress/keyrelease actions */

	if (G_Mixer.chanMode[chan] & LOOP_ANY)
		ac->deactivate();

	gu_setFavicon(this);

	char buf[256];
	sprintf(buf, "Edit Actions in Channel %d", chan+1);
	label(buf);

	set_non_modal();
	size_range(640, 176);
	resizable(scroller);

	show();
}
Ejemplo n.º 18
0
void MainWindow::createComponents()
{
    Fl_Group* grpSequence = new Fl_Group(10,20,150,120, "Sequence :");
    if ( grpSequence != NULL )
    {
        grpSequence->box(FL_DOWN_BOX);
        grpSequence->align(Fl_Align(FL_ALIGN_TOP_LEFT));
        grpSequence->labelsize(DEFAULT_FONT_SIZE);
        grpSequence->begin();

        seqPreparing = new Fl_Box(20,30,130,20,"1. Preparing update ...");
        if ( seqPreparing != NULL )
        {
            seqPreparing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
            seqPreparing->labelsize(DEFAULT_FONT_SIZE);
            seqPreparing->deactivate();
        }

        seqRetrieving = new Fl_Box(20,50,130,20,"2. Retrieving data ...");
        if ( seqRetrieving != NULL )
        {
            seqRetrieving->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
            seqRetrieving->labelsize(DEFAULT_FONT_SIZE);
            seqRetrieving->deactivate();
        }

        seqProcessing = new Fl_Box(20,70,130,20,"3. Processing data ...");
        if ( seqProcessing != NULL )
        {
            seqProcessing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
            seqProcessing->labelsize(DEFAULT_FONT_SIZE);
            seqProcessing->deactivate();
        }

        seqUpdating = new Fl_Box(20,90,130,20,"4. Updating ...");
        if ( seqUpdating != NULL )
        {
            seqUpdating->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
            seqUpdating->labelsize(DEFAULT_FONT_SIZE);
            seqUpdating->deactivate();
        }

        seqFinalizing = new Fl_Box(20,110,130,20,"5. Finalizing ...");
        if ( seqFinalizing != NULL )
        {
            seqFinalizing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
            seqFinalizing->labelsize(DEFAULT_FONT_SIZE);
            seqFinalizing->deactivate();
        }

        grpSequence->end();

        progBar = new Fl_Progress(10,150,150,10);
        if ( progBar != NULL )
        {
            progBar->color2(FL_BLUE);
            progBar->maximum(5);
            progBar->minimum(0);
            progBar->value(0);
        }

        mli_info = new Fl_Box(170,20,220,140,"");
        if ( mli_info != NULL )
        {
            mli_info->box( FL_DOWN_BOX );
            mli_info->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE );
            mli_info->labelsize(DEFAULT_FONT_SIZE);
        }

        Fl_Box* boxCopyright = new Fl_Box(10,165,380,35);
        if ( boxCopyright != NULL )
        {
            boxCopyright->box(FL_DOWN_BOX);
            boxCopyright->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE );
            boxCopyright->labelsize(COPYRIGHT_FONT_SIZE);
            boxCopyright->label("Automatic Updater, (C)Copyright 2013 Rageworx freeware.\n"
                                "All rights reserved, [email protected]");
        }

    }
}