⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preferences_widgets.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
        module_config_t *p_config = p_parser->p_config;        if( p_config ) do        {            /* Hack: required subcategory is stored in i_min */            if( p_config->i_type == CONFIG_SUBCATEGORY &&                p_config->i_value == p_item->i_min )            {                combo->Append( wxU(p_parser->psz_longname),                                   p_parser->psz_object_name );                if( p_item->psz_value && !strcmp(p_item->psz_value,                                        p_parser->psz_object_name) )                combo->SetValue( wxU(p_parser->psz_longname) );            }        } while( p_config->i_type != CONFIG_HINT_END && p_config++ );    }    vlc_list_release( p_list );    combo->SetToolTip( wxU(p_item->psz_longtext) );    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    sizer->Layout();    this->SetSizerAndFit( sizer );}ModuleConfigControl::~ModuleConfigControl(){    ;}wxString ModuleConfigControl::GetPszValue(){    return wxU( (char *)combo->GetClientData( combo->GetSelection() ));}/***************************************************************************** * ModuleListCatonfigControl implementation *****************************************************************************/BEGIN_EVENT_TABLE(ModuleListCatConfigControl, wxPanel)    EVT_CHECKBOX( wxID_HIGHEST , ModuleListCatConfigControl::OnUpdate )END_EVENT_TABLE()ModuleListCatConfigControl::ModuleListCatConfigControl( vlc_object_t *p_this,                                                     module_config_t *p_item,                                                     wxWindow *parent )  : ConfigControl( p_this, p_item, parent ){    vlc_list_t *p_list;    module_t *p_parser;    delete sizer;    sizer = new wxBoxSizer( wxVERTICAL );    label = new wxStaticText(this, -1, wxU(p_item->psz_text));    sizer->Add( label );    text = new wxTextCtrl( this, -1, wxU(p_item->psz_value),                           wxDefaultPosition,wxSize( 300, 20 ) );    /* build a list of available modules */    p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );    for(  int i_index = 0; i_index < p_list->i_count; i_index++ )    {        p_parser = (module_t *)p_list->p_values[i_index].p_object ;        if( !strcmp( p_parser->psz_object_name, "main" ) )              continue;        module_config_t *p_config;        if( p_parser->b_submodule )            p_config = ((module_t*)p_parser->p_parent)->p_config;        else            p_config = p_parser->p_config;        if( p_config ) do        {            /* Hack: required subcategory is stored in i_min */            if( p_config->i_type == CONFIG_SUBCATEGORY &&                p_config->i_value == p_item->i_min )            {                moduleCheckBox *mc = new moduleCheckBox;                mc->checkbox = new wxCheckBox( this, wxID_HIGHEST,                                               wxU(p_parser->psz_longname));                /* hack to handle submodules properly */                int i = -1;                while( p_parser->pp_shortcuts[++i] != NULL );                i--;                mc->psz_module = strdup( i>=0?p_parser->pp_shortcuts[i]                                         :p_parser->psz_object_name );                pp_checkboxes.push_back( mc );                if( p_item->psz_value &&                    strstr( p_item->psz_value, mc->psz_module ) )                {                    mc->checkbox->SetValue( true );                }                sizer->Add( mc->checkbox );            }        } while( p_config->i_type != CONFIG_HINT_END && p_config++ );    }    vlc_list_release( p_list );    text->SetToolTip( wxU(p_item->psz_longtext) );    sizer->Add(text, 0, wxEXPAND|wxALL, 5 );    sizer->Add (new wxStaticText( this, -1, wxU( vlc_wraptext( _("Select "        "the desired modules. For more advanced control, the "        "resulting \"chain\" can be modified.") , 72 ) ) ) );    sizer->Layout();    this->SetSizerAndFit( sizer );}ModuleListCatConfigControl::~ModuleListCatConfigControl(){    ;}wxString ModuleListCatConfigControl::GetPszValue(){    return text->GetValue() ;}void  ModuleListCatConfigControl::OnUpdate( wxCommandEvent &event ){    bool b_waschecked = false;    wxString newtext =  text->GetValue();    for( unsigned int i = 0 ; i< pp_checkboxes.size() ; i++ )    {        b_waschecked = newtext.Find( wxT(":")+wxU(pp_checkboxes[i]->psz_module)+wxT(":")) != -1 || newtext.BeforeFirst( ':' ) == wxString(wxU(pp_checkboxes[i]->psz_module)) || newtext.AfterLast( ':' ) == wxString(wxU(pp_checkboxes[i]->psz_module));        /* For some reasons, ^^ doesn't compile :( */        if( (pp_checkboxes[i]->checkbox->IsChecked() && ! b_waschecked )||            (! pp_checkboxes[i]->checkbox->IsChecked() && b_waschecked) )        {            if( b_waschecked )            {                /* Maybe not the clest solution */                if( ! newtext.Replace(wxString(wxT(":"))                                      +wxU(pp_checkboxes[i]->psz_module)+wxT(":"),                                      wxT(":")))                {                    if( newtext.BeforeFirst( ':' ) == wxString(wxU(pp_checkboxes[i]->psz_module)) )                    {                        newtext = newtext.AfterFirst( ':' );                    }                    else if( newtext.AfterLast( ':' ) == wxString(wxU(pp_checkboxes[i]->psz_module)) )                    {                        newtext = newtext.BeforeLast( ':' );                    }                    else if( newtext == wxString(wxU(pp_checkboxes[i]->psz_module)) )                    {                        newtext = wxT("");                    }                    else                    {                        newtext.Replace(wxU(pp_checkboxes[i]->psz_module),wxU(""));                    }                }            }            else            {                if( newtext.Len() == 0 )                {                    newtext = wxU(pp_checkboxes[i]->psz_module);                }                else                {                    newtext += wxU( ":" );                    newtext += wxU(pp_checkboxes[i]->psz_module);                }            }        }    }    text->SetValue( newtext );}/***************************************************************************** * StringConfigControl implementation *****************************************************************************/StringConfigControl::StringConfigControl( vlc_object_t *p_this,                                          module_config_t *p_item,                                          wxWindow *parent )  : ConfigControl( p_this, p_item, parent ){    label = new wxStaticText(this, -1, wxU(p_item->psz_text));    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    textctrl = new wxTextCtrl( this, -1,                               wxL2U(p_item->psz_value),                               wxDefaultPosition,                               wxDefaultSize,                               wxTE_PROCESS_ENTER);    textctrl->SetToolTip( wxU(p_item->psz_longtext) );    sizer->Add( textctrl, 1, wxALL, 5 );    sizer->Layout();    this->SetSizerAndFit( sizer );}StringConfigControl::~StringConfigControl(){    ;}wxString StringConfigControl::GetPszValue(){    return textctrl->GetValue();}BEGIN_EVENT_TABLE(StringConfigControl, wxPanel)    /* Text events */    EVT_TEXT(-1, StringConfigControl::OnUpdate)END_EVENT_TABLE()/***************************************************************************** * StringListConfigControl implementation *****************************************************************************/StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,                                                  module_config_t *p_item,                                                  wxWindow *parent )  : ConfigControl( p_this, p_item, parent ){    psz_default_value = p_item->psz_value;    if( psz_default_value ) psz_default_value = strdup( psz_default_value );    label = new wxStaticText(this, -1, wxU(p_item->psz_text));    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    combo = new wxComboBox( this, -1, wxT(""),                            wxDefaultPosition, wxDefaultSize,                            0, NULL, wxCB_READONLY );    UpdateCombo( p_item );    combo->SetToolTip( wxU(p_item->psz_longtext) );    sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    for( int i = 0; i < p_item->i_action; i++ )    {        wxButton *button =            new wxButton( this, wxID_HIGHEST+i,                          wxU(_(p_item->ppsz_action_text[i])) );        sizer->Add( button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);    }    sizer->Layout();    this->SetSizerAndFit( sizer );}StringListConfigControl::~StringListConfigControl(){    if( psz_default_value ) free( psz_default_value );}void StringListConfigControl::UpdateCombo( module_config_t *p_item ){    vlc_bool_t b_found = VLC_FALSE;    int i_index;    /* build a list of available options */    for( i_index = 0; i_index < p_item->i_list; i_index++ )    {        combo->Append( ( p_item->ppsz_list_text &&                         p_item->ppsz_list_text[i_index] ) ?                       wxU(p_item->ppsz_list_text[i_index]) :                       wxL2U(p_item->ppsz_list[i_index]) );        combo->SetClientData( i_index, (void *)p_item->ppsz_list[i_index] );        if( ( p_item->psz_value &&              !strcmp( p_item->psz_value, p_item->ppsz_list[i_index] ) ) ||             ( !p_item->psz_value && !*p_item->ppsz_list[i_index] ) )        {            combo->SetSelection( i_index );            combo->SetValue( ( p_item->ppsz_list_text &&                               p_item->ppsz_list_text[i_index] ) ?                             wxU(p_item->ppsz_list_text[i_index]) :                             wxL2U(p_item->ppsz_list[i_index]) );            b_found = VLC_TRUE;        }    }    if( p_item->psz_value && !b_found )    {        /* Add custom entry to list */        combo->Append( wxL2U(p_item->psz_value) );        combo->SetClientData( i_index, (void *)psz_default_value );        combo->SetSelection( i_index );        combo->SetValue( wxL2U(p_item->psz_value) );    }}BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)    /* Button events */    EVT_BUTTON(-1, StringListConfigControl::OnAction)    /* Text events */    EVT_TEXT(-1, StringListConfigControl::OnUpdate)END_EVENT_TABLE()void StringListConfigControl::OnAction( wxCommandEvent& event ){    int i_action = event.GetId() - wxID_HIGHEST;    module_config_t *p_item = config_FindConfig( p_this, GetName().mb_str(wxConvUTF8) );    if( !p_item ) return;    if( i_action < 0 || i_action >= p_item->i_action ) return;    vlc_value_t val;    wxString value = GetPszValue();    *((const char **)&val.psz_string) = value.mb_str(wxConvUTF8);    p_item->ppf_action[i_action]( p_this, GetName().mb_str(wxConvUTF8), val, val, 0 );    if( p_item->b_dirty )    {        combo->Clear();        UpdateCombo( p_item );        p_item->b_dirty = VLC_FALSE;    }}wxString StringListConfigControl::GetPszValue(){    int selected = combo->GetSelection();    if( selected != -1 )    {        return wxL2U((char *)combo->GetClientData( selected ));    }    return wxString();}/***************************************************************************** * FileConfigControl implementation *****************************************************************************/FileConfigControl::FileConfigControl( vlc_object_t *p_this,                                      module_config_t *p_item,                                      wxWindow *parent )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -