Example #1
0
// ****************************************************************************
//
//  Function Name:	RSolidColor::DarkenBy( )
//
//  Description:		
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RSolidColor::DarkenBy( YScaleFactor scale )
	{
	YColorComponent	red	= GetRed();
	YColorComponent	green	= GetGreen();
	YColorComponent	blue	= GetBlue();
	uLONG				redder	= static_cast<uLONG>( ::Round( static_cast<YRealDimension>( red )  * scale ) );
	uLONG				greener	= static_cast<uLONG>( ::Round( static_cast<YRealDimension>( green )  * scale ) );
	uLONG				bluer		= static_cast<uLONG>( ::Round( static_cast<YRealDimension>( blue )  * scale ) );

	TpsAssert( ( scale >= 0.0 ), "Negative color component makes no sense." );
	TpsAssert( ( scale <= 1.0 ), "Bad color component scale factor." );

	red	= ( redder > red ) ? kMinColorComponent : static_cast<YColorComponent>( red - redder );
	green	= ( greener > green ) ? kMinColorComponent : static_cast<YColorComponent>( green - greener );
	blue	= ( bluer > blue ) ? kMinColorComponent : static_cast<YColorComponent>( blue - bluer );

#ifdef	_WINDOWS							 
	m_Color = RGB( red, green, blue );
#endif	// _WINDOWS
#ifdef	MAC							 
	m_Color.red = red;
	m_Color.green = green;
	m_Color.blue = blue;
#endif	// MAC
	}
