예제 #1
0
파일: noteedit.cpp 프로젝트: tosky/basket
void HtmlEditor::validate()
{
    if (Tools::htmlToText(textEdit()->toHtml()).isEmpty())
        setEmpty();
    QString convert = textEdit()->document()->toHtml("utf-8");
    if(note()->allowCrossReferences())
        convert = Tools::tagCrossReferences(convert, /*userLink=*/true);

    m_htmlContent->setHtml(convert);
    m_htmlContent->saveToFile();
    m_htmlContent->setEdited();

    disconnect();
    graphicsWidget()->disconnect();
    if (InlineEditors::instance()) {
        InlineEditors::instance()->disableRichTextToolBar();
//      if (InlineEditors::instance()->richTextToolBar())
//          InlineEditors::instance()->richTextToolBar()->hide();
    }
    
    if( graphicsWidget() )
    {
      note()->setZValue(1);
      delete graphicsWidget()->widget();
      setInlineEditor(0);
    }
}
예제 #2
0
Task* LoadTask(char* name) { // modif quand CMD.wd
	FILE* t;
	CMD command;
	char task[1024];
	char* ptr_on_wd;
	Task* tsk = NotUsed();
	
	if (tsk!=NULL) {
		sprintf(task, "%s/%s", PATH_TO_TASKS, name);
		t = fopen(task, "r");
		if (t!=NULL) {
			strncpy(tsk->id, name, 64);
			setEmpty(&(tsk->q));
			tsk->inuse=1;
			tsk->exec=0;
			tsk->demand=0;
			while (fgets(command.cmd, 1024, t)!=NULL) {
				CleanLineFeed(command.cmd);
				if ((ptr_on_wd=strchr(command.cmd, '#'))!=NULL) {
					*ptr_on_wd='\0';
					sprintf(command.wd, "%s", ptr_on_wd+1);
				}
				else command.wd[0]='\0';
				if (!filled(&(tsk->q)))
					addTail(&(tsk->q), command);
			}
			fclose(t);
			sha->loaded++;
			return tsk;
		}
	}
	return NULL;
}
예제 #3
0
파일: Image.cpp 프로젝트: dboesel/libavg
void Image::discard()
{
    assertValid();
    setEmpty();
    m_State = CPU;
    assertValid();
}
예제 #4
0
void
Buffer::initialize(uint8_t value)
{
	setEmpty();
	Assert(data);
	memset(data, value, size);
}
예제 #5
0
    void compute(const T* verts, int size, int components)
    {
      CHECK(components>=2 && components <=4)

      setEmpty();

	    if (size == 0)
		    return;

	    mMin.x() = mMax.x() = (double)verts[0];
	    mMin.y() = mMax.y() = (double)verts[1];
      if (components >= 3)
        mMin.z() = mMax.z() = (double)verts[2];
      else 
        mMin.z() = mMax.z() = 0;

	    for(int i=components; i<size; i+=components)
	    {
		    if ( mMax.x() < (double)verts[i+0] ) mMax.x() = (double)verts[i+0];
		    if ( mMax.y() < (double)verts[i+1] ) mMax.y() = (double)verts[i+1];

		    if ( components >=3 && mMax.z() < (double)verts[i+2] ) mMax.z() = (double)verts[i+2];

		    if ( mMin.x() > (double)verts[i+0] ) mMin.x() = (double)verts[i+0];
		    if ( mMin.y() > (double)verts[i+1] ) mMin.y() = (double)verts[i+1];

		    if ( components >=3 && mMin.z() > (double)verts[i+2] ) mMin.z() = (double)verts[i+2];
	    }
    }
