#include <config.h>
-#include <fstream>
-#include <queue>
-#include <list>
-#include <algorithm>
-#include <vector>
-#include <utility>
-
-#include <unistd.h>
-#include <csignal>
-#include <sys/wait.h>
-
-#include FORMS_H_LOCATION
-#include <cstdlib>
-#include <cctype>
-#include <cmath>
-#include <cerrno>
-
#include "figinset.h"
+
#include "lyx_main.h"
#include "buffer.h"
-#include "frontends/FileDialog.h"
-#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
#include "debug.h"
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
-#include "support/FileInfo.h"
-#include "support/lyxlib.h"
-#include "support/os.h"
#include "Painter.h"
#include "font.h"
#include "bufferview_funcs.h"
#include "ColorHandler.h"
#include "converter.h"
-#include "frontends/Dialogs.h" // redrawGUI
#include "BufferView.h"
+#include "frontends/FileDialog.h"
+#include "frontends/Alert.h"
+#include "frontends/Dialogs.h" // redrawGUI
+
+#include "support/FileInfo.h"
+#include "support/lyxlib.h"
+#include "support/os.h"
+#include "support/filetools.h"
+
+#include <fstream>
+#include <queue>
+#include <list>
+#include <algorithm>
+#include <vector>
+#include <utility>
+
+#include <unistd.h>
+#include <csignal>
+#include <sys/wait.h>
+#include <cstdlib>
+#include <cctype>
+#include <cmath>
+#include <cerrno>
+
using std::ostream;
using std::istream;
using std::ofstream;
using std::copy;
using std::pair;
using std::make_pair;
+using std::ios;
+using std::ostream_iterator;
#ifndef CXX_GLOBAL_CSTD
using std::memcpy;
if (lyxerr.debugging()) {
lyxerr << "Pids to wait for: \n";
copy(pidwaitlist.begin(), pidwaitlist.end(),
- std::ostream_iterator<int>(lyxerr, "\n"));
+ ostream_iterator<int>(lyxerr, "\n"));
lyxerr << flush;
}
}
}
-extern "C"
+extern "C" {
+
+static
int GhostscriptMsg(XEvent * ev, void *)
{
// bin all events not of interest
return FL_PREEMPT;
}
+}
+
void AllocColors(int num)
// allocate color cube numxnumxnum, if possible
gs_color = true;
}
+
void InitFigures()
{
// if bitmaps and figures are not empty we will leak mem
vi->visualid, vi->c_class,
vi->bits_per_rgb, vi->map_entries);
}
- color_visual = ( (vi->c_class == StaticColor) ||
+ color_visual = ((vi->c_class == StaticColor) ||
(vi->c_class == PseudoColor) ||
(vi->c_class == TrueColor) ||
- (vi->c_class == DirectColor) );
+ (vi->c_class == DirectColor));
if ((vi->c_class & 1) == 0) return;
// now allocate colors
if (vi->c_class == GrayScale) {
{
// This _have_ to be set before the fork!
unsigned long background_pixel =
- lyxColorHandler->colorPixel(LColor::background);
+ lyxColorHandler->colorPixel(LColor::graphicsbg);
// run queued requests for ghostscript, if any
if (!gsrunning && gs_color && !gs_xcolor) {
// create translation file
ofstream ofs;
- ofs.open(make_tmp(getpid()).c_str());
+ ofs.open(make_tmp(getpid()).c_str(), ios::binary);
ofs << "gsave clippath pathbbox grestore\n"
<< "4 dict begin\n"
<< "/ury exch def /urx exch def /lly exch def "
env = new char_p[ne + 2];
string tmp = t2.str().c_str();
env[0] = new char[tmp.size() + 1];
- std::copy(tmp.begin(), tmp.end(), env[0]);
+ copy(tmp.begin(), tmp.end(), env[0]);
env[0][tmp.size()] = '\0';
memcpy(&env[1], environ,
sizeof(char*) * (ne + 1));
string buf;
bool finished = false;
- while (lex.IsOK() && !finished) {
+ while (lex.isOK() && !finished) {
lex.next();
- string const token = lex.GetString();
+ string const token = lex.getString();
lyxerr[Debug::INFO] << "Token: " << token << endl;
if (token.empty())
finished = true;
} else if (token == "file") {
if (lex.next()) {
- buf = lex.GetString();
- string buf1 = OnlyPath(owner->fileName());
+ buf = lex.getString();
+ string const buf1(OnlyPath(owner->fileName()));
fname = MakeAbsPath(buf, buf1);
changedfname = true;
}
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "subcaption") {
- if (lex.EatLine())
- subcaption = lex.GetString();
+ if (lex.eatLine())
+ subcaption = lex.getString();
} else if (token == "label") {
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "angle") {
if (lex.next())
- angle = lex.GetFloat();
+ angle = lex.getFloat();
} else if (token == "size") {
if (lex.next())
- wid = lex.GetInteger();
+ wid = lex.getInteger();
if (lex.next())
- hgh = lex.GetInteger();
+ hgh = lex.getInteger();
} else if (token == "flags") {
if (lex.next())
- flags = pflags = lex.GetInteger();
+ flags = pflags = lex.getInteger();
} else if (token == "subfigure") {
subfigure = psubfigure = true;
} else if (token == "width") {
int typ = 0;
if (lex.next())
- typ = lex.GetInteger();
+ typ = lex.getInteger();
if (lex.next())
- xwid = lex.GetFloat();
+ xwid = lex.getFloat();
switch (typ) {
case DEF: wtype = DEF; break;
case CM: wtype = CM; break;
} else if (token == "height") {
int typ = 0;
if (lex.next())
- typ = lex.GetInteger();
+ typ = lex.getInteger();
if (lex.next())
- xhgh = lex.GetFloat();
+ xhgh = lex.getFloat();
switch (typ) {
case DEF: htype = DEF; break;
case CM: htype = CM; break;
}
-int InsetFig::docBook(Buffer const *, ostream & os) const
+int InsetFig::docbook(Buffer const *, ostream & os) const
{
string const buf1 = OnlyPath(owner->fileName());
string figurename = MakeRelPath(fname, buf1);
if (suffixIs(figurename, ".eps"))
figurename.erase(figurename.length() - 4);
- os << "@<graphic fileref=\"" << figurename << "\"></graphic>";
+ os << "<graphic fileref=\"" << figurename << "\"></graphic>";
return 0;
}
void InsetFig::validate(LaTeXFeatures & features) const
{
- features.graphics = true;
- if (subfigure) features.subfigure = true;
+ features.require("graphics");
+ if (subfigure)
+ features.require("subfigure");
}
}
-void InsetFig::edit(BufferView * bv, int, int, unsigned int)
+void InsetFig::edit(BufferView *, int, int, unsigned int)
{
lyxerr[Debug::INFO] << "Editing InsetFig." << endl;
regenerate();
- // We should have RO-versions of the form instead.
- // The actual prevention of altering a readonly doc
- // is done in CallbackFig()
- if (bv->buffer()->isReadonly())
- WarnReadonly(bv->buffer()->fileName());
-
if (!form) {
form = create_form_Figure();
fl_set_form_atclose(form->Figure, CancelCloseBoxCB, 0);
fl_set_input(form->Width, tostr(xwid).c_str());
fl_set_input(form->Height, tostr(xhgh).c_str());
fl_set_input(form->Angle, tostr(angle).c_str());
- if (!fname.empty()){
+ if (!fname.empty()) {
string buf1 = OnlyPath(owner->fileName());
string fname2 = MakeRelPath(fname, buf1);
fl_set_input(form->EpsFile, fname2.c_str());
FileDialog fileDlg(current_view->owner(), _("Select an EPS figure"),
LFUN_SELECT_FILE_SYNC,
- make_pair(string(_("Clip art")), string(bufclip)),
- make_pair(string(_("Documents")), string(buf)));
+ make_pair(string(_("Clip art|#C#c")), string(bufclip)),
+ make_pair(string(_("Documents|#o#O")), string(buf)));
bool error = false;
do {
if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|| contains(p, "%") || contains(p, " ")) {
- WriteAlert(_("Filename can't contain any "
+ Alert::alert(_("Filename can't contain any "
"of these characters:"),
// xgettext:no-c-format
_("space, '#', '~', '$' or '%'."));