Example #2
0
// ****************************************************************************
//
//  Function Name:	RCompositeSelection::Unselect( )
//
//  Description:		Removes a selection from this composite
//
//  Returns:			Nothing
//
//  Exceptions:		Memory
//
// ****************************************************************************
//
void RCompositeSelection::Unselect( const RComponentView* pSelectableObject, BOOLEAN fRender )
{
    YSelectionCollectionIterator iterator = m_SelectionCollection.Start( );
    for( ; iterator != m_SelectionCollection.End( ); ++iterator )
    {
        TpsAssert( dynamic_cast<RSingleSelection*>( *iterator ), "Nested compounds not implemented yet." );

        if( ( *iterator )->IsSelected( pSelectableObject ) )
        {
            // Create a drawing surface and transform
            RViewDrawingSurface drawingSurface( m_pView );
            R2dTransform transform;
            SetupRender( drawingSurface, transform );
            RRealRect rect( m_pView->GetSize( ) );

            if( ShouldRenderSelection( ) && fRender )
                ( *iterator )->Render( drawingSurface, transform, rect );

            delete *iterator;
            m_SelectionCollection.RemoveAt( iterator );

            return;
        }
    }

    // Tell the view the selection is changing
    m_pView->OnChangeSelection( );

    TpsAssert( FALSE, "Object was not selected." );
}
Example #3
0
// ****************************************************************************
//
//  Function Name:	::CompareSelection( )
//
//  Description:		Compares two single selections for z-order. Used by the
//							sort routine below.
//
//  Returns:			1 if selection1 is is higher in z-order than selection 2
//  Returns:			-1 if selection1 is is lower in z-order than selection 2
//
//  Exceptions:		Memory
//
// ****************************************************************************
//
int CompareSelection( RSelection* pSelection1, RSelection* pSelection2 )
{
    TpsAssert( dynamic_cast<RSingleSelection*>( pSelection1 ), "Nested compounds not implemented yet." );
    TpsAssert( dynamic_cast<RSingleSelection*>( pSelection2 ), "Nested compounds not implemented yet." );

    return( static_cast<RSingleSelection*>( pSelection1 )->IsHigherZOrder( *static_cast<RSingleSelection*>( pSelection2 ) ) ) ? 1 : -1;
}
Example #4
0
// ****************************************************************************
//
//  Function Name:	RCompositeSelection::Select( )
//
//  Description:		Adds a selection to this composite
//
//  Returns:			Nothing
//
//  Exceptions:		Memory
//
// ****************************************************************************
//
void RCompositeSelection::Select( const RComponentView* pSelectableObject, BOOLEAN fRender )
{
    // Validate
    TpsAssert( pSelectableObject, "NULL Selection" );
    TpsAssertValid( pSelectableObject );

    // Dont select if it is not selectable
    if( !pSelectableObject->GetComponentAttributes( ).IsSelectable( ) )
        return;

    // Check to see if it already in the selection list
    TpsAssert( IsSelected( pSelectableObject ) == FALSE, "Selection is already in this composite." );

    // Create a new selection and add it
    RSingleSelection* pNewSelection = new RSingleSelection( pSelectableObject, m_pView );
    m_SelectionCollection.InsertAtEnd( pNewSelection );

    // Create a drawing surface and transform
    RViewDrawingSurface drawingSurface( m_pView );
    R2dTransform transform;
    SetupRender( drawingSurface, transform );
    RRealRect rect( m_pView->GetSize( ) );

    if( fRender && ShouldRenderSelection( ) )
        pNewSelection->Render( drawingSurface, transform, rect );

    // Tell the view the selection is changing
    m_pView->OnChangeSelection( );
}
Example #5
0
void RSoftGlowSettings::Validate() const
{
	RObject::Validate();
	TpsAssertIsObject( RSoftGlowSettings, this );
	TpsAssert( 0.0 <= m_fGlowOpacity && m_fGlowOpacity <= 1.0, "Soft glow opacity not in range 0 - 1" );
	TpsAssert( 0.0 <= m_fGlowEdgeSoftness && m_fGlowEdgeSoftness <= 1.0, "Soft glow edge softness not in range 0 - 1" );
}
Example #6
0
COLORREF RWinColorPalette::ColorFromPoint( RIntPoint ptCell )
{
	RBitmapImage&	biPalette	= GetPaletteBitmapImage();
//	TpsAssert( biPalette.GetSystemHandle(), "Uninitialized palette!" );
	TpsAssert( biPalette.GetBitDepth() == 8, "Invalid bit-depth for color palette!" );
	TpsAssert( ptCell.m_x < (int) biPalette.GetWidthInPixels(), "Invalid coordinate!" );
	TpsAssert( ptCell.m_y < (int) biPalette.GetHeightInPixels(), "Invalid coordinate!" );

	void*     pRawData   = biPalette.GetRawData();
	RGBQUAD*  pColorData = (RGBQUAD *) RBitmapImage::GetColorData( pRawData );
	LPBYTE    pImageData = (LPBYTE) RBitmapImage::GetImageData( pRawData );

	uLONG     ulBytesPerRow = RBitmapImage::GetBytesPerRow( 
					biPalette.GetWidthInPixels(), 
					biPalette.GetBitDepth() );

	YIntDimension biHeight = ((BITMAPINFOHEADER *) pRawData)->biHeight;

	if (biHeight >= 0)
	{
		// The bitmap is bottom up.
		ptCell.m_y = (biHeight - 1) - ptCell.m_y ;
	}

	uLONG nIndex = (ptCell.m_y) * ulBytesPerRow + ptCell.m_x;
	RGBQUAD rgb  = pColorData[ pImageData[nIndex] ];
	
	return RGB( rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue );
}
Example #7
0
LRESULT CALLBACK RCdSwapDialog::myWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	if (uMsg == WM_DEVICECHANGE)
	{
		DEV_BROADCAST_VOLUME* dbcv = (DEV_BROADCAST_VOLUME*)lParam;
		int iDrive;

		switch (wParam)
		{
		case DBT_DEVICEARRIVAL:
			if (dbcv->dbcv_devicetype == DBT_DEVTYP_VOLUME &&
				(dbcv->dbcv_flags & DBTF_MEDIA))
			{
				for (iDrive = 0; iDrive < 26; iDrive++)
				{
					if (dbcv->dbcv_unitmask & (1L << iDrive))
					{
						TRACE( "CD inserted in drive %d - end dialog now\n", iDrive );
						TpsAssert( pThisDialog, "pThisDialog is NULL!" );
						pThisDialog->EndDialog( IDOK );
					}
				}
			}
			break;
		}
	}
	TpsAssert( pThisDialog, "pThisDialog is NULL!" );
	TpsAssert( pThisDialog->pOSWndProc, "pThisDialog->pOSWndProc is NULL!" );
	return pThisDialog->pOSWndProc( hWnd, uMsg, wParam, lParam );
}
Example #8
0
void REdgeOutlineSettings::Validate() const
{
	RObject::Validate();
	TpsAssertIsObject(REdgeOutlineSettings, this);
	TpsAssert(0 <= m_nEdgeOutlineWidth && m_nEdgeOutlineWidth <= 7, "Outline edge width not in range 0 - 7");
	TpsAssert(0 <= m_rcEdgeOutlineColor && m_rcEdgeOutlineColor <= 0x00ffffff, "Outline edge color in range 0 - 0x00ffffff");
}
Example #9
0
// ****************************************************************************
//
//  Function Name:	_AssertDIBInfo()
//
//  Description:		Validate information in DIBINFO structure.
//
//  Returns:			none
//
//  Exceptions:		none
//
// ****************************************************************************
static void _AssertDIBInfo (const DIBINFO& Dib)
{
	TpsAssert(Dib.pBits != NULL, "Bad DIB pointer");
	TpsAssert(Dib.Width > 0 &&  Dib.Width < 0x3FFF, "Bad DIB width");
	TpsAssert(Dib.Height > 0 &&  Dib.Height < 0x3FFF, "Bad DIB height");
	TpsAssert(Dib.BytesPerPixel > 0 && Dib.BytesPerPixel <= 4, "Bad DIB bytes/pixel");
	TpsAssert(Dib.BytesPerRow > 0 && Dib.BytesPerRow < 0x7FFF, "Bad DIB bytes/row");
}
Example #10
0
// ****************************************************************************
//
//  Function Name:	RCursor::SpinCursor( )
//
//  Description:		Continue spinning the cursor if the count is > 0
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void	RCursor::DoStartSpin( )
	{
	TpsAssert( m_StartSpinCount > 0, "The SpinCursor was never started" );
	TpsAssert( m_StartSpinTime <= RenaissanceGetTickCount()," The Cursor is starting to spin to soon" );
	if ( !m_fSpinStarted )
		AfxGetApp( )->BeginWaitCursor( );
	m_fSpinStarted = TRUE;
	}