예제 #6
0
void AngleInterval::setIntersection(const AngleInterval& i1, const AngleInterval& i2)
{
  if(i1.isFull()) {
    c = i2.c;
    d = i2.d;
  }
  else if(i2.isFull()) {
    c = i1.c;
    d = i1.d;
  }
  else if(i1.contains(i2.c)) {
    c = i2.c;
    d = Min(i2.d,i1.d-AngleCCWDiff(i2.c,i1.c));
  }
  else if(i2.contains(i1.c)) {
    c = i1.c;
    d = Min(i1.d,i2.d-AngleCCWDiff(i1.c,i2.c));
  }
  else
    setEmpty();
  if(!i1.contains(*this)) {
    printf("Error in i1\n");
    printf("Intersect %f->%f with %f->%f\n",i1.c,i1.d,i2.c,i2.d);
    printf("Result: %f->%f\n",c,d);
  }
  if(!i2.contains(*this)) {
    printf("Error in i2\n");
    printf("Intersect %f->%f with %f->%f\n",i1.c,i1.d,i2.c,i2.d);
    printf("Result: %f->%f\n",c,d);
  }
  Assert(i1.contains(*this));
  Assert(i2.contains(*this));
}
예제 #7
0
 Engine::Engine(double size, const char* type){
   if (size >= 0 && type[0] != '\0'){
     _size = size;
     strcpy(_type, type);
   }
   else
     //Never call Engine(), or *this = Engine();
     setEmpty(); // The best way!
 }
