~ubuntu-branches/ubuntu/karmic/gnash/karmic

« back to all changes in this revision

Viewing changes to libcore/asobj/TextFormat.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// textformat.cpp:  ActionScript text formatting decorators, for Gnash.
 
2
// 
 
3
//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
4
// 
 
5
// This program is free software; you can redistribute it and/or modify
 
6
// it under the terms of the GNU General Public License as published by
 
7
// the Free Software Foundation; either version 3 of the License, or
 
8
// (at your option) any later version.
 
9
// 
 
10
// This program is distributed in the hope that it will be useful,
 
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
// GNU General Public License for more details.
 
14
//
 
15
// You should have received a copy of the GNU General Public License
 
16
// along with this program; if not, write to the Free Software
 
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
// 
 
19
 
 
20
#include "log.h"
 
21
#include "Object.h" // for getObjectInterface
 
22
#include "TextFormat.h"
 
23
#include "fn_call.h"
 
24
#include "builtin_function.h" // for getter/setter properties
 
25
#include "namedStrings.h"
 
26
#include "VM.h"
 
27
#include "types.h" // for PIXELS_TO_TWIPS
 
28
#include "StringPredicates.h" // for parseAlignString
 
29
#include "smart_ptr.h" // intrusive_ptr
 
30
 
 
31
namespace gnash {
 
32
 
 
33
// Forward declarations
 
34
static as_value textformat_new(const fn_call& fn);
 
35
static as_object* getTextFormatInterface();
 
36
static void attachTextFormatInterface(as_object& o);
 
37
 
 
38
 
 
39
void
 
40
registerTextFormatNative(as_object& o)
 
41
{
 
42
    VM& vm = o.getVM();
 
43
    
 
44
    //vm.registerNative(110, 0) // [_global] TextFormat
 
45
    vm.registerNative(&TextFormat::font_getset, 110, 1);
 
46
    vm.registerNative(&TextFormat::font_getset, 110, 2);
 
47
    vm.registerNative(&TextFormat::size_getset, 110, 3);
 
48
    vm.registerNative(&TextFormat::size_getset, 110, 4);
 
49
    vm.registerNative(&TextFormat::color_getset, 110, 5);
 
50
    vm.registerNative(&TextFormat::color_getset, 110, 6);
 
51
    vm.registerNative(&TextFormat::url_getset, 110, 7);
 
52
    vm.registerNative(&TextFormat::url_getset, 110, 8);
 
53
    vm.registerNative(&TextFormat::target_getset, 110, 9);
 
54
    vm.registerNative(&TextFormat::target_getset, 110, 10);
 
55
    vm.registerNative(&TextFormat::bold_getset, 110, 11);
 
56
    vm.registerNative(&TextFormat::bold_getset, 110, 12);
 
57
    vm.registerNative(&TextFormat::italic_getset, 110, 13);
 
58
    vm.registerNative(&TextFormat::italic_getset, 110, 14);
 
59
    vm.registerNative(&TextFormat::underline_getset, 110, 15);
 
60
    vm.registerNative(&TextFormat::underline_getset, 110, 16);
 
61
    vm.registerNative(&TextFormat::align_getset, 110, 17);
 
62
    vm.registerNative(&TextFormat::align_getset, 110, 18);
 
63
    vm.registerNative(&TextFormat::leftMargin_getset, 110, 19);
 
64
    vm.registerNative(&TextFormat::leftMargin_getset, 110, 20);
 
65
    vm.registerNative(&TextFormat::rightMargin_getset, 110, 21);
 
66
    vm.registerNative(&TextFormat::rightMargin_getset, 110, 22);
 
67
    vm.registerNative(&TextFormat::indent_getset, 110, 23);
 
68
    vm.registerNative(&TextFormat::indent_getset, 110, 24);
 
69
    vm.registerNative(&TextFormat::leading_getset, 110, 25);
 
70
    vm.registerNative(&TextFormat::leading_getset, 110, 26);
 
71
    vm.registerNative(&TextFormat::blockIndent_getset, 110, 27);
 
72
    vm.registerNative(&TextFormat::blockIndent_getset, 110, 28);
 
73
    vm.registerNative(&TextFormat::tabStops_getset, 110, 29);
 
74
    vm.registerNative(&TextFormat::tabStops_getset, 110, 30);
 
75
    vm.registerNative(&TextFormat::bullet_getset, 110, 31);
 
76
    vm.registerNative(&TextFormat::bullet_getset, 110, 32);
 
77
    vm.registerNative(&TextFormat::getTextExtent_method, 110, 33);
 
78
 
 
79
}
 
80
 
 
81
TextFormat::TextFormat()
 
82
        :
 
83
        as_object(getTextFormatInterface()),
 
84
        _flags(0),
 
85
        _underline(false),
 
86
        _bold(false),
 
87
        _italic(false),
 
88
        _bullet(false),
 
89
        _align(edit_text_character_def::ALIGN_LEFT),
 
90
        _blockIndent(-1),
 
91
        _color(),
 
92
        _indent(-1),
 
93
        _leading(-1),
 
94
        _leftMargin(-1),
 
95
        _rightMargin(-1),
 
96
        _pointSize(-1),
 
97
        _tabStops(-1),
 
98
        _target()
 
99
{
 
100
        //log_debug("%s:", __FUNCTION__);
 
101
        init_member("getTextExtent", new builtin_function(TextFormat::getTextExtent_method));
 
102
}
 
103
 
 
104
/// new TextFormat([font, [size, [color, [bold, [italic, [underline, [url, [target, [align,[leftMargin, [rightMargin, [indent, [leading]]]]]]]]]]]]])
 
105
static as_value
 
106
textformat_new(const fn_call& fn)
 
107
{
 
108
        //GNASH_REPORT_FUNCTION;
 
109
 
 
110
        boost::intrusive_ptr<TextFormat> tf = new TextFormat;
 
111
        
 
112
        const unsigned int args = fn.nargs;
 
113
        
 
114
        switch (args)
 
115
        {
 
116
            default:
 
117
                log_error(_("Too many args (%d) passed to TextFormat"), args);
 
118
            case 13:
 
119
                tf->leadingSet(PIXELS_TO_TWIPS(fn.arg(12).to_int()));
 
120
            case 12:
 
121
                tf->indentSet(PIXELS_TO_TWIPS(fn.arg(11).to_int()));
 
122
            case 11:
 
123
                tf->rightMarginSet(PIXELS_TO_TWIPS(fn.arg(10).to_int()));
 
124
            case 10:
 
125
                tf->leftMarginSet(PIXELS_TO_TWIPS(fn.arg(9).to_int()));
 
126
            case 9:
 
127
                tf->alignSet(fn.arg(8).to_string());
 
128
            case 8:
 
129
                tf->targetSet(fn.arg(7).to_string());
 
130
            case 7:
 
131
                tf->urlSet(fn.arg(6).to_string());
 
132
            case 6:
 
133
                tf->underlinedSet(fn.arg(5).to_bool());
 
134
            case 5:
 
135
                tf->italicedSet(fn.arg(4).to_bool());
 
136
            case 4:
 
137
                tf->boldSet(fn.arg(3).to_bool());
 
138
            case 3:
 
139
            {
 
140
                rgba col;
 
141
                col.parseRGB(fn.arg(2).to_int());
 
142
                tf->colorSet(col);
 
143
            }
 
144
            case 2:
 
145
                tf->sizeSet(PIXELS_TO_TWIPS(fn.arg(1).to_int()));
 
146
            case 1:
 
147
                tf->fontSet(fn.arg(0).to_string());
 
148
                break;
 
149
            case 0:
 
150
                // What happens here?
 
151
                break;
 
152
        }
 
153
        
 
154
        return as_value(tf.get());
 
155
}
 
156
 
 
157
as_value
 
158
TextFormat::display_getset(const fn_call& /*fn*/)
 
159
{
 
160
        LOG_ONCE( log_unimpl("TextField.display") );
 
161
        return as_value();
 
162
}
 
163
 
 
164
as_value
 
165
TextFormat::bullet_getset(const fn_call& fn)
 
166
{
 
167
    // Has the right return values, but not properly implemented
 
168
        LOG_ONCE( log_unimpl("TextFormat.bullet") );
 
169
 
 
170
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
171
 
 
172
        as_value ret;
 
173
 
 
174
        if ( fn.nargs == 0 ) // getter
 
175
        {
 
176
                if ( ptr->bulletDefined() ) ret.set_bool(ptr->bullet());
 
177
                else ret.set_null();
 
178
        }
 
179
        else // setter
 
180
        {
 
181
            // Boolean
 
182
                ptr->bulletSet(fn.arg(0).to_bool());
 
183
        }
 
184
 
 
185
        return ret;
 
186
}
 
187
 
 
188
as_value
 
189
TextFormat::tabStops_getset(const fn_call& /*fn*/)
 
190
{
 
191
        LOG_ONCE( log_unimpl("TextField.tabStops") );
 
192
        return as_value();
 
193
}
 
194
 
 
195
as_value
 
196
TextFormat::blockIndent_getset(const fn_call& fn)
 
197
{
 
198
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
199
 
 
200
        as_value ret;
 
201
 
 
202
        if ( fn.nargs == 0 ) // getter
 
203
        {
 
204
                if ( ptr->blockIndentDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->blockIndent()));
 
205
                else ret.set_null();
 
206
        }
 
207
        else // setter
 
208
        {
 
209
                ptr->blockIndentSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
210
        }
 
211
 
 
212
        return ret;
 
213
}
 
