示例#1
0
文件: mmg.cpp 项目: VRDate/mkvtoolnix
void
mmg_app::handle_command_line_arguments() {
  if (1 >= app->argc)
    return;

  std::vector<std::string> args;
  size_t i;
  for (i = 1; static_cast<size_t>(app->argc) > i; ++i)
    args.push_back(wxMB(wxString(app->argv[i])));

  handle_common_cli_args(args, "");

  if (args.empty())
    return;

  std::vector<wxString> wargs;
  for (i = 0; args.size() > i; ++i)
    wargs.push_back(wxU(args[i]));

  if (wargs[0] == wxT("--edit-headers")) {
    if (wargs.size() == 1)
      wxMessageBox(Z("Missing file name after for the option '--edit-headers'."), Z("Missing file name"), wxOK | wxCENTER | wxICON_ERROR);
    else
      mdlg->create_header_editor_window(wargs[1]);

    return;
  }

  for (auto &file : wargs)
    if (!wxFileExists(file) || wxDirExists(file))
      wxMessageBox(wxString::Format(Z("The file '%s' does not exist."), file.c_str()), Z("Error loading settings"), wxOK | wxCENTER | wxICON_ERROR);
    else {
#ifdef SYS_WINDOWS
      if ((file.Length() > 3) && (file.c_str()[1] != wxT(':')) && (file.c_str()[0] != wxT('\\')))
        file = wxGetCwd() + wxT("\\") + file;
#else
      if ((file.Length() > 0) && (file.c_str()[0] != wxT('/')))
        file = wxGetCwd() + wxT("/") + file;
#endif

      if (wxFileName(file).GetExt() == wxU("mmg"))
        mdlg->load(file);
      else
        mdlg->input_page->add_file(file, false);
    }
}
示例#2
0
FloatConfigControl::FloatConfigControl( 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));
    textctrl = new wxTextCtrl( this, -1,
                               wxString::Format(wxT("%f"),
                                                p_item->f_value),
                               wxDefaultPosition, wxDefaultSize,
                               wxTE_PROCESS_ENTER );
    textctrl->SetToolTip( wxU(p_item->psz_longtext) );
    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
    sizer->Add( textctrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
    sizer->Layout();
    this->SetSizerAndFit( sizer );
}
示例#3
0
/*****************************************************************************
 * IntegerListConfigControl implementation
 *****************************************************************************/
IntegerListConfigControl::IntegerListConfigControl( 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 );
    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 );

    sizer->Layout();
    this->SetSizerAndFit( sizer );
}
示例#4
0
/*****************************************************************************
 * IntegerConfigControl implementation
 *****************************************************************************/
IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
                                            module_config_t *p_item,
                                            HWND parent, HINSTANCE hInst,
                                            int * py_pos )
  : ConfigControl( p_this, p_item, parent, hInst )
{
    label = new wxStaticText(this, -1, wxU(p_item->psz_text));
    spin = new wxSpinCtrl( this, -1,
                           wxString::Format(wxT("%d"),
                                            p_item->i_value),
                           wxDefaultPosition, wxDefaultSize,
                           wxSP_ARROW_KEYS,
                           -10000000, 10000000, p_item->i_value);
    spin->SetToolTip( wxU(p_item->psz_longtext) );
    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
    sizer->Add( spin, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
    sizer->Layout();
    this->SetSizerAndFit( sizer );
}
示例#5
0
void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{
    playlist_t *p_playlist =
        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                       FIND_ANYWHERE );
    if( p_playlist == NULL )
    {
        return;
    }

    if( p_file_dialog == NULL )
        p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
            wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );

	p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO 
        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO 
        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST 
        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));

    if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
    {
        wxArrayString paths;

        p_file_dialog->GetPaths( paths );

        for( size_t i = 0; i < paths.GetCount(); i++ )
        {
            char *psz_utf8 = wxFromLocale( paths[i] );
            if( event.GetInt() )
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                              (i ? PLAYLIST_PREPARSE : 0 ),
                              PLAYLIST_END );
            else
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
            wxLocaleFree( psz_utf8 );
        }
    }

    vlc_object_release( p_playlist );
}
示例#6
0
/*****************************************************************************
 * ConfigControl implementation
 *****************************************************************************/