예제 #8
0
파일: noteedit.cpp 프로젝트: tosky/basket
CrossReferenceEditor::CrossReferenceEditor(CrossReferenceContent *crossReferenceContent, QWidget *parent)
        : NoteEditor(crossReferenceContent)
{
    QPointer<CrossReferenceEditDialog> dialog = new CrossReferenceEditDialog(crossReferenceContent, parent);
    if (dialog->exec() == QDialog::Rejected)
        cancel();
    if (crossReferenceContent->url().isEmpty() && crossReferenceContent->title().isEmpty())
        setEmpty();
}
예제 #9
0
파일: noteedit.cpp 프로젝트: tosky/basket
LauncherEditor::LauncherEditor(LauncherContent *launcherContent, QWidget *parent)
        : NoteEditor(launcherContent)
{
    QPointer<LauncherEditDialog> dialog = new LauncherEditDialog(launcherContent, parent);
    if (dialog->exec() == QDialog::Rejected)
        cancel();
    if (launcherContent->name().isEmpty() && launcherContent->exec().isEmpty())
        setEmpty();
}
예제 #10
0
void AngleInterval::setCosLess(Real y)
{
  if(y < -One) setEmpty();
  else if(y >= One) setCircle();
  else {
    c=Acos(y);
    d=TwoPi-Two*c;
  }
}
예제 #11
0
DataCell::DataCell(string &dataInput) : data(0), empty(true)
{
    if(dataInput.size() != 0)
        setEmpty(false);

    replace(dataInput.begin(), dataInput.end(), ',', '.');

    data = atof(dataInput.c_str());
}
예제 #12
0
파일: noteedit.cpp 프로젝트: tosky/basket
LinkEditor::LinkEditor(LinkContent *linkContent, QWidget *parent)
        : NoteEditor(linkContent)
{
    QPointer<LinkEditDialog> dialog = new LinkEditDialog(linkContent, parent);
    if (dialog->exec() == QDialog::Rejected)
        cancel();
    if (linkContent->url().isEmpty() && linkContent->title().isEmpty())
        setEmpty();
}
예제 #13
0
State::State(): turn(WHITE) {
  setBackRow(0, WHITE, &board);
  setPawns(1, WHITE, &board);
  for (int row = 2; row <= 5; ++row) {
    setEmpty(row, &board);
  }
  setPawns(6, BLACK, &board);
  setBackRow(7, BLACK, &board);
}
예제 #14
0
void AngleInterval::setSinLess(Real y)
{
  if(y < -One) setEmpty();
  else if(y >= One) setCircle();
  else {
    c=Asin(y);
    d=Pi+c;
    c=Pi-c;
  }
}
예제 #15
0
void AngleInterval::setSinGreater(Real y)
{
  if(y > One) setEmpty();
  else if(y <= -One) setCircle();
  else {
    c=Asin(y);
    d=Pi-c;
    c=AngleNormalize(c);
  }
}
예제 #16
0
void AngleInterval::setCosGreater(Real y)
{
  if(y >= One) setEmpty();
  else if(y <= -One) setCircle();
  else {
    c=Acos(y);
    d=c+c;
    c=AngleNormalize(-c);
  }
}
예제 #17
0
void MessageView::handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
    Q_ASSERT(topLeft.row() == bottomRight.row() && topLeft.parent() == bottomRight.parent());
    if (topLeft == message) {
        if (viewer == emptyView && message.data(Imap::Mailbox::RoleIsFetched).toBool()) {
            qDebug() << "MessageView: message which was previously not loaded has just became available";
            setEmpty();
            setMessage(topLeft);
        }
        tags->setTagList(message.data(Imap::Mailbox::RoleMessageFlags).toStringList());
    }
}
예제 #18
0
void GrClip::setFromIRect(const GrIRect& r) {
    fList.reset();
    if (r.isEmpty()) {
        // use a canonical empty rect for == testing.
        setEmpty();
    } else {
        fList.push_back();
        fList.back().fRect.set(r);
        fList.back().fType = kRect_ClipType;
        fConservativeBounds.set(r);
        fConservativeBoundsValid = true;
    }
}
예제 #19
0
파일: chars.cpp 프로젝트: qyh/studio
// @brief Assignment operator of Chars
Chars & Chars::operator =(char rhs)
{
	if (isEmpty()){
		m_capacity = sizeof(char);
		m_data = new char[m_capacity];
		if (m_data == NULL) {
			setEmpty();
			return *this;
		}
	}
	m_data[0] = rhs;
	m_length = 1;
	return *this;
}
예제 #20
0
bool StructureSet::remove(Structure* structure)
{
    if (isThin()) {
        if (singleStructure() == structure) {
            setEmpty();
            return true;
        }
        return false;
    }

    OutOfLineList* list = structureList();
    for (unsigned i = 0; i < list->m_length; ++i) {
        if (list->list()[i] != structure)
            continue;
        list->list()[i] = list->list()[--list->m_length];
        if (!list->m_length) {
            OutOfLineList::destroy(list);
            setEmpty();
        }
        return true;
    }
    return false;
}
예제 #21
0
void QLabelImage::loadPixmap(QString path)
{
    
    QLoadImageThread *imageLoader = new QLoadImageThread();
    setEmpty();
    showLoadingPixmap();

    connect(imageLoader, SIGNAL(completed(QPixmap)),
            SLOT(setPrivatePixmap(QPixmap)));
    connect(imageLoader, SIGNAL(finished()),
            imageLoader, SLOT(deleteLater()));

    imageLoader->setPath(path);
    imageLoader->start();
}
예제 #22
0
 SuperHero::SuperHero(const int* powers, int size_of_powers,
         const char* name, double strength):Hero(name, strength){
   if (size_of_powers != 0){
     _size_of_powers = size_of_powers;
     _powers = new int[_size_of_powers];
     for (int i = 0; i < _size_of_powers; i++){
       if (powers[i] > 0)
         _powers[i] = powers[i];
       else
         _powers[i] = 0;
     }
   }
   else
     setEmpty();
 }
예제 #23
0
파일: noteedit.cpp 프로젝트: tosky/basket
void TextEditor::validate()
{
    if (Settings::spellCheckTextNotes() != textEdit()->checkSpellingEnabled()) {
        Settings::setSpellCheckTextNotes(textEdit()->checkSpellingEnabled());
        Settings::saveConfig();
    }

    textEdit()->setCheckSpellingEnabled(false);
    if (textEdit()->document()->isEmpty())
        setEmpty();
    m_textContent->setText(textEdit()->toPlainText());
    m_textContent->saveToFile();
    m_textContent->setEdited();

    note()->setWidth(0);
}
예제 #24
0
  Ship::Ship(const char* type, Engine* engines, int length){
    int i;
    if (type[0] != '\0' && strlen(type) <= 6 && length > 0){
      strcpy(_type, type);
      _length = length;
      for (i = 0; i < length; i++){
        _engines[i] = &engines[i];
      }
      for (; i < 10; i++){
        _engines[i] = NULL;
      }
	  }
    else{
      setEmpty();
    }
  }
