mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Lior's color patch; other small things
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@837 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e80ad470cb
commit
802d3221e0
1
ANNOUNCE
1
ANNOUNCE
@ -60,6 +60,7 @@ with mirrors at
|
||||
|
||||
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/
|
||||
|
22
ChangeLog
22
ChangeLog
@ -1,3 +1,18 @@
|
||||
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.
|
||||
@ -9,6 +24,13 @@
|
||||
|
||||
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.
|
||||
|
||||
|
@ -42,6 +42,12 @@ if test "x$KPSEWHICH" = xkpsewhich ; then
|
||||
[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
|
||||
|
||||
|
25
images/redo_bw.xpm
Normal file
25
images/redo_bw.xpm
Normal file
@ -0,0 +1,25 @@
|
||||
/* XPM */
|
||||
static char const * redo_bw_xpm[] = {
|
||||
"20 20 2 1",
|
||||
" c #BFBFBFBFBFBF",
|
||||
". c black",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ...... ",
|
||||
" .. .. ",
|
||||
" .. .. . ",
|
||||
" .. .. .. ",
|
||||
" .. .... ",
|
||||
" . .... ",
|
||||
" ..... ",
|
||||
" ...... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
25
images/undo_bw.xpm
Normal file
25
images/undo_bw.xpm
Normal file
@ -0,0 +1,25 @@
|
||||
/* XPM */
|
||||
static char const * undo_bw_xpm[] = {
|
||||
"20 20 2 1",
|
||||
" c #BFBFBFBFBFBF",
|
||||
". c black",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ...... ",
|
||||
" .. .. ",
|
||||
" . .. .. ",
|
||||
" .. .. .. ",
|
||||
" .... .. ",
|
||||
" .... . ",
|
||||
" ..... ",
|
||||
" ...... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
@ -255,6 +255,12 @@
|
||||
# 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 ########################################################
|
||||
#
|
||||
|
@ -26,6 +26,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
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
|
||||
|
@ -195,5 +195,33 @@ GC LyXColorHandler::getGCLinepars(PainterBase::line_style ls,
|
||||
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;
|
||||
|
@ -42,6 +42,9 @@ public:
|
||||
///
|
||||
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;
|
||||
|
17
src/LColor.C
17
src/LColor.C
@ -22,6 +22,7 @@
|
||||
#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,
|
||||
@ -171,6 +172,22 @@ void LColor::setColor(LColor::color col, string const & x11name)
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
@ -173,6 +173,8 @@ public:
|
||||
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;
|
||||
|
||||
|
@ -393,6 +393,7 @@ void LyXAction::init()
|
||||
{ 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 }
|
||||
};
|
||||
|
||||
|
@ -253,6 +253,7 @@ enum kb_action {
|
||||
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 */
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ using std::istringstream;
|
||||
#include "kbmap.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "bufferlist.h"
|
||||
#include "ColorHandler.h"
|
||||
#include "lyxserver.h"
|
||||
#include "lyx.h"
|
||||
#include "intl.h"
|
||||
@ -2601,6 +2602,30 @@ string LyXFunc::Dispatch(int ac,
|
||||
}
|
||||
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()) {
|
||||
|
29
src/lyxrc.C
29
src/lyxrc.C
@ -85,6 +85,7 @@ enum LyXRCTags {
|
||||
RC_SCREEN_FONT_POPUP,
|
||||
RC_SCREEN_FONT_ENCODING,
|
||||
RC_SCREEN_FONT_ENCODING_MENU,
|
||||
RC_SET_COLOR,
|
||||
RC_AUTOSAVE,
|
||||
RC_DOCUMENTPATH,
|
||||
RC_TEMPLATEPATH,
|
||||
@ -250,6 +251,7 @@ keyword_item lyxrcTags[] = {
|
||||
{ "\\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 },
|
||||
@ -837,6 +839,30 @@ int LyXRC::read(string const & filename)
|
||||
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())
|
||||
@ -1043,6 +1069,7 @@ int LyXRC::read(string const & filename)
|
||||
if ( lexrc.next())
|
||||
docbook_to_pdf_command = lexrc.GetString();
|
||||
break;
|
||||
|
||||
case RC_LAST: break; // this is just a dummy
|
||||
}
|
||||
}
|
||||
@ -1101,6 +1128,8 @@ void LyXRC::output(ostream & os) const
|
||||
// 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:
|
||||
|
Loading…
Reference in New Issue
Block a user