IntervalAnchor::IntervalAnchor(string id, double begin, double end) : ContentAnchor(id) { typeSet.insert("IntervalAnchor"); this->begin = 0; setEnd(end); setBegin(begin); }
int Timer::timeDiff() { setEnd(); int time_used = ((m_end.tv_sec - m_begin.tv_sec) * 1000000 \ +(m_end.tv_usec - m_begin.tv_usec)); setBegin(); return time_used; }
int SampleChannel::loadByPatch(const char *f, int i) { int res = load(f); volume = G_Patch.getVol(i); key = G_Patch.getKey(i); index = G_Patch.getIndex(i); mode = G_Patch.getMode(i); mute = G_Patch.getMute(i); mute_s = G_Patch.getMute_s(i); solo = G_Patch.getSolo(i); boost = G_Patch.getBoost(i); panLeft = G_Patch.getPanLeft(i); panRight = G_Patch.getPanRight(i); readActions = G_Patch.getRecActive(i); recStatus = readActions ? REC_READING : REC_STOPPED; readPatchMidiIn(i); midiInReadActions = G_Patch.getMidiValue(i, "InReadActions"); midiInPitch = G_Patch.getMidiValue(i, "InPitch"); readPatchMidiOut(i); if (res == SAMPLE_LOADED_OK) { setBegin(G_Patch.getBegin(i)); setEnd (G_Patch.getEnd(i, wave->size)); setPitch(G_Patch.getPitch(i)); } else { // volume = DEFAULT_VOL; // mode = DEFAULT_CHANMODE; // status = STATUS_WRONG; // key = 0; if (res == SAMPLE_LEFT_EMPTY) status = STATUS_EMPTY; else if (res == SAMPLE_READ_ERROR) status = STATUS_MISSING; sendMidiLplay(); } return res; }
void Editable::paint(Graphics &g) { Size fsize = g.getFont().getSize(); Size size = getSize(); int count = getMaxCharNum(g); gpos_t ystart = (size.height - fsize.height) / 2; int start = _begin; /* if begin could not be determined previously, try that again */ if(_begin == std::numeric_limits<size_t>::max()) { setBegin(); assert(_begin != std::numeric_limits<size_t>::max()); start = _begin; } string text = _secret ? string(_str.length(),'*') : _str; count = MIN((int)text.length(),count); g.setColor(getTheme().getColor(Theme::TEXT_BACKGROUND)); g.fillRect(1,1,size.width - 2,size.height - 2); g.setColor(getTheme().getColor(_focused ? Theme::CTRL_DARKBORDER : Theme::CTRL_BORDER)); g.drawRect(Pos(0,0),size); gsize_t pad = getTheme().getTextPadding(); if(_selStart != -1) { int spos; /* selection background */ g.setColor(getTheme().getColor(Theme::SEL_BACKGROUND)); spos = (start > _selStart ? 0 : (_selStart - start)); g.fillRect(pad + fsize.width * spos, ystart - CURSOR_OVERLAP, fsize.width * (MIN(count - spos,MIN(_selEnd - start,_selEnd - _selStart))), fsize.height + CURSOR_OVERLAP * 2); /* part before selection */ if(start < _selStart) { g.setColor(getTheme().getColor(Theme::TEXT_FOREGROUND)); g.drawString(pad,ystart,text,start,MIN(count,_selStart)); } /* selection */ g.setColor(getTheme().getColor(Theme::SEL_FOREGROUND)); g.drawString(pad + fsize.width * spos,ystart,text,MAX(start,_selStart), (MIN(count - spos,MIN(_selEnd - start,_selEnd - _selStart)))); /* part behind selection */ if(_selEnd < start + count) { g.setColor(getTheme().getColor(Theme::TEXT_FOREGROUND)); spos = _selEnd - start; g.drawString(pad + spos * fsize.width,ystart,text,_selEnd, MIN(count - spos,MIN((int)text.length() - start,(int)text.length() - _selEnd))); } } else { g.setColor(getTheme().getColor(Theme::TEXT_FOREGROUND)); g.drawString(pad,ystart,text,start,count); } if(_focused) { g.setColor(getTheme().getColor(Theme::CTRL_DARKBORDER)); g.fillRect(pad + fsize.width * (_cursor - start), ystart - CURSOR_OVERLAP,CURSOR_WIDTH,fsize.height + CURSOR_OVERLAP * 2); } }
ImageView::ImageView(QWidget *parent) : QMainWindow(parent), ui(new Ui::ImageView) { ui->setupUi(this); setWindowTitle("MicroLab ImgP"); //! \brief connectActionToSlots //! connectActionToSlots(); newSonWidgets(); connect(ui->openDirAction, SIGNAL(triggered()), this, SLOT(openDir())); connect(ui->openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs())); connect(ui->actionExit_4, SIGNAL(triggered()), this, SLOT(close())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextImage())); connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(previousImage())); connect(ui->beginButton, SIGNAL(clicked()), this, SLOT(setBegin())); connect(ui->endButton, SIGNAL(clicked()), this, SLOT(setEnd())); connect(ui->slideShowButton, SIGNAL(clicked()), this, SLOT(slideShow())); connect(ui->slideShowDelaySlider, SIGNAL(valueChanged(int)), this, SLOT(setSlideShowDelay(int))); slideshowTimer = new QTimer(this); connect(slideshowTimer, SIGNAL(timeout()), this, SLOT(nextImage())); ui->imageNameLabel->setText(tr("Select a folder from the <b>file -> openDir</b> or <b>file->openFile</b> menu to view images or image..")); ui->openFileAction->setShortcut(tr("Ctrl+O")); setImage(":/images/Cover.jpg"); ui->previousButton->setEnabled(false); ui->nextButton->setEnabled(false); ui->beginButton->setEnabled(false); ui->endButton->setEnabled(false); ui->slideShowButton->setEnabled(false); ui->slideShowDelaySlider->setEnabled(false); ui->slideShowDelayLabel->setEnabled(false); ui->slideShowDelaySlider->setValue(15); //! NOTICE HERE ui->actionOpen_Recent_Files->setEnabled(false); ui->actionSave->setEnabled(false); ui->actionSave_As->setEnabled(true); ui->actionLecel_Set->setEnabled(false); //! @warning Bug setButtonIcon(ui->slideShowButton, ":/images/buttons/play.png", 48, 48); setButtonIcon(ui->nextButton, ":/images/buttons/next.png", 48, 48); setButtonIcon(ui->previousButton, ":/images/buttons/back.png", 48, 48); setButtonIcon(ui->beginButton, ":/images/buttons/rewind.png", 48, 48); setButtonIcon(ui->endButton, ":/images/buttons/fastfwd.png", 48, 48); setWindowTitle(tr("ImageView")); folderName = ""; imageNumber = 0; totalImages = 0; slideShowDelay = 2.0; QLabel *label = new QLabel("<a href = http://yajunyang.cn>connect me...</a>", this); connect(label, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString))); ui->statusBar->insertWidget(0, label); }
Timer::Timer() { setBegin(); }