コード例 #1
0
ファイル: GeoLaTeXCache.java プロジェクト: avilleret/geogebra
 public void remove() {
   if (keyLaTeX != null)
     try {
       JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
     } catch (Exception ee) {
       ee.printStackTrace();
     }
 }
コード例 #2
0
ファイル: GeoLaTeXCache.java プロジェクト: avilleret/geogebra
  public Object getCachedLaTeXKey(
      String latex, int fontSize, int style, ColorAdapter fgColorAdapter) {
    Object newKey;
    try {

      newKey =
          JLaTeXMathCache.getCachedTeXFormula(
              latex,
              TeXConstants.STYLE_DISPLAY,
              style,
              fontSize,
              1 /* inset around the label*/,
              (AwtColorAdapter) fgColorAdapter);
    } catch (ParseException e) {
      if (keyLaTeX != null) {
        // remove old key from cache
        try {
          JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
        } catch (Exception ee) {
          ee.printStackTrace();
        }
      }
      throw e;
    }
    if (keyLaTeX != null && !keyLaTeX.equals(newKey)) {
      // key has changed, remove old key from cache
      try {
        JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
      } catch (Exception ee) {
        ee.printStackTrace();
      }
      // Application.debug("removing");
    }

    keyLaTeX = newKey;
    return keyLaTeX;
  }