ConfigControl::ConfigControl( vlc_object_t *_p_this,
                              module_config_t *p_item, wxWindow *parent )
  : wxPanel( parent ), p_this( _p_this ),
    pf_update_callback( NULL ), p_update_data( NULL ),
    name( wxU(p_item->psz_name) ), i_type( p_item->i_type ),
    b_advanced( p_item->b_advanced )

{
    sizer = new wxBoxSizer( wxHORIZONTAL );
}
void
scanning_for_playlists_dlg::update_gauge(size_t progress) {
  m_progress = progress;
  m_g_progress->SetValue(m_progress);
  m_st_progress->SetLabel(wxU(boost::format(NY("%1% of %2% file processed", "%1% of %2% files processed", m_max_progress)) % m_progress % m_max_progress));
#if defined(SYS_WINDOWS)
  if (m_taskbar_progress)
    m_taskbar_progress->set_value(m_progress, m_max_progress);
#endif  // SYS_WINDOWS
}
示例#8
0
void SubsFileDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{
    wxFileDialog dialog( this, wxU(_("Open file")),
                         wxT(""), wxT(""), wxT("*"), wxOPEN );

    if( dialog.ShowModal() == wxID_OK )
    {
        file_combo->SetValue( dialog.GetPath() );
    }
}
示例#9
0
/* Keep aout up to date and update the bands if needed */
void ExtraPanel::OnIdle( wxIdleEvent &event )
{
    CheckAout();
    if( b_update == VLC_TRUE )
    {
        if( b_my_update == VLC_TRUE )
        {
            b_update = b_my_update = VLC_FALSE;
            return;
        }
        char *p = psz_bands;
        for( int i = 0; i < 10; i++ )
        {
                float f;
                char psz_val[5];
                int i_val;
                /* Read dB -20/20*/
                f = strtof( p, &p );
                i_val= (int)( ( f + 20 ) * 10 );
                band_sliders[i]->SetValue( 400 - i_val );
                i_values[i] = 400 - i_val;
                sprintf( psz_val, "%.1f", f );
                band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") +
                                                wxU( psz_val ) + wxT("dB") );
                if( p == NULL )
                {
                    break;
                }
                p++;
                if( *p == 0 )
                    break;
        }
        char psz_val[5];
        int i_val = (int)( ( f_preamp + 20 ) * 10 );
        sprintf( psz_val, "%.1f", f_preamp );
        preamp_slider->SetValue( 400 - i_val );
        const wxString preamp = wxT("Preamp\n");
        preamp_text->SetLabel( preamp + wxU( psz_val ) + wxT( "dB" ) );
        eq_chkbox->SetValue( TRUE );
        b_update = VLC_FALSE;
    }
}
示例#10
0
/*****************************************************************************
 * FileConfigControl implementation
 *****************************************************************************/
