diff --git a/src/mmg/extern_data.cpp b/src/mmg/extern_data.cpp index eaa59a7d7..1fcfbd658 100644 --- a/src/mmg/extern_data.cpp +++ b/src/mmg/extern_data.cpp @@ -1734,3 +1734,250 @@ const char *mime_types[] = { "model/vnd.parasolid.transmit.binary", NULL }; + +const char *cctlds[] = { + "ac", + "ad", + "ae", + "af", + "ag", + "ai", + "al", + "am", + "an", + "ao", + "aq", + "ar", + "as", + "at", + "au", + "aw", + "az", + "ba", + "bb", + "bd", + "be", + "bf", + "bg", + "bh", + "bi", + "bj", + "bm", + "bn", + "bo", + "br", + "bs", + "bt", + "bv", + "bw", + "by", + "bz", + "ca", + "cc", + "cd", + "cf", + "cg", + "ch", + "ci", + "ck", + "cl", + "cm", + "cn", + "co", + "cr", + "cu", + "cv", + "cx", + "cy", + "cz", + "de", + "dj", + "dk", + "dm", + "do", + "dz", + "ec", + "ee", + "eg", + "eh", + "er", + "es", + "et", + "fi", + "fj", + "fk", + "fm", + "fo", + "fr", + "ga", + "gd", + "ge", + "gf", + "gg", + "gh", + "gi", + "gl", + "gm", + "gn", + "gp", + "gq", + "gr", + "gs", + "gt", + "gu", + "gw", + "gy", + "hk", + "hm", + "hn", + "hr", + "ht", + "hu", + "id", + "ie", + "il", + "im", + "in", + "io", + "iq", + "ir", + "is", + "it", + "je", + "jm", + "jo", + "jp", + "ke", + "kg", + "kh", + "ki", + "km", + "kn", + "kp", + "kr", + "kw", + "ky", + "kz", + "la", + "lb", + "lc", + "li", + "lk", + "lr", + "ls", + "lt", + "lu", + "lv", + "ly", + "ma", + "mc", + "md", + "mg", + "mh", + "mk", + "ml", + "mm", + "mn", + "mo", + "mp", + "mq", + "mr", + "ms", + "mt", + "mu", + "mv", + "mw", + "mx", + "my", + "mz", + "na", + "nc", + "ne", + "nf", + "ng", + "ni", + "nl", + "no", + "np", + "nr", + "nu", + "nz", + "om", + "pa", + "pe", + "pf", + "pg", + "ph", + "pk", + "pl", + "pm", + "pn", + "pr", + "ps", + "pt", + "pw", + "py", + "qa", + "re", + "ro", + "ru", + "rw", + "sa", + "sb", + "sc", + "sd", + "se", + "sg", + "sh", + "si", + "sj", + "sk", + "sl", + "sm", + "sn", + "so", + "sr", + "st", + "sv", + "sy", + "sz", + "tc", + "td", + "tf", + "tg", + "th", + "tj", + "tk", + "tm", + "tn", + "to", + "tp", + "tr", + "tt", + "tv", + "tw", + "tz", + "ua", + "ug", + "uk", + "um", + "us", + "uy", + "uz", + "va", + "vc", + "ve", + "vg", + "vi", + "vn", + "vu", + "wf", + "ws", + "ye", + "yt", + "yu", + "za", + "zm", + "zw", + NULL +}; diff --git a/src/mmg/extern_data.h b/src/mmg/extern_data.h index c0721e912..6f50c55b6 100644 --- a/src/mmg/extern_data.h +++ b/src/mmg/extern_data.h @@ -24,5 +24,6 @@ extern const char *sub_charsets[]; extern const char *mime_types[]; +extern const char *cctlds[]; #endif // __EXTERN_DATA_H diff --git a/src/mmg/mmg.h b/src/mmg/mmg.h index a0ae6fd26..b0ed529e6 100644 --- a/src/mmg/mmg.h +++ b/src/mmg/mmg.h @@ -111,6 +111,8 @@ using namespace libmatroska; #define ID_TC_CHAPTERCOUNTRYCODES 10066 #define ID_TC_CHAPTERSTART 10067 #define ID_TC_CHAPTEREND 10068 +#define ID_CB_CHAPTERSELECTLANGUAGECODE 10069 +#define ID_CB_CHAPTERSELECTCOUNTRYCODE 10070 #define ID_M_FILE_LOAD 20000 #define ID_M_FILE_SAVE 20001 @@ -302,6 +304,7 @@ public: wxTextCtrl *tc_chapter_name, *tc_language_codes, *tc_country_codes; wxTextCtrl *tc_start_time, *tc_end_time; + wxComboBox *cob_add_language_code, *cob_add_country_code; wxTimer value_copy_timer; @@ -322,9 +325,13 @@ public: void on_remove_chapter(wxCommandEvent &evt); void on_copy_values(wxTimerEvent &evt); void on_entry_selected(wxTreeEvent &evt); + void on_language_code_selected(wxCommandEvent &evt); + void on_country_code_selected(wxCommandEvent &evt); void add_recursively(wxTreeItemId &parent, EbmlMaster &master); wxString create_chapter_label(KaxChapterAtom &chapter); + + void enable_inputs(bool enable); }; class mux_dialog: public wxDialog { diff --git a/src/mmg/tab_chapters.cpp b/src/mmg/tab_chapters.cpp index 7c61e9e8f..b6be2a1a3 100644 --- a/src/mmg/tab_chapters.cpp +++ b/src/mmg/tab_chapters.cpp @@ -66,10 +66,12 @@ void expand_subtree(wxTreeCtrl &tree, wxTreeItemId &root, bool expand = true) { #define Y1 30 #define X1 140 +#define X2 370 #define XS 360 tab_chapters::tab_chapters(wxWindow *parent, wxMenu *nm_chapters): wxPanel(parent, -1, wxDefaultPosition, wxSize(100, 400), wxTAB_TRAVERSAL) { + uint32_t i; m_chapters = nm_chapters; @@ -108,12 +110,28 @@ tab_chapters::tab_chapters(wxWindow *parent, wxMenu *nm_chapters): tc_language_codes = new wxTextCtrl(this, ID_TC_CHAPTERLANGUAGES, _(""), wxPoint(X1, 285 + 3 * Y1 + YOFF), wxSize(XS - X1, -1)); + cob_add_language_code = + new wxComboBox(this, ID_CB_CHAPTERSELECTLANGUAGECODE, _(""), + wxPoint(X2, 285 + 3 * Y1 + YOFF), wxSize(120, -1), + 0, NULL); + for (i = 0; i < sorted_iso_codes.Count(); i++) + cob_add_language_code->Append(sorted_iso_codes[i]); + cob_add_language_code->SetValue(_("")); new wxStaticText(this, wxID_STATIC, _("Country codes:"), wxPoint(10, 285 + 4 * Y1)); tc_country_codes = new wxTextCtrl(this, ID_TC_CHAPTERCOUNTRYCODES, _(""), wxPoint(X1, 285 + 4 * Y1 + YOFF), wxSize(XS - X1, -1)); + cob_add_country_code = + new wxComboBox(this, ID_CB_CHAPTERSELECTCOUNTRYCODE, _(""), + wxPoint(X2, 285 + 4 * Y1 + YOFF), wxSize(120, -1), + 0, NULL); + for (i = 0; cctlds[i] != NULL; i++) + cob_add_country_code->Append(_(cctlds[i])); + cob_add_country_code->SetValue(_("")); + + enable_inputs(false); m_chapters->Enable(ID_M_CHAPTERS_SAVE, false); m_chapters->Enable(ID_M_CHAPTERS_SAVEAS, false); @@ -133,6 +151,16 @@ tab_chapters::~tab_chapters() { delete chapters; } +void tab_chapters::enable_inputs(bool enable) { + tc_chapter_name->Enable(enable); + tc_start_time->Enable(enable); + tc_end_time->Enable(enable); + tc_language_codes->Enable(enable); + tc_country_codes->Enable(enable); + cob_add_language_code->Enable(enable); + cob_add_country_code->Enable(enable); +} + void tab_chapters::on_new_chapters(wxCommandEvent &evt) { file_name = ""; if (chapters != NULL) @@ -147,6 +175,8 @@ void tab_chapters::on_new_chapters(wxCommandEvent &evt) { b_add_chapter->Enable(true); b_remove_chapter->Enable(true); + enable_inputs(false); + mdlg->set_status_bar("New chapters created."); } @@ -270,6 +300,8 @@ void tab_chapters::on_load_chapters(wxCommandEvent &evt) { tid_root = tc_chapters->AddRoot(file_name); add_recursively(tid_root, *chapters); expand_subtree(*tc_chapters, tid_root); + + enable_inputs(false); mdlg->set_status_bar("Chapters loaded."); } @@ -313,9 +345,12 @@ void tab_chapters::on_entry_selected(wxTreeEvent &evt) { tc_end_time->SetValue(""); tc_language_codes->SetValue(""); tc_country_codes->SetValue(""); + enable_inputs(false); return; } + enable_inputs(true); + label = "(unnamed chapter)"; languages = ""; countries = ""; @@ -369,10 +404,22 @@ void tab_chapters::on_entry_selected(wxTreeEvent &evt) { tc_end_time->SetValue(""); } +void tab_chapters::on_language_code_selected(wxCommandEvent &evt) { + + +} + +void tab_chapters::on_country_code_selected(wxCommandEvent &evt) { +} + IMPLEMENT_CLASS(tab_chapters, wxPanel); BEGIN_EVENT_TABLE(tab_chapters, wxPanel) EVT_BUTTON(ID_B_ADDCHAPTER, tab_chapters::on_add_chapter) EVT_BUTTON(ID_B_REMOVECHAPTER, tab_chapters::on_remove_chapter) EVT_TIMER(ID_T_CHAPTERVALUES, tab_chapters::on_copy_values) EVT_TREE_SEL_CHANGED(ID_TRC_CHAPTERS, tab_chapters::on_entry_selected) + EVT_COMBOBOX(ID_CB_CHAPTERSELECTLANGUAGECODE, + tab_chapters::on_language_code_selected) + EVT_COMBOBOX(ID_CB_CHAPTERSELECTCOUNTRYCODE, + tab_chapters::on_country_code_selected) END_EVENT_TABLE();