Exemplo n.º 1
0
void SliceEditView::GoToSlice(int slicenumber)
{
	//make sure the suggested slice is in range...
	if(slicenumber > pCPJ->getTotalLayers() - 1 || slicenumber < 0)
	{
		return;
	}
	if(slicenumber != currSlice)
	{
		ClearUndoBuffer();
	}	
	
	currSlice = slicenumber;
	setWindowTitle("Slice Manager - " + GetEditMode() + ": " + QString().number(currSlice+1) + " / " + QString().number(pCPJ->getTotalLayers()));
	DeCompressIntoContext();
	
	if(supportMode)
	{
		RefreshContext(0);
	}
	else
	{
		RefreshContext(1);
	}
	
	if(!supportMode)
	{
		SaveToUndoBuffer(); //when moving on to a new slice, always save the state it's in to a buffer.
	}

	greenTimer.start();
}
Exemplo n.º 2
0
void SliceEditView::GoToSlice(int slicenumber)
{
    //确保切片期望值是在范围内...
	if(slicenumber > pCPJ->getTotalLayers() - 1 || slicenumber < 0)
	{
		return;
	}
	if(slicenumber != currSlice)
	{
		ClearUndoBuffer();
	}	
	
	currSlice = slicenumber;
	setWindowTitle("Slice Manager - " + GetEditMode() + ": " + QString().number(currSlice+1) + " / " + QString().number(pCPJ->getTotalLayers()));
	DeCompressIntoContext();
	
	if(supportMode)
	{
		RefreshContext(0);
	}
	else
	{
		RefreshContext(1);
	}
	
	if(!supportMode)
	{
        SaveToUndoBuffer(); //移动到一个新的切片时,始终保存其状态到此缓冲区。
	}

	greenTimer.start();
}
Exemplo n.º 3
0
void SliceEditView::PasteFromClipboard()
{
	if(supportMode)
		return;

	QClipboard *clipboard = QApplication::clipboard();
	if(clipboard->image().isNull())
		return;

	modified = true;
	topImg = clipboard->image();
	pDrawingContext->SetUpperImg(&topImg);
	RefreshContext(1);//so we can undo the paste...
	SaveToUndoBuffer();//since the image is altered, save to the buffer.
	ReCompress();
}
Exemplo n.º 4
0
void SliceEditView::Undo()
{
	if(!supportMode)
	{
		if(backupIndx >= 1)
		{	
			backupIndx--;
			topImg = imgBackup[backupIndx];
			pDrawingContext->SetUpperImg(&topImg);
			RefreshContext(1);
			modified = true;
			ReCompress();
			pDrawingContext->update();
		}
	}
}
Exemplo n.º 5
0
void SliceEditView::PasteFromClipboard()
{
	if(supportMode)
		return;

	QClipboard *clipboard = QApplication::clipboard();
	if(clipboard->image().isNull())
		return;

	modified = true;
	topImg = clipboard->image();
	pDrawingContext->SetUpperImg(&topImg);
    RefreshContext(1);//所以我们可以撤消粘贴...
    SaveToUndoBuffer();//由于图像被改变,保存到缓冲器。
	ReCompress();
}
Exemplo n.º 6
0
void SliceEditView::Redo()
{
	if(!supportMode)
	{
		backupIndx++;
		if(backupIndx >= imgBackup.size())
		{
			backupIndx = imgBackup.size() - 1;
			return;
		}

		topImg = imgBackup[backupIndx];
		pDrawingContext->SetUpperImg(&topImg);
		RefreshContext(1);
		modified = true;
		ReCompress();
		pDrawingContext->update();
	}
}