214
 
 
215
as_value
 
216
TextFormat::leading_getset(const fn_call& fn)
 
217
{
 
218
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
219
 
 
220
        as_value ret;
 
221
 
 
222
        if ( fn.nargs == 0 ) // getter
 
223
        {
 
224
                if ( ptr->leadingDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->leading()));
 
225
                else ret.set_null();
 
226
        }
 
227
        else // setter
 
228
        {
 
229
                ptr->leadingSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
230
        }
 
231
 
 
232
        return ret;
 
233
}
 
234
 
 
235
as_value
 
236
TextFormat::indent_getset(const fn_call& fn)
 
237
{
 
238
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
239
 
 
240
        as_value ret;
 
241
 
 
242
        if ( fn.nargs == 0 ) // getter
 
243
        {
 
244
                if ( ptr->indentDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->indent()));
 
245
                else ret.set_null();
 
246
        }
 
247
        else // setter
 
248
        {
 
249
                ptr->indentSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
250
        }
 
251
 
 
252
        return ret;
 
253
}
 
254
 
 
255
as_value
 
256
TextFormat::rightMargin_getset(const fn_call& fn)
 
257
{
 
258
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
259
 
 
260
        as_value ret;
 
261
 
 
262
        if ( fn.nargs == 0 ) // getter
 
263
        {
 
264
                if ( ptr->rightMarginDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->rightMargin()));
 
265
                else ret.set_null();
 
266
        }
 
