txtattrb.h
来自「linux下的一款播放器」· C头文件 代码 · 共 1,012 行 · 第 1/3 页
H
1,012 行
LONG32 m_lastKnownY; //This is needed so that the file format can know whether or not the // anchor tag set the font color or if there is a <font color="foo"> // tag after the <a...> and before the </a> tag. This way, the packet // header can accurately order the <a> and <font> tags so that the // color comes out right at the renderer end: ULONG32 m_ulNumLinkColorOverrides; //This is needed because we need to know when the // last-seen "<TIME ... end=endTime>" was seen. Since m_endTime may not // necessarily be equal to endTime (it can be adjusted down by // adjustStartAndEndTimes() ), we need to know what the original endtime // was: ULONG32 m_ulMostRecentTimeTagEndTime; //Changed these from "AtBeginTime" to "AtTimeZero": LONG32 m_xAtTimeZeroUpperLeftCorner; //where text is initially drawn. LONG32 m_yAtTimeZeroUpperLeftCorner; //where text is initially drawn. LONG32 m_xUpperLeftCorner; //where TextOut() will draw the text. LONG32 m_yUpperLeftCorner; //where TextOut() will draw the text. LONG32 m_xExtent; //the calculated width, in pixels, of the text. LONG32 m_yExtent; //the calculated height, in pixels, of the text.}; //END class TextAttributes declaration./*////////////////////////////////////////////////////////////////////////////** TextAttribStack class:*/class TextAttribStackULONG32 : public CHXStack{ public: TextAttribStackULONG32() { m_isInitialized = FALSE; } TextAttribStackULONG32(const ULONG32& defaultVal) { init(defaultVal); } ~TextAttribStackULONG32() { removeAll(); }; void init(const ULONG32& defaultVal) { m_defaultValue = defaultVal; push(m_defaultValue); m_isInitialized = TRUE; }#if defined(SHOW_CODE_CHANGE_MESSAGES)#pragma message("EH- in "__FILE__", do I want \"push(const T& t)\" here?")#endif/* void push(T& t); T& pop(); //returns reference to T on top of stack. T& peek(); //gets contents at top without popping it.*/ void push(ULONG32& ul) { ULONG32* p_ul = NULL; if((p_ul = getNew_ULONG32(ul)) != NULL) { CHXStack::Push((void*)p_ul); } } ULONG32 pop() { if(GetSize() <= 0) push(m_defaultValue); ULONG32* p_ul = (ULONG32*)CHXStack::Pop(); ULONG32 ret_val; if(p_ul == (ULONG32*)0) { return m_defaultValue; } else { ret_val = *p_ul; delete p_ul; return ret_val; } } ULONG32& peek() { if(GetSize() <= 0) { push(m_defaultValue); } ULONG32* p_ul = (ULONG32*)ElementAt(GetSize()-1); if(p_ul == (ULONG32*)0) { return m_defaultValue; } else { return *p_ul; } } void removeAll() { while (CHXStack::GetSize() > 0) { ULONG32* p_ul = (ULONG32*)CHXStack::Pop(); delete p_ul; } RemoveAll(); } private: ULONG32 m_defaultValue; BOOL m_isInitialized; ULONG32* getNew_ULONG32(ULONG32 ul) //will return NULL if new() fails. { ULONG32* p_ul = new(ULONG32); if(p_ul) { *p_ul = ul; } return p_ul; }};/*////////////////////////////////////////////////////////////////////////////** TextAttribStack class:*/class TextAttribStackBOOL{ public: TextAttribStackBOOL() { m_isInitialized = FALSE; m_ulTRUEcount=0L;} TextAttribStackBOOL(BOOL defaultVal) { init(defaultVal); } ~TextAttribStackBOOL() { removeAll(); }; void init(BOOL defaultVal) { m_ulTRUEcount =0L; m_defaultValue = defaultVal; push(m_defaultValue); m_isInitialized = TRUE; } void push(BOOL b) { if(b) m_ulTRUEcount++; else if(m_ulTRUEcount > 0) m_ulTRUEcount--; } ULONG32 pop() { if(!m_ulTRUEcount) push(m_defaultValue); else m_ulTRUEcount--; return m_ulTRUEcount; } ULONG32 peek() { if(!m_ulTRUEcount) push(m_defaultValue); return m_ulTRUEcount; } void removeAll() { m_ulTRUEcount = 0L; } private: BOOL m_defaultValue; //If greater than 0, then there have been more TRUE "pushes" than // FALSE ones, e.g., if we see "<b><b></b>", then the count goes // from 0 to 1 to 2 to 1, and isBold is thus TRUE since its count // is 1. "<b></b></b>" would go from 0 to 1 to 0 to 0, i.e., it // will not go below 0 so a subsequent <b> will be honored (by not // being matched with the prior </b>. ULONG32 m_ulTRUEcount; BOOL m_isInitialized;};/*////////////////////////////////////////////////////////////////////////////** TextAttributeStacks class:*/#define FONT_SIZE 0x00000001L#define FONT_FACE 0x00000002L#define FONT_COLOR 0x00000004L#define FONT_BGCOLOR 0x00000008L#define FONT_CHARSET 0x00000010Lclass TextAttributeStacks{ public: TextAttributeStacks(); ~TextAttributeStacks() { ;} void flush(); void flushFontStacks(); void flushTickerStacks(); void flushBIUSandBlinkStacks(); void flushIndentAmtStack(); void setTextAttributesToTopsOfStacksVals(TextAttributes& ta); //The following return the default val if stack is empty: inline ULONG32 popFontStack(); inline COLORTYPE popTextColorStack(); inline COLORTYPE popTextBackgroundColorStack(); inline COLORTYPE popTickerUpperColorStack(); inline COLORTYPE popTickerLowerColorStack(); inline ULONG32 popFontFaceStack(); inline ULONG32 popFontCharsetStack(); inline ULONG32 popFontPointSizeStack(); inline ULONG32 peekAtFontPointSizeStack(); inline BOOL popIsBoldStack(); inline BOOL popIsItalicizedStack(); inline BOOL popIsUnderlinedStack(); inline BOOL popIsStruckOutStack(); inline ULONG32 popBlinkRateStack(); inline BOOL popIsCenteredStack(); inline BOOL popIsRequiredStack(); inline BOOL popIsPreStack(); inline BOOL peekAtIsPreStack(); inline UINT16 popLineIndentAmtInPixelsStack(); inline UINT16 peekAtLineIndentAmtInPixelsStack(); inline ULONG32 popFontTagStartByteInFileStack(); //The following return the default val if stack is empty: inline void pushFontStack(ULONG32 ul); inline void pushTextColorStack(COLORTYPE clr, BOOL bPushFontStackToo=TRUE); inline void pushTextBackgroundColorStack(COLORTYPE clr, BOOL bPushFontStackToo=TRUE); inline void pushFontCharsetStack(ULONG32 charset, BOOL bPushFontStackToo=TRUE); inline void pushFontPointSizeStack(ULONG32 siz, BOOL bPushFontStackToo=TRUE); inline void pushTickerUpperColorStack(COLORTYPE clr); inline void pushTickerLowerColorStack(COLORTYPE clr); void pushFontFaceStack(ULONG32 ulFontFaceIndex); void isTickerUpperText(BOOL itut) { m_bIsTickerUpperText = itut; } inline void pushIsBoldStack(BOOL isBld); inline void pushIsItalicizedStack(BOOL isItal); inline void pushIsUnderlinedStack(BOOL isUndrln); inline void pushIsStruckOutStack(BOOL isStrckOut); inline void pushBlinkRateStack(ULONG32 blnkRt); inline void pushIsCenteredStack(BOOL isCenterd); inline void pushIsRequiredStack(); inline void pushIsPreStack(); //For indenting text in lists and as requested: inline void pushLineIndentAmtInPixelsStack(UINT16 lia); inline void pushFontTagStartByteInFileStack(ULONG32 ulStartByte); ULONG32 peekAtTextColorStack() { return m_textColorStack.peek(); } ULONG32 peekAtTextBackgroundColorStack() { return m_textBackgroundColorStack.peek(); } ULONG32 peekAtPointSizeStack() { return m_fontPointSizeStack.peek(); } ULONG32 peekAtCharsetStack() { return m_fontCharsetStack.peek(); } ULONG32 peekAtFontFaceStack() { return m_fontFaceStack.peek(); } private: /* Note: stacks are initialized to default vals (at index [0]) and if * user tries to pop when stack top is [0], i.e., an "empty" stack, * the default val in [0] is never removed and is returned: */ TextAttribStackULONG32 m_fontStack; TextAttribStackULONG32 m_textColorStack; TextAttribStackULONG32 m_textBackgroundColorStack; TextAttribStackULONG32 m_fontFaceStack; TextAttribStackULONG32 m_fontCharsetStack; TextAttribStackULONG32 m_fontPointSizeStack; TextAttribStackULONG32 m_tickerUpperColorStack; TextAttribStackULONG32 m_tickerLowerColorStack; BOOL m_bIsTickerUpperText; TextAttribStackBOOL m_isBoldStack; TextAttribStackBOOL m_isItalicizedStack; TextAttribStackBOOL m_isUnderlinedStack; TextAttribStackBOOL m_isStruckOutStack; TextAttribStackBOOL m_isCenteredStack; ULONG32 m_ulRequiredTagCount; ULONG32 m_ulPreTagCount; TextAttribStackULONG32 m_blinkRateStack; //added this for indenting text in lists and as requested: TextAttribStackULONG32 m_lineIndentAmtInPixelsStack; //This keeps track of the location in the file of each // <FONT> tag so each </FONT> tag knows where it's matching <FONT> tag is TextAttribStackULONG32 m_fontTagStartByteInFileStack;}; //END class TextAttributeStacks declaration./******************************************************************** * Inline class TextAttributeStacks methods ********************************************************************///The following return the default val if stack is empty:inlineULONG32 TextAttributeStacks::popFontStack(){ ULONG32 fontTop = m_fontStack.peek(); if(fontTop & FONT_SIZE) { popFontPointSizeStack();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?