void EscDraw::DrawSmartText(EscEscape& e) { if(e.GetCount() < 3 || e.GetCount() > 7) e.ThrowError("wrong number of arguments in call to 'DrawSmartText'"); int x = e.Int(0); int y = e.Int(1); int ii = 2; String text; if(ii < e.GetCount() && e[ii].IsArray()) text = ToUtf8((WString)e[ii++]); int accesskey = ExtractAccessKey(text, text); Font font = StdFont().Height(11); if(ii < e.GetCount()) font = FontEsc(e[ii++]); if(font.GetHeight() == 0) #ifdef GUI_X11 font.Height(12); #else font.Height(11); #endif Color color = SColorText; if(ii < e.GetCount()) color = ColorEsc(e[ii++]); int cx = INT_MAX; if(ii < e.GetCount()) cx = e.Int(ii++); ::DrawSmartText(w, x, y, cx, text, font, color, accesskey); }
void EscDraw::DrawText(EscEscape& e) { if(e.GetCount() < 3 || e.GetCount() > 6) e.ThrowError("wrong number of arguments in call to 'DrawText'"); int x = e.Int(0); int y = e.Int(1); Font font = StdFont(); Color color = SColorText; if(e[2].IsInt()) { int z = e.Int(2); e.CheckArray(3); WString text = e[3]; if(e.GetCount() > 4) font = FontEsc(e[4]); if(e.GetCount() > 5) color = ColorEsc(e[5]); w.DrawText(x, y, z, text, Nvl(font, StdFont()), color); } else { e.CheckArray(2); WString text = e[2]; if(e.GetCount() > 3) font = FontEsc(e[3]); if(e.GetCount() > 4) color = ColorEsc(e[4]); w.DrawText(x, y, text, Nvl(font, StdFont()), color); } }
void EscDraw::DrawLine(EscEscape& e) { if(e.GetCount() == 4) w.DrawLine(PointEsc(e[0]), PointEsc(e[1]), e.Int(2), ColorEsc(e[3])); else if(e.GetCount() == 6) w.DrawLine(e.Int(0), e.Int(1), e.Int(2), e.Int(3), e.Int(4), ColorEsc(e[5])); else e.ThrowError("wrong number of arguments in call to 'DrawLine'"); }
void EscDraw::DrawRect(EscEscape& e) { if(e.GetCount() == 2) w.DrawRect(RectEsc(e[0]), ColorEsc(e[1])); else if(e.GetCount() == 5) w.DrawRect(e.Int(0), e.Int(1), e.Int(2), e.Int(3), ColorEsc(e[4])); else e.ThrowError("wrong number of arguments in call to 'DrawRect'"); }
void SIC_Print(EscEscape& e) { if(e[0].IsArray()) Cout() << (String) e[0]; else if(e[0].IsNumber()) Cout() << e[0].GetNumber(); else if(!e[0].IsVoid()) e.ThrowError("invalid argument to 'Print'"); }
void SIC_GetTextSize(EscEscape& e) { if(e.GetCount() < 1 || e.GetCount() > 2) e.ThrowError("wrong number of arguments in call to 'GetTextSize'"); e.CheckArray(0); WString text = e[0]; Font font = StdFont(); if(e.GetCount() > 1) font = FontEsc(e[1]); e = EscSize(GetTextSize(text, font)); }
void SIC_GetSmartTextSize(EscEscape& e) { if(e.GetCount() < 1 || e.GetCount() > 2) e.ThrowError("wrong number of arguments in call to 'GetTextSize'"); e.CheckArray(0); String text = ToUtf8((WString)(e[0])); ExtractAccessKey(text, text); Font font = StdFont(); if(e.GetCount() > 1) font = FontEsc(e[1]); e = EscSize(GetSmartTextSize(text, font)); }
void EscDraw::DrawQtf(EscEscape& e) { if(e.GetCount() < 5 || e.GetCount() > 6) e.ThrowError("wrong number of arguments in call to 'DrawQtf'"); // int zoom = e.Int(0); int x = e.Int(1); int y = e.Int(2); e.CheckArray(3); WString text = e[3]; int cx = e.Int(4); String txt = '\1' + ToUtf8(text); ::DrawSmartText(w, x, y, cx, txt, StdFont(), SColorText, 0); }
void ESC_cout(EscEscape& e) { if(e[0].IsArray()) PutConsole((String) e[0]); else if(e[0].IsNumber()) { String str; str << e[0].GetNumber(); PutConsole(str); } else if(!e[0].IsVoid()) e.ThrowError("invalid argument to 'cout'" + e.DumpType(0)); }
void EscDraw::DrawImage(EscEscape& e) { int cnt = e.GetCount(); if(cnt == 2) w.DrawImage(RectEsc(e[0]), GetUscImage((String)e[1])); else if(cnt == 3) w.DrawImage(e.Int(0), e.Int(1), GetUscImage((String)e[2])); else if(cnt == 5) w.DrawImage(e.Int(0), e.Int(1), e.Int(2), e.Int(3), GetUscImage((String)e[4])); else e.ThrowError("wrong number of arguments in call to 'DrawImage'"); }
void EscDraw::DrawImageColor(EscEscape& e) { int cnt = e.GetCount(); if(cnt != 4 && cnt != 5 && cnt != 7) e.ThrowError("wrong number of arguments in call to 'DrawImageColor'"); Image img = Colorize(GetUscImage((String)e[cnt - 3]), ColorEsc(e[cnt - 2]), e.Int(cnt - 1)); if(cnt == 4) w.DrawImage(RectEsc(e[0]), img); else if(cnt == 5) w.DrawImage(e.Int(0), e.Int(1), img); else if(cnt == 7) w.DrawImage(e.Int(0), e.Int(1), e.Int(2), e.Int(3), img); }
void EscDraw::GetTextSize(EscEscape& e) { if(e.GetCount() < 1 || e.GetCount() > 2) e.ThrowError("wrong number of arguments in call to 'GetTextSize'"); e.CheckArray(0); WString text = e[0]; Font font = StdFont(); if(font.GetHeight() == 0) #ifdef GUI_X11 font.Height(12); #else font.Height(11); #endif if(e.GetCount() > 1) font = FontEsc(e[1]); e = EscSize(::GetTextSize(text, font)); }