X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxvc.C;h=31aca999eac6133cc80efc98b1b3f600969f4c49;hb=a858be7332e331e0244e4dba7b0931b6072ffd3d;hp=db0572eccd4911f12d3ec2a944ae007b3ac0436c;hpb=0eccdd1c3613e5170deb77b22174dd0afde833e9;p=lyx.git diff --git a/src/lyxvc.C b/src/lyxvc.C index db0572eccd..31aca999ea 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -6,11 +6,11 @@ #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" @@ -49,9 +49,10 @@ bool LyXVC::file_found_hook(string const & fn) 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(); @@ -60,9 +61,10 @@ bool LyXVC::file_found_hook(string const & fn) // 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(); @@ -85,7 +87,7 @@ bool LyXVC::file_not_found_hook(string const &) 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); @@ -96,8 +98,8 @@ void LyXVC::scanMaster() 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; @@ -136,7 +138,9 @@ void LyXVC::scanMaster() read_enough = true; } else { // unexpected - lyxerr.debug("LyXVC::scanMaster(): unexpected token", Error::LYXVC); + lyxerr[Debug::LYXVC] + << "LyXVC::scanMaster(): unexpected token" + << endl; } } } @@ -176,11 +180,11 @@ void LyXVC::registrer() 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; } @@ -210,7 +214,7 @@ void LyXVC::checkIn() 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)"; @@ -222,7 +226,7 @@ void LyXVC::checkIn() 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), @@ -239,7 +243,7 @@ void LyXVC::checkOut() 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. @@ -259,7 +263,7 @@ void LyXVC::revert() void LyXVC::undoLast() { - lyxerr.debug("LyXVC: undoLast", Error::LYXVC); + lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl; doVCCommand("rcs -o" + getVersion() + " \"" + OnlyFilename(_owner->getFileName()) + "\""); } @@ -304,6 +308,12 @@ void LyXVC::logClose(FL_OBJECT *obj, long) 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) { @@ -311,9 +321,16 @@ 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)); @@ -324,12 +341,12 @@ void LyXVC::viewLog(string const & fil) 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); } @@ -343,6 +360,11 @@ void LyXVC::viewLog(string const & fil) 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); } } @@ -379,10 +401,9 @@ void LyXVC::showLog() 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; }