示例#1
0
文件: frame.cpp 项目: jeeb/mkvtoolnix
void
header_editor_frame_c::on_file_reload(wxCommandEvent &) {
  if (   have_been_modified()
      && (wxYES != wxMessageBox(Z("Some header values have been modified. Do you really want to reload without saving the file?"), Z("Headers modified"), wxYES_NO | wxICON_QUESTION, this)))
    return;

  open_file(m_file_name);
}
示例#2
0
文件: frame.cpp 项目: jeeb/mkvtoolnix
bool
header_editor_frame_c::on_drop_files(wxCoord,
                                     wxCoord,
                                     const wxArrayString &dropped_files) {
  if (   have_been_modified()
      && (wxYES != wxMessageBox(Z("Some header values have been modified. Do you really want to load a new file without saving the current one?"), Z("Headers modified"), wxYES_NO | wxICON_QUESTION, this)))
    return false;

  open_file(wxFileName(dropped_files[0]));

  return true;
}
示例#3
0
文件: frame.cpp 项目: jeeb/mkvtoolnix
void
header_editor_frame_c::on_file_close(wxCommandEvent &) {
  if (   have_been_modified()
      && (wxYES != wxMessageBox(Z("Some header values have been modified. Do you really want to close without saving the file?"), Z("Headers modified"), wxYES_NO | wxICON_QUESTION, this)))
    return;

  clear_pages();

  m_analyzer.reset();

  m_file_name.Clear();

  enable_menu_entries();
}
示例#4
0
void
header_editor_frame_c::on_file_save(wxCommandEvent &) {
    wxDateTime curr_mtime;
    m_file_name.GetTimes(NULL, &curr_mtime, NULL);

    if (curr_mtime != m_file_mtime) {
        wxMessageBox(Z("The file has been changed by another program since it was read by the header editor. Therefore you have to re-load it. "
                       "Unfortunately this means that all of your changes will be lost."), Z("File modified"), wxOK | wxICON_ERROR, this);
        return;
    }

    if (!have_been_modified()) {
        wxMessageBox(Z("None of the header fields has been modified. Nothing has been saved."), Z("No fields modified"), wxOK | wxICON_INFORMATION, this);
        return;
    }

    wxTreeItemId page_id = validate_pages();

    if (page_id.IsOk()) {
        m_tc_tree->SelectItem(page_id);
        wxMessageBox(Z("There were errors in the header values preventing the headers from being saved. The first error has been selected."), Z("Header validation"), wxOK | wxICON_ERROR, this);
        return;
    }

    do_modifications();

    size_t i;
    bool tracks_written = false;
    for (i = 0; m_top_level_pages.size() > i; ++i) {
        if (m_top_level_pages[i]->has_been_modified()) {
            if (m_top_level_pages[i]->m_l1_element->Generic().GlobalId == KaxTracks::ClassInfos.GlobalId) {
                if (tracks_written)
                    continue;
                tracks_written = true;
            }

            kax_analyzer_c::update_element_result_e result = m_analyzer->update_element(m_top_level_pages[i]->m_l1_element, true);
            if (kax_analyzer_c::uer_success != result)
                display_update_element_result(result);
        }
    }

    open_file(m_file_name);
}