mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
compiling not tested. two patches from angus with some small fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1220 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
acb3eecb5d
commit
d1e95f33c4
2
ANNOUNCE
2
ANNOUNCE
@ -73,7 +73,7 @@ The source code package is available at:
|
||||
and at the mirrors listed above.
|
||||
|
||||
You need to have XForms version 0.88 or newer to compile your own
|
||||
version. Version 0.88 is highly recomended. LyX should also compile
|
||||
version. Version 0.88 is highly recommended. LyX should also compile
|
||||
with 0.89.
|
||||
|
||||
Credits
|
||||
|
59
ChangeLog
59
ChangeLog
@ -1,3 +1,62 @@
|
||||
2000-11-15 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/ColorHandler.[Ch]: removed some header files from .h file.
|
||||
Included LColor.h in .C file.
|
||||
|
||||
* src/LColor.[Ch]: made class copyable so that I could create a
|
||||
system_lcolor instance.
|
||||
|
||||
* src/Painter.h: removed LColor.h.
|
||||
|
||||
* src/lyx_gui.C (create_forms): used AddName.
|
||||
|
||||
* src/lyx_main.C (init): copied lcolor to system_lcolr prior to reading
|
||||
of user preferences/lyxrc file.
|
||||
|
||||
* src/lyxrc.C (output): output changes to lcolor.
|
||||
|
||||
* src/frontends/xforms/Color.[Ch]: Changed X11Color to a new struct,
|
||||
NamedColor.
|
||||
Moved class xformColor to files xform_helpers.[Ch]. These files,
|
||||
Color.[Ch], could now be moved into src if they would be useful to
|
||||
other GUIs.
|
||||
|
||||
* src/frontends/xforms/xform_helpers.[Ch]: moved class XformColor here.
|
||||
Also moved FormPreferences::browseFile here as it can be used by any
|
||||
xform dialog with a "Browse" button. FormGraphics is a perfect example.
|
||||
|
||||
* src/support/filetools.[Ch] (WriteableDir, ReadableDir, WriteableFile,
|
||||
ReadableFile): changed the FormPreferences methods a little and moved
|
||||
them here as they'll be useful elsewhere also.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.h: a bit more cleaning up.
|
||||
Removed some header files and used forward declarations instead.
|
||||
Better commenting.
|
||||
Removed some methods as they'll be useful elsewhere (see above).
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C: a bit more cleaning up.
|
||||
Can also now modify the LyX LColors. However, for reasons that I don't
|
||||
yet understand, it appears that we can use
|
||||
LyXFunc::Dispatch(LFUN_SET_COLOR, arg) only when we have a buffer
|
||||
present. The problem appears to lie in ColorHandler, because I can
|
||||
change the color using LColor.SetColor(). Similarly, when reading in a
|
||||
preferences file with some set_color instances, I'll get a warning
|
||||
like: Color sea green is undefined or may not be redefined
|
||||
Bad lyxrc set_color for sea green
|
||||
|
||||
Once the buffer is loaded, however, I can happily change to this color.
|
||||
|
||||
Finally, it appears that I have to set the color of "inset frame"
|
||||
explicitly, or it oscillates from "black" to "indian red" with each
|
||||
successive "Apply".
|
||||
|
||||
2000-11-15 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ANNOUNCE: corrected a spelling mistake.
|
||||
|
||||
* src/tabular.C (OldFormatRead): variable "h" was set but never used.
|
||||
Removed.
|
||||
|
||||
2000-11-15 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/kbsequence.C (addkey): use a vector as per Andre Poenitz patch.
|
||||
|
@ -196,16 +196,16 @@ dnl Check the version of g++
|
||||
fi
|
||||
if test x$with_warnings = xyes ; then
|
||||
case $gxx_version in
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
|
||||
2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
|
||||
2.97*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";;
|
||||
*) CXXFLAGS="$CXXFLAGS -W -Wall -Wno-return-type";;
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
2.96*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
2.97*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
*) CXXFLAGS="$CXXFLAGS -W -Wall";;
|
||||
esac
|
||||
if test $lyx_devel_version = yes ; then
|
||||
case $gxx_version in
|
||||
2.95.*) ;;
|
||||
2.96*) ;;
|
||||
2.97*) ;;
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
2.96*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
2.97*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
*2.91*) ;;
|
||||
*) CXXFLAGS="$CXXFLAGS -pedantic";;
|
||||
esac
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include "ColorHandler.h"
|
||||
#include "LColor.h"
|
||||
#include "gettext.h"
|
||||
|
||||
using std::endl;
|
||||
|
@ -18,9 +18,7 @@
|
||||
// This is only included to provide stuff for the non-public sections
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <map>
|
||||
#include "PainterBase.h"
|
||||
#include "LColor.h"
|
||||
|
||||
class LyXFont;
|
||||
class WorkArea;
|
||||
|
@ -214,3 +214,5 @@ LColor::color LColor::getFromLyXName(string const & lyxname) const
|
||||
|
||||
// The evil global LColor instance
|
||||
LColor lcolor;
|
||||
// An equally evil global system LColor instance
|
||||
LColor system_lcolor;
|
||||
|
@ -32,7 +32,10 @@
|
||||
- A logical color, such as no color, inherit, math
|
||||
|
||||
*/
|
||||
class LColor : public noncopyable {
|
||||
class LColor //: public noncopyable {
|
||||
// made copyable for same reasons as LyXRC was made copyable. See there for
|
||||
// explanation.
|
||||
{
|
||||
public:
|
||||
/// Names of colors, including all logical colors
|
||||
enum color {
|
||||
@ -216,5 +219,7 @@ private:
|
||||
|
||||
///
|
||||
extern LColor lcolor;
|
||||
///
|
||||
extern LColor system_lcolor;
|
||||
|
||||
#endif
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "PainterBase.h"
|
||||
#include "LColor.h"
|
||||
|
||||
class LyXFont;
|
||||
class WorkArea;
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
virtual PainterBase & fillPolygon(
|
||||
int const * xp, int const * yp,
|
||||
int np,
|
||||
LColor::color =LColor::foreground) = 0;
|
||||
LColor::color = LColor::foreground) = 0;
|
||||
|
||||
/// Draw lines from x1,y1 to x2,y2. They are arrays
|
||||
virtual PainterBase & segments(
|
||||
|
@ -18,13 +18,10 @@
|
||||
|
||||
#include <algorithm> // max
|
||||
#include <cmath> // floor
|
||||
#include <fstream> // ofstream
|
||||
#include "Color.h"
|
||||
#include "lyxlex.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::ofstream;
|
||||
|
||||
static int const nohue = -1;
|
||||
|
||||
@ -131,92 +128,3 @@ HSVColor::HSVColor(RGBColor const & rgb)
|
||||
h += 360;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sorted by hand to prevent LyXLex from complaining on read().
|
||||
static
|
||||
keyword_item xformTags[] = {
|
||||
// { "\\gui_active_tab", FL_LIGHTER_COL1 },
|
||||
{ "\\gui_background", FL_COL1 },
|
||||
{ "\\gui_buttonbottom", FL_BOTTOM_BCOL },
|
||||
{ "\\gui_buttonleft", FL_LEFT_BCOL },
|
||||
{ "\\gui_buttonright", FL_RIGHT_BCOL },
|
||||
{ "\\gui_buttontop", FL_TOP_BCOL },
|
||||
{ "\\gui_inactive", FL_INACTIVE },
|
||||
{ "\\gui_push_button", FL_YELLOW },
|
||||
{ "\\gui_selected", FL_MCOL },
|
||||
{ "\\gui_text", FL_BLACK }
|
||||
};
|
||||
|
||||
|
||||
static const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
|
||||
|
||||
|
||||
bool XformColor::read(string const & filename)
|
||||
{
|
||||
LyXLex lexrc(xformTags, xformCount);
|
||||
if (!lexrc.setFile(filename))
|
||||
return false;
|
||||
|
||||
while (lexrc.IsOK()) {
|
||||
int const le = lexrc.lex();
|
||||
|
||||
switch (le) {
|
||||
case LyXLex::LEX_UNDEF:
|
||||
lexrc.printError("Unknown tag `$$Token'");
|
||||
continue;
|
||||
case LyXLex::LEX_FEOF:
|
||||
continue;
|
||||
default: break;
|
||||
}
|
||||
|
||||
RGBColor col;
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.r = lexrc.GetInteger();
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.g = lexrc.GetInteger();
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.b = lexrc.GetInteger();
|
||||
|
||||
fl_mapcolor(le, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool XformColor::write(string const & filename)
|
||||
{
|
||||
ofstream os(filename.c_str());
|
||||
if (!os)
|
||||
return false;
|
||||
|
||||
os << "### This file is part of\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "### LyX, The Document Processor\n"
|
||||
<< "###\n"
|
||||
<< "### Copyright 1995 Matthias Ettrich\n"
|
||||
<< "### Copyright 1995-2000 The LyX Team.\n"
|
||||
<< "###\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "\n"
|
||||
<< "# This file is written by LyX, if you want to make your own\n"
|
||||
<< "# modifications you should do them from inside LyX and save\n"
|
||||
<< "\n";
|
||||
|
||||
for (int i = 0; i < xformCount; ++i) {
|
||||
string const tag = xformTags[i].tag;
|
||||
int const colorID = xformTags[i].code;
|
||||
RGBColor color;
|
||||
|
||||
fl_getmcolor(colorID, &color.r, &color.g, &color.b);
|
||||
|
||||
os << tag << " "
|
||||
<< color.r << " " << color.g << " " << color.b << "\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -12,8 +12,6 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#include <utility> // for pair
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
#endif
|
||||
@ -42,17 +40,13 @@ struct RGBColor {
|
||||
RGBColor(HSVColor const &);
|
||||
};
|
||||
|
||||
typedef std::pair<string, RGBColor> X11Color;
|
||||
|
||||
/// struct holding xform-specific colors
|
||||
struct XformColor {
|
||||
struct NamedColor : public RGBColor {
|
||||
string name;
|
||||
int colorID;
|
||||
RGBColor col;
|
||||
XformColor() : colorID(0) {}
|
||||
NamedColor() : RGBColor() {}
|
||||
NamedColor(string const & n, RGBColor const & c )
|
||||
: RGBColor(c), name(n) {}
|
||||
RGBColor const & color() const { return *this; }
|
||||
string const & getname() const { return name; }
|
||||
static bool read(string const &);
|
||||
static bool write(string const &);
|
||||
};
|
||||
|
||||
inline
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,10 +18,7 @@
|
||||
#define FORMPREFERENCES_H
|
||||
|
||||
#include <utility> // for pair
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "Color.h"
|
||||
#include "LString.h"
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
@ -32,6 +29,9 @@ class Command;
|
||||
class Dialogs;
|
||||
class Format;
|
||||
class LyXView;
|
||||
class NamedColor;
|
||||
class RGBColor;
|
||||
class XformColor;
|
||||
struct FD_form_colors;
|
||||
struct FD_form_converters;
|
||||
struct FD_form_formats;
|
||||
@ -67,9 +67,9 @@ private:
|
||||
virtual void redraw();
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
///
|
||||
/// Hide the dialog.
|
||||
virtual void hide();
|
||||
/// OK from dialog
|
||||
/// OK (Save) from dialog
|
||||
virtual void ok();
|
||||
/// Apply from dialog
|
||||
virtual void apply();
|
||||
@ -77,48 +77,25 @@ private:
|
||||
virtual bool input(FL_OBJECT *, long);
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// control which feedback message is output
|
||||
void feedback( FL_OBJECT * );
|
||||
/// The handler for the preemptive feedback
|
||||
void Feedback(FL_OBJECT *, int);
|
||||
///
|
||||
/// Pointer to the actual instantiation of xform's form.
|
||||
virtual FL_FORM * form() const;
|
||||
/// control which feedback message is output
|
||||
void feedback(FL_OBJECT *);
|
||||
|
||||
/** Helper functions available to the various tab folders.
|
||||
*/
|
||||
|
||||
///
|
||||
bool WriteableDir( string const & );
|
||||
///
|
||||
bool ReadableDir( string const & );
|
||||
///
|
||||
bool WriteableFile( string const &, string const & = string() );
|
||||
///
|
||||
bool ReadableFile( string const &, string const & = string() );
|
||||
///
|
||||
void setPreHandler( FL_OBJECT * ) const;
|
||||
///
|
||||
/// Set the preemptive handler for each FL_OBJECT.
|
||||
static void setPreHandler(FL_OBJECT *);
|
||||
/// The preemptive handler for feedback messages.
|
||||
void Feedback(FL_OBJECT *, int);
|
||||
/// Print a warning message and set warning flag.
|
||||
void printWarning( string const & );
|
||||
|
||||
/** title: filedlg title, pattern: *.ps etc
|
||||
extra buttons on filedlg: dir1 = (name, dir), dir2 = (name, dir)
|
||||
/** Launch a file dialog and modify input if it returns a new file.
|
||||
For an explanation of the various parameters, see xform_helpers.h.
|
||||
*/
|
||||
void browse( FL_OBJECT * input,
|
||||
string const & title, string const & pattern,
|
||||
std::pair<string,string> const & dir1,
|
||||
std::pair<string,string> const & dir2 );
|
||||
|
||||
///
|
||||
bool browse(FL_OBJECT * input,
|
||||
string const & title, string const & pattern,
|
||||
std::pair<string,string> const & dir1 //=
|
||||
//std::pair<string,string>()
|
||||
,
|
||||
std::pair<string,string> const & dir2 //=
|
||||
//std::pair<string,string>()
|
||||
);
|
||||
/// called from browse()
|
||||
string const browseFile( string const & filename,
|
||||
string const & title, string const & pattern,
|
||||
std::pair<string,string> const & dir1,
|
||||
std::pair<string,string> const & dir2 ) const;
|
||||
|
||||
/// Type definitions from the fdesign produced header file.
|
||||
FD_form_preferences * build_preferences();
|
||||
///
|
||||
@ -214,7 +191,7 @@ private:
|
||||
///
|
||||
FD_form_colors * dialog_;
|
||||
/// A vector of RGB colors and associated name.
|
||||
static std::vector<X11Color> colorDB;
|
||||
static std::vector<NamedColor> colorDB;
|
||||
/// A vector of xform RGB colors and associated name.
|
||||
static std::vector<XformColor> xformColorDB;
|
||||
};
|
||||
@ -225,7 +202,7 @@ private:
|
||||
class Converters {
|
||||
public:
|
||||
///
|
||||
Converters( FormPreferences & p ) : parent_(p), dialog_(0) {}
|
||||
Converters( FormPreferences & p ) : parent_(p), dialog_(0) {}
|
||||
///
|
||||
~Converters();
|
||||
///
|
||||
@ -565,7 +542,6 @@ private:
|
||||
///
|
||||
friend class SpellChecker;
|
||||
|
||||
|
||||
/** The tab folders.
|
||||
*/
|
||||
|
||||
|
@ -11,7 +11,16 @@
|
||||
|
||||
#include <vector>
|
||||
#include "xform_helpers.h"
|
||||
#include <fstream> // ofstream
|
||||
#include "lyxlex.h"
|
||||
#include "filedlg.h" // LyXFileDlg
|
||||
#include "support/FileInfo.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h" // WriteAlert
|
||||
#include "gettext.h"
|
||||
|
||||
using std::ofstream;
|
||||
using std::pair;
|
||||
using std::vector;
|
||||
|
||||
// Take a string and add breaks so that it fits into a desired label width, w
|
||||
@ -58,3 +67,141 @@ string formatted( string const & sin, int w, int size, int style )
|
||||
|
||||
return sout;
|
||||
}
|
||||
|
||||
|
||||
string const browseFile( string const & filename,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
pair<string,string> const & dir1,
|
||||
pair<string,string> const & dir2 )
|
||||
{
|
||||
string lastPath = ".";
|
||||
if( !filename.empty() ) lastPath = OnlyPath(filename);
|
||||
|
||||
LyXFileDlg fileDlg;
|
||||
|
||||
if( !dir1.second.empty() ) {
|
||||
FileInfo fileInfo( dir1.second );
|
||||
if( fileInfo.isOK() && fileInfo.isDir() )
|
||||
fileDlg.SetButton( 0, dir1.first, dir1.second );
|
||||
}
|
||||
|
||||
if( !dir2.second.empty() ) {
|
||||
FileInfo fileInfo( dir2.second );
|
||||
if( fileInfo.isOK() && fileInfo.isDir() )
|
||||
fileDlg.SetButton( 1, dir2.first, dir2.second );
|
||||
}
|
||||
|
||||
bool error = false;
|
||||
string buf;
|
||||
do {
|
||||
string p = fileDlg.Select(title,
|
||||
lastPath,
|
||||
pattern, filename );
|
||||
|
||||
if (p.empty()) return p;
|
||||
|
||||
lastPath = OnlyPath(p);
|
||||
|
||||
if (p.find_first_of("#~$% ") != string::npos) {
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
} else {
|
||||
error = false;
|
||||
buf = p;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
// sorted by hand to prevent LyXLex from complaining on read().
|
||||
static
|
||||
keyword_item xformTags[] = {
|
||||
// { "\\gui_active_tab", FL_LIGHTER_COL1 },
|
||||
{ "\\gui_background", FL_COL1 },
|
||||
{ "\\gui_buttonbottom", FL_BOTTOM_BCOL },
|
||||
{ "\\gui_buttonleft", FL_LEFT_BCOL },
|
||||
{ "\\gui_buttonright", FL_RIGHT_BCOL },
|
||||
{ "\\gui_buttontop", FL_TOP_BCOL },
|
||||
{ "\\gui_inactive", FL_INACTIVE },
|
||||
{ "\\gui_push_button", FL_YELLOW },
|
||||
{ "\\gui_selected", FL_MCOL },
|
||||
{ "\\gui_text", FL_BLACK }
|
||||
};
|
||||
|
||||
|
||||
static const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
|
||||
|
||||
|
||||
bool XformColor::read(string const & filename)
|
||||
{
|
||||
LyXLex lexrc(xformTags, xformCount);
|
||||
if (!lexrc.setFile(filename))
|
||||
return false;
|
||||
|
||||
while (lexrc.IsOK()) {
|
||||
int const le = lexrc.lex();
|
||||
|
||||
switch (le) {
|
||||
case LyXLex::LEX_UNDEF:
|
||||
lexrc.printError("Unknown tag `$$Token'");
|
||||
continue;
|
||||
case LyXLex::LEX_FEOF:
|
||||
continue;
|
||||
default: break;
|
||||
}
|
||||
|
||||
RGBColor col;
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.r = lexrc.GetInteger();
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.g = lexrc.GetInteger();
|
||||
|
||||
if (!lexrc.next()) break;
|
||||
col.b = lexrc.GetInteger();
|
||||
|
||||
fl_mapcolor(le, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool XformColor::write(string const & filename)
|
||||
{
|
||||
ofstream os(filename.c_str());
|
||||
if (!os)
|
||||
return false;
|
||||
|
||||
os << "### This file is part of\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "### LyX, The Document Processor\n"
|
||||
<< "###\n"
|
||||
<< "### Copyright 1995 Matthias Ettrich\n"
|
||||
<< "### Copyright 1995-2000 The LyX Team.\n"
|
||||
<< "###\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "\n"
|
||||
<< "# This file is written by LyX, if you want to make your own\n"
|
||||
<< "# modifications you should do them from inside LyX and save\n"
|
||||
<< "\n";
|
||||
|
||||
for (int i = 0; i < xformCount; ++i) {
|
||||
string const tag = xformTags[i].tag;
|
||||
int const colorID = xformTags[i].code;
|
||||
RGBColor color;
|
||||
|
||||
fl_getmcolor(colorID, &color.r, &color.g, &color.b);
|
||||
|
||||
os << tag << " "
|
||||
<< color.r << " " << color.g << " " << color.b << "\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,10 +5,32 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <utility> // pair
|
||||
#include <config.h>
|
||||
#include "LString.h"
|
||||
#include "Color.h"
|
||||
|
||||
// Take a string and add breaks so that it fits into a desired label width, w
|
||||
string formatted( string const &label, int w, int size, int style );
|
||||
|
||||
/** Launch a file dialog and return the chosen file.
|
||||
filename: a suggested filename.
|
||||
title: the title of the dialog.
|
||||
pattern: *.ps etc.
|
||||
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
|
||||
*/
|
||||
string const browseFile( string const & filename,
|
||||
string const & title,
|
||||
string const & pattern,
|
||||
std::pair<string,string> const & dir1,
|
||||
std::pair<string,string> const & dir2 );
|
||||
|
||||
/// struct holding xform-specific colors
|
||||
struct XformColor : public NamedColor {
|
||||
int colorID;
|
||||
XformColor() : NamedColor(), colorID(0) {}
|
||||
static bool read(string const &);
|
||||
static bool write(string const &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "language.h"
|
||||
#include "ColorHandler.h"
|
||||
#include "frontends/GUIRunTime.h"
|
||||
#include "frontends/xforms/Color.h"
|
||||
#include "frontends/xforms/xform_helpers.h" // for XformColor
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -373,7 +373,7 @@ void LyXGUI::create_forms()
|
||||
// This is probably as good a time as any to map the xform colours,
|
||||
// should a mapping exist.
|
||||
{
|
||||
string filename = user_lyxdir + "/preferences.xform";
|
||||
string filename = AddName(user_lyxdir, "preferences.xform");
|
||||
XformColor::read( filename );
|
||||
}
|
||||
|
||||
|
@ -402,6 +402,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
|
||||
system_lyxrc = lyxrc;
|
||||
system_formats = formats;
|
||||
system_converters = converters;
|
||||
system_lcolor = lcolor;
|
||||
|
||||
// If there is a preferences file we read that instead
|
||||
// of the old lyxrc file.
|
||||
|
17
src/lyxrc.C
17
src/lyxrc.C
@ -1158,9 +1158,20 @@ void LyXRC::output(ostream & os) const
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
//case RC_SET_COLOR:
|
||||
// color bindings not written to preference file.
|
||||
// And we want to be warned about that. (Lgb)
|
||||
os << "\n#\n"
|
||||
<< "# COLOR SECTION ###################################\n"
|
||||
<< "#\n\n";
|
||||
|
||||
case RC_SET_COLOR:
|
||||
for( int i=0; i<LColor::ignore; ++i ) {
|
||||
LColor::color lc = static_cast<LColor::color>(i);
|
||||
|
||||
if (lcolor.getX11Name(lc) !=
|
||||
system_lcolor.getX11Name(lc)) {
|
||||
os << "\\set_color \"" << lcolor.getX11Name(lc)
|
||||
<< "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
os << "\n#\n"
|
||||
<< "# PRINTER SECTION ###################################\n"
|
||||
|
@ -1135,3 +1135,151 @@ void removeAutosaveFile(string const & filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WriteableDir(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.writable()) {
|
||||
errorMessage = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ReadableDir(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.readable()) {
|
||||
errorMessage = N_("Cannot read this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool WriteableFile(string const & name, string & errorMessage)
|
||||
{
|
||||
// A writeable file is either:
|
||||
// * An existing file to which we have write access, or
|
||||
// * A file that doesn't yet exist but that would exist in a writeable
|
||||
// directory.
|
||||
|
||||
errorMessage.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
errorMessage = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.writable()) {
|
||||
errorMessage = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
errorMessage = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (f.exist() && !f.writable()) {
|
||||
errorMessage = N_("Cannot write to this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ReadableFile(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
errorMessage = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.readable()) {
|
||||
errorMessage = N_("Cannot read from this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
errorMessage = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.exist()) {
|
||||
errorMessage = N_("File does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.readable()) {
|
||||
errorMessage = N_("Cannot read from this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -199,10 +199,22 @@ string const ReplaceEnvironmentPath(string const & path);
|
||||
Returns true if successful */
|
||||
bool LyXReadLink(string const & file, string & Link);
|
||||
|
||||
/* Uses kpsewhich to find tex files */
|
||||
/// Uses kpsewhich to find tex files
|
||||
string const findtexfile(string const & fil, string const & format);
|
||||
|
||||
/* remove the autosave-file and give a Message if it can't be done */
|
||||
/// remove the autosave-file and give a Message if it can't be done
|
||||
void removeAutosaveFile(string const & filename);
|
||||
|
||||
/** Perform some quite detailed tests to ascertain whether the directory or
|
||||
file is readable or writeable. If not, then an error message is returned.
|
||||
*/
|
||||
///
|
||||
bool WriteableDir(string const & dir, string & errorMessage);
|
||||
///
|
||||
bool ReadableDir(string const & dir, string & errorMessage);
|
||||
///
|
||||
bool WriteableFile(string const & file, string & errorMessage);
|
||||
///
|
||||
bool ReadableFile(string const & file, string & errorMessage);
|
||||
|
||||
#endif
|
||||
|
@ -1262,7 +1262,6 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
int e = 0;
|
||||
int f = 0;
|
||||
int g = 0;
|
||||
int h = 0;
|
||||
|
||||
istream & is = lex.getStream();
|
||||
string s(fl);
|
||||
@ -1314,7 +1313,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||
endfoot = c;
|
||||
endlastfoot = d;
|
||||
for (i = 0; i < rows_; ++i) {
|
||||
a = b = c = d = e = f = g = h = 0;
|
||||
a = b = c = d = e = f = g = 0;
|
||||
is >> a >> b >> c >> d;
|
||||
row_info[i].top_line = a;
|
||||
row_info[i].bottom_line = b;
|
||||
|
Loading…
Reference in New Issue
Block a user