Example #11
0
// ****************************************************************************
//
//  Function Name:	RWHPTriple::operator+( )
//
//  Description:		Addition operator
//
//  Returns:			Result of the color addition
//
//  Exceptions:		None
//
// ****************************************************************************
RWHPTriple RWHPTriple::operator+( const RWHPTriple& rhs ) const
{
	double flWhite  = m_flWhite ;
	double flHue    = m_flHue ;
	double flPurity = m_flPurity ;

	//
	// White
	//
	if (rhs.m_flWhite > 0.0)
	{
		flWhite = m_flWhite + (1.0 - m_flWhite) * rhs.m_flWhite ;
	}
	else if (rhs.m_flWhite < 0.0)
	{
		flWhite = m_flWhite + m_flWhite * rhs.m_flWhite ;
	}

	// Kill whiteness for a black in model gradient
	if ((rhs.m_flPurity < 0.0) && !(rhs.m_flWhite > 0))
	{
		flWhite += flWhite * rhs.m_flPurity ;
	}

	//
	// Hue
	//
	flHue += rhs.m_flHue ;

	if (flHue >= 3.0)
	{
		flHue -= 3.0 ;
	}
	if (flHue < 0.0)
	{
		flHue += 3.0 ;
	}

	//
	// Purity
	//
	if (rhs.m_flPurity > 0.0)
	{
		flPurity += (1.0 - m_flPurity) * rhs.m_flPurity ;
	}
	else if (rhs.m_flPurity < 0.0)
	{
		flPurity += m_flPurity * rhs.m_flPurity ;
	}

	TpsAssert( 0.0 <= m_flWhite  && m_flWhite  <= 1.0, "Invalid whiteness component!") ;
	TpsAssert( 0.0 <= m_flHue    && m_flHue    <= 3.0, "Invalid hue component!") ;
	TpsAssert( 0.0 <= m_flPurity && m_flPurity <= 1.0, "Invalid purity component!") ;

	return RWHPTriple( flWhite, flHue, flPurity ) ;
}
Example #12
0
// ****************************************************************************
//
//  Function Name:	RGpSurfaceState::Restore( )
//
//  Description:		restore the previously saved state
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpSurfaceState::Restore()
{
    TpsAssert( m_pSurface!=NULL, "Attempting to restore an uninitialized or already restored state" );

    RGpDrawingSurface* pDrawingSurface = dynamic_cast<RGpDrawingSurface*>( m_pSurface );
    TpsAssert( pDrawingSurface!=NULL, "GpScriptSurfaceState restoring the state of a non-gp drawing surface" );
    RSurfaceState::Restore();

    UnimplementedCode();
}
Example #13
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::SolidPolylineTo( )
//
//  Description:		Draws a bunch of solid lines, using and updating the
//							current point.
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpDrawingSurface::SolidPolylineTo( const RIntPoint* pPoints, YPointCount numPoints )
{
    TpsAssert( ( numPoints > 0 ), "Need at least 1 point." );
    TpsAssert( ( numPoints < kMaxPoints ), "Too many points." );

    for ( int i = 0; i < numPoints; i++ )
    {
        ::LineTo( ( pPoints->m_x - m_PenWidthOffset ), ( pPoints->m_y - m_PenWidthOffset ) );
        pPoints++;
    }
}
Example #14
0
// ****************************************************************************
//
//  Function Name:	operator==( YFontInfo& , YFontInfo&)
//
//  Description:		True if the font info structures match
//
//  Returns:			TRUE if the font info structures match
//
//  Exceptions:		Nothing
//
// ****************************************************************************
//
BOOLEAN YFontInfo::operator==( const YFontInfo& rhs ) const
	{
	TpsAssert( ulPadding == 0, "The Font1 padding field is not 0" );
	TpsAssert( rhs.ulPadding == 0, "The Font2 padding field is not 0" );
	
	return static_cast<BOOLEAN>( ( (attributes == rhs.attributes) &&
											 (height == rhs.height)	&&
											 //(width == rhs.width) &&
											 (angle == rhs.angle)	&&
											 (strcmp( sbName, rhs.sbName) == 0) ) );
	}
