Exemplo n.º 1
0
void RecordBox::draw(void)
{
    drawGradient(theme->col_dark_ctrl, theme->col_light_ctrl, 0, 0, width, 16);
    drawLine(0,16, width, 1, theme->col_outline);
    if(recording==true)
    {
        drawFullBox(0, 17, width, RECORDBOX_HEIGHT-17, theme->col_signal);
        labelmsg->setTheme(theme, theme->col_signal);
        labelmsg2->setTheme(theme, theme->col_signal);
        buttoncancel->setTheme(theme, theme->col_signal);
        labelrec->show();
        labelmsg->hide();
        labelmsg2->hide();
        buttoncancel->hide();
    }
    else
    {
        drawFullBox(0, 17, width, RECORDBOX_HEIGHT-17, theme->col_light_bg);
        labelrec->hide();
        labelmsg->show();
        labelmsg2->show();
        buttoncancel->show();
        buttoncancel->pleaseDraw();
    }
    drawBorder();

    u8 titlewidth = getStringWidth(title)+5;
    drawString(title, (RECORDBOX_WIDTH-titlewidth)/2, 2, titlewidth+5);

    labelmsg->pleaseDraw();
    labelmsg2->pleaseDraw();
    labelrec->pleaseDraw();
}
Exemplo n.º 2
0
void CheckBox::draw(void)
{
	if(!isExposed())
		return;
	
	// Draw the box
	if(enabled)
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl ,2, 4, 7, 7);
	else
		drawGradient(theme->col_light_ctrl_disabled, theme->col_dark_ctrl_disabled,2, 4, 7, 7);
	
	drawLine(1, 3, 9, 1, theme->col_outline);
	drawLine(1,11, 9, 1, theme->col_outline);
	drawLine(1, 3, 9, 0, theme->col_outline);
	drawLine(9, 3, 9, 0, theme->col_outline);
	
	// Clear up
	if(!albino)
		drawFullBox(0, 0, 11, 3, theme->col_light_bg);
	else
		drawFullBox(0, 0, 11, 3, theme->col_dark_bg);
	
	// Checked or not
	if(checked == true)
		drawMonochromeIcon(1, 0, 10, 10, haken_bin);
	
	// Text
	if(!albino)
		drawString(label, 13, 2, 255, theme->col_text);
	else
		drawString(label, 13, 2, 255, theme->col_lighter_bg);
}
Exemplo n.º 3
0
void GroupBox::draw(void)
{
	drawBox(0, 4, width, height, theme->col_lighter_bg);
	u16 strwidth = getStringWidth(text);
	drawFullBox(10, 0, strwidth+2, 10, theme->col_light_bg);
	drawString(text, 11, 0, width - 12);
}
Exemplo n.º 4
0
Arquivo: main.c Projeto: 0xtob/dsmi
void displayChannel(u8 chn)
{
	char cstr[3] = {0, 0, 0};
	sprintf(cstr, "%u", chn);
	drawFullBox(206, 155, 14, 9, RGB15(26, 26, 26) | BIT(15));
	drawString(cstr, 206, 155);
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: 0xtob/dsmi
void displayOctave(u8 chn)
{
	char cstr[3] = {0, 0, 0};
	sprintf(cstr, "%u", chn);
	drawFullBox(102, 155, 14, 9, RGB15(26, 26, 26) | BIT(15));
	drawString(cstr, 102, 155);
}
Exemplo n.º 6
0
void NormalizeBox::draw(void)
{
	drawGradient(theme->col_list_highlight1, theme->col_list_highlight2, 0, 0, width, 16);
	drawLine(0,16, width, 1, RGB15(0,0,0)|BIT(15));
	drawFullBox(0, 17, width, NORMALIZEBOX_HEIGHT-17, theme->col_light_bg);
	drawBorder();
	
	u8 titlewidth = getStringWidth(title)+5;
	drawString(title, (NORMALIZEBOX_WIDTH-titlewidth)/2, 2, titlewidth+5);
	
	gui.draw();
}
Exemplo n.º 7
0
void RadioButton::draw(void)
{
	// Draw the dot
	//drawFullBox(2, 2, 7, 7, col);
	drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl ,2, 2, 7, 7);
	
	drawLine(3, 1, 5, 1, theme->col_outline);
	drawLine(3, 9, 5, 1, theme->col_outline);
	drawLine(1, 3, 5, 0, theme->col_outline);
	drawLine(9, 3, 5, 0, theme->col_outline);
	
	drawPixel(2, 2, theme->col_outline);
	drawPixel(8, 2, theme->col_outline);
	drawPixel(2, 8, theme->col_outline);
	drawPixel(8, 8, theme->col_outline);
	
	// Filled or not
	if(active == true) {
		drawFullBox(4, 4, 3, 3, theme->col_outline);
	}
	
	// Text
	drawString(label, 13, 0);
}
Exemplo n.º 8
0
void ListBox::draw(void)
{
	if(!isExposed())
		return;

	calcScrollThingy();

	u16 rows_displayed = (height-1)/ROW_HEIGHT;
	u16 i;
	// Horizontal Separator Lines
	for(i=0;i<rows_displayed-1;++i) {
		drawLine(1,ROW_HEIGHT*(i+1),width-SCROLLBAR_WIDTH-1,1,theme->col_sepline);
	}
	
	// Fill rows
	for(i=0;i<rows_displayed;++i) {
		if(scrollpos+i==activeelement) {
			drawGradient(theme->col_list_highlight1, theme->col_list_highlight2, 1, ROW_HEIGHT*i+1, width-SCROLLBAR_WIDTH-1, ROW_HEIGHT-1);
		} else {
			drawGradient(theme->col_medium_bg, theme->col_light_bg, 1, ROW_HEIGHT*i+1, width-SCROLLBAR_WIDTH-1, ROW_HEIGHT-1);
		}
	}

	// Vertical number separator line
	if(show_numbers) {
		drawLine(COUNTER_WIDTH,1,height-2,0,theme->col_sepline);
	}
	
	// Scrollbar
	// Upper Button
	if(buttonstate==SCROLLUP) {
		drawGradient(theme->col_dark_ctrl, theme->col_light_ctrl, width-SCROLLBAR_WIDTH+1, 1, 8, 8);
	} else {
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl, width-SCROLLBAR_WIDTH+1, 1, 8, 8);
	}
	
	// This draws the up-arrow
	s8 j, p;
	for(j=0;j<3;j++) {
		for(p=-j;p<=j;++p) {
			*(*vram+SCREEN_WIDTH*(y+j+3)+x+width-SCROLLBAR_WIDTH+4+p) = RGB15(0,0,0) | BIT(15);
		}
	}
	
	drawBox(width-SCROLLBAR_WIDTH, 0, 9, 9);
	
	// Lower Button
	if(buttonstate==SCROLLDOWN) {
		drawGradient(theme->col_dark_ctrl, theme->col_light_ctrl, width-SCROLLBAR_WIDTH+1, height-9, 8, 8);
	} else {
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl, width-SCROLLBAR_WIDTH+1, height-9, 8, 8);
	}
	
	// This draws the down-arrow
	for(j=2;j>=0;j--) {
		for(p=-j;p<=j;++p) {
			*(*vram+SCREEN_WIDTH*(y-j+height-4)+x+width-SCROLLBAR_WIDTH+4+p) = RGB15(0,0,0) | BIT(15);
		}
	}
	
	drawBox(width-SCROLLBAR_WIDTH, height-9, 9, 9);
	
	drawBox(width-SCROLLBAR_WIDTH, 0, SCROLLBAR_WIDTH,height);
	
	// Clear Scrollbar
	drawGradient(theme->col_medium_bg, theme->col_light_bg, width-SCROLLBAR_WIDTH+1, SCROLLBUTTON_HEIGHT, SCROLLBAR_WIDTH-2, height-2*SCROLLBUTTON_HEIGHT);
	
	// The scroll thingy
	if(buttonstate==SCROLLTHINGY) {
		drawFullBox(width-SCROLLBAR_WIDTH+1, SCROLLBUTTON_HEIGHT-1+scrollthingypos, SCROLLBAR_WIDTH-2, scrollthingyheight, theme->col_list_highlight2);
	} else {
		drawFullBox(width-SCROLLBAR_WIDTH+1, SCROLLBUTTON_HEIGHT-1+scrollthingypos, SCROLLBAR_WIDTH-2, scrollthingyheight, theme->col_list_highlight1);
	}
	drawBox(width-SCROLLBAR_WIDTH, SCROLLBUTTON_HEIGHT+scrollthingypos-1, SCROLLBAR_WIDTH, scrollthingyheight);
	
	// Numbers (if enabled)
	u16 contentoffset;
	if(show_numbers) {
		char *numberstr = (char*)malloc(4);
		//iprintf("%u %u\n",scrollpos,elements.size());
		u16 offset;
		if(zero_offset==true) {
			offset=0;
		} else {
			offset=1;
		}
		for(i=0;(i<height/ROW_HEIGHT)&&(scrollpos+i<elements.size());++i) {
			sprintf(numberstr,"%2x",scrollpos+i+offset);
			drawString(numberstr, 2, ROW_HEIGHT*i+2);
		}
		free(numberstr);
		
		contentoffset = COUNTER_WIDTH;
	} else {
		contentoffset = 0;
	}
	
	// Content
	for(i=0;(i<height/ROW_HEIGHT)&&(scrollpos+i<elements.size());++i) {
		drawString(elements.at(scrollpos+i).c_str(), contentoffset+2, ROW_HEIGHT*i+2, width-contentoffset-2-SCROLLBAR_WIDTH-2);
	}
	
	drawBorder();
}
Exemplo n.º 9
0
void SampleDisplay::draw(void)
{
	if(!isExposed())
		return;

	//
	// Border and background
	//
	//drawFullBox(0, 0, width, height, theme->col_dark_bg);
	u32 colcol = theme->col_dark_bg | theme->col_dark_bg << 16;
	for(int j=y;j<y+height;++j) dmaFillWordsDamnFast(colcol, *vram+256*j+x, width*2);

	if(active==false) {
		drawBorder();
	} else {
		drawBorder(RGB15(31,0,0)|BIT(15));
	}

	// Now comes sample-dependant stuff, so return if we have no sample
	if((smp==0)||(smp->getNSamples()==0)) return;

	//
	// Selection
	//
	s32 selleft = sampleToPixel(MIN(selstart, selend));
	s32 selwidth = sampleToPixel(MAX(selstart, selend)) - selleft;
	bool dontdraw = false;

	if( (selleft >= 0) && (selleft < width-2) && (selleft + selwidth > width - 2) ) {
		selwidth = (width-2) - selleft;
	} else if( (selleft < 0) && (selleft + selwidth > 0) && (selleft + selwidth < width-2) ) {
		selwidth += selleft;
		selleft = 0;
	} else if( (selleft < 0) && (selleft + selwidth > width-2) ) {
		selwidth = width-2;
		selleft = 0;
	} else if( (selleft + selwidth < 0) || (selleft > width-2) ) {
		dontdraw = true;
	}

	if(selection_exists && !dontdraw) {
		drawFullBox(selleft+1, 1, selwidth, DRAW_HEIGHT+1, RGB15(31,31,0)|BIT(15));
	}

	//
	// Scrollbar
	//

	// Right Button
	if(pen_on_scroll_right) {
		drawGradient(theme->col_dark_ctrl, theme->col_light_ctrl, width-9, height-SCROLLBAR_WIDTH+1, 8, 8);
	} else {
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl, width-9, height-SCROLLBAR_WIDTH+1, 8, 8);
	}

	// This draws the right-arrow
	s8 j, p;
	for(j=0;j<3;j++) {
		for(p=-j;p<=j;++p) {
			*(*vram+SCREEN_WIDTH*(y+height-SCROLLBAR_WIDTH+4+p)+x+width-j-3) = RGB15(0,0,0) | BIT(15);
		}
	}

	drawBox(width-SCROLLBAR_WIDTH, height-SCROLLBUTTON_HEIGHT, 9, 9);

	// Left Button
	if(pen_on_scroll_left) {
		drawGradient(theme->col_dark_ctrl, theme->col_light_ctrl, 1, height-9, 8, 8);
	} else {
		drawGradient(theme->col_light_ctrl, theme->col_dark_ctrl, 1, height-9, 8, 8);
	}

	// This draws the down-arrow
	for(j=2;j>=0;j--) {
		for(p=-j;p<=j;++p) {
			*(*vram+SCREEN_WIDTH*(y+height-SCROLLBAR_WIDTH+4+p)+x+j+3) = theme->col_icon;
		}
	}

	drawBox(0, height-9, 9, 9);


	drawBox(0, height-SCROLLBAR_WIDTH, width, SCROLLBAR_WIDTH);

	// Clear Scrollbar
	drawGradient(theme->col_medium_bg, theme->col_light_bg, SCROLLBUTTON_HEIGHT, height-SCROLLBAR_WIDTH+1, width-2*SCROLLBUTTON_HEIGHT, SCROLLBAR_WIDTH-2);

	// The scroll thingy
	if(pen_on_scrollthingy) {
		drawFullBox(SCROLLBUTTON_HEIGHT+scrollthingypos, height-SCROLLBAR_WIDTH+1, scrollthingywidth-2, SCROLLBAR_WIDTH-2, theme->col_light_ctrl);
	} else {
		drawFullBox(SCROLLBUTTON_HEIGHT+scrollthingypos, height-SCROLLBAR_WIDTH+1, scrollthingywidth-2, SCROLLBAR_WIDTH-2, theme->col_dark_ctrl);
	}

	drawBox(SCROLLBUTTON_HEIGHT-1+scrollthingypos, height-SCROLLBAR_WIDTH, scrollthingywidth, SCROLLBAR_WIDTH);

	//
	// Sample
	//

	u16 colortable[DRAW_HEIGHT+2];
	for(u8 i=0; i<DRAW_HEIGHT+2; ++i)
		colortable[i] = interpolateColor(theme->col_light_ctrl, theme->col_dark_ctrl, i);

	// TODO; Eliminate floats here!!

	/*
	float step = (float)(smp->getNSamples() >> zoom_level) / (float)(width-2);
	float pos = 0.0f;

	u32 renderwindow = (u32)MAX(1, MIN(100, ceil(step)));
	*/