267
        else // setter
 
268
        {
 
269
                ptr->rightMarginSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
270
        }
 
271
 
 
272
        return ret;
 
273
}
 
274
 
 
275
as_value
 
276
TextFormat::leftMargin_getset(const fn_call& fn)
 
277
{
 
278
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
279
 
 
280
        as_value ret;
 
281
 
 
282
        if ( fn.nargs == 0 ) // getter
 
283
        {
 
284
                if ( ptr->leftMarginDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->leftMargin()));
 
285
                else ret.set_null();
 
286
        }
 
287
        else // setter
 
288
        {
 
289
                ptr->leftMarginSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
290
        }
 
291
 
 
292
        return ret;
 
293
}
 
294
 
 
295
as_value
 
296
TextFormat::align_getset(const fn_call& fn)
 
297
{
 
298
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
299
 
 
300
        as_value ret;
 
301
 
 
302
        if ( fn.nargs == 0 ) // getter
 
303
        {
 
304
                if ( ptr->alignDefined() ) ret.set_string(ptr->getAlignString(ptr->align()));
 
305
                else ret.set_null();
 
306
        }
 
307
        else // setter
 
308
        {
 
309
                ptr->alignSet(fn.arg(0).to_string());
 
310
        }
 
311
 
 
312
        return ret;
 
313
}
 
314
 
 
315
as_value
 
316
TextFormat::underline_getset(const fn_call& fn)
 
317
{
 
318
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
319
 
 
320
        as_value ret;
 
321
 
 
322
        if ( fn.nargs == 0 ) // getter
 
323
        {
 
324
                if ( ptr->underlinedDefined() ) ret.set_bool(ptr->underlined());
 
325
                else ret.set_null();
 
326
        }
 
327
        else // setter
 
328
        {
 
329
                ptr->underlinedSet(fn.arg(0).to_bool());
 
330
        }
 
331
 
 
332
        return ret;
 
333
}
 
