#include "buffer.h"
#include "bufferlist.h"
#include "BufferView.h"
+#include "buffer_funcs.h"
#include "cursor.h"
#include "debug.h"
#include "gettext.h"
// Menu callbacks
//
-bool MenuWrite(Buffer * buffer)
+bool menuWrite(Buffer * buffer)
{
if (buffer->save()) {
LyX::ref().session().addLastFile(buffer->fileName());
text, 0, 1, _("&Rename"), _("&Cancel"));
if (ret == 0)
- return WriteAs(buffer);
+ return writeAs(buffer);
return false;
}
-bool WriteAs(Buffer * buffer, string const & filename)
+bool writeAs(Buffer * buffer, string const & filename)
{
string fname = buffer->fileName();
string const oldname = fname;
if (filename.empty()) {
FileDialog fileDlg(_("Choose a filename to save document as"),
- LFUN_WRITEAS,
+ LFUN_BUFFER_WRITE_AS,
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
make_pair(string(_("Templates|#T#t")),
bool unnamed = buffer->isUnnamed();
buffer->setUnnamed(false);
- if (!MenuWrite(buffer)) {
+ if (!menuWrite(buffer)) {
buffer->setFileName(oldname);
buffer->setUnnamed(unnamed);
return false;
}
-void QuitLyX(bool noask)
+void quitLyX(bool noask)
{
lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
Alert::warning(_("Unable to remove temporary directory"), msg);
}
- lyx_gui::exit();
+ lyx_gui::exit(0);
}
} // namespace anon
-void AutoSave(BufferView * bv)
+void autoSave(BufferView * bv)
// should probably be moved into BufferList (Lgb)
// Perfect target for a thread...
{
// create new file with template
// SERVERCMD !
//
-void NewFile(BufferView * bv, string const & filename)
+void newFile(BufferView * bv, string const & filename)
{
// Split argument by :
string name;
string tmpname = split(filename, name, ':');
-#ifdef __EMX__ // Fix me! lyx_cb.C may not be low level enough to allow this.
- if (name.length() == 1
- && isalpha(static_cast<unsigned char>(name[0]))
- && (prefixIs(tmpname, "/") || prefixIs(tmpname, "\\"))) {
- name += ':';
- name += token(tmpname, ':', 0);
- tmpname = split(tmpname, ':');
- }
-#endif
lyxerr[Debug::INFO] << "Arg is " << filename
<< "\nName is " << name
<< "\nTemplate is " << tmpname << endl;
- bv->newFile(name, tmpname);
+ Buffer * const b = newFile(name, tmpname);
+ if (b)
+ bv->setBuffer(b);
}
// Insert ascii file (if filename is empty, prompt for one)
-void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
+void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
{
if (!bv->available())
return;
// This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings.
-void Reconfigure(BufferView * bv)
+void reconfigure(BufferView * bv)
{
bv->owner()->message(_("Running configure..."));
// Run configure in user lyx directory
Path p(package().user_support());
- string const configure_script =
- addName(package().system_support(), "configure.py");
- string const configure_command = "python " + quoteName(configure_script);
+ string const configure_command = package().configure_command();
Systemcall one;
one.startscript(Systemcall::Wait, configure_command);
p.pop();