#define _fix(x) ((x)<<12)

	int step = divf32(_fix(smp->getNSamples() >> zoom_level), _fix(width-2));
	int pos = 0;

	int ceil_step = step;
	if (ceil_step & 0xFFF)
	{
		ceil_step &= ~0xFFF;
		ceil_step ++;
	}

	u32 renderwindow = MAX(1, MIN(100, ceil_step>>12));

	u16 middle = (DRAW_HEIGHT+2)/2;//-1;

	s32 lastmax=0, lastmin=0;
	if(smp->is16bit() == true) {

		s16 *data;
		s16 *base = (s16*)smp->getData() + pixelToSample(0);

		for(u32 i=1; i<u32(width-1); ++i)
		{
			data = &(base[pos>>12]);

			s32 maxsmp = -32767, minsmp = 32767;

			for(u32 j=0;j<renderwindow;++j) {
				if(*data > maxsmp) maxsmp = *data;
				if(*data < minsmp) minsmp = *data;
				data++;
			}

			s32 maxy = div32((DRAW_HEIGHT+2) * maxsmp, 2 * 32767);
			s32 miny = div32((DRAW_HEIGHT+2) * minsmp, 2 * 32767);

			if(i>1) {
				if(lastmin > maxy) maxy = lastmin;
				if(lastmax < miny) miny = lastmax;
			}

			for(s16 j=miny; j<=maxy; ++j) (*vram)[SCREEN_WIDTH*(y+middle-j)+x+i] = colortable[middle-j];

			lastmax = maxy;
			lastmin = miny;

			*(*vram+SCREEN_WIDTH*(y+middle)+x+i) = colortable[middle];

			pos += step;
		}

	} else {