Example #15
0
// ****************************************************************************
//
//  Function Name:	RNumberDialog::GetSmartNumberSuffix
//
//  Description:		Return internationally correct suffix for given string
//							embedded number
//
//  Returns:			suffix
//
//  Exceptions:		None
//
// ****************************************************************************
RMBCString RNumberDialog::GetSmartNumberSuffix( const RMBCString& rNumber )
{
    int nNumber = atoi( (LPCSZ)rNumber );
    TpsAssert( nNumber >= 0 , "Number string invalid. Negative numbers not supported." );
    TpsAssert( nNumber <= kMaxNumber, "Number string invalid. Too large.");
    TpsAssert( rNumber.GetStringLength() <= kMaxNumNumbers, "Number string too long" );
    if( nNumber == 0 && rNumber.GetStringLength() > 1 )
    {
        TpsAssertAlways( "Invalid number string." );
    }

    //
    // Only interested in the last two digits of number (ie. Suffix for 12 is the
    // same as suffix for 112)
    int nMeaningfulDigits = atoi( (LPCSZ)rNumber );
    if( rNumber.GetStringLength() > 2 )
    {
        // If the number is three digits or greater, just get the last two digits..
        char sDigitConvert[3];
        //strncpy( sDigitConvert, (LPCSZ)rNumber[ rNumber.GetStringLength() - 2 ], 2 );
        sDigitConvert[ 0 ] = rNumber[ rNumber.GetStringLength() - 2 ];
        sDigitConvert[ 1 ] = rNumber[ rNumber.GetStringLength() - 1 ];
        sDigitConvert[ 2 ] = 0;
        nMeaningfulDigits = atoi( sDigitConvert );
    }
    //
    // To be safe for all languages we define suffixes for every number up to
    // 20, then just define suffixes for the second digit for numbers greater
    // than that.
    if( nMeaningfulDigits < kNumberOfSuffixesDefinedFromZero )
    {
        /*!!!!!!!!!!!!       NOTE        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
        // Smart number ids from 0-19 MUST be sequential or the proper suffix will
        // NOT be used!!!!!! -MWH
        int nFirstSuffixInResource = IDS_SMARTNUM_SUFFIX_0;
        return ::GetResourceManager().GetResourceString( nFirstSuffixInResource + nMeaningfulDigits );
    }
    else
    {
        //
        // Number is greater than 20, need to get last digit suffix
        RMBCString rLastDigit("");
        rLastDigit += rNumber[rNumber.GetStringLength()-1];
        int nLastDigit = atoi( (LPCSZ)rLastDigit );
        /*!!!!!!!!!!!!       NOTE        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
        // Smart number two digit ids MUST be sequential or the proper suffix will
        // NOT be used!!!!!! -MWH
        int nFirst2DigitSuffixInResource = IDS_SMARTNUM_2DIGIT_SUFFIX_0;
        return ::GetResourceManager().GetResourceString( nFirst2DigitSuffixInResource + nLastDigit );
    }
}
Example #16
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::SetClipRect( )
//
//  Description:		Sets the current clip rect
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpDrawingSurface::SetClipRect( const RIntRect& clipRect )
{
    GrafPtr		pGrafPort = (GrafPtr)GetSurface();
    GrafPtr		holdPort;
    Rect			qdRect;

    TpsAssert( ( pGrafPort != NULL ), "Nil surface device pointer." );
    TpsAssert( ( !clipRect.IsEmpty() ), "Empty clip rect." );
    ::GetPort( &holdPort );
    ::SetPort( pGrafPort );
    ::SetRect( &qdRect, clipRect.m_Left, clipRect.m_Top, clipRect.m_Right, clipRect.m_Bottom );
    ::ClipRect( &qdRect );
    ::SetPort( holdPort );
}
Example #17
0
// ****************************************************************************
//
//  Function Name:	RGroupSelectionAction::Undo( )
//
//  Description:		Undoes the action
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGroupSelectionAction::Undo( )
	{
	// Call the base method to setup the state properly
	RUndoableAction::Undo( );

	// Make sure the component was created properly
	TpsAssert( m_pGroupDocument, "No group document" );

	// Remove the current selection
	m_pCurrentSelection->Remove( );

	// Make a component collection
	RComponentCollection componentCollection ( m_OldSelection );

	// Transfer the components out of the group
	m_pParentDocument->TransferComponents( m_pGroupDocument,
														componentCollection,
														componentCollection.GetBoundingRect( ),
														m_GroupBoundingRect );

	// Remove the group component
	m_pParentDocument->RemoveComponent( m_pGroupDocument );

	// Restore the Z-order
	m_pCurrentSelection->GetView( )->SetZOrderState( m_OldZOrder );

	//	Tell the view that its layout has changed
	m_pCurrentSelection->GetView()->XUpdateAllViews( kLayoutChanged, 0 );

	// Reset the current selection and render it
	*m_pCurrentSelection = m_OldSelection;
	m_pCurrentSelection->Render( );
	}
Example #18
0
// ****************************************************************************
//
//  Function Name:	RSingleSelection::Validate( )
//
//  Description:		Validates the object
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RSingleSelection::Validate( )	const
	{
	RSelection::Validate( );
	TpsAssertIsObject( RSingleSelection, this );
	TpsAssert( m_pSelectedObject, "NULL selected object." );
	TpsAssertValid( m_pSelectedObject );
	}
Example #19
0
// ****************************************************************************
//
//  Function Name:	REditImageInterfaceImp::SetClippingPath( )
//
//  Description:		Sets the clipping path into the components
//                   image.
//
//  Returns:			
//
//  Exceptions:		
//
// ****************************************************************************
//
void REditImageInterfaceImp::SetClippingPath( const RClippingPath* path )
{
	// Get a pointer to the image document's image.  Note,
	// we should be able to assume that it is a RBitmapImage,
	// as this interface is only provided by image components
	// with RBitmapImages.
	RBitmapImage* pImage = dynamic_cast<RBitmapImage*>(
		m_pImageDocument->GetImage() );
	TpsAssert( pImage, "Invalid image component!" );

	if (path)
	{
		RClippingPath rPath( *path );
		m_pImageDocument->SetCropRectFromPath( &rPath, TRUE );
		pImage->SetRPath( &rPath );
	}
	else if (!pImage->PathFromImport())
	{
		m_pImageDocument->SetCropRectFromPath( NULL, FALSE );
		pImage->DeleteRPath();
	}

	else
		return;

	ApplyImageEffects();
}
Example #20
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::SolidPolygon( )
//
//  Description:		Fills and frames a solid polygon
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpDrawingSurface::SolidPolygon( const RIntPoint* pPoints, YPointCount numPoints )
{
    PolyHandle		hPoly;

    TpsAssert( ( numPoints < kMaxPoints ), "Too many points." );

    if ( numPoints == 2 )
        Polyline( pPoints, numPoints );
    else
    {
        hPoly = CreatePolygon( pPoints, numPoints );

        CreateBrush( );
        ::FillPoly( hPoly, &qd.black );

        CreatePen( );

        // offset polygon to simulate windows center pixel stroke
        if ( m_PenWidthOffset != 0 )
            ::OffsetPoly( hPoly, -m_PenWidthOffset, -m_PenWidthOffset );

        ::FramePoly( hPoly );

        ::DisposeHandle( (Handle)hPoly );
    }
}
ASSERTNAME

#include "CustomGraphicSearch.h"				// header for this class


/****************************************************************************
	RCustomGraphicSearchCollection::RCustomGraphicSearchCollection(
		RChunkStorage *aChunkStorage, YChunkTag anIndexChunkType )

	Construct an RCustomGraphicSearchCollection from aChunkStorage
	and anIndexChunkType. (Also seeks to beginning of anIndexChunkType chunk and
	caches into memory in theINDX for better performance.)
*****************************************************************************/

RCustomGraphicSearchCollection::RCustomGraphicSearchCollection(
	RChunkStorage *aChunkStorage, YChunkTag anIndexChunkType )
	:	RSearchCollection( aChunkStorage ),
		theINDX( 0 ),
		theIndexChunkType( anIndexChunkType ),
		theIndexOffset( 0 ),
		theKeywordOffset( 0 ),
		theMinorCategory( 0 ),
		theGraphicType( 0 )
{
	TpsAssert( theIndexChunkType != 0, "Index chunk type must be non-zero." );

	CacheIndexChunk();	// cache into theINDX for better performance
}
Example #22
0
// ****************************************************************************
//
//  Function Name:	RMergeData::ClearEntry( )
//
//  Description:		Clear the given entry (for printing)
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void	RMergeData::ClearEntry( YCounter entryNumber )
	{
	TpsAssert( entryNumber <= m_MergeData.Count( ), "Clearing entry number that is larger than list size" );

	RMergeIterator	iterator	= GetMergeListStart( ) + entryNumber;
	(*iterator)->ClearSelected( );
	}
Example #23
0
// ****************************************************************************
//
//  Function Name:	REditComponentAttributesAction::REditComponentAttributesAction( )
//
//  Description:		Constructor
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
REditComponentAttributesAction::REditComponentAttributesAction( RCompositeSelection* pCurrentSelection )
	: RUndoableAction( m_ActionId, STRING_UNDO_EDIT_COMPONENT_ATTRIBUTES, STRING_REDO_EDIT_COMPONENT_ATTRIBUTES ),
	  m_pCurrentSelection( pCurrentSelection ),
	  m_OldZOrder( pCurrentSelection->GetView( )->GetZOrderState( ) ),
	  m_fAttributesChanged( FALSE )
	{
	// Validate parameters
	TpsAssertValid( pCurrentSelection );
	TpsAssert( m_pCurrentSelection->Count( ) == 1, "Edit Component Attributes action only operates on one object." );

	// Get the component document. This is where attributes are stored
	m_pComponentDocument = ( *m_pCurrentSelection->Start( ) )->GetComponentDocument( );

	// Get and save the component attributes
	m_OldComponentAttributes = m_pComponentDocument->GetComponentAttributes( );
	m_NewComponentAttributes = m_OldComponentAttributes;

	// Create and do the Edit Component Attributes dialog
	REditComponentAttributesDialog dialog( m_OldComponentAttributes );
	if( dialog.DoModal( ) == IDOK )
		{
		// Get the new attributes
		dialog.FillInComponentAttributes( m_NewComponentAttributes );
		m_fAttributesChanged	= TRUE;
		}
	}
//****************************************************************************
//
// Function Name: FillData
//
// Description:   Fills an HeadlineDataStruct with the Headline 
//						proportion attribute data
//
// Returns:       None
//
// Exceptions:	   None
//
//****************************************************************************
void RHeadlineProportionPage::FillData( RHeadlineInterface* pInterface )
{
	TpsAssert( pInterface, "Invalid Interface!" ) ;

	pInterface->SetScale1( m_uwScale1 ) ;
	pInterface->SetScale2( m_uwScale2 ) ;
	pInterface->SetScale3( m_uwScale3 ) ;
}
Example #25
0
// ****************************************************************************
//
//  Function Name:	RGraphicInterfaceImp::Render( )
//
//  Description:		Render the data in the view.
//
//  Returns:			Nothing
//
//  Exceptions:		kMemory
//
// ****************************************************************************
//
void RGraphicInterfaceImp::Render( RDrawingSurface& drawingSurface, const R2dTransform& transform,
										  const RIntRect& rcRender, const RIntRect& rcLocation )
{
	R2dTransform	graphicTransform	= transform;
	graphicTransform.PreTranslate( rcLocation.m_Left, rcLocation.m_Top );
	TpsAssert( m_pGraphic != NULL, "Render called with NULL graphic" );
	m_pGraphic->Render( drawingSurface, rcLocation.WidthHeight(), graphicTransform, rcRender, m_pGraphic->GetMonochromeColor(), FALSE );
}
Example #26
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::IsVisible( const RIntRect& rc )
//
//  Description:		return TRUE if the rect is visible else FALSE
//
//  Returns:			BOOL fVisible
//
//  Exceptions:		None
//
// ****************************************************************************
//
BOOLEAN RGpDrawingSurface::IsVisible( const RIntRect& rc )
{
    Rect		rect;
    GrafPtr	pGrafPort = (GrafPtr)GetSurface();
    TpsAssert( ( pGrafPort != NULL ), "Nil surface device pointer." );
    ::SetRect( &rect, rc.m_Left, rc.m_Top, rc.m_Right, rc.m_Bottom );
    return ::RectInRgn( &rect, pGrafPort->clipRgn );
}
Example #27
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::DrawFocusRect()
//
//  Description:		Image the characters to the the Drawing Surface
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpDrawingSurface::DrawFocusRect( const RIntRect rcRect )
{
    GrafPtr		pGrafPort = (GrafPtr)GetSurface();

    TpsAssert( ( pGrafPort != NULL ), "Nil surface device pointer." );

    UnimplementedCode();
}
Example #28
0
							RCdSwapDialog()
							:	CDialog(),
								pActiveWindow( NULL ),
								pOSWndProc( NULL )
							{
								TpsAssert( pThisDialog==NULL, "pThisDialog is not NULL!" );

								pActiveWindow = ::GetActiveWindow();
								TpsAssert( pActiveWindow, "pActiveWindow is NULL - can't detect CD insertion." );

								if (pActiveWindow)
								{
									pOSWndProc = (WNDPROC)::SetWindowLong( pActiveWindow, GWL_WNDPROC, (LONG)myWndProc );
									TpsAssert( pOSWndProc, "pOSWndProc is NULL!" );
								}
								pThisDialog = this;
							}
Example #29
0
// ****************************************************************************
//
//  Function Name:	RGpDrawingSurface::DrawCharacters( )
//
//  Description:		Image the characters to the the Drawing Surface
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RGpDrawingSurface::DrawCharacters( const RIntPoint& point, YCounter count, LPCUBYTE pCharacters, int* pWidths )
{
    TpsAssert( pCharacters, "No Characters were passed to DrawCharacters" );

    //CreateFont( );

    UnimplementedCode();
}
Example #30
0
/* ----------------------------------------------------------------------------
   handleAECore 
   Handles core application Apple Events.  
   Returns an apple event error code.                                        
   ---------------------------------------------------------------------------- */
pascal  OSErr  handleAECore (AppleEvent theEvent, AppleEvent theReply, long refCon)
{
#pragma unused(theReply)
#pragma unused(refCon)
OSErr                osErr = noErr;
Size                 rSize;
DescType             rType;
unsigned long        eventID;

/**  get event ID of apple event  **/
    if ((osErr = AEGetAttributePtr(&theEvent, keyEventIDAttr, typeType, &rType, (Ptr)&eventID, sizeof(eventID), &rSize)) != noErr)
       return(osErr);

/**  process apple event  **/
    switch (eventID) 
    {
       case kAEOpenApplication:
          osErr = noErr;
          break;
       case kAEOpenDocuments:
          TpsAssert(false, "We have no Documents!");
          osErr = errAEEventNotHandled;
          break;
       case kAEPrintDocuments:
          TpsAssert(false, "We print no Documents!");
          osErr = errAEEventNotHandled;
          break;
       case kAEQuitApplication:
          gQuit = true;														// exit event loop
          break;
       case kAEApplicationDied:
          TpsAssert(false, "A close relative to this application just Died!");
          osErr = errAEEventNotHandled;
          break;
       case kAEAnswer:
          TpsAssert(false, "We have no Answers!");
          osErr = errAEEventNotHandled;
          break;
      default:
          TpsAssert(false, "We are very confused over this turn of Events!");
          osErr = errAEEventNotHandled;
          break;
    }

    return(osErr);
}