#include "FileDialogPrivate.h"
+using lyx::docstring;
+
using std::string;
-FileDialog::FileDialog(string const & title,
+FileDialog::FileDialog(docstring const & title,
kb_action action,
Button b1,
Button b2)
FileDialog::Result const
-FileDialog::open(string const & path,
+FileDialog::open(docstring const & path,
lyx::support::FileFilterList const & filters,
- string const & suggested)
+ docstring const & suggested)
{
return private_->open(path, filters, suggested);
}
FileDialog::Result const
-FileDialog::opendir(string const & path,
- string const & suggested)
+FileDialog::opendir(docstring const & path,
+ docstring const & suggested)
{
return private_->opendir(path, suggested);
}
FileDialog::Result const
-FileDialog::save(string const & path,
+FileDialog::save(docstring const & path,
lyx::support::FileFilterList const & filters,
- string const & suggested)
+ docstring const & suggested)
{
return private_->save(path, filters, suggested);
}
#include "support/filefilterlist.h"
#include "debug.h"
+using lyx::docstring;
+
using std::string;
-FileDialog::Private::Private(string const & title,
+FileDialog::Private::Private(docstring const & title,
kb_action action,
FileDialog::Button /*b1*/,
FileDialog::Button /*b2*/) :
action_(action),
fileChooser_("You shouldn't see this", Gtk::FILE_CHOOSER_ACTION_OPEN)
{
- fileChooser_.set_title(title);
+ fileChooser_.set_title(lyx::to_utf8(title));
}
FileDialog::Result const
-FileDialog::Private::open(string const & path,
+FileDialog::Private::open(docstring const & path,
lyx::support::FileFilterList const & filters,
- string const & suggested)
+ docstring const & suggested)
{
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
}
-FileDialog::Result const FileDialog::Private::opendir(string const & path,
- string const & suggested)
+FileDialog::Result const FileDialog::Private::opendir(docstring const & path,
+ docstring const & suggested)
{
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
}
-FileDialog::Result const FileDialog::Private::save(string const & path,
+FileDialog::Result const FileDialog::Private::save(docstring const & path,
lyx::support::FileFilterList const & filters,
- string const & suggested)
+ docstring const & suggested)
{
fileChooser_.set_action(Gtk::FILE_CHOOSER_ACTION_SAVE);
fileChooser_.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
}
-FileDialog::Result const FileDialog::Private::showChooser(string const & path,
+FileDialog::Result const FileDialog::Private::showChooser(docstring const & path,
lyx::support::FileFilterList const & filters,
- string const & suggested)
+ docstring const & suggested)
{
- lyxerr[Debug::GUI] << "File Dialog with path \"" << path
- << "\", mask \"" << filters.as_string()
- << "\", suggested \"" << suggested << "\"\n";
+ lyxerr[Debug::GUI] << "File Dialog with path \"" << lyx::to_utf8(path)
+ << "\", mask \"" << lyx::to_utf8(filters.as_string())
+ << "\", suggested \"" << lyx::to_utf8(suggested) << "\"\n";
for (lyx::support::FileFilterList::size_type i = 0; i < filters.size(); ++i) {
typedef lyx::support::FileFilterList::Filter::glob_iterator glob_iterator;
continue;
Gtk::FileFilter filter;
- filter.set_name(filters[i].description());
+ filter.set_name(lyx::to_utf8(filters[i].description()));
for (; it != end; ++it)
filter.add_pattern(*it);
}
if (!path.empty())
- fileChooser_.set_current_folder(path);
+ fileChooser_.set_current_folder(lyx::to_utf8(path));
if (!suggested.empty())
- fileChooser_.set_current_name(suggested);
+ fileChooser_.set_current_name(lyx::to_utf8(suggested));
fileChooser_.set_default_response(Gtk::RESPONSE_OK);
Result result;
result.first = FileDialog::Chosen;
if (fileChooser_.run() == Gtk::RESPONSE_OK)
- result.second = fileChooser_.get_filename();
+ result.second = lyx::from_utf8(fileChooser_.get_filename());
else
- result.second = string();
+ result.second = docstring();
return result;
}
class FileDialog::Private : public sigc::trackable {
public:
- Private(std::string const & title,
+ Private(lyx::docstring const & title,
kb_action action,
FileDialog::Button b1, FileDialog::Button b2);
- FileDialog::Result const open(std::string const & path,
+ FileDialog::Result const open(lyx::docstring const & path,
lyx::support::FileFilterList const & filters,
- std::string const & suggested);
- FileDialog::Result const opendir(std::string const & path,
- std::string const & suggested);
- FileDialog::Result const save(std::string const & path,
+ lyx::docstring const & suggested);
+ FileDialog::Result const opendir(lyx::docstring const & path,
+ lyx::docstring const & suggested);
+ FileDialog::Result const save(lyx::docstring const & path,
lyx::support::FileFilterList const & filters,
- std::string const & suggested);
+ lyx::docstring const & suggested);
- FileDialog::Result const showChooser(std::string const & path,
+ FileDialog::Result const showChooser(lyx::docstring const & path,
lyx::support::FileFilterList const & filters,
- std::string const & suggested);
+ lyx::docstring const & suggested);
private:
kb_action action_;
{
// GTK+ Stock buttons take precedence
if (!btn->get_use_stock())
- btn->set_label(label);
+ btn->set_label(lyx::to_utf8(label));
}
} // namespace frontend
#include <libglademm.h>
+using lyx::docstring;
using lyx::support::changeExtension;
using lyx::support::split;
using lyx::support::trim;
void GBibtex::add()
{
- string new_bib = controller().browseBib("");
+ string new_bib = lyx::to_utf8(controller().browseBib(docstring()));
if (new_bib.empty())
return;
void GBibtex::browse()
{
- string const file = controller().browseBst("");
+ string const file = lyx::to_utf8(controller().browseBst(docstring()));
if (!file.empty()) {
- string const filen = changeExtension(file, "");
+ string const filen = changeExtension(file, string());
bool present = false;
for (unsigned int i = 0; i < stylecombo_.get_model()->children().size(); ++i) {
#include <vector>
#include <string>
+using lyx::docstring;
using lyx::support::token;
using lyx::support::FileFilterList;
using lyx::support::trim;
/// Produces a vector of Gtk::FileFilter*s out of the controller's filterstring
/// providing sensible descriptions (with alttitle as a fallback)
-std::vector<Gtk::FileFilter* > get_filters(const std::string & filterstring, const std::string & alttitle)
+std::vector<Gtk::FileFilter* > get_filters(docstring const & filterstring, docstring const & alttitle)
{
FileFilterList filterlist(filterstring);
std::vector<Gtk::FileFilter* > filters(filterlist.size());
FileFilterList::Filter ff = filterlist[i];
filters[i] = new Gtk::FileFilter();
- std::string description = ff.description();
+ docstring const description = ff.description();
if (description.empty())
- filters[i]->set_name(Glib::locale_to_utf8(alttitle) +
- " " + lyx::to_utf8(_("files")));
+ filters[i]->set_name(lyx::to_utf8(alttitle + ' ' + _("files")));
else
- filters[i]->set_name(Glib::locale_to_utf8(description));
+ filters[i]->set_name(lyx::to_utf8(description));
for (FileFilterList::Filter::glob_iterator git = ff.begin();
git!=ff.end(); ++git)
- filters[i]->add_pattern(Glib::locale_to_utf8(*git));
+ filters[i]->add_pattern(*git);
}
return filters;
}
external::Template templ = controller().getTemplate(count);
Gtk::TreeModel::iterator iter = templatestore_->append();
- (*iter)[templateColumns().name] = Glib::locale_to_utf8(*cit);
- (*iter)[templateColumns().info] =
- Glib::locale_to_utf8(templ.helpText);
+ (*iter)[templateColumns().name] = *cit;
+ (*iter)[templateColumns().info] = templ.helpText;
(*iter)[templateColumns().filters] = get_filters(
- controller().getTemplateFilters(*cit),*cit);
+ lyx::from_utf8(controller().getTemplateFilters(*cit)),
+ lyx::from_utf8(*cit));
}
{
// Get the filename from the dialog
string const in_name = fileentry_->get_text();
- string const out_name = controller().browse(in_name);
+ string const out_name = lyx::to_utf8(controller().browse(lyx::from_utf8(in_name)));
lyxerr[Debug::GRAPHICS]
<< "[FormGraphics]out_name: " << out_name << "\n";
if (out_name != in_name && !out_name.empty()) {
else
type = ControlInclude::VERBATIM;
- fileentry_->set_text(controller().browse(fileentry_->get_text(), type));
+ fileentry_->set_text(lyx::to_utf8(controller().browse(lyx::from_utf8(fileentry_->get_text()), type)));
}
void GMenubar::onCommandActivate(MenuItem const * item,
- Gtk::MenuItem * /*gitem*/)
+ Gtk::MenuItem * /*gitem*/)
{
- view_.dispatch(item->func());
+ view_->dispatch(item->func());
}
} // namespace frontend
void setApply(Gtk::Button * apply);
void setOK(Gtk::Button * ok);
void setRestore(Gtk::Button * restore);
- void setTitle(lyx::doctring const &);
+ void setTitle(lyx::docstring const &);
bool readOnly() const;
protected:
// Build the dialog
class GViewGladeB : public GViewBase {
protected:
- GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
+ GViewGladeB(Dialog & parent, lyx::docstring const & t, bool allowResize);
virtual Gtk::Window const * window() const;
virtual Gtk::Window * window();
Glib::RefPtr<Gnome::Glade::Xml> xml_;