#include <nodetxtl.h>
Inheritance diagram for FormatRegion:
Public Member Functions | |
BOOL | GetCharMetrics (CharMetrics *pCharMetrics, WCHAR ch) |
Get metrics for a given char using the current attributes of the format region. | |
MILLIPOINT | GetCharsKerning (WCHAR chLeft, WCHAR chRight) |
Finds the kerning distance between two chars. | |
MILLIPOINT | GetTracking () |
Justification | GetJustification () |
MILLIPOINT | GetLineSpacing () |
FIXED16 | GetLineSpaceRatio () |
MILLIPOINT | GetFontSize () |
MILLIPOINT | GetBaseLineShift () |
MILLIPOINT | GetLeftMargin () |
MILLIPOINT | GetRightMargin () |
MILLIPOINT | GetFirstIndent () |
TxtRuler * | GetRuler () |
Private Member Functions | |
FormatRegion () | |
Initialise member variables of the RenderRegion to keep it happy. | |
~FormatRegion () | |
Destructor for FormatRegion. | |
BOOL | Init (NodeRenderableInk *pFirstNode) |
Initialise a FormatRegion setting the attribute stack to those attributes applied to the specified node. | |
virtual void | DrawPathToOutputDevice (Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH) |
virtual void | DrawRect (DocRect *RectToRender) |
virtual void | DrawDragRect (DocRect *RectToRender) |
virtual void | DrawLine (const DocCoord &StartPoint, const DocCoord &EndPoint) |
virtual void | DrawPixel (const DocCoord &Point) |
virtual void | DrawBlob (DocCoord p, BlobType type) |
virtual void | DrawCross (const DocCoord &Point, const UINT32 Size) |
virtual void | DrawBitmap (const DocCoord &Point, KernelBitmap *pBitmap) |
virtual void | DrawBitmap (const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID=NULL) |
virtual void | DrawBitmapBlob (const DocCoord &Point, KernelBitmap *BlobShape) |
virtual void | DrawBitmapBlob (const DocCoord &Point, ResourceID resID) |
virtual void | DrawFixedSystemText (StringBase *TheText, DocRect &BoundsRect, UINT32 uFormat=DEFAULT_TEXT_FORMATTING) |
To draw simple text, using the default host-operating-system font. The size and style of this font are decided by the host OS (or oil code) and cannot be set in any way. To determine how much space is needed to display a string with this method, see the SeeAlso. | |
virtual void | SetFixedSystemTextColours (DocColour *TextCol, DocColour *Background) |
To set the text and background colour(s) for any FixedSystem text rendered in this render region in the future (within the current rendering pass). | |
virtual void | GetFixedSystemTextSize (StringBase *TheText, DocRect *BoundsRect, double *atDpi=NULL) |
To determine how much room is needed to plot a bit of text with RenderRegion::DrawFixedSystemText. | |
virtual void | DrawPixelRect (DocRect *RectToRender) |
To try and plot a single pixel rectangle outline. It does this by using filled rectangles rather than just drawing the line itself. This is required because although GDI and GDraw fills can be made to match up, their outlines can't (at the time of writing). Assumes fill colour and line colour have already been set up along with a line width, usually assumed to be zero which means plot single-pixel lines. Usually, the fill colour is set to be the required line colour and the line colour is set to be transparent (COLOUR_TRANS). | |
virtual void | DrawPixelLine (const DocCoord &StartPoint, const DocCoord &EndPoint) |
To try and plot a single pixel line. It does this by using a filled rectangle rather than just drawing the line itself. This is required because although GDI and GDraw fills can be made to match up, their outlines can't (at the time of writing). Assumes fill colour and line colour have already been set up along with a line width, usually assumed to be zero which means plot single-pixel lines. Usually, the fill colour is set to be the required line colour and the line colour is set to be transparent (COLOUR_TRANS). | |
virtual BOOL | StopRender (void) |
virtual void | InitClipping (void) |
virtual void | InitAttributes (void) |
virtual void | SetLineAttributes (void) |
virtual void | SetOSDrawingMode (void) |
virtual void | SetQualityLevel (void) |
Does nothing. | |
virtual INT32 | CalcPixelWidth (void) |
virtual INT32 | CalcScaledPixelWidth (void) |
Private Attributes | |
std::auto_ptr< wxDC > | m_pFormatDC |
Definition at line 130 of file nodetxtl.h.
|
Initialise member variables of the RenderRegion to keep it happy.
Definition at line 2062 of file nodetxtl.cpp. 02062 : RenderRegion() 02063 { 02064 CurrentClipRect = DocRect(0,0,0,0); 02065 ScaledPixelWidth = 1; 02066 }
|
|
Destructor for FormatRegion.
Definition at line 2077 of file nodetxtl.cpp.
|
|
Implements RenderRegion. Definition at line 168 of file nodetxtl.h.
|
|
Implements RenderRegion. Definition at line 169 of file nodetxtl.h.
|
|
Implements RenderRegion. Definition at line 150 of file nodetxtl.h. 00150 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 149 of file nodetxtl.h. 00149 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 152 of file nodetxtl.h. 00152 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 151 of file nodetxtl.h. 00151 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 147 of file nodetxtl.h. 00147 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 148 of file nodetxtl.h. 00148 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 144 of file nodetxtl.h. 00144 {ERROR3("Rendering into a FormatRegion");};
|
|
To draw simple text, using the default host-operating-system font. The size and style of this font are decided by the host OS (or oil code) and cannot be set in any way. To determine how much space is needed to display a string with this method, see the SeeAlso.
Reimplemented from RenderRegion. Definition at line 155 of file nodetxtl.h. 00155 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 145 of file nodetxtl.h. 00145 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 142 of file nodetxtl.h. 00142 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 146 of file nodetxtl.h. 00146 {ERROR3("Rendering into a FormatRegion");};
|
|
To try and plot a single pixel line. It does this by using a filled rectangle rather than just drawing the line itself. This is required because although GDI and GDraw fills can be made to match up, their outlines can't (at the time of writing). Assumes fill colour and line colour have already been set up along with a line width, usually assumed to be zero which means plot single-pixel lines. Usually, the fill colour is set to be the required line colour and the line colour is set to be transparent (COLOUR_TRANS).
Reimplemented from RenderRegion. Definition at line 159 of file nodetxtl.h. 00159 {ERROR3("Rendering into a FormatRegion");};
|
|
To try and plot a single pixel rectangle outline. It does this by using filled rectangles rather than just drawing the line itself. This is required because although GDI and GDraw fills can be made to match up, their outlines can't (at the time of writing). Assumes fill colour and line colour have already been set up along with a line width, usually assumed to be zero which means plot single-pixel lines. Usually, the fill colour is set to be the required line colour and the line colour is set to be transparent (COLOUR_TRANS).
Reimplemented from RenderRegion. Definition at line 158 of file nodetxtl.h. 00158 {ERROR3("Rendering into a FormatRegion");};
|
|
Implements RenderRegion. Definition at line 143 of file nodetxtl.h. 00143 {ERROR3("Rendering into a FormatRegion");};
|
|
Definition at line 180 of file nodetxtl.h. 00180 { return RR_TXTBASELINE(); }
|
|
Get metrics for a given char using the current attributes of the format region.
Definition at line 2162 of file nodetxtl.cpp. 02163 { 02164 ERROR2IF(pCharMetrics==NULL, FALSE, "FormatRegion::GetCharMetrics() - pCharMetrics==NULL"); 02165 02166 // get the char metrics for the specified character 02167 wxDC *pDC = m_pFormatDC.get(); 02168 CharDescription FontDesc( FONTEMCHAR, RR_TXTFONTTYPEFACE(), RR_TXTBOLD(), RR_TXTITALIC() ); 02169 if( FONTMANAGER->GetCharMetrics( pDC, ch, FontDesc, pCharMetrics ) == FALSE ) 02170 return FALSE; 02171 02172 // get x/y scale factors and apply then to the default metrics found 02173 // Note: y scale factor does not include script ratio so does not affect ascent/descent 02174 // ie a line of subscript text has the same line ascents/descents as a non-subscript line 02175 TxtScriptAttribute* pScriptAttr=RR_TXTSCRIPT(); 02176 ERROR2IF(pScriptAttr==NULL,FALSE,"RenderRegion::GetCharAttributeMatrix() - pScriptAttr==NULL"); 02177 double ScaleY = (double)RR_TXTFONTSIZE() / TextManager::GetDefaultHeight(); 02178 double ScaleX = ScaleY * RR_TXTASPECTRATIO().MakeDouble() * pScriptAttr->Size.MakeDouble(); 02179 pCharMetrics->Scale(ScaleX,ScaleY); 02180 02181 return TRUE; 02182 }
|
|
Finds the kerning distance between two chars.
Definition at line 2196 of file nodetxtl.cpp. 02197 { 02198 // get the char metrics for the specified character 02199 wxDC *pDC = m_pFormatDC.get(); 02200 CharDescription FontDesc(FONTEMCHAR, RR_TXTFONTTYPEFACE(), RR_TXTBOLD(), RR_TXTITALIC()); 02201 MILLIPOINT kern = FONTMANAGER->GetCharsKerning( pDC, chLeft, chRight, FontDesc ); 02202 02203 // get x/y scale factors and apply then to the default metrics found 02204 // Note: y scale factor does not include script ratio so does not affect ascent/descent 02205 // ie a line of subscript text has the same line ascents/descents as a non-subscript line 02206 TxtScriptAttribute* pScriptAttr=RR_TXTSCRIPT(); 02207 ERROR2IF(pScriptAttr==NULL,FALSE,"RenderRegion::GetCharAttributeMatrix() - pScriptAttr==NULL"); 02208 double ScaleY = (double)RR_TXTFONTSIZE() / TextManager::GetDefaultHeight(); 02209 double ScaleX = ScaleY * RR_TXTASPECTRATIO().MakeDouble() * pScriptAttr->Size.MakeDouble(); 02210 02211 if (kern) 02212 kern = (MILLIPOINT)(kern * ScaleX + 0.5); 02213 02214 return kern; 02215 }
|
|
Definition at line 183 of file nodetxtl.h. 00183 { return RR_TXTFIRSTINDENT(); }
|
|
To determine how much room is needed to plot a bit of text with RenderRegion::DrawFixedSystemText.
Reimplemented from RenderRegion. Definition at line 157 of file nodetxtl.h. 00157 {ERROR3("Rendering into a FormatRegion");};
|
|
Definition at line 179 of file nodetxtl.h. 00179 { return RR_TXTFONTSIZE(); }
|
|
Definition at line 176 of file nodetxtl.h. 00176 { return RR_TXTJUSTIFICATION(); }
|
|
Definition at line 181 of file nodetxtl.h. 00181 { return RR_TXTLEFTMARGIN(); }
|
|
Definition at line 178 of file nodetxtl.h. 00178 { return ((TxtLineSpaceAttribute*)CurrentAttrs[ATTR_TXTLINESPACE].pAttr)->Ratio; }
|
|
Definition at line 177 of file nodetxtl.h. 00177 { return RR_TXTLINESPACE(); }
|
|
Definition at line 182 of file nodetxtl.h. 00182 { return RR_TXTRIGHTMARGIN(); }
|
|
Definition at line 184 of file nodetxtl.h. 00184 { return RR_TXTRULER(); }
|
|
Definition at line 175 of file nodetxtl.h. 00175 { return RR_TXTTRACKING(); }
|
|
Initialise a FormatRegion setting the attribute stack to those attributes applied to the specified node.
Definition at line 2094 of file nodetxtl.cpp. 02095 { 02096 m_pFormatDC = std::auto_ptr<wxDC>( new wxMemoryDC ); 02097 if( NULL == m_pFormatDC.get() ) 02098 ERROR2(FALSE,"FormatRegion::Init() - CreateCompatibleDC() failed"); 02099 02100 RenderView = DocView::GetSelected(); 02101 02102 // If there is not a selected doc view (e.g. because it is a clipboard document), 02103 // try the current view item. 02104 // This should only be an issue when formatting text that's been imported into the clipboard, usually 02105 // as part of an OLE operation 02106 if (RenderView == NULL) 02107 { 02108 RenderView = View::GetCurrent(); 02109 if (RenderView == NULL) 02110 { 02111 ERROR3("No view!! Can't format text without a view"); 02112 return FALSE; 02113 } 02114 02115 // ERROR3IF(RenderView->GetDoc()->IsNotAClipboard(),"No selected doc view yet doc attached to current view is not a clipboard doc. Is this right?"); 02116 } 02117 02118 // Initialise the render region 02119 StartRender(); 02120 02121 // Get the attributes 02122 if (pFirstNode==NULL) 02123 return TRUE; 02124 02125 CCAttrMap *pAttribMap = new CCAttrMap(30); 02126 if (pAttribMap == NULL) return FALSE; 02127 02128 if (!pFirstNode->FindAppliedAttributes(pAttribMap)) 02129 { 02130 delete pAttribMap; 02131 return FALSE; 02132 } 02133 02134 CCAttrMap::iterator pos = pAttribMap->GetStartPosition(); 02135 CCAttrMap::iterator end = pAttribMap->GetEndPosition(); 02136 while( pos != end ) 02137 { 02138 CCRuntimeClass *pKey; 02139 void *pVal; 02140 pAttribMap->GetNextAssoc(pos, pKey, pVal); 02141 02142 ((NodeAttribute*) pVal)->Render(this); 02143 } 02144 02145 delete pAttribMap; 02146 02147 return TRUE; 02148 }
|
|
Implements RenderRegion. Definition at line 164 of file nodetxtl.h.
|
|
Implements RenderRegion. Definition at line 163 of file nodetxtl.h.
|
|
To set the text and background colour(s) for any FixedSystem text rendered in this render region in the future (within the current rendering pass).
If either of the colours is passed in as a NULL pointer, that colour will not be set, and will remain at the previous setting. Note that these values are passed directly to the host OS at the point of calling, so you must call this method every time the colour is changed (i.e. don't rely on just changing the DocColours that you passed in originally, as they aren't remembered in any way). Note also that if you call DrawFixedSystemText without a prior call to this method, the colours used are undefined.
Reimplemented from RenderRegion. Definition at line 156 of file nodetxtl.h. 00156 {ERROR3("Rendering into a FormatRegion");};
|
|
Definition at line 165 of file nodetxtl.h.
|
|
Implements RenderRegion. Definition at line 166 of file nodetxtl.h.
|
|
Does nothing.
Reimplemented from RenderRegion. Definition at line 167 of file nodetxtl.h.
|
|
Implements RenderRegion. Definition at line 162 of file nodetxtl.h. 00162 {return TRUE;};
|
|
Definition at line 186 of file nodetxtl.h. |