FileConfigControl::FileConfigControl( vlc_object_t *p_this,
                                      module_config_t *p_item,
                                      wxWindow *parent )
  : ConfigControl( p_this, p_item, parent )
{
    directory = p_item->i_type == CONFIG_ITEM_DIRECTORY;
    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 );
    browse = new wxButton( this, wxID_HIGHEST, wxU(_("Browse...")) );
    sizer->Add( browse, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
    sizer->Layout();
    this->SetSizerAndFit( sizer );
}
示例#11
0
void
job_run_dialog::process_input() {
  if (!process)
    return;

  while (process->IsInputAvailable()) {
    bool got_char = false;
    char c        = 0;

    if (!out->Eof()) {
      c = out->GetC();
      got_char = true;
    }

    if (got_char && ((c == '\n') || (c == '\r') || out->Eof())) {
      wxString wx_line = wxU(line);

      if (wx_line.Find(wxT("#GUI#begin_scanning_playlists")) == 0)
        m_scanning_playlists = true;

      else if (wx_line.Find(wxT("#GUI#end_scanning_playlists")) == 0) {
        m_scanning_playlists         = false;

        m_start_time                 = mtx::sys::get_current_time_millis();
        m_next_remaining_time_update = m_start_time + 8000;

        if (!current_job) {
          m_start_time_total                 = m_start_time;
          m_next_remaining_time_update_total = m_next_remaining_time_update;
        }

      } else if (wx_line.Find(wxT("#GUI#progress")) == 0) {
        int percent_pos = wx_line.Find(wxT("%"));
        if (0 < percent_pos) {
          wx_line.Remove(percent_pos);
          wxString tmp = wx_line.AfterLast(wxT(' '));

          long value;
          tmp.ToLong(&value);
          if ((value >= 0) && (value <= 100))
            set_progress_value(value);
        }
      } else if (wx_line.Length() > 0)
        *jobs[jobs_to_start[current_job]].log += wx_line + wxT("\n");
      line = "";
    } else if ((unsigned char)c != 0xff)
      line += c;

    update_remaining_time();

    if (out->Eof())
      break;
  }
}
示例#12
0
void
tab_input_format::translate_ui() {
  rb_aspect_ratio->SetLabel(Z("Aspect ratio:"));
  cob_aspect_ratio->SetToolTip(TIP("Sets the display aspect ratio of the track. The format can be either 'a/b' in which case both numbers must be integer "
                                   "(e.g. 16/9) or just a single floating point number 'f' (e.g. 2.35)."));
  rb_display_dimensions->SetLabel(Z("Display width/height:"));
  tc_display_width->SetToolTip(TIP("Sets the display width of the track. The height must be set as well, or this field will be ignored."));
  tc_display_height->SetToolTip(TIP("Sets the display height of the track. The width must be set as well, or this field will be ignored."));
  st_fourcc->SetLabel(Z("FourCC:"));
  cob_fourcc->SetToolTip(TIP("Forces the FourCC of the video track to this value. Note that this only works for video "
                             "tracks that use the AVI compatibility mode or for QuickTime video tracks. This option CANNOT be used to change Matroska's CodecID."));
  st_stereo_mode->SetLabel(Z("Stereoscopy:"));
  cob_stereo_mode->SetToolTip(TIP("Sets the stereo mode of the video track to this value. If left empty then the track's original stereo mode will be kept or, if "
                                  "it didn't have one, none will be set at all."));
  st_fps->SetLabel(Z("FPS:"));
  cob_fps->SetToolTip(TIP("Sets the default duration or number of frames per second for a track. This can either be a floating point number or a fraction."));
  st_nalu_size_length->SetLabel(Z("NALU size length:"));
  cob_nalu_size_length->SetToolTip(TIP("Forces the NALU size length to a certain number of bytes. This parameter is only available for AVC/h.264 elementary "
                                       "streams read from AVC/h.264 ES files, AVIs or Matroska files created with '--engage allow_avc_in_vwf_mode'. "
                                       "It defaults to 4 bytes, but there are files which do not contain a frame or slice that is bigger than 65535 bytes. "
                                       "For such files you can use this parameter and decrease the size to 2."));
  st_delay->SetLabel(Z("Delay (in ms):"));
  tc_delay->SetToolTip(TIP("Delay this track's timecodes by a couple of ms. Can be negative. Works with all track types, "
                           "but negative delays should not be used with video tracks."));
  st_stretch->SetLabel(Z("Stretch by:"));
  tc_stretch->SetToolTip(TIP("Stretch this track's timecodes. This entry can have two formats. "
                             "It is either a positive floating point number, or a fraction like e.g. 1200/1253. "
                             "Works best on video and subtitle tracks."));
  st_sub_charset->SetLabel(Z("Charset:"));
  auto tip = (boost::format("%1% %2% %3% %4%")
              % Y("Selects the character set a subtitle file or chapter information was written with.")
              % Y("Only needed in certain situations:")
              % (boost::format(Y("1. for subtitle files that do not use a byte order marker (BOM) and that are not encoded in the system's current character set (%1%);"))
                 % g_cc_local_utf8->get_charset())
              % Y("2. for files with chapter information (e.g. OGM, MP4) for which mkvmerge does not detect the encoding correctly.")
              ).str();
  cob_sub_charset->SetToolTip(format_tooltip(wxU(tip)));
  st_cropping->SetLabel(Z("Cropping:"));
  tc_cropping->SetToolTip(TIP("Sets the cropping parameters. Must be comma-separated list of four numbers for the cropping to be used at the left, top, right and bottom."));
  cb_aac_is_sbr->SetLabel(Z("AAC is SBR/HE-AAC/AAC+"));
  cb_aac_is_sbr->SetToolTip(TIP("This track contains SBR AAC/HE-AAC/AAC+ data. Only needed for AAC input files, because SBR AAC cannot be detected automatically for "
                                "these files. Not needed for AAC tracks read from MP4 or Matroska files."));

  cb_reduce_to_core->SetLabel(Z("Reduce to audio core"));
  cb_reduce_to_core->SetToolTip(TIP("Drops the lossless extensions from an audio track and keeps only its lossy core. This only works with DTS tracks."));

  cb_fix_bitstream_timing_info->SetLabel(Z("Fix bitstream timing information"));
  cb_fix_bitstream_timing_info->SetToolTip(TIP("Normally mkvmerge does not change the timing information (frame/field rate) stored in the video bitstream. "
                                               "With this option that information is adjusted to match the container timing information. "
                                               "The container timing information can come from various sources: from the command line via --default-duration, "
                                               "the source container or derived from the bitstream."));

  setup_control_contents();
}
scanning_for_playlists_dlg::scanning_for_playlists_dlg(wxWindow *parent,
                                                       wxString const &original_file_name,
                                                       wxArrayString const &original_output,
                                                       std::vector<wxString> const &other_file_names)
  : wxDialog{parent, wxID_ANY, Z("Scanning directory")}
