///////////
// Extract
void DialogAttachments::OnExtract(wxCommandEvent &event) {
	// Check if there's a selection
	int i = listView->GetFirstSelected();

	// Get path
	if (i != -1) {
		wxString path;
		bool fullPath = false;

		// Multiple or single?
		if (listView->GetNextSelected(i) != -1) path = wxDirSelector(_("Select the path to save the files to:"),Options.AsText(_T("Fonts Collector Destination"))) + _T("/");
		else {
			// Default path
			wxString defPath = ((AssAttachment*) listView->GetItemData(i))->GetFileName();
			path = wxFileSelector(_("Select the path to save the file to:"),Options.AsText(_T("Fonts Collector Destination")),defPath);
			fullPath = true;
		}
		if (path.IsEmpty()) return;

		// Loop through items in list
		while (i != -1) {
			AssAttachment *attach = (AssAttachment*) listView->GetItemData(i);
			wxString filename = path;
			if (!fullPath) filename += attach->GetFileName();
			attach->Extract(filename);
			i = listView->GetNextSelected(i);
		}
	}
}
Beispiel #2
0
void wxPicToolFrame::OnbtnOutputClick(wxCommandEvent& event)
{
    wxString fn = wxDirSelector();
    if (!fn.size())
        return;
    txtOutput->SetValue(fn);
}
Beispiel #3
0
/*
 * call-seq:
 *   dir_dialog([parent], [options]) -> String
 *
 * shows an DirDialog.
 * ===Arguments
 * * parent of this window or nil
 *
 * *options: Hash with possible options to set:
 *   * path String default path
 *   * message String
 *   * style Integer
 *   * pos WX::Point

 *   * must_exist Style Flag does set MUST_EXIST
 *   * change_dir Style Flag does set CHANGE_DIR
 * ===Return value
 * selected path
*/
DLL_LOCAL VALUE _getUserDir(int argc,VALUE *argv,VALUE self)
{
	VALUE parent,hash;
	rb_scan_args(argc, argv, "01:",&parent,&hash);

	app_protected();

	wxString message(wxDirSelectorPromptStr);
	wxString defaultPath(wxEmptyString);
	int style(wxDD_DEFAULT_STYLE);
	wxPoint pos(wxDefaultPosition);

	if(rb_obj_is_kind_of(hash,rb_cHash))
	{
		set_default_values(hash,message,defaultPath,style);

		set_hash_option(hash,"pos",pos);

		set_style_flags(hash,style);

	}

	return wrap(wxDirSelector(message,
			defaultPath,style,pos,
			unwrap<wxWindow*>(parent)));
}
Beispiel #4
0
  virtual void openDir( wxCommandEvent& event )
  {
    wxString dir = wxDirSelector( wxT("Choose a folder") );

    if (!dir.empty())
      logDir->SetValue(dir);
  }
