bool SymbolPanel::CheckControlLines()
{
	bool res = false;
	if ( !mDragLine && !mDrawing )
	{
		mActiveLine = -1;
		for (int i = 0; i < clNum; ++i)
		{
			if ( mLines[i]->CheckMouse() )
			{
				mActiveLine = i;
				this->SetCursor( mLines[i]->GetCursor() );
				this->SetToolTip( mLines[i]->GetToolTip() );
			}
		}
		if ( mActiveLine == -1 )
		{
			this->SetToolTip( "" );
			this->SetCursor( wxNullCursor );
			mDrawCursor = true;
		}
		else
		{
			mDrawCursor = false;
			res = true;
			PaintNow();
		}
	}
	return res;
}
/* virtual */ bool EditPanel::CursorPressed( int directon )
{
	wxPoint dir( 0, 0 );
	switch ( directon )
	{
		case WXK_LEFT:
			dir.x = -1;
		break;

		case WXK_RIGHT:
			dir.x = 1;
		break;

		case WXK_UP:
			dir.y = -1;
		break;

		case WXK_DOWN:
			dir.y = 1;
		break;

		default:
            return false;
		break;
	}
	if (mBitmapRect.Contains( mCursor + dir ))
	{
		mCursor += dir;
	}
	if (!CommandEdit())
	{
		PaintNow();
	}
	return true;
}
Ejemplo n.º 3
0
/**
 * 画像をリサイズする
 * @param bool toBig true:大きく false:小さく
 */
void wxImagePanel::Resize(bool toBig) {

     if (this->originalHeight <= 0 || this->originalWidth <= 0) {
	  return;
     }

     if ( 0.1 <= this->magnification && this->magnification <= 2.0 ) {
	  if (toBig && magnification == 2.0) {
	       return;
	  } else if (toBig) {
	       // 大きくする
	       this->magnification += 0.1;	       
	  } else if (!toBig && magnification == 0.1) {
	       return;
	  } else {
	       // 小さくする
	       this->magnification -= 0.1;
	  }

	  bool ret = image.LoadFile(imageInfo.imagePath, m_type);
	  if (!ret) {
	       wxMessageBox(wxT("リサイズ実行時に画像ファイルが見つかりませんでした"));
	       return;
	  }

	  wxImage copy = image.ConvertToImage();
	  int x = originalWidth*magnification;
	  int y = originalHeight*magnification;

	  image  = wxBitmap(copy.Rescale(x, y, wxIMAGE_QUALITY_HIGH));
	  PaintNow();
     }
}
/* virtual */ bool PalettePanel::KeyDown( int modifier, int keyCode )
{
	if ( EditPanel::KeyDown( modifier, keyCode ) )
	{
		return true;
	}
	bool res = true;
	switch ( keyCode )
	{
		case WXK_NUM_ONE:
			mLeftPos = mCursor;
		break;

		case WXK_NUM_TWO:
			mRightPos = mCursor;
		break;

		default:
			res = false;
	}
	if (res)
	{
		GetBitmapColour( keyCode == WXK_NUM_TWO );
		PaintNow();
	}
	return res;
}
bool SymbolPanel::DragLine()
{
	if (mDragLine && mActiveLine != -1)
	{
		if (mMousePoint.x != -1 && mMousePoint.y != -1 && mMousePoint != mDragPoint )
		{
			mLines[mActiveLine]->SetValue( mMousePoint );
			SyncronizeValues();
			mDragPoint = mMousePoint;
			PaintNow();
			return true;
		}
	}
	return false;
}
Ejemplo n.º 6
0
/**
 * 画像を元のサイズに戻す
 */
void wxImagePanel::Reset() {

     if (originalHeight <= 0 || originalWidth <= 0) {
	  return;
     }
     
     bool ret = image.LoadFile(imageInfo.imagePath, m_type);	  
     if (!ret) {
	  wxMessageBox(wxT("リサイズ実行時に画像ファイルが見つかりませんでした"));
	  return;
     }

     wxImage copy = image.ConvertToImage();
     image  = wxBitmap(copy.Rescale(originalWidth, originalHeight, wxIMAGE_QUALITY_HIGH));
     this->magnification = 1.0;
     PaintNow();
}
/* virtual */ bool EditPanel::MouseMoving( int modifier, int btn )
{
	if ( DrawPanel::MouseMoving( modifier, btn ) )
	{
		return true;
	}
	if ( this->HasFocus() && mBitmapRect.Contains( mMousePoint ) && mMousePoint != mPreviousPoint)
	{
		mPreviousPoint = mCursor;
		mCursor = mMousePoint;
		if (!CommandEdit())
		{
			PaintNow();
		}
		return true;
	}
	return false;
}
bool EditPanel::DoPlacePixel( const wxPoint& pos, const UttColour& color )
{
	if (mRealScale < 1.0f)
	{
		wxLogMessage( "Unable to edit image with such scale.");
		EndDrawing();
		return false;
	}
	
	if (mImageInfo)
	{
		mImageInfo->GetImage()->WriteIndex(pos, color.GetIndex());
		SendRebuildDataEvent();
	}

	wxMemoryDC temp_dc;
	temp_dc.SelectObject(*mBitmap);
	temp_dc.SetPen( wxPen(color) );
	temp_dc.DrawPoint ( pos );
	PaintNow();
	return true;
}
Ejemplo n.º 9
0
/**
 * 画像を90度回転させる
 * @param bool clockwise true:時計回り false:反時計回り
 */
void wxImagePanel::Rotate90(bool clockwise) {

     wxImage copy = this->image.ConvertToImage();
     image  = wxBitmap(copy.Rotate90(clockwise));
     PaintNow();
}