Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::UI::Dialogs::FileSaveDialogImpl::FileSaveDialogImpl ( char const *  dir,
FileDialogType  fileTypes,
char const *  title,
char const *  default_key 
)

Constructor

Definition at line 1212 of file filedialog.cpp.

References createFileTypeMenu(), extension, fileNameEntry, fileNameEntryChangedCallback(), fileTypeBox, fileTypeChangedCallback(), fileTypeComboBox, myFilename, svgPreview, and updatePreviewCallback().

                                                                :
                                       Gtk::FileChooserDialog(Glib::ustring(title),
                                           Gtk::FILE_CHOOSER_ACTION_SAVE)
{
    append_extension = (bool)prefs_get_int_attribute("dialogs.save_as", "append_extension", 1);

    /* One file at a time */
    set_select_multiple(false);

    /* Initalize to Autodetect */
    extension = NULL;
    /* No filename to start out with */
    myFilename = "";

    /* Set our dialog type (save, export, etc...)*/
    dialogType = fileTypes;

    /* Set the pwd and/or the filename */
    if (dir != NULL)
        set_current_folder(dir);

    //###### Add the file types menu
    //createFilterMenu();

    //###### Do we want the .xxx extension automatically added?
    fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically")));
    fileTypeCheckbox.set_active(append_extension);

    fileTypeBox.pack_start(fileTypeCheckbox);
    createFileTypeMenu();
    fileTypeComboBox.set_size_request(200,40);
    fileTypeComboBox.signal_changed().connect(
         sigc::mem_fun(*this, &FileSaveDialogImpl::fileTypeChangedCallback) );

    fileTypeBox.pack_start(fileTypeComboBox);

    set_extra_widget(fileTypeBox);
    //get_vbox()->pack_start(fileTypeBox, false, false, 0);
    //get_vbox()->reorder_child(fileTypeBox, 2);

    //###### Add a preview widget
    set_preview_widget(svgPreview);
    set_preview_widget_active(true);
    set_use_preview_label (false);

    //Catch selection-changed events, so we can adjust the text widget
    signal_update_preview().connect(
         sigc::mem_fun(*this, &FileSaveDialogImpl::updatePreviewCallback) );


    //Let's do some customization
    fileNameEntry = NULL;
    Gtk::Container *cont = get_toplevel();
    std::vector<Gtk::Entry *> entries;
    findEntryWidgets(cont, entries);
    //g_message("Found %d entry widgets\n", entries.size());
    if (entries.size() >=1 )
        {
        //Catch when user hits [return] on the text field
        fileNameEntry = entries[0];
        fileNameEntry->signal_activate().connect(
             sigc::mem_fun(*this, &FileSaveDialogImpl::fileNameEntryChangedCallback) );
        }

    //Let's do more customization
    std::vector<Gtk::Expander *> expanders;
    findExpanderWidgets(cont, expanders);
    //g_message("Found %d expander widgets\n", expanders.size());
    if (expanders.size() >=1 )
        {
        //Always show the file list
        Gtk::Expander *expander = expanders[0];
        expander->set_expanded(true);
        }


    //if (extension == NULL)
    //    checkbox.set_sensitive(FALSE);

    add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    add_button(Gtk::Stock::SAVE,   Gtk::RESPONSE_OK);

    show_all_children();
}


Generated by  Doxygen 1.6.0   Back to index