コード例 #1
0
ファイル: dialogs.cpp プロジェクト: jweinberg/scummvm
void Dialog::draw() {
	assert(_widthChars != 0);

	// Set up the palette for this view
	_palette = new RGBList(8, NULL);
	_palette->setRange(0, 8, DIALOG_PALETTE);
	_vm->_palette->addRange(_palette);

	// Calculate bounds
	int dlgWidth = _dialogWidth;
	int dlgHeight = _lines.size() * (_vm->_font->current()->getHeight() + 1) + 10;
	int dialogX = (_vm->_screen->width() - dlgWidth) / 2;
	int dialogY = (_vm->_screen->height() - dlgHeight) / 2;

	// Create the surface for the dialog
	create(dlgWidth, dlgHeight, 1);
	_coords.left = dialogX;
	_coords.top = dialogY;
	_coords.right = dialogX + dlgWidth + 1;
	_coords.bottom = dialogY + dlgHeight + 1;

	// Set up the dialog
	fillRect(Common::Rect(0, 0, width(), height()), 3);
	setColour(2);
	hLine(1, width() - 1, height() - 2);	// Bottom edge
	hLine(0, width(), height() - 1);
	vLine(width() - 2, 2, height());		// Right edge
	vLine(width() - 1, 1, height());

	// Render dialog interior
	uint16 seed = 0xb78e;
	for (int yp = 2; yp < (height() - 2); ++yp) {
		byte *destP = this->getBasePtr(2, yp);

		for (int xp = 2; xp < (width() - 2); ++xp) {
			// Adjust the random seed
			uint16 v = seed;
			seed += 0x181D;
			v = ROR16(v, 9);
			seed = (seed ^ v) + ROR16(v, 3);

			*destP++ = ((seed & 0x10) != 0) ? 1 : 0;
		}
	}

	// If an ask position is set, create the input area frame
	if (_askPosition.y > 0) {

	}

	// Handle drawing the text contents
	_vm->_font->current()->setColours(7, 7, 7);
	setColour(7);

	for (uint lineCtr = 0, yp = 5; lineCtr < _lines.size(); ++lineCtr, yp += _vm->_font->current()->getHeight() + 1) {

		if (_lines[lineCtr].barLine) {
			// Bar separation line
			hLine(5, width() - 6, ((_vm->_font->current()->getHeight() + 1) >> 1) + yp);
		} else {
コード例 #2
0
ファイル: draw_buffer.cpp プロジェクト: AdmiralCurtiss/ppsspp
void DrawBuffer::RectOutline(float x, float y, float w, float h, uint32_t color, int align) {
	hLine(x, y, x + w + pixel_in_dps, color);
	hLine(x, y + h, x + w + pixel_in_dps, color);

	vLine(x, y, y + h + pixel_in_dps, color);
	vLine(x + w, y, y + h + pixel_in_dps, color);
}
コード例 #3
0
ファイル: table.c プロジェクト: sakhnik/ThermoPlast
void DrawTable(const struct CGUIConstItem *Table)
{
	assert(Table);
	assert(Table->Kind==IDK_TABLE);

	TableCtrlSpec=((struct CTableCtrl *)(Table->Specific));

	tLeft   = Table->Left;
	tTop    = Table->Top;
	tWidth  = Table->Width;
	tHeight = Table->Height;

	ClearBox(tLeft,tTop,tWidth,tHeight);
	RectangleSet(tLeft,tTop,tWidth,tHeight);
	hLine(tLeft+1,tTop+tHeight-2,tWidth-2);
	vLine(tLeft+tWidth-2,tTop+1,tHeight-3);


	Cols = TableCtrlSpec->ColCount;
	Rows = TableCtrlSpec->RowCount;

	Cell = Table->Contained;
	AddToDequeTail((void *)Cell,&DrawQueue);
	// Заголовок таблиці
	vLine(Cell->Width+Cell->Left-4,tTop+1,tHeight-3);

	for (i=1;i<Cols;i++)
	{
		++Cell;
		vLine(Cell->Left-2,tTop+1,tHeight-3);
	}

	++Cell;
	hLine(tLeft+1,Cell->Top-3,tWidth-3);

	// друк по рядках
	for (j=1;j<Rows;j++)
	{
		hLine(tLeft+1,Cell->Top-2,tWidth-3);
		Cell+=Cols;
/*		for (i=1;i<Cols;i++)
		{
			++Cell;
			if (Cell->Additional->IsEnabled)
				DrawLimitedString(Cell->Left+4,Cell->Top+2,Cell->Width-4,Cell->Height-2,
					((struct CEditBoxItem *)(Cell->Specific))->Text,guiNormalFont);
			else
				DrawLimitedString(Cell->Left+4,Cell->Top+2,Cell->Width-4,Cell->Height-2,
					((struct CEditBoxItem *)(Cell->Specific))->Text,guiDisabledFont);

		}
		++Cell;*/
	}
}
コード例 #4
0
ファイル: hStatusBar.cpp プロジェクト: gameoverhack/ofxhGui
void hStatusBar::draw(void)
{
    if(data->disabled == true) return;

    hGui * gui = hGui::getInstance();

    w = ofGetWidth();
    h = ofGetHeight();
    y = h - 13;

    if(visibleBackground) {
        if(backgroundColor != -1)
            hSetHexColor(backgroundColor);
        else hSetHexColor(gui->backgroundColor);
        hPaintRect(x, y, w, h);
    }

    hSetHexColor(gui->borderColor);
    hLine(x, y, x+w, y);

    if(data->label.size() > 0) {
        hSetHexColor(gui->textColor);
        hDrawString(gui->ffont, data->label, x+2, y+gui->ftextHeight-2);
    }
}
コード例 #5
0
ファイル: Board.cpp プロジェクト: erdincay/libboard
Group
Board::makeGrid( Point topLeft,
                 size_t columns, size_t rows,
                 double width, double height,
                 Color penColor, Color fillColor, double lineWidth,
                 const LineStyle style,
                 const LineCap cap,
                 const LineJoin join,
                 int depth )
{
  Group group;
  double cellSide = width / columns;
  group << Rectangle(topLeft.x,topLeft.y,width,height,penColor,fillColor,lineWidth,style,cap,join,depth);
  Line vLine(topLeft.x+cellSide,topLeft.y,topLeft.x+cellSide,topLeft.y-height,penColor,lineWidth,style,Shape::RoundCap,join,depth);
  while ( --columns ) {
    group << vLine;
    vLine.translate(cellSide,0);
  }
  cellSide = height / rows;
  Line hLine(topLeft.x,topLeft.y-cellSide,topLeft.x+width,topLeft.y-cellSide,penColor,lineWidth,style,Shape::RoundCap,join,depth);
  while ( --rows ) {
    group << hLine;
    hLine.translate(0,-cellSide);
  }

  return group;
}
コード例 #6
0
void textBox::render()
{
	if(hidden)
		return;

	if(reDraw)
	{
		SDL_FillRect(surface,NULL,SDL_MapRGB(surface->format,color.r,color.g,color.b));
		hLine(0,0,rect.w,SDL_MapRGB(surface->format,0,0,0));
		vLine(0,1,rect.h - 2,SDL_MapRGB(surface->format,0,0,0));
		hLine(0,rect.h - 1,rect.w,SDL_MapRGB(surface->format,255,255,255));
		vLine(rect.w - 1,1,rect.h - 2,SDL_MapRGB(surface->format,255,255,255));
		reDraw = false;
		if(foreground != NULL)
		{
			SDL_Rect tmpRect = {2,2,0,0};
			SDL_BlitSurface(foreground,NULL,surface,&tmpRect);
		}
	}
	SDL_BlitSurface(surface,NULL,screen,&rect);
}
コード例 #7
0
ファイル: mads_anim.cpp プロジェクト: St0rmcrow/scummvm
AnimviewView::AnimviewView(MadsM4Engine *vm):
		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
		MadsView(this), _backgroundSurface(MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT),
		_codeSurface(MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT) {

	MadsView::_bgSurface = &_backgroundSurface;
	MadsView::_depthSurface = &_codeSurface;
	MadsView::setViewport(Common::Rect(0, MADS_Y_OFFSET, MADS_SURFACE_WIDTH, MADS_Y_OFFSET + MADS_SURFACE_HEIGHT));

	_screenType = VIEWID_ANIMVIEW;
	_screenFlags.layer = LAYER_BACKGROUND;
	_screenFlags.visible = true;
	_screenFlags.get = SCREVENT_ALL;
	_callback = NULL;
	_script = NULL;
	_palData = NULL;
	_previousUpdate = 0;
	_transition = kTransitionNone;
	_activeAnimation = NULL;
	_bgLoadFlag = true;
	_startFrame = -1;
	_scriptDone = false;

	reset();

	// Set up system palette colors
	_vm->_palette->setMadsSystemPalette();

	// Block reserved palette ranges
	_vm->_palette->blockRange(16, 2);
	_vm->_palette->blockRange(250, 4);

	clear();
	_backgroundSurface.clear();

	setColor(2);
	hLine(0, width() - 1, MADS_Y_OFFSET - 2);
	hLine(0, width() - 1, MADS_Y_OFFSET + MADS_SURFACE_HEIGHT + 2);
}
コード例 #8
0
ファイル: mads_anim.cpp プロジェクト: St0rmcrow/scummvm
TextviewView::TextviewView(MadsM4Engine *vm):
		View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
		_bgSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT),
		_textSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT + vm->_font->current()->getHeight() +
			TEXTVIEW_LINE_SPACING) {

	_screenType = VIEWID_TEXTVIEW;
	_screenFlags.layer = LAYER_BACKGROUND;
	_screenFlags.visible = true;
	_screenFlags.get = SCREVENT_ALL;
	_callback = NULL;
	_script = NULL;
	_spareScreen = NULL;
	_bgCurrent = NULL;
	_bgSpare = NULL;
	reset();

	// Set up system palette colors and the two colors for text display
	_vm->_palette->setMadsSystemPalette();
	RGB8 palData[3];
	palData[0].r = palData[0].g = palData[0].b = 0;
	palData[1].r = 0; palData[1].g = palData[1].b = 252;
	palData[2].r = 0; palData[2].g = palData[2].b = 180;
	_vm->_palette->setPalette(&palData[0], 4, 3);
	_vm->_palette->blockRange(4, 3);

	_vm->_font->current()->setColors(5, 6, 4);

	clear();
	_bgSurface.clear();
	_textSurface.clear();

	int y = (height() - MADS_SURFACE_HEIGHT) / 2;
	setColor(2);
	hLine(0, width() - 1, y - 2);
	hLine(0, width() - 1, height() - y + 1);
}
コード例 #9
0
ファイル: commands.c プロジェクト: ohanssen/ArcticTracker
static void cmd_lcd(Stream *chp, int argc, char* argv[]) 
{   
   clear();
   label(0,0, "APRS");
   flag(32,0, "i", true);
   flag(41,0, "a", false);
   flag(50,0, "g", true);
   flag(59,0, "d", true);
   battery(70,3,2);
   hLine(0,10,66);
   
   writeText(0,15,"144.800 MHz");
   writeText(0,26,"LA7ECA-7");
   writeText(0,37,"W1,W2-1,SAR");  
   
   flush();
}
コード例 #10
0
ファイル: audicle_ui_base.cpp プロジェクト: ccrma/audicle
void
UIScrollBar::draw() { 

    glLineWidth ( 1 );

    glPushName( _id ) ;
	if ( _vertical ) vLine();
	else hLine();

	if ( _vspan < _vrange ) { 
		glPushName( _box.id() );
		UIRect b = toGlobal(_box);
		b.filledRounded();
		b.outlineRounded();
		glPopName();
	}
    glPopName();
}
コード例 #11
0
void PSV_ChartItem::createHVLine()
{
    QLineF hLine(m_chartRect.left(),m_chartRect.center().y(),m_chartRect.right(),m_chartRect.center().y());
    QLineF vLine(m_chartRect.center().x(),m_chartRect.top(),m_chartRect.center().x(),m_chartRect.bottom());

    m_hLineItem = new QGraphicsLineItem(hLine,this);
    m_vLineItem = new QGraphicsLineItem(vLine,this);
    m_boundingItem = new QGraphicsRectItem(getBoundingRect(),this);
    m_hLineItem->hide();
    m_vLineItem->hide();
    m_boundingItem->hide();
    m_hLineItem->setZValue(10001);
    m_vLineItem->setZValue(10001);
    m_boundingItem->setZValue(10001);

    m_currentMesItem = new QGraphicsTextItem(this);
    //    m_currentMesItem->setFont(m_valueFont);

}
コード例 #12
0
ファイル: hDialog.cpp プロジェクト: gameoverhack/ofxhGui
void hDialog::draw(void)
{
    hGui * gui = hGui::getInstance();

    int hh;

    if((confirmButton != NULL) || (msgTextArea != NULL))
		hh = (h - gui->buttonHeight) + 1;
    else hh = h;

    // Draw the dialog background
    if(visibleBackground){
        if(backgroundColor != -1)
			hSetHexColor(backgroundColor);
        else hSetHexColor(gui->backgroundColor);
        hPaintRect(x, y, w, hh);
    }

    // Draw top bar content
    hSetHexColor(dialogColor);
    hPaintRect(x, y, w, gui->checkBoxSize);

    // Draw all widgets inside the dialog
    int size = widgets.size();
    for(int i = 0; i < size; ++i)
        widgets[i]->draw();

	//  Frames have to be done last, in case they are recovered by something else
    // Draw the dialog frame
    if(visibleBorder){
        hSetHexColor(gui->borderColor);
        hFrameRect(x, y, w, hh);
    }

    // Draw top bar frame
    hSetHexColor(gui->borderColor);
    hFrameRect(x, y, w, gui->checkBoxSize);

#if defined( __WIN32__ ) || defined( _WIN32 )
    hSetHexColor(dialogColor);
    hLine(x, y+gui->checkBoxSize-1, x+w-gui->checkBoxSize-1, y+gui->checkBoxSize-1);
#endif
}
コード例 #13
0
ファイル: hSlider.cpp プロジェクト: gameoverhack/ofxhGui
void hSlider::draw(void)
{
    hGui * gui = hGui::getInstance();

	if(varType != HGUI_NO_VAR) {
		syncWithVar();
        setLinkedValues();

        if(data->value < min) data->value = min;
        else if(data->value > max) data->value = max;

		double pRange = w - 2;
        double vRange = max - min;
        position = ((data->value - min) * pRange) / vRange;
	}

    hWidget::draw();

	if(data->selectColor != -1) {
        if(data->disabled == false)
				hSetHexColor(data->selectColor);
            else hSetHexColor(gui->disableColor);
	} else {
        if(data->disabled == false)
				hSetHexColor(gui->sliderColor);
            else hSetHexColor(gui->disableColor);
	}

	hPaintRect(x+1, y+1, position, h-2);

	hSetHexColor(hGui::getInstance()->borderColor);
	hLine (x+position+1, y+1, x+position+1, y+h-1);

    if(owningLabel == true) {
        if(linkedLabel != NULL)
            linkedLabel->draw();
	}
}
コード例 #14
0
ファイル: animsettingdialog.cpp プロジェクト: julianliaw/ckb
AnimSettingDialog::AnimSettingDialog(QWidget* parent, KbAnim* anim) :
    QDialog(parent),
    ui(new Ui::AnimSettingDialog),
    _anim(anim), repCheck(0), kpRepCheck(0), lastDuration(1.0)
{
    ui->setupUi(this);
    setWindowTitle(anim->name());
    const AnimScript* script = anim->script();

    // Build settings UI
    ui->settingsGrid->addWidget(new QLabel("<b>Animation</b>", this), 0, 0, 1, 7);
    ui->settingsGrid->addWidget(hLine(), 1, 0, 1, 7);
    int row = 2;
    QListIterator<AnimScript::Param> i(script->paramIterator());
    while(i.hasNext()){
        const AnimScript::Param& param = i.next();
        if(param.name == "duration" || param.name == "trigger" || param.name == "kptrigger" || param.name == "repeat" || param.name == "kprepeat")
            continue;
        QVariant value = anim->parameters.value(param.name);
        // Display prefix label on the left (except for booleans)
        if(param.type != AnimScript::Param::BOOL)
            ui->settingsGrid->addWidget(new QLabel(param.prefix, this), row, 1);
        if(row == 2)
            ui->settingsGrid->addItem(new QSpacerItem(15, 0, QSizePolicy::Fixed), row, 2);
        // Configure and display main widget
        QWidget* widget = 0;
        int colSpan = 1;
        switch(param.type){
        case AnimScript::Param::BOOL:
            widget = new QCheckBox(param.prefix, this);
            ((QCheckBox*)widget)->setChecked(value.toBool());
            colSpan = 4;
            break;
        case AnimScript::Param::LONG:
            widget = new QSpinBox(this);
            ((QSpinBox*)widget)->setMinimum(param.minimum.toInt());
            ((QSpinBox*)widget)->setMaximum(param.maximum.toInt());
            ((QSpinBox*)widget)->setValue(value.toInt());
            break;
        case AnimScript::Param::DOUBLE:
            widget = new QDoubleSpinBox(this);
            ((QDoubleSpinBox*)widget)->setDecimals(1);
            ((QDoubleSpinBox*)widget)->setMinimum(param.minimum.toDouble());
            ((QDoubleSpinBox*)widget)->setMaximum(param.maximum.toDouble());
            ((QDoubleSpinBox*)widget)->setValue(value.toDouble());
            break;
        case AnimScript::Param::RGB:
            widget = new ColorButton(this);
            ((ColorButton*)widget)->color(QColor("#" + value.toString()));
            colSpan = 3;
            break;
        case AnimScript::Param::ARGB:{
            widget = new ColorButton(this, true);
            QString val = value.toString();
            QColor color;
            if(val.length() == 8){
                color = "#" + val.right(6);
                color.setAlpha(val.left(2).toInt(0, 16));
            } else
                color = "#" + val;
            ((ColorButton*)widget)->color(color);
            colSpan = 3;
            break;
        }
        default:
            break;
        }
        if(widget){
            settingWidgets[param.name] = widget;
            ui->settingsGrid->addWidget(widget, row, 3, 1, colSpan);
        }
        // Display postfix label on the right
        if(param.type != AnimScript::Param::BOOL){
            ui->settingsGrid->addWidget(new QLabel(param.postfix, this), row, 3 + colSpan, 1, 4 - colSpan);
            if(colSpan < 3)
                // Additionally add spacers to compress short elements to the left
                ui->settingsGrid->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), row, 4 + colSpan);
        }
        // On the first row, add a horizontal spacer to collapse the layout on to the left side
        if(row == 2)
            ui->settingsGrid->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), row, 6);
        row++;
    }
    // Add timing info at bottom
    ui->settingsGrid->addItem(new QSpacerItem(0, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 6);
    ui->settingsGrid->addWidget(new QLabel("<b>Timing</b>", this), row++, 0, 1, 7);
    ui->settingsGrid->addWidget(hLine(), row++, 0, 1, 7);
    if(script->hasParam("duration")){
        // Duration is required for all other timing parameters
        lastDuration = anim->parameters.value("duration").toDouble();
        // Show duration spinner
        ui->settingsGrid->addWidget(new QLabel("Duration", this), row, 1);
        QDoubleSpinBox* spinner = new QDoubleSpinBox(this);
        spinner->setDecimals(1);
        spinner->setMinimum(0.1);
        spinner->setValue(lastDuration);
        connect(spinner, SIGNAL(valueChanged(double)), this, SLOT(newDuration(double)));
        settingWidgets["duration"] = spinner;
        ui->settingsGrid->addWidget(spinner, row, 3, 1, 1);
        ui->settingsGrid->addWidget(new QLabel("seconds", this), row, 4, 1, 2);
        row++;
        if(script->hasParam("trigger")){
            // Start with mode allowed?
            if(script->hasParam("kptrigger") || script->hasParam("repeat")){
                ui->settingsGrid->addItem(new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 6);
                ui->settingsGrid->addWidget(hLine(), row++, 0, 1, 7);
                ui->settingsGrid->addItem(new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 6);
            }
            if(script->hasParam("kptrigger")){
                // Start with mode AND start with keypress allowed? Show check box
                QCheckBox* check = new QCheckBox("Start with mode", this);
                check->setChecked(anim->parameters.value("trigger").toBool());
                ui->settingsGrid->addWidget(check, row, 1, 1, 6);
                settingWidgets["trigger"] = check;
                row++;
            }
            if(script->hasParam("repeat")){
                // Repeat allowed? Add check box + spinner
                double repValue = anim->parameters.value("repeat").toDouble();
                repCheck = new QCheckBox("Repeat every:", this);
                repCheck->setChecked(repValue >= 0.);
                ui->settingsGrid->addWidget(repCheck, row, 1);
                QDoubleSpinBox* spinner = new QDoubleSpinBox(this);
                spinner->setDecimals(1);
                spinner->setMinimum(0.1);
                if(repValue >= 0.)
                    spinner->setValue(repValue);
                else
                    spinner->setValue(lastDuration);
                settingWidgets["repeat"] = spinner;
                ui->settingsGrid->addWidget(spinner, row, 3, 1, 1);
                ui->settingsGrid->addWidget(new QLabel("seconds", this), row, 4, 1, 2);
                row++;
            }
        }
        if(script->hasParam("kptrigger")){
            // Start with keypress allowed?
            if(script->hasParam("trigger") || script->hasParam("kprepeat")){
                ui->settingsGrid->addItem(new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 6);
                ui->settingsGrid->addWidget(hLine(), row++, 0, 1, 7);
                ui->settingsGrid->addItem(new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 6);
            }
            if(script->hasParam("trigger")){
                // Start with mode AND start with keypress allowed? Show check box
                QCheckBox* check = new QCheckBox("Start with key press", this);
                check->setChecked(anim->parameters.value("kptrigger").toBool());
                ui->settingsGrid->addWidget(check, row, 1, 1, 6);
                settingWidgets["kptrigger"] = check;
                row++;
            }
            if(script->hasParam("kprepeat")){
                // Repeat allowed? Add check box + spinner
                double repValue = anim->parameters.value("kprepeat").toDouble();
                kpRepCheck = new QCheckBox("Repeat every:", this);
                kpRepCheck->setChecked(repValue >= 0.);
                ui->settingsGrid->addWidget(kpRepCheck, row, 1);
                QDoubleSpinBox* spinner = new QDoubleSpinBox(this);
                spinner->setDecimals(1);
                spinner->setMinimum(0.1);
                if(repValue >= 0.)
                    spinner->setValue(repValue);
                else
                    spinner->setValue(lastDuration);
                settingWidgets["kprepeat"] = spinner;
                ui->settingsGrid->addWidget(spinner, row, 3, 1, 1);
                ui->settingsGrid->addWidget(new QLabel("seconds", this), row, 4, 1, 2);
                row++;
            }
        }
    }
コード例 #15
0
ファイル: grph.c プロジェクト: tenente-yk/bedmoni
void grph_line_bound(int fd, int x0, int y0, int x1, int y1, int yl, int yu)
{
  short dx = 0, dy = 0;
  signed char  dx_sym = 0, dy_sym = 0;
  short dx_x2 = 0, dy_x2 = 0;
  short di = 0;
 // PGDC pgdc = (PGDC) fd;

//printf("line: %d %d %d\n", pgdc->x, pgdc->cx, pgdc->xres);
  dx = x1-x0;
  dy = y1-y0;


  if(dx == 0)          /* vertical line */
  {
    if (y0 < yl && y1 < yl) return;
    if (y0 > yu && y1 > yu) return;
    if (y0 < yl) y0 = yl;
    if (y0 > yu) y0 = yu;
    if (y1 < yl) y1 = yl;
    if (y1 > yu) y1 = yu;
    vLine(fd, x0, y0, y1);
    return;
  }

  if(dx > 0)
  {
    dx_sym = 1;
  }
  else
  {
    dx_sym = -1;
  }

  if(dy == 0)          /* horizontal line */
  {
    if (y0 < yl) return;
    if (y0 > yu) return;
    hLine(fd, x0, y0, x1);
    return;
  }

  if (((PGDC) fd)->ps != PS_SOLID)
  {
    error("Only PS_SOLID is supported in %s", __FUNCTION__);
  }


  if(dy > 0)
  {
    dy_sym = 1;
  }
  else
  {
    dy_sym = -1;
  }

  dx = dx_sym*dx;
  dy = dy_sym*dy;

  dx_x2 = dx*2;
  dy_x2 = dy*2;

  if(dx >= dy)
  {
    di = dy_x2 - dx;
    while(x0 != x1)
    {
      if (y0 >= yl && y0 <= yu)
      {
        lcd_point(fd, x0, y0);
      }
      x0 += dx_sym;
      if(di<0)
      {
        di += dy_x2;
      }
      else
      {
        di += dy_x2 - dx_x2;
        y0 += dy_sym;
      }
    }
    if (y0 >= yl && y0 <= yu)
    {
      lcd_point(fd, x0, y0);
    }
  }
  else
  {
    di = dx_x2 - dy;
    while(y0 != y1)
    {
      if (y0 >= yl && y0 <= yu)
      {
        lcd_point(fd, x0, y0);
      }
      y0 += dy_sym;
      if(di < 0)
      {
        di += dx_x2;
      }
      else
      {
        di += dx_x2 - dy_x2;
        x0 += dx_sym;
      }
    }
    if (y0 >= yl && y0 <= yu)
    {
      lcd_point(fd, x0, y0);
    }
  }
  return;
}
コード例 #16
0
ファイル: grph.c プロジェクト: tenente-yk/bedmoni
void grph_line(int fd, int x0, int y0, int x1, int y1)
{
  short dx = 0, dy = 0;
  signed char  dx_sym = 0, dy_sym = 0;
  short dx_x2 = 0, dy_x2 = 0;
  short di = 0;
 // PGDC pgdc = (PGDC) fd;

//printf("line: %d %d %d\n", pgdc->x, pgdc->cx, pgdc->xres);
/*  x0 += pgdc->x;
  y0 += pgdc->y;
  x1 += pgdc->x;
  y1 += pgdc->y;
*/
  dx = x1-x0;
  dy = y1-y0;

/*  x += pgdc->x;
  y += pgdc->y;

  if (cx<0) cx = 0;
  if (cy<0) cy = 0;

  if (x > pgdc->x+pgdc->cx) return;
  else if (x+cx > pgdc->x+pgdc->cx) cx = pgdc->x+pgdc->cx -1 - x;

  if (y > pgdc->y+pgdc->cy) return;
  else if (y+cy > pgdc->y+pgdc->cy) cy = pgdc->y+pgdc->cy -1 - y;
*/

  if(dx == 0)          /* vertical line */
  {
   /* if (x0 < pgdc->x || x0 > pgdc->x + pgdc->cx) return;
    y0 = (y0 < pgdc->y) ? pgdc->y : y0;
    y0 = (y0 >= pgdc->y+pgdc->cy) ? pgdc->y+pgdc->cy-1 : y0;
    y1 = (y1 < pgdc->y) ? pgdc->y : y1;
    y1 = (y1 >= pgdc->y+pgdc->cy) ? pgdc->y+pgdc->cy-1 : y1;*/
    vLine(fd, x0, y0, y1);
    return;
  }

  if(dx > 0)
  {
    dx_sym = 1;
  }
  else
  {
    dx_sym = -1;
  }

  if(dy == 0)          /* horizontal line */
  {
   /* if (y0 < pgdc->y || y0 > pgdc->y + pgdc->cy) return;
printf("grph_line %d %d  %d %d\n", x0, x1, pgdc->x, pgdc->cx);
    x0 = (x0 < pgdc->x) ? pgdc->x : x0;
    x0 = (x0 >= pgdc->x+pgdc->cx) ? pgdc->x+pgdc->cx-1 : x0;
    x1 = (x1 < pgdc->x) ? pgdc->x : x1;
    x1 = (x1 >= pgdc->x+pgdc->cx) ? pgdc->x+pgdc->cx-1 : x1;*/
    hLine(fd, x0, y0, x1);
    return;
  }

  if (((PGDC) fd)->ps != PS_SOLID)
  {
    error("Only PS_SOLID is supported in %s", __FUNCTION__);
  }


  if(dy > 0)
  {
    dy_sym = 1;
  }
  else
  {
    dy_sym = -1;
  }

  dx = dx_sym*dx;
  dy = dy_sym*dy;

  dx_x2 = dx*2;
  dy_x2 = dy*2;

  if(dx >= dy)
  {
    di = dy_x2 - dx;
    while(x0 != x1)
    {
      lcd_point(fd, x0, y0);
      x0 += dx_sym;
      if(di<0)
      {
        di += dy_x2;
      }
      else
      {
        di += dy_x2 - dx_x2;
        y0 += dy_sym;
      }
     // if (x0<0 || x0>=pgdc->cx) break;
     // if (y0<0 || y0>=pgdc->cy) break;
    }
    lcd_point(fd, x0, y0);
  }
  else
  {
    di = dx_x2 - dy;
    while(y0 != y1)
    {
      lcd_point(fd, x0, y0);
      y0 += dy_sym;
      if(di < 0)
      {
        di += dx_x2;
      }
      else
      {
        di += dx_x2 - dy_x2;
        x0 += dx_sym;
      }
     // if (x0<0 || x0>=pgdc->cx) break;
     // if (y0<0 || y0>=pgdc->cy) break;
    }
    lcd_point(fd, x0, y0);
  }
  return;
}
コード例 #17
0
ファイル: masteredit.cpp プロジェクト: faesong/oom
MasterEdit::MasterEdit()
: MidiEditor(0, _rasterInit, 0)
{
	setWindowTitle(tr("OOMidi: Mastertrack"));
	_raster = 0; // measure
	//setMinimumSize(400, 300);
	//resize(500, 350);

	//---------Pulldown Menu----------------------------
	//      QPopupMenu* file = new QPopupMenu(this);
	//      menuBar()->insertItem("&File", file);

	//---------ToolBar----------------------------------

	tools = addToolBar(tr("Master tools"));
	tools->addActions(undoRedo->actions());

	tools2 = new EditToolBar(this, PointerTool | PencilTool | RubberTool);
	addToolBar(tools2);

	QToolBar* enableMaster = addToolBar(tr("Enable master"));
	enableButton = new QToolButton();
	enableButton->setCheckable(true);
	enableButton->setText(tr("Enable"));
	enableButton->setToolTip(tr("Enable usage of master track"));
	enableButton->setChecked(song->masterFlag());
	enableMaster->addWidget(enableButton);
	connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));

	QToolBar* info = addToolBar(tr("Info"));
	QLabel* label = new QLabel(tr("Cursor"));
	label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	label->setIndent(3);
	info->addWidget(label);

	cursorPos = new PosLabel(0);
	cursorPos->setFixedHeight(22);
	cursorPos->setToolTip(tr("time at cursor position"));
	info->addWidget(cursorPos);
	tempo = new TempoLabel(0);
	tempo->setFixedHeight(22);
	tempo->setToolTip(tr("tempo at cursor position"));
	info->addWidget(tempo);

	const char* rastval[] = {
		QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
	};
	rasterLabel = new LabelCombo(tr("Snap"), 0);
	rasterLabel->setFocusPolicy(Qt::NoFocus);
	for (int i = 0; i < 6; i++)
		rasterLabel->insertItem(i, tr(rastval[i]));
	rasterLabel->setCurrentIndex(1);
	info->addWidget(rasterLabel);
	connect(rasterLabel, SIGNAL(activated(int)), SLOT(_setRaster(int)));

	//---------values for current position---------------
	info->addWidget(new QLabel(tr("CurPos ")));
	curTempo = new TempoEdit(0);
	curSig = new SigEdit(0);
	curSig->setValue(AL::TimeSignature(4, 4));
	curTempo->setToolTip(tr("tempo at current position"));
	curSig->setToolTip(tr("time signature at current position"));
	info->addWidget(curTempo);
	info->addWidget(curSig);
	///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
	connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));

	///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
	connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));

	//---------------------------------------------------
	//    master
	//---------------------------------------------------

	int xscale = -20;
	int yscale = -500;
	hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
	vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
	vscroll->setRange(30000, 250000);
	time1 = new MTScale(&_raster, mainw, xscale);
	sign = new SigScale(&_raster, mainw, xscale);
	//      thits     = new HitScale(&_raster, mainw, xscale);

	canvas = new Master(this, mainw, xscale, yscale);

	//      zhits     = new HitScale(&_raster, mainw, xscale);
	time2 = new MTScale(&_raster, mainw, xscale);
	tscale = new TScale(mainw, yscale);
	time2->setBarLocator(true);

	//---------------------------------------------------
	//    Rest
	//---------------------------------------------------

	//      QSizeGrip* corner   = new QSizeGrip(mainw);

	mainGrid->setRowStretch(5, 100);
	mainGrid->setColumnStretch(1, 100);

	mainGrid->addWidget(hLine(mainw), 0, 1);
	mainGrid->addWidget(time1, 1, 1);
	mainGrid->addWidget(hLine(mainw), 2, 1);
	mainGrid->addWidget(sign, 3, 1);
	mainGrid->addWidget(hLine(mainw), 4, 1);
	//    mainGrid->addWidget(thits,         5, 1);
	//    mainGrid->addWidget(hLine(mainw),  6, 1);
	mainGrid->addWidget(canvas, 5, 1);
	mainGrid->addWidget(tscale, 5, 0);
	mainGrid->addWidget(hLine(mainw), 6, 1);
	//    mainGrid->addWidget(zhits,         9, 1);
	//    mainGrid->addWidget(hLine(mainw),  7, 1);
	mainGrid->addWidget(time2, 7, 1);
	mainGrid->addWidget(hscroll, 8, 1);
	mainGrid->addWidget(vscroll, 0, 2, 10, 1);
	//      mainGrid->addWidget(corner,  9, 2, AlignBottom | AlignRight);


	connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
	connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
	connect(vscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setYMag(float)));

	connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int)));
	connect(vscroll, SIGNAL(scaleChanged(float)), tscale, SLOT(setYMag(float)));

	connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
	connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
	//      connect(hscroll, SIGNAL(scrollChanged(int)), thits,  SLOT(setXPos(int)));
	connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
	//      connect(hscroll, SIGNAL(scrollChanged(int)), zhits,  SLOT(setXPos(int)));
	connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));

	connect(hscroll, SIGNAL(scaleChanged(float)), time1, SLOT(setXMag(float)));
	connect(hscroll, SIGNAL(scaleChanged(float)), sign, SLOT(setXMag(float)));
	//      connect(hscroll, SIGNAL(scaleChanged(int)), thits,  SLOT(setXMag(int)));
	connect(hscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setXMag(float)));
	//      connect(hscroll, SIGNAL(scaleChanged(int)), zhits,  SLOT(setXMag(int)));
	connect(hscroll, SIGNAL(scaleChanged(float)), time2, SLOT(setXMag(float)));

	connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
	//      connect(sign,   SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
	//      connect(thits,  SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
	//      connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
	//      connect(zhits,  SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
	connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));

	connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
	connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
	connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
	connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(posChanged(int, unsigned, bool)));

	connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
	connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
}
コード例 #18
0
ファイル: cscreenshotview.cpp プロジェクト: weinkym/src_miao
void CScreenShotView::updatePreviewItem(const QPoint &pos)
{
    C_SCREENSHOT_LOG_FUNCTION;
    QPixmap pixmap(m_previewItemWidth,m_previewItemPixmapHeight+m_previewItemTextHeight);
    pixmap.fill(QColor(Qt::white));
    QPainter painter(&pixmap);
    painter.setRenderHints(QPainter::TextAntialiasing
                           | QPainter::SmoothPixmapTransform
                           | QPainter::HighQualityAntialiasing
                           | QPainter::NonCosmeticDefaultPen
                           | QPainter::Qt4CompatiblePainting);
    QPointF toItemPos = getPointToSelectedItem(pos);

    qreal scaleSize = 3;
    {//draw preview
        qreal width = m_previewItemWidth / scaleSize;
        qreal height = m_previewItemPixmapHeight / scaleSize;
        qreal x = (toItemPos.x() - 0.5 * width);
        QPointF pos(0,0);
        if(x < 0)
        {
            width = width + x;
            pos.setX(-x * scaleSize);
            x = 0;
        }
        else
        {
            width = qMin(width,m_desktopPixmap.width() - x);
        }
        qreal y = (toItemPos.y() - 0.5 * height);
        if(y < 0)
        {
            height += y;
            pos.setY(-y * scaleSize);
            y = 0;
        }
        else
        {
            height = qMin(height,m_desktopPixmap.height() - y);
        }
        QPixmap pixmap = m_desktopPixmap.copy(x,y,width,height).scaled(width * scaleSize,height * scaleSize);
        painter.drawImage(pos,pixmap.toImage());
        QColor lineColor("#89D4EB");
        lineColor.setAlpha(128);
        QPen pen(lineColor);
        pen.setWidth(m_previewLineWidth);
        painter.setPen(pen);
        QLineF hLine(0,0.5 * m_previewItemPixmapHeight,m_previewItemWidth,0.5 * m_previewItemPixmapHeight);
        painter.drawLine(hLine);
        QLineF vLine(0.5 * m_previewItemWidth,0,0.5 * m_previewItemWidth,m_previewItemPixmapHeight);
        painter.drawLine(vLine);
    }
    QRectF textRect(0,m_previewItemPixmapHeight,m_previewItemWidth,m_previewItemTextHeight);
    {//draw text background
        QBrush textBrush(QColor("#4F4F4F"));
        QPen pen(Qt::NoPen);
        painter.setPen(pen);
        painter.setBrush(textBrush);
        painter.drawRect(textRect);
    }
    {//draw text
        QRgb pointRgb = getPixmapPosRgb(m_desktopPixmap,toItemPos.toPoint());
        QFont font;
        font.setPixelSize(m_previewPointSize);
        painter.setFont(font);
        QColor textColor("#B8B8B8");
        QPen pen(textColor);
        painter.setPen(pen);
        QString text = QString("(%1,%2)\nRGB:(%3,%4,%5)")
                .arg(pos.x())
                .arg(pos.y())
                .arg(qRed(pointRgb))
                .arg(qGreen(pointRgb))
                .arg(qBlue(pointRgb));
        painter.drawText(textRect,Qt::AlignCenter,text);
    }
    m_previewItem->setPixmap(pixmap);
    qreal x = pos.x() - m_previewItemDx - pixmap.width();
    if(x < 0)
    {
        x = pos.x() + m_previewItemDy;
    }
    qreal y = pos.y() + m_previewItemDy;
    if(y + pixmap.height() > this->height())
    {
        y = pos.y() - m_previewItemDy - pixmap.height();
    }
    m_previewItem->setPos(x,y);
    if(!m_previewItem->isVisible())
    {
        emit sigPreviewItemShow();
        m_previewItem->setVisible(true && !m_onlySelect);
    }
}
コード例 #19
0
ファイル: surface.cpp プロジェクト: havlenapetr/Scummvm
void Surface::frameRect(const Common::Rect &r, uint32 color) {
	hLine(r.left, r.top, r.right-1, color);
	hLine(r.left, r.bottom-1, r.right-1, color);
	vLine(r.left, r.top, r.bottom-1, color);
	vLine(r.right-1, r.top, r.bottom-1, color);
}
コード例 #20
0
void drawPbStamp(struct pbStamp *pbStampPtr, struct pbStampPict *stampPictPtr)
/* draw the stamp */
{
int ix, iy, iw, ih;
char *stampName, *stampTable, *stampTitle, *stampDesc;
double txmin, tymin, txmax, tymax;
int i, n, index;
int xx, yy;
char charStr[2];
Color edgeColor;
Color stampColor;
int titleLen;

stampName   = cloneString(pbStampPtr->stampName);
stampTable  = cloneString(pbStampPtr->stampTable);
stampTitle  = cloneString(pbStampPtr->stampTitle);
n           = pbStampPtr->len;
txmin       = pbStampPtr->xmin;
txmax       = pbStampPtr->xmax;
tymin       = pbStampPtr->ymin;
tymax       = pbStampPtr->ymax;
stampDesc   = cloneString(pbStampPtr->stampDesc);

ix = stampPictPtr->xOrig;
iy = stampPictPtr->yOrig;
iw = stampPictPtr->width;
ih = stampPictPtr->height;
    
xScale = (double)(iw)/(txmax - txmin);
yScale = (double)(ih)/(tymax - tymin);
   
calStampXY(stampPictPtr, txmin, tymax, &xx, &yy);
mapBoxStamp(xx, yy, iw, ih, stampTitle, stampName);

calStampXY(stampPictPtr, txmin+(txmax-txmin)/2.0, tymax, &xx, &yy);
vgTextCentered(g_vg, xx-5, yy-12, 10, 10, MG_BLACK, g_font, stampTitle);
    
titleLen = strlen(stampTitle);
mapBoxStampTitle(xx-5-titleLen*6/2-6, yy-14, titleLen*6+12, 14,  stampTitle, stampName);
    
edgeColor  = boundaryColor;
stampColor = vgFindColorIx(g_vg, 220, 220, 220);
for (index=0; index < (n-1); index++)
    {
    pbBox(tx[index], tymin, tx[index+1]-tx[index], ty[index], stampColor);
    hLine(tx[index], ty[index], tx[index+1]-tx[index], 1, edgeColor);
    }
vLine(tx[0], 0, ty[0], 1,  edgeColor);
for (index=0; index < (n-1); index++)
    {
    if (ty[index+1] > ty[index])
	{
	vLine(tx[index+1], ty[index], ty[index+1]-ty[index], 1,  edgeColor);
	}
    else
	{
	vLine(tx[index+1], ty[index+1], ty[index]-ty[index+1], 1, edgeColor);
	}
    }
    
hLine(txmin, tymin, txmax-txmin, 2, boundaryColor);
/* this line needs to call hLine2 for fine tuning at the right hand side ending */
hLine2(txmin, tymax, txmax-txmin, 2, boundaryColor);
vLine(txmin, tymin, tymax-tymin, 2, boundaryColor);
vLine(txmax, tymin, tymax-tymin, 2, boundaryColor);
    
if (strcmp(pbStampPtr->stampName, "pepRes") == 0)
    {
    for (i=0; i<20; i++)
	{
    	calStampXY(stampPictPtr, tx[i], tymin, &xx, &yy);
	safef(charStr, sizeof(charStr), "%c", aaAlphabet[i]);
	vgTextCentered(g_vg, xx+1, yy+5, 10, 10, MG_BLACK, g_font, charStr);
	}
    } 
}
コード例 #21
0
void drawPbStampB(struct pbStamp *pbStampPtr, struct pbStampPict *stampPictPtr)
/* draw the stamp, especially for the AA Anomaly */
{
int ix, iy, iw, ih;
char *stampTable, *stampTitle, *stampDesc;
double txmin, tymin, txmax, tymax;
int i, n, index;
int xx, yy;
char charStr[2];
int titleLen;

stampTable  = cloneString(pbStampPtr->stampTable);
stampTitle  = cloneString(pbStampPtr->stampTitle);
n           = pbStampPtr->len;
txmin       = pbStampPtr->xmin;
txmax       = pbStampPtr->xmax;
tymin       = pbStampPtr->ymin;
tymax       = pbStampPtr->ymax;
stampDesc   = cloneString(pbStampPtr->stampDesc);

ix = stampPictPtr->xOrig;
iy = stampPictPtr->yOrig;
iw = stampPictPtr->width;
ih = stampPictPtr->height;

xScale = (double)(iw)/(txmax - txmin);
yScale = (double)(ih)/(tymax - tymin);

calStampXY(stampPictPtr, txmin, tymax, &xx, &yy);
mapBoxStamp(xx, yy, iw, ih, "Amino Acid Anomalies", "pepAnomalies");
 
calStampXY(stampPictPtr, txmin+(txmax-txmin)/2.0, tymax, &xx, &yy);
vgTextCentered(g_vg, xx-5, yy-12, 10, 10, MG_BLACK, g_font, "Amino Acid Anomalies");
    
titleLen = strlen("Amino Acid Anomoly");
mapBoxStampTitle(xx-5-titleLen*6/2-6, yy-14, titleLen*6+12, 14,  
	         "Amino Acid Anomolies", "pepAnomalies");
/*
calStampXY(stampPictPtr, txmax-(txmax-txmin)*.25, tymin+(tymax-tymin)/4.0*3.0, &xx, &yy);
vgTextCentered(g_vg, xx, yy-10, 10, 10, MG_BLACK, g_font, "+2 stddev");
calStampXY(stampPictPtr, txmax-(txmax-txmin)*.25, tymin+(tymax-tymin)/4.0, &xx, &yy);
vgTextCentered(g_vg, xx, yy-10, 10, 10, MG_BLACK, g_font, "-2 stddev");
*/

index = 0; 
hLine(tx[index], (tymax-tymin)/8.0,     (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/4.0,     (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/8.0*3.0, (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/4.0*3.0, (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/8.0*4.0, (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/8.0*5.0, (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);
hLine(tx[index], (tymax-tymin)/8.0*7.0, (tx[index+1]-tx[index])/2.0, 1, MG_GRAY);

for (index=0; index < (n-1); index++)
    {
    hLine(tx[index], (tymax-tymin)/2.0,     tx[index+1]-tx[index], 1, MG_BLACK);
    }
   
vLine(tx[0], 0, ty[0], 1,  pbBlue);
    
hLine(txmin, tymin, txmax-txmin, 2, boundaryColor);
/* this line needs to call hLine2 for fine tuning at the right hand side ending */ 
hLine2(txmin, tymax, txmax-txmin, 2, boundaryColor);
vLine(txmin, tymin, tymax-tymin, 2, boundaryColor);
vLine(txmax, tymin, tymax-tymin, 2, boundaryColor);
 
if (strcmp(pbStampPtr->stampName, "pepRes") == 0)
    {
    for (i=0; i<20; i++)
    	{
    	calStampXY(stampPictPtr, tx[i], tymin, &xx, &yy);
	safef(charStr, sizeof(charStr), "%c", aaAlphabet[i]);
	vgTextCentered(g_vg, xx+1, yy+5, 10, 10, MG_BLACK, g_font, charStr);
	}
    } 
}
コード例 #22
0
ファイル: masteredit.cpp プロジェクト: Adamiko/los
MasterEdit::MasterEdit()
: AbstractMidiEditor(0, _rasterInit, 0)
{
    setWindowTitle(tr("LOS: Tempo Editor"));
    setWindowIcon(*losIcon);
    mainw->setLayout(mainGrid);
    _raster = 0; // measure
    //setMinimumSize(400, 300);
    //resize(500, 350);

    //---------Pulldown Menu----------------------------
    //      QPopupMenu* file = new QPopupMenu(this);
    //      menuBar()->insertItem("&File", file);

    //---------ToolBar----------------------------------

    QToolBar* info = new QToolBar(tr("Info Tools"));
    addToolBar(Qt::BottomToolBarArea, info);

    editbar = new EditToolBar(this, masterTools);

    info->setFloatable(false);
    info->setMovable(false);

    cursorPos = new PosLabel(0);
    cursorPos->setFixedHeight(22);
    cursorPos->setToolTip(tr("time at cursor position"));
    cursorPos->setObjectName("composerCursor");
    info->addWidget(cursorPos);
    tempo = new TempoLabel(0);
    tempo->setFixedHeight(22);
    tempo->setToolTip(tr("tempo at cursor position"));
    tempo->setObjectName("pitchLabel");
    info->addWidget(tempo);

    const char* rastval[] = {
        QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
    };
    rasterLabel = new QComboBox(this);
    rasterLabel->setFocusPolicy(Qt::NoFocus);
    for (int i = 0; i < 6; i++)
        rasterLabel->insertItem(i, tr(rastval[i]));
    rasterLabel->setCurrentIndex(1);
    info->addWidget(rasterLabel);
    connect(rasterLabel, SIGNAL(currentIndexChanged(int)), SLOT(_setRaster(int)));

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    spacer->setFixedWidth(15);
    info->addWidget(spacer);

    info->addWidget(editbar);

    QWidget* spacer15 = new QWidget();
    spacer15->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    spacer15->setFixedWidth(15);
    info->addWidget(spacer15);

    //---------values for current position---------------
    info->addWidget(new QLabel(tr("CurPos ")));
    curTempo = new TempoEdit(0);
    curSig = new SigEdit(0);
    curSig->setValue(AL::TimeSignature(4, 4));
    curTempo->setToolTip(tr("tempo at current position"));
    curSig->setToolTip(tr("time signature at current position"));
    info->addWidget(curTempo);
    info->addWidget(curSig);
    ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
    connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));

    ///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
    connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));

    //---------------------------------------------------
    //    master
    //---------------------------------------------------

    int xscale = -20;
    int yscale = -500;
    hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
    vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
    vscroll->setRange(30000, 250000);
    time1 = new MTScale(&_raster, mainw, xscale);
    sign = new SigScale(&_raster, mainw, xscale);

    canvas = new Master(this, mainw, xscale, yscale);

    time2 = new MTScale(&_raster, mainw, xscale);
    tscale = new TScale(mainw, yscale);
    time2->setBarLocator(true);

    //---------------------------------------------------
    //    Rest
    //---------------------------------------------------

    //      QSizeGrip* corner   = new QSizeGrip(mainw);

    mainGrid->setRowStretch(5, 100);
    mainGrid->setColumnStretch(1, 100);

    mainGrid->addWidget(hLine(mainw), 0, 1);
    mainGrid->addWidget(time1, 1, 1);
    mainGrid->addWidget(hLine(mainw), 2, 1);
    mainGrid->addWidget(sign, 3, 1);
    mainGrid->addWidget(hLine(mainw), 4, 1);
    mainGrid->addWidget(canvas, 5, 1);
    mainGrid->addWidget(tscale, 5, 0);
    mainGrid->addWidget(hLine(mainw), 6, 1);
    mainGrid->addWidget(time2, 7, 1);
    mainGrid->addWidget(hscroll, 8, 1);
    mainGrid->addWidget(vscroll, 0, 2, 10, 1);


    connect(editbar, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
    connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
    connect(vscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setYMag(float)));

    connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int)));
    connect(vscroll, SIGNAL(scaleChanged(float)), tscale, SLOT(setYMag(float)));

    connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
    connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));

    connect(hscroll, SIGNAL(scaleChanged(float)), time1, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), sign, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), canvas, SLOT(setXMag(float)));
    connect(hscroll, SIGNAL(scaleChanged(float)), time2, SLOT(setXMag(float)));

    connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
    connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));

    connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
    connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
    connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
    connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(posChanged(int, unsigned, bool)));

    connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
    connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
    posChanged(0, song->cpos(), false);
}