BundleConfigDialog(ProjectPtr project, wxWindow* parent, const wxArrayString& choices, IManager* manager) : wxDialog(parent, wxID_ANY, _("Mac Bundler Configuration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , m_pluginManager(manager) { m_accepted = false; m_project_name = project->GetName(); wxStaticText* titleLabel = new wxStaticText(this, wxID_ANY, _("Choose which target(s) to \"bundle-ize\"")); m_choices_widget = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices); m_info_plist_cb = new wxCheckBox(this, wxID_ANY, _("Generate Info.plist file")); m_get_info_string = new wxTextCtrl(this, wxID_ANY, m_project_name + wxT(", version 1.0, copyright myself")); m_version = new wxTextCtrl(this, wxID_ANY, wxT("1.0")); m_icon_file = new wxTextCtrl(this, wxID_ANY, m_project_name + wxT(".icns")); m_identifier = new wxTextCtrl(this, wxID_ANY, wxT("com.mycompany.") + m_project_name.Lower()); m_signature = new wxTextCtrl(this, wxID_ANY, (m_project_name + wxT("????")).Left(4).Upper()); m_icon_cb = new wxCheckBox(this, wxID_ANY, _("Copy the following icon into the project")); wxStaticText* warning = new wxStaticText(this, wxID_ANY, _("Warning : applying these changes cannot be undone automatically")); wxButton* okBtn = new wxButton(this, wxID_OK, _("Apply changes")); wxButton* cancelBtn = new wxButton(this, wxID_CANCEL, _("Cancel")); okBtn->SetDefault(); m_signature->SetMaxLength(4); m_info_plist_cb->SetValue(true); m_icon_cb->SetValue(true); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* subsizer = new wxBoxSizer(wxHORIZONTAL); wxFlexGridSizer* plistSizer = new wxFlexGridSizer(5, 2, 5, 5); plistSizer->AddGrowableCol(1, 1); plistSizer->Add(new wxStaticText(this, wxID_ANY, _("Get Info Version String")), 0, wxALIGN_RIGHT); plistSizer->Add(m_get_info_string, 1, wxEXPAND); plistSizer->Add(new wxStaticText(this, wxID_ANY, _("Version Number")), 0, wxALIGN_RIGHT); plistSizer->Add(m_version, 1, wxEXPAND); plistSizer->Add(new wxStaticText(this, wxID_ANY, _("Icon File")), 0, wxALIGN_RIGHT); plistSizer->Add(m_icon_file, 1, wxEXPAND); plistSizer->Add(new wxStaticText(this, wxID_ANY, _("Bundle Identifier")), 0, wxALIGN_RIGHT); plistSizer->Add(m_identifier, 1, wxEXPAND); plistSizer->Add(new wxStaticText(this, wxID_ANY, _("4-Character Signature")), 0, wxALIGN_RIGHT); plistSizer->Add(m_signature, 1, wxEXPAND); sizer->Add(titleLabel, 0, wxEXPAND | wxALL, 10); sizer->Add(m_choices_widget, 1, wxEXPAND | wxALL, 10); sizer->Add(m_info_plist_cb, 0, wxEXPAND | wxALL, 5); sizer->Add(plistSizer, 1, wxEXPAND | wxALL, 5); sizer->Add(m_icon_cb, 0, wxALL, 10); wxStaticBoxSizer* iconBox = new wxStaticBoxSizer(wxHORIZONTAL, this); m_icon_picker = new IconPicker(this); m_icon_picker->setImage( wxT("/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns")); iconBox->Add(m_icon_picker, 1, wxEXPAND); sizer->Add(iconBox, 0, wxALL, 10); sizer->Add(warning, 0, wxEXPAND | wxALL, 10); subsizer->AddStretchSpacer(); subsizer->Add(cancelBtn, 0, wxLEFT | wxRIGHT, 5); subsizer->Add(okBtn, 0, wxLEFT | wxRIGHT, 5); sizer->Add(subsizer, 0, wxEXPAND | wxALL, 10); okBtn->Connect( okBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BundleConfigDialog::onOk), NULL, this); cancelBtn->Connect(cancelBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BundleConfigDialog::onCancel), NULL, this); m_info_plist_cb->Connect(m_info_plist_cb->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(BundleConfigDialog::onPlistCheckboxPressed), NULL, this); this->SetSizerAndFit(sizer); this->Centre(); // Load last stored size & position from the configuration tool SetName("BundleConfigDialog"); WindowAttrManager::Load(this); }
bool App::OnInit() { // to make life simpler, use the same version number as xylib wxString version = xylib_get_version(); // reading numbers won't work with decimal points different than '.' setlocale(LC_NUMERIC, "C"); SetAppName("xyConvert"); wxCmdLineParser cmdLineParser(cmdLineDesc, argc, argv); if (cmdLineParser.Parse(false) != 0) { cmdLineParser.Usage(); return false; } if (cmdLineParser.Found(wxT("V"))) { wxMessageOutput::Get()->Printf("xyConvert, powered by xylib " + version + "\n"); return false; } wxFrame *frame = new wxFrame(NULL, wxID_ANY, "xyConvert"); //frame->SetIcon(wxICON(xyconvert)); #ifdef __WXMSW__ frame->SetIcon(wxIcon("xyconvert")); // load from a resource #else wxIconBundle ib; ib.AddIcon(wxIcon(xyconvert48_xpm)); ib.AddIcon(wxIcon(xyconvert16_xpm)); frame->SetIcons(ib); #endif wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); browser = new XyFileBrowser(frame); sizer->Add(browser, wxSizerFlags(1).Expand()); wxStaticBoxSizer *outsizer = new wxStaticBoxSizer(wxVERTICAL, frame, "TSV output"); wxBoxSizer *hsizer = new wxBoxSizer(wxHORIZONTAL); dir_cb = new wxCheckBox(frame, wxID_ANY, "directory:"); hsizer->Add(dir_cb, wxSizerFlags().Centre().Border()); dirpicker = new wxDirPickerCtrl(frame, wxID_ANY); hsizer->Add(dirpicker, wxSizerFlags(1)); hsizer->AddSpacer(10); hsizer->Add(new wxStaticText(frame, wxID_ANY, "extension:"), wxSizerFlags().Centre().Border()); ext_tc = new wxTextCtrl(frame, wxID_ANY, "xy"); ext_tc->SetMinSize(wxSize(50, -1)); hsizer->Add(ext_tc, wxSizerFlags().Centre()); hsizer->AddSpacer(10); overwrite = new wxCheckBox(frame, wxID_ANY, "allow overwrite"); hsizer->Add(overwrite, wxSizerFlags().Centre()); outsizer->Add(hsizer, wxSizerFlags().Expand()); header = new wxCheckBox(frame, wxID_ANY, "add header"); outsizer->Add(header, wxSizerFlags().Border()); sizer->Add(outsizer, wxSizerFlags().Expand().Border()); wxBoxSizer *btn_sizer = new wxBoxSizer(wxHORIZONTAL); wxButton *about = new wxButton(frame, wxID_ABOUT); wxButton *convert = new wxButton(frame, wxID_CONVERT); wxButton *close = new wxButton(frame, wxID_EXIT); btn_sizer->Add(about, wxSizerFlags().Border()); btn_sizer->AddStretchSpacer(); btn_sizer->Add(convert, wxSizerFlags().Border()); btn_sizer->Add(close, wxSizerFlags().Border()); sizer->Add(btn_sizer, wxSizerFlags().Expand().Border()); if (cmdLineParser.GetParamCount() > 0) { wxFileName fn(cmdLineParser.GetParam(0)); if (fn.FileExists()) { browser->filectrl->SetPath(fn.GetFullPath()); browser->update_file_options(); } } dirpicker->SetPath(browser->filectrl->GetDirectory()); dirpicker->Enable(false); frame->SetSizerAndFit(sizer); #ifdef __WXGTK__ frame->SetSize(-1, 550); #endif #ifdef __WXMSW__ // wxMSW bug workaround frame->SetBackgroundColour(browser->GetBackgroundColour()); #endif frame->Show(); Connect(dir_cb->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &App::OnDirCheckBox); browser->Connect(browser->filectrl->GetId(), wxEVT_FILECTRL_FOLDERCHANGED, (wxObjectEventFunction) &App::OnFolderChanged, NULL, this); Connect(about->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &App::OnAbout); Connect(convert->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &App::OnConvert); Connect(close->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &App::OnClose); return true; }