diff options
author | Rüdiger Timm <rt@openoffice.org> | 2007-07-24 09:34:41 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2007-07-24 09:34:41 +0000 |
commit | 0501897c9462be1b70eae9e301fca990eec3dad6 (patch) | |
tree | 4e7b8d7a356513262ddbbff4525e2b70c3083f40 /vcl/workben | |
parent | c624ad4033828e5c659e99d406dcd946212a9fac (diff) |
INTEGRATION: CWS mergesvp (1.1.2); FILE ADDED
2007/06/28 16:22:01 pl 1.1.2.1: #i78931# add svp test programs
Diffstat (limited to 'vcl/workben')
-rw-r--r-- | vcl/workben/svpclient.cxx | 309 | ||||
-rw-r--r-- | vcl/workben/svptest.cxx | 384 |
2 files changed, 693 insertions, 0 deletions
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx new file mode 100644 index 000000000000..8460d51b2bb2 --- /dev/null +++ b/vcl/workben/svpclient.cxx @@ -0,0 +1,309 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svpclient.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2007-07-24 10:34:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include <sal/main.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <vcl/event.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/button.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/imgctrl.hxx> +#include <vcl/bitmapex.hxx> +#include <tools/stream.hxx> + +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> + +#include <math.h> + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> + +#include <errno.h> +#include <unistd.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + + +using namespace rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +// ----------------------------------------------------------------------- + +// Forward declaration +void Main(); + +// ----------------------------------------------------------------------- + +SAL_IMPLEMENT_MAIN() +{ + Reference< XMultiServiceFactory > xMS; + xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + + InitVCL( xMS ); + ::Main(); + DeInitVCL(); + + return 0; +} + +// ----------------------------------------------------------------------- + +class MyWin : public WorkWindow +{ + PushButton m_aListButton; + ListBox m_aSvpBitmaps; + ImageControl m_aImage; + PushButton m_aQuitButton; +public: + MyWin( Window* pParent, WinBits nWinStyle ); + + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + void KeyInput( const KeyEvent& rKEvt ); + void KeyUp( const KeyEvent& rKEvt ); + void Paint( const Rectangle& rRect ); + void Resize(); + + BOOL Close(); + + void parseList( const rtl::OString& rList ); + rtl::OString processCommand( const rtl::OString& rCommand ); + + DECL_LINK( ListHdl, Button* ); + DECL_LINK( SelectHdl, ListBox* ); + DECL_LINK( QuitHdl, Button* ); +}; + +// ----------------------------------------------------------------------- + +void Main() +{ + MyWin aMainWin( NULL, WB_STDWORK ); + aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "SvpClient" ) ) ); + aMainWin.Show(); + + Application::Execute(); +} + +// ----------------------------------------------------------------------- + +MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : + WorkWindow( pParent, nWinStyle ), + m_aListButton( this, 0 ), + m_aSvpBitmaps( this, WB_BORDER ), + m_aImage( this, WB_BORDER ), + m_aQuitButton( this, 0 ) +{ + m_aListButton.SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) ); + m_aListButton.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "List Elements" ) ) ); + m_aListButton.SetClickHdl( LINK( this, MyWin, ListHdl ) ); + m_aListButton.Show(); + + m_aSvpBitmaps.SetPosSizePixel( Point( 10, 40 ), Size( 150, 150 ) ); + m_aSvpBitmaps.SetSelectHdl( LINK( this, MyWin, SelectHdl ) ); + m_aSvpBitmaps.Show(); + + m_aImage.SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) ); + m_aImage.SetScaleImage( FALSE ); + m_aImage.Show(); + + m_aQuitButton.SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) ); + m_aQuitButton.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Quit SVP server" ) ) ); + m_aQuitButton.SetClickHdl( LINK( this, MyWin, QuitHdl ) ); + m_aQuitButton.Show(); +} + +BOOL MyWin::Close() +{ + BOOL bRet = WorkWindow::Close(); + if( bRet ) + Application::Quit(); + return bRet; +} + +void MyWin::parseList( const rtl::OString& rList ) +{ + sal_Int32 nTokenPos = 0; + rtl::OUString aElementType; + m_aSvpBitmaps.Clear(); + while( nTokenPos >= 0 ) + { + rtl::OString aLine = rList.getToken( 0, '\n', nTokenPos ); + if( ! aLine.getLength() || *aLine.getStr() == '#' ) + continue; + + if( aLine.compareTo( "ElementType: ", 13 ) == 0 ) + aElementType = rtl::OStringToOUString( aLine.copy( 13 ), RTL_TEXTENCODING_ASCII_US ); + else + { + rtl::OUStringBuffer aNewElement( 64 ); + aNewElement.append( aElementType ); + aNewElement.appendAscii( ": " ); + aNewElement.append( rtl::OStringToOUString( aLine, RTL_TEXTENCODING_ASCII_US ) ); + m_aSvpBitmaps.InsertEntry( aNewElement.makeStringAndClear() ); + } + } +} + +rtl::OString MyWin::processCommand( const rtl::OString& rCommand ) +{ + static const char* pEnv = getenv("SVP_LISTENER_PORT"); + rtl::OStringBuffer aAnswer; + int nPort = (pEnv && *pEnv) ? atoi(pEnv) : 8000; + int nSocket = socket( PF_INET, SOCK_STREAM, 0 ); + if( nSocket >= 0) + { + struct sockaddr_in addr; + memset(&addr, 0, sizeof(struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons(nPort); + addr.sin_addr.s_addr = INADDR_ANY; + if( connect( nSocket, (const sockaddr*)&addr, sizeof(addr) ) ) + { + perror( "SvpElementContainer: connect() failed" ); + close(nSocket); + } + else + { + write( nSocket, rCommand.getStr(), rCommand.getLength() ); + write( nSocket, "\n", 1 ); + char buf[256]; + ssize_t nBytes = 0; + do + { + nBytes = read( nSocket, buf, sizeof(buf) ); + aAnswer.append( buf, nBytes ); + } while( nBytes == sizeof( buf ) ); + } + } + else + perror( "SvpElementContainer: socket() failed\n" ); + return aAnswer.makeStringAndClear(); +} + +IMPL_LINK( MyWin, ListHdl, Button*, ) +{ + parseList( processCommand( "list" ) ); + return 0; +} + +IMPL_LINK( MyWin, QuitHdl, Button*, ) +{ + processCommand( "quit" ); + return 0; +} + +IMPL_LINK( MyWin, SelectHdl, ListBox*, ) +{ + String aEntry = m_aSvpBitmaps.GetSelectEntry(); + USHORT nPos = aEntry.SearchAscii( ": " ); + if( nPos != STRING_NOTFOUND ) + { + OStringBuffer aCommand( 64 ); + aCommand.append( "get " ); + aCommand.append( rtl::OUStringToOString( aEntry.Copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) ); + OString aAnswer( processCommand( aCommand.makeStringAndClear() ) ); + SvMemoryStream aStream( aAnswer.getLength() ); + aStream.Write( aAnswer.getStr(), aAnswer.getLength() ); + aStream.Seek( STREAM_SEEK_TO_BEGIN ); + Bitmap aBitmap; + aStream >> aBitmap; + fprintf( stderr, "got bitmap of size %ldx%ld\n", + sal::static_int_cast< long >(aBitmap.GetSizePixel().Width()), + sal::static_int_cast< long >(aBitmap.GetSizePixel().Height())); + Size aFixedSize( aBitmap.GetSizePixel() ); + aFixedSize.Width() += 10; + aFixedSize.Height() += 10; + m_aImage.SetSizePixel( aFixedSize ); + m_aImage.SetBitmap( BitmapEx( aBitmap ) ); + } + return 0; +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseMove( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseMove( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonDown( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonUp( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonUp( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyInput( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyInput( rKEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyUp( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyUp( rKEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::Paint( const Rectangle& rRect ) +{ + WorkWindow::Paint( rRect ); +} + +// ----------------------------------------------------------------------- + +void MyWin::Resize() +{ + WorkWindow::Resize(); +} diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx new file mode 100644 index 000000000000..8e9e4189d63f --- /dev/null +++ b/vcl/workben/svptest.cxx @@ -0,0 +1,384 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svptest.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2007-07-24 10:34:41 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include <sal/main.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <vcl/event.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/gradient.hxx> +#include <vcl/lineinfo.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/metric.hxx> + +#include <rtl/ustrbuf.hxx> + +#include <math.h> + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> + +using namespace rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +// ----------------------------------------------------------------------- + +// Forward declaration +void Main(); + +// ----------------------------------------------------------------------- + +SAL_IMPLEMENT_MAIN() +{ + Reference< XMultiServiceFactory > xMS; + xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); + + InitVCL( xMS ); + ::Main(); + DeInitVCL(); + + return 0; +} + +// ----------------------------------------------------------------------- + +class MyWin : public WorkWindow +{ + Bitmap m_aBitmap; +public: + MyWin( Window* pParent, WinBits nWinStyle ); + + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + void KeyInput( const KeyEvent& rKEvt ); + void KeyUp( const KeyEvent& rKEvt ); + void Paint( const Rectangle& rRect ); + void Resize(); +}; + +// ----------------------------------------------------------------------- + +void Main() +{ + MyWin aMainWin( NULL, WB_APP | WB_STDWORK ); + aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - Workbench" ) ) ); + aMainWin.Show(); + + Application::Execute(); +} + +// ----------------------------------------------------------------------- + +MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : + WorkWindow( pParent, nWinStyle ), + m_aBitmap( Size( 256, 256 ), 32 ) +{ + // prepare an alpha mask + BitmapWriteAccess* pAcc = m_aBitmap.AcquireWriteAccess(); + for( int nX = 0; nX < 256; nX++ ) + { + for( int nY = 0; nY < 256; nY++ ) + { + double fRed = 255.0-1.5*sqrt((double)(nX*nX+nY*nY)); + if( fRed < 0.0 ) + fRed = 0.0; + double fGreen = 255.0-1.5*sqrt((double)(((255-nX)*(255-nX)+nY*nY))); + if( fGreen < 0.0 ) + fGreen = 0.0; + double fBlue = 255.0-1.5*sqrt((double)((128-nX)*(128-nX)+(255-nY)*(255-nY))); + if( fBlue < 0.0 ) + fBlue = 0.0; + pAcc->SetPixel( nX, nY, BitmapColor( sal_uInt8(fRed), sal_uInt8(fGreen), sal_uInt8(fBlue) ) ); + } + } + m_aBitmap.ReleaseAccess( pAcc ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseMove( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseMove( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonDown( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonDown( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::MouseButtonUp( const MouseEvent& rMEvt ) +{ + WorkWindow::MouseButtonUp( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyInput( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyInput( rKEvt ); +} + +// ----------------------------------------------------------------------- + +void MyWin::KeyUp( const KeyEvent& rKEvt ) +{ + WorkWindow::KeyUp( rKEvt ); +} + +// ----------------------------------------------------------------------- + +static Point project( const Point& rPoint ) +{ + const double angle_x = M_PI / 6.0; + const double angle_z = M_PI / 6.0; + + // transform planar coordinates to 3d + double x = rPoint.X(); + double y = rPoint.Y(); + //double z = 0; + + // rotate around X axis + double x1 = x; + double y1 = y * cos( angle_x ); + double z1 = y * sin( angle_x ); + + // rotate around Z axis + double x2 = x1 * cos( angle_z ) + y1 * sin( angle_z ); + //double y2 = y1 * cos( angle_z ) - x1 * sin( angle_z ); + double z2 = z1; + + return Point( (sal_Int32)x2, (sal_Int32)z2 ); +} + +static Color approachColor( const Color& rFrom, const Color& rTo ) +{ + Color aColor; + UINT8 nDiff; + // approach red + if( rFrom.GetRed() < rTo.GetRed() ) + { + nDiff = rTo.GetRed() - rFrom.GetRed(); + aColor.SetRed( rFrom.GetRed() + ( nDiff < 10 ? nDiff : 10 ) ); + } + else if( rFrom.GetRed() > rTo.GetRed() ) + { + nDiff = rFrom.GetRed() - rTo.GetRed(); + aColor.SetRed( rFrom.GetRed() - ( nDiff < 10 ? nDiff : 10 ) ); + } + else + aColor.SetRed( rFrom.GetRed() ); + + // approach Green + if( rFrom.GetGreen() < rTo.GetGreen() ) + { + nDiff = rTo.GetGreen() - rFrom.GetGreen(); + aColor.SetGreen( rFrom.GetGreen() + ( nDiff < 10 ? nDiff : 10 ) ); + } + else if( rFrom.GetGreen() > rTo.GetGreen() ) + { + nDiff = rFrom.GetGreen() - rTo.GetGreen(); + aColor.SetGreen( rFrom.GetGreen() - ( nDiff < 10 ? nDiff : 10 ) ); + } + else + aColor.SetGreen( rFrom.GetGreen() ); + + // approach blue + if( rFrom.GetBlue() < rTo.GetBlue() ) + { + nDiff = rTo.GetBlue() - rFrom.GetBlue(); + aColor.SetBlue( rFrom.GetBlue() + ( nDiff < 10 ? nDiff : 10 ) ); + } + else if( rFrom.GetBlue() > rTo.GetBlue() ) + { + nDiff = rFrom.GetBlue() - rTo.GetBlue(); + aColor.SetBlue( rFrom.GetBlue() - ( nDiff < 10 ? nDiff : 10 ) ); + } + else + aColor.SetBlue( rFrom.GetBlue() ); + + return aColor; +} + +#define DELTA 5.0 +void MyWin::Paint( const Rectangle& rRect ) +{ + WorkWindow::Paint( rRect ); + + Push( PUSH_ALL ); + MapMode aMapMode( MAP_100TH_MM ); + + SetMapMode( aMapMode ); + + Size aPaperSize = GetOutputSize(); + Point aCenter( aPaperSize.Width()/2-300, + (aPaperSize.Height() - 8400)/2 + 8400 ); + Point aP1( aPaperSize.Width()/48, 0), aP2( aPaperSize.Width()/40, 0 ), aPoint; + + DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) ); + DrawRect( Rectangle( Point( 100,100 ), + Size( aPaperSize.Width()-200, + aPaperSize.Height()-200 ) ) ); + DrawRect( Rectangle( Point( 200,200 ), + Size( aPaperSize.Width()-400, + aPaperSize.Height()-400 ) ) ); + DrawRect( Rectangle( Point( 300,300 ), + Size( aPaperSize.Width()-600, + aPaperSize.Height()-600 ) ) ); + + // AllSettings aSettings( Application::GetSettings() ); + + const int nFontCount = GetDevFontCount(); + const int nFontSamples = (nFontCount<15) ? nFontCount : 15; + for( int i = 0; i < nFontSamples; ++i ) + { +#if 0 + Font aFont( GetFont() ); + aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ) ); + aFont.SetWeight( WEIGHT_NORMAL ); + aFont.SetItalic( ITALIC_NONE ); +#else + FontInfo aFont = GetDevFont( (i*nFontCount) / nFontSamples ); + aFont.SetHeight( 400 + (i%7) * 100 ); + aFont.SetOrientation( i * (3600 / nFontSamples) ); +#endif + SetFont( aFont ); + + sal_uInt8 nRed = (i << 6) & 0xC0; + sal_uInt8 nGreen = (i << 4) & 0xC0; + sal_uInt8 nBlue = (i << 2) & 0xC0; + SetTextColor( Color( nRed, nGreen, nBlue ) ); + + OUStringBuffer aPrintText(1024); + long nMaxWidth = 0; + + aPrintText.appendAscii( "SVP test program" ); + + DrawText( Rectangle( Point( (aPaperSize.Width() - 4000) / 2, 2000 ), + Size( aPaperSize.Width() - 2100 - nMaxWidth, + aPaperSize.Height() - 4000 ) ), + aPrintText.makeStringAndClear(), + TEXT_DRAW_MULTILINE ); + } + + SetFillColor(); + DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ), + Size( 3000,3000 ) ) ); + DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ), + Size( 3000,3000 ), + m_aBitmap ); + + Color aWhite( 0xff, 0xff, 0xff ); + Color aBlack( 0, 0, 0 ); + Color aLightRed( 0xff, 0, 0 ); + Color aDarkRed( 0x40, 0, 0 ); + Color aLightBlue( 0, 0, 0xff ); + Color aDarkBlue( 0,0,0x40 ); + Color aLightGreen( 0, 0xff, 0 ); + Color aDarkGreen( 0, 0x40, 0 ); + + Gradient aGradient( GRADIENT_LINEAR, aBlack, aWhite ); + aGradient.SetAngle( 900 ); + DrawGradient( Rectangle( Point( 1000, 4500 ), + Size( aPaperSize.Width() - 2000, + 500 ) ), aGradient ); + aGradient.SetStartColor( aDarkRed ); + aGradient.SetEndColor( aLightBlue ); + DrawGradient( Rectangle( Point( 1000, 5300 ), + Size( aPaperSize.Width() - 2000, + 500 ) ), aGradient ); + aGradient.SetStartColor( aDarkBlue ); + aGradient.SetEndColor( aLightGreen ); + DrawGradient( Rectangle( Point( 1000, 6100 ), + Size( aPaperSize.Width() - 2000, + 500 ) ), aGradient ); + aGradient.SetStartColor( aDarkGreen ); + aGradient.SetEndColor( aLightRed ); + DrawGradient( Rectangle( Point( 1000, 6900 ), + Size( aPaperSize.Width() - 2000, + 500 ) ), aGradient ); + + + + LineInfo aLineInfo( LINE_SOLID, 200 ); + double sind = sin( DELTA*M_PI/180.0 ); + double cosd = cos( DELTA*M_PI/180.0 ); + double factor = 1 + (DELTA/1000.0); + int n=0; + Color aLineColor( 0, 0, 0 ); + Color aApproachColor( 0, 0, 200 ); + while ( aP2.X() < aCenter.X() && n++ < 680 ) + { + aLineInfo.SetWidth( n/3 ); + aLineColor = approachColor( aLineColor, aApproachColor ); + SetLineColor( aLineColor ); + + // switch aproach color + if( aApproachColor.IsRGBEqual( aLineColor ) ) + { + if( aApproachColor.GetRed() ) + aApproachColor = Color( 0, 0, 200 ); + else if( aApproachColor.GetGreen() ) + aApproachColor = Color( 200, 0, 0 ); + else + aApproachColor = Color( 0, 200, 0 ); + } + + DrawLine( project( aP1 ) + aCenter, + project( aP2 ) + aCenter, + aLineInfo ); + aPoint.X() = (int)((((double)aP1.X())*cosd - ((double)aP1.Y())*sind)*factor); + aPoint.Y() = (int)((((double)aP1.Y())*cosd + ((double)aP1.X())*sind)*factor); + aP1 = aPoint; + aPoint.X() = (int)((((double)aP2.X())*cosd - ((double)aP2.Y())*sind)*factor); + aPoint.Y() = (int)((((double)aP2.Y())*cosd + ((double)aP2.X())*sind)*factor); + aP2 = aPoint; + } + Pop(); +} + +// ----------------------------------------------------------------------- + +void MyWin::Resize() +{ + WorkWindow::Resize(); +} |