#include FORMS_H_LOCATION
#include "lyxvc.h"
-#include "error.h"
+#include "debug.h"
#include "lyx_gui_misc.h"
#include "bufferlist.h"
#include "support/syscall.h"
-#include "pathstack.h"
+#include "support/path.h"
#include "support/filetools.h"
#include "support/FileInfo.h"
#include "gettext.h"
FileInfo f;
// Check if *,v exists.
tmp += ",v";
- lyxerr.debug(string("Checking if file is under vc: ") + tmp, Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
+ << tmp << endl;
if (f.newFile(tmp).readable()) {
- lyxerr.debug("Yes it is under vc.", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "Yes it is under vc." << endl;
master = tmp;
backend = RCS_VCS;
scanMaster();
// Check if RCS/*,v exists.
tmp = AddName(AddPath(OnlyPath(fn), "RCS"), fn);
tmp += ",v";
- lyxerr.debug("Checking if file is under vc: " + tmp, Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "Checking if file is under vc: "
+ << tmp << endl;
if (f.newFile(tmp).readable()) {
- lyxerr.debug("Yes it is under vc.", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "Yes it is under vc."<< endl;
master = tmp;
backend = RCS_VCS;
scanMaster();
void LyXVC::scanMaster()
{
- lyxerr.debug("LyXVC: This file is a VC file.", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: This file is a VC file." << endl;
LyXLex lex(0, 0);
lex.setFile(master);
lex.next();
token = lex.GetString();
- lyxerr.debug("LyXVC::scanMaster: current lex text: `"
- +token+"'", Error::LYXVC);
+ lyxerr[Debug::LYXVC] <<"LyXVC::scanMaster: current lex text: `"
+ << token << "'" << endl;
if (token.empty())
continue;
read_enough = true;
} else {
// unexpected
- lyxerr.debug("LyXVC::scanMaster(): unexpected token", Error::LYXVC);
+ lyxerr[Debug::LYXVC]
+ << "LyXVC::scanMaster(): unexpected token"
+ << endl;
}
}
}
return;
}
- lyxerr.debug("LyXVC: registrer", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
string tmp = askForText(_("LyX VC: Initial description"),
_("(no initial description)"));
if (tmp.empty()) {
- lyxerr.debug("LyXVC: user cancelled", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: user cancelled" << endl;
WriteAlert(_("Info"), _("This document has NOT been registered."));
return;
}
return;
}
- lyxerr.debug("LyXVC: checkIn", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
_owner->getUser()->getOwner()->getLyXFunc()->Dispatch(LFUN_MENUWRITE);
string tmp = askForText(_("LyX VC: Log Message"));
if (tmp.empty()) tmp = "(no log msg)";
void LyXVC::checkOut()
{
- lyxerr.debug("LyXVC: checkOut", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
if (!_owner->isLyxClean()
&& !AskQuestion(_("Changes in document:"),
MakeDisplayPath(_owner->getFileName(),50),
void LyXVC::revert()
{
- lyxerr.debug("LyXVC: revert", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: revert" << endl;
// Here we should check if the buffer is dirty. And if it is
// we should warn the user that reverting will discard all
// changes made since the last check in.
void LyXVC::undoLast()
{
- lyxerr.debug("LyXVC: undoLast", Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
doVCCommand("rcs -o" + getVersion() + " \""
+ OnlyFilename(_owner->getFileName()) + "\"");
}
fl_hide_form(This->browser->LaTeXLog);
}
+// and, hack over hack, here is a C wrapper :)
+extern "C" void C_LyXVC_logClose(FL_OBJECT *ob, long data)
+{
+ LyXVC::logClose(ob, data);
+}
+
void LyXVC::logUpdate(FL_OBJECT *obj, long)
{
This->showLog();
}
+extern "C" void C_LyXVC_logUpdate(FL_OBJECT *ob, long data)
+{
+ LyXVC::logUpdate(ob, data);
+}
+
void LyXVC::viewLog(string const & fil)
{
+ static int ow = -1, oh;
+
if (!browser) {
FL_OBJECT *obj;
browser = (FD_LaTeXLog *) fl_calloc(1, sizeof(*browser));
browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, logClose, 0);
+ fl_set_object_callback(obj, C_LyXVC_logClose, 0);
obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30,
idex(_("Update|#Uu")));
fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1);
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
- fl_set_object_callback(obj,logUpdate,0);
+ fl_set_object_callback(obj, C_LyXVC_logUpdate,0);
fl_end_form();
fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0);
}
fl_show_form(browser->LaTeXLog,
FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
_("RCS History"));
+ if (ow < 0) {
+ ow = browser->LaTeXLog->w;
+ oh = browser->LaTeXLog->h;
+ }
+ fl_set_form_minsize(browser->LaTeXLog, ow, oh);
}
}
int LyXVC::doVCCommand(string const & cmd)
{
- lyxerr.debug("doVCCommand: " + cmd, Error::LYXVC);
+ lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl;
Systemcalls one;
- PathPush(_owner->filepath);
- int ret = one.Startscript(Systemcalls::System, cmd);
- PathPop();
+ Path p(_owner->filepath);
+ int ret = one.startscript(Systemcalls::System, cmd);
return ret;
}