示例#1
0
 void outputFileChooserDialogOKButtonClicked()
 {
     Gtk::Label* outputFileDisplayLabel;
     builder->get_widget("outputFileDisplayLabel", outputFileDisplayLabel);
     outputFilePath = outputFileChooserDialog->get_filename();
     outputFileChooserDialog->hide();
     outputFileDisplayLabel->set_text(outputFilePath);
 }
示例#2
0
void Forest::importFile()
{
    Gtk::FileChooserDialog * fc = new Gtk::FileChooserDialog("Import Cal3d File");
    // fc->set_transient_for(*this);

    fc->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    fc->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);


    Gtk::FileFilter filter_cfg;
    filter_cfg.set_name("Cal3d Model files");
    filter_cfg.add_pattern("*.cfg");
    filter_cfg.add_pattern("*.cal");
    fc->add_filter(filter_cfg);

    Gtk::FileFilter filter_component;
    filter_component.set_name("Cal3d Component files");
    filter_component.add_pattern("*.caf");
    filter_component.add_pattern("*.cmf");
    filter_component.add_pattern("*.cmf");
    fc->add_filter(filter_component);

    fc->signal_response().connect(sigc::bind<Gtk::FileChooserDialog*>(sigc::mem_fun(*this, &Forest::import_response), fc));
    fc->show_all();
}
示例#3
0
    GUI(Glib::RefPtr<Gtk::Application> _app, SimulationRunner &_runner) : app(_app), runner(_runner)
    {
        builder = Gtk::Builder::create_from_file("gui.glade");
        builder->get_widget("mainWindow", mainWindow);

        Gtk::Button* closeButton;
        builder->get_widget("closeButton", closeButton);
        closeButton->signal_clicked().connect(
            sigc::mem_fun(this, &GUI::stopSimulationRequested));
        mainWindow->signal_hide().connect(
            sigc::mem_fun(this, &GUI::quitCallback));

        builder->get_widget("inputFile", inputFileChooserButton);
        inputFileChooserButton->signal_selection_changed().connect(
            sigc::mem_fun(this, &GUI::inputFileChanged));
        builder->get_widget("impulseFile", impulseResponseFileChooserButton);
        impulseResponseFileChooserButton->signal_selection_changed().connect(
            sigc::mem_fun(this, &GUI::impulseResponseFileChanged));

        Gtk::Button* outputFileButton;
        builder->get_widget("outputFileButton", outputFileButton);
        builder->get_widget(
            "outputFileChooserDialog", outputFileChooserDialog);
        outputFileButton->signal_clicked().connect(
            sigc::mem_fun(
                outputFileChooserDialog, &Gtk::FileChooserDialog::show));

        Gtk::Button* outputFileChooserDialogCloseButton;
        builder->get_widget(
            "outputFileChooserDialogCloseButton",
            outputFileChooserDialogCloseButton);
        outputFileChooserDialogCloseButton->signal_clicked().connect(
            sigc::mem_fun(
                outputFileChooserDialog, &Gtk::FileChooserDialog::hide));

        Gtk::Button* outputFileChooserDialogOKButton;
        builder->get_widget(
            "outputFileChooserDialogOKButton",
            outputFileChooserDialogOKButton);
        outputFileChooserDialogOKButton->signal_clicked().connect(
            sigc::mem_fun(
                this, &GUI::outputFileChooserDialogOKButtonClicked));
        outputFileChooserDialog->signal_file_activated().connect(
            sigc::mem_fun(
                this, &GUI::outputFileChooserDialogOKButtonClicked));

        Gtk::Button* runButton;
        builder->get_widget("runButton", runButton);
        runButton->signal_clicked().connect(
            sigc::mem_fun(this, &GUI::runButtonClicked));

        app->run(*mainWindow);
    }
