#include <config.h>
#include <unistd.h>
-#include <signal.h>
+#include <csignal>
#include <sys/wait.h>
#include FORMS_H_LOCATION
-#include <stdlib.h>
-#include <ctype.h>
-#include <math.h>
+#include <cstdlib>
+#include <cctype>
+#include <cmath>
#include "form1.h"
#include "figinset.h"
#include "lyx_main.h"
#include "buffer.h"
#include "filedlg.h"
-#include "filetools.h"
+#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
-#include "error.h"
+#include "debug.h"
#include "lyxdraw.h"
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
-#include "FileInfo.h"
-
-// $Id: figinset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: figinset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
-#endif /* lint */
+#include "support/FileInfo.h"
extern BufferView *current_view;
static volatile bool alarmed;
static Figref **figures; /* all the figures */
static figdata **bitmaps; /* all the bitmaps */
-static queue *gsqueue = NULL; /* queue for ghostscripting */
+static queue *gsqueue = 0; /* queue for ghostscripting */
static int gsrunning = 0; /* currently so many gs's are running */
static bool bitmap_waiting = false; /* bitmaps are waiting finished */
static char bittable[256]; /* bit reversion table */
static bool gs_gray; // is grayscale?
static int gs_allcolors; // number of all colors
-static pidwait *pw = NULL; // pid wait list
+static pidwait *pw = 0; // pid wait list
extern FD_form_main *fd_form_main;
pw = p;
if (lyxerr.debugging()) {
- lyxerr.print(LString("Pids to wait for: ") + int(p->pid));
+ lyxerr << "Pids to wait for: " << p->pid << endl;
while (p->next) {
p = p->next;
- lyxerr.print(LString() + int(p->pid));
+ lyxerr << p->pid << endl;
}
}
}
XClientMessageEvent *e = (XClientMessageEvent*) ev;
if(lyxerr.debugging()) {
- fprintf(stderr,
- "ClientMessage, win:[xx] gs:[%ld] pm:[%ld]\n",
- e->data.l[0], e->data.l[1]);
+ lyxerr << "ClientMessage, win:[xx] gs:[" << e->data.l[0]
+ << "] pm:[" << e->data.l[1] << "]" << endl;
}
// just kill gs, that way it will work for sure
figinset_canvas), &wa);
XFlush(fl_display);
if (lyxerr.debugging()) {
- fprintf(stderr,
- "Starting image translation %ld %d %dx%d %d %d\n",
- p->bitmap, p->flags, p->wid, p->hgh, wa.depth,
- XYPixmap);
+ lyxerr
+ << "Starting image translation "
+ << p->bitmap << " "
+ << p->flags << " "
+ << p->wid << "x" << p->hgh
+ << " " << wa.depth
+ << " " << XYPixmap << endl;
+
}
// now fork rendering process
forkstat = fork();
if (forkstat == -1) {
- lyxerr.debug("Cannot fork, using slow "
- "method for pixmap translation.");
+ lyxerr.debug() << "Cannot fork, using slow "
+ "method for pixmap translation." << endl;
tmpdisp = fl_display;
} else if (forkstat > 0) {
// register child
if (lyxerr.debugging()) {
- lyxerr.print(
- LString("Spawned child ")
- + int(forkstat));
+ lyxerr << "Spawned child "
+ << forkstat << endl;
}
addpidwait(forkstat);
break; // in parent process
} else {
- tmpdisp = XOpenDisplay(XDisplayName(NULL));
+ tmpdisp = XOpenDisplay(XDisplayName(0));
XFlush(tmpdisp);
}
im = XGetImage(tmpdisp, p->bitmap, 0, 0,
p->wid, p->hgh, (1<<wa.depth)-1, XYPixmap);
XFlush(tmpdisp);
if (lyxerr.debugging()) {
- lyxerr.print("Got the image");
+ lyxerr << "Got the image" << endl;
}
if (!im) {
if (lyxerr.debugging()) {
- lyxerr.print("Error getting the image");
+ lyxerr << "Error getting the image" << endl;
}
goto noim;
}
}
}
if (lyxerr.debugging()) {
- lyxerr.print("Putting image back");
+ lyxerr << "Putting image back" << endl;
}
XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0,
0, 0, p->wid, p->hgh);
XDestroyImage(im);
if (lyxerr.debugging()) {
- lyxerr.print("Done translation");
+ lyxerr << "Done translation" << endl;
}
noim:
if (lyxerr.debugging()) {
- lyxerr.print(LString("Killing gs ")
- + int(p->gspid));
+ lyxerr << "Killing gs "
+ << p->gspid << endl;
}
kill(p->gspid, SIGHUP);
}
} else {
if (lyxerr.debugging()) {
- lyxerr.print(LString("Killing gs ")
- +int(p->gspid));
+ lyxerr << "Killing gs "
+ << p->gspid << endl;
}
kill(p->gspid, SIGHUP);
int i;
if (lyxerr.debugging()) {
- printf("Allocating color cube %dx%dx%d\n", num, num, num);
+ lyxerr << "Allocating color cube " << num
+ << 'x' << num << 'x' << num << endl;
}
if (num <= 1) {
- lyxerr.print("Error allocating color colormap.");
+ lyxerr << "Error allocating color colormap." << endl;
gs_color = false;
return;
}
if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0);
if(lyxerr.debugging()) {
- lyxerr.print(LString("Cannot allocate color cube " )
- + int(num));
+ lyxerr << "Cannot allocate color cube "
+ << num << endl;;
}
AllocColors(num-1);
return;
int i;
if (lyxerr.debugging()) {
- lyxerr.print(LString("Allocating grayscale ramp ")
- + int(num));
+ lyxerr << "Allocating grayscale ramp "
+ << num << endl;
}
if (num < 4) {
- lyxerr.print("Error allocating grayscale colormap.");
+ lyxerr << "Error allocating grayscale colormap." << endl;
gs_color = false;
return;
}
if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0);
if (lyxerr.debugging()) {
- lyxerr.print(LString("Cannot allocate grayscale ")
- + int(num));
+ lyxerr << "Cannot allocate grayscale "
+ << num << endl;
}
AllocGrays(num/2);
return;
figarrsize = 0;
bmparrsize = 0;
- lyxerr.debug("Unregistering figures...");
+ lyxerr.debug() << "Unregistering figures..." << endl;
fl_remove_canvas_handler(figinset_canvas, ClientMessage,
GhostscriptMsg);
if (gs_color) {
- lyxerr.debug("Freeing up the colors...");
+ lyxerr.debug() << "Freeing up the colors..." << endl;
XFreeColors(fl_display, color_map, gs_pixels,
gs_num_pixels, 0);
/******????????????????? what's planes in this case ??????***/
static void chpixmap(Pixmap, int, int)
{
- Display* tempdisp = XOpenDisplay(XDisplayName(NULL));
+ Display* tempdisp = XOpenDisplay(XDisplayName(0));
// here read the pixmap and change all colors to those we
// have allocated
if (pid == -1) {
if (lyxerr.debugging()) {
- lyxerr.print("GS start error! Cannot fork.");
+ lyxerr << "GS start error! Cannot fork." << endl;
}
p->data->broken = true;
p->data->reading = false;
if (pid == 0) { // child
char **env, rbuf[80], gbuf[40];
int ne = 0;
- Display* tempdisp = XOpenDisplay(XDisplayName(NULL));
+ Display* tempdisp = XOpenDisplay(XDisplayName(0));
// create translation file
sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
//#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer!
if (lyxerr.debugging()) {
- lyxerr.print(LString("Will set GHOSTVIEW"
- " property to [") +
- tbuf + "]");
+ lyxerr << "Will set GHOSTVIEW property to ["
+ << tbuf << "]" << endl;
}
// wait until property is deleted if executing multiple
// ghostscripts
// grab server to prevent other child interfering
// with setting GHOSTVIEW property
if (lyxerr.debugging()) {
- lyxerr.print("Grabbing the server");
+ lyxerr << "Grabbing the server" << endl;
}
XGrabServer(tempdisp);
prop = XListProperties(tempdisp, fl_get_canvas_id(
// ok, property found, we must wait until ghostscript
// deletes it
if (lyxerr.debugging()) {
- lyxerr.print("Releasing the server");
- lyxerr.print(LString('[') +
- int(getpid()) +
- "] GHOSTVIEW property"
- " found. Waiting.");
+ lyxerr << "Releasing the server" << endl;
+ lyxerr << "["
+ << getpid()
+ << "] GHOSTVIEW property"
+ " found. Waiting." << endl;
}
#ifdef WITH_WARNINGS
#warning What is this doing? (wouldn't a sleep(1); work too?')
XUngrabServer(tempdisp);
XFlush(tempdisp);
if (lyxerr.debugging()) {
- lyxerr.print("Releasing the server");
+ lyxerr << "Releasing the server" << endl;
}
XCloseDisplay(tempdisp);
"-dSAFER",
rbuf, gbuf, tbuf,
p->data->fname.c_str(),
- "showpage.ps", "quit.ps", "-", NULL);
+ "showpage.ps", "quit.ps", "-", 0);
// if we are still there, an error occurred.
- lyxerr.print(LString("Error executing ghostscript. ")
- +"Code: "+err);
- lyxerr.debug("Cmd: "
- + lyxrc->ps_command
- +" -sDEVICE=x11 "
- + tbuf + LString(' ')
- + p->data->fname);
+ lyxerr << "Error executing ghostscript. "
+ << "Code: " << err << endl;
+ lyxerr.debug() << "Cmd: "
+ << lyxrc->ps_command
+ << " -sDEVICE=x11 "
+ << tbuf << ' '
+ << p->data->fname << endl;
_exit(0); // no gs?
}
// normal process (parent)
if (lyxerr.debugging()) {
- lyxerr.print(LString("GS [") + int(pid) + "] started");
+ lyxerr << "GS [" << pid << "] started" << endl;
}
gsqueue = gsqueue->next;
gsrunning++;
p->ry = ((float)data->raw_hgh*72)/pshgh;
p->data = data;
- p->next = NULL;
+ p->next = 0;
// now put into queue
p2 = gsqueue;
}
-static figdata *getfigdata(int wid, int hgh, LString const & fname,
+static figdata *getfigdata(int wid, int hgh, string const & fname,
int psx, int psy, int pswid, int pshgh,
int raw_wid, int raw_hgh, float angle, char flags)
{
figdata *p;
XWindowAttributes wa;
- if (fname.empty()) return NULL;
+ if (fname.empty()) return 0;
while (i < bmpinsref) {
if (bitmaps[i]->wid == wid && bitmaps[i]->hgh == hgh &&
}
++i;
}
- /* not found -> create new record or return NULL if no record */
+ /* not found -> create new record or return 0 if no record */
++bmpinsref;
if (bmpinsref > bmparrsize) {
// allocate more space
figinset_canvas), &wa);
if (lyxerr.debugging()) {
- printf("Create pixmap disp:%d scr:%d w:%d h:%d depth:%d\n",
- PTR_AS_INT(fl_display), DefaultScreen(fl_display),
- wid, hgh, wa.depth);
+ lyxerr << "Create pixmap disp:" << fl_display
+ << " scr:" << DefaultScreen(fl_display)
+ << " w:" << wid
+ << " h:" << hgh
+ << " depth:" << wa.depth << endl;
}
p->ref = 1;
for (i = 0; i < figinsref; ++i) if (figures[i]->data == p) {
if (lyxerr.debugging()) {
- printf("Updating inset %d\n",
- PTR_AS_INT(figures[i]->inset));
+ lyxerr << "Updating inset " << figures[i]->inset
+ << endl;
}
//UpdateInset(figures[i]->inset);
// add inset figures[i]->inset into to_update list
bool pid_handled = false;
- lyxerr.debug(LString("Got pid = ") + long (pid));
+ lyxerr.debug() << "Got pid = " << pid << endl;
pid_handled = false;
for (i = bmpinsref - 1; i >= 0; --i) {
if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) {
- lyxerr.debug("Found pid in bitmaps");
+ lyxerr.debug() << "Found pid in bitmaps" << endl;
// now read the file and remove it from disk
p = bitmaps[i];
p->reading = false;
if (bitmaps[i]->gsdone) *status = 0;
if (*status == 0) {
- lyxerr.debug(LString("GS [") + int(pid) +
- "] exit OK.");
+ lyxerr.debug() << "GS [" << pid
+ << "] exit OK." << endl;
} else {
- fprintf(stderr, "GS [%ld] error %d E:%d %d S:%d %d\n", long(pid),
- *status, WIFEXITED(*status), WEXITSTATUS(*status),
- WIFSIGNALED(*status), WTERMSIG(*status));
+ lyxerr << "GS [" << pid << "] error "
+ << *status << " E:"
+ << WIFEXITED(*status)
+ << " " << WEXITSTATUS(*status)
+ << " S:" << WIFSIGNALED(*status)
+ << " " << WTERMSIG(*status) << endl;
}
if (*status == 0) {
bitmap_waiting = true;
}
}
if (!pid_handled) {
- lyxerr.debug("Checking pid in pidwait");
- pidwait *p = pw, *prev = NULL;
+ lyxerr.debug() << "Checking pid in pidwait" << endl;
+ pidwait *p = pw, *prev = 0;
while (p) {
if (pid == p->pid) {
- lyxerr.debug("Found pid in pidwait");
- lyxerr.debug(LString("Caught child pid of recompute routine ") + int(pid));
+ lyxerr.debug() << "Found pid in pidwait" << endl;
+ lyxerr.debug() << "Caught child pid of recompute routine " << pid << endl;
if (prev)
prev->next = p->next;
else
}
if (pid == -1) {
- lyxerr.debug("waitpid error");
+ lyxerr.debug() << "waitpid error" << endl;
switch (errno) {
case ECHILD:
- lyxerr.print(
- "The process or process group specified by pid "
- "does not exist or is not a child of the cal-"
- "ling process or can never be in the states "
- "specified by options.");
+ lyxerr << "The process or process group specified by "
+ "pid does not exist or is not a child of "
+ "the calling process or can never be in the "
+ "states specified by options." << endl;
break;
case EINTR:
- lyxerr.print(
- "waitpid() was interrupted due to the receipt "
- "of a signal sent by the calling process.");
+ lyxerr << "waitpid() was interrupted due to the "
+ "receipt of a signal sent by the calling "
+ "process." << endl;
break;
case EINVAL:
- lyxerr.print(
- "An invalid value was specified for options.");
+ lyxerr << "An invalid value was specified for "
+ "options." << endl;
break;
default:
- lyxerr.print("Unknown error from waitpid");
+ lyxerr << "Unknown error from waitpid" << endl;
break;
}
} else if (pid == 0) {
- lyxerr.print("waitpid nohang");
+ lyxerr << "waitpid nohang" << endl;;
} else {
- lyxerr.debug("normal exit from childhandler");
+ lyxerr.debug() << "normal exit from childhandler" << endl;
}
}
Figref *tmpfig;
if (figinsref == 0) InitFigures();
- fi->form = NULL;
+ fi->form = 0;
++figinsref;
if (figinsref > figarrsize) {
// allocate more space
figures = tmp;
}
tmpfig = new Figref;
- tmpfig->data = NULL;
+ tmpfig->data = 0;
tmpfig->inset = fi;
figures[figinsref-1] = tmpfig;
fi->figure = tmpfig;
if (lyxerr.debugging()) {
- lyxerr.print(LString("Register Figure: buffer:[") +
- long(current_view->currentBuffer()) + "]");
+ lyxerr << "Register Figure: buffer:["
+ << current_view->currentBuffer() << "]" << endl;
}
}
fl_hide_form(tmpfig->inset->form->Figure);
fl_free_form(tmpfig->inset->form->Figure);
free(tmpfig->inset->form);
- tmpfig->inset->form = NULL;
+ tmpfig->inset->form = 0;
}
i = FindFigIndex(tmpfig);
--figinsref;
static char* NextToken(FILE *myfile)
{
- char* token = NULL;
+ char* token = 0;
char c;
int i = 0;
InsetFig::~InsetFig()
{
if (lyxerr.debugging()) {
- lyxerr.print("Figure destructor called");
+ lyxerr << "Figure destructor called" << endl;
}
UnregisterFigure(this);
}
font.setFamily (LyXFont::SANS_FAMILY);
font.setSize (LyXFont::SIZE_FOOTNOTE);
- LString justname = OnlyFilename (fname);
+ string justname = OnlyFilename (fname);
font.drawString(justname,pm,
baseline - font.maxAscent() - 4,
(int) x + 8);
Regenerate();
fprintf(file, "Figure size %d %d\n", wid, hgh);
if (!fname.empty()) {
- LString buf1 = OnlyPath(owner->getFileName());
- LString fname2 = MakeRelPath(fname, buf1);
+ string buf1 = OnlyPath(owner->getFileName());
+ string fname2 = MakeRelPath(fname, buf1);
fprintf(file, "file %s\n", fname2.c_str());
}
if (!subcaption.empty())
void InsetFig::Read(LyXLex &lex)
{
- LString buf;
+ string buf;
bool finished = false;
while (lex.IsOK() && !finished) {
lex.next();
- LString const token = lex.GetString();
- lyxerr.debug("Token: " + token);
+ string const token = lex.GetString();
+ lyxerr.debug() << "Token: " << token << endl;
if (token.empty())
continue;
} else if (token == "file") {
if (lex.next()) {
buf = lex.GetString();
- LString buf1 = OnlyPath(owner->getFileName());
+ string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(buf, buf1);
changedfname = true;
}
case PER_PAGE: wtype = PER_PAGE; break;
case PER_COL: wtype = PER_COL; break;
default:
- lyxerr.debug("Unknown type!");
+ lyxerr.debug() << "Unknown type!" << endl;
break;
}
twtype = wtype;
case IN: htype = IN; break;
case PER_PAGE: htype = PER_PAGE; break;
default:
- lyxerr.debug("Unknown type!");
+ lyxerr.debug() << "Unknown type!" << endl;
break;
}
thtype = htype;
}
-int InsetFig::Latex(LString &file, signed char /* fragile*/ )
+int InsetFig::Latex(string &file, signed char /* fragile*/ )
{
Regenerate();
file += cmd + ' ';
}
-int InsetFig::Linuxdoc(LString &/*file*/)
+int InsetFig::Linuxdoc(string &/*file*/)
{
return 0;
}
-int InsetFig::DocBook(LString &file)
+int InsetFig::DocBook(string &file)
{
- LString figurename=fname;
+ string figurename=fname;
- if(figurename.suffixIs(".eps"))
- figurename=figurename.substring(0,fname.length()-5);
+ if(suffixIs(figurename, ".eps"))
+ figurename.erase(fname.length() - 5);
file += "@<graphic fileref=\"" + figurename + "\"></graphic>";
return 0;
void InsetFig::Edit(int, int)
{
- lyxerr.debug("Editing InsetFig.");
+ lyxerr.debug() << "Editing InsetFig." << endl;
Regenerate();
// We should have RO-versions of the form instead.
if (!form) {
form = create_form_Figure();
- fl_set_form_atclose(form->Figure, CancelCloseBoxCB, NULL);
+ fl_set_form_atclose(form->Figure, CancelCloseBoxCB, 0);
fl_set_object_return(form->Angle,FL_RETURN_ALWAYS);
fl_set_object_return(form->Width,FL_RETURN_ALWAYS);
fl_set_object_return(form->Height,FL_RETURN_ALWAYS);
InsetFig *tmp = new InsetFig(100, 100, owner);
if (lyxerr.debugging()) {
- fprintf(stderr, "Clone Figure: buffer:[%d], cbuffer:[xx]\n",
- PTR_AS_INT(current_view->currentBuffer()));
+ lyxerr << "Clone Figure: buffer:["
+ << current_view->currentBuffer()
+ << "], cbuffer:[xx]" << endl;
}
tmp->wid = wid;
tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy,
pswid, pshgh, raw_wid, raw_hgh,
angle, flags & (3|8));
- } else tmp->figure->data = NULL;
+ } else tmp->figure->data = 0;
tmp->subcaption = subcaption;
tmp->changedfname = false;
tmp->owner = owner;
void InsetFig::Regenerate()
{
- LString cmdbuf;
- LString gcmd;
- LString resizeW, resizeH;
- LString rotate, recmd;
+ string cmdbuf;
+ string gcmd;
+ string resizeW, resizeH;
+ string rotate, recmd;
if (fname.empty()) {
cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}";
return;
}
- LString buf1 = OnlyPath(owner->getFileName());
- LString fname2 = MakeRelPath(fname, buf1);
+ string buf1 = OnlyPath(owner->getFileName());
+ string fname2 = MakeRelPath(fname, buf1);
gcmd = "\\includegraphics{" + fname2 + '}';
void InsetFig::TempRegenerate()
{
- LString gcmd;
- LString cmdbuf;
- LString resizeW, resizeH;
- LString rotate, recmd;
- LString tsubcap;
+ string gcmd;
+ string cmdbuf;
+ string resizeW, resizeH;
+ string rotate, recmd;
+ string tsubcap;
char const *tfname; // *textra;
float tangle, txwid, txhgh;
return;
}
- LString buf1 = OnlyPath(owner->getFileName());
- LString fname2 = MakeRelPath(tfname, buf1);
+ string buf1 = OnlyPath(owner->getFileName());
+ string fname2 = MakeRelPath(tfname, buf1);
// \includegraphics*[<llx,lly>][<urx,ury>]{file}
gcmd = "\\includegraphics{" + fname2 + '}';
if (!rotate.empty()) cmdbuf += '}';
if (!recmd.empty()) cmdbuf += '}';
if (psubfigure && !tsubcap.empty()) {
- cmdbuf = LString("\\subfigure{") + tsubcap
- + LString("}{") + cmdbuf + "}";
+ cmdbuf = string("\\subfigure{") + tsubcap
+ + string("}{") + cmdbuf + "}";
}
switch (htype) {
case DEF:
- //fprintf(stderr, "This should not happen!\n");
+ //lyxerr << "This should not happen!" << endl;
break;
- case CM: /* cm */
+ case CM: /* cm */
newy = (int) (28.346*xhgh);
break;
case IN: /* in */
newy = (int) (72*xhgh);
break;
- case PER_PAGE: /* % of page */
+ case PER_PAGE: /* % of page */
newy = (int) (8.42*xhgh);
break;
- case PER_COL:
- // Doesn't occur; case exists to suppress
+ case PER_COL:
+ // Doesn't occur; case exists to suppress
// compiler warnings.
break;
}
psx, psy, pswid, pshgh,
raw_wid, raw_hgh,
angle, flags & (3|8));
- } else figure->data = NULL;
+ } else figure->data = 0;
// free the old data
if (pf) freefigdata(pf);
{
/* get %%BoundingBox: from postscript file */
int lastchar, c;
- char *p = NULL;
+ char *p = 0;
/* defaults to associated size
* ..just in case the PS-file is not readable (Henner,24-Aug-97)
for (;;) {
c = fgetc(f);
if (c == EOF) {
- lyxerr.debug("End of (E)PS file reached and"
- " no BoundingBox!");
+ lyxerr.debug() << "End of (E)PS file reached and"
+ " no BoundingBox!" << endl;
break;
}
if (c == '%' && lastchar == '%') {
}
if (lyxerr.debugging()) {
- fprintf(stderr, "%%%%BoundingBox:"
- " %d %d %d %d\n",
- psx, psy, pswid, pshgh);
+ lyxerr << "%%%%BoundingBox:"
+ << psx << ' '
+ << psy << ' '
+ << pswid << ' '
+ << pshgh << endl;
break;
}
}
c = 0;
delete[] p;
- p = NULL;
+ p = 0;
}
lastchar = c;
}
fl_activate_object(form->Width);
break;
default:
- lyxerr.debug("Unknown type!");
+ lyxerr.debug() << "Unknown type!" << endl;
break;
}
regen = true;
fl_activate_object(form->Height);
break;
default:
- lyxerr.debug("Unknown type!");
+ lyxerr.debug() << "Unknown type!" << endl;
break;
}
regen = true;
angle = atof(fl_get_input(form->Angle));
p = fl_get_input(form->EpsFile);
if (p && *p) {
- LString buf1 = OnlyPath(owner->getFileName());
+ string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(p, buf1);
changedfname = true;
} else {
if (!fname.empty()) {
changedfname = true;
- fname.clean();
+ fname.erase();
}
}
subcaption = fl_get_input(form->Subcaption);
Recompute();
/* now update inset */
if (lyxerr.debugging()) {
- fprintf(stderr, "Update: [%dx%d]\n", wid, hgh);
+ lyxerr << "Update: ["
+ << wid << 'x' << hgh << ']' << endl;
}
UpdateInset(this);
if (arg == 8) {
fl_hide_form(form->Figure);
fl_free_form(form->Figure);
free(form);
- form = NULL;
+ form = 0;
}
break;
} //if not readonly
fl_hide_form(form->Figure);
fl_free_form(form->Figure);
free(form);
- form = NULL;
+ form = 0;
break;
}
sprintf(buf, "%g", angle);
fl_set_input(form->Angle, buf);
if (!fname.empty()){
- LString buf1 = OnlyPath(owner->getFileName());
- LString fname2 = MakeRelPath(fname, buf1);
+ string buf1 = OnlyPath(owner->getFileName());
+ string fname2 = MakeRelPath(fname, buf1);
fl_set_input(form->EpsFile, fname2.c_str());
}
else fl_set_input(form->EpsFile, "");
pid = fork();
if (pid == -1) {
- lyxerr.print("Cannot fork process!");
+ lyxerr << "Cannot fork process!" << endl;
return; // error
}
if (pid > 0) {
return; // parent process
}
- LString buf1 = OnlyPath(owner->getFileName());
- LString buf2 = MakeAbsPath(p, buf1);
+ string buf1 = OnlyPath(owner->getFileName());
+ string buf2 = MakeAbsPath(p, buf1);
- lyxerr.print(LString("Error during rendering ") +
- int(execlp(lyxrc->view_pspic_command.c_str(),
- lyxrc->view_pspic_command.c_str(),
- buf2.c_str(),
- NULL)));
+ lyxerr << "Error during rendering "
+ << execlp(lyxrc->view_pspic_command.c_str(),
+ lyxrc->view_pspic_command.c_str(),
+ buf2.c_str(), 0)
+ << endl;
_exit(0);
}
void InsetFig::BrowseFile()
{
- LString buf, buf2, bufclip;
- static LString current_figure_path;
+ string buf, buf2, bufclip;
+ static string current_figure_path;
static int once = 0;
LyXFileDlg fileDlg;
if (lyxerr.debugging()) {
- fprintf(stderr, "Filename: %s\n", owner->getFileName().c_str());
+ lyxerr << "Filename: "
+ << owner->getFileName() << endl;
}
- LString p = fl_get_input(form->EpsFile);
+ string p = fl_get_input(form->EpsFile);
buf = MakeAbsPath(owner->getFileName());
buf2 = OnlyPath(buf);
ProhibitInput();
if (once) {
p =fileDlg.Select(_("EPS Figure"), current_figure_path,
- "*ps", LString());
+ "*ps", string());
} else {
p = fileDlg.Select(_("EPS Figure"), buf,
- "*ps", LString());
+ "*ps", string());
}
AllowInput();
current_figure_path = OnlyPath(p);
once = 1;
- if (p.contains("#") || p.contains("~") || p.contains("$")
- || p.contains("%") || p.contains(" "))
+ if (contains(p, "#") || contains(p, "~") || contains(p, "$")
+ || contains(p, "%") || contains(p, " "))
{
WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format
_("space, '#', '~', '$' or '%'."));
/* obj->form contains the form */
if (lyxerr.debugging()) {
- lyxerr.print(LString("GraphicsCB callback: ") + long(arg));
+ lyxerr << "GraphicsCB callback: " << arg << endl;
}
/* find inset we were reacting to */
== obj->form) {
if (lyxerr.debugging()) {
- lyxerr.print(LString("Calling back figure ")
- +int(i));
+ lyxerr << "Calling back figure " << i << endl;
}
figures[i]->inset->CallbackFig(arg);
return;
if (figures[i]->inset->form
&& figures[i]->inset->form->Figure->visible) {
if (lyxerr.debugging()) {
- lyxerr.print(LString("Hiding figure ")
- +int(i));
+ lyxerr << "Hiding figure " << i << endl;
}
// hide and free the form
figures[i]->inset->CallbackFig(9);