#if defined(SYS_WINDOWS)
  , m_taskbar_progress{}
#endif  // SYS_WINDOWS
  , m_scanner{new scan_directory_thread_c{this, other_file_names}}
  , m_aborted{}
  , m_progress{}
  , m_max_progress{other_file_names.size()}
  , m_start_time{}
  , m_next_remaining_time_update{}
{
	m_st_progress           = new wxStaticText(this, wxID_ANY,    wxU(boost::format(NY("%1% of %2% file processed", "%1% of %2% files processed", other_file_names.size())) % 0 % other_file_names.size()));
	m_g_progress            = new wxGauge(     this, wxID_ANY,    m_max_progress);
  auto st_remaining_label = new wxStaticText(this, wxID_ANY,    Z("Remaining time:"));
	m_st_remaining_time     = new wxStaticText(this, wxID_ANY,    Z("is being estimated"));
	m_b_abort               = new wxButton(    this, wxID_CANCEL, Z("&Abort"));

#if defined(SYS_WINDOWS)
  if (get_windows_version() >= WINDOWS_VERSION_7) {
    m_taskbar_progress = new taskbar_progress_c(mdlg);
    m_taskbar_progress->set_state(TBPF_NORMAL);
    m_taskbar_progress->set_value(0, other_file_names.size());
  }
#endif  // SYS_WINDOWS

  auto siz_remaining_time = new wxBoxSizer(wxHORIZONTAL);
  siz_remaining_time->Add(st_remaining_label,  0, wxALL, 5);
  siz_remaining_time->Add(m_st_remaining_time, 0, wxALL, 5);

	auto siz_button = new wxBoxSizer(wxHORIZONTAL);
	siz_button->AddStretchSpacer();
	siz_button->Add(m_b_abort, 0, wxALL, 5);
	siz_button->AddStretchSpacer();

	auto siz_all = new wxBoxSizer(wxVERTICAL);
	siz_all->Add(m_st_progress,      0, wxALL,            5);
	siz_all->Add(m_g_progress,       0, wxALL | wxEXPAND, 5);
	siz_all->Add(siz_remaining_time, 0, wxALL,            5);
	siz_all->Add(siz_button,         1, wxEXPAND,         5);

	SetSizerAndFit(siz_all);
  auto min_size = GetMinSize();
  SetSize(wxSize{min_size.GetWidth() + 50, min_size.GetHeight()});
	Layout();

	Centre(wxBOTH);

  parse_output(original_file_name, original_output);
}
示例#14
0
void
mux_dialog::add_input(std::string const &input) {
  auto lines        = split(m_available_input + input, boost::regex("\r|\n"));
  m_available_input = lines.back();
  lines.pop_back();

  for (auto const &line : lines) {
    wxCommandEvent evt(mux_process::event, mux_process::output_available);
    evt.SetString(wxU(line));
    wxPostEvent(this, evt);
  }
}
void
select_scanned_file_dlg::update_info() {
  wxListItem item;

  auto &playlist = *m_playlists[m_selected_playlist_idx];

  m_st_duration->SetLabel(wxU(format_timecode(playlist.duration, 0)));
  m_st_size->SetLabel(wxU(format_file_size(playlist.size)));
  m_st_chapters->SetLabel(wxU(boost::format("%1%") % playlist.chapters));

  m_lc_tracks->Hide();
  m_lc_tracks->DeleteAllItems();
  long idx = 0;
  for (auto &track : playlist.tracks) {
    auto id = m_lc_tracks->InsertItem(idx, track.type);
    m_lc_tracks->SetItem(id, 1, track.codec);
    m_lc_tracks->SetItem(id, 2, wxU(boost::format("%|1$ -15s|") % to_utf8(track.language)));
    ++idx;
  }

  m_lc_tracks->SetColumnWidth(0, wxLIST_AUTOSIZE);
  m_lc_tracks->SetColumnWidth(1, wxLIST_AUTOSIZE);
  m_lc_tracks->SetColumnWidth(2, wxLIST_AUTOSIZE);

  m_lc_tracks->Show();

  m_lc_items->Hide();
  m_lc_items->DeleteAllItems();
  idx = 0;
  for (auto &file : playlist.files) {
    auto id = m_lc_items->InsertItem(idx, wxFileName{file}.GetFullName());
    m_lc_items->SetItem(id, 1, wxFileName{file}.GetPath());
    ++idx;
  }

  m_lc_items->SetColumnWidth(0, wxLIST_AUTOSIZE);
  m_lc_items->SetColumnWidth(1, wxLIST_AUTOSIZE);

  m_lc_items->Show();
}
ask_scan_for_playlists_dlg::ask_scan_for_playlists_dlg(wxWindow *parent,
                                                       size_t num_other_files)
  : wxDialog{parent, wxID_ANY, Z("Scan directory for other playlists")}
{
	SetSize(500, 150);

  auto text = wxU(boost::format("%1% %2% %3%")
                  % Y("The file you've added is a playlist.")
                  % (boost::format(NY("The directory it is located in contains %1% other file with the same extension.",
                                      "The directory it is located in contains %1% other files with the same extension.",
                                      num_other_files))
                     % num_other_files)
                  % Y("mmg can scan these files, present the results including duration and number of tracks of each playlist found and let you choose which one to add."));
	auto st_question = new wxStaticText(this, wxID_ANY, text);
	st_question->Wrap(480);

	auto st_in_the_future = new wxStaticText(this, wxID_ANY, Z("What to do in the future:"), wxDefaultPosition, wxDefaultSize, 0);

  wxString const scan_directory_for_playlists_choices[] = {
    Z("always ask the user"),
    Z("always scan for other playlists"),
    Z("never scan for other playlists"),
  };
  m_cob_in_the_future = new wxMTX_COMBOBOX_TYPE(this, wxID_ANY, Z("always ask the user"), wxDefaultPosition, wxDefaultSize, 3, scan_directory_for_playlists_choices, wxCB_READONLY);
	m_cob_in_the_future->SetSelection(mdlg->options.scan_directory_for_playlists);


	auto b_scan      = new wxButton(this, wxID_OK,     Z("&Scan for other playlists"));
	auto b_dont_scan = new wxButton(this, wxID_CANCEL, Z("&Don't scan, just add the file"));
  b_scan->SetDefault();

	auto siz_in_the_future = new wxBoxSizer(wxHORIZONTAL);
	siz_in_the_future->Add(st_in_the_future,    0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	siz_in_the_future->Add(m_cob_in_the_future, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	auto siz_buttons = new wxBoxSizer(wxHORIZONTAL);
	siz_buttons->AddStretchSpacer();
	siz_buttons->Add(b_scan);
	siz_buttons->AddStretchSpacer();
	siz_buttons->Add(b_dont_scan);
	siz_buttons->AddStretchSpacer();

	auto siz_all = new wxBoxSizer(wxVERTICAL);
	siz_all->Add(st_question,       0, wxALL,    5);
	siz_all->Add(siz_in_the_future, 1, wxEXPAND, 5);
	siz_all->Add(siz_buttons,       1, wxEXPAND, 5);

	SetSizerAndFit(siz_all);
	Layout();

	Centre(wxBOTH);
}
示例#17
0
void StringListConfigControl::UpdateCombo( module_config_t *p_item )
{
    /* build a list of available options */
    for( int 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]) );
        }
    }
}
示例#18
0
void
mux_dialog::update_remaining_time() {
    int64_t now = get_current_time_millis();

    if ((0 == m_progress) || (now < m_next_remaining_time_update))
        return;

    int64_t total_time     = (now - m_start_time) * 100 / m_progress;
    int64_t remaining_time = total_time - now + m_start_time;
    st_remaining_time->SetLabel(wxU(create_minutes_seconds_time_string(static_cast<unsigned int>(remaining_time / 1000))));

    m_next_remaining_time_update = now + 1000;
}
示例#19
0
void ExtraPanel::OnChangeEqualizer( wxScrollEvent &event )
{
    aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf,
                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
    char psz_values[102];
    memset( psz_values, 0, 102 );


    /* Smoothing */
    int i_diff = event.GetPosition() - i_values[  event.GetId() - Band0_Event ];
    i_values[ event.GetId() - Band0_Event] = event.GetPosition();

    for( int i = event.GetId() + 1 ; i <= Band9_Event ; i++ )
    {
        int i_new = band_sliders[ i-Band0_Event ]->GetValue() +
           (int)( i_diff * pow( (float)i_smooth / 100 , i- event.GetId() ) ) ;
        if( i_new < 0 ) i_new = 0;
        if( i_new > 400 ) i_new = 400;
        band_sliders[ i-Band0_Event ]->SetValue( i_new );
    }
    for( int i = Band0_Event ; i < event.GetId() ; i++ )
    {
        int i_new =   band_sliders[ i-Band0_Event ]->GetValue() +
           (int)( i_diff * pow( (float)i_smooth / 100 , event.GetId() - i  ) );
        if( i_new < 0 ) i_new = 0;
        if( i_new > 400 ) i_new = 400;
        band_sliders[ i-Band0_Event ]->SetValue( i_new );
    }

    /* Write the new bands values */
    for( int i = 0 ; i < 10 ; i++ )
    {
        char psz_val[5];
        float f_val = (float)( 400 - band_sliders[i]->GetValue() ) / 10- 20 ;
        sprintf( psz_values, "%s %f", psz_values, f_val );
        sprintf( psz_val, "%.1f", f_val );
        band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") +
                        wxU( psz_val ) + wxT("dB" ) );
    }
    if( p_aout == NULL )
    {
        config_PutPsz( p_intf, "equalizer-bands", psz_values );
    }
    else
    {
        var_SetString( p_aout, "equalizer-bands", psz_values );
        config_PutPsz( p_intf, "equalizer-bands", psz_values );
        b_my_update = VLC_TRUE;
        vlc_object_release( p_aout );
    }
}
示例#20
0
/*****************************************************************************
 * ModuleConfigControl implementation
 *****************************************************************************/