示例#4
0
文件: jackfft.C 项目: cppsp/workspace
void loadfile()
{
	Gtk::FileChooserDialog* d;
	b->get_widget("filechooserdialog1", d);
	Gtk::Window* w;
	b->get_widget("window1", w);
	d->set_transient_for(*w);
	d->set_action(FILE_CHOOSER_ACTION_OPEN);
	Gtk::Button* b = d->add_button(Stock::OPEN, RESPONSE_OK);
	if(d->run() == RESPONSE_OK)
	{
		GIOGenericStream s = Glib::RefPtr<Gio::InputStream>::cast_dynamic(d->get_file()->read());
		do_load(s);
		s.Close();
		fname = d->get_filename();
		if(fname.length() <= 0)
		{
			WARN(1, "current file name could not be updated because the file path is not obtainable(not a local file?)");
		}
	}
	d->hide();
	b->get_parent()->Gtk::Container::remove(*b);
	delete b;
}
示例#5
0
void Window::vCreateFileOpenDialog()
{
    if (m_poFileOpenDialog != NULL) {
        return;
    }

    std::string sGBDir = m_poDirConfig->sGetKey("gb_roms");
    std::string sGBADir = m_poDirConfig->sGetKey("gba_roms");

    Gtk::FileChooserDialog* poDialog = new Gtk::FileChooserDialog(*this, _("Open"));
    poDialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    poDialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);

    try {
        if (sGBDir != "") {
            poDialog->add_shortcut_folder(sGBDir);
            poDialog->set_current_folder(sGBDir);
        }

        if (sGBADir != "" && sGBADir != sGBDir) {
            poDialog->add_shortcut_folder(sGBADir);
            poDialog->set_current_folder(sGBADir);
        }
    } catch (const Gtk::FileChooserError& e) {
        // Most likely the shortcut already exists, so do nothing
    }

    const char* acsPattern[] = {
        // GBA
        "*.[bB][iI][nN]", "*.[aA][gG][bB]", "*.[gG][bB][aA]",
        // GB
        "*.[gG][bB]", "*.[sS][gG][bB]", "*.[cC][gG][bB]", "*.[gG][bB][cC]",
        // Both
        "*.[mM][bB]", "*.[eE][lL][fF]", "*.[zZ][iI][pP]", "*.[zZ]", "*.[gG][zZ]",
        "*.7[zZ]",
    };

#if !GTK_CHECK_VERSION(3, 0, 0)
    Gtk::FileFilter oAllGBAFilter;
    oAllGBAFilter.set_name(_("All Gameboy Advance files"));
    for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) {
        oAllGBAFilter.add_pattern(acsPattern[i]);
    }

    Gtk::FileFilter oGBAFilter;
    oGBAFilter.set_name(_("Gameboy Advance files"));
    for (int i = 0; i < 3; i++) {
        oGBAFilter.add_pattern(acsPattern[i]);
    }

    Gtk::FileFilter oGBFilter;
    oGBFilter.set_name(_("Gameboy files"));
    for (int i = 3; i < 7; i++) {
        oGBFilter.add_pattern(acsPattern[i]);
    }
#else
    const Glib::RefPtr<Gtk::FileFilter> oAllGBAFilter = Gtk::FileFilter::create();
    oAllGBAFilter->set_name(_("All Gameboy Advance files"));
    for (guint i = 0; i < G_N_ELEMENTS(acsPattern); i++) {
        oAllGBAFilter->add_pattern(acsPattern[i]);
    }

    const Glib::RefPtr<Gtk::FileFilter> oGBAFilter = Gtk::FileFilter::create();
    oGBAFilter->set_name(_("Gameboy Advance files"));
    for (int i = 0; i < 3; i++) {
        oGBAFilter->add_pattern(acsPattern[i]);
    }

    const Glib::RefPtr<Gtk::FileFilter> oGBFilter = Gtk::FileFilter::create();
    oGBFilter->set_name(_("Gameboy files"));
    for (int i = 3; i < 7; i++) {
        oGBFilter->add_pattern(acsPattern[i]);
    }
#endif

    poDialog->add_filter(oAllGBAFilter);
    poDialog->add_filter(oGBAFilter);
    poDialog->add_filter(oGBFilter);

    m_poFileOpenDialog = poDialog;
}