334
 
 
335
as_value
 
336
TextFormat::italic_getset(const fn_call& fn)
 
337
{
 
338
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
339
 
 
340
        as_value ret;
 
341
 
 
342
        if ( fn.nargs == 0 ) // getter
 
343
        {
 
344
                if ( ptr->italicedDefined() ) ret.set_bool(ptr->italiced());
 
345
                else ret.set_null();
 
346
        }
 
347
        else // setter
 
348
        {
 
349
                ptr->italicedSet(fn.arg(0).to_bool());
 
350
        }
 
351
 
 
352
        return ret;
 
353
}
 
354
 
 
355
as_value
 
356
TextFormat::bold_getset(const fn_call& fn)
 
357
{
 
358
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
359
 
 
360
        as_value ret;
 
361
 
 
362
        if ( fn.nargs == 0 ) // getter
 
363
        {
 
364
                if ( ptr->boldDefined() ) ret.set_bool(ptr->bold());
 
365
                else ret.set_null();
 
366
        }
 
367
        else // setter
 
368
        {
 
369
                ptr->boldSet(fn.arg(0).to_bool());
 
370
        }
 
371
 
 
372
        return ret;
 
373
}
 
374
 
 
375
as_value
 
376
TextFormat::target_getset(const fn_call& /*fn*/)
 
377
{
 
378
        LOG_ONCE( log_unimpl("TextField.target") );
 
379
        return as_value();
 
380
}
 
381
 
 
382
as_value
 
383
TextFormat::url_getset(const fn_call& /*fn*/)
 
384
{
 
385
        LOG_ONCE( log_unimpl("TextField.url") );
 
386
        return as_value();
 
387
}
 
388
 
 
389
as_value
 
390
TextFormat::color_getset(const fn_call& fn)
 
391
{
 
392
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
393
 
 
394
        as_value ret;
 
395
 
 
396
        if ( fn.nargs == 0 ) // getter
 
397
        {
 
398
                if ( ptr->colorDefined() )  ret.set_double(ptr->color().toRGB());
 
399
                else ret.set_null();
 
400
        }
 
401
        else // setter
 
402
        {
 
403
                rgba newcolor;
 
404
                newcolor.parseRGB(fn.arg(0).to_int());
 
405
                ptr->colorSet(newcolor);
 
406
        }
 
407
 
 
408
        return ret;
 
409
}
 
410
 
 
411
as_value
 
412
TextFormat::size_getset(const fn_call& fn)
 
413
{
 
414
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
415
 
 
416
        as_value ret;
 
417
 
 
418
        if ( fn.nargs == 0 ) // getter
 
419
        {
 
420
                if ( ptr->sizeDefined() ) ret.set_double(TWIPS_TO_PIXELS(ptr->size()));
 
421
                else ret.set_null();
 
422
        }
 
423
        else // setter
 
424
        {
 
425
                ptr->sizeSet(PIXELS_TO_TWIPS(fn.arg(0).to_int()));
 
426
        }
 
427
 
 
428
        return ret;
 
429
}
 
430
 
 
431
as_value
 
432
TextFormat::font_getset(const fn_call& fn)
 
433
{
 
434
        boost::intrusive_ptr<TextFormat> ptr = ensureType<TextFormat>(fn.this_ptr);
 
435
 
 
436
        as_value ret;
 
437
 
 
438
        if ( fn.nargs == 0 ) // getter
 
439
        {
 
440
                if ( ptr->fontDefined() ) ret.set_string(ptr->font());
 
441
                else ret.set_null();
 
442
        }
 
443
        else // setter
 
444
        {
 
445
                ptr->fontSet(fn.arg(0).to_string());
 
446
        }
 
447
 
 
448
        return ret;
 
449
}
 
450
 
 
451
as_value
 
452
TextFormat::getTextExtent_method(const fn_call& /*fn*/)
 
453
{
 
454
        LOG_ONCE( log_unimpl("TextField.getTextExtent") );
 
455
        return as_value();
 
456
}
 
457
 
 
458
static void
 
459
attachTextFormatInterface(as_object& o)
 