예제 #25
0
파일: chars.cpp 프로젝트: qyh/studio
// @brief Assign rhs to Chars, r_len specify rhs's length
// @param rhs, r_len
// @return true on success, or false on error
bool Chars::assign(const char* rhs, size_t r_len)
{
	
	if (!isEmpty()) {
		setEmpty();
	}
	m_capacity = r_len;
	m_data = new char[m_capacity];
	if (m_data == NULL) {
		return false;
	}

	memcpy(m_data, rhs, r_len);
	m_length = r_len;
	
	return true;
}
예제 #26
0
파일: make.c 프로젝트: jackspirou/orson
refObject makingJoker(refChar string, int hook, ...)
{ refJoker newJoker = malloc(jokerSize);
  if (newJoker == nil)
  { fail("Cannot make '%s' in makingJoker!", string); }
  else
  { vaList hooks;
    degree(newJoker) = jokerDegree;
    size(newJoker)   = jokerSize;
    state(newJoker)  = 0x7F;
    tag(newJoker)    = jokerTag;
    self(newJoker)   = setEmpty();
    string(newJoker) = string;
    vaStart(hooks, hook);
    while (hook != 0)
    { self(newJoker) = setAdjoin(self(newJoker), hook);
      hook = vaArg(hooks, int); }
    vaEnd(hooks);
    return toRefObject(newJoker); }}
void SphereVolume::extendBy(const Pnt3f &pt)
{
    if(isUntouchable() == true)
        return;
    
    if(isEmpty() == true)
    {
        _center = pt;
        _radius = 0.f;
        
        setEmpty(false);
    }
    else
    {
        Real32 d = (_center - pt).length();
        
        if(d > _radius)
            _radius = d;
    }
}
예제 #28
0
파일: chars.cpp 프로젝트: qyh/studio
// @brief Assignment operator of Chars
Chars & Chars::operator =(const char *rhs)
{
	size_t r_len = strlen(rhs);
	if (m_capacity < r_len) {

		m_capacity = r_len;
		if(m_data != NULL) {
			delete[] m_data;
		}
		m_data = new char[m_capacity];
		if (m_data == NULL) {
			setEmpty();
			return *this;
		}
	}
	memcpy(m_data, rhs, r_len);
	m_length = r_len;

	return *this;
}
예제 #29
0
Task* AddTask(char* task) {
	Task* t = NotUsed();
	if (sha->loaded < MAXTASK) {
		if (task!=NULL) {
			strncpy(t->id, task, 64);
			t->inuse=1;
			setEmpty(&(t->q));
			sha->loaded++;
			return t;
		}
		else {
			fprintf(stderr, "*** impossible to create an empty task");
			return (Task*)NULL;
		}
	}
	else {
		fprintf(stderr, "*** already too much tasks loaded (max. %d)\n", MAXTASK);
		return (Task*)NULL;
	}
}
예제 #30
0
void ReloadTask(char* name) { // modif quand CMD.wd
	Task* taskptr;
	FILE* t;
	CMD command;
	char task[1024];
	
	sprintf(task, "%s/%s", PATH_TO_TASKS, name);
	t = fopen(task, "r");
	if (t!=NULL) {
		if ((taskptr = GetTask(name))!=NULL) {
			setEmpty(&(taskptr->q));
			while (fgets(command.cmd, 1024, t)!=NULL) {
				CleanLineFeed(command.cmd);
				if (!filled(&(taskptr->q)))
					addTail(&(taskptr->q), command);
			}
			fclose(t);
		}
	}
	else fprintf(stderr, "*** impossible to load %s task\n", name);
}