ftp://alpha.tat.physik.uni-tuebingen.de/pub/lyx
ftp://ftp.lip6.fr/pub/lyx/
+ ftp://ftp.chg.ru/packages/lyx/
ftp://ftp.sdsc.edu/pub/other/lyx/
ftp://ftp.fciencias.unam.mx/pub/Lyx/
ftp://mirror.aarnet.edu.au/pub/LyX/
+2000-06-26 Lior Silberman <slior@math.huji.ac.il>
+
+ * src/lyxrc.C:
+ * lib/lyxrc.example: new lyxrc tag \set_color.
+
+ * src/lyxfunc.C (Dispatch):
+ * src/commandtags.h:
+ * src/LyXAction.C: new lyxfunc "set-color".
+
+ * src/LColor.[Ch] (setColor): new method to set colors from a lyxname
+ and an x11name given as strings.
+
+ * src/ColorHandler.[Ch] (updateColor): new method. Updates the GC
+ cache when a color is changed.
+
2000-06-26 Juergen Vigna <jug@sad.it>
* src/lyxrow.C (width): added this functions and variable.
2000-06-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+ * images/undo_bw.xpm: new icon.
+ * images/redo_bw.xpm: ditto.
+
+ * configure.in (INSTALL_SCRIPT): change value to
+ ${INSTALL} to avoid failures of install-script target.
+ * lib/reLyX/configure.in (INSTALL_SCRIPT): ditto
+
* src/BufferView.h: add a magic "friend" declaration to please
compaq cxx.
[Define this if you have the kpsewhich program working on your system.])
fi
+# Work around a problem in automake 1.4: when invoking install-strip,
+# INSTALL_PROGRAM is changed to 'install -s', and since
+# INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
+# which returns an error condition when stripping fails.
+INSTALL_SCRIPT='${INSTALL}'
+
### we will also need a C compiler to compile GNU gettext
AC_PROG_CC
--- /dev/null
+/* XPM */
+static char const * redo_bw_xpm[] = {
+"20 20 2 1",
+" c #BFBFBFBFBFBF",
+". c black",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ...... ",
+" .. .. ",
+" .. .. . ",
+" .. .. .. ",
+" .. .... ",
+" . .... ",
+" ..... ",
+" ...... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
--- /dev/null
+/* XPM */
+static char const * undo_bw_xpm[] = {
+"20 20 2 1",
+" c #BFBFBFBFBFBF",
+". c black",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ...... ",
+" .. .. ",
+" . .. .. ",
+" .. .. .. ",
+" .... .. ",
+" .... . ",
+" ..... ",
+" ...... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
# This is the default in LyX (exactly what LaTeX does):
#\screen_font_sizes 5.0 7.0 8.0 9.0 10.0 12.0 14.4 17.28 20.74 24.88
+# To change the colors for footnotes:
+#\set_color footnote green
+# for mathed you may also want to change the coloring of lines and brackets:
+#\set_color math yellow
+#\set_color mathlines yellow
+
#
# TOOLBAR SECTION ########################################################
#
LYX_DIR=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
AC_SUBST(LYX_DIR)
+# Work around a problem in automake 1.4: when invoking install-strip,
+# INSTALL_PROGRAM is changed to 'install -s', and since
+# INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
+# which returns an error condition when stripping fails.
+INSTALL_SCRIPT='${INSTALL}'
+
dnl Checks for programs.
AC_PROG_INSTALL
RELYX_CHECK_PERL
GCCapStyle | GCJoinStyle | GCFunction, &val);
}
+// update GC cache after color redefinition
+void LyXColorHandler::updateColor (LColor::color c)
+{
+ // color GC cache
+ GC gc = colorGCcache[c];
+ if (gc != NULL) {
+ XFreeGC(display, gc);
+ colorGCcache[c] = NULL;
+ getGCForeground(c);
+ }
+
+ // line GC cache
+
+ int index, ls, lw;
+ for (ls=0; ls<3; ++ls)
+ for (lw=0; lw<2; ++lw) {
+ index = lw + (ls << 1) + (c << 3);
+ if (lineGCcache.find(index) != lineGCcache.end()) {
+ gc = lineGCcache[index];
+ XFreeGC(display,gc);
+ lineGCcache.erase(index);
+ getGCLinepars(PainterBase::line_style(ls),
+ PainterBase::line_width(lw), c);
+ }
+ }
+
+}
+
//
LyXColorHandler * lyxColorHandler;
///
GC getGCLinepars(PainterBase::line_style,
PainterBase::line_width, LColor::color c);
+ /// update the cache after a color definition change
+ void updateColor(LColor::color c);
+
private:
///
Display * display;
#include "gettext.h"
#include "support/lstrings.h"
+using std::endl;
void LColor::fill(LColor::color col, string const & gui,
string const & latex, string const & x11,
}
+bool LColor::setColor(string const & lyxname, string const & x11name)
+{
+ color col = getFromLyXName (lyxname);
+
+ // "inherit" is returned for colors not in the database
+ // (and anyway should not be redefined)
+ if (col == inherit || col == ignore) {
+ lyxerr << "Color " << lyxname << " is undefined or may not be"
+ " redefined" << endl;
+ return false;
+ }
+ setColor (col, x11name);
+ return true;
+}
+
+
LColor::color LColor::getFromGUIName(string const & guiname) const
{
InfoTab::const_iterator ici = infotab.begin();
LColor();
///
void setColor(LColor::color col, string const & x11name);
+ ///
+ bool setColor(string const & lyxname, string const & x11name);
/// Get GUI name of color
string getGUIName(LColor::color c) const;
{ LFUN_UPCASE_WORD, "word-upcase", "", Noop },
{ LFUN_DATE_INSERT, "date-insert", "", Noop },
{ LFUN_PARAGRAPH_SPACING, "paragraph-spacing", "", Noop },
+ { LFUN_SET_COLOR, "set-color", "", Noop },
{ LFUN_NOACTION, "", "", Noop }
};
LFUN_LOFVIEW, // Dekel 20000519
LFUN_LOTVIEW, // Dekel 20000519
LFUN_LOAVIEW, // Dekel 20000519
+ LFUN_SET_COLOR, // SLior 20000611
LFUN_INSET_EXTERNAL, // Alstrup 20000609
LFUN_LASTACTION /* this marks the end of the table */
};
#include "kbmap.h"
#include "lyxfunc.h"
#include "bufferlist.h"
+#include "ColorHandler.h"
#include "lyxserver.h"
#include "lyx.h"
#include "intl.h"
}
break;
+ case LFUN_SET_COLOR:
+ {
+ string lyx_name, x11_name;
+ x11_name = split(argument, lyx_name, ' ');
+ if (lyx_name.empty() || x11_name.empty()) {
+ LyXBell();
+ setErrorMessage(N_("Syntax: set-color <lyx_name>"
+ " <x11_name>"));
+ break;
+ }
+
+ if (!lcolor.setColor(lyx_name, x11_name)) {
+ static string err1 (N_("Set-color \""));
+ static string err2 (N_("\" failed - color is undefined "
+ "or may not be redefined"));
+ LyXBell();
+ setErrorMessage(err1 + lyx_name + err2);
+ break;
+ }
+ lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
+ owner->view()->redraw();
+ break;
+ }
+
case LFUN_UNKNOWN_ACTION:
{
if(!owner->buffer()) {
RC_SCREEN_FONT_POPUP,
RC_SCREEN_FONT_ENCODING,
RC_SCREEN_FONT_ENCODING_MENU,
+ RC_SET_COLOR,
RC_AUTOSAVE,
RC_DOCUMENTPATH,
RC_TEMPLATEPATH,
{ "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER },
{ "\\screen_zoom", RC_SCREEN_ZOOM },
{ "\\serverpipe", RC_SERVERPIPE },
+ { "\\set_color", RC_SET_COLOR },
{ "\\show_banner", RC_SHOW_BANNER },
{ "\\spell_command", RC_SPELL_COMMAND },
{ "\\tempdir_path", RC_TEMPDIRPATH },
font_norm_menu = lexrc.GetString();
break;
+ case RC_SET_COLOR:
+ {
+ string lyx_name, x11_name;
+
+ if (lexrc.lex() == LyXLex::LEX_DATA) {
+ lyx_name = lexrc.GetString();
+ } else {
+ lexrc.printError("Bad color tag: `$$Token'");
+ break;
+ }
+
+ if (lexrc.lex() == LyXLex::LEX_DATA) {
+ x11_name = lexrc.GetString();
+ } else {
+ lexrc.printError("Bad color name: `$$Token'");
+ break;
+ }
+
+ if (!lcolor.setColor(lyx_name, x11_name))
+ lyxerr << "Bad lyxrc set_color for "
+ << lyx_name << endl;
+
+ break;
+ }
case RC_AUTOREGIONDELETE:
// Auto region delete defaults to true
if (lexrc.next())
if ( lexrc.next())
docbook_to_pdf_command = lexrc.GetString();
break;
+
case RC_LAST: break; // this is just a dummy
}
}
// bind files are not done here.
case RC_BEGINTOOLBAR:
// Toolbar is not written here (yet).
+ case RC_SET_COLOR:
+ // color bindings not written to preference file.
case RC_FONT_ENCODING:
os << "\\font_encoding \"" << fontenc << "\"\n";
case RC_PRINTER: