1 /*****************************************************************************
\r
2 * misc.cpp: miscellaneous functions.
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2002 VideoLAN
\r
6 * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
\r
8 * This program is free software; you can redistribute it and/or modify
\r
9 * it under the terms of the GNU General Public License as published by
\r
10 * the Free Software Foundation; either version 2 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU General Public License
\r
19 * along with this program; if not, write to the Free Software
\r
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
21 *****************************************************************************/
\r
28 /****************************************************************************
\r
29 * This function replaces "Hint", "Caption" and "Text" properties of each
\r
30 * component of the form by the appropriate translation.
\r
31 ****************************************************************************/
\r
32 void __fastcall Translate( TForm *Form )
\r
35 Form->Hint = _( Form->Hint );
\r
36 Form->Caption = _( Form->Caption );
\r
39 for( i = 0; i < Form->ComponentCount; i++ )
\r
41 // Does this component need a translation ?
\r
42 if( Form->Components[i]->Tag > 0 )
\r
44 TComponent *Component = Form->Components[i];
\r
47 if( Component->Tag & 1 )
\r
49 if( Component->InheritsFrom( __classid( TControl ) ) )
\r
51 TControl *Object = (TControl *) Component;
\r
52 Object->Hint = _( Object->Hint );
\r
54 else if( Component->InheritsFrom( __classid( TMenuItem ) ) )
\r
56 TMenuItem *Object = (TMenuItem *) Component;
\r
57 Object->Hint = _( Object->Hint );
\r
62 if( Component->Tag & 2 )
\r
64 if( Component->InheritsFrom( __classid( TMenuItem ) ) )
\r
66 TMenuItem *Object = (TMenuItem *) Component;
\r
67 Object->Caption = _( Object->Caption );
\r
69 else if( Component->InheritsFrom( __classid( TLabel ) ) )
\r
71 TLabel *Object = (TLabel *) Component;
\r
72 Object->Caption = _( Object->Caption );
\r
74 else if( Component->InheritsFrom( __classid( TButton ) ) )
\r
76 TButton *Object = (TButton *) Component;
\r
77 Object->Caption = _( Object->Caption );
\r
79 else if( Component->InheritsFrom( __classid( TToolButton ) ) )
\r
81 TToolButton *Object = (TToolButton *) Component;
\r
82 Object->Caption = _( Object->Caption );
\r
84 else if( Component->InheritsFrom( __classid( TRadioButton ) ) )
\r
86 TRadioButton *Object = (TRadioButton *) Component;
\r
87 Object->Caption = _( Object->Caption );
\r
89 else if( Component->InheritsFrom( __classid( TCheckBox ) ) )
\r
91 TCheckBox *Object = (TCheckBox *) Component;
\r
92 Object->Caption = _( Object->Caption );
\r
94 else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )
\r
96 TRadioGroup *Object = (TRadioGroup *) Component;
\r
97 Object->Caption = _( Object->Caption );
\r
99 else if( Component->InheritsFrom( __classid( TGroupBox ) ) )
\r
101 TGroupBox *Object = (TGroupBox *) Component;
\r
102 Object->Caption = _( Object->Caption );
\r
104 else if( Component->InheritsFrom( __classid( TTabSheet ) ) )
\r
106 TTabSheet *Object = (TTabSheet *) Component;
\r
107 Object->Caption = _( Object->Caption );
\r
109 else if( Component->InheritsFrom( __classid( TListView ) ) )
\r
111 TListView *Object = (TListView *) Component;
\r
113 for( iCol = 0; iCol < Object->Columns->Count; iCol++ )
\r
114 Object->Columns->Items[iCol]->Caption =
\r
115 _( Object->Columns->Items[iCol]->Caption );
\r
120 if( Component->Tag & 4 )
\r
122 if( Component->InheritsFrom( __classid( TEdit ) ) )
\r
124 TEdit *Object = (TEdit *) Component;
\r
125 Object->Text = _( Object->Text );
\r
127 else if( Component->InheritsFrom( __classid( TComboBox ) ) )
\r
129 TComboBox *Object = (TComboBox *) Component;
\r
130 Object->Text = _( Object->Text );
\r