Slightly nicer syntax highlighting

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@376 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-14 19:30:23 +00:00
parent f21f11ac87
commit 82f3dc42c7
7 changed files with 69 additions and 36 deletions
+15 -7
View File
@@ -17,6 +17,18 @@ DECLARE_POINTER_TYPE(Font);
// ----------------------------------------------------------------------------- : Font
enum FontFlags
{ FONT_NORMAL = 0
, FONT_BOLD = 0x01
, FONT_ITALIC = 0x02
, FONT_SOFT = 0x04
, FONT_CODE = 0x08
, FONT_CODE_KW = 0x10 // syntax highlighting
, FONT_CODE_STRING = 0x20 // syntax highlighting
, FONT_CODE_NUMBER = 0x40 // syntax highlighting
, FONT_CODE_OPER = 0x80 // syntax highlighting
};
/// A font for rendering text
/** Contains additional information about scaling, color and shadow */
class Font : public IntrusivePtrBase<Font> {
@@ -26,16 +38,12 @@ class Font : public IntrusivePtrBase<Font> {
Scriptable<double> size; ///< Size of the font
Scriptable<String> weight, style; ///< Weight and style of the font (bold/italic)
Scriptable<bool> underline; ///< Underlined?
int weight_i, style_i; ///< wx constants for weight and style
double scale_down_to; ///< Smallest size to scale down to
Scriptable<Color> color; ///< Color to use
Scriptable<Color> shadow_color; ///< Color for shadow
RealSize shadow_displacement; ///< Position of the shadow
Color separator_color; ///< Color for <sep> text
enum {
NORMAL,
TYPEWRITER, ///< Use a typewriter font
} type;
int flags; ///< FontFlags for this font
Font();
@@ -47,8 +55,8 @@ class Font : public IntrusivePtrBase<Font> {
/// Does this font have a shadow?
inline bool hasShadow() { return shadow_displacement.width != 0 || shadow_displacement.height != 0; }
/// Make a bold/italic/placeholder version of this font
FontP make(bool bold, bool italic, bool placeholder_color, bool code_color, Color* other_color) const;
/// Add style to a font, and optionally change the color
FontP make(int add_flags, Color* other_color) const;
/// Convert this font to a wxFont
wxFont toWxFont(double scale) const;