ModuleConfigControl::ModuleConfigControl( 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;

    label = new wxStaticText(this, -1, wxU(p_item->psz_text));
    combo = new wxComboBox( this, -1, wxL2U(p_item->psz_value),
                            wxDefaultPosition, wxDefaultSize,
                            0, NULL, wxCB_READONLY | wxCB_SORT );

    /* build a list of available modules */
    p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
    combo->Append( wxU(_("Default")), (void *)NULL );
    combo->SetSelection( 0 );
    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_capability, p_item->psz_type ) )
        {
            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) );
        }
    }
    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 );
}
示例#21
0
/*****************************************************************************
 * Constructor.
 *****************************************************************************/
ExtraPanel::ExtraPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ):
        wxPanel( _p_parent , -1, wxDefaultPosition, wxDefaultSize )
{

    p_intf = _p_intf;
    p_parent = _p_parent;
    SetAutoLayout( TRUE );

    wxBoxSizer *extra_sizer = new wxBoxSizer( wxHORIZONTAL );

    notebook = new wxNotebook( this, Notebook_Event );

    wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );

    notebook->AddPage( VideoPanel( notebook ), wxU(_("Video")) );
    notebook->AddPage( EqzPanel( notebook ), wxU(_("Equalizer")) );
    notebook->AddPage( AudioPanel( notebook ), wxU(_("Audio")) );

    extra_sizer->Add( notebook_sizer, 1, wxEXPAND, 0 );

    SetSizerAndFit( extra_sizer );
    extra_sizer->Layout();
}
示例#22
0
void
mmg_options_t::init_popular_languages(const wxString &list) {
  size_t i;

  popular_languages.clear();

  if (!list.IsEmpty()) {
    std::vector<wxString> codes = split(list, wxU(" "));
    for (i = 0; codes.size() > i; ++i)
      if (is_valid_iso639_2_code(wxMB(codes[i])))
        popular_languages.Add(codes[i]);
  }

  if (popular_languages.IsEmpty()) {
    std::map<std::string, bool> codes_found;
    for (auto lang : g_iso639_languages)
      if (!codes_found[lang.iso639_2_code] && is_popular_language_code(lang.iso639_2_code)) {
        popular_languages.Add(wxU(lang.iso639_2_code));
        codes_found[lang.iso639_2_code] = true;
      }
  }

  popular_languages.Sort();
}
示例#23
0
void Messages::OnSaveLog( wxCommandEvent& WXUNUSED(event) )
{
    if( save_log_dialog == NULL )
        save_log_dialog = new wxFileDialog( this,
            wxU(_("Save Messages As...")),
            wxT(""), wxT("messages"), wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );

    if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK )
    {
        if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
        {
            // [FIX ME] should print an error message
        }
    }
}
示例#24
0
/* Audio panel constructor */
wxPanel *ExtraPanel::AudioPanel( wxWindow *parent )
{
    char *psz_filters;

    wxPanel *panel = new wxPanel( parent, -1 );
    wxBoxSizer *panel_sizer = new wxBoxSizer( wxHORIZONTAL );

    /* Create static box to surround the adjust controls */
    wxStaticBox *filter_box =
           new wxStaticBox( panel, -1, wxU(_("Audio filters")) );
    wxStaticBoxSizer *filter_sizer =
        new wxStaticBoxSizer( filter_box, wxVERTICAL );
    filter_sizer->SetMinSize( -1, 50 );

    wxCheckBox * headphone_check = new wxCheckBox( panel, HeadPhone_Event,
                                    wxU(_("Headphone virtualization")));
    headphone_check->SetToolTip( wxU(_("This filter gives the feeling of a "
             "5.1 speaker set when using a headphone." ) ) );

    wxCheckBox * normvol_check = new wxCheckBox( panel, NormVol_Event,
                                    wxU(_("Volume normalization")));
    normvol_check->SetToolTip( wxU(_("This filter prevents the audio output "
                         "power from going over a defined value." ) ) );

    wxStaticText *normvol_label = new wxStaticText( panel, -1,
                                   wxU( _("Maximum level") ) );

    wxSlider *normvol_slider = new wxSlider ( panel, NVSlider_Event, 20, 5,
                           100, wxDefaultPosition, wxSize( 100, -1 ) );

    filter_sizer->Add( headphone_check, 0, wxALL, 4 );
    filter_sizer->Add( normvol_check, 0, wxALL, 4 );
    filter_sizer->Add( normvol_label, 0, wxALL, 4 );
    filter_sizer->Add( normvol_slider, 0, wxALL, 4 );

    panel_sizer->Add( filter_sizer, 1, wxTOP, 2 );
    panel->SetSizerAndFit( panel_sizer );
    panel_sizer->Layout();
    panel_sizer->SetSizeHints( panel );

    /* Write down initial values */
    psz_filters = config_GetPsz( p_intf, "audio-filter" );
    if( psz_filters )
    {
        headphone_check->SetValue( strstr( psz_filters, "headphone" ) );
        normvol_check->SetValue( strstr( psz_filters, "normvol" ) );
        free( psz_filters );
    }
    else
    {
        headphone_check->SetValue( 0 );
        normvol_check->SetValue( 0 );
    }

    return panel;
}
void
scanning_for_playlists_dlg::on_progress_changed(wxCommandEvent &evt) {
  update_gauge(evt.GetInt());

  uint64_t now = get_current_time_millis();

  if ((0 == m_progress) || (now < m_next_remaining_time_update))
    return;

  int64_t total_time     = (now - m_start_time) * m_max_progress / m_progress;
  int64_t remaining_time = total_time - now + m_start_time;
  m_st_remaining_time->SetLabel(wxU(create_minutes_seconds_time_string(static_cast<unsigned int>(remaining_time / 1000))));

  m_next_remaining_time_update = now + 500;
}
示例#26
0
/**********************************************************************
 * Rebuild the playlist
 **********************************************************************/
