]> git.sesse.net Git - vlc/blobdiff - modules/gui/win32/misc.cpp
* changed OSGraphics constructor (needed for X11)
[vlc] / modules / gui / win32 / misc.cpp
index a052e6f34b00f21eb711d2628c07821db3e7fc9a..6eb63809d8fe74c6e09f5506fdfe9dd8dcd53fb0 100644 (file)
  *****************************************************************************/\r
 \r
 #include <vcl.h>\r
+#include <comctrls.hpp>\r
 #pragma hdrstop\r
 \r
+#include <vlc/vlc.h>\r
+\r
 #include "misc.h"\r
 \r
 /****************************************************************************\r
  ****************************************************************************/\r
 void __fastcall Translate( TForm *Form )\r
 {\r
-#if 0\r
-    Form->Hint = _( Form->Hint );\r
-    Form->Caption = _( Form->Caption );\r
+    // We must test the string because we don't want to get the default one\r
+    if( Form->Hint != "" )\r
+    {\r
+        Form->Hint = _( Form->Hint.c_str() );\r
+    }\r
+    if( Form->Caption != "" )\r
+    {\r
+        Form->Caption = _( Form->Caption.c_str() );\r
+    }\r
 \r
-    int i;\r
-    for( i = 0; i < Form->ComponentCount; i++ )\r
+    for( int i = 0; i < Form->ComponentCount; i++ )\r
     {\r
         // Does this component need a translation ?\r
         if( Form->Components[i]->Tag > 0 )\r
         {\r
             TComponent *Component = Form->Components[i];\r
 \r
+            // Note: the Text property isn't translated, because we don't want\r
+            // to modify the content of TEdit or TComboBox objects, which\r
+            // may have default values\r
+\r
             // Hint property\r
             if( Component->Tag & 1 )\r
             {\r
                 if( Component->InheritsFrom( __classid( TControl ) ) )\r
                 {\r
                     TControl *Object = (TControl *) Component;\r
-                    Object->Hint = _( Object->Hint );\r
+                    if( Object->Hint != "" )\r
+                    {\r
+                        Object->Hint = _( Object->Hint.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
                 {\r
                     TMenuItem *Object = (TMenuItem *) Component;\r
-                    Object->Hint = _( Object->Hint );\r
+                    if( Object->Hint != "" )\r
+                    {\r
+                        Object->Hint = _( Object->Hint.c_str() );\r
+                    }\r
                 }\r
             }\r
 \r
@@ -64,74 +82,81 @@ void __fastcall Translate( TForm *Form )
                 if( Component->InheritsFrom( __classid( TMenuItem ) ) )\r
                 {\r
                     TMenuItem *Object = (TMenuItem *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
-                }\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
+               }\r
                 else if( Component->InheritsFrom( __classid( TLabel ) ) )\r
                 {\r
                     TLabel *Object = (TLabel *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TButton ) ) )\r
                 {\r
                     TButton *Object = (TButton *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
-                }\r
-                else if( Component->InheritsFrom( __classid( TToolButton ) ) )\r
-                {\r
-                    TToolButton *Object = (TToolButton *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TRadioButton ) ) )\r
                 {\r
                     TRadioButton *Object = (TRadioButton *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TCheckBox ) ) )\r
                 {\r
                     TCheckBox *Object = (TCheckBox *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TRadioGroup ) ) )\r
                 {\r
                     TRadioGroup *Object = (TRadioGroup *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TGroupBox ) ) )\r
                 {\r
                     TGroupBox *Object = (TGroupBox *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
-                else if( Component->InheritsFrom( __classid( TTabSheet ) ) )\r
+                else if( Component->InheritsFrom( __classid( TToolButton ) ) )\r
                 {\r
-                    TTabSheet *Object = (TTabSheet *) Component;\r
-                    Object->Caption = _( Object->Caption );\r
+                    TToolButton *Object = (TToolButton *) Component;\r
+                    if( Object->Caption != "" )\r
+                    {\r
+                        Object->Caption = _( Object->Caption.c_str() );\r
+                    }\r
                 }\r
                 else if( Component->InheritsFrom( __classid( TListView ) ) )\r
                 {\r
-                    TListView *Object = (TListView *) Component;\r
-                    int iCol;\r
-                    for( iCol = 0; iCol < Object->Columns->Count; iCol++ )\r
-                        Object->Columns->Items[iCol]->Caption =\r
-                                 _( Object->Columns->Items[iCol]->Caption );\r
-                }\r
-            }\r
-\r
-            // Text property\r
-            if( Component->Tag & 4 )\r
-            {\r
-                if( Component->InheritsFrom( __classid( TEdit ) ) )\r
-                {\r
-                    TEdit *Object = (TEdit *) Component;\r
-                    Object->Text = _( Object->Text );\r
-                }\r
-                else if( Component->InheritsFrom( __classid( TComboBox ) ) )\r
-                {\r
-                    TComboBox *Object = (TComboBox *) Component;\r
-                    Object->Text = _( Object->Text );\r
+                    TListView *ListView = (TListView *) Component;\r
+                    for( int iCol = 0; iCol < ListView->Columns->Count; iCol++ )\r
+                    {\r
+                        TListColumn *Object = ListView->Columns->Items[iCol];\r
+                        if( Object->Caption != "" )\r
+                        {\r
+                            Object->Caption = _( Object->Caption.c_str() );\r
+                        }\r
+                    }\r
                 }\r
             }\r
         }\r
     }\r
-#endif\r
 }\r
  \r