+
+// update GC cache after color redefinition
+void LyXColorHandler::updateColor (LColor::color c)
+{
+ // color GC cache
+ GC gc = colorGCcache[c];
+ if (gc != 0) {
+ XFreeGC(display, gc);
+ colorGCcache[c] = NULL;
+ getGCForeground(c);
+ }
+
+ // line GC cache
+
+ for (int ls = 0; ls < 3; ++ls)
+ for (int lw = 0; lw < 2; ++lw) {
+ int const index = lw + (ls << 1) + (c << 6);
+ 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);
+ }
+ }
+
+}
+