summaryrefslogtreecommitdiff
path: root/include/delphi/m_fontservice.inc
blob: c6dacc42e1b92eef60828fcb193e88156adbbde8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// Copyright Scott Ellis (mail@scottellis.com.au) 2005
// This software is licenced under the GPL (General Public Licence)
// available at http://www.gnu.org/copyleft/gpl.html
{$IFNDEF FONT_SERVICE_API}
{$DEFINE FONT_SERVICE_API}

const
// style flags
  DBFONTF_BOLD      = 1;
  DBFONTF_ITALIC    = 2;
  DBFONTF_UNDERLINE = 4;
  DBFONTF_STRIKEOUT = 8;
// flags for compatibility
  FIDF_APPENDNAME       = 1;   // append 'Name' to the setting used to store
                               // font face (as CLC settings require)
  FIDF_NOAS             = 2;   // disable the <prefix>As setting to prevent
                               // 'same as' behaviour
  FIDF_SAVEACTUALHEIGHT = 4;   // write the actual height of a test string to the db
  FIDF_SAVEPOINTSIZE    = 8;   // write the font point size to the db
// additional flags
  FIDF_DEFAULTVALID     = 32;  // the default font settings are valid - else,
                               // just use generic default
  FIDF_NEEDRESTART      = 64;  // setting changes will not take effect until
                               // miranda is restarted
  FIDF_ALLOWREREGISTER  = 128; // allow plugins to register this font again
                               // (i.e. override already registered settings
                               // such as flags)
  FIDF_ALLOWEFFECTS     = 256; // allow setting of font effects
                               // (i.e. underline and strikeout)
  FIDF_DISABLESTYLES    = 512; // don't allow to select font attributes (bold/underline/italics)
                               // FIDF_ALLOWEFFECTS has priority and will override this flag!

const
// font class
  FIDF_CLASSMASK    = $70000000;
  FIDF_CLASSHEADER  = $10000000;
  FIDF_CLASSGENERAL = $20000000;
  FIDF_CLASSSMALL   = $30000000;

type
// settings to be used for the value of 'deffontsettings' in the FontID
// structure below - i.e. defaults
  PFontSettings_tag = ^TFontSettings_tag;
  TFontSettings_tag = record
    colour  : TCOLORREF;
    size    : ShortInt;
    style   : byte; // see the DBFONTF_* flags above
    charset : byte;
    szFace  : array[0..(LF_FACESIZE)-1] of AnsiChar;
  end;
  TFontSettings = TFontSettings_tag;
  PFontSettings = ^TFontSettings;

  PFontSettingsW_tag = ^TFontSettingsW_tag;
  TFontSettingsW_tag = record
    colour  : TCOLORREF;
    size    : ShortInt;
    style   : byte; // see the DBFONTF_* flags above
    charset : byte;
    szFace  : array[0..(LF_FACESIZE)-1] of WideChar;
  end;
  TFontSettingsW = TFontSettingsW_tag;
  PFontSettingsW = ^TFontSettingsW;

type
// a font identifier structire - used for registering a font,
// and getting one out again
  PFontID_tag = ^TFontID_tag;
  TFontID_tag = record
    cbSize         : int;
    // [TRANSLATED-BY-CORE] group the font belongs to - this is the 'Font Group' list in the options page
    group          : array[0..63] of AnsiChar;
    // [TRANSLATED-BY-CORE] the name of the font setting e.g. 'contacts' in the 'contact list' group
    name           : array[0..63] of AnsiChar;
    // the 'module' in the database where the font data is stored
    dbSettingsGroup: array[0..31] of AnsiChar;
    // prepended to the settings used to store this font's data in the db
    prefix         : array[0..31] of AnsiChar;
    // bitwise OR of the FIDF_* flags above
    flags          : dword;
    deffontsettings: TFontSettings; // defaults, if flags & FIDF_DEFAULTVALID
    // controls the order in the font group in which the fonts are listed in the
    // UI (if order fields are equal, they will be ordered alphabetically by name)
    order          : int;
    backgroundGroup:array [0..63] of AnsiChar;
    backgroundName: array [0..63] of AnsiChar;
  end;
  TFontID = TFontID_tag;
  pFontID = ^TFontID;

  PFontIDW_tag = ^TFontIDW_tag;
  TFontIDW_tag = record
    cbSize         : int;
    // [TRANSLATED-BY-CORE] group the font belongs to - this is the 'Font Group' list in the options page
    group          : array[0..63] of WideChar;
    // [TRANSLATED-BY-CORE] the name of the font setting e.g. 'contacts' in the 'contact list' group
    name           : array[0..63] of WideChar;
    // the 'module' in the database where the font data is stored
    dbSettingsGroup: array[0..31] of AnsiChar;
    // prepended to the settings used to store this font's data in the db
    prefix         : array[0..31] of AnsiChar;
    // bitwise OR of the FIDF_* flags above
    flags          : dword;
    deffontsettings: TFontSettingsW; // defaults, if flags & FIDF_DEFAULTVALID
    // controls the order in the font group in which the fonts are listed in the
    // UI (if order fields are equal, they will be ordered alphabetically by name)
    order          : int;
    backgroundGroup:array [0..63] of WideChar;
    backgroundName: array [0..63] of WideChar;
  end;
  TFontIDW = TFontIDW_tag;
  PFontIDW = ^TFontIDW;