void PlaylistManager::Rebuild( vlc_bool_t b_root )
{
    playlist_view_t *p_view;

    i_items_to_append = 0;
    i_cached_item_id = -1;

    p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );

    treectrl->DeleteAllItems();
    treectrl->AddRoot( wxU(_("root" )), -1, -1,
                       new PlaylistItem( p_view->p_root ) );

    wxTreeItemId root = treectrl->GetRootItem();
    UpdateNode( p_view->p_root, root );
}
示例#27
0
void
tab_attachments::add_attachment(const wxString &file_name) {
  mmg_attachment_cptr attch = mmg_attachment_cptr(new mmg_attachment_t);

  attch->file_name  = file_name;
  wxString name     = file_name.AfterLast(wxT(PSEP));
  wxString ext      = name.AfterLast(wxT('.'));
  name             += wxString(wxT(" (")) + file_name.BeforeLast(wxT(PSEP)) + wxT(")");
  lb_attachments->Append(name);

  if (ext.Length() > 0)
    attch->mime_type = wxU(guess_mime_type(wxMB(file_name), true));
  attch->style       = 0;
  attch->stored_name = derive_stored_name_from_file_name(attch->file_name);

  attachments.push_back(attch);
}
示例#28
0
wxString
create_track_order(bool all) {
  size_t i;
  wxString result;
  std::string temp;

  fix_format("%d:" LLD, temp);
  wxString format = wxU(temp);
  for (i = 0; i < tracks.size(); i++) {
    if (!all && (!tracks[i]->enabled || tracks[i]->appending || ('c' == tracks[i]->type) || ('t' == tracks[i]->type)))
      continue;

    if (!result.IsEmpty())
      result += wxT(",");
    result += wxString::Format(format, tracks[i]->source, tracks[i]->id);
  }

  return result;
}
示例#29
0
void
he_value_page_c::translate_ui() {
  if (!m_b_reset)
    return;

  m_b_reset->SetLabel(Z("&Reset"));

  wxString type
    = vt_ascii_string     == m_value_type ? Z("ASCII string (no special chars like\nUmlaute etc)")
    : vt_string           == m_value_type ? Z("String")
    : vt_unsigned_integer == m_value_type ? Z("Unsigned integer")
    : vt_signed_integer   == m_value_type ? Z("Signed integer")
    : vt_float            == m_value_type ? Z("Floating point number")
    : vt_binary           == m_value_type ? Z("Binary (displayed as hex numbers)")
    : vt_bool             == m_value_type ? Z("Boolean (yes/no, on/off etc)")
    :                                       Z("unknown");

  m_st_type_label->SetLabel(Z("Type:"));
  m_st_type->SetLabel(type);
  if (!m_description.get_translated().empty()) {
    m_st_description_label->SetLabel(Z("Description:"));
    m_st_description->SetLabel(wxU(m_description.get_translated()));
  }

  if (!m_element) {
    m_st_add_or_remove->SetLabel(Z("This element is not currently present in the file.\nYou can let the header editor add the element\nto the file."));
    m_st_value_label->SetLabel(Z("New value:"));
    m_cb_add_or_remove->SetLabel(Z("Add element"));

  } else {
    m_st_add_or_remove->SetLabel(Z("This element is currently present in the file.\nYou can let the header editor remove the element\nfrom the file."));
    m_st_value_label->SetLabel(Z("Current value:"));
    m_cb_add_or_remove->SetLabel(Z("Remove element"));

    const EbmlSemantic *semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId);
    if (semantic && semantic->Mandatory)
      m_st_add_or_remove->SetLabel(Z("This element is currently present in the file.\nIt cannot be removed because it is a\nmandatory header field."));
  }

  m_st_status->SetLabel(Z("Status:"));
  if (m_present)
    m_st_original_value->SetLabel(Z("Original value:"));
}
示例#30
0
ExtraWindow::ExtraWindow( intf_thread_t *_p_intf, wxWindow *p_parent,
                          wxPanel *_extra_panel ):
       wxFrame( p_parent, -1, wxU(_("Extended controls")), wxDefaultPosition,
                 wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
        fprintf(stderr,"Creating extrawindow\n");
    p_intf = _p_intf;
    SetIcon( *p_intf->p_sys->p_icon );

    wxBoxSizer *window_sizer = new wxBoxSizer( wxVERTICAL );
    SetSizer( window_sizer );
//    panel = new ExtraPanel(  p_intf, this );//_extra_panel;

    panel = _extra_panel;
    window_sizer->Add( panel );

    window_sizer->Layout();
    window_sizer->Fit( this );

    Show();
}