mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
better font and language handling for ert compability reading
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3170 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dd51f5a487
commit
c307b3bd88
@ -1,5 +1,8 @@
|
||||
2001-12-08 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* buffer.C (insertErtContents): try to handle font and language
|
||||
interaction a bit better.
|
||||
|
||||
* ColorHandler.C (updateColor): change the hash to cover the whole
|
||||
LColor enum, ws cleanup
|
||||
(getGCLinepars): ditto
|
||||
|
@ -108,12 +108,13 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
|
||||
// the color closest to the one we want.
|
||||
Visual * vi = DefaultVisual(display, DefaultScreen(display));
|
||||
|
||||
XColor * cmap = new XColor[vi->map_entries];
|
||||
//XColor * cmap = new XColor[vi->map_entries];
|
||||
boost::scoped_array<XColor> cmap(new XColor[vi->map_entries]);
|
||||
|
||||
for (int i = 0; i < vi->map_entries; ++i) {
|
||||
cmap[i].pixel = i;
|
||||
}
|
||||
XQueryColors(display, colormap, cmap, vi->map_entries);
|
||||
XQueryColors(display, colormap, cmap.get(), vi->map_entries);
|
||||
|
||||
// Walk through the cmap and look for close colors.
|
||||
int closest_pixel = 0;
|
||||
@ -153,7 +154,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
|
||||
<< _("Pixel [") << closest_pixel << _("] is used.")
|
||||
<< endl;
|
||||
val.foreground = cmap[closest_pixel].pixel;
|
||||
delete[] cmap;
|
||||
//delete[] cmap;
|
||||
}
|
||||
|
||||
val.function = GXcopy;
|
||||
@ -228,10 +229,11 @@ void LyXColorHandler::updateColor (LColor::color c)
|
||||
for (int ls = 0; ls < 3; ++ls)
|
||||
for (int lw = 0; lw < 2; ++lw) {
|
||||
int const index = lw + (ls << 1) + (c << 6);
|
||||
if (lineGCcache.find(index) != lineGCcache.end()) {
|
||||
gc = lineGCcache[index];
|
||||
XFreeGC(display,gc);
|
||||
lineGCcache.erase(index);
|
||||
LineGCCache::iterator it = lineGCcache.find(index);
|
||||
if (it != lineGCcache.end()) {
|
||||
gc = it->second;
|
||||
XFreeGC(display, gc);
|
||||
lineGCcache.erase(it);
|
||||
getGCLinepars(PainterBase::line_style(ls),
|
||||
PainterBase::line_width(lw), c);
|
||||
}
|
||||
|
@ -16,13 +16,13 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "TextCache.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferlist.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using std::ostream;
|
||||
using std::for_each;
|
||||
using std::remove_if;
|
||||
|
@ -18,13 +18,14 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
|
||||
#include "LString.h"
|
||||
#include "lyxtext.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
|
||||
|
||||
// This is only the very first implemetation and use of the TextCache,
|
||||
// operations on it needs to be put into a class or a namespace, that part
|
||||
// is _NOT_ finished so don't bother to come with too many comments on it
|
||||
|
53
src/buffer.C
53
src/buffer.C
@ -14,24 +14,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <list>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef HAVE_LOCALE
|
||||
#include <locale>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
@ -107,6 +89,25 @@
|
||||
#include "ParagraphParameters.h"
|
||||
#include "iterators.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <list>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef HAVE_LOCALE
|
||||
#include <locale>
|
||||
#endif
|
||||
|
||||
|
||||
using std::ostream;
|
||||
using std::ofstream;
|
||||
using std::ifstream;
|
||||
@ -188,7 +189,7 @@ Buffer::~Buffer()
|
||||
|
||||
string const Buffer::getLatexName(bool no_path) const
|
||||
{
|
||||
string name = ChangeExtension(MakeLatexName(filename), ".tex");
|
||||
string const name = ChangeExtension(MakeLatexName(filename), ".tex");
|
||||
if (no_path)
|
||||
return OnlyFilename(name);
|
||||
else
|
||||
@ -245,7 +246,8 @@ void Buffer::setReadonly(bool flag)
|
||||
// Should work on a list
|
||||
void Buffer::updateTitles() const
|
||||
{
|
||||
if (users) users->owner()->updateWindowTitle();
|
||||
if (users)
|
||||
users->owner()->updateWindowTitle();
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +255,8 @@ void Buffer::updateTitles() const
|
||||
// Should work on a list
|
||||
void Buffer::resetAutosaveTimers() const
|
||||
{
|
||||
if (users) users->owner()->resetAutosaveTimer();
|
||||
if (users)
|
||||
users->owner()->resetAutosaveTimer();
|
||||
}
|
||||
|
||||
|
||||
@ -388,12 +391,14 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
|
||||
|
||||
#ifndef NO_COMPABILITY
|
||||
void Buffer::insertErtContents(Paragraph * par, int & pos,
|
||||
LyXFont const & font, bool set_inactive)
|
||||
LyXFont const & f, bool set_inactive)
|
||||
{
|
||||
if (!ert_comp.contents.empty()) {
|
||||
lyxerr[Debug::INSETS] << "ERT contents:\n"
|
||||
<< ert_comp.contents << endl;
|
||||
lyxerr[Debug::INSETS] << "ERT contents:\n'"
|
||||
<< ert_comp.contents << "'" << endl;
|
||||
Inset * inset = new InsetERT(ert_comp.contents, true);
|
||||
LyXFont font;
|
||||
font.setLanguage(f.language());
|
||||
par->insertInset(pos++, inset, font);
|
||||
ert_comp.contents.erase();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user