460
{
 
461
        int flags = 0; // for sure we want to enum, dunno about deleting yet
 
462
 
 
463
        o.init_property("display", &TextFormat::display_getset, &TextFormat::display_getset, flags);
 
464
        o.init_property("bullet", &TextFormat::bullet_getset, &TextFormat::bullet_getset, flags);
 
465
        o.init_property("tabStops", &TextFormat::tabStops_getset, &TextFormat::tabStops_getset, flags);
 
466
        o.init_property("blockIndent", &TextFormat::blockIndent_getset, &TextFormat::blockIndent_getset, flags);
 
467
        o.init_property("leading", &TextFormat::leading_getset, &TextFormat::leading_getset, flags);
 
468
        o.init_property("indent", &TextFormat::indent_getset, &TextFormat::indent_getset, flags);
 
469
        o.init_property("rightMargin", &TextFormat::rightMargin_getset, &TextFormat::rightMargin_getset, flags);
 
470
        o.init_property("leftMargin", &TextFormat::leftMargin_getset, &TextFormat::leftMargin_getset, flags);
 
471
        o.init_property("align", &TextFormat::align_getset, &TextFormat::align_getset, flags);
 
472
        o.init_property("underline", &TextFormat::underline_getset, &TextFormat::underline_getset, flags);
 
473
        o.init_property("italic", &TextFormat::italic_getset, &TextFormat::italic_getset, flags);
 
474
        o.init_property("bold", &TextFormat::bold_getset, &TextFormat::bold_getset, flags);
 
475
        o.init_property("target", &TextFormat::target_getset, &TextFormat::target_getset, flags);
 
476
        o.init_property("url", &TextFormat::url_getset, &TextFormat::url_getset, flags);
 
477
        o.init_property("color", &TextFormat::color_getset, &TextFormat::color_getset, flags);
 
478
        o.init_property("size", &TextFormat::size_getset, &TextFormat::size_getset, flags);
 
479
        o.init_property("font", &TextFormat::font_getset, &TextFormat::font_getset, flags);
 
480
}
 
481
 
 
482
static as_object*
 
483
getTextFormatInterface()
 
484
{
 
485
        static boost::intrusive_ptr<as_object> o;
 
486
        if ( ! o )
 
487
        {
 
488
                o = new as_object(getObjectInterface());
 
489
                attachTextFormatInterface(*o);
 
490
        }
 
491
        return o.get();
 
492
}
 
493
 
 
494
// extern (used by Global.cpp)
 
495
void textformat_class_init(as_object& global)
 
496
{
 
497
        // This is going to be the global Color "class"/"function"
 
498
        static boost::intrusive_ptr<builtin_function> cl;
 
499
 
 
500
        if ( cl == NULL )
 
501
        {
 
502
                cl=new builtin_function(&textformat_new, getTextFormatInterface());
 
503
        }
 
504
 
 
505
        // Register _global.Color
 
506
        global.init_member("TextFormat", cl.get());
 
507
 
 
508
}
 
509
 
 
510
edit_text_character_def::alignment
 
511
TextFormat::parseAlignString(const std::string& align)
 
512
{
 
513
        StringNoCaseEqual cmp;
 
514
        if ( cmp(align, "left") ) return edit_text_character_def::ALIGN_LEFT;
 
515
        else if ( cmp(align, "center") ) return edit_text_character_def::ALIGN_CENTER;
 
516
        else if ( cmp(align, "right") ) return edit_text_character_def::ALIGN_RIGHT;
 
517
        else if ( cmp(align, "justify") ) return edit_text_character_def::ALIGN_JUSTIFY;
 
518
        else
 
519
        {
 
520
                log_debug("Invalid align string %s, take as left", align);
 
521
                return edit_text_character_def::ALIGN_LEFT;
 
522
        }
 
523
}
 
524
 
 
525
const char* 
 
526
TextFormat::getAlignString(edit_text_character_def::alignment a)
 
527
{
 
528
        switch (a)
 
529
        {
 
530
                case edit_text_character_def::ALIGN_LEFT:
 
531
                        return "left";
 
532
                case edit_text_character_def::ALIGN_CENTER:
 
533
                        return "center";
 
534
                case edit_text_character_def::ALIGN_RIGHT:
 
535
                        return "right";
 
536
                case edit_text_character_def::ALIGN_JUSTIFY:
 
537
                        return "justify";
 
538
                default:
 
539
                        log_error("Uknown alignment value: %d, take as left", a);
 
540
                        return "left";
 
541
        }
 
542
}
 
543
 
 
544
 
 
545
} // end of gnash namespace