]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/PreferencesWindow.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / beos / PreferencesWindow.cpp
index fede588e7f6b326ed3e95ba74219f735fce6447c..248741a40d579d1515337adc36034ed612f3c478 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * PreferencesWindow.cpp: beos interface
  *****************************************************************************
- * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * Copyright (C) 1999, 2000, 2001 the VideoLAN team
  * $Id$
  *
  * Authors: Eric Petit <titer@m0k.org>
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <stdlib.h> /* atoi(), strtod() */
 
 #include <String.h>
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
+#include <vlc_interface.h>
 #include <vlc_keys.h>
 #include <vlc_config_cat.h>
 
 /*****************************************************************************
  * PreferencesWindow::PreferencesWindow
  *****************************************************************************/
-PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
+PreferencesWindow::PreferencesWindow( intf_thread_t * _p_intf,
                                       BRect frame, const char * name )
     : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
-               B_NOT_ZOOMABLE ),
-      fConfigScroll( NULL ),
-      p_intf( p_interface )
+               B_NOT_ZOOMABLE )
 {
+    p_intf   = _p_intf;
+    fCurrent = NULL;
+
     BRect rect;
 
+    SetSizeLimits( PREFS_WINDOW_WIDTH, 2000, PREFS_WINDOW_HEIGHT, 2000 );
+
     /* The "background" view */
     fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
     fPrefsView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
@@ -182,10 +184,6 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
         if( options < 1 || category < 0 || subcategory < 0 )
             continue;
 
-        fprintf( stderr, "cat %d, sub %d, %s\n", category, subcategory,
-                 p_module->psz_shortname ? p_module->psz_shortname :
-                 p_module->psz_object_name );
-
         catItem = NULL;
         for( int j = 0; j < fOutline->CountItemsUnder( NULL, true ); j++ )
         {
@@ -228,18 +226,15 @@ PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
 
     vlc_list_release( p_list );
 
+    /* Collapse the whole tree */
     for( int i = 0; i < fOutline->FullListCountItems(); i++ )
     {
-        otherItem = (ConfigItem *)
-            fOutline->FullListItemAt( i );
-        if( fOutline->Superitem( otherItem ) )
-        {
-            fOutline->Collapse( otherItem );
-        }
+        otherItem = (ConfigItem *) fOutline->FullListItemAt( i );
+        fOutline->Collapse( otherItem );
     }
 
     /* Set the correct values */
-    ApplyChanges( false );
+    Apply( false );
 
     /* Select the first item */
     fOutline->Select( 0 );
@@ -300,15 +295,17 @@ void PreferencesWindow::MessageReceived( BMessage * message )
 
         case PREFS_DEFAULTS:
             config_ResetAll( p_intf );
-            ApplyChanges( false );
+            config_SaveConfigFile( p_intf, NULL );
+            Apply( false );
             break;
 
         case PREFS_APPLY:
-            ApplyChanges( true );
+            Apply( true );
             break;
 
         case PREFS_SAVE:
-            SaveChanges();
+            Apply( true );
+            config_SaveConfigFile( p_intf, NULL );
             break;
 
         default:
@@ -322,8 +319,7 @@ void PreferencesWindow::MessageReceived( BMessage * message )
 void PreferencesWindow::FrameResized( float width, float height )
 {
     BWindow::FrameResized( width, height );
-
-    UpdateScrollBar();
+    fCurrent->UpdateScrollBar();
 }
 
 /*****************************************************************************
@@ -334,90 +330,41 @@ void PreferencesWindow::Update()
     /* Get the selected item, if any */
     if( fOutline->CurrentSelection() < 0 )
         return;
-    fCurrent = (ConfigItem*)
-        fOutline->ItemAt( fOutline->CurrentSelection() );
 
     /* Detach the old box if any */
-    if( fDummyView->CountChildren() > 0 )
-        fDummyView->RemoveChild( fDummyView->ChildAt( 0 ) );
+    if( fCurrent )
+    {
+        fCurrent->ResetScroll();
+        fDummyView->RemoveChild( fCurrent->Box() );
+    }
 
     /* Add the new one... */
+    fCurrent = (ConfigItem *)
+        fOutline->ItemAt( fOutline->CurrentSelection() );
     fDummyView->AddChild( fCurrent->Box() );
 
     /* ...then resize it (we must resize it after it's attached or the
        children don't get adjusted) */
     fCurrent->Box()->ResizeTo( fDummyView->Bounds().Width(),
                                fDummyView->Bounds().Height() );
-
-#if 0
-    /* Force redrawing of its children */
-    BRect rect = fCurrent->fConfigBox->Bounds();
-    rect.InsetBy( 10,10 );
-    rect.top += 10;
-    fCurrent->fConfigScroll->ResizeTo( rect.Width(), rect.Height() );
-    fCurrent->fConfigScroll->Draw( fCurrent->fConfigScroll->Bounds() );
-
-    UpdateScrollBar();
-#endif
-}
-
-
-/*****************************************************************************
- * PreferencesWindow::UpdateScrollBar
- *****************************************************************************/
-void PreferencesWindow::UpdateScrollBar()
-{
-    /* We have to fix the scrollbar manually because it doesn't handle
-       correctly simple BViews */
-
-#if 0
-    if( !fCurrent )
-    {
-        return;
-    }
-
-    /* Get the available BRect for display */
-    BRect display = fCurrent->fConfigScroll->Bounds();
-    display.right -= B_V_SCROLL_BAR_WIDTH;
-
-    /* Fix the scrollbar */
-    BScrollBar * scrollBar;
-    long max;
-       BRect visible = display & fCurrent->fConfigView->Bounds();
-       BRect total = display | fCurrent->fConfigView->Bounds();
-    scrollBar = fCurrent->fConfigScroll->ScrollBar( B_VERTICAL );
-    max = (long)( fCurrent->fConfigView->Bounds().Height() - visible.Height() );
-    if( max < 0 ) max = 0;
-    scrollBar->SetRange( 0, max );
-    scrollBar->SetProportion( visible.Height() / total.Height() );
-    scrollBar->SetSteps( 10, 100 );
-#endif
+    fCurrent->UpdateScrollBar();
 }
 
 /*****************************************************************************
- * PreferencesWindow::ApplyChanges
+ * PreferencesWindow::Apply
  * Apply changes if doIt is true, revert them otherwise
  *****************************************************************************/
-void PreferencesWindow::ApplyChanges( bool doIt )
+void PreferencesWindow::Apply( bool doIt )
 {
     ConfigItem * item;
 
-    for( int i = 0; i < fOutline->CountItems(); i++ )
+    for( int i = 0; i < fOutline->FullListCountItems(); i++ )
     {
-        item = (ConfigItem*) fOutline->ItemAt( i );
+        item = (ConfigItem*) fOutline->FullListItemAt( i );
         item->Apply( doIt );
     }
 }
 
-/*****************************************************************************
- * PreferencesWindow::SaveChanges
- *****************************************************************************/
-void PreferencesWindow::SaveChanges()
-{
-    ApplyChanges( true );
-    config_SaveConfigFile( p_intf, NULL );
-}
-
 /*****************************************************************************
  * PreferencesWindow::ReallyQuit
  *****************************************************************************/
@@ -444,15 +391,18 @@ ConfigItem::ConfigItem( intf_thread_t * _p_intf, char * name,
     fType      = type;
     fHelp      = strdup( help );
 
-    fTextView = NULL;
-
     BRect r;
     r = BRect( 0, 0, 100, 100 );
     fBox = new BBox( r, NULL, B_FOLLOW_ALL );
     fBox->SetLabel( name );
 
+    fTextView = NULL;
+    fScroll   = NULL;
+    fView     = NULL;
+
     if( fType == TYPE_CATEGORY )
     {
+        /* Category: we just show the help text */
         r = fBox->Bounds();
         r.InsetBy( 10, 10 );
         r.top += 5;
@@ -463,7 +413,105 @@ ConfigItem::ConfigItem( intf_thread_t * _p_intf, char * name,
         fTextView->MakeSelectable( false );
         fTextView->Insert( fHelp );
         fBox->AddChild( fTextView );
+
+        return;
+    }
+
+    vlc_list_t * p_list = NULL;
+    module_t * p_module = NULL;
+    if( fType == TYPE_MODULE )
+    {
+        p_module = (module_t *) vlc_object_get( p_intf, fObjectId );
+    }
+    else
+    {
+        if( !( p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
+                                       FIND_ANYWHERE ) ) )
+        {
+            return;
+        }
+        for( int i = 0; i < p_list->i_count; i++ )
+        {
+            p_module = (module_t*) p_list->p_values[i].p_object;
+
+            if( !strcmp( p_module->psz_object_name, "main" ) )
+                break;
+            else
+                p_module = NULL;
+        }
+    }
+
+    if( !p_module || p_module->i_object_type != VLC_OBJECT_MODULE )
+    {
+        /* Shouldn't happen */
+        return;
+    }
+
+    module_config_t * p_item;
+    p_item = fSubModule ? ((module_t *)p_module->p_parent)->p_config :
+               p_module->p_config;
+
+    if( fType == TYPE_SUBCATEGORY )
+    {
+        for( ; p_item->i_type != CONFIG_HINT_END; p_item++ )
+        {
+            if( p_item->i_type == CONFIG_SUBCATEGORY &&
+                p_item->i_value == fObjectId )
+            {
+                break;
+            }
+        }
+    }
+
+    r = fBox->Bounds();
+    r = BRect( 10,20,fBox->Bounds().right-B_V_SCROLL_BAR_WIDTH-10,
+               fBox->Bounds().bottom-10 );
+    fView = new BView( r, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
+                       B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE );
+    fView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+
+    r = fView->Bounds();
+    r.InsetBy( 10,10 );
+
+    ConfigWidget * widget;
+    for( ; p_item->i_type != CONFIG_HINT_END; p_item++ )
+    {
+        if( ( p_item->i_type == CONFIG_CATEGORY ||
+              p_item->i_type == CONFIG_SUBCATEGORY ) &&
+            fType == TYPE_SUBCATEGORY &&
+            p_item->i_value != fObjectId )
+        {
+            break;
+        }
+
+        widget = new ConfigWidget( p_intf, r, p_item );
+        if( !widget->InitCheck() )
+        {
+            delete widget;
+            continue;
+        }
+        fView->AddChild( widget );
+        r.top += widget->Bounds().Height();
+    }
+
+    if( fType == TYPE_MODULE )
+    {
+        vlc_object_release( p_module );
+    }
+    else
+    {
+        vlc_list_release( p_list );
     }
+
+    /* Create a scroll view around our fView */
+    fScroll = new BScrollView( NULL, fView, B_FOLLOW_ALL, 0, false,
+                               true, B_FANCY_BORDER );
+    fScroll->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+    fBox->AddChild( fScroll );
+
+    /* Adjust fView's height to the size it actually needs (we do this
+       only now so the BScrollView fits the BBox) */
+    fView->ResizeTo( fView->Bounds().Width(), r.top + 10 );
 }
 
 /***********************************************************************
@@ -479,6 +527,53 @@ ConfigItem::~ConfigItem()
     }
 }
 
+/*****************************************************************************
+ * ConfigItem::UpdateScrollBar
+ *****************************************************************************/
+void ConfigItem::UpdateScrollBar()
+{
+    /* We have to fix the scrollbar manually because it doesn't handle
+       correctly simple BViews */
+
+    if( !fScroll )
+    {
+        return;
+    }
+
+    /* Get the available BRect for display */
+    BRect display = fScroll->Bounds();
+    display.right -= B_V_SCROLL_BAR_WIDTH;
+
+    /* Fix the scrollbar */
+    BScrollBar * scrollBar;
+    BRect visible = display & fView->Bounds();
+    BRect total   = display | fView->Bounds();
+    scrollBar = fScroll->ScrollBar( B_VERTICAL );
+    long max = (long)( fView->Bounds().Height() - visible.Height() );
+    if( max < 0 ) max = 0;
+    scrollBar->SetRange( 0, max );
+    scrollBar->SetProportion( visible.Height() / total.Height() );
+    scrollBar->SetSteps( 10, 100 );
+
+    /* We have to force redraw to avoid visual bugs when resizing
+       (BeOS bug?) */
+    fScroll->Invalidate();
+    fView->Invalidate();
+}
+
+/*****************************************************************************
+ * ConfigItem::ResetScroll
+ *****************************************************************************/
+void ConfigItem::ResetScroll()
+{
+    if( !fScroll )
+    {
+        return;
+    }
+
+    fView->ScrollTo( 0, 0 );
+}
+
 /***********************************************************************
  * ConfigItem::Apply
  ***********************************************************************
@@ -486,17 +581,13 @@ ConfigItem::~ConfigItem()
  **********************************************************************/
 void ConfigItem::Apply( bool doIt )
 {
-    ConfigWidget * widget;
-
-    return;
-
-    if( !fView )
+    if( !fScroll )
     {
-        /* This is a category */
         return;
     }
 
     /* Call ConfigWidget::Apply for every child of your fView */
+    ConfigWidget * widget;
     for( int i = 0; i < fView->CountChildren(); i++ )
     {
         widget = (ConfigWidget*) fView->ChildAt( i );
@@ -514,64 +605,92 @@ void ConfigItem::Apply( bool doIt )
  **********************************************************************/
 ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
                             module_config_t * p_item )
-    : BView( rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW )
+    : BView( rect, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
+             B_WILL_DRAW )
 {
-#if 0
-    fType = type;
+    p_intf = _p_intf;
+
+    SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+
+    BRect r;
+    BMenuItem * menuItem;
+    /* Skip deprecated options */
+    if( p_item->psz_current )
+    {
+        fInitOK = false;
+        return;
+    }
+
+    fInitOK = true;
+
+    fType = p_item->i_type;
+    fName = strdup( p_item->psz_name );
 
     switch( fType )
     {
+        case CONFIG_ITEM_MODULE:
+        case CONFIG_ITEM_MODULE_CAT:
+        case CONFIG_ITEM_MODULE_LIST_CAT:
         case CONFIG_ITEM_STRING:
         case CONFIG_ITEM_FILE:
-        case CONFIG_ITEM_MODULE:
         case CONFIG_ITEM_DIRECTORY:
         case CONFIG_ITEM_INTEGER:
         case CONFIG_ITEM_FLOAT:
             ResizeTo( Bounds().Width(), 25 );
-            fTextControl = new BTextControl( Bounds(), NULL, label, NULL,
-                                     new BMessage() );
+            fTextControl = new VTextControl( Bounds(), NULL,
+                p_item->psz_text, NULL, new BMessage(),
+                B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
             AddChild( fTextControl );
             break;
-
-        case CONFIG_ITEM_BOOL:
-            ResizeTo( Bounds().Width(), 25 );
-            fCheckBox = new BCheckBox( Bounds(), NULL, label, new BMessage() );
-            AddChild( fCheckBox );
-            break;
-
         case CONFIG_ITEM_KEY:
             ResizeTo( Bounds().Width(), 25 );
-            r.left = r.right - 60;
+            r = Bounds();
+            r.left = r.right - 100;
             fPopUpMenu = new BPopUpMenu( "" );
-            fMenuField = new BMenuField( r, NULL, NULL, fPopUpMenu );
+            fMenuField = new BMenuField( r, NULL, NULL, fPopUpMenu,
+                B_FOLLOW_RIGHT | B_FOLLOW_TOP );
             for( unsigned i = 0;
-                 i < sizeof( vlc_keys ) / sizeof( key_descriptor_t ); i++ )
+                 i < sizeof( vlc_keys ) / sizeof( key_descriptor_t );
+                 i++ )
             {
                 menuItem = new BMenuItem( vlc_keys[i].psz_key_string, NULL );
                 fPopUpMenu->AddItem( menuItem );
             }
-        
             r.right = r.left - 10; r.left = r.left - 60;
-            fShiftCheck = new BCheckBox( r, NULL, "Shift", new BMessage );
-        
+            fShiftCheck = new BCheckBox( r, NULL, "Shift",
+                new BMessage(), B_FOLLOW_RIGHT | B_FOLLOW_TOP );
             r.right = r.left - 10; r.left = r.left - 60;
-            fCtrlCheck = new BCheckBox( r, NULL, "Ctrl", new BMessage );
-        
+            fCtrlCheck = new BCheckBox( r, NULL, "Ctrl",
+                new BMessage(), B_FOLLOW_RIGHT | B_FOLLOW_TOP );
             r.right = r.left - 10; r.left = r.left - 60;
-            fAltCheck = new BCheckBox( r, NULL, "Alt", new BMessage );
-        
-            /* Can someone tell me how we're supposed to get GUI items aligned ? */
-            r.right = r.left - 10; r.left = 0;
-            r.bottom -= 10;
-            fStringView = new BStringView( r, NULL, label );
-        
+            fAltCheck = new BCheckBox( r, NULL, "Alt",
+                new BMessage(), B_FOLLOW_RIGHT | B_FOLLOW_TOP );
+            r.right = r.left - 10; r.left = 0; r.bottom -= 10;
+            fStringView = new BStringView( r, NULL, p_item->psz_text,
+                B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
             AddChild( fStringView );
             AddChild( fAltCheck );
             AddChild( fCtrlCheck );
             AddChild( fShiftCheck );
             AddChild( fMenuField );
             break;
-#endif
+        case CONFIG_ITEM_BOOL:
+            ResizeTo( Bounds().Width(), 25 );
+            fCheckBox = new BCheckBox( Bounds(), NULL, p_item->psz_text,
+                new BMessage(), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
+            AddChild( fCheckBox );
+            break;
+        case CONFIG_SECTION:
+            fInitOK = false;
+            break;
+        default:
+            fInitOK = false;
+    }
+}
+
+ConfigWidget::~ConfigWidget()
+{
+    free( fName );
 }
 
 /***********************************************************************
@@ -581,34 +700,36 @@ ConfigWidget::ConfigWidget( intf_thread_t * _p_intf, BRect rect,
  **********************************************************************/
 void ConfigWidget::Apply( bool doIt )
 {
-#if 0
+    BMenuItem * menuItem;
+    char string[256];
+    vlc_value_t val;
+
     switch( fType )
     {
         case CONFIG_ITEM_STRING:
         case CONFIG_ITEM_FILE:
         case CONFIG_ITEM_MODULE:
+        case CONFIG_ITEM_MODULE_CAT:
+        case CONFIG_ITEM_MODULE_LIST_CAT:
         case CONFIG_ITEM_DIRECTORY:
             if( doIt )
             {
-                config_PutPsz( p_intf, fConfigName, fTextControl->Text() );
+                config_PutPsz( p_intf, fName, fTextControl->Text() );
             }
             else
             {
-                fTextControl->SetText( config_GetPsz( p_intf, fConfigName ) );
+                fTextControl->SetText( config_GetPsz( p_intf, fName ) );
             }
             break;
 
         case CONFIG_ITEM_INTEGER:
             if( doIt )
             {
-                config_PutInt( p_intf, fConfigName,
-                               atoi( fTextControl->Text() ) );
+                config_PutInt( p_intf, fName, atoi( fTextControl->Text() ) );
             }
             else
             {
-                memset( string, 0, 1024 );
-                snprintf( string, 1023, "%d",
-                          config_GetInt( p_intf, fConfigName ) );
+                snprintf( string, 256, "%d", config_GetInt( p_intf, fName ) );
                 fTextControl->SetText( string );
             }
             break;
@@ -616,63 +737,49 @@ void ConfigWidget::Apply( bool doIt )
         case CONFIG_ITEM_FLOAT:
             if( doIt )
             {
-                config_PutFloat( p_intf, fConfigName,
-                                 strtod( fTextControl->Text(), NULL ) );
+                config_PutFloat( p_intf, fName, atof( fTextControl->Text() ) );
             }
             else
             {
-                memset( string, 0, 1024 );
-                snprintf( string, 1023, "%f",
-                          config_GetFloat( p_intf, fConfigName ) );
+                snprintf( string, 256, "%f", config_GetFloat( p_intf, fName ) );
                 fTextControl->SetText( string );
             }
             break;
 
-        case CONFIG_ITEM_BOOL:
-            if( doIt )
-            {
-                config_PutInt( p_intf, fConfigName, fCheckBox->Value() );
-            }
-            else
-            {
-                fCheckBox->SetValue( config_GetInt( p_intf, fConfigName ) );
-            }
-            break;
-
         case CONFIG_ITEM_KEY:
             if( doIt )
             {
                 menuItem = fPopUpMenu->FindMarked();
                 if( menuItem )
                 {
-                    int value = vlc_keys[fPopUpMenu->IndexOf( menuItem )].i_key_code;
+                    val.i_int = vlc_keys[fPopUpMenu->IndexOf( menuItem )].i_key_code;
                     if( fAltCheck->Value() )
                     {
-                        value |= KEY_MODIFIER_ALT;
+                        val.i_int |= KEY_MODIFIER_ALT;
                     }
                     if( fCtrlCheck->Value() )
                     {
-                        value |= KEY_MODIFIER_CTRL;
+                        val.i_int |= KEY_MODIFIER_CTRL;
                     }
                     if( fShiftCheck->Value() )
                     {
-                        value |= KEY_MODIFIER_SHIFT;
+                        val.i_int |= KEY_MODIFIER_SHIFT;
                     }
-                    config_PutInt( p_intf, fConfigName, value );
+                    var_Set( p_intf->p_libvlc, fName, val );
                 }
             }
             else
             {
-                int value = config_GetInt( p_intf, fConfigName );
-                fAltCheck->SetValue( value & KEY_MODIFIER_ALT );
-                fCtrlCheck->SetValue( value & KEY_MODIFIER_CTRL );
-                fShiftCheck->SetValue( value & KEY_MODIFIER_SHIFT );
-        
+                val.i_int = config_GetInt( p_intf, fName );
+                fAltCheck->SetValue( val.i_int & KEY_MODIFIER_ALT );
+                fCtrlCheck->SetValue( val.i_int & KEY_MODIFIER_CTRL );
+                fShiftCheck->SetValue( val.i_int & KEY_MODIFIER_SHIFT );
                 for( unsigned i = 0;
                      i < sizeof( vlc_keys ) / sizeof( key_descriptor_t ); i++ )
                 {
                     if( (unsigned) vlc_keys[i].i_key_code ==
-                            ( value & ~KEY_MODIFIER ) )
+                            ( val.i_int & ~KEY_MODIFIER ) )
                     {
                         menuItem = fPopUpMenu->ItemAt( i );
                         menuItem->SetMarked( true );
@@ -680,10 +787,22 @@ void ConfigWidget::Apply( bool doIt )
                     }
                 }
             }
+            break;
+
+        case CONFIG_ITEM_BOOL:
+            if( doIt )
+            {
+                config_PutInt( p_intf, fName, fCheckBox->Value() );
+            }
+            else
+            {
+                fCheckBox->SetValue( config_GetInt( p_intf, fName ) );
+            }
+            break;
 
+        default:
             break;
     }
-#endif
 }
 
 VTextView::VTextView( BRect frame, const char *name,
@@ -698,3 +817,17 @@ void VTextView::FrameResized( float width, float height )
     BTextView::FrameResized( width, height );
     SetTextRect( BRect( 10,10, width-11, height-11 ) );
 }
+
+VTextControl::VTextControl( BRect frame, const char *name,
+                            const char *label, const char *text,
+                            BMessage * message, uint32 resizingMode )
+    : BTextControl( frame, name, label, text, message, resizingMode )
+{
+    FrameResized( Bounds().Width(), Bounds().Height() );
+}
+
+void VTextControl::FrameResized( float width, float height )
+{
+    BTextControl::FrameResized( width, height );
+    SetDivider( width / 2 );
+}