Пример #1
0
void Editor::undo()
{
    if ( mBackupList.size() > 0 && mBackupIndex > -1 )
    {
        if ( mBackupIndex == mBackupList.size() - 1 )
        {
            BackupElement* lastBackupElement = mBackupList[ mBackupIndex ];
            if ( lastBackupElement->type() == BackupElement::BITMAP_MODIF )
            {
                BackupBitmapElement* lastBackupBitmapElement = ( BackupBitmapElement* )lastBackupElement;
                backup( lastBackupBitmapElement->layer, lastBackupBitmapElement->frame, "NoOp" );
                mBackupIndex--;
            }
            if ( lastBackupElement->type() == BackupElement::VECTOR_MODIF )
            {
                BackupVectorElement* lastBackupVectorElement = ( BackupVectorElement* )lastBackupElement;
                backup( lastBackupVectorElement->layer, lastBackupVectorElement->frame, "NoOp" );
                mBackupIndex--;
            }
        }
        //
        mBackupList[ mBackupIndex ]->restore( this );
        mBackupIndex--;
        mScribbleArea->calculateSelectionRect(); // really ugly -- to improve
    }
}
Пример #2
0
static void
linsertbs()
{
    char    *eol, *now;
    int cnt;

    if(curPos == startOfLine) {
        return;
    }
    backup(1);
    curPos--;
    cnt = 0;
    eol = startOfLine + lineLen - 1;
    now = curPos;
    while(curPos <= eol) {
        *curPos = *(curPos+1);
        curPos++;
        cnt++;
    }
    putbytes(now,cnt-1);
    putchar(' ');
    backup((int)cnt);
    curPos = now;
    lineLen--;
}
Пример #3
0
void Editor::undo()
{
    if (mBackupList.size() > 0 && mBackupIndex > -1)
    {
        if (mBackupIndex == mBackupList.size() - 1)
        {
            BackupElement* lastBackupElement = mBackupList[mBackupIndex];
            if (lastBackupElement->type() == BackupElement::BITMAP_MODIF)
            {
                BackupBitmapElement* lastBackupBitmapElement = static_cast<BackupBitmapElement*>(lastBackupElement);
                backup(lastBackupBitmapElement->layer, lastBackupBitmapElement->frame, "NoOp");
                mBackupIndex--;
            }
            if (lastBackupElement->type() == BackupElement::VECTOR_MODIF)
            {
                BackupVectorElement* lastBackupVectorElement = static_cast<BackupVectorElement*>(lastBackupElement);
                backup(lastBackupVectorElement->layer, lastBackupVectorElement->frame, "NoOp");
                mBackupIndex--;
            }
            if (lastBackupElement->type() == BackupElement::SOUND_MODIF)
            {
                BackupSoundElement* lastBackupSoundElement = static_cast<BackupSoundElement*>(lastBackupElement);
                backup(lastBackupSoundElement->layer, lastBackupSoundElement->frame, "NoOp");
                mBackupIndex--;
            }
        }

        mBackupList[mBackupIndex]->restore(this);
        mBackupIndex--;
        mScribbleArea->cancelTransformedSelection();
        mScribbleArea->calculateSelectionRect(); // really ugly -- to improve
        emit updateBackup();
    }
}
Пример #4
0
void Editor::backup(QString undoText)
{
    KeyFrame* frame = nullptr;
    if (mLastModifiedLayer > -1 && mLastModifiedFrame > 0)
    {
        if (layers()->currentLayer()->type() == Layer::SOUND)
        {
            frame = layers()->currentLayer()->getKeyFrameWhichCovers(mLastModifiedFrame);
            if (frame != nullptr)
            {
                backup(mLastModifiedLayer, frame->pos(), undoText);
            }
        }
        else
        {
            backup(mLastModifiedLayer, mLastModifiedFrame, undoText);
        }
    }
    if (mLastModifiedLayer != layers()->currentLayerIndex() || mLastModifiedFrame != currentFrame())
    {
        if (layers()->currentLayer()->type() == Layer::SOUND)
        {
            frame = layers()->currentLayer()->getKeyFrameWhichCovers(currentFrame());

            if (frame != nullptr)
            {
                backup(layers()->currentLayerIndex(), frame->pos(), undoText);
            }
        }
        else
        {
            backup(layers()->currentLayerIndex(), currentFrame(), undoText);
        }
    }
}
Пример #5
0
int main(int argc, char *argv[])
{
	int do_restore = argc > 1 && strcmp("-r", argv[1]) == 0;
	const char *mode = (do_restore) ? "r+" : "w+";

	/* call perm() and open() before malloc() */
	perm(PERM_START, PERM_SIZE);
	mopen(MMAP_FILE, mode, MMAP_SIZE);
	bopen(BACK_FILE, mode);
	if (do_restore) {
		restore();
	} else {
		home = (home_st *)malloc(sizeof(home_st));
		/* initialize home struct... */
		mflush(); backup();
	}

	for (;/* each step */;) {
		/* Application_Step(); */
		backup();
	}

	free(home);
	mclose();
	bclose();
	return(0);
}
Пример #6
0
/*
**  OPERATOR -- process a token starting with an operator
**
**	Processes operators, strings, comments, and 
**	floating constants without a leading 0.
**
**	Parameters:
**		chr - first character of token {equel_cmap (chr) == OPATR}
**
**	Returns:
**		NUMBER or STRING token, or operator token.
**		CONTINUE on error.
**
**	Side Effects:
**		Adds a node to the Symbol space, and returns adress
**		in "yylval".
**		Opcode is set to the opcode of the operator.
**		May backup a character.
*/
int
operator(char chr)
{
	register struct optab	*op;
	char			opbuf [3];

	opbuf [0] = chr;
	opbuf [1] = getch();
	opbuf [2] = '\0';

	if (opbuf [0] == '.' && equel_cmap(opbuf[1]) == NUMBR) {
		/* floating mantissa w/o leading 0 */
		backup(opbuf [1]);
		return (number(opbuf [0]));
	}
	if (equel_cmap(opbuf[1]) != OPATR) {
		backup(opbuf [1]);
		opbuf [1] = '\0';
	}
	/* operator has been reduced to its smallest 
	 * possible length, now try to find it in the
	 * operator table [tokens.y]
	 */
	for ( ; ; ) {
		for (op = Optab; op->op_term; op++)
			if (strcmp(op->op_term, opbuf) == 0)
				break;
		if (!op->op_term && opbuf [1]) {
			/* reduce a 2 char operator to 1 char,
			 * and re-search
			 */
			backup(opbuf[1]);
			opbuf [1] = '\0';
			continue;
		}
		break;
	}
	if (op->op_term) {
		/* string quotes ? */
		if (op->op_token == Tokens.sp_quote)
			return (string(op));

		/* comment indicator ? */
		if (op->op_token == Tokens.sp_bgncmnt)
			return (comment());

		/* {strcmp(opbuf, op->op_term) == 0} */
		Opcode = op->op_code;
		yylval.u_dn = addsym(op->op_term);
		return (op->op_token);
	}
	yysemerr("bad operator", opbuf);

	/* operator not found, skip token and try again */
	return (CONTINUE);
}
Пример #7
0
void main(int argc, char* argv[]) {
  if (argc == 3) {
    printf("Backup from %s to %s\n",
      argv[1], argv[2]);
    backup(argv[1], argv[2]);
  } else {
    printf("Usage: backup fromDir toDir\n");
    backup("k:\\bc5\\oop\\", "h:\\oop\\");
  }
}
Пример #8
0
void get_tag()
/* saw AGGR or ENUM */
{
	switch (lookahead()) {
	default:
		error('e', "missing tag");
		insert_tok(ID);
		latok->retval.s = "__MISSING__";
	case ID:
	{
		Pname n = ktbl->look(latok->retval.s,HIDDEN);
		if (n == 0) {
			n = new name(latok->retval.s);
			n->lex_level = 0;
			n = n->tname(latok->last->retval.t);
			modified_tn = modified_tn->l;
		}
		else {
			switch (n->tp->base) {
			case COBJ:
			case EOBJ:
				break;
			default:
				error('i',"hidden%n:%t",n,n->tp);
			}
		}
		latok->tok = TNAME;
		latok->retval.pn = n;
		break;
	}
	case TNAME:
		break;
	}

	switch (lookahead()) {
	default:
		backup(); return;
	case COLON:
		switch (lookahead()) {
		case ID: case TNAME: case LC:
			break;
		default:
			backup(); return;
		}
	case LC:{ int level = 1;
		for(;;) switch (lookahead()) {
			case LC: level++; break;
			case RC: if(--level==0) return;
				break;
			case EOFTOK:
				error('i', "unexpected eof");
			}
		} // case LC
	} // switch
}
Пример #9
0
void Editor::backup( QString undoText )
{
    if ( lastModifiedLayer > -1 && lastModifiedFrame > 0 )
    {
        backup( lastModifiedLayer, lastModifiedFrame, undoText );
    }
    if ( lastModifiedLayer != layers()->currentLayerIndex() || lastModifiedFrame != currentFrame() )
    {
        backup( layers()->currentLayerIndex(), currentFrame(), undoText );
    }
}
void Editor::paste()
{
    if((cutFlag||copyFlag)&&layers()->currentLayerIndex()>2)
    {
        newBitmapLayer();
    }
    Layer* layer = mObject->getLayer( layers()->currentLayerIndex() );
    if ( layer != NULL )
    {
        if ( layer->type() == Layer::BITMAP && g_clipboardBitmapImage.image() != NULL )
        {
            backup( tr( "Paste" ) );
            BitmapImage tobePasted = g_clipboardBitmapImage.copy();
            qDebug() << "to be pasted --->" << tobePasted.image()->size();
            if ( mScribbleArea->somethingSelected )
            {
                QRectF selection = mScribbleArea->getSelection();
                if ( g_clipboardBitmapImage.width() <= selection.width() && g_clipboardBitmapImage.height() <= selection.height() )
                {
                    tobePasted.moveTopLeft( selection.topLeft() );
                }
                else
                {
                    tobePasted.transform( selection, true );
                }
            }
            auto pLayerBitmap = static_cast< LayerBitmap* >( layer );
            pLayerBitmap->getLastBitmapImageAtFrame( currentFrame(), 0 )->paste( &tobePasted ); // paste the clipboard
        }
        else if ( layer->type() == Layer::VECTOR && clipboardVectorOk )
        {
            backup( tr( "Paste" ) );
            mScribbleArea->deselectAll();
            VectorImage* vectorImage = ( ( LayerVector* )layer )->getLastVectorImageAtFrame( currentFrame(), 0 );
            vectorImage->paste( g_clipboardVectorImage );  // paste the clipboard
            mScribbleArea->setSelection( vectorImage->getSelectionRect(), true );
            //((LayerVector*)layer)->getLastVectorImageAtFrame(backupFrame, 0)->modification(); ????
        }
    }
    mScribbleArea->updateCurrentFrame();
    if((cutFlag&&!mScribbleArea->somethingSelected)||(copyFlag&&mScribbleArea->somethingSelected))
    {
        mScribbleArea->mySelection=cutArea;
        mScribbleArea->setSelection( mScribbleArea->mySelection, true );
        mScribbleArea->myTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
        mScribbleArea->myTempTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
        mScribbleArea->update();
        mScribbleArea->mIncludeImg[mLayerManager->currentLayerIndex()]=mScribbleArea->mySelection;
        tools()->setCurrentTool(MOVE);
    }
    cutFlag =0;
    copyFlag =0;
}
Пример #11
0
int scan_mod()
/*
	  ptr mod
	| "(" mod ")"
	| mod suf
	| ...
*/
{
for(;;)
	switch (lookahead()) {
	case AND:
	case MUL:                     // ptr mod
		continue;
	case LP:                      // "(" mod ")" [suf] | suf
		switch (lookahead()) {
		case AND:
		case MUL:
		case LP:
		case LB:
			backup();
			if (!scan_mod()) return 0;
			if (lookahead() != RP) return 0;
			if (!scan_suf()) return 0;
			return 1;
		case AGGR: case ENUM: case TYPE: case TNAME:
			backup();
			if (!scan_tlist()) return 0;
			if (lookahead() != RP) return 0;
			/* no break */
		case RP:
			bad_cast = 1;	/* possible cast to ftn */
			if (!scan_suf()) return 0;
			return 1;
		default:
			return 0;
		}
	case LB:                      // mod suf
		backup();
		if (!scan_suf()) return 0;
		return 1;
	case RP:
	case CM:
	case ELLIPSIS:
		backup();
		return 1;
	default:
		return 0;
	}
}
Пример #12
0
//You may wish to change render
void PrintAbsyn::render(Char c)
{
  if (c == '{')
  {
     bufAppend('\n');
     indent();
     bufAppend(c);
     _n_ = _n_ + 2;
     bufAppend('\n');
     indent();
  }
  else if (c == '(' || c == '[')
     bufAppend(c);
  else if (c == ')' || c == ']')
  {
     backup();
     bufAppend(c);
     bufAppend(' ');
  }
  else if (c == '}')
  {
     _n_ = _n_ - 2;
     backup();
     backup();
     bufAppend(c);
     bufAppend('\n');
     indent();
  }
  else if (c == ',')
  {
     backup();
     bufAppend(c);
     bufAppend(' ');
  }
  else if (c == ';')
  {
     backup();
     bufAppend(c);
     bufAppend('\n');
     indent();
  }
  else if (c == 0) return;
  else
  {
     bufAppend(c);
     bufAppend(' ');
  }
}
Пример #13
0
static void *lex_comment(struct lexer *lexer)
{
    while (iscomment(next(lexer)))
        ;
    backup(lexer);
    return lex_config;
}
Пример #14
0
void UMLGeneralizationLine::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * parent )
{
	QPolygonF head;
	head.append( QPointF( 0.0, 0.0 ) );
	head.append( QPointF( cos( PI / 6 ), -sin( PI / 6 ) ) );
	head.append( QPointF( cos( -PI / 6 ), -sin( -PI / 6 ) ) );

	QPainterPath path;
	path.addPolygon( head );

	QTransform transform;
	transform.translate( this->line().p2().x(), this->line().p2().y() );
	transform.scale( ARROW_HEAD_SIZE, ARROW_HEAD_SIZE );
	transform.rotate( 180.0 - this->line().angle() );

	QTransform backup( painter->transform() );
	painter->setTransform( transform, true );
	painter->fillPath( path, QColor( "blue" ) );
	painter->setPen( this->pen() );
	painter->drawPolygon( head );
	painter->setTransform( backup );

	qreal triangleHeight = ::sqrt( 3.0 ) / 2.0;
	QPointF realP2( transform.map( QLineF( QPointF( 0.0, 0.0 ), QPointF( triangleHeight, 0.0 ) ) ).p2() );
	painter->drawLine( this->line().p1(), realP2 );

}
Пример #15
0
void Instances::Sort(const int attIndex)
{
    if (!attribute(attIndex).isNominal())
    {
        // Use quicksort from Utils class for sorting
        double_array vals(numInstances());
        std::vector<Instance*> backup(vals.size());
        for (int i = 0; i < vals.size(); i++)
        {
            Instance &inst = instance(i);
            backup[i] = &inst;
            double val = inst.value(attIndex);
            if (Utils::isMissingValue(val))
            {
                vals[i] = std::numeric_limits<double>::max();
            }
            else
            {
                vals[i] = val;
            }
        }

        int_array sortOrder = Utils::sortWithNoMissingValues(vals);
        for (int i = 0; i < vals.size(); i++)
        {
            mInstances[i] = backup[sortOrder[i]];
        }
    }
    else
    {
        sortBasedOnNominalAttribute(attIndex);
    }
}
Пример #16
0
/* Delete the character under the cursor */
static void
delchr(int del, char *curline, int line_len)
{
   int i, cnt;

   if (cp > cl || del == 0) {
      return;
   }
   while (del-- && cl > 0) {
      cnt = char_count(cp, curline);
      if ((i=cl-cp-cnt) > 0) {
         memcpy(&curline[cp], &curline[cp+cnt], i);
      }
      cl -= cnt;
      curline[cl] = EOS;
      t_clrline(0, t_width);
      i = 0;
      while (cl > cp) {
         forward(curline, line_len);
         i++;
      }
      while (i--) {
         backup(curline);
      }
   }
}
Пример #17
0
static int lvchange_alloc(struct cmd_context *cmd, struct logical_volume *lv)
{
	int want_contiguous = 0;
	alloc_policy_t alloc;

	want_contiguous = strcmp(arg_str_value(cmd, contiguous_ARG, "n"), "n");
	alloc = want_contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
	alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, alloc);

	if (alloc == lv->alloc) {
		log_error("Allocation policy of logical volume \"%s\" is "
			  "already %s", lv->name, get_alloc_string(alloc));
		return 0;
	}

	lv->alloc = alloc;

	/* FIXME If contiguous, check existing extents already are */

	log_verbose("Setting contiguous allocation policy for \"%s\" to %s",
		    lv->name, get_alloc_string(alloc));

	log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);

	/* No need to suspend LV for this change */
	if (!vg_write(lv->vg) || !vg_commit(lv->vg))
		return_0;

	backup(lv->vg);

	return 1;
}
Пример #18
0
static void ItemInHandRenderer_render_hook(ItemInHandRenderer* renderer, float partialTicks) {
	// call the actual Minecraft method first to render the right hand
	ItemInHandRenderer_render_real(renderer, partialTicks);
	// store the current camera position
	MatrixStack::Ref matref = MatrixStack::World.push();
	// move the camera 1 units to the left
	Vec3 oneleft {-1.0f, 0.0f, 0.0f};
	matref.matrix->translate(oneleft);
	uintptr_t playerPtr = *((uintptr_t*) ((uintptr_t) renderer->minecraft + MINECRAFT_LOCAL_PLAYER_OFFSET));
	Inventory* inventory = *((Inventory**) (playerPtr + PLAYER_INVENTORY_OFFSET));
	
	// save the current active slot
	ItemInstance backup(renderer->currentItem);
	// change the active slot to the item held in slot 1
	renderer->currentItem.cloneSafe(inventory->getLinked(1));

	// and call the actual ItemInHandRenderer method in MCPE again
	ItemInHandRenderer_render_real(renderer, partialTicks);

	// restore active slot
	renderer->currentItem.cloneSafe(&backup);

	// restore 
	// MatrixStack::View.pop();
	// the MatrixStack::Ref auto pops
}
Пример #19
0
int			main(int ac, char **av)
{
	t_env	e;

	e.inf.h = 0.2;
	e.div = 2;
	if (ac >= 2 && ac <= 7)
	{
		if (ft_strcmp(av[1], "-help") == 0)
			aff_help();
		e.mlx = mlx_init();
		init_env(&e);
		read_args(&e, ac, av);
		parsing(&e, av[1]);
		e.inf.scale = (((e.arg.winx + e.arg.winy) / (e.p.lenx + e.p.leny)) / 2);
		e.inf.scale = e.inf.scale <= 0 ? 0.8 : e.inf.scale;
		e.orix = e.arg.winx / 2;
		e.oriy = e.arg.winy / e.p.leny;
		backup(&e);
		draw(&e);
	}
	else
		aff_help();
	return (0);
}
Пример #20
0
int scan_suf()
/*
	suf vec | suf arg_type_list | ...
	vec --> "[" [ICON] "]"
	arg_type_list --> "(" [tlist] ")"
*/
{
int found = 0;
for(;;)
	switch (lookahead()) {
	case LB:
		scan_e();
		found = 1;
		continue;
	case LP:
		if (!scan_tlist()) return 0;
		if (lookahead() != RP) return 0;
		if (found) {
			bad_cast = 1;	/* possible cast to ftn */
		} else found = 1;
		continue;
	default:
		backup();
		return 1;
	}
}
Пример #21
0
// Look for string s in token source.
// If found, return 1, with buffer at next char after s,
// else return 0 (caller should back up).
static int
findstr(TokenSource* ts, Rune* s)
{
	int	c0;
	int	n;
	int	nexti;
	int	i;
	int	c;

	c0 = s[0];
	n = runestrlen(s);
	while(1) {
		c = getchar(ts);
		if(c < 0)
			break;
		if(c == c0) {
			if(n == 1)
				return 1;
			nexti = ts->i;
			for(i = 1; i < n; i++) {
				c = getchar(ts);
				if(c < 0)
					goto mainloop_done;
				if(c != s[i])
					break;
			}
			if(i == n)
				return 1;
			backup(ts, nexti);
		}
	}
mainloop_done:
	return 0;
}
Пример #22
0
// We've just read a '<!' at position starti,
// so this may be a comment or other ignored section, or it may
// be just a literal string if there is no close before end of file
// (other browsers do that).
// The accepted practice seems to be (note: contrary to SGML spec!):
// If see <!--, look for --> to close, or if none, > to close.
// If see <!(not --), look for > to close.
// If no close before end of file, leave original characters in as literal data.
//
// If we see ignorable stuff, return Comment.
// Else return nil (caller should back up and try again when more data arrives,
// unless at end of file, in which case caller should just make '<' a data token).
static int
comment(TokenSource* ts)
{
	int	nexti;
	int	havecomment;
	int	c;

	nexti = ts->i;
	havecomment = 0;
	c = getchar(ts);
	if(c == '-') {
		c = getchar(ts);
		if(c == '-') {
			if(findstr(ts, L"-->"))
				havecomment = 1;
			else
				backup(ts, nexti);
		}
	}
	if(!havecomment) {
		if(c == '>')
			havecomment = 1;
		else if(c >= 0) {
			if(findstr(ts, L">"))
				havecomment = 1;
		}
	}
	if(havecomment)
		return Comment;
	return -1;
}
Пример #23
0
BackupDialog::BackupDialog(QWidget* parent) : QDialog(parent)
{
    ui.setupUi(this);

    m_thread = new BackupSizeThread();
    connect(m_thread, SIGNAL(finished()), this, SLOT(updateSizeInfo()));
    connect(m_thread, SIGNAL(terminated()), this, SLOT(updateSizeInfo()));

    connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui.buttonCancel, SIGNAL(clicked()), m_thread, SLOT(quit()));
    connect(ui.buttonChange, SIGNAL(clicked()), this, SLOT(changeBackupPath()));
    connect(ui.buttonBackup, SIGNAL(clicked()), this, SLOT(backup()));

    ui.backupSize->setText(tr("Installation size: calculating ..."));
    m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();

    m_backupName = RbSettings::value(RbSettings::BackupPath).toString();
    if(m_backupName.isEmpty()) {
        m_backupName = m_mountpoint;
    }
    RockboxInfo info(m_mountpoint);
    m_backupName += "/.backup/rockbox-backup-" + info.version() + ".zip";
    ui.backupLocation->setText(QDir::toNativeSeparators(m_backupName));

    m_thread->setPath(m_mountpoint + "/.rockbox");
    m_thread->start();
}
Пример #24
0
bool Editor::importBitmapImage( QString filePath )
{
    backup( tr( "ImportImg" ) );

    QImageReader reader( filePath );

    Q_ASSERT( layers()->currentLayer()->type() == Layer::BITMAP );
    auto layer = static_cast<LayerBitmap*>( layers()->currentLayer() );

    QImage img( reader.size(), QImage::Format_ARGB32_Premultiplied );

    while ( reader.read( &img ) )
    {
        if ( img.isNull() || reader.nextImageDelay() <= 0 )
        {
            break;
        }

        if ( !layer->keyExists( currentFrame() ) )
        {
            addNewKey();
        }
        BitmapImage* bitmapImage = layer->getBitmapImageAtFrame( currentFrame() );

        QRect boundaries = img.rect();
        boundaries.moveTopLeft( mScribbleArea->getCentralPoint().toPoint() - QPoint( boundaries.width() / 2, boundaries.height() / 2 ) );

        BitmapImage* importedBitmapImage = new BitmapImage( boundaries, img );
        bitmapImage->paste( importedBitmapImage );

        scrubTo( currentFrame() + 1 );
    }

    return true;
}
Пример #25
0
bool Editor::importVectorImage( QString filePath )
{
    Q_ASSERT( layers()->currentLayer()->type() == Layer::VECTOR );

    backup( tr( "ImportImg" ) );

    auto layer = static_cast<LayerVector*>( layers()->currentLayer() );

    VectorImage* vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    if ( vectorImage == NULL )
    {
        addNewKey();
        vectorImage = ( ( LayerVector* )layer )->getVectorImageAtFrame( currentFrame() );
    }
    VectorImage* importedVectorImage = new VectorImage;
    bool ok = importedVectorImage->read( filePath );
    if ( ok )
    {
        importedVectorImage->selectAll();
        vectorImage->paste( *importedVectorImage );
    }
    /*
    else
    {
        QMessageBox::warning( mMainWindow,
                              tr( "Warning" ),
                              tr( "Unable to load vector image.<br><b>TIP:</b> Use Vector layer to import vectors." ),
                              QMessageBox::Ok,
                              QMessageBox::Ok );
    }
    */
    return ok;
}
Пример #26
0
int runFail(NDBT_Context* ctx, NDBT_Step* step){
  NdbBackup backup(GETNDB(step)->getNodeId()+1);

  NdbRestarter restarter;

  if (restarter.getNumDbNodes() < 2){
    ctx->stopTest();
    return NDBT_OK;
  }

  if(restarter.waitClusterStarted(60) != 0){
    g_err << "Cluster failed to start" << endl;
    return NDBT_FAILED;
  }

  if (testMaster) {
    if (testSlave) {
      if (backup.FailMasterAsSlave(restarter) != NDBT_OK){
	return NDBT_FAILED;
      }
    } else {
      if (backup.FailMaster(restarter) != NDBT_OK){
	return NDBT_FAILED;
      }
    }
  } else {
    if (backup.FailSlave(restarter) != NDBT_OK){
      return NDBT_FAILED;
    }
  }

  return NDBT_OK;
}
Пример #27
0
//-------------------------------------------------------------------------
void SaveProject(PROJECTITEM *project)
{
    FILE *out ;
    char name[MAX_PATH];
    sprintf(name, "%s.cpj", project->realName);
    if (PropGetBool(NULL, "BACKUP_PROJECTS"))
        backup(name);	
    out = fopen(name, "w");
    if (!out)
    {
        ExtendedMessageBox("Save Error", 0, "Could not save project %s", project->displayName);
        return;
    }
    fprintf(out, "<CC386PROJECT>\n");
    fprintf(out, "\t<VERSION ID=\"%d\"/>\n", PROJVERS);
    fprintf(out, "\t<WORKAREA NAME=\"%s\"/>\n", workArea->realName);
    fprintf(out, "\t<TARGET TITLE=\"%s\">\n", project->displayName);
    SaveProfiles(out, project, 2);    
    fprintf(out, "\t\t<FILES>\n");
    SaveFiles(out, project, project->children,3);
    fprintf(out, "\t\t</FILES>\n");
    fprintf(out, "\t</TARGET>\n");
    fprintf(out, "</CC386PROJECT>\n");
    fclose(out);
    project->changed = FALSE;
}
Пример #28
0
/// @throws AbortError, GetRangesError
void DirectSearch::searchComp(Mem::Random &ram, Comparison::t comp, Async::AbortableProgress &progress) {
	assert(mStatus != DirectStatus::NotStarted);
	if (mStatus == DirectStatus::SavedBackup) {
		Mem::Live live(ram);
		Mem::Backup backup(mBackup.get());
		mBackup = boost::none;
		mStatus = DirectStatus::Started;
		Mem::DoubleBlockEnum blocks(backup, live, Number::maxSize);
		progress.start(blocks.totalSize());
		while (blocks.next()) {
			if (mType) {
				mLocLists[mType.get()].appendComp(blocks, comp);
			}
			else {
				for (size_t type = 0; type < Number::Type::count; ++type) {
					mLocLists[type].appendComp(blocks, comp);
				}
			}
			progress.set(blocks.doneSize());
			progress.check();
		}
	}
	else {
		Mem::Random::Lock lock(ram);
		initProgress(progress);
		for (size_t type = 0; type < Number::Type::count; ++type) {
			mLocLists[type].filterComp(lock, comp, progress);
		}
	}
}
Пример #29
0
void MainWindow::createMenu()
{
    addMenu = new QMenu(this);
    addMenu = this->menuBar()->addMenu(tr("添加"));
    addMemberAction = new QAction(tr("添加/修改家庭成员"),this);
    connect(addMemberAction,SIGNAL(triggered()),this,SLOT(addMember()));
    addMonthDefAction = new QAction(tr("添加/修改月固定支出"),this);
    connect(addMonthDefAction,SIGNAL(triggered()),this,SLOT(addMonthDef()));
    addMenu->addAction(addMemberAction);
    addMenu->addAction(addMonthDefAction);

    dataMenu = new QMenu(this);
    dataMenu = this->menuBar()->addMenu(tr("数据库管理"));
    backupAction = new QAction(tr("数据库备份"),this);
    connect(backupAction,SIGNAL(triggered()),this,SLOT(backup()));
    restoreAction = new QAction(tr("数据库还原"),this);
    connect(restoreAction,SIGNAL(triggered()),this,SLOT(restore()));
    dataMenu->addAction(backupAction);
    dataMenu->addAction(restoreAction);

    aboutMenu = new QMenu(this);
    aboutMenu = this->menuBar()->addMenu(tr("关于"));
    aboutAction = new QAction(tr("软件信息"),this);
    connect(aboutAction,SIGNAL(triggered()),this,SLOT(about()));
    aboutMenu->addAction(aboutAction);


}
Пример #30
0
static void
delete_something()
{
	char	*eol, *now, C, *new;
	int	cnt;

	C = getchar();
	if (C == 'w') {		/* word */
		now = curPos;
		eol = startOfLine + lineLen -1;
		while (curPos <= eol) {
			if (*curPos == ' ')
				break;
			curPos++;
		}
		if (curPos < eol) {
			new = curPos;
			strcpy(now,new);
			cnt = strlen(now);
			putbytes(now,cnt);
			curPos = now + cnt;
			while(curPos <= eol) {
				putchar(' ');
				curPos++;
				cnt++;
			}
			backup(cnt);
		}