// $Revision: 1.10 $ // Copyright (C) 1994 Taligent, Inc. All rights reserved. #ifndef Taligent_STANDARDGRAFEDIT #include "StandardGrafEdit.h" #endif #ifndef Taligent_CANVASCOMMANDS #include "CanvasCommands.h" #endif #ifndef Taligent_GRAFEDITTRACE #include "GrafEditTrace.h" #endif //================================================================================ // class TStandardCanvasFillColorSelectionState // // description Sets the fill color of the current selection. //================================================================================ //======================================== // Constructors and Destructor //======================================== TStandardCanvasFillColorSelectionState::TStandardCanvasFillColorSelectionState () : TCommandControlStateOn () { // SCRUNCH - reduces selection change heap events during iteration SetUpdateCurrentSelection (false); // command does not change selection } TStandardCanvasFillColorSelectionState::TStandardCanvasFillColorSelectionState ( const TStandardCanvasFillColorSelectionState& source) : TCommandControlStateOn (source) { } TStandardCanvasFillColorSelectionState::TStandardCanvasFillColorSelectionState ( const TColor& color, TGUIBundleConnection* theBundleConnectionToAlias) : TCommandControlStateOn (theBundleConnectionToAlias, TStandardText("Change Fill Color"), new TSetCanvasGraphicFillColorCmd (color)) { TLocale locale; TLocale::GetCurrentLocale(locale); TStandardText commandName("Change Fill Color"); try { TDeleterFor theArchive = TArchive::CopyArchiveForSharedLibrary(); TArchiveEnvelope theEnvelope(theArchive, locale); commandName.Replace (*theEnvelope.CopyObject( TStandardText("Change Fill Color") )); } catch (const TStandardException&) { ::qprintf("Error reading command name text from archive\n"); } AdoptNameLabel(new TTextLabel(commandName)); } TStandardCanvasFillColorSelectionState::~TStandardCanvasFillColorSelectionState () { } //======================================== // MCollectible Overrides //======================================== MCollectibleDefinitionsMacro (TStandardCanvasFillColorSelectionState, kOriginalVersion); TStandardCanvasFillColorSelectionState& TStandardCanvasFillColorSelectionState::operator= (const TStandardCanvasFillColorSelectionState& source) { #ifdef DEBUG ::qprintf ( "TStandardCanvasFillColorSelectionState::operator=\n" ); #endif if ( this != &source ) { TCommandControlStateOn::operator= (source); } return *this; } TStream& TStandardCanvasFillColorSelectionState::operator>>= (TStream& toWhere) const { #ifdef DEBUG ::qprintf ( "TStandardCanvasFillColorSelectionState::operator>>=\n" ); #endif WriteVersion (toWhere); // TCommandControlStateOn::operator>>= (toWhere); // kludge -- we will just stream the momentary control state // it doesn't make sense to stream an MGUIBundle. // and I don't want to add streaming operators to TCommandControlStateOn // because it is unclear how to properly resurect a TCommandControlStateOn // so I leave it up to clients to handle the reconnection of the // TGUIBundleConnection by themselves. -- chrisy warren MMomentaryControlState::operator>>= (toWhere); return toWhere; } TStream& TStandardCanvasFillColorSelectionState::operator<<= (TStream& fromWhere) { #ifdef DEBUG ::qprintf ( "TStandardCanvasFillColorSelectionState::operator<<=\n" ); #endif VersionInfo version = ReadVersion (fromWhere); if ( version != kOriginalVersion ) throw TGlobalExceptionKludge(kStreamBadVersion, 0); // TCommandControlStateOn::operator<<= (fromWhere); // kludge -- we will just stream the momentary control state MMomentaryControlState::operator<<= (fromWhere); return fromWhere; } void TStandardCanvasFillColorSelectionState::HandleAddInterests( TSetOf &theInterests ) const { TGUIBundleInterest theCurrentSelectionInterest = GetGUIBundle()->GetCurrentSelectionChangeInterest(); theInterests.Add( ::Copy(theCurrentSelectionInterest) ); } //================================================================================ // class TStandardCanvasFrameColorSelectionState // // description Sets the frame color of the current selection. //================================================================================ //======================================== // Constructors and Destructor //======================================== TStandardCanvasFrameColorSelectionState::TStandardCanvasFrameColorSelectionState () : TCommandControlStateOn () { // SCRUNCH - reduces selection change heap events during iteration SetUpdateCurrentSelection (false); // command does not change selection } TStandardCanvasFrameColorSelectionState::TStandardCanvasFrameColorSelectionState ( const TStandardCanvasFrameColorSelectionState& source) : TCommandControlStateOn (source) { } TStandardCanvasFrameColorSelectionState::TStandardCanvasFrameColorSelectionState ( const TColor& color, TGUIBundleConnection* theBundleConnectionToAlias) : TCommandControlStateOn (theBundleConnectionToAlias, TStandardText("Change Frame Color"), new TSetCanvasGraphicFrameColorCmd (color)) { TLocale locale; TLocale::GetCurrentLocale(locale); TStandardText commandName("Change Frame Color"); try { TDeleterFor theArchive = TArchive::CopyArchiveForSharedLibrary(); TArchiveEnvelope theEnvelope(theArchive, locale); commandName.Replace (*theEnvelope.CopyObject( TStandardText("Change Frame Color") )); } catch (const TStandardException&) { ::qprintf("Error reading command name text from archive\n"); } AdoptNameLabel(new TTextLabel(commandName)); } TStandardCanvasFrameColorSelectionState::~TStandardCanvasFrameColorSelectionState () { } //======================================== // MCollectible Overrides //======================================== MCollectibleDefinitionsMacro (TStandardCanvasFrameColorSelectionState, kOriginalVersion); TStandardCanvasFrameColorSelectionState& TStandardCanvasFrameColorSelectionState::operator= (const TStandardCanvasFrameColorSelectionState& source) { #ifdef DEBUG ::qprintf ( "TStandardCanvasFrameColorSelectionState::operator=\n" ); #endif if ( this != &source ) { TCommandControlStateOn::operator= (source); } return *this; } TStream& TStandardCanvasFrameColorSelectionState::operator>>= (TStream& toWhere) const { #ifdef DEBUG ::qprintf ( "TStandardCanvasFrameColorSelectionState::operator>>=\n" ); #endif WriteVersion (toWhere); // TCommandControlStateOn::operator>>= (toWhere); // kludge -- we will just stream the momentary control state MMomentaryControlState::operator>>= (toWhere); return toWhere; } TStream& TStandardCanvasFrameColorSelectionState::operator<<= (TStream& fromWhere) { #ifdef DEBUG ::qprintf ( "TStandardCanvasFrameColorSelectionState::operator<<=\n" ); #endif VersionInfo version = ReadVersion (fromWhere); if ( version != kOriginalVersion ) throw TGlobalExceptionKludge(kStreamBadVersion, 0); // TCommandControlStateOn::operator<<= (fromWhere); // kludge -- we will just stream the momentary control state MMomentaryControlState::operator<<= (fromWhere); return fromWhere; } void TStandardCanvasFrameColorSelectionState::HandleAddInterests( TSetOf &theInterests ) const { TGUIBundleInterest theCurrentSelectionInterest = GetGUIBundle()->GetCurrentSelectionChangeInterest(); theInterests.Add( ::Copy(theCurrentSelectionInterest) ); } //================================================================================ // class TStandardCanvasLineWidthSelectionState // // description Sets the line width of the current selection. //================================================================================ //======================================== // Constructors and Destructor //======================================== TStandardCanvasLineWidthSelectionState::TStandardCanvasLineWidthSelectionState () : TCommandControlStateOn () { // SCRUNCH - reduces selection change heap events during iteration SetUpdateCurrentSelection (false); // command does not change selection } TStandardCanvasLineWidthSelectionState::TStandardCanvasLineWidthSelectionState ( const TStandardCanvasLineWidthSelectionState& source) : TCommandControlStateOn (source) { } TStandardCanvasLineWidthSelectionState::TStandardCanvasLineWidthSelectionState ( GCoordinate width, TGUIBundleConnection* theBundleConnectionToAlias) : TCommandControlStateOn (theBundleConnectionToAlias, TStandardText("Change Line Width"), new TSetCanvasGraphicLineWidthCmd (width)) { TLocale locale; TLocale::GetCurrentLocale(locale); TStandardText commandName("Change Line Width"); try { TDeleterFor theArchive = TArchive::CopyArchiveForSharedLibrary(); TArchiveEnvelope theEnvelope(theArchive, locale); commandName.Replace (*theEnvelope.CopyObject( TStandardText("Change Line Width") )); } catch (const TStandardException&) { ::qprintf("Error reading command name text from archive\n"); } AdoptNameLabel(new TTextLabel(commandName)); } TStandardCanvasLineWidthSelectionState::~TStandardCanvasLineWidthSelectionState () { } //======================================== // MCollectible Overrides //======================================== MCollectibleDefinitionsMacro (TStandardCanvasLineWidthSelectionState, kOriginalVersion); TStandardCanvasLineWidthSelectionState& TStandardCanvasLineWidthSelectionState::operator= (const TStandardCanvasLineWidthSelectionState& source) { #ifdef DEBUG ::qprintf ( "TStandardCanvasLineWidthSelectionState::operator=\n" ); #endif if ( this != &source ) { TCommandControlStateOn::operator= (source); } return *this; } TStream& TStandardCanvasLineWidthSelectionState::operator>>= (TStream& toWhere) const { #ifdef DEBUG ::qprintf ( "TStandardCanvasLineWidthSelectionState::operator>>=\n" ); #endif WriteVersion (toWhere); // TCommandControlStateOn::operator>>= (toWhere); // kludge -- we will just stream the momentary control state MMomentaryControlState::operator>>= (toWhere); return toWhere; } TStream& TStandardCanvasLineWidthSelectionState::operator<<= (TStream& fromWhere) { #ifdef DEBUG ::qprintf ( "TStandardCanvasLineWidthSelectionState::operator<<=\n" ); #endif VersionInfo version = ReadVersion (fromWhere); if ( version != kOriginalVersion ) throw TGlobalExceptionKludge(kStreamBadVersion, 0); // TCommandControlStateOn::operator<<= (fromWhere); // kludge -- we will just stream the momentary control state MMomentaryControlState::operator<<= (fromWhere); return fromWhere; } void TStandardCanvasLineWidthSelectionState::HandleAddInterests( TSetOf &theInterests ) const { TGUIBundleInterest theCurrentSelectionInterest = GetGUIBundle()->GetCurrentSelectionChangeInterest(); theInterests.Add( ::Copy(theCurrentSelectionInterest) ); }