void NewWorkspaceDlg::OnWorkspaceDirPicker( wxCommandEvent& event )
{
    const wxString& dir = wxDirSelector(wxT("Choose a folder:"));
    if ( !dir.empty() ) {
        m_textCtrlWorkspacePath->SetValue( dir );
    }
}
void ReconcileProjectFiletypesDlg::OnIgnoreBrowse(wxCommandEvent& WXUNUSED(event))
{
    ProjectPtr proj = ManagerST::Get()->GetProject(m_projname);
    wxCHECK_RET(proj, "Can't find a Project with the supplied name");

    wxString topleveldir, types;
    wxArrayString ignorefiles, excludes, regexes;
    proj->GetReconciliationData(topleveldir, types, ignorefiles, excludes, regexes);

    if (topleveldir.empty()) {
        topleveldir = proj->GetFileName().GetPath();
    }
    
    wxFileName tld(topleveldir);
    if ( tld.IsRelative() ) {
        tld.MakeAbsolute( proj->GetFileName().GetPath() );
    }
    wxString new_exclude = wxDirSelector(_("Select a directory to ignore:"), tld.GetFullPath(), wxDD_DEFAULT_STYLE, wxDefaultPosition, this);

    if (!new_exclude.empty()) {
        wxFileName fn = wxFileName::DirName(new_exclude);
        fn.MakeRelativeTo(topleveldir);
        new_exclude = fn.GetFullPath();

        if (m_listExclude->FindString(new_exclude) == wxNOT_FOUND) {
            m_listExclude->Append(new_exclude);
        }
    }
}
void PSCustomBuildPage::OnBrowseCustomBuildWD(wxCommandEvent& event)
{
    DirSaver ds;

    // Since all paths are relative to the project, set the working directory to the
    // current project path
    ProjectPtr p = ManagerST::Get()->GetProject(m_projectName);
    if(p) {
        wxSetWorkingDirectory(p->GetFileName().GetPath());
    }

    wxFileName fn(m_textCtrlCustomBuildWD->GetValue());
    wxString initPath(wxEmptyString);

    if(fn.DirExists()) {
        fn.MakeAbsolute();
        initPath = fn.GetFullPath();
    }

    wxString new_path =
        wxDirSelector(_("Select working directory:"), initPath, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
    if(new_path.IsEmpty() == false) {
        m_textCtrlCustomBuildWD->SetValue(new_path);
    }
}
Beispiel #8
0
void DialogAttachments::OnExtract(wxCommandEvent &) {
	int i = listView->GetFirstSelected();
	if (i == -1) return;

	wxString path;
	bool fullPath = false;

	// Multiple or single?
	if (listView->GetNextSelected(i) != -1)
		path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
	else {
		// Default path
		wxString defPath = ((AssAttachment*)wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
		path = wxFileSelector(
			_("Select the path to save the file to:"),
			lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()),
			defPath,
			".ttf",
			"Font Files (*.ttf)|*.ttf",
			wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
			this);
		fullPath = true;
	}
	if (!path) return;

	// Loop through items in list
	while (i != -1) {
		AssAttachment *attach = (AssAttachment*)wxUIntToPtr(listView->GetItemData(i));
		attach->Extract(fullPath ? path : path + attach->GetFileName());
		i = listView->GetNextSelected(i);
	}
}
void DialogAttachments::OnExtract(wxCommandEvent &) {
	int i = listView->GetFirstSelected();
	if (i == -1) return;

	agi::fs::path path;
	bool fullPath = false;

	// Multiple or single?
	if (listView->GetNextSelected(i) != -1)
		path = wxDirSelector(_("Select the path to save the files to:"), to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())).c_str();
	else {
		path = SaveFileSelector(
			_("Select the path to save the file to:"),
			"Path/Fonts Collector Destination",
			ass->Attachments[i].GetFileName(),
			".ttf", "Font Files (*.ttf)|*.ttf",
			this);
		fullPath = true;
	}
	if (path.empty()) return;

	// Loop through items in list
	while (i != -1) {
		auto& attach = ass->Attachments[i];
		attach.Extract(fullPath ? path : path/attach.GetFileName());
		i = listView->GetNextSelected(i);
	}
}
Beispiel #10
0
void PCS_Preferences::onBrowse(wxCommandEvent &event){
	wxString dir = wxDirSelector(_("Select New Texture Path"), tpath->GetValue());
	if(!dir.empty()){
		texture_paths->Append(dir);
		texture_paths->SetSelection(texture_paths->GetCount()-1);
		tpath->ChangeValue(dir);
	}
}
Beispiel #11
0
void MainFrame::OnSaveDirectory(wxCommandEvent &event)
{
	//string dataSaveDirectory = "";
	wxString dir = wxDirSelector(wxT("Select the Data Save Directory"),wxString(humanoidCtrl->dataSaveDirectory.c_str(),wxConvUTF8));   // logger->dataSaveDirectory
	dir += wxT("/");
	humanoidCtrl->dataSaveDirectory = dir.mb_str();		// logger->dataSaveDirectory
	cout << "Data Directory Changed to " << humanoidCtrl->dataSaveDirectory << endl;	// logger->dataSaveDirectory
}
void SvnCheckoutDialog::OnBrowseDirectory( wxCommandEvent& event )
{
	wxUnusedVar(event);
	wxString new_path = wxDirSelector(wxT(""), wxT(""), wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
	if (new_path.IsEmpty() == false) {
		m_textCtrl20->SetValue(new_path);
	}
}
Beispiel #13
0
bool HearthLogApp::OnInit()
{
	// Build the path for a log file
	auto file = Helper::GetUserDataDir();
	file.SetFullName("log.txt");

	// Create the containing directory if needed
	if (!file.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) {
		wxLogError("error creating save directory: %s", file.GetPath());
		return false;
	}

	// Open a file for logging
	fout.open(file.GetFullPath().c_str().AsChar(), std::ofstream::out);

	// Setup the log file
	auto logFile = new wxLogStream(&fout);
	wxLog::SetActiveTarget(logFile);

	// Wrap the log file with a GUI window
	auto logWindow = new wxLogWindow(NULL, _("Log"), false, true);
	logWindow->GetFrame()->SetSize(1024, 300);
	wxLog::SetActiveTarget(logWindow);

	// Start logging
	wxLog::SetVerbose();
	wxLogMessage(_("Hearth Log %s"), Helper::AppVersion());

	// Setup config from file
	wxConfig::Set(new wxFileConfig("", "", "config.ini", "", wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_SUBDIR));

	// Locate the Hearthstone directory
	while (!Helper::GetHearthstoneVersion()) {
		auto dir = wxDirSelector(_("Hearth Log: Please locate your Hearthstone directory (Usually C:\\Program Files (x86)\\Hearthstone)"));
		if (dir.empty()) {
			return false;
		}
		Helper::WriteConfig("HearthstoneDir", dir);
	}

	// Create the GUI bits
	icon = new TaskBarIcon();

	// Setup a packet parsing stack
	PacketCapture::Start("tcp port 3724 or tcp port 1119", 
	//PacketCapture::Start("tcp port 1119", "C:\\Users\\Chip\\Documents\\Network Monitor 3\\Captures\\Hearthstone2.pcap", 
		[]() -> PacketCapture::Callback::Ptr {
			return std::make_unique<tcp::Parser>(
				[](int64_t nanotime, tcp::Stream *stream) -> tcp::Parser::Callback::Ptr {
					return std::make_unique<GameLogger>(nanotime, stream);
				});
		});

	// Try to upload any logs that haven't been uploaded yet
	icon->UploadAll();

	return true;
}
void avVersionEditorDlg::OnSvnDirectoryClick(wxCommandEvent&)
{
    wxString dir = wxDirSelector(wxDirSelectorPromptStr, m_svnDirectory, 0, wxDefaultPosition, this);
    if (!dir.IsEmpty())
    {
        txtSvnDir->SetValue(dir);
        m_svnDirectory = txtSvnDir->GetValue();
    }
}
Beispiel #15
0
void NewToolDlg::OnButtonBrowseWD( wxCommandEvent& event )
{
	wxUnusedVar(event);
	wxString path(m_textCtrlWd->GetValue());
	wxString new_path = wxDirSelector(wxT("Select working directory:"), path, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
	if(new_path.IsEmpty() == false){
		m_textCtrlWd->SetValue(new_path);
	}
}
Beispiel #16
0
void SessionAdmin::OnPREFERENCESClick( wxCommandEvent& )
{
    const wxString& dir = wxDirSelector(_("Choose new NX session directory."),
            m_NxDirectory, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
    if (!dir.IsEmpty()) {
        m_NxDirectory = dir;
        m_sessions->SetDir(dir);
    }
}
void PreferencesDialog::OnButton(wxCommandEvent& event)
{
    switch (event.GetId()) {

        case ID_B_DONE: {
            wxCloseEvent fake;
            OnCloseWindow(fake); // handle on-exit stuff there
            break;
        }
        case ID_B_CANCEL:
            EndModal(wxCANCEL);
            break;

        // quality page stuff
        case ID_B_Q_LOW:
            iWormSegments->SetInteger(2);
            iWormSides->SetInteger(4);
            iBondSides->SetInteger(4);
            iHelixSides->SetInteger(8);
            iAtomSlices->SetInteger(5);
            iAtomStacks->SetInteger(3);
            break;
        case ID_B_Q_MED:
            iWormSegments->SetInteger(6);
            iWormSides->SetInteger(6);
            iBondSides->SetInteger(6);
            iHelixSides->SetInteger(12);
            iAtomSlices->SetInteger(10);
            iAtomStacks->SetInteger(8);
            break;
        case ID_B_Q_HIGH:
            iWormSegments->SetInteger(10);
            iWormSides->SetInteger(20);
            iBondSides->SetInteger(16);
            iHelixSides->SetInteger(30);
            iAtomSlices->SetInteger(20);
            iAtomStacks->SetInteger(14);
            break;

        // cache page stuff
        case ID_B_CACHE_BROWSE: {
            DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(tCache, ID_T_CACHE_FOLDER, wxTextCtrl)
            wxString path;
            path = wxDirSelector("Select a cache folder:", tCache->GetValue());
            if (path.size() > 0 && wxDirExists(path.c_str()))
                tCache->SetValue(path);
            break;
        }
        case ID_B_CACHE_CLEAR:
            TruncateCache(0);
            break;

        default:
            event.Skip();
    }
}
void SubversionView::OnChangeRootDir( wxCommandEvent& event )
{
	wxUnusedVar(event);
	wxString path(m_textCtrlRootDir->GetValue());
	wxString new_path = wxDirSelector(wxT(""), path, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
	if (new_path.IsEmpty() == false) {
		m_textCtrlRootDir->SetValue(new_path);
		BuildTree();
	}
}
Beispiel #19
0
void DlgSelectFolder::OnButtonSelectFolder(wxCommandEvent& event)
{
	//wxString dir
	m_strDir = wxDirSelector("Choose a folder", m_strDir);
	if ( !m_strDir.empty() ){
		m_textCtrlFolder->SetValue(m_strDir);
	}


}
Beispiel #20
0
void ImportDlg::OnBrowseForOutputFolder(wxCommandEvent& event)
{
    wxString curtext = m_textName->GetValue();
    wxFileName fn(curtext);
    wxString dir = wxDirSelector();
    if(dir.IsEmpty()) return;

    wxFileName newpath(dir, fn.GetFullName());
    m_textName->ChangeValue(newpath.GetFullPath());
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnBrowseButtonClick( wxCommandEvent& aEvent )
{
    wxString path = getDownloadDir();

    path = wxDirSelector( _("Choose a folder to save the downloaded libraries" ),
                             path, 0, wxDefaultPosition, this );

    if( !path.IsEmpty() && wxDirExists( path ) )
    {
        setDownloadDir( path );
        updateGithubControls();
    }
}
Beispiel #22
0
void NewClassDlg::OnBrowseFolder(wxCommandEvent& e)
{
    wxUnusedVar(e);
    wxString initPath;
    if(wxFileName::DirExists(m_textCtrlGenFilePath->GetValue())) {
        initPath = m_textCtrlGenFilePath->GetValue();
    }
    wxString new_path =
        wxDirSelector(_("Select Generated Files Path:"), initPath, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
    if(new_path.IsEmpty() == false) {
        m_textCtrlGenFilePath->ChangeValue(new_path);
    }
}
Beispiel #23
0
void OpenMovieWizard::DirDialogPage::onButton(wxCommandEvent&)
{
   const auto& dir = wxDirSelector(wxEmptyString, comboBox->GetValue(), // read the combo box for the default path
      wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST, // the second style removes the button to create a new directory
      wxDefaultPosition, this); // pass this as the parent

   if (!dir.empty()) // did the user select a directory?
   {
      if (comboBox->FindString(dir) == wxNOT_FOUND) {
         comboBox->Append(dir);
      }
      comboBox->SetValue(dir);
   }
}
Beispiel #24
0
	virtual void OnGridEditorShown( wxGridEvent& event ) 
	{
		int row, col;
		row = event.GetRow(); // 行?
		col = event.GetCol(); // 列?
		if (col==1) {
			const wxString& dir = wxDirSelector("Choose a folder");
			if ( !dir.empty() ) {
				wxFileName f(dir);
				m_grid_dir->SetCellValue(row, col, dir);
				m_grid_dir->SetCellValue(row, 0, "Import." + f.GetName());
			}
		}
	}
void TemplateClassDlg::OnBrowseFilePath( wxCommandEvent& event )
{
	wxUnusedVar( event );
	wxString dir = wxT("");
	if ( wxFileName::DirExists( m_projectPath ) ) {
		dir = m_projectPath;
	}

	dir = wxDirSelector( _("Select output folder"), dir, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
	if ( !dir.IsEmpty() ) {
		m_projectPath = dir;
		m_textCtrlFilePath->SetValue(m_projectPath);
	}
}
void PHPProjectSettingsDlg::OnAddCCPath(wxCommandEvent& event)
{
    wxString path = wxDirSelector();
    if(path.IsEmpty() == false) {
        wxString currentValue = m_textCtrlCCIncludePath->GetValue();
        currentValue.Trim().Trim(false);

        if(currentValue.IsEmpty() == false) {
            currentValue << wxT("\n") << path;
        } else {
            currentValue << path;
        }
        m_textCtrlCCIncludePath->ChangeValue(currentValue);
    }
}
Beispiel #27
0
void SpringOptionsTab::OnDataDir(wxCommandEvent& /*unused*/)
{
	int result = wxMessageBox(_("Do you want to change spring's datadir location? (select yes only if you know what you're doing)"), _("Data dir wizard"), wxICON_QUESTION | wxYES_NO | wxCANCEL, &ui().mw());

	if (result != wxYES) {
		return;
	}

	const wxString dir = wxDirSelector(_("Choose a folder"), TowxString(SlPaths::GetDataDir()));
	const bool res = SlPaths::CreateSpringDataDir(STD_STRING(dir));
	if (!res) {
		wxMessageBox(wxString::Format(_("Something went wrong when creating the directory: %s"), dir.c_str()));
		return;
	}
}
Beispiel #28
0
void QuickDebugDlg::OnButtonBrowseWD(wxCommandEvent& event)
{
    wxUnusedVar(event);

    wxString ans, path(GetWorkingDirectory());
    if(!wxFileName::DirExists(path)) {
        path = wxGetCwd();
    }

    ans = wxDirSelector(_("Select working directory:"), path);
    if(!ans.empty()) {
        m_WD->Insert(ans, 0);
        m_WD->SetSelection(0);
    }
}
void WIZARD_FPLIB_TABLE::OnBrowseButtonClick( wxCommandEvent& aEvent )
{
    wxString path = getDownloadDir();

    path = wxDirSelector( _("Choose a folder to save the downloaded libraries" ),
                          path, 0, wxDefaultPosition, this );

    if( !path.IsEmpty() && wxDirExists( path ) )
    {
        setDownloadDir( path );

        wxConfigBase* cfg = Pgm().CommonSettings();
        cfg->Write( KICAD_FPLIBS_LAST_DOWNLOAD_DIR, path );

        updateGithubControls();
    }
}
Beispiel #30
0
void TagsOptionsDlg::OnAddExcludePath(wxCommandEvent& event)
{
    wxUnusedVar(event);
    wxString new_path =
        wxDirSelector(_("Add ctags Parser Exclude Path:"), wxT(""), wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
    if(new_path.IsEmpty() == false) {
        wxString currPathsStr = m_textCtrlCtagsExcludePaths->GetValue();
        wxArrayString currPaths = wxStringTokenize(currPathsStr, wxT("\n\r"), wxTOKEN_STRTOK);
        if(currPaths.Index(new_path) == wxNOT_FOUND) {
            currPathsStr.Trim().Trim(false);
            if(currPathsStr.IsEmpty() == false) {
                currPathsStr << wxT("\n");
            }
            currPathsStr << new_path;
            m_textCtrlCtagsExcludePaths->ChangeValue(currPathsStr);
        }
    }
}