コード例 #1
0
std::string genericFilechooserWindow::getPathToFolder
(
	void
)
{
	return get_current_folder();
}
コード例 #2
0
ファイル: folder.c プロジェクト: go2ev-devteam/GPCV
int cam_get_new_file_name(void* handle, char* filename, char* ext, int idx)
{
	folderInfo_t* fi = (folderInfo_t*)handle;
	int ret;
	char folder[256];
	
	if (fi->name_format == 1)
	{
		ret = get_current_folder2(fi, folder);

		if (0 > ret)
			return -1;
			
		get_time_file_name(filename, folder, fi->postfix, ext);
		
		return 0;
	}
	else
	{
		ret = get_current_folder(fi, folder);

		if (0 > ret)
			return -1;
	
		if (ret)
			idx = ret;
		
		get_index_file_name(filename, idx, folder, ext);
		
		return idx;
	}
}
コード例 #3
0
ファイル: filechooserDialog.cpp プロジェクト: Byvirven/BiMED
std::string filechooserDialog::getPathToFolder
(
	void
)
{
	return get_current_folder();
}
コード例 #4
0
ファイル: file-chooser.cpp プロジェクト: sirjaren/utsushi
void
file_chooser::on_response (int response_id)
{
  if (Gtk::RESPONSE_ACCEPT != response_id) return;

  if (get_current_extension ().empty ())
    set_current_extension (default_extension_);

  std::string fmt;
  {                             // check whether extension is known
    std::string ext (get_current_extension ());
    bool found = false;
    Gtk::TreeModel::Children children (file_type_.get_model ()->children ());

    for (Gtk::TreeModel::Children::const_iterator it = children.begin ();
         !found && children.end () != it;
         ++it)
      {
        Gtk::TreeModel::Row r = *it;
        extension_list      l = r[column->exts];

        found = count (l.begin (), l.end (), ext);

        if (found) fmt = r[column->text];
      }

    if (!found)
      {
        Gtk::MessageDialog tbd
          (*this, _("Unsupported file format."),
           use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal);

        tbd.set_secondary_text
          ((format (_("The '%1%' file extension is not associated with"
                      " a supported file format.  Please select a file"
                      " format or use one of the known file extensions."))
            % ext).str ());

        if (dynamic_cast< Gtk::Window * > (this))
          get_group ()->add_window (tbd);

        tbd.run ();
        signal_response ().emission_stop ();
        response (Gtk::RESPONSE_CANCEL);
        return;
      }
  }
  if (!single_image_mode_
      && requests_single_file (get_current_name ()))
    {                           // check whether single file is okay
      if (!supports_multi_image (get_current_name ()))
        {
          Gtk::MessageDialog tbd
            (*this, (format (_("The %1% format does not support multiple"
                               " images in a single file.")) % fmt).str (),
             use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal);

          tbd.set_secondary_text
            ((format (_("Please save to PDF or TIFF if you want a single"
                        " file.  If you prefer the %1% image format, use"
                        " a filename such as 'Untitled-%%3i%2%'."))
              % fmt % get_current_extension ()).str ());

          if (dynamic_cast< Gtk::Window * > (this))
            get_group ()->add_window (tbd);

          tbd.run ();
          signal_response ().emission_stop ();
          response (Gtk::RESPONSE_CANCEL);
          return;
        }
    }

  if (!do_overwrite_confirmation_) return;

  format message;
  format details;

  if (requests_single_file (get_current_name ()))
    {
      if (!fs::exists (std::string (get_filename ()))) return;

      message = format (_("The name \"%1%\" already exists.\n"
                          "OK to overwrite this name using the new settings?"));
      details = format (_("The file already exists in \"%1%\"."
                          "  Replacing it will overwrite its contents."));
    }
  else
    {
      // FIXME Add meaningful checking
      // if (no_possible_matches ) return;

      message = format (_("Files matching \"%1%\" may already exist."
                          "  Do you want to replace them?"));
    //details = format (_("These files already exist in \"%1%\"."
    //                    "  Replacing them may overwrite their contents."));

      // FIXME show list of matching files in an expander with details
    }

  message % get_current_name ();
  if (0 < details.size ())
    details % get_current_folder ();

  Gtk::MessageDialog tbd (*this, message.str (), use_markup,
                          Gtk::MESSAGE_QUESTION,
                          Gtk::BUTTONS_NONE, modal);

  if (0 < details.size ())
    tbd.set_secondary_text (details.str ());
  tbd.add_button (Gtk::Stock::NO , Gtk::RESPONSE_CANCEL);
  tbd.add_button (Gtk::Stock::YES, Gtk::RESPONSE_ACCEPT);
  tbd.set_default_response (Gtk::RESPONSE_ACCEPT);

  if (dynamic_cast< Gtk::Window * > (this))
    get_group ()->add_window (tbd);

  if (Gtk::RESPONSE_ACCEPT != tbd.run ())
    {
      signal_response ().emission_stop ();
      response (Gtk::RESPONSE_CANCEL);
    }
}