const
  { fired when a user modifies font settings, so reget your fonts }
  ME_FONT_RELOAD:PAnsiChar = 'Font/Reload';

function Font_Register(pFont:pFontID; hLang:int) : int; stdcall; external AppDll;
function Font_Get(pGroup,pName:pAnsiChar; pFont:pLogFontA) : longint; stdcall; external AppDll;

type
  PColourID_tag = ^TColourID_tag;
  TColourID_tag = record
    cbSize          : int;
    group           : array[0..63] of AnsiChar;
    name            : array[0..63] of AnsiChar;
    dbSettingsGroup : array[0..31] of AnsiChar;
    setting         : array[0..31] of AnsiChar;
    flags           : dword;     // not used
    defcolour       : TCOLORREF; // default value
    order           : int;
  end;
  TColourID = TColourID_tag;
  PColourID = ^TColourID;

  PColourIDW_tag = ^TColourIDW_tag;
  TColourIDW_tag = record
    cbSize          : int;
    group           : array[0..63] of WideChar;
    name            : array[0..63] of WideChar;
    dbSettingsGroup : array[0..31] of AnsiChar;
    setting         : array[0..31] of AnsiChar;
    flags           : dword;     // not used
    defcolour       : TCOLORREF; // default value
    order           : int;
  end;
  TColourIDW = TColourIDW_tag;
  PColourIDW = ^TColourIDW;

const
  { fired when a user modifies font settings, so reget your fonts and colours }
  ME_COLOUR_RELOAD:PAnsiChar = 'Colour/Reload';

function Colour_Register(pColour:pColourID; hLang:int) : int; stdcall; external AppDll;
function Colour_Get(pGroup,pName:pAnsiChar) : longint; stdcall; external AppDll;

//////////////////////////////////////////////////////////////////////////
//
//  EFFECTS
//
type
  FONTEFFECT_tag = record
    effectIndex    :byte;
    baseColour     :dword; // ARGB
    secondaryColour:dword; // ARGB
  end;
  TFONTEFFECT = FONTEFFECT_tag;

type
  EffectID_tag = record
    cbSize         :int;
    group          :array [0..63] of AnsiChar;
    name           :array [0..63] of AnsiChar;
    dbSettingsGroup:array [0..31] of AnsiChar;
    setting        :array [0..31] of AnsiChar;
    flags          :dword;
    defeffect      :TFONTEFFECT;
    order          :int;
    value          :TFONTEFFECT;
  end;
  PEffectID = ^TEffectID;
  TEffectID = EffectID_tag;

type
  EffectIDW_tag = record
    cbSize         :int;
    group          :array [0..63] of WideChar;
    name           :array [0..63] of WideChar;
    dbSettingsGroup:array [0..31] of AnsiChar;
    setting        :array [0..31] of AnsiChar;
    flags          :dword;
    defeffect      :TFONTEFFECT;
    order          :int;
    value          :TFONTEFFECT;
  end;
  PEffectIDW = ^TEffectIDW;
  TEffectIDW = EffectIDW_tag;

const
// fired when a user modifies font settings, so reget your fonts and colours
// wparam = lparam = 0
  ME_EFFECT_RELOAD:PAnsiChar = 'Effect/Reload';

{$ENDIF}