]> git.lyx.org Git - lyx.git/blobdiff - src/ColorHandler.C
Dekel's patch -- I didn't fix the xforms-0.88 keysyms stuff so it still doesn't finis...
[lyx.git] / src / ColorHandler.C
index 5b2571fbdd1b6f6ace0565a06c429dc5ba5c2c63..ce6410a5b0ab7c172f0353ca40e8b36db2e2a259 100644 (file)
@@ -195,5 +195,34 @@ 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;