# PrescrComs

name: Вакуум
arg1: Давление
proc:
JavaLikeCalc.JavaScript
SYS.DAQ.ModBus.PLC1.VP5.com.set(false);
if(SYS.DAQ.ModBus.PLC1.P.var.get() < arg1.toReal()) rez = true;


name: VF
arg1: Положение VF
arg2: Давление
proc:
JavaLikeCalc.JavaScript
SYS.DAQ.ModBus.PLC1.VF.varIn.set(arg1);
if(SYS.DAQ.ModBus.PLC1.VF.var.get() > (arg1.toReal()*0.99) && 
  SYS.DAQ.ModBus.PLC1.VF.var.get() < (arg1.toReal()*1.01) &&
  SYS.DAQ.ModBus.PLC1.P.var.get() > (arg2.toReal()*0.99) &&
  SYS.DAQ.ModBus.PLC1.P.var.get() < (arg2.toReal()*1.01)) rez = true;


name: Канал газонапуска
arg1: Канал (1...4)
arg2: Задание расхода
proc:
JavaLikeCalc.JavaScript
var cnl = arg1.toInt();
if(cnl < 1 || cnl > 4) { rez = -1; return; }
SYS.DAQ.ModBus.PLC1["VP"+(5+cnl)].com.set(true);
SYS.DAQ.ModBus.PLC1["VF"+cnl].varIn.set(arg2);
if(SYS.DAQ.ModBus.PLC1["VF"+cnl].var.get() > (arg2.toReal()*0.99) && 
  SYS.DAQ.ModBus.PLC1["VF"+cnl].var.get() < (arg2.toReal()*1.01)) rez = true;


name: Генератор плазмы
arg1: Мощность
arg2: Доза
arg3: Обнулять дозу
proc:
JavaLikeCalc.JavaScript
if(f_start && arg3.toInt()) SYS.DAQ.ModBus.PLC1.Pint_GVCH1.com.set(false);
SYS.DAQ.ModBus.PLC1.gvch1.com2.set(true);
SYS.DAQ.ModBus.PLC1.gvch1.Psp.set(arg1);
if(SYS.DAQ.ModBus.PLC1.Pint_GVCH1.Pint.get() > arg3.toReal()) rez = true;


name: Стол
arg1: Мощность
arg2: Доза
arg3: Обнулять дозу
proc:
JavaLikeCalc.JavaScript
if(f_start && arg3.toInt()) SYS.DAQ.ModBus.PLC1.Pint_GVCH2.com.set(false);
SYS.DAQ.ModBus.PLC1.gvch2.com2.set(true);
SYS.DAQ.ModBus.PLC1.gvch2.Psp.set(arg1);
if(SYS.DAQ.ModBus.PLC1.Pint_GVCH2.Pint.get() > arg3.toReal()) rez = true;


name: Таймер
arg1: Время (с)
proc:
JavaLikeCalc.JavaScript
if(f_start) tmp1 = arg1;
var curTm = tmp1.toReal();
if(curTm <= 0) { rez = "1:Wait elapsed for "+arg1+"s"; return; }
curTm -= 1/f_frq;
tmp1 = max(0,curTm);
rez = "0:Wait now for "+curTm+"s";


name: Атмосфера
proc:
JavaLikeCalc.JavaScript
SYS.DAQ.ModBus.PLC1.VP5.com.set(true);
if(SYS.DAQ.ModBus.PLC1.P.var.get() == 1e5 || SYS.DAQ.ModBus.PLC1.SI12.var.get() == false) rez = true;


# PrescrProgs

name: Тест
prgTxt:
<prg wtm="35"><com arg1="10" arg2="0" arg3="0" arg4="0" arg5="0" id="Таймер" /><com arg1="15" arg2="0" arg3="0" arg4="0" arg5="0" id="Фоновий таймер" /><com arg1="20" arg2="0" arg3="0" arg4="0" arg5="0" id="Таймер" /></prg>


# VCAPrjs

ID: tmplSO
NAME: Signal groups (template)
DESCR: The projects' template of visualisation based on signal groups.
DB_TBL: prj_tmplSO
USER: roman
GRP: users
uk#NAME: Групи сигналізації (шаблон)
uk#DESCR: Шаблон проекту візуалізації, який базовано на групах сигналізації.
ru#NAME: Группы сигнализаций (шаблон)
ru#DESCR: Шаблон проекта визуализации основанного на группах сигнализации.
ICO:


ID: archBrowser
NAME: Archives browser
DB_TBL: prj_archBrowser
USER: root
GRP: UI
uk#NAME: Огляд архівів
ru#NAME: Обзор архивов
ICO:


# prj_archBrowser

OWNER: /archBrowser/control
ID: ElCadr
PARENT: /wlb_Main/wdg_ElCadr
ATTRS:
pgGrp;digComs;digStts;max;min;prmAMax;prmAMin;prmAnalog;prmAuto;prmCasc;prmClose;prmCloseSt;prmColor;prmCom;prmDemention;prmDescr;prmId;prmImpQdwnTm;prmImpQupTm;prmManIn;prmOpenSt;prmOut;prmPrec;prmShifr;prmSp;prmStop;prmVar;prmVarIn;prmWMax;prmWMin;


OWNER: /archBrowser
ID: so
PARENT: /wlb_Main/wdg_RootPgSo
ATTRS: geomH;pgOpen;
PROC:
JavaLikeCalc.JavaScript
if(lastView != pgCont_pgOpenSrc)
{
	//> Pages counter display
	if(pgCont_pgOpenSrc.length)
	{
		elLst = this["pg_1"]["pg_ggraph"].nodeList("pg_");
		curEl = pgCont_pgOpenSrc.parsePath(4);
		for(i_m = 0; i_m < elLst.length; i_m++) if(elLst[i_m] == curEl) break;
		pgCntr_text = ""+(i_m+1)+"\n("+elLst.length+")";
		prev_active = next_active = (elLst.length>1);
	}
	else { pgCntr_text = "-"; prev_active = next_active = false; }
	lastView = pgCont_pgOpenSrc;
}


# prj_tmplSO

OWNER: /tmplSO/control
ID: cntrRegul
PARENT: /wlb_Main/wdg_cntrRegul
ATTRS:
DESCR;Hdwn;Hup;K1;K2;K3;K4;Kp;NAME;SHIFR;Td;Ti;Zi;ed;max;min;out;out_addr;sp;sp_addr;var;var_addr;KImpRfact;Kd;Ki;TImpMin;TImpPer;Tzd;auto_addr;impQdwn_addr;impQup_addr;prec;


# prj_tmplSO_incl

IDW: /prj_tmplSO/pg_so/pg_1/pg_gcadr/pg_1
ID: el1
PARENT: /prj_tmplSO/pg_so/pg_1/pg_gcadr/wdg_el1
ATTRS:
digComs;digStts;max;min;prmAMax;prmAMin;prmAnalog;prmAuto;prmCasc;prmClose;prmCloseSt;prmCom;prmDemention;prmDescr;prmId;prmImpQdwnTm;prmImpQupTm;prmManIn;prmOpenSt;prmOut;prmPrec;prmShifr;prmSp;prmStop;prmVar;prmWMax;prmWMin;prmAddr;


IDW: /prj_tmplSO/pg_so/pg_rg/pg_rg/pg_1
ID: e1
PARENT: /prj_tmplSO/pg_so/pg_rg/pg_rg/wdg_e1
ATTRS:
p1_addr;p1_clr;p1_max;p1_min;p1_name;p2_addr;p2_max;p2_min;p2_name;p3_addr;p3_max;p3_min;p3_name;p4_addr;p4_max;p4_min;p4_name;p5_addr;p5_max;p5_min;p5_name;title;


IDW: /prj_tmplSO/pg_so/pg_rg/pg_rg/pg_1
ID: e2
PARENT: /prj_tmplSO/pg_so/pg_rg/pg_rg/wdg_e2
ATTRS:
p1_addr;p1_max;p1_min;p1_name;p2_addr;p2_max;p2_min;p2_name;p3_addr;p3_max;p3_min;p3_name;p4_addr;p4_max;p4_min;p4_name;title;


# prj_tmplSO_io

IDW: /prj_tmplSO/pg_so
ID: evProc
IO_VAL:
ws_BtPress:/prev:prev:/pg_so/*/*/$
ws_BtPress:/next:next:/pg_so/*/*/$
ws_BtPress:/go_mn:open:/pg_so/*/mn/*
ws_BtPress:/go_graph:open:/pg_so/*/ggraph/*
ws_BtPress:/go_cadr:open:/pg_so/*/gcadr/*
ws_BtPress:/go_view:open:/pg_so/*/gview/*
ws_BtPress:/go_doc:open:/pg_so/*/doc/*
ws_BtPress:/go_resg:open:/pg_so/rg/rg/*
ws_BtPress:/so1:open:/pg_so/1/*/*
ws_BtPress:/so2:open:/pg_so/2/*/*
ws_BtPress:/so3:open:/pg_so/3/*/*
ws_BtPress:/so4:open:/pg_so/4/*/*
ws_BtPress:/so5:open:/pg_so/5/*/*
ws_BtPress:/so6:open:/pg_so/6/*/*
ws_BtPress:/so7:open:/pg_so/7/*/*
ws_BtPress:/so8:open:/pg_so/8/*/*
ws_BtPress:/so9:open:/pg_so/9/*/*
ws_BtPress:*:open:/pg_control/pg_terminator


IDW: /prj_tmplSO/pg_so/pg_1/pg_ggraph
ID: evProc
IO_VAL:
ws_FocusIn:/trnd1:open:/pg_control/pg_grph_panel
ws_FocusIn:/el1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el7:open:/pg_control/pg_ElCadr
ws_FocusIn:/el8:open:/pg_control/pg_ElCadr

uk#IO_VAL:
ws_FocusIn:/trnd1:open:/pg_control/pg_grph_panel
ws_FocusIn:/el1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el7:open:/pg_control/pg_ElCadr
ws_FocusIn:/el8:open:/pg_control/pg_ElCadr

ru#IO_VAL:
ws_FocusIn:/trnd1:open:/pg_control/pg_grph_panel
ws_FocusIn:/el1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el7:open:/pg_control/pg_ElCadr
ws_FocusIn:/el8:open:/pg_control/pg_ElCadr


IDW: /prj_tmplSO/pg_so/pg_1/pg_gview
ID: evProc
IO_VAL:
ws_FocusIn:/el1_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_6:open:/pg_control/pg_ElCadr

uk#IO_VAL:
ws_FocusIn:/el1_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_6:open:/pg_control/pg_ElCadr

ru#IO_VAL:
ws_FocusIn:/el1_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el1_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el2_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el3_6:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_1:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_2:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_3:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_4:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_5:open:/pg_control/pg_ElCadr
ws_FocusIn:/el4_6:open:/pg_control/pg_ElCadr


# wlb_Main

ID: ElCadr
PARENT: /wlb_originals/wdg_Box
ATTRS: path;name;active;geomW;geomH;evProc;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
ev_wrk = ev_rez = "";
off = 0;

if(!prmColor.isEVal()) { bordColor = prmColor; bordWidth = 2; }
else { bordColor = "black"; bordWidth = 1; } 

//> Disable all mutable widgets
info_ed_en = info_var_en = info_sp_en = info_out_en = up_en = upm_en = down_en = downm_en = lev_out_en = lev_var_en = lev_sp_en = mode_en = modMan_en = modAuto_en =
    modCasc_en = pnl_pid_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = 
    com_open_en = com_stop_en = com_close_en = st_open_en = st_close_en = Ramka_en = moveUp_en = moveDwn_en = false;

info_name_text = prmShifr.isEVal() ? "" : prmShifr;

//>Impulse processing
if(!prmAnalog.isEVal() && prmAnalog == false)
{  
  lev_out_en = info_out_en = false; 
  moveUp_en = moveDwn_en = true; 
  moveUp_fillColor = (!prmImpQupTm.isEVal() && prmImpQupTm) ? "cyan" : "black-0"; 
  moveDwn_fillColor = (!prmImpQdwnTm.isEVal() && prmImpQdwnTm) ? "cyan" : "black-0"; 
}

//> Check for analog
if(!prmVar.isEVal() || !prmVarIn.isEVal())
{
  info_ed_en = info_var_en = lev_var_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = true;
  info_ed_text = prmDemention.isEVal() ? "" : prmDemention;
  pVar = prmVar.isEVal() ? prmVarIn : prmVar;
  if(prmVarIn.isEVal()) info_var_bordWidth = 0;
  if(info_var_clearCnt <= 0) { info_var_arg0val = pVar; info_var_backColor = ""; } else info_var_clearCnt--; 
  lev_var_p1y = max(0,min(140,140*(1-(pVar-min)/(max-min))));
  info_var_arg0cfg = "10;f;"+(prmPrec.isEVal()?2:prmPrec);

  info_var_color = lev_var_c3 = "#3EFF3E";
  //> Warning borders process
  if(!prmWMin.isEVal() && !prmWMax.isEVal() && prmWMax > prmWMin)
  {
    lev_var_c2 = "yellow";
    lev_var_p6y = lev_var_p7y = 140*(1-(prmWMax-min)/(max-min));
    lev_var_p8y = lev_var_p9y = 140*(1-(prmWMin-min)/(max-min));
    if( pVar >= prmWMax || pVar <= prmWMin ) info_var_color = lev_var_c3 = "yellow";
  }
  else lev_var_c2 = "black-0";
  //> Alarm borders process
  if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin)
  {
    lev_var_c1 = "red";
    lev_var_p2y = lev_var_p3y = 140*(1-(prmAMax-min)/(max-min));
    lev_var_p4y = lev_var_p5y = 140*(1-(prmAMin-min)/(max-min));
    if( pVar >= prmAMax || pVar <= prmAMin ) info_var_color = lev_var_c3 = "red";
  }
  else lev_var_c1 = "black-0";
  //> EVAL
  if(pVar > max || pVar < min) info_var_color = lev_var_c3 = "lightgray";

  //>>Check an process PID regulator
  if(!prmVar.isEVal() && !prmSp.isEVal() && !prmOut.isEVal())
  {
    lev_out_en = info_out_en = (prmAnalog.isEVal() || prmAnalog == true);
    info_sp_en = lev_sp_en = mode_en = modMan_en = modAuto_en = pnl_pid_en = true;

    modCasc_en = !prmCasc.isEVal(); 
    up_en = upm_en = down_en = downm_en = (prmCasc != true);
    lev_out_p1y = 140*(1-prmOut/100);
    lev_sp_p1y = max(0,min(140,140*(1-(prmSp-min)/(max-min))));
    if(info_sp_clearCnt <= 0) { info_sp_arg0val = prmSp; info_sp_backColor = ""; } else info_sp_clearCnt--; 
    info_sp_arg0cfg = "10;f;"+((prmPrec==EVAL_INT)?2:prmPrec);
    if(info_out_clearCnt <= 0) { info_out_arg0val = prmOut; info_out_backColor = ""; } else info_out_clearCnt--;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      prevMode = prmAuto ? ((prmCasc==true)?"Cascad":"Automat") : "Manual";      
      if(ev_wrk == "ws_BtPress:/modMan" && prmAuto) 
      {  
        prmAuto = false; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Mode: "+prmDescr+" : "+prevMode+" : Manual");
      }
      else if(ev_wrk == "ws_BtPress:/modAuto" && (!prmAuto || prmCasc)) 
      {  
        prmAuto = true; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Mode : "+prmDescr+" : "+prevMode+" : Automat");
      }
      else if(ev_wrk == "ws_BtPress:/modCasc" && !prmCasc) 
      {  
        prmAuto = prmCasc = true;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Mode : "+prmDescr+" : "+prevMode+" : Cascad");
      }
      else if(ev_wrk == "key_mousePresLeft:/info_sp")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Setpoint : "+prmDescr+" : "+real2str(prmSp,prmPrec)+" : "+real2str(info_sp_arg0val,prmPrec) );
        prmSp = info_sp_arg0val; info_sp_backColor = ""; info_sp_clearCnt = 0;
      }
      else if(ev_wrk == "key_mousePresLeft:/info_out")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Output : "+prmDescr+" : "+real2str(prmManIn,1)+" : "+real2str(info_out_arg0val,1) );
        prmManIn = info_out_arg0val; info_out_backColor = ""; info_out_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else if(ev_wrk == "ws_BtPress:/pnl_pid")
      {
        sessNm = strParsePath(path,0);
        pidPg = "/"+sessNm + "/pg_so/"+vcaAttrGet("/"+sessNm+"/pg_so/wdg_pgCont/a_pgOpenSrc").parsePath(2)+"/pg_greg/pg_"+prmId;
        if( vcaNodePresent(pidPg) ) vcaAttrSet(pidPg+"/a_pgOpen",1);
        else ev_rez+= "usr_PidCntrCall\n"; 
      } 
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl && prmAuto)
    {
      if(prmPrec.isEVal()) newVl = ((info_sp_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_sp_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin ) newVl = max(prmAMin,min(prmAMax,newVl));
      info_sp_arg0val = newVl; info_sp_backColor = "darkslategray"; info_sp_clearCnt = 25;
    }
    else if(appToVl && !prmAuto)
    {
       if(prmAnalog==false)
       {
         prmManIn = 50+2.5*appToVl;
         if( appToVl == -1 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Output: "+prmDescr+" :: Close ( < )" );
         else if( appToVl == 1 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Output: "+prmDescr+" :: Open ( > )" );
         else if( appToVl == -10 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Output: "+prmDescr+" :: Close ( << )" );
         else if( appToVl == 10 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Output: "+prmDescr+" :: Open ( >> )" );
       }
       else
       {
         newVl = max(0,min(100,info_out_arg0val+appToVl));
         info_out_arg0val = newVl; info_out_backColor = "darkslategray"; info_out_clearCnt = 25;
      }
    }

    if(prmAuto && prmCasc) { mode_text = "Cascad"; info_sp_bordWidth = info_out_bordWidth = 0; }
    else if(prmAuto)
    {
      mode_text = "Automat";
      info_sp_bordWidth = 1; info_out_bordWidth = 0;
    }
    else
    {
      mode_text = "Manual";
      info_out_bordWidth = 1; info_sp_bordWidth = 0;
    }
  }
  //>> Manual variable input
  else if(!prmVarIn.isEVal())
  {
    up_en = upm_en = down_en = downm_en = true;
    info_var_bordWidth = 1;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      else if(ev_wrk == "key_mousePresLeft:/info_var")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Variable : "+prmDescr+" : "+real2str(prmVarIn,prmPrec)+" : "+real2str(info_var_arg0val,prmPrec) );
        prmVarIn = info_var_arg0val; info_var_backColor = ""; info_var_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl)
    {
      if(prmPrec.isEVal()) newVl = ((info_var_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_var_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin) newVl = max(prmAMin,min(prmAMax,newVl));
      info_var_arg0val = newVl; info_var_backColor = "darkslategray"; info_var_clearCnt = 25;
    }
  }
}
else if(!prmCom.isEVal() || !prmClose.isEVal() || !prmOpenSt.isEVal() || !prmCloseSt.isEVal())
{
  Ramka_en = true;
  com_open_en = com_close_en = (!prmCom.isEVal() || !prmClose.isEVal());
  st_open_en = st_close_en = (!prmOpenSt.isEVal() || !prmCloseSt.isEVal());
  com_stop_en = !prmStop.isEVal();

  if(com_open_en)
  {
    com_open_name = !digComs.isEVal() ? strParse(strParse(digComs,0,";"),0,"-") : "OPEN";
    com_open_color = (strParse(strParse(digComs,0,";"),1,"-") != "") ? strParse(strParse(digComs,0,";"),1,"-") : "green";
    com_open_tipTool = !digComs.isEVal() ? "Command "+strParse(strParse(digComs,0,";"),0,"-") : "Command OPEN";
    com_open_tipStatus = !digComs.isEVal() ? "Press for "+strParse(strParse(digComs,0,";"),0,"-") : "Press for OPEN";
    com_open_en = com_open_name.length;
  }
  if(com_close_en)
  {
    com_close_name  = !digComs.isEVal() ? strParse(strParse(digComs,1,";"),0,"-") : "CLOSE";
    com_close_color = (strParse(strParse(digComs,1,";"),1,"-") != "") ? strParse(strParse(digComs,1,";"),1,"-") : "red";
    com_close_tipTool = !digComs.isEVal() ? "Command "+strParse(strParse(digComs,1,";"),0,"-") : "Command CLOSE";
    com_close_tipStatus = !digComs.isEVal() ? "Press for "+strParse(strParse(digComs,1,";"),0,"-") : "Press for CLOSE";
    com_close_en = com_close_name.length;
  }
  if(com_stop_en)
  { 
    com_stop_name = com_close_tipTool = !digComs.isEVal() ? strParse(strParse(digComs,2,";"),0,"-") : "STOP";
    com_stop_color = (strParse(strParse(digComs,2,";"),1,"-") != "") ? strParse(strParse(digComs,2,";"),1,"-") : "yellow";
    com_close_tipTool = !digComs.isEVal() ? "Command "+strParse(strParse(digComs,2,";"),0,"-") : "Command STOP";
    com_close_tipStatus = !digComs.isEVal() ? "Press for "+strParse(strParse(digComs,2,";"),0,"-") : "Press for STOP";
    com_stop_en = com_stop_name.length;
  }
  if(st_open_en)
  { 
    st_open_text = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "OPEN";
    st_open_color = (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green";
    st_open_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "OPEN";
    st_open_tipStatus = !digStts.isEVal() ? "State "+strParse(strParse(digStts,0,";"),0,"-") : "State OPEN";
  }
  if(st_close_en)
  { 
    st_close_text = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "CLOSE";
    st_close_color = (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red";
    st_close_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "CLOSE";
    st_close_tipStatus = !digStts.isEVal() ? "State "+strParse(strParse(digStts,1,";"),0,"-") : "State CLOSE";
  }

  //Event process
  while(true)
  {
    ev_wrk = strParse(event,0,"\n",off);
    if(ev_wrk == "") break;
    else if(ev_wrk == "ws_BtPress:/com_open")
    {
      if(!prmCom.isEVal()) prmCom = true; prmClose = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Command : "+prmDescr+" : : "+com_open_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_close")
    {
      if(!prmClose.isEVal()) prmClose = true; prmCom = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Command : "+prmDescr+" : : "+com_close_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_stop")
    {
      prmStop = true;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Command : "+prmDescr+" : : "+com_stop_name);
    }
    else ev_rez+=ev_wrk+"\n";
  }
  event=ev_rez;

  if(st_open_en) st_open_color = !prmOpenSt.isEVal() ? ( prmOpenSt ?
  	( (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green" ) :    
  	"gray" ) : ( prmCloseSt ? "gray" : ( (strParse(strParse(digStts,0,";"),1,"-") != "") ?
  	strParse(strParse(digStts,0,";"),1,"-") : "green" ) );

  if(st_close_en) st_close_color = !prmCloseSt.isEVal() ? ( prmCloseSt ?
  	( (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red" ) :
  	"gray") : ( prmOpenSt ? "gray" : ( (strParse(strParse(digStts,1,";"),1,"-") != "") ?
  	strParse(strParse(digStts,1,";"),1,"-") : "red" ) );
}

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
ev_wrk = ev_rez = "";
off = 0;

if(!prmColor.isEVal()) { bordColor = prmColor; bordWidth = 2; }
else { bordColor = "black"; bordWidth = 1; } 

//> Disable all mutable widgets
info_ed_en = info_var_en = info_sp_en = info_out_en = up_en = upm_en = down_en = downm_en = lev_out_en = lev_var_en = lev_sp_en = mode_en = modMan_en = modAuto_en =
    modCasc_en = pnl_pid_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = 
    com_open_en = com_stop_en = com_close_en = st_open_en = st_close_en = Ramka_en = moveUp_en = moveDwn_en = false;

info_name_text = prmShifr.isEVal() ? "" : prmShifr;

//>Impulse processing
if(!prmAnalog.isEVal() && prmAnalog == false)
{  
  lev_out_en = info_out_en = false; 
  moveUp_en = moveDwn_en = true; 
  moveUp_fillColor = (!prmImpQupTm.isEVal() && prmImpQupTm) ? "cyan" : "black-0"; 
  moveDwn_fillColor = (!prmImpQdwnTm.isEVal() && prmImpQdwnTm) ? "cyan" : "black-0"; 
}

//> Check for analog
if(!prmVar.isEVal() || !prmVarIn.isEVal())
{
  info_ed_en = info_var_en = lev_var_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = true;
  info_ed_text = prmDemention.isEVal() ? "" : prmDemention;
  pVar = prmVar.isEVal() ? prmVarIn : prmVar;
  if(prmVarIn.isEVal()) info_var_bordWidth = 0;
  if(info_var_clearCnt <= 0) { info_var_arg0val = pVar; info_var_backColor = ""; } else info_var_clearCnt--; 
  lev_var_p1y = max(0,min(140,140*(1-(pVar-min)/(max-min))));
  info_var_arg0cfg = "10;f;"+(prmPrec.isEVal()?2:prmPrec);

  info_var_color = lev_var_c3 = "#3EFF3E";
  //> Warning borders process
  if(!prmWMin.isEVal() && !prmWMax.isEVal() && prmWMax > prmWMin)
  {
    lev_var_c2 = "yellow";
    lev_var_p6y = lev_var_p7y = 140*(1-(prmWMax-min)/(max-min));
    lev_var_p8y = lev_var_p9y = 140*(1-(prmWMin-min)/(max-min));
    if( pVar >= prmWMax || pVar <= prmWMin ) info_var_color = lev_var_c3 = "yellow";
  }
  else lev_var_c2 = "black-0";
  //> Alarm borders process
  if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin)
  {
    lev_var_c1 = "red";
    lev_var_p2y = lev_var_p3y = 140*(1-(prmAMax-min)/(max-min));
    lev_var_p4y = lev_var_p5y = 140*(1-(prmAMin-min)/(max-min));
    if( pVar >= prmAMax || pVar <= prmAMin ) info_var_color = lev_var_c3 = "red";
  }
  else lev_var_c1 = "black-0";
  //> EVAL
  if(pVar > max || pVar < min) info_var_color = lev_var_c3 = "lightgray";

  //>>Check an process PID regulator
  if(!prmVar.isEVal() && !prmSp.isEVal() && !prmOut.isEVal())
  {
    lev_out_en = info_out_en = (prmAnalog.isEVal() || prmAnalog == true);
    info_sp_en = lev_sp_en = mode_en = modMan_en = modAuto_en = pnl_pid_en = true;

    modCasc_en = !prmCasc.isEVal(); 
    up_en = upm_en = down_en = downm_en = (prmCasc != true);
    lev_out_p1y = 140*(1-prmOut/100);
    lev_sp_p1y = max(0,min(140,140*(1-(prmSp-min)/(max-min))));
    if(info_sp_clearCnt <= 0) { info_sp_arg0val = prmSp; info_sp_backColor = ""; } else info_sp_clearCnt--; 
    info_sp_arg0cfg = "10;f;"+((prmPrec==EVAL_INT)?2:prmPrec);
    if(info_out_clearCnt <= 0) { info_out_arg0val = prmOut; info_out_backColor = ""; } else info_out_clearCnt--;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      prevMode = prmAuto ? ((prmCasc == true)?"Каскад":"Автомат") : "Ручний";
      if(ev_wrk == "ws_BtPress:/modMan" && prmAuto) 
      {  
        prmAuto = false; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим: "+prmDescr+" : "+prevMode+" : Ручний");
      }
      else if(ev_wrk == "ws_BtPress:/modAuto" && (!prmAuto || prmCasc)) 
      {  
        prmAuto = true; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим : "+prmDescr+" : "+prevMode+" : Автомат");
      }
      else if(ev_wrk == "ws_BtPress:/modCasc" && !prmCasc) 
      {  
        prmAuto = prmCasc = true;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим : "+prmDescr+" : "+prevMode+" : Каскад");
      }
      else if(ev_wrk == "key_mousePresLeft:/info_sp")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Завдання : "+prmDescr+" : "+real2str(prmSp,prmPrec)+" : "+real2str(info_sp_arg0val,prmPrec) );
        prmSp = info_sp_arg0val; info_sp_backColor = ""; info_sp_clearCnt = 0;
      }
      else if(ev_wrk == "key_mousePresLeft:/info_out")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Вихід : "+prmDescr+" : "+real2str(prmManIn,1)+" : "+real2str(info_out_arg0val,1) );
	   prmManIn = info_out_arg0val; info_out_backColor = ""; info_out_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else if(ev_wrk == "ws_BtPress:/pnl_pid")
      {
        sessNm = strParsePath(path,0);
        pidPg = "/"+sessNm + "/pg_so/"+vcaAttrGet("/"+sessNm+"/pg_so/wdg_pgCont/a_pgOpenSrc").parsePath(2)+"/pg_greg/pg_"+prmId;
        if( vcaNodePresent(pidPg) ) vcaAttrSet(pidPg+"/a_pgOpen",1);
        else ev_rez+= "usr_PidCntrCall\n"; 
      } 
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl && prmAuto)
    {
      if(prmPrec.isEVal()) newVl = ((info_sp_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_sp_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin ) newVl = max(prmAMin,min(prmAMax,newVl));
      info_sp_arg0val = newVl; info_sp_backColor = "darkslategray"; info_sp_clearCnt = 25;
    }
    else if(appToVl && !prmAuto)
    {
       if(prmAnalog==false)
       {
         prmManIn = 50+2.5*appToVl;
         if(appToVl == -1) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Вихід: "+prmDescr+" :: Закрити ( < )" );
         else if(appToVl == 1) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Вихід: "+prmDescr+" :: Відкрити ( > )" );
         else if(appToVl == -10) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Вихід: "+prmDescr+" :: Закрити ( << )" );
         else if(appToVl == 10) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Вихід: "+prmDescr+" :: Відкрити ( >> )" );
       }
       else
       {
         newVl = max(0,min(100,info_out_arg0val+appToVl));
         info_out_arg0val = newVl; info_out_backColor = "darkslategray"; info_out_clearCnt = 25;
      }
    }

    if(prmAuto && prmCasc) { mode_text = "Каскад"; info_sp_bordWidth = info_out_bordWidth = 0; }
    else if(prmAuto)
    {
      mode_text = "Автомат";
      info_sp_bordWidth = 1; info_out_bordWidth = 0;
    }
    else
    {
      mode_text = "Ручний";
      info_out_bordWidth = 1; info_sp_bordWidth = 0;
    }
  }
  //>> Manual variable input
  else if(!prmVarIn.isEVal())
  {
    up_en = upm_en = down_en = downm_en = true;
    info_var_bordWidth = 1;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      else if(ev_wrk == "key_mousePresLeft:/info_var")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Змінна : "+prmDescr+" : "+real2str(prmVarIn,prmPrec)+" : "+real2str(info_var_arg0val,prmPrec) );
        prmVarIn = info_var_arg0val; info_var_backColor = ""; info_var_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl)
    {
      if(prmPrec.isEVal()) newVl = ((info_var_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_var_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin) newVl = max(prmAMin,min(prmAMax,newVl));
      info_var_arg0val = newVl; info_var_backColor = "darkslategray"; info_var_clearCnt = 25;
    }
  }
}
else if(!prmCom.isEVal() || !prmClose.isEVal() || !prmOpenSt.isEVal() || !prmCloseSt.isEVal())
{
  Ramka_en = true;
  com_open_en = com_close_en = (!prmCom.isEVal() || !prmClose.isEVal());
  st_open_en = st_close_en = (!prmOpenSt.isEVal() || !prmCloseSt.isEVal());
  com_stop_en = !prmStop.isEVal();

  if(com_open_en)
  {
    com_open_name = !digComs.isEVal() ? strParse(strParse(digComs,0,";"),0,"-") : "ОТКР";
    com_open_color = (strParse(strParse(digComs,0,";"),1,"-") != "") ? strParse(strParse(digComs,0,";"),1,"-") : "green";
    com_open_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,0,";"),0,"-") : "Команда ОТКР";
    com_open_tipStatus = !digComs.isEVal() ? "Натиснути для "+strParse(strParse(digComs,0,";"),0,"-") : "Натиснути для ОТКР";
    com_open_en = com_open_name.length;
  }
  if(com_close_en)
  {
    com_close_name  = !digComs.isEVal() ? strParse(strParse(digComs,1,";"),0,"-") : "ЗАКР";
    com_close_color = (strParse(strParse(digComs,1,";"),1,"-") != "") ? strParse(strParse(digComs,1,";"),1,"-") : "red";
    com_close_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,1,";"),0,"-") : "Команда ЗАКР";
    com_close_tipStatus = !digComs.isEVal() ? "Натиснути для "+strParse(strParse(digComs,1,";"),0,"-") : "Натиснути для ЗАКР";
    com_close_en = com_close_name.length;
  }
  if(com_stop_en)
  { 
    com_stop_name = com_close_tipTool = !digComs.isEVal() ? strParse(strParse(digComs,2,";"),0,"-") : "СТОП";
    com_stop_color = (strParse(strParse(digComs,2,";"),1,"-") != "") ? strParse(strParse(digComs,2,";"),1,"-") : "yellow";
    com_close_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,2,";"),0,"-") : "Команда СТОП";
    com_close_tipStatus = !digComs.isEVal() ? "Натиснути для "+strParse(strParse(digComs,2,";"),0,"-") : "Натиснути для СТОП";
    com_stop_en = com_stop_name.length;
  }
  if(st_open_en)
  { 
    st_open_text = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "ОТКР";
    st_open_color = (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green";
    st_open_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "ОТКР";
    st_open_tipStatus = !digStts.isEVal() ? "Стан "+strParse(strParse(digStts,0,";"),0,"-") : "Стан ОТКР";
  }
  if(st_close_en)
  { 
    st_close_text = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "ЗАКР";
    st_close_color = (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red";
    st_close_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "ЗАКР";
    st_close_tipStatus = !digStts.isEVal() ? "Стан "+strParse(strParse(digStts,1,";"),0,"-") : "Стан ЗАКР";
  }

  //Event process
  while(true)
  {
    ev_wrk = strParse(event,0,"\n",off);
    if(ev_wrk == "") break;
    else if(ev_wrk == "ws_BtPress:/com_open")
    {
      if(!prmCom.isEVal()) prmCom = true; prmClose = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_open_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_close")
    {
      if(!prmClose.isEVal()) prmClose = true; prmCom = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_close_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_stop")
    {
      prmStop = true;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_stop_name);
    }
    else ev_rez+=ev_wrk+"\n";
  }
  event=ev_rez;

  if(st_open_en) st_open_color = !prmOpenSt.isEVal() ? ( prmOpenSt ?
  	( (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green" ) :    
  	"gray" ) : ( prmCloseSt ? "gray" : ( (strParse(strParse(digStts,0,";"),1,"-") != "") ?
  	strParse(strParse(digStts,0,";"),1,"-") : "green" ) );

  if(st_close_en) st_close_color = !prmCloseSt.isEVal() ? ( prmCloseSt ?
  	( (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red" ) :
  	"gray") : ( prmOpenSt ? "gray" : ( (strParse(strParse(digStts,1,";"),1,"-") != "") ?
  	strParse(strParse(digStts,1,";"),1,"-") : "red" ) );
}

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
ev_wrk = ev_rez = "";
off = 0;

if(!prmColor.isEVal()) { bordColor = prmColor; bordWidth = 2; }
else { bordColor = "black"; bordWidth = 1; } 

//> Disable all mutable widgets
info_ed_en = info_var_en = info_sp_en = info_out_en = up_en = upm_en = down_en = downm_en = lev_out_en = lev_var_en = lev_sp_en = mode_en = modMan_en = modAuto_en =
    modCasc_en = pnl_pid_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = 
    com_open_en = com_stop_en = com_close_en = st_open_en = st_close_en = Ramka_en = moveUp_en = moveDwn_en = false;

info_name_text = prmShifr.isEVal() ? "" : prmShifr;

//>Impulse processing
if(!prmAnalog.isEVal() && prmAnalog == false)
{  
  lev_out_en = info_out_en = false; 
  moveUp_en = moveDwn_en = true; 
  moveUp_fillColor = (!prmImpQupTm.isEVal() && prmImpQupTm) ? "cyan" : "black-0"; 
  moveDwn_fillColor = (!prmImpQdwnTm.isEVal() && prmImpQdwnTm) ? "cyan" : "black-0"; 
}

//> Check for analog
if(!prmVar.isEVal() || !prmVarIn.isEVal())
{
  info_ed_en = info_var_en = lev_var_en = greed_text_en = greed_text1_en = greed_text2_en = greed_text3_en = greed_text4_en = greed_text5_en = true;
  info_ed_text = prmDemention.isEVal() ? "" : prmDemention;
  pVar = prmVar.isEVal() ? prmVarIn : prmVar;
  if(prmVarIn.isEVal()) info_var_bordWidth = 0;
  if(info_var_clearCnt <= 0) { info_var_arg0val = pVar; info_var_backColor = ""; } else info_var_clearCnt--; 
  lev_var_p1y = max(0,min(140,140*(1-(pVar-min)/(max-min))));
  info_var_arg0cfg = "10;f;"+(prmPrec.isEVal()?2:prmPrec);

  info_var_color = lev_var_c3 = "#3EFF3E";
  //> Warning borders process
  if(!prmWMin.isEVal() && !prmWMax.isEVal() && prmWMax > prmWMin)
  {
    lev_var_c2 = "yellow";
    lev_var_p6y = lev_var_p7y = 140*(1-(prmWMax-min)/(max-min));
    lev_var_p8y = lev_var_p9y = 140*(1-(prmWMin-min)/(max-min));
    if( pVar >= prmWMax || pVar <= prmWMin ) info_var_color = lev_var_c3 = "yellow";
  }
  else lev_var_c2 = "black-0";
  //> Alarm borders process
  if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin)
  {
    lev_var_c1 = "red";
    lev_var_p2y = lev_var_p3y = 140*(1-(prmAMax-min)/(max-min));
    lev_var_p4y = lev_var_p5y = 140*(1-(prmAMin-min)/(max-min));
    if( pVar >= prmAMax || pVar <= prmAMin ) info_var_color = lev_var_c3 = "red";
  }
  else lev_var_c1 = "black-0";
  //> EVAL
  if(pVar > max || pVar < min) info_var_color = lev_var_c3 = "lightgray";

  //>>Check an process PID regulator
  if(!prmVar.isEVal() && !prmSp.isEVal() && !prmOut.isEVal())
  {
    lev_out_en = info_out_en = (prmAnalog.isEVal() || prmAnalog == true);
    info_sp_en = lev_sp_en = mode_en = modMan_en = modAuto_en = pnl_pid_en = true;

    modCasc_en = !prmCasc.isEVal(); 
    up_en = upm_en = down_en = downm_en = (prmCasc != true);
    lev_out_p1y = 140*(1-prmOut/100);
    lev_sp_p1y = max(0,min(140,140*(1-(prmSp-min)/(max-min))));
    if(info_sp_clearCnt <= 0) { info_sp_arg0val = prmSp; info_sp_backColor = ""; } else info_sp_clearCnt--; 
    info_sp_arg0cfg = "10;f;"+((prmPrec==EVAL_INT)?2:prmPrec);
    if(info_out_clearCnt <= 0) { info_out_arg0val = prmOut; info_out_backColor = ""; } else info_out_clearCnt--;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      prevMode = prmAuto ? ((prmCasc==true)?"Каскад":"Автомат") : "Ручной";
      if(ev_wrk == "ws_BtPress:/modMan" && prmAuto) 
      {  
        prmAuto = false; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим: "+prmDescr+" : "+prevMode+" : Ручной");
      }
      else if(ev_wrk == "ws_BtPress:/modAuto" && (!prmAuto || prmCasc)) 
      {  
        prmAuto = true; if(prmCasc==true) prmCasc = false;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим : "+prmDescr+" : "+prevMode+" : Автомат");
      }
      else if(ev_wrk == "ws_BtPress:/modCasc" && !prmCasc) 
      {  
        prmAuto = prmCasc = true;
        messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Режим : "+prmDescr+" : "+prevMode+" : Каскад");
      }
      else if(ev_wrk == "key_mousePresLeft:/info_sp")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Задание : "+prmDescr+" : "+real2str(prmSp,prmPrec)+" : "+real2str(info_sp_arg0val,prmPrec) );
        prmSp = info_sp_arg0val; info_sp_backColor = ""; info_sp_clearCnt = 0;
      }
      else if(ev_wrk == "key_mousePresLeft:/info_out")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Выход : "+prmDescr+" : "+real2str(prmManIn,1)+" : "+real2str(info_out_arg0val,1) );
        prmManIn = info_out_arg0val; info_out_backColor = ""; info_out_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else if(ev_wrk == "ws_BtPress:/pnl_pid")
      {
        sessNm = strParsePath(path,0);
        pidPg = "/"+sessNm + "/pg_so/"+vcaAttrGet("/"+sessNm+"/pg_so/wdg_pgCont/a_pgOpenSrc").parsePath(2)+"/pg_greg/pg_"+prmId;
        if( vcaNodePresent(pidPg) ) vcaAttrSet(pidPg+"/a_pgOpen",1);
        else ev_rez+= "usr_PidCntrCall\n"; 
      } 
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl && prmAuto)
    {
      if(prmPrec.isEVal()) newVl = ((info_sp_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_sp_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin ) newVl = max(prmAMin,min(prmAMax,newVl));
      info_sp_arg0val = newVl; info_sp_backColor = "darkslategray"; info_sp_clearCnt = 25;
    }
    else if(appToVl && !prmAuto)
    {
       if(prmAnalog==false)
       {
         prmManIn = 50+2.5*appToVl;
         if( appToVl == -1 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Выход: "+prmDescr+" :: Закрыть ( < )" );
         else if( appToVl == 1 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Выход: "+prmDescr+" :: Открыть ( > )" );
         else if( appToVl == -10 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Выход: "+prmDescr+" :: Закрыть ( << )" );
         else if( appToVl == 10 ) messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'.Выход: "+prmDescr+" :: Открыть ( >> )" );
       }
       else
       {
         newVl = max(0,min(100,info_out_arg0val+appToVl));
         info_out_arg0val = newVl; info_out_backColor = "darkslategray"; info_out_clearCnt = 25;
      }
    }

    if(prmAuto && prmCasc) { mode_text = "Каскад"; info_sp_bordWidth = info_out_bordWidth = 0; }
    else if(prmAuto)
    {
      mode_text = "Автомат";
      info_sp_bordWidth = 1; info_out_bordWidth = 0;
    }
    else
    {
      mode_text = "Ручной";
      info_out_bordWidth = 1; info_sp_bordWidth = 0;
    }
  }
  //>> Manual variable input
  else if(!prmVarIn.isEVal())
  {
    up_en = upm_en = down_en = downm_en = true;
    info_var_bordWidth = 1;
    appToVl = 0;

    //Event process
    while(true)
    {
      ev_wrk = strParse(event,0,"\n",off);
      if(ev_wrk == "") break;
      else if(ev_wrk == "key_mousePresLeft:/info_var")
      {
        messPut( "OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Переменная : "+prmDescr+" : "+real2str(prmVarIn,prmPrec)+" : "+real2str(info_var_arg0val,prmPrec) );
        prmVarIn = info_var_arg0val; info_var_backColor = ""; info_var_clearCnt = 0;
      }
      else if(ev_wrk == "ws_BtPress:/up") appToVl = 1;
      else if(ev_wrk == "ws_BtPress:/upm") appToVl = 10;
      else if(ev_wrk == "ws_BtPress:/down") appToVl = -1;
      else if(ev_wrk == "ws_BtPress:/downm") appToVl = -10;
      else ev_rez+=ev_wrk+"\n";
    }
    event=ev_rez;

    if(appToVl)
    {
      if(prmPrec.isEVal()) newVl = ((info_var_arg0val-min)/(max-min)+appToVl/100)*(max-min)+min;
      else newVl = info_var_arg0val+appToVl*pow(10,-prmPrec);
      newVl = max(min,min(max,newVl));
      if(!prmAMin.isEVal() && !prmAMax.isEVal() && prmAMax > prmAMin) newVl = max(prmAMin,min(prmAMax,newVl));
      info_var_arg0val = newVl; info_var_backColor = "darkslategray"; info_var_clearCnt = 25;
    }
  }
}
else if(!prmCom.isEVal() || !prmClose.isEVal() || !prmOpenSt.isEVal() || !prmCloseSt.isEVal())
{
  Ramka_en = true;
  com_open_en = com_close_en = (!prmCom.isEVal() || !prmClose.isEVal());
  st_open_en = st_close_en = (!prmOpenSt.isEVal() || !prmCloseSt.isEVal());
  com_stop_en = !prmStop.isEVal();

  if(com_open_en)
  {
    com_open_name = !digComs.isEVal() ? strParse(strParse(digComs,0,";"),0,"-") : "ОТКР";
    com_open_color = (strParse(strParse(digComs,0,";"),1,"-") != "") ? strParse(strParse(digComs,0,";"),1,"-") : "green";
    com_open_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,0,";"),0,"-") : "Команда ОТКР";
    com_open_tipStatus = !digComs.isEVal() ? "Нажать для "+strParse(strParse(digComs,0,";"),0,"-") : "Нажать для ОТКР";
    com_open_en = com_open_name.length;
  }
  if(com_close_en)
  {
    com_close_name  = !digComs.isEVal() ? strParse(strParse(digComs,1,";"),0,"-") : "ЗАКР";
    com_close_color = (strParse(strParse(digComs,1,";"),1,"-") != "") ? strParse(strParse(digComs,1,";"),1,"-") : "red";
    com_close_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,1,";"),0,"-") : "Команда ЗАКР";
    com_close_tipStatus = !digComs.isEVal() ? "Нажать для "+strParse(strParse(digComs,1,";"),0,"-") : "Нажать для ЗАКР";
    com_close_en = com_close_name.length;
  }
  if(com_stop_en)
  { 
    com_stop_name = com_close_tipTool = !digComs.isEVal() ? strParse(strParse(digComs,2,";"),0,"-") : "СТОП";
    com_stop_color = (strParse(strParse(digComs,2,";"),1,"-") != "") ? strParse(strParse(digComs,2,";"),1,"-") : "yellow";
    com_close_tipTool = !digComs.isEVal() ? "Команда "+strParse(strParse(digComs,2,";"),0,"-") : "Команда СТОП";
    com_close_tipStatus = !digComs.isEVal() ? "Нажать для "+strParse(strParse(digComs,2,";"),0,"-") : "Нажать для СТОП";
    com_stop_en = com_stop_name.length;
  }
  if(st_open_en)
  { 
    st_open_text = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "ОТКР";
    st_open_color = (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green";
    st_open_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,0,";"),0,"-") : "ОТКР";
    st_open_tipStatus = !digStts.isEVal() ? "Состояние "+strParse(strParse(digStts,0,";"),0,"-") : "Состояние ОТКР";
  }
  if(st_close_en)
  { 
    st_close_text = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "ЗАКР";
    st_close_color = (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red";
    st_close_tipTool = !digStts.isEVal() ? strParse(strParse(digStts,1,";"),0,"-") : "ЗАКР";
    st_close_tipStatus = !digStts.isEVal() ? "Состояние "+strParse(strParse(digStts,1,";"),0,"-") : "Состояние ЗАКР";
  }

  //Event process
  while(true)
  {
    ev_wrk = strParse(event,0,"\n",off);
    if(ev_wrk == "") break;
    else if(ev_wrk == "ws_BtPress:/com_open")
    {
      if(!prmCom.isEVal()) prmCom = true; prmClose = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_open_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_close")
    {
      if(!prmClose.isEVal()) prmClose = true; prmCom = false;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_close_name);
    }
    else if(ev_wrk == "ws_BtPress:/com_stop")
    {
      prmStop = true;
      messPut("OP:"+vcaSesUser(path),2,"'"+prmShifr+"'. Команда : "+prmDescr+" : : "+com_stop_name);
    }
    else ev_rez+=ev_wrk+"\n";
  }
  event=ev_rez;

  if(st_open_en) st_open_color = !prmOpenSt.isEVal() ? ( prmOpenSt ?
  	( (strParse(strParse(digStts,0,";"),1,"-") != "") ? strParse(strParse(digStts,0,";"),1,"-") : "green" ) :    
  	"gray" ) : ( prmCloseSt ? "gray" : ( (strParse(strParse(digStts,0,";"),1,"-") != "") ?
  	strParse(strParse(digStts,0,";"),1,"-") : "green" ) );

  if(st_close_en) st_close_color = !prmCloseSt.isEVal() ? ( prmCloseSt ?
  	( (strParse(strParse(digStts,1,";"),1,"-") != "") ? strParse(strParse(digStts,1,";"),1,"-") : "red" ) :
  	"gray") : ( prmOpenSt ? "gray" : ( (strParse(strParse(digStts,1,";"),1,"-") != "") ?
  	strParse(strParse(digStts,1,";"),1,"-") : "red" ) );
}


ID: grpGraph
PARENT: /wlb_originals/wdg_Box
ATTRS: name;dscr;geomW;geomH;evProc;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	//> Parameter selection enable
	if(allowSelLst.length)
		for(i_el = 0; i_el < 8; i_el++)
		{
			cEl = this["el"+(i_el+1)];
			cEl.attrSet("en",1);
			if(cEl.attr("contextMenu").search(":select$") < 0)
				cEl.attrSet("contextMenu",cEl.attr("contextMenu")+"Select:select\n");
		}
}

curTm = SYS.time();
if(!trnd1_tSek) trnd1_tSek = curTm;
selSingle = 0;
selAll = false;

//> Events process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "key_presComma:/trnd1")		trnd1_tSek -= trnd1_tSize/2;
	else if(ev_cur == "key_presPeriod:/trnd1")	trnd1_tSek += trnd1_tSize/2;
	else if(ev_cur == "ws_SliderChange:/arh")	trnd1_tSek = arh_value*trnd1_tSize;
	else if(ev_cur.search("usr_single:/el") == 0)	selSingle = ev_cur.slice(14).toInt();
	else if(ev_cur.search("usr_all:/el") == 0)		selAll = true;
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Trend","Event: "+ev_cur);
}
event = ev_rez;

//> Trend time control
//if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if(trnd1_tSek < curTm) trnd1_trcPer = 0;
else { trnd1_trcPer = 1; trnd1_tSek = 0; }

//> Generic
name_arg0val = grpName;

//> Trends
arh_beg = 1e30;
arh_end = 0;
for(i_el = 0; i_el < 8; i_el++)
{
	cEl = this["el"+(i_el+1)];
	if(selAll)	cEl.attrSet("bordStyle",3);
	if(selSingle) cEl.attrSet("bordStyle",((i_el+1)==selSingle)?3:1);
	cTr = this["trnd1"];
	cTrPrm = "prm"+i_el;
	if(!cEl.attr("en")) cTr.attrSet(cTrPrm+"addr","");
	else
	{
		cTr.attrSet(cTrPrm+"addr",cEl.attr("addr"));
		cTr.attrSet(cTrPrm+"bordL",cEl.attr("min"));
		cTr.attrSet(cTrPrm+"bordU",cEl.attr("max"));
		cTr.attrSet(cTrPrm+"color",cEl.attr("color"));
		cTr.attrSet(cTrPrm+"width",cEl.attr("bordWidth"));
		cEl.attrSet("varEl",cTr.attr(cTrPrm+"val"));
		//Enable/disable of the mode's indication in the regulators ???
		cEl.attrSet("enMode",((curTm-trnd1_curSek) <= 2));
		//Archive depth calculate
		if(cEl.attr("bordStyle") == 3)
		{
			arh_tmp = cTr.attr(cTrPrm+"prop");
			if((arh_vl=arh_tmp.parse(0,":").toReal())) arh_beg = min(arh_beg,arh_vl);
			if((arh_vl=arh_tmp.parse(1,":").toReal())) arh_end = min(curTm,max(arh_end,arh_vl));
		}
	}
}
//> Set archive scroll
if(arh_end && ((arh_end-arh_beg)/trnd1_tSize > 2))
{
	arh_cfg = "0:"+floor(arh_beg/trnd1_tSize+1)+":"+floor(arh_end/trnd1_tSize+1)+":1:5";
	arh_value = (trnd1_tSek?trnd1_tSek:curTm)/trnd1_tSize;
	arh_tipTool = "Archive space: ["+SYS.strftime(arh_beg)+" ... "+SYS.strftime(arh_end)+"]";
	arh_active = true;
	if(selSingle) trnd1_tSek = arh_end;
}
else { arh_active = false; arh_tipTool = ""; }

uk#PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	//> Parameter selection enable
	if(allowSelLst.length)
		for(i_el = 0; i_el < 8; i_el++)
		{
			cEl = this["el"+(i_el+1)];
			cEl.attrSet("en",1);
			if(cEl.attr("contextMenu").search(":select$") < 0)
				cEl.attrSet("contextMenu",cEl.attr("contextMenu")+"Вибір:select\n");
		}
}

curTm = SYS.time();
if(!trnd1_tSek) trnd1_tSek = curTm;
selSingle = 0;
selAll = false;

//> Events process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "key_presComma:/trnd1")		trnd1_tSek -= trnd1_tSize/2;
	else if(ev_cur == "key_presPeriod:/trnd1")	trnd1_tSek += trnd1_tSize/2;
	else if(ev_cur == "ws_SliderChange:/arh")	trnd1_tSek = arh_value*trnd1_tSize;
	else if(ev_cur.search("usr_single:/el") == 0)	selSingle = ev_cur.slice(14).toInt();
	else if(ev_cur.search("usr_all:/el") == 0)		selAll = true;
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Trend","Event: "+ev_cur);
}
event = ev_rez;

//> Trend time control
//if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if(trnd1_tSek < curTm) trnd1_trcPer = 0;
else { trnd1_trcPer = 1; trnd1_tSek = 0; }

//> Generic
name_arg0val = grpName;

//> Trends
arh_beg = 1e30;
arh_end = 0;
for(i_el = 0; i_el < 8; i_el++)
{
	cEl = this["el"+(i_el+1)];
	if(selAll)	cEl.attrSet("bordStyle",3);
	if(selSingle) cEl.attrSet("bordStyle",((i_el+1)==selSingle)?3:1);
	cTr = this["trnd1"];
	cTrPrm = "prm"+i_el;
	if(!cEl.attr("en")) cTr.attrSet(cTrPrm+"addr","");
	else
	{
		cTr.attrSet(cTrPrm+"addr",cEl.attr("addr"));
		cTr.attrSet(cTrPrm+"bordL",cEl.attr("min"));
		cTr.attrSet(cTrPrm+"bordU",cEl.attr("max"));
		cTr.attrSet(cTrPrm+"color",cEl.attr("color"));
		cTr.attrSet(cTrPrm+"width",cEl.attr("bordWidth"));
		cEl.attrSet("varEl",cTr.attr(cTrPrm+"val"));
		//Enable/disable of the mode's indication in the regulators ???
		cEl.attrSet("enMode",((curTm-trnd1_curSek) <= 2));
		//Archive depth calculate
		if(cEl.attr("bordStyle") == 3)
		{
			arh_tmp = cTr.attr(cTrPrm+"prop");
			if((arh_vl=arh_tmp.parse(0,":").toReal())) arh_beg = min(arh_beg,arh_vl);
			if((arh_vl=arh_tmp.parse(1,":").toReal())) arh_end = min(curTm,max(arh_end,arh_vl));
		}
	}
}
//> Set archive scroll
if(arh_end && ((arh_end-arh_beg)/trnd1_tSize > 2))
{
	arh_cfg = "0:"+floor(arh_beg/trnd1_tSize+1)+":"+floor(arh_end/trnd1_tSize+1)+":1:5";
	arh_value = (trnd1_tSek?trnd1_tSek:curTm)/trnd1_tSize;
	arh_tipTool = "Простір архіву: ["+SYS.strftime(arh_beg)+" ... "+SYS.strftime(arh_end)+"]";
	arh_active = true;
	if(selSingle) trnd1_tSek = arh_end;
}
else { arh_active = false; arh_tipTool = ""; }

ru#PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	//> Parameter selection enable
	if(allowSelLst.length)
		for(i_el = 0; i_el < 8; i_el++)
		{
			cEl = this["el"+(i_el+1)];
			cEl.attrSet("en",1);
			if(cEl.attr("contextMenu").search(":select$") < 0)
				cEl.attrSet("contextMenu",cEl.attr("contextMenu")+"Выбор:select\n");
		}
}

curTm = SYS.time();
if(!trnd1_tSek) trnd1_tSek = curTm;
selSingle = 0;
selAll = false;

//> Events process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "key_presComma:/trnd1")		trnd1_tSek -= trnd1_tSize/2;
	else if(ev_cur == "key_presPeriod:/trnd1")	trnd1_tSek += trnd1_tSize/2;
	else if(ev_cur == "ws_SliderChange:/arh")	trnd1_tSek = arh_value*trnd1_tSize;
	else if(ev_cur.search("usr_single:/el") == 0)	selSingle = ev_cur.slice(14).toInt();
	else if(ev_cur.search("usr_all:/el") == 0)		selAll = true;
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Trend","Event: "+ev_cur);
}
event = ev_rez;

//> Trend time control
//if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if(trnd1_tSek < curTm) trnd1_trcPer = 0;
else { trnd1_trcPer = 1; trnd1_tSek = 0; }

//> Generic
name_arg0val = grpName;

//> Trends
arh_beg = 1e30;
arh_end = 0;
for(i_el = 0; i_el < 8; i_el++)
{
	cEl = this["el"+(i_el+1)];
	if(selAll)	cEl.attrSet("bordStyle",3);
	if(selSingle) cEl.attrSet("bordStyle",((i_el+1)==selSingle)?3:1);
	cTr = this["trnd1"];
	cTrPrm = "prm"+i_el;
	if(!cEl.attr("en")) cTr.attrSet(cTrPrm+"addr","");
	else
	{
		cTr.attrSet(cTrPrm+"addr",cEl.attr("addr"));
		cTr.attrSet(cTrPrm+"bordL",cEl.attr("min"));
		cTr.attrSet(cTrPrm+"bordU",cEl.attr("max"));
		cTr.attrSet(cTrPrm+"color",cEl.attr("color"));
		cTr.attrSet(cTrPrm+"width",cEl.attr("bordWidth"));
		cEl.attrSet("varEl",cTr.attr(cTrPrm+"val"));
		//Enable/disable of the mode's indication in the regulators ???
		cEl.attrSet("enMode",((curTm-trnd1_curSek) <= 2));
		//Archive depth calculate
		if(cEl.attr("bordStyle") == 3)
		{
			arh_tmp = cTr.attr(cTrPrm+"prop");
			if((arh_vl=arh_tmp.parse(0,":").toReal())) arh_beg = min(arh_beg,arh_vl);
			if((arh_vl=arh_tmp.parse(1,":").toReal())) arh_end = min(curTm,max(arh_end,arh_vl));
		}
	}
}
//> Set archive scroll
if(arh_end && ((arh_end-arh_beg)/trnd1_tSize > 2))
{
	arh_cfg = "0:"+floor(arh_beg/trnd1_tSize+1)+":"+floor(arh_end/trnd1_tSize+1)+":1:5";
	arh_value = (trnd1_tSek?trnd1_tSek:curTm)/trnd1_tSize;
	arh_tipTool = "Область архива: ["+SYS.strftime(arh_beg)+" ... "+SYS.strftime(arh_end)+"]";
	arh_active = true;
	if(selSingle) trnd1_tSek = arh_end;
}
else { arh_active = false; arh_tipTool = ""; }


ID: graphSelPrm
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgOpenSrc;pgGrp;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	apply_active = false;
	name_active = val_min_active = val_max_active = dim_active = false;
	prm_items = prm_value = name_value = dim_value = "";
	val_min_value = val_max_value = 0;
	//> Connect to linked widget 
	if(pgOpenSrc.length) lWdg=this.wdgAt(pgOpenSrc,true);
	if(lWdg)
	{
		//> Get allowed graphic's sources for selection
		tmplLst = "";
		if(lWdg.attrPresent("allowSelLst")) tmplLst = lWdg.attr("allowSelLst");
		else if(lWdg.ownerWdg(true).attrPresent("allowSelLst")) tmplLst = lWdg.ownerWdg(true).attr("allowSelLst");
		for(off = 0; (pIt=tmplLst.parse(0,"\n",off)).length; )
			//>> Archives list template process
			if(pIt == "<varhs>")
			{
				aLs = SYS.Archive.nodeList("va_");
				for(i_a = 0; i_a < aLs.length; i_a++)
				{
					itNm = SYS.Archive[aLs[i_a]].cfg("NAME");
					if(!itNm.length) itNm = SYS.Archive[aLs[i_a]].cfg("Source");
					prm_items += "Archive '"+itNm+"' (/Archive/"+aLs[i_a]+")\n";
				}
			}
			//>> Direct items list process by form "{path}:{name}:{min}:{max}:{dim}"
			else if(pIt.search("/(sub_|)Archive") >= 0)
			{
				itObj = SYS.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				prm_items += "Archive '"+pIt.parse(1,":")+"' ("+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			else
			{
				pathAbs = pIt.search("/(sub_|)DAQ") >= 0;
				itObj = pathAbs ? SYS.nodeAt(pIt.parse(0,":")) : SYS.DAQ.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				itNm = pIt.parse(1,":");
				if(!itNm.length && typeof(itObj).search("TCntrNode:TValue[:$]") == 0) itNm = itObj.NAME.get();
				prm_items += "DAQ '"+itNm+(pathAbs?"' (":"' (/DAQ")+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			//> Current value process
		itAddr = lWdg.link("addr").match("(prm|arh):([^ ]+) \\(\\+\\)");
		if(itAddr.length == 3)
		{
			//> Get Name
			if(lWdg.link("name").search("prm:[^ ]+ \\(\\+\\)") >= 0) name_value = lWdg.attr("name");
			else if((itTmp=lWdg.link("name").match("val:(.+$)")).length == 2) name_value = itTmp[1];
			else name_value = "Empty";
			//> Get Min and Max
			if(lWdg.link("min").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_min_value = lWdg.attr("min");
			else if((itTmp=lWdg.link("min").match("val:(.+$)")).length == 2) val_min_value = itTmp[1];
			if(lWdg.link("max").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_max_value = lWdg.attr("max");
			else if((itTmp=lWdg.link("max").match("val:(.+$)")).length == 2) val_max_value = itTmp[1];
			//> Dimension
			if(lWdg.link("ed").search("prm:[^ ]+ \\(\\+\\)") >= 0) dim_value = lWdg.attr("ed");
			else if((itTmp=lWdg.link("ed").match("val:(.+$)")).length == 2) dim_value = itTmp[1];
			//> Current prm name
			if(itAddr[1] == "prm")	prm_value = "DAQ '"+name_value+"' (/DAQ"+(itAddr[2].replace(new RegExp("/var$"),"")+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			else if(itAddr[1] == "arh") prm_value = "Archive '"+name_value+"' (/Archive/va_"+(itAddr[2]+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			if(prm_value.length) name_active = val_min_active = val_max_active = dim_active = true;
		}

		//> Load current properties
		color_value = lWdg.link("color");
	}
}

colorBox_backColor = color_value;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "ws_CombChange:/prm")	//Parametr selected
	{
		//> Set properties
		itTmp=prm_value.match(".+'(.*)' \\((.+?)\\)");
		if(itTmp.length == 3)
		{
			if(itTmp[1].length)	name_value = itTmp[1];
			off1 = 0;
			itVal = itTmp[2].parse(0,":",off1);	//Path
			//Connect to source and get main values for parameter
			if(itVal.parsePath(0) == "DAQ" && typeof(itObj=SYS.nodeAt(itVal)).search("TCntrNode:TValue[:$]") == 0)
			{
				val_min_value = itObj.min.get();
				val_max_value = itObj.max.get();
				dim_value = itObj.ed.get();
			}
			
			//Set direct values
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_min_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_max_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) dim_value = itVal;
		}
		apply_active = name_active = val_min_active = val_max_active = dim_active = true;
	}
	else if(ev_cur.search("ws_LnAccept:") == 0)	apply_active = true;
	else if(ev_cur == "ws_BtPress:/apply")
	{
		//Link addr set
		itTmp=prm_value.match(".+\\((.+?)[:\\)]");
		if(itTmp.length != 2) lWdg.linkSet("addr","");
		else
		{
			off1 = 0;
			firstEl = itTmp[1].parsePath(0,off1);
			if(firstEl == "Archive")
			{
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","arh:"+itTmp[1].slice(off1+4));
				lWdg.linkSet("name","val:"+name_value);
				lWdg.linkSet("min","val:"+val_min_value);
				lWdg.linkSet("max","val:"+val_max_value);
				lWdg.linkSet("ed","val:"+dim_value);
			}
			else if(firstEl == "DAQ")
			{
				itObj = SYS.nodeAt(itTmp[1]);
				isPrm = (typeof(itObj).search("TCntrNode:TValue[:$]") == 0);
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","prm:"+itTmp[1].slice(off1),isPrm);
				if(!isPrm || name_value != itObj.NAME.get())	lWdg.linkSet("name", "val:"+name_value);
				if(!isPrm || val_min_value != itObj.min.get())	lWdg.linkSet("min","val:"+val_min_value);
				if(!isPrm || val_max_value != itObj.max.get())	lWdg.linkSet("max","val:"+val_max_value);
				if(!isPrm || dim_value != itObj.ed.get())		lWdg.linkSet("ed","val:"+dim_value);
			}
		}
		lWdg.linkSet("color",color_value);

		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
}
event = ev_rez;

uk#PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	apply_active = false;
	name_active = val_min_active = val_max_active = dim_active = false;
	prm_items = prm_value = name_value = dim_value = "";
	val_min_value = val_max_value = 0;
	//> Connect to linked widget 
	if(pgOpenSrc.length) lWdg=this.wdgAt(pgOpenSrc,true);
	if(lWdg)
	{
		//> Get allowed graphic's sources for selection
		tmplLst = "";
		if(lWdg.attrPresent("allowSelLst")) tmplLst = lWdg.attr("allowSelLst");
		else if(lWdg.ownerWdg(true).attrPresent("allowSelLst")) tmplLst = lWdg.ownerWdg(true).attr("allowSelLst");
		for(off = 0; (pIt=tmplLst.parse(0,"\n",off)).length; )
			//>> Archives list template process
			if(pIt == "<varhs>")
			{
				aLs = SYS.Archive.nodeList("va_");
				for(i_a = 0; i_a < aLs.length; i_a++)
				{
					itNm = SYS.Archive[aLs[i_a]].cfg("NAME");
					if(!itNm.length) itNm = SYS.Archive[aLs[i_a]].cfg("Source");
					prm_items += "Архів '"+itNm+"' (/Archive/"+aLs[i_a]+")\n";
				}
			}
			//>> Direct items list process by form "{path}:{name}:{min}:{max}:{dim}"
			else if(pIt.search("/(sub_|)Archive") >= 0)
			{
				itObj = SYS.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				prm_items += "Архів '"+pIt.parse(1,":")+"' ("+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			else
			{
				pathAbs = pIt.search("/(sub_|)DAQ") >= 0;
				itObj = pathAbs ? SYS.nodeAt(pIt.parse(0,":")) : SYS.DAQ.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				itNm = pIt.parse(1,":");
				if(!itNm.length && typeof(itObj).search("TCntrNode:TValue[:$]") == 0) itNm = itObj.NAME.get();
				prm_items += "DAQ '"+itNm+(pathAbs?"' (":"' (/DAQ")+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			//> Current value process
		itAddr = lWdg.link("addr").match("(prm|arh):([^ ]+) \\(\\+\\)");
		if(itAddr.length == 3)
		{
			//> Get Name
			if(lWdg.link("name").search("prm:[^ ]+ \\(\\+\\)") >= 0) name_value = lWdg.attr("name");
			else if((itTmp=lWdg.link("name").match("val:(.+$)")).length == 2) name_value = itTmp[1];
			else name_value = "Порожньо";
			//> Get Min and Max
			if(lWdg.link("min").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_min_value = lWdg.attr("min");
			else if((itTmp=lWdg.link("min").match("val:(.+$)")).length == 2) val_min_value = itTmp[1];
			if(lWdg.link("max").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_max_value = lWdg.attr("max");
			else if((itTmp=lWdg.link("max").match("val:(.+$)")).length == 2) val_max_value = itTmp[1];
			//> Dimension
			if(lWdg.link("ed").search("prm:[^ ]+ \\(\\+\\)") >= 0) dim_value = lWdg.attr("ed");
			else if((itTmp=lWdg.link("ed").match("val:(.+$)")).length == 2) dim_value = itTmp[1];
			//> Current prm name
			if(itAddr[1] == "prm")	prm_value = "DAQ '"+name_value+"' (/DAQ"+(itAddr[2].replace(new RegExp("/var$"),"")+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			else if(itAddr[1] == "arh") prm_value = "Archive '"+name_value+"' (/Archive/va_"+(itAddr[2]+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			if(prm_value.length) name_active = val_min_active = val_max_active = dim_active = true;
		}

		//> Load current properties
		color_value = lWdg.link("color");
	}
}

colorBox_backColor = color_value;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "ws_CombChange:/prm")	//Parametr selected
	{
		//> Set properties
		itTmp=prm_value.match(".+'(.*)' \\((.+?)\\)");
		if(itTmp.length == 3)
		{
			if(itTmp[1].length)	name_value = itTmp[1];
			off1 = 0;
			itVal = itTmp[2].parse(0,":",off1);	//Path
			//Connect to source and get main values for parameter
			if(itVal.parsePath(0) == "DAQ" && typeof(itObj=SYS.nodeAt(itVal)).search("TCntrNode:TValue[:$]") == 0)
			{
				val_min_value = itObj.min.get();
				val_max_value = itObj.max.get();
				dim_value = itObj.ed.get();
			}
			
			//Set direct values
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_min_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_max_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) dim_value = itVal;
		}
		apply_active = name_active = val_min_active = val_max_active = dim_active = true;
	}
	else if(ev_cur.search("ws_LnAccept:") == 0)	apply_active = true;
	else if(ev_cur == "ws_BtPress:/apply")
	{
		//Link addr set
		itTmp=prm_value.match(".+\\((.+?)[:\\)]");
		if(itTmp.length != 2) lWdg.linkSet("addr","");
		else
		{
			off1 = 0;
			firstEl = itTmp[1].parsePath(0,off1);
			if(firstEl == "Archive")
			{
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","arh:"+itTmp[1].slice(off1+4));
				lWdg.linkSet("name","val:"+name_value);
				lWdg.linkSet("min","val:"+val_min_value);
				lWdg.linkSet("max","val:"+val_max_value);
				lWdg.linkSet("ed","val:"+dim_value);
			}
			else if(firstEl == "DAQ")
			{
				itObj = SYS.nodeAt(itTmp[1]);
				isPrm = (typeof(itObj).search("TCntrNode:TValue[:$]") == 0);
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","prm:"+itTmp[1].slice(off1),isPrm);
				if(!isPrm || name_value != itObj.NAME.get())	lWdg.linkSet("name", "val:"+name_value);
				if(!isPrm || val_min_value != itObj.min.get())	lWdg.linkSet("min","val:"+val_min_value);
				if(!isPrm || val_max_value != itObj.max.get())	lWdg.linkSet("max","val:"+val_max_value);
				if(!isPrm || dim_value != itObj.ed.get())		lWdg.linkSet("ed","val:"+dim_value);
			}
		}
		lWdg.linkSet("color",color_value);

		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
}
event = ev_rez;

ru#PROC:
JavaLikeCalc.JavaScript
if(f_start)
{
	apply_active = false;
	name_active = val_min_active = val_max_active = dim_active = false;
	prm_items = prm_value = name_value = dim_value = "";
	val_min_value = val_max_value = 0;
	//> Connect to linked widget 
	if(pgOpenSrc.length) lWdg=this.wdgAt(pgOpenSrc,true);
	if(lWdg)
	{
		//> Get allowed graphic's sources for selection
		tmplLst = "";
		if(lWdg.attrPresent("allowSelLst")) tmplLst = lWdg.attr("allowSelLst");
		else if(lWdg.ownerWdg(true).attrPresent("allowSelLst")) tmplLst = lWdg.ownerWdg(true).attr("allowSelLst");
		for(off = 0; (pIt=tmplLst.parse(0,"\n",off)).length; )
			//>> Archives list template process
			if(pIt == "<varhs>")
			{
				aLs = SYS.Archive.nodeList("va_");
				for(i_a = 0; i_a < aLs.length; i_a++)
				{
					itNm = SYS.Archive[aLs[i_a]].cfg("NAME");
					if(!itNm.length) itNm = SYS.Archive[aLs[i_a]].cfg("Source");
					prm_items += "Архив '"+itNm+"' (/Archive/"+aLs[i_a]+")\n";
				}
			}
			//>> Direct items list process by form "{path}:{name}:{min}:{max}:{dim}"
			else if(pIt.search("/(sub_|)Archive") >= 0)
			{
				itObj = SYS.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				prm_items += "Архив '"+pIt.parse(1,":")+"' ("+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			else
			{
				pathAbs = pIt.search("/(sub_|)DAQ") >= 0;
				itObj = pathAbs ? SYS.nodeAt(pIt.parse(0,":")) : SYS.DAQ.nodeAt(pIt.parse(0,":"));
				if(!itObj) continue;
				itNm = pIt.parse(1,":");
				if(!itNm.length && typeof(itObj).search("TCntrNode:TValue[:$]") == 0) itNm = itObj.NAME.get();
				prm_items += "DAQ '"+itNm+(pathAbs?"' (":"' (/DAQ")+(pIt.parse(0,":")+":"+pIt.parse(2,":")+":"+pIt.parse(3,":")+":"+pIt.parse(4,":")).replace(new RegExp(":*$"),"")+")\n";
			}
			//> Current value process
		itAddr = lWdg.link("addr").match("(prm|arh):([^ ]+) \\(\\+\\)");
		if(itAddr.length == 3)
		{
			//> Get Name
			if(lWdg.link("name").search("prm:[^ ]+ \\(\\+\\)") >= 0) name_value = lWdg.attr("name");
			else if((itTmp=lWdg.link("name").match("val:(.+$)")).length == 2) name_value = itTmp[1];
			else name_value = "Пусто";
			//> Get Min and Max
			if(lWdg.link("min").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_min_value = lWdg.attr("min");
			else if((itTmp=lWdg.link("min").match("val:(.+$)")).length == 2) val_min_value = itTmp[1];
			if(lWdg.link("max").search("prm:[^ ]+ \\(\\+\\)") >= 0) val_max_value = lWdg.attr("max");
			else if((itTmp=lWdg.link("max").match("val:(.+$)")).length == 2) val_max_value = itTmp[1];
			//> Dimension
			if(lWdg.link("ed").search("prm:[^ ]+ \\(\\+\\)") >= 0) dim_value = lWdg.attr("ed");
			else if((itTmp=lWdg.link("ed").match("val:(.+$)")).length == 2) dim_value = itTmp[1];
			//> Current prm name
			if(itAddr[1] == "prm")	prm_value = "DAQ '"+name_value+"' (/DAQ"+(itAddr[2].replace(new RegExp("/var$"),"")+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			else if(itAddr[1] == "arh") prm_value = "Архив '"+name_value+"' (/Archive/va_"+(itAddr[2]+":"+val_min_value+":"+val_max_value+":"+dim_value).replace(new RegExp(":*$"),"")+")";
			if(prm_value.length) name_active = val_min_active = val_max_active = dim_active = true;
		}

		//> Load current properties
		color_value = lWdg.link("color");
	}
}

colorBox_backColor = color_value;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	if(ev_cur == "ws_CombChange:/prm")	//Parametr selected
	{
		//> Set properties
		itTmp=prm_value.match(".+'(.*)' \\((.+?)\\)");
		if(itTmp.length == 3)
		{
			if(itTmp[1].length)	name_value = itTmp[1];
			off1 = 0;
			itVal = itTmp[2].parse(0,":",off1);	//Path
			//Connect to source and get main values for parameter
			if(itVal.parsePath(0) == "DAQ" && typeof(itObj=SYS.nodeAt(itVal)).search("TCntrNode:TValue[:$]") == 0)
			{
				val_min_value = itObj.min.get();
				val_max_value = itObj.max.get();
				dim_value = itObj.ed.get();
			}
			
			//Set direct values
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_min_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) val_max_value = itVal;
			if((itVal=itTmp[2].parse(0,":",off1)).length) dim_value = itVal;
		}
		apply_active = name_active = val_min_active = val_max_active = dim_active = true;
	}
	else if(ev_cur.search("ws_LnAccept:") == 0)	apply_active = true;
	else if(ev_cur == "ws_BtPress:/apply")
	{
		//Link addr set
		itTmp=prm_value.match(".+\\((.+?)[:\\)]");
		if(itTmp.length != 2) lWdg.linkSet("addr","");
		else
		{
			off1 = 0;
			firstEl = itTmp[1].parsePath(0,off1);
			if(firstEl == "Archive")
			{
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","arh:"+itTmp[1].slice(off1+4));
				lWdg.linkSet("name","val:"+name_value);
				lWdg.linkSet("min","val:"+val_min_value);
				lWdg.linkSet("max","val:"+val_max_value);
				lWdg.linkSet("ed","val:"+dim_value);
			}
			else if(firstEl == "DAQ")
			{
				itObj = SYS.nodeAt(itTmp[1]);
				isPrm = (typeof(itObj).search("TCntrNode:TValue[:$]") == 0);
				lWdg.linkSet("addr","",true);	//Clear all othet values
				lWdg.linkSet("addr","prm:"+itTmp[1].slice(off1),isPrm);
				if(!isPrm || name_value != itObj.NAME.get())	lWdg.linkSet("name", "val:"+name_value);
				if(!isPrm || val_min_value != itObj.min.get())	lWdg.linkSet("min","val:"+val_min_value);
				if(!isPrm || val_max_value != itObj.max.get())	lWdg.linkSet("max","val:"+val_max_value);
				if(!isPrm || dim_value != itObj.ed.get())		lWdg.linkSet("ed","val:"+dim_value);
			}
		}
		lWdg.linkSet("color",color_value);

		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
}
event = ev_rez;


ID: RootPgSo
PARENT: /wlb_originals/wdg_Box
ATTRS: path;name;dscr;active;geomW;geomH;evProc;backColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
calcCnt++;

if(f_start)
{
	play_en = demoPlayProc.length;
	//> Checking to signal object's presenting
	soLst = this.nodeList("pg_");
	for(i = 0; i < soLst.length; i++)
	{
		if(!(curSO=soLst[i].slice(3).toInt()))	continue;
		soW = this["wdg_so"+curSO];
		soW.attrSet("name",this["pg_"+curSO].attr("name"));
		soDscr = this["pg_"+curSO].attr("dscr");
		if(soDscr.length) soW.attrSet("tipTool",soDscr);
		soW.attrSet("en",1);
	}
	//> Check for disable all SO and expand for need
	var firstRow = 0; var secondRow = 0;
	for(i = 0; i < 16; i++)
		if(this["wdg_so"+(i+1)].attr("en"))
		{ if(i < 8)	firstRow++;	else secondRow++; }
	if(firstRow <= 1 && !secondRow)
	{
		soOff = this["wdg_so1"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
	}
	else if(!secondRow)
	{
		soOff = this["wdg_so9"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
		if(firstRow < 8)
		{
			soOff = this["wdg_so1"].attr("geomX");
			soWdth = this["wdg_so8"].attr("geomX")+this["wdg_so8"].attr("geomW");
			soSize = soWdth/firstRow;
			for(i = 0; i < 7; i++)
			{
				if(!this["wdg_so"+(i+1)].attr("en"))	continue;
				this["wdg_so"+(i+1)].attrSet("geomX",soOff).attrSet("geomW",soSize-3);
				soOff += soSize;
			}
		}
	}

	//> Result graphics present check
	go_rg_active = this.nodeList("pg_","/pg_rg/pg_rg").length;
}

if(pgCont_pgOpenSrc != lastView)
{
  //> Checking for SO selection change
  curSO = pgCont_pgOpenSrc.parsePath(2).slice(3);
  lastSO = lastView.parsePath(2).slice(3);
  if( curSO != lastSO )
  {
    if( lastSO.length ) this["wdg_so"+lastSO].attrSet("color","#555555");
    if( curSO.length )
    {
      this["wdg_so"+curSO].attrSet("color","#777799");
      //>> Check for view modes active
      go_mn_active = this["pg_"+curSO]["pg_mn"].nodeList("pg_").length;
      go_ggraph_active = this["pg_"+curSO]["pg_ggraph"].nodeList("pg_").length;
      go_gcadr_active = this["pg_"+curSO]["pg_gcadr"].nodeList("pg_").length;
      go_gview_active = this["pg_"+curSO]["pg_gview"].nodeList("pg_").length;
      go_doc_active = this["pg_"+curSO]["pg_doc"].nodeList("pg_").length;
    }
  }
  //> Checking for view selection change
  curMode = pgCont_pgOpenSrc.parsePath(3).slice(3);
  lastMode = lastView.parsePath(3).slice(3);
  if( curMode != lastMode )
  {
    if( lastMode.length ) this["wdg_go_"+lastMode].attrSet("color","");
    if( curMode.length ) this["wdg_go_"+curMode].attrSet("color","#777799");
  }

  //> Pages counter display
  if( pgCont_pgOpenSrc.length && curMode.length )
  {
    elLst = this["pg_"+curSO]["pg_"+curMode].nodeList("pg_");
    curEl = pgCont_pgOpenSrc.parsePath(4);
    for( i_m = 0; i_m < elLst.length; i_m++ ) if( elLst[i_m] == curEl ) break;
    pgCntr_text = ""+(i_m+1)+"\n("+elLst.length+")";
    prev_active = next_active = (elLst.length>1);
  }
  else { pgCntr_text = "-"; prev_active = next_active = false; }

  lastView = pgCont_pgOpenSrc;
}

//> Cvitation button's
cvt_light_en = alarmSt&0x100; cvt_alarm_en = alarmSt&0x200; cvt_sound_en = alarmSt&0x400;
cvt_light_active = alarmSt&0x10000; cvt_alarm_active = alarmSt&0x20000; cvt_sound_active = alarmSt&0x40000;

//> One second's calls
if( (calcCnt%f_frq) == 0 )
{
  //> Alarms display
  soLst = this.nodeList("pg_");
  for( i = 0; i < soLst.length; i++ )
  {
    curSO = soLst[i].slice(3);
    aSt = this["pg_"+curSO].attr("alarmSt");
    aLev = aSt&0xFF;
    if( aLev && aSt&0x100 )
    {  
      if( aLev > 30 ) wColor = "#ff0000";
      else wColor = "#ffff00";
      curColor = this["wdg_so"+curSO].attr("colorText");
      this["wdg_so"+curSO].attrSet("colorText",(aSt&0x10000 && curColor==wColor)?"black":wColor);
    }
    else this["wdg_so"+curSO].attrSet("colorText","#00ff00");
  }
}

//> Events process
ev_rez = "";
off = 0;
while(true)
{
  sval = event.parse(0,"\n",off);
  if( sval == "" ) break;
  else if( sval == "ws_BtPress:/cvt_light" ) alarmSt = 0x1000001;
  else if( sval == "ws_BtPress:/cvt_alarm" ) alarmSt = 0x1000002;
  else if( sval == "ws_BtPress:/cvt_sound" ) alarmSt = 0x1000004;
  else ev_rez+=sval+"\n";
  //SYS.messDebug("MainPg","Event: "+sval);
}
event=ev_rez;

//> Demo play process
if(f_start || !play_value) { stepCur = -1; stepTm = 0; play_img = "start"; }
if(play_value)
{
	play_img = "stop";
	if(stepTm > 0) stepTm -= 1/f_frq;
	else
	{
		var args = new Object();
		args.this = this;
		args.stepTm = stepTm;
		args.stepCur = stepCur;
		SYS.DAQ.funcCall("JavaLikeCalc.JavaScript",args,demoPlayProc);
		stepTm = args.stepTm;
		stepCur = args.stepCur;
	}
}

uk#PROC:
JavaLikeCalc.JavaScript
calcCnt++;

if( f_start )
{
	play_en = demoPlayProc.length;
  //> Checking to signal object's presenting
  soLst = this.nodeList("pg_");
  for( i = 0; i < soLst.length; i++ )
  {
    if( !(curSO=soLst[i].slice(3).toInt()) ) continue;
    soW = this["wdg_so"+curSO];
    soW.attrSet("name",this["pg_"+curSO].attr("name"));
    soDscr = this["pg_"+curSO].attr("dscr");
    if( soDscr.length ) soW.attrSet("tipTool",soDscr);
    soW.attrSet("en",1);
  }
	//> Check for disable all SO and expand for need
	var firstRow = 0; var secondRow = 0;
	for(i = 0; i < 16; i++)
		if(this["wdg_so"+(i+1)].attr("en"))
		{ if(i < 8)	firstRow++;	else secondRow++; }
	if(firstRow <= 1 && !secondRow)
	{
		soOff = this["wdg_so1"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
	}
	else if(!secondRow)
	{
		soOff = this["wdg_so9"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
		if(firstRow < 8)
		{
			soOff = this["wdg_so1"].attr("geomX");
			soWdth = this["wdg_so8"].attr("geomX")+this["wdg_so8"].attr("geomW");
			soSize = soWdth/firstRow;
			for(i = 0; i < 7; i++)
			{
				if(!this["wdg_so"+(i+1)].attr("en"))	continue;
				this["wdg_so"+(i+1)].attrSet("geomX",soOff).attrSet("geomW",soSize-3);
				soOff += soSize;
			}
		}
	}
  //> Result graphics present check
  go_rg_active = this.nodeList("pg_","/pg_rg/pg_rg").length;
}

if( pgCont_pgOpenSrc != lastView )
{
  //> Checking for SO selection change
  curSO = pgCont_pgOpenSrc.parsePath(2).slice(3);
  lastSO = lastView.parsePath(2).slice(3);
  if( curSO != lastSO )
  {
    if( lastSO.length ) this["wdg_so"+lastSO].attrSet("color","#555555");
    if( curSO.length )
    {
      this["wdg_so"+curSO].attrSet("color","#777799");
      //>> Check for view modes active
      go_mn_active = this["pg_"+curSO]["pg_mn"].nodeList("pg_").length;
      go_ggraph_active = this["pg_"+curSO]["pg_ggraph"].nodeList("pg_").length;
      go_gcadr_active = this["pg_"+curSO]["pg_gcadr"].nodeList("pg_").length;
      go_gview_active = this["pg_"+curSO]["pg_gview"].nodeList("pg_").length;
      go_doc_active = this["pg_"+curSO]["pg_doc"].nodeList("pg_").length;
    }
  }
  //> Checking for view selection change
  curMode = pgCont_pgOpenSrc.parsePath(3).slice(3);
  lastMode = lastView.parsePath(3).slice(3);
  if( curMode != lastMode )
  {
    if( lastMode.length ) this["wdg_go_"+lastMode].attrSet("color","");
    if( curMode.length ) this["wdg_go_"+curMode].attrSet("color","#777799");
  }

  //> Pages counter display
  if( pgCont_pgOpenSrc.length && curMode.length )
  {
    elLst = this["pg_"+curSO]["pg_"+curMode].nodeList("pg_");
    curEl = pgCont_pgOpenSrc.parsePath(4);
    for( i_m = 0; i_m < elLst.length; i_m++ ) if( elLst[i_m] == curEl ) break;
    pgCntr_text = ""+(i_m+1)+"\n("+elLst.length+")";
    prev_active = next_active = (elLst.length>1);
  }
  else { pgCntr_text = "-"; prev_active = next_active = false; }

  lastView = pgCont_pgOpenSrc;
}

//> Cvitation button's
cvt_light_en = alarmSt&0x100; cvt_alarm_en = alarmSt&0x200; cvt_sound_en = alarmSt&0x400;
cvt_light_active = alarmSt&0x10000; cvt_alarm_active = alarmSt&0x20000; cvt_sound_active = alarmSt&0x40000;

//> One second's calls
if( (calcCnt%f_frq) == 0 )
{
  //> Alarms display
  soLst = this.nodeList("pg_");
  for( i = 0; i < soLst.length; i++ )
  {
    curSO = soLst[i].slice(3);
    aSt = this["pg_"+curSO].attr("alarmSt");
    aLev = aSt&0xFF;
    if( aLev && aSt&0x100 )
    {  
      if( aLev > 30 ) wColor = "#ff0000";
      else wColor = "#ffff00";
      curColor = this["wdg_so"+curSO].attr("colorText");
      this["wdg_so"+curSO].attrSet("colorText",(aSt&0x10000 && curColor==wColor)?"black":wColor);
    }
    else this["wdg_so"+curSO].attrSet("colorText","#00ff00");
  }
}

//> Events process
ev_rez = "";
off = 0;
while(true)
{
  sval = event.parse(0,"\n",off);
//  messPut("MainPg",1,"Event: "+sval);
  if( sval == "" ) break;
  else if( sval == "ws_BtPress:/cvt_light" ) alarmSt = 0x1000001;
  else if( sval == "ws_BtPress:/cvt_alarm" ) alarmSt = 0x1000002;
  else if( sval == "ws_BtPress:/cvt_sound" ) alarmSt = 0x1000004;
  else ev_rez+=sval+"\n";
}
event=ev_rez;

//> Demo play process
if(f_start || !play_value) { stepCur = -1; stepTm = 0; play_img = "start"; }
if(play_value)
{
	play_img = "stop";
	if(stepTm > 0) stepTm -= 1/f_frq;
	else
	{
		var args = new Object();
		args.this = this;
		args.stepTm = stepTm;
		args.stepCur = stepCur;
		SYS.DAQ.funcCall("JavaLikeCalc.JavaScript",args,demoPlayProc);
		stepTm = args.stepTm;
		stepCur = args.stepCur;
	}
}

ru#PROC:
JavaLikeCalc.JavaScript
calcCnt++;

if( f_start )
{
	play_en = demoPlayProc.length;
  //> Checking to signal object's presenting
  soLst = this.nodeList("pg_");
  for( i = 0; i < soLst.length; i++ )
  {
    if( !(curSO=soLst[i].slice(3).toInt()) ) continue;
    soW = this["wdg_so"+curSO];
    soW.attrSet("name",this["pg_"+curSO].attr("name"));
    soDscr = this["pg_"+curSO].attr("dscr");
    if( soDscr.length ) soW.attrSet("tipTool",soDscr);
    soW.attrSet("en",1);
  }
	//> Check for disable all SO and expand for need
	var firstRow = 0; var secondRow = 0;
	for(i = 0; i < 16; i++)
		if(this["wdg_so"+(i+1)].attr("en"))
		{ if(i < 8)	firstRow++;	else secondRow++; }
	if(firstRow <= 1 && !secondRow)
	{
		soOff = this["wdg_so1"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
	}
	else if(!secondRow)
	{
		soOff = this["wdg_so9"].attr("geomY");
		soSize = this["pgCont"].attr("geomY")-soOff;
		this["pgCont"].attrSet("geomY",soOff).attrSet("geomH",this["pgCont"].attr("geomH")+soSize);
		if(firstRow < 8)
		{
			soOff = this["wdg_so1"].attr("geomX");
			soWdth = this["wdg_so8"].attr("geomX")+this["wdg_so8"].attr("geomW");
			soSize = soWdth/firstRow;
			for(i = 0; i < 7; i++)
			{
				if(!this["wdg_so"+(i+1)].attr("en"))	continue;
				this["wdg_so"+(i+1)].attrSet("geomX",soOff).attrSet("geomW",soSize-3);
				soOff += soSize;
			}
		}
	}

  //> Result graphics present check
  go_rg_active = this.nodeList("pg_","/pg_rg/pg_rg").length;
}

if( pgCont_pgOpenSrc != lastView )
{
  //> Checking for SO selection change
  curSO = pgCont_pgOpenSrc.parsePath(2).slice(3);
  lastSO = lastView.parsePath(2).slice(3);
  if( curSO != lastSO )
  {
    if( lastSO.length ) this["wdg_so"+lastSO].attrSet("color","#555555");
    if( curSO.length )
    {
      this["wdg_so"+curSO].attrSet("color","#777799");
      //>> Check for view modes active
      go_mn_active = this["pg_"+curSO]["pg_mn"].nodeList("pg_").length;
      go_ggraph_active = this["pg_"+curSO]["pg_ggraph"].nodeList("pg_").length;
      go_gcadr_active = this["pg_"+curSO]["pg_gcadr"].nodeList("pg_").length;
      go_gview_active = this["pg_"+curSO]["pg_gview"].nodeList("pg_").length;
      go_doc_active = this["pg_"+curSO]["pg_doc"].nodeList("pg_").length;
    }
  }
  //> Checking for view selection change
  curMode = pgCont_pgOpenSrc.parsePath(3).slice(3);
  lastMode = lastView.parsePath(3).slice(3);
  if( curMode != lastMode )
  {
    if( lastMode.length ) this["wdg_go_"+lastMode].attrSet("color","");
    if( curMode.length ) this["wdg_go_"+curMode].attrSet("color","#777799");
  }

  //> Pages counter display
  if( pgCont_pgOpenSrc.length && curMode.length )
  {
    elLst = this["pg_"+curSO]["pg_"+curMode].nodeList("pg_");
    curEl = pgCont_pgOpenSrc.parsePath(4);
    for( i_m = 0; i_m < elLst.length; i_m++ ) if( elLst[i_m] == curEl ) break;
    pgCntr_text = ""+(i_m+1)+"\n("+elLst.length+")";
    prev_active = next_active = (elLst.length>1);
  }
  else { pgCntr_text = "-"; prev_active = next_active = false; }

  lastView = pgCont_pgOpenSrc;
}

//> Cvitation button's
cvt_light_en = alarmSt&0x100; cvt_alarm_en = alarmSt&0x200; cvt_sound_en = alarmSt&0x400;
cvt_light_active = alarmSt&0x10000; cvt_alarm_active = alarmSt&0x20000; cvt_sound_active = alarmSt&0x40000;

//> One second's calls
if( (calcCnt%f_frq) == 0 )
{
  //> Alarms display
  soLst = this.nodeList("pg_");
  for( i = 0; i < soLst.length; i++ )
  {
    curSO = soLst[i].slice(3);
    aSt = this["pg_"+curSO].attr("alarmSt");
    aLev = aSt&0xFF;
    if( aLev && aSt&0x100 )
    {  
      if( aLev > 30 ) wColor = "#ff0000";
      else wColor = "#ffff00";
      curColor = this["wdg_so"+curSO].attr("colorText");
      this["wdg_so"+curSO].attrSet("colorText",(aSt&0x10000 && curColor==wColor)?"black":wColor);
    }
    else this["wdg_so"+curSO].attrSet("colorText","#00ff00");
  }
}

//> Events process
ev_rez = "";
off = 0;
while(true)
{
  sval = event.parse(0,"\n",off);
//  messPut("MainPg",1,"Event: "+sval);
  if( sval == "" ) break;
  else if( sval == "ws_BtPress:/cvt_light" ) alarmSt = 0x1000001;
  else if( sval == "ws_BtPress:/cvt_alarm" ) alarmSt = 0x1000002;
  else if( sval == "ws_BtPress:/cvt_sound" ) alarmSt = 0x1000004;
  else ev_rez+=sval+"\n";
}
event=ev_rez;

//> Demo play process
if(f_start || !play_value) { stepCur = -1; stepTm = 0; play_img = "start"; }
if(play_value)
{
	play_img = "stop";
	if(stepTm > 0) stepTm -= 1/f_frq;
	else
	{
		var args = new Object();
		args.this = this;
		args.stepTm = stepTm;
		args.stepCur = stepCur;
		SYS.DAQ.funcCall("JavaLikeCalc.JavaScript",args,demoPlayProc);
		stepTm = args.stepTm;
		stepCur = args.stepCur;
	}
}


ID: ElViewCadr
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;evProc;backColor;bordWidth;bordColor;bordStyle;
ICO:

PROC:
JavaLikeCalc.JavaScript
text_arg0val = name;
text_arg1val = var;
trnd_prm0addr = addr;
bordColor = (focus&&bordColor!="white")?"white":"gray";

uk#PROC:
JavaLikeCalc.JavaScript
text_arg0val = name;
text_arg1val = var;
trnd_prm0addr = addr;
bordColor = (focus&&bordColor!="white")?"white":"gray";

ru#PROC:
JavaLikeCalc.JavaScript
text_arg0val = name;
text_arg1val = var;
trnd_prm0addr = addr;
bordColor = (focus&&bordColor!="white")?"white":"gray";


ID: grpCadr
PARENT: /wlb_originals/wdg_Box
ATTRS: name;dscr;geomW;geomH;evProc;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
curTm = Special.FLibSYS.tmTime();
if( !trnd1_tSek ) trnd1_tSek = curTm;
//- Events process -
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur=Special.FLibSYS.strParse(event,0,"\n",off);
  if( ev_cur == "" ) break;
  //Special.FLibSYS.messPut("Trend",0,"Event: "+ev_cur);
  if( ev_cur == "key_presSC#3b:/trnd1")  trnd1_tSek-=trnd1_tSize/2;
  else if( ev_cur == "key_presSC#3c:/trnd1")  trnd1_tSek+=trnd1_tSize/2;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//- Trend time control -
if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if( trnd1_tSek < curTm ) trnd1_trcPer=0;
else { trnd1_trcPer=1; trnd1_tSek=0;  }

//- Generic -
name_arg0val = grpName;

//- Trend 1 -
if( el1_prmAddr == EVAL_STR ) { el1_en = false; trnd1_prm0addr = ""; }
else
{
  el1_en = true;
  trnd1_prm0addr = el1_prmAddr; trnd1_prm0bordL = el1_min; trnd1_prm0bordU = el1_max; trnd1_prm0color = el1_bordColor;
}

//- Trend 2 -
if( el2_prmAddr == EVAL_STR ) { el2_en = false; trnd1_prm1addr = ""; }
else
{
  el2_en = true;
  trnd1_prm1addr = el2_prmAddr; trnd1_prm1bordL = el2_min; trnd1_prm1bordU = el2_max; trnd1_prm1color = el2_bordColor;
}

//- Trend 3 -
if( el3_prmAddr == EVAL_STR ) { el3_en = false; trnd1_prm2addr = ""; }
else
{
  el3_en = true;
  trnd1_prm2addr = el3_prmAddr; trnd1_prm2bordL = el3_min; trnd1_prm2bordU = el3_max; trnd1_prm2color = el3_bordColor;
}

//- Trend 4 -
if( el4_prmAddr == EVAL_STR ) { el4_en = false; trnd1_prm3addr = ""; }
else
{
  el4_en = true;
  trnd1_prm3addr = el4_prmAddr; trnd1_prm3bordL = el4_min; trnd1_prm3bordU = el4_max; trnd1_prm3color = el4_bordColor;
}

//- Trend 5 -
if( el5_prmAddr == EVAL_STR ) { el5_en = false; trnd1_prm4addr = ""; }
else
{
  el5_en = true;
  trnd1_prm4addr = el5_prmAddr; trnd1_prm4bordL = el5_min; trnd1_prm4bordU = el5_max; trnd1_prm4color = el5_bordColor;
}

//- Trend 6 -
if( el6_prmAddr == EVAL_STR ) { el6_en = false; trnd1_prm5addr = ""; }
else
{
  el6_en = true;
  trnd1_prm5addr = el6_prmAddr; trnd1_prm5bordL = el6_min; trnd1_prm5bordU = el6_max; trnd1_prm5color = el6_bordColor;
}

//- Trend 7 -
if( el7_prmAddr == EVAL_STR ) { el7_en = false; trnd1_prm6addr = ""; }
else
{
  el7_en = true;
  trnd1_prm6addr = el7_prmAddr; trnd1_prm6bordL = el7_min; trnd1_prm6bordU = el7_max; trnd1_prm6color = el7_bordColor;
}

//- Trend 8 -
if( el8_prmAddr == EVAL_STR ) { el8_en = false; trnd1_prm7addr = ""; }
else
{
  el8_en = true;
  trnd1_prm7addr = el8_prmAddr; trnd1_prm7bordL = el8_min; trnd1_prm7bordU = el8_max; trnd1_prm7color = el8_bordColor;
}

uk#PROC:
JavaLikeCalc.JavaScript
curTm = Special.FLibSYS.tmTime();
if( !trnd1_tSek ) trnd1_tSek = curTm;
//- Events process -
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur=Special.FLibSYS.strParse(event,0,"\n",off);
  if( ev_cur == "" ) break;
  //Special.FLibSYS.messPut("Trend",0,"Event: "+ev_cur);
  if( ev_cur == "key_presSC#3b:/trnd1")  trnd1_tSek-=trnd1_tSize/2;
  else if( ev_cur == "key_presSC#3c:/trnd1")  trnd1_tSek+=trnd1_tSize/2;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//- Trend time control -
if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if( trnd1_tSek < curTm ) trnd1_trcPer=0;
else { trnd1_trcPer=1; trnd1_tSek=0;  }

//- Generic -
name_arg0val = grpName;

//- Trend 1 -
if( el1_prmAddr == EVAL_STR ) { el1_en = false; trnd1_prm0addr = ""; }
else
{
  el1_en = true;
  trnd1_prm0addr = el1_prmAddr; trnd1_prm0bordL = el1_min; trnd1_prm0bordU = el1_max; trnd1_prm0color = el1_bordColor;
}

//- Trend 2 -
if( el2_prmAddr == EVAL_STR ) { el2_en = false; trnd1_prm1addr = ""; }
else
{
  el2_en = true;
  trnd1_prm1addr = el2_prmAddr; trnd1_prm1bordL = el2_min; trnd1_prm1bordU = el2_max; trnd1_prm1color = el2_bordColor;
}

//- Trend 3 -
if( el3_prmAddr == EVAL_STR ) { el3_en = false; trnd1_prm2addr = ""; }
else
{
  el3_en = true;
  trnd1_prm2addr = el3_prmAddr; trnd1_prm2bordL = el3_min; trnd1_prm2bordU = el3_max; trnd1_prm2color = el3_bordColor;
}

//- Trend 4 -
if( el4_prmAddr == EVAL_STR ) { el4_en = false; trnd1_prm3addr = ""; }
else
{
  el4_en = true;
  trnd1_prm3addr = el4_prmAddr; trnd1_prm3bordL = el4_min; trnd1_prm3bordU = el4_max; trnd1_prm3color = el4_bordColor;
}

//- Trend 5 -
if( el5_prmAddr == EVAL_STR ) { el5_en = false; trnd1_prm4addr = ""; }
else
{
  el5_en = true;
  trnd1_prm4addr = el5_prmAddr; trnd1_prm4bordL = el5_min; trnd1_prm4bordU = el5_max; trnd1_prm4color = el5_bordColor;
}

//- Trend 6 -
if( el6_prmAddr == EVAL_STR ) { el6_en = false; trnd1_prm5addr = ""; }
else
{
  el6_en = true;
  trnd1_prm5addr = el6_prmAddr; trnd1_prm5bordL = el6_min; trnd1_prm5bordU = el6_max; trnd1_prm5color = el6_bordColor;
}

//- Trend 7 -
if( el7_prmAddr == EVAL_STR ) { el7_en = false; trnd1_prm6addr = ""; }
else
{
  el7_en = true;
  trnd1_prm6addr = el7_prmAddr; trnd1_prm6bordL = el7_min; trnd1_prm6bordU = el7_max; trnd1_prm6color = el7_bordColor;
}

//- Trend 8 -
if( el8_prmAddr == EVAL_STR ) { el8_en = false; trnd1_prm7addr = ""; }
else
{
  el8_en = true;
  trnd1_prm7addr = el8_prmAddr; trnd1_prm7bordL = el8_min; trnd1_prm7bordU = el8_max; trnd1_prm7color = el8_bordColor;
}

ru#PROC:
JavaLikeCalc.JavaScript
curTm = Special.FLibSYS.tmTime();
if( !trnd1_tSek ) trnd1_tSek = curTm;
//- Events process -
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur=Special.FLibSYS.strParse(event,0,"\n",off);
  if( ev_cur == "" ) break;
  //Special.FLibSYS.messPut("Trend",0,"Event: "+ev_cur);
  if( ev_cur == "key_presSC#3b:/trnd1")  trnd1_tSek-=trnd1_tSize/2;
  else if( ev_cur == "key_presSC#3c:/trnd1")  trnd1_tSek+=trnd1_tSize/2;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//- Trend time control -
if( trnd1_curSek > trnd1_tSek || trnd1_curSek < (trnd1_tSek-trnd1_tSize) ) trnd1_curSek = trnd1_tSek;
if( trnd1_tSek < curTm ) trnd1_trcPer=0;
else { trnd1_trcPer=1; trnd1_tSek=0;  }

//- Generic -
name_arg0val = grpName;

//- Trend 1 -
if( el1_prmAddr == EVAL_STR ) { el1_en = false; trnd1_prm0addr = ""; }
else
{
  el1_en = true;
  trnd1_prm0addr = el1_prmAddr; trnd1_prm0bordL = el1_min; trnd1_prm0bordU = el1_max; trnd1_prm0color = el1_bordColor;
}

//- Trend 2 -
if( el2_prmAddr == EVAL_STR ) { el2_en = false; trnd1_prm1addr = ""; }
else
{
  el2_en = true;
  trnd1_prm1addr = el2_prmAddr; trnd1_prm1bordL = el2_min; trnd1_prm1bordU = el2_max; trnd1_prm1color = el2_bordColor;
}

//- Trend 3 -
if( el3_prmAddr == EVAL_STR ) { el3_en = false; trnd1_prm2addr = ""; }
else
{
  el3_en = true;
  trnd1_prm2addr = el3_prmAddr; trnd1_prm2bordL = el3_min; trnd1_prm2bordU = el3_max; trnd1_prm2color = el3_bordColor;
}

//- Trend 4 -
if( el4_prmAddr == EVAL_STR ) { el4_en = false; trnd1_prm3addr = ""; }
else
{
  el4_en = true;
  trnd1_prm3addr = el4_prmAddr; trnd1_prm3bordL = el4_min; trnd1_prm3bordU = el4_max; trnd1_prm3color = el4_bordColor;
}

//- Trend 5 -
if( el5_prmAddr == EVAL_STR ) { el5_en = false; trnd1_prm4addr = ""; }
else
{
  el5_en = true;
  trnd1_prm4addr = el5_prmAddr; trnd1_prm4bordL = el5_min; trnd1_prm4bordU = el5_max; trnd1_prm4color = el5_bordColor;
}

//- Trend 6 -
if( el6_prmAddr == EVAL_STR ) { el6_en = false; trnd1_prm5addr = ""; }
else
{
  el6_en = true;
  trnd1_prm5addr = el6_prmAddr; trnd1_prm5bordL = el6_min; trnd1_prm5bordU = el6_max; trnd1_prm5color = el6_bordColor;
}

//- Trend 7 -
if( el7_prmAddr == EVAL_STR ) { el7_en = false; trnd1_prm6addr = ""; }
else
{
  el7_en = true;
  trnd1_prm6addr = el7_prmAddr; trnd1_prm6bordL = el7_min; trnd1_prm6bordU = el7_max; trnd1_prm6color = el7_bordColor;
}

//- Trend 8 -
if( el8_prmAddr == EVAL_STR ) { el8_en = false; trnd1_prm7addr = ""; }
else
{
  el8_en = true;
  trnd1_prm7addr = el8_prmAddr; trnd1_prm7bordL = el8_min; trnd1_prm7bordU = el8_max; trnd1_prm7color = el8_bordColor;
}


ID: anShow
PARENT: /wlb_originals/wdg_Box
ATTRS: path;name;active;geomH;contextMenu;evProc;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
name_text=pName;
val_arg0val=pVal;
val_font = "Arial 24 1 0 0 0"; 
if( pPrec != EVAL_INT ) val_arg0cfg=";f;"+pPrec;
if( pVal == EVAL_REAL ) { val_color = name_color = "grey"; val_font = "Arial 24 0 1 0 1"; alarm = ""; pErrCode=0; return; }

//Alarms create
if( pErrCode != pErr )
{
  pErrCode = pErr;
  if( pErrCode==1 || pErrCode==2 ){ if(redEVAL != EVAL_BOOL && redEVAL) alarm = "100|"+pName+"|"+spName+" - reject.|7"; else alarm = "100|"+pName+"||1"; }
  else if( pErrCode==3 )	{ alarm = "50|"+pName+"|"+spName+" above alarm border.|7"; }
  else if( pErrCode==4 )	{ alarm = "50|"+pName+"|"+spName+" bellow alarm border.|7"; }
  else if( pErrCode==5 )	{ alarm = "10|"+pName+"|"+spName+" above warning border."+"|7"; }
  else if( pErrCode==6 )	{ alarm = "10|"+pName+"|"+spName+ " bellow warning border."+"|7"; }
  else if( alarmSt&0x100 ) alarm = "1|"+pName+"||1";
}
if( !pErrCode && alarmSt&0x100 && !(alarmSt&0x10000) ) alarm = "";

//Alarm color change
alarmLev = alarmSt&0xFF;
if( alarmLev && alarmSt&0x100 )
{
  blinkPr = true;
  if( !pErrCode ) wColor = "lime";
  else if( alarmLev > 75 ){ wColor = "grey";   blinkPr = false; }
  else if( alarmLev > 30 ) wColor = "red";
  else wColor = "yellow";
  if( blinkPr ) name_color = val_color = (alarmSt&0x10000 && name_color==wColor) ? "grey" : wColor;
  else 
  { 
    if( pErrCode==1 || pErrCode==2 ) { val_color = wColor; val_font = "Arial 24 0 1 0 1"; name_color = (redEVAL != EVAL_BOOL && redEVAL) ? "red" : wColor; }
    else name_color = val_color = wColor;
  }
}
else  name_color = val_color = "lime";

//> Blink focused or linked with ElCadr
if( vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == pName )
{
  bordColor =  bordColor != "white" ? "white" : "grey";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "grey"; }

//> Check the regulator mode
if( pModeC != EVAL_BOOL && pModeC ) mode_text = "C";
else mode_text = (pModeA == EVAL_BOOL) ? "" : ((pModeA) ? "A" : "M");

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
name_text=pName;
val_arg0val=pVal;
val_font = "Arial 24 1 0 0 0"; 
if( pPrec != EVAL_INT ) val_arg0cfg=";f;"+pPrec;
if( pVal == EVAL_REAL ) { val_color = name_color = "grey"; val_font = "Arial 24 0 1 0 1"; alarm = ""; pErrCode=0; return; }

//Alarms create
if( pErrCode != pErr )
{
  pErrCode = pErr;
  if( pErrCode==1 || pErrCode==2 ){ if(redEVAL != EVAL_BOOL && redEVAL) alarm = "100|"+pName+"|"+spName+" - відмова.|5"; else alarm = "100|"+pName+"||1"; }
  else if( pErrCode==3 )	{ alarm = "50|"+pName+"|"+spName+" вище за допустиму границю.|7"; }
  else if( pErrCode==4 )	{ alarm = "50|"+pName+"|"+spName+" нижче за допустиму границю.|7"; }
  else if( pErrCode==5 )	{ alarm = "10|"+pName+"|"+spName+" вище норми.|7"; }
  else if( pErrCode==6 )	{ alarm = "10|"+pName+"|"+spName+ " нижче норми.|7"; }
  else if( alarmSt&0x100 ) alarm = "1|"+pName+"||1";
}
if( !pErrCode && alarmSt&0x100 && !(alarmSt&0x10000) ) alarm = "";

//Alarm color change
alarmLev = alarmSt&0xFF;
if( alarmLev && alarmSt&0x100 )
{
  blinkPr = true;
  if( !pErrCode ) wColor = "lime";
  else if( alarmLev > 75 ){ wColor = "grey";   blinkPr = false; }
  else if( alarmLev > 30 ) wColor = "red";
  else wColor = "yellow";
  if( blinkPr ) name_color = val_color = (alarmSt&0x10000 && name_color==wColor) ? "grey" : wColor;
  else 
  { 
    if( pErrCode==1 || pErrCode==2 ) { val_color = wColor; val_font = "Arial 24 0 1 0 1"; name_color = (redEVAL != EVAL_BOOL && redEVAL) ? "red" : wColor; }
    else name_color = val_color = wColor;
  }
}
else  name_color = val_color = "lime";

//> Blink focused or linked with ElCadr
if( vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == pName )
{
  bordColor =  bordColor != "white" ? "white" : "grey";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "grey"; }

//> Check the regulator mode
if( pModeC != EVAL_BOOL && pModeC ) mode_text = "К";
else mode_text = (pModeA == EVAL_BOOL) ? "" : ((pModeA) ? "А" : "Р");

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
name_text=pName;
val_arg0val=pVal;
val_font = "Arial 24 1 0 0 0"; 
if( pPrec != EVAL_INT ) val_arg0cfg=";f;"+pPrec;
if( pVal == EVAL_REAL ) { val_color = name_color = "grey"; val_font = "Arial 24 0 1 0 1"; alarm = ""; pErrCode=0; return; }

//Alarms create
if( pErrCode != pErr )
{
  pErrCode = pErr;
  if( pErrCode==1 || pErrCode==2 ){ if(redEVAL != EVAL_BOOL && redEVAL) alarm = "100|"+pName+"|"+spName+" - отказ.|5"; else alarm = "100|"+pName+"||1"; }
  else if( pErrCode==3 )	{ alarm = "50|"+pName+"|"+spName+" выше допустимой границы.|7"; }
  else if( pErrCode==4 )	{ alarm = "50|"+pName+"|"+spName+" ниже допустимой границы.|7"; }
  else if( pErrCode==5 )	{ alarm = "10|"+pName+"|"+spName+" выше нормы.|7"; }
  else if( pErrCode==6 )	{ alarm = "10|"+pName+"|"+spName+ " ниже нормы.|7"; }
  else if( alarmSt&0x100 ) alarm = "1|"+pName+"||1";
}
if( !pErrCode && alarmSt&0x100 && !(alarmSt&0x10000) ) alarm = "";

//Alarm color change
alarmLev = alarmSt&0xFF;
if( alarmLev && alarmSt&0x100 )
{
  blinkPr = true;
  if( !pErrCode ) wColor = "lime";
  else if( alarmLev > 75 ){ wColor = "grey";   blinkPr = false; }
  else if( alarmLev > 30 ) wColor = "red";
  else wColor = "yellow";
  if( blinkPr ) name_color = val_color = (alarmSt&0x10000 && name_color==wColor) ? "grey" : wColor;
  else 
  { 
    if( pErrCode==1 || pErrCode==2 ) { val_color = wColor; val_font = "Arial 24 0 1 0 1"; name_color = (redEVAL != EVAL_BOOL && redEVAL) ? "red" : wColor; }
    else name_color = val_color = wColor;
  }
}
else  name_color = val_color = "lime";

//> Blink focused or linked with ElCadr
if( vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == pName )
{
  bordColor =  bordColor != "white" ? "white" : "grey";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "grey"; }

//> Check the regulator mode
if( pModeC != EVAL_BOOL && pModeC ) mode_text = "К";
else mode_text = (pModeA == EVAL_BOOL) ? "" : ((pModeA) ? "А" : "Р");


ID: ViewCadr
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
name_arg0val = name;

if( f_start )
{
  el1_1_en = (el1_1_addr!=EVAL_STR); el1_2_en = (el1_2_addr!=EVAL_STR); el1_3_en = (el1_3_addr!=EVAL_STR); 
  el1_4_en = (el1_4_addr!=EVAL_STR); el1_5_en = (el1_5_addr!=EVAL_STR); el1_6_en = (el1_6_addr!=EVAL_STR);
  el2_1_en = (el2_1_addr!=EVAL_STR); el2_2_en = (el2_2_addr!=EVAL_STR); el2_3_en = (el2_3_addr!=EVAL_STR); 
  el2_4_en = (el2_4_addr!=EVAL_STR); el2_5_en = (el2_5_addr!=EVAL_STR); el2_6_en = (el2_6_addr!=EVAL_STR);
  el3_1_en = (el3_1_addr!=EVAL_STR); el3_2_en = (el3_2_addr!=EVAL_STR); el3_3_en = (el3_3_addr!=EVAL_STR); 
  el3_4_en = (el3_4_addr!=EVAL_STR); el3_5_en = (el3_5_addr!=EVAL_STR); el3_6_en = (el3_6_addr!=EVAL_STR);
  el4_1_en = (el4_1_addr!=EVAL_STR); el4_2_en = (el4_2_addr!=EVAL_STR); el4_3_en = (el4_3_addr!=EVAL_STR); 
  el4_4_en = (el4_4_addr!=EVAL_STR); el4_5_en = (el4_5_addr!=EVAL_STR); el4_6_en = (el4_6_addr!=EVAL_STR);

  rows = new Array( (el1_1_en || el1_2_en || el1_3_en || el1_4_en || el1_5_en || el1_6_en),
		        (el2_1_en || el2_2_en || el2_3_en || el2_4_en || el2_5_en || el2_6_en),
		        (el3_1_en || el3_2_en || el3_3_en || el3_4_en || el3_5_en || el3_6_en),
                                   (el4_1_en || el4_2_en || el4_3_en || el4_4_en || el4_5_en || el4_6_en) );
  cols = new Array( (el1_1_en || el2_1_en || el3_1_en || el4_1_en), (el1_2_en || el2_2_en || el3_2_en || el4_2_en), (el1_3_en || el2_3_en || el3_3_en || el4_3_en),
		      (el1_4_en || el2_4_en || el3_4_en || el4_4_en), (el1_5_en || el2_5_en || el3_5_en || el4_5_en), (el1_6_en || el2_6_en || el3_6_en || el4_6_en) );

  xScale = 0; for( i = 0; i < 6; i++ ) xScale += cols[i]; if( xScale ) xScale = 6/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 6; j++ ) this["wdg_el"+i+"_"+j].attrSet("geomXsc",xScale);
      this["wdg_el"+i+"_2"].attrSet( "geomX", 3 + 150*xScale*cols[0] );
      this["wdg_el"+i+"_3"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]) );
      this["wdg_el"+i+"_4"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]) );
      this["wdg_el"+i+"_5"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]) );
      this["wdg_el"+i+"_6"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]+cols[4]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 6; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_el"+i+"_"+j].attrSet("geomYsc",yScale);
      this["wdg_el2_"+j].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_el3_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_el4_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}

uk#PROC:
JavaLikeCalc.JavaScript
name_arg0val = name;

if( f_start )
{
  el1_1_en = (el1_1_addr!=EVAL_STR); el1_2_en = (el1_2_addr!=EVAL_STR); el1_3_en = (el1_3_addr!=EVAL_STR); 
  el1_4_en = (el1_4_addr!=EVAL_STR); el1_5_en = (el1_5_addr!=EVAL_STR); el1_6_en = (el1_6_addr!=EVAL_STR);
  el2_1_en = (el2_1_addr!=EVAL_STR); el2_2_en = (el2_2_addr!=EVAL_STR); el2_3_en = (el2_3_addr!=EVAL_STR); 
  el2_4_en = (el2_4_addr!=EVAL_STR); el2_5_en = (el2_5_addr!=EVAL_STR); el2_6_en = (el2_6_addr!=EVAL_STR);
  el3_1_en = (el3_1_addr!=EVAL_STR); el3_2_en = (el3_2_addr!=EVAL_STR); el3_3_en = (el3_3_addr!=EVAL_STR); 
  el3_4_en = (el3_4_addr!=EVAL_STR); el3_5_en = (el3_5_addr!=EVAL_STR); el3_6_en = (el3_6_addr!=EVAL_STR);
  el4_1_en = (el4_1_addr!=EVAL_STR); el4_2_en = (el4_2_addr!=EVAL_STR); el4_3_en = (el4_3_addr!=EVAL_STR); 
  el4_4_en = (el4_4_addr!=EVAL_STR); el4_5_en = (el4_5_addr!=EVAL_STR); el4_6_en = (el4_6_addr!=EVAL_STR);

  rows = new Array( (el1_1_en || el1_2_en || el1_3_en || el1_4_en || el1_5_en || el1_6_en),
		        (el2_1_en || el2_2_en || el2_3_en || el2_4_en || el2_5_en || el2_6_en),
		        (el3_1_en || el3_2_en || el3_3_en || el3_4_en || el3_5_en || el3_6_en),
                                   (el4_1_en || el4_2_en || el4_3_en || el4_4_en || el4_5_en || el4_6_en) );
  cols = new Array( (el1_1_en || el2_1_en || el3_1_en || el4_1_en), (el1_2_en || el2_2_en || el3_2_en || el4_2_en), (el1_3_en || el2_3_en || el3_3_en || el4_3_en),
		      (el1_4_en || el2_4_en || el3_4_en || el4_4_en), (el1_5_en || el2_5_en || el3_5_en || el4_5_en), (el1_6_en || el2_6_en || el3_6_en || el4_6_en) );

  xScale = 0; for( i = 0; i < 6; i++ ) xScale += cols[i]; if( xScale ) xScale = 6/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 6; j++ ) this["wdg_el"+i+"_"+j].attrSet("geomXsc",xScale);
      this["wdg_el"+i+"_2"].attrSet( "geomX", 3 + 150*xScale*cols[0] );
      this["wdg_el"+i+"_3"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]) );
      this["wdg_el"+i+"_4"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]) );
      this["wdg_el"+i+"_5"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]) );
      this["wdg_el"+i+"_6"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]+cols[4]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 6; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_el"+i+"_"+j].attrSet("geomYsc",yScale);
      this["wdg_el2_"+j].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_el3_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_el4_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}

ru#PROC:
JavaLikeCalc.JavaScript
name_arg0val = name;

if( f_start )
{
  el1_1_en = (el1_1_addr!=EVAL_STR); el1_2_en = (el1_2_addr!=EVAL_STR); el1_3_en = (el1_3_addr!=EVAL_STR); 
  el1_4_en = (el1_4_addr!=EVAL_STR); el1_5_en = (el1_5_addr!=EVAL_STR); el1_6_en = (el1_6_addr!=EVAL_STR);
  el2_1_en = (el2_1_addr!=EVAL_STR); el2_2_en = (el2_2_addr!=EVAL_STR); el2_3_en = (el2_3_addr!=EVAL_STR); 
  el2_4_en = (el2_4_addr!=EVAL_STR); el2_5_en = (el2_5_addr!=EVAL_STR); el2_6_en = (el2_6_addr!=EVAL_STR);
  el3_1_en = (el3_1_addr!=EVAL_STR); el3_2_en = (el3_2_addr!=EVAL_STR); el3_3_en = (el3_3_addr!=EVAL_STR); 
  el3_4_en = (el3_4_addr!=EVAL_STR); el3_5_en = (el3_5_addr!=EVAL_STR); el3_6_en = (el3_6_addr!=EVAL_STR);
  el4_1_en = (el4_1_addr!=EVAL_STR); el4_2_en = (el4_2_addr!=EVAL_STR); el4_3_en = (el4_3_addr!=EVAL_STR); 
  el4_4_en = (el4_4_addr!=EVAL_STR); el4_5_en = (el4_5_addr!=EVAL_STR); el4_6_en = (el4_6_addr!=EVAL_STR);

  rows = new Array( (el1_1_en || el1_2_en || el1_3_en || el1_4_en || el1_5_en || el1_6_en),
		        (el2_1_en || el2_2_en || el2_3_en || el2_4_en || el2_5_en || el2_6_en),
		        (el3_1_en || el3_2_en || el3_3_en || el3_4_en || el3_5_en || el3_6_en),
                                   (el4_1_en || el4_2_en || el4_3_en || el4_4_en || el4_5_en || el4_6_en) );
  cols = new Array( (el1_1_en || el2_1_en || el3_1_en || el4_1_en), (el1_2_en || el2_2_en || el3_2_en || el4_2_en), (el1_3_en || el2_3_en || el3_3_en || el4_3_en),
		      (el1_4_en || el2_4_en || el3_4_en || el4_4_en), (el1_5_en || el2_5_en || el3_5_en || el4_5_en), (el1_6_en || el2_6_en || el3_6_en || el4_6_en) );

  xScale = 0; for( i = 0; i < 6; i++ ) xScale += cols[i]; if( xScale ) xScale = 6/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 6; j++ ) this["wdg_el"+i+"_"+j].attrSet("geomXsc",xScale);
      this["wdg_el"+i+"_2"].attrSet( "geomX", 3 + 150*xScale*cols[0] );
      this["wdg_el"+i+"_3"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]) );
      this["wdg_el"+i+"_4"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]) );
      this["wdg_el"+i+"_5"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]) );
      this["wdg_el"+i+"_6"].attrSet( "geomX", 3 + 150*xScale*(cols[0]+cols[1]+cols[2]+cols[3]+cols[4]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 6; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_el"+i+"_"+j].attrSet("geomYsc",yScale);
      this["wdg_el2_"+j].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_el3_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_el4_"+j].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}


ID: anShow1
PARENT: /wlb_originals/wdg_Box
ATTRS: name;active;geomH;evProc;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
name_text=pName;
val_arg0val=pVal;
if( prec != EVAL_INT ) val_arg0cfg=";f;"+prec;

uk#PROC:
JavaLikeCalc.JavaScript
name_text=pName;
val_arg0val=pVal;
if( prec != EVAL_INT ) val_arg0cfg=";f;"+prec;

ru#PROC:
JavaLikeCalc.JavaScript
name_text=pName;
val_arg0val=pVal;
if( prec != EVAL_INT ) val_arg0cfg=";f;"+prec;


ID: cntrRegul
PARENT: /wlb_originals/wdg_Box
ATTRS: id;path;name;active;geomW;geomH;evProc;pgGrp;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
txt_pnlTitle_arg0val = NAME;

if( f_start ) clc = 0;
clc++;
if( clc == 3 ) event+="usr_ElCadr";
ev_wrk=ev_rez="";
off=0;
while(true)
{
    ev_wrk=event.parse(0,"\n",off);
    if( ev_wrk == "" ) break;
    if( ev_wrk == "ws_LnAccept:/kp" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kp : "+DESCR+" : "+Kp+" : " +kp_value); Kp = kp_value; }
    else if( ev_wrk == "ws_LnAccept:/ki" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ki : "+DESCR+" : "+Ki+" : " +ki_value); Ki = ki_value; }
    else if( ev_wrk == "ws_LnAccept:/ti" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ti : "+DESCR+" : "+Ti/1000+" : " +ti_value); Ti = 1000*ti_value; }
    else if( ev_wrk == "ws_LnAccept:/kd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kd : "+DESCR+" : "+Kd+" : " +kd_value); Kd = kd_value; }
    else if( ev_wrk == "ws_LnAccept:/td" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Td : "+DESCR+" : "+Td/1000+" : " +td_value); Td = 1000*td_value; }
    else if( ev_wrk == "ws_LnAccept:/tzd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Tzd : "+DESCR+" : "+Tzd+" : " +tzd_value); Tzd = 1000*tzd_value; }
    else if( ev_wrk == "ws_LnAccept:/zn" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Zn : "+DESCR+" : "+Zi+" : " +zn_value); Zi = zn_value; }
    else if( ev_wrk == "ws_LnAccept:/h1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H1 : "+DESCR+" : "+Hdwn+" : " +h1_value); Hdwn = h1_value; }
    else if( ev_wrk == "ws_LnAccept:/h2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H2 : "+DESCR+" : "+Hup+" : " +h2_value); Hup = h2_value; }
    else if( ev_wrk == "ws_LnAccept:/k1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K1 : "+DESCR+" : "+K1+" : " +k1_value); K1 = k1_value; }
    else if( ev_wrk == "ws_LnAccept:/k2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K2 : "+DESCR+" : "+K2+" : " +k2_value); K2 = k2_value; }
    else if( ev_wrk == "ws_LnAccept:/k3" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K3 : "+DESCR+" : "+K3+" : " +k3_value); K3 = k3_value; }
    else if( ev_wrk == "ws_LnAccept:/k4" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K4 : "+DESCR+" : "+K4+" : " +k4_value); K4 = k4_value; }
    else if( ev_wrk == "ws_LnAccept:/tiPer" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpPer : "+DESCR+" : "+TImpPer/1000+" : " +tiPer_value); TImpPer = 1000*tiPer_value; }
    else if( ev_wrk == "ws_LnAccept:/tiMin" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpMin : "+DESCR+" : "+TImpMin/1000+" : " +tiMin_value); TImpMin = 1000*tiMin_value; }    
    else if( ev_wrk == "ws_LnAccept:/rfct" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.KImpRfact : "+DESCR+" : "+KImpRfact+" : " +rfct_value); KImpRfact = rfct_value; }
    else ev_rez+=ev_wrk+"\n";
}
event=ev_rez;

kp_active = (Kp!=EVAL_REAL); kp_value = kp_active?Kp:0;
ki_active = (Ki!=EVAL_REAL); ki_value = ki_active?Ki:0;
ti_active = (Ti!=EVAL_REAL); ti_value = ti_active?Ti/1000:0;
kd_active = (Kd!=EVAL_REAL); kd_value = kd_active?Kd:0;
td_active = (Td!=EVAL_REAL); td_value = td_active?Td/1000:0;
tzd_active = (Tzd!=EVAL_REAL); tzd_value = tzd_active?Tzd/1000:0;
zn_active = (Zi!=EVAL_REAL); zn_value = zn_active?Zi:0;
h1_active = (Hdwn!=EVAL_REAL); h1_value = h1_active?Hdwn:0;
h2_active = (Hup!=EVAL_REAL); h2_value = h2_active?Hup:0;
k1_active = (K1!=EVAL_REAL); k1_value = k1_active?K1:0;
k2_active = (K2!=EVAL_REAL); k2_value = k2_active?K2:0;
k3_active = (K3!=EVAL_REAL); k3_value = k3_active?K3:0;
k4_active = (K4!=EVAL_REAL); k4_value = k4_active?K4:0;
tiPer_active = (TImpPer!=EVAL_REAL); tiPer_value = tiPer_active?TImpPer/1000:0;
tiMin_active = (TImpMin!=EVAL_REAL); tiMin_value = tiMin_active?TImpMin/1000:0;
rfct_active = (KImpRfact!=EVAL_REAL); rfct_value = rfct_active?KImpRfact:0;

doc_tmpl = "<body  bgcolor='grey'><table style='color: white' border='1' cellpadding='1' cellspacing='0' width='100%'>\n";
doc_tmpl += "<tr><td>Id:</td><td>"+((EVAL_STR == SHIFR) ? "" : strEnc2HTML(SHIFR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Name:</td><td>"+((EVAL_STR == NAME) ? "" : strEnc2HTML(NAME))+"</td></tr>\n";
doc_tmpl += "<tr><td>Description:</td><td>"+((EVAL_STR == DESCR) ? "" : strEnc2HTML(DESCR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Dimension:</td><td>"+((EVAL_STR==ed) ? "" : strEnc2HTML(ed))+"</td></tr>\n";
doc_tmpl += "<tr><td>Setpoint:</td><td>"+ ((trnd_prm1val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm1val) : strEnc2HTML(real2str(trnd_prm1val,prec))) : "");
doc_tmpl += ((trnd_prm1val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm1val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Variable:</td><td>"+ ((trnd_prm2val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm2val) :strEnc2HTML(real2str(trnd_prm2val,prec))) : "");
doc_tmpl += ((trnd_prm2val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm2val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Output:</td><td>"+((trnd_prm0val != EVAL_REAL) ? strEnc2HTML(real2str(trnd_prm0val,1)) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Scale:</td><td>"+(min != EVAL_REAL ? strEnc2HTML(min) : "")+" ... "+(max != EVAL_REAL ? strEnc2HTML(max) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Mode:</td><td>"+((trnd_prm3val==EVAL_REAL)?" - ": (trnd_prm3val ? "Automat" : "Manual"))+"</td></tr>\n";
doc_tmpl += "</table></body>";

//Diagram
trnd_prm0addr = out_addr;
trnd_prm1addr = sp_addr;
trnd_prm1bordL = min;
trnd_prm1bordU = max;
trnd_prm2addr = var_addr;
trnd_prm2bordL = min;
trnd_prm2bordU = max;
trnd_prm3addr = auto_addr;
trnd_prm4addr = impQup_addr;
trnd_prm5addr = impQdwn_addr;

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
txt_pnlTitle_arg0val = NAME;

if( f_start ) clc = 0;
clc++;
if( clc == 3 ) event+="usr_ElCadr";
ev_wrk=ev_rez="";
off=0;
while(true)
{
    ev_wrk=event.parse(0,"\n",off);
    if( ev_wrk == "" ) break;
    if( ev_wrk == "ws_LnAccept:/kp" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kp : "+DESCR+" : "+Kp+" : " +kp_value); Kp = kp_value; }
    else if( ev_wrk == "ws_LnAccept:/ki" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ki : "+DESCR+" : "+Ki+" : " +ki_value); Ki = ki_value; }
    else if( ev_wrk == "ws_LnAccept:/ti" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ti : "+DESCR+" : "+Ti/1000+" : " +ti_value); Ti = 1000*ti_value; }
    else if( ev_wrk == "ws_LnAccept:/kd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kd : "+DESCR+" : "+Kd+" : " +kd_value); Kd = kd_value; }
    else if( ev_wrk == "ws_LnAccept:/td" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Td : "+DESCR+" : "+Td/1000+" : " +td_value); Td = 1000*td_value; }
    else if( ev_wrk == "ws_LnAccept:/tzd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Tzd : "+DESCR+" : "+Tzd+" : " +tzd_value); Tzd = 1000*tzd_value; }
    else if( ev_wrk == "ws_LnAccept:/zn" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Zn : "+DESCR+" : "+Zi+" : " +zn_value); Zi = zn_value; }
    else if( ev_wrk == "ws_LnAccept:/h1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H1 : "+DESCR+" : "+Hdwn+" : " +h1_value); Hdwn = h1_value; }
    else if( ev_wrk == "ws_LnAccept:/h2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H2 : "+DESCR+" : "+Hup+" : " +h2_value); Hup = h2_value; }
    else if( ev_wrk == "ws_LnAccept:/k1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K1 : "+DESCR+" : "+K1+" : " +k1_value); K1 = k1_value; }
    else if( ev_wrk == "ws_LnAccept:/k2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K2 : "+DESCR+" : "+K2+" : " +k2_value); K2 = k2_value; }
    else if( ev_wrk == "ws_LnAccept:/k3" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K3 : "+DESCR+" : "+K3+" : " +k3_value); K3 = k3_value; }
    else if( ev_wrk == "ws_LnAccept:/k4" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K4 : "+DESCR+" : "+K4+" : " +k4_value); K4 = k4_value; }
    else if( ev_wrk == "ws_LnAccept:/tiPer" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpPer : "+DESCR+" : "+TImpPer/1000+" : " +tiPer_value); TImpPer = 1000*tiPer_value; }
    else if( ev_wrk == "ws_LnAccept:/tiMin" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpMin : "+DESCR+" : "+TImpMin/1000+" : " +tiMin_value); TImpMin = 1000*tiMin_value; }    
    else if( ev_wrk == "ws_LnAccept:/rfct" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.KImpRfact : "+DESCR+" : "+KImpRfact+" : " +rfct_value); KImpRfact = rfct_value; }
    else ev_rez+=ev_wrk+"\n";
}
event=ev_rez;

kp_active = (Kp!=EVAL_REAL); kp_value = kp_active?Kp:0;
ki_active = (Ki!=EVAL_REAL); ki_value = ki_active?Ki:0;
ti_active = (Ti!=EVAL_REAL); ti_value = ti_active?Ti/1000:0;
kd_active = (Kd!=EVAL_REAL); kd_value = kd_active?Kd:0;
td_active = (Td!=EVAL_REAL); td_value = td_active?Td/1000:0;
tzd_active = (Tzd!=EVAL_REAL); tzd_value = tzd_active?Tzd/1000:0;
zn_active = (Zi!=EVAL_REAL); zn_value = zn_active?Zi:0;
h1_active = (Hdwn!=EVAL_REAL); h1_value = h1_active?Hdwn:0;
h2_active = (Hup!=EVAL_REAL); h2_value = h2_active?Hup:0;
k1_active = (K1!=EVAL_REAL); k1_value = k1_active?K1:0;
k2_active = (K2!=EVAL_REAL); k2_value = k2_active?K2:0;
k3_active = (K3!=EVAL_REAL); k3_value = k3_active?K3:0;
k4_active = (K4!=EVAL_REAL); k4_value = k4_active?K4:0;
tiPer_active = (TImpPer!=EVAL_REAL); tiPer_value = tiPer_active?TImpPer/1000:0;
tiMin_active = (TImpMin!=EVAL_REAL); tiMin_value = tiMin_active?TImpMin/1000:0;
rfct_active = (KImpRfact!=EVAL_REAL); rfct_value = rfct_active?KImpRfact:0;

doc_tmpl = "<body  bgcolor='grey'><table style='color: white' border='1' cellpadding='1' cellspacing='0' width='100%'>\n";
doc_tmpl += "<tr><td>Id:</td><td>"+((EVAL_STR == SHIFR) ? "" : strEnc2HTML(SHIFR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Ім’я:</td><td>"+((EVAL_STR == NAME) ? "" : strEnc2HTML(NAME))+"</td></tr>\n";
doc_tmpl += "<tr><td>Опис:</td><td>"+((EVAL_STR == DESCR) ? "" : strEnc2HTML(DESCR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Одиниця виміру:</td><td>"+((EVAL_STR==ed) ? "" : strEnc2HTML(ed))+"</td></tr>\n";
doc_tmpl += "<tr><td>Завдання:</td><td>"+ ((trnd_prm1val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm1val) : strEnc2HTML(real2str(trnd_prm1val,prec))) : "");
doc_tmpl += ((trnd_prm1val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm1val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Змінна:</td><td>"+ ((trnd_prm2val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm2val) :strEnc2HTML(real2str(trnd_prm2val,prec))) : "");
doc_tmpl += ((trnd_prm2val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm2val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Вихід:</td><td>"+((trnd_prm0val != EVAL_REAL) ? strEnc2HTML(real2str(trnd_prm0val,1)) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Шкала:</td><td>"+(min != EVAL_REAL ? strEnc2HTML(min) : "")+" ... "+(max != EVAL_REAL ? strEnc2HTML(max) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Режим:</td><td>"+((trnd_prm3val==EVAL_REAL)?" - ": (trnd_prm3val ? "Автомат" : "Ручний"))+"</td></tr>\n";
doc_tmpl += "</table></body>";

//Diagram
trnd_prm0addr = out_addr;
trnd_prm1addr = sp_addr;
trnd_prm1bordL = min;
trnd_prm1bordU = max;
trnd_prm2addr = var_addr;
trnd_prm2bordL = min;
trnd_prm2bordU = max;
trnd_prm3addr = auto_addr;
trnd_prm4addr = impQup_addr;
trnd_prm5addr = impQdwn_addr;

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
txt_pnlTitle_arg0val = NAME;

if( f_start ) clc = 0;
clc++;
if( clc == 3 ) event+="usr_ElCadr";
ev_wrk=ev_rez="";
off=0;
while(true)
{
    ev_wrk=event.parse(0,"\n",off);
    if( ev_wrk == "" ) break;
    if( ev_wrk == "ws_LnAccept:/kp" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kp : "+DESCR+" : "+Kp+" : " +kp_value); Kp = kp_value; }
    else if( ev_wrk == "ws_LnAccept:/ki" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ki : "+DESCR+" : "+Ki+" : " +ki_value); Ki = ki_value; }
    else if( ev_wrk == "ws_LnAccept:/ti" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Ti : "+DESCR+" : "+Ti/1000+" : " +ti_value); Ti = 1000*ti_value; }
    else if( ev_wrk == "ws_LnAccept:/kd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Kd : "+DESCR+" : "+Kd+" : " +kd_value); Kd = kd_value; }
    else if( ev_wrk == "ws_LnAccept:/td" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Td : "+DESCR+" : "+Td/1000+" : " +td_value); Td = 1000*td_value; }
    else if( ev_wrk == "ws_LnAccept:/tzd" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Tzd : "+DESCR+" : "+Tzd+" : " +tzd_value); Tzd = 1000*tzd_value; }
    else if( ev_wrk == "ws_LnAccept:/zn" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.Zn : "+DESCR+" : "+Zi+" : " +zn_value); Zi = zn_value; }
    else if( ev_wrk == "ws_LnAccept:/h1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H1 : "+DESCR+" : "+Hdwn+" : " +h1_value); Hdwn = h1_value; }
    else if( ev_wrk == "ws_LnAccept:/h2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.H2 : "+DESCR+" : "+Hup+" : " +h2_value); Hup = h2_value; }
    else if( ev_wrk == "ws_LnAccept:/k1" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K1 : "+DESCR+" : "+K1+" : " +k1_value); K1 = k1_value; }
    else if( ev_wrk == "ws_LnAccept:/k2" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K2 : "+DESCR+" : "+K2+" : " +k2_value); K2 = k2_value; }
    else if( ev_wrk == "ws_LnAccept:/k3" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K3 : "+DESCR+" : "+K3+" : " +k3_value); K3 = k3_value; }
    else if( ev_wrk == "ws_LnAccept:/k4" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.K4 : "+DESCR+" : "+K4+" : " +k4_value); K4 = k4_value; }
    else if( ev_wrk == "ws_LnAccept:/tiPer" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpPer : "+DESCR+" : "+TImpPer/1000+" : " +tiPer_value); TImpPer = 1000*tiPer_value; }
    else if( ev_wrk == "ws_LnAccept:/tiMin" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.TImpMin : "+DESCR+" : "+TImpMin/1000+" : " +tiMin_value); TImpMin = 1000*tiMin_value; }    
    else if( ev_wrk == "ws_LnAccept:/rfct" ) { messPut("OP:"+vcaSesUser(path),2,"'"+NAME+"'.KImpRfact : "+DESCR+" : "+KImpRfact+" : " +rfct_value); KImpRfact = rfct_value; }
    else ev_rez+=ev_wrk+"\n";
}
event=ev_rez;

kp_active = (Kp!=EVAL_REAL); kp_value = kp_active?Kp:0;
ki_active = (Ki!=EVAL_REAL); ki_value = ki_active?Ki:0;
ti_active = (Ti!=EVAL_REAL); ti_value = ti_active?Ti/1000:0;
kd_active = (Kd!=EVAL_REAL); kd_value = kd_active?Kd:0;
td_active = (Td!=EVAL_REAL); td_value = td_active?Td/1000:0;
tzd_active = (Tzd!=EVAL_REAL); tzd_value = tzd_active?Tzd/1000:0;
zn_active = (Zi!=EVAL_REAL); zn_value = zn_active?Zi:0;
h1_active = (Hdwn!=EVAL_REAL); h1_value = h1_active?Hdwn:0;
h2_active = (Hup!=EVAL_REAL); h2_value = h2_active?Hup:0;
k1_active = (K1!=EVAL_REAL); k1_value = k1_active?K1:0;
k2_active = (K2!=EVAL_REAL); k2_value = k2_active?K2:0;
k3_active = (K3!=EVAL_REAL); k3_value = k3_active?K3:0;
k4_active = (K4!=EVAL_REAL); k4_value = k4_active?K4:0;
tiPer_active = (TImpPer!=EVAL_REAL); tiPer_value = tiPer_active?TImpPer/1000:0;
tiMin_active = (TImpMin!=EVAL_REAL); tiMin_value = tiMin_active?TImpMin/1000:0;
rfct_active = (KImpRfact!=EVAL_REAL); rfct_value = rfct_active?KImpRfact:0;

doc_tmpl = "<body  bgcolor='grey'><table style='color: white' border='1' cellpadding='1' cellspacing='0' width='100%'>\n";
doc_tmpl += "<tr><td>Id:</td><td>"+((EVAL_STR == SHIFR) ? "" : strEnc2HTML(SHIFR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Имя:</td><td>"+((EVAL_STR == NAME) ? "" : strEnc2HTML(NAME))+"</td></tr>\n";
doc_tmpl += "<tr><td>Описание:</td><td>"+((EVAL_STR == DESCR) ? "" : strEnc2HTML(DESCR))+"</td></tr>\n";
doc_tmpl += "<tr><td>Единица измерения:</td><td>"+((EVAL_STR==ed) ? "" : strEnc2HTML(ed))+"</td></tr>\n";
doc_tmpl += "<tr><td>Задание:</td><td>"+ ((trnd_prm1val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm1val) : strEnc2HTML(real2str(trnd_prm1val,prec))) : "");
doc_tmpl += ((trnd_prm1val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm1val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Переменная:</td><td>"+ ((trnd_prm2val != EVAL_REAL) ? ((prec==EVAL_INT) ? strEnc2HTML(trnd_prm2val) :strEnc2HTML(real2str(trnd_prm2val,prec))) : "");
doc_tmpl += ((trnd_prm2val == EVAL_REAL || max == EVAL_REAL || min == EVAL_REAL || max == min) ? "" : ("("+strEnc2HTML(real2str(100*(trnd_prm2val-min)/(max-min),1))+"%)"))+"</td></tr>\n";
doc_tmpl += "<tr><td>Выход:</td><td>"+((trnd_prm0val != EVAL_REAL) ? strEnc2HTML(real2str(trnd_prm0val,1)) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Шкала:</td><td>"+(min != EVAL_REAL ? strEnc2HTML(min) : "")+" ... "+(max != EVAL_REAL ? strEnc2HTML(max) : "")+"</td></tr>\n";
doc_tmpl += "<tr><td>Режим:</td><td>"+((trnd_prm3val==EVAL_REAL)?" - ": (trnd_prm3val ? "Автомат" : "Ручной"))+"</td></tr>\n";
doc_tmpl += "</table></body>";

//Diagram
trnd_prm0addr = out_addr;
trnd_prm1addr = sp_addr;
trnd_prm1bordL = min;
trnd_prm1bordU = max;
trnd_prm2addr = var_addr;
trnd_prm2bordL = min;
trnd_prm2bordU = max;
trnd_prm3addr = auto_addr;
trnd_prm4addr = impQup_addr;
trnd_prm5addr = impQdwn_addr;


ID: ResultGraph
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
name_arg0val = (grpName!=EVAL_STR) ? grpName : "";

if( f_start )
{
  rows = new Array();
  cols = new Array();
  for( i = 0; i < 4; i++ )
  {
    rows[i] = this["wdg_e"+(1+i)].attr("en") || this["wdg_e"+(5+i)].attr("en") || this["wdg_e"+(9+i)].attr("en") || this["wdg_e"+(13+i)].attr("en");
    cols[i] = this["wdg_e"+(1+i*4)].attr("en") || this["wdg_e"+(2+i*4)].attr("en") || this["wdg_e"+(3+i*4)].attr("en") || this["wdg_e"+(4+i*4)].attr("en");
  }

  xScale = 0; for( i = 0; i < 4; i++ ) xScale += cols[i]; if( xScale ) xScale = 4/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 4; j++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomXsc",xScale);
      this["wdg_e"+(4+i)].attrSet( "geomX", 1 + 224*xScale*cols[0] );
      this["wdg_e"+(8+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]) );
      this["wdg_e"+(12+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]+cols[2]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 4; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomYsc",yScale);
      this["wdg_e"+(2+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_e"+(3+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_e"+(4+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}

uk#PROC:
JavaLikeCalc.JavaScript
name_arg0val = (grpName!=EVAL_STR) ? grpName : "";

if( f_start )
{
  rows = new Array();
  cols = new Array();
  for( i = 0; i < 4; i++ )
  {
    rows[i] = this["wdg_e"+(1+i)].attr("en") || this["wdg_e"+(5+i)].attr("en") || this["wdg_e"+(9+i)].attr("en") || this["wdg_e"+(13+i)].attr("en");
    cols[i] = this["wdg_e"+(1+i*4)].attr("en") || this["wdg_e"+(2+i*4)].attr("en") || this["wdg_e"+(3+i*4)].attr("en") || this["wdg_e"+(4+i*4)].attr("en");
  }

  xScale = 0; for( i = 0; i < 4; i++ ) xScale += cols[i]; if( xScale ) xScale = 4/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 4; j++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomXsc",xScale);
      this["wdg_e"+(4+i)].attrSet( "geomX", 1 + 224*xScale*cols[0] );
      this["wdg_e"+(8+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]) );
      this["wdg_e"+(12+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]+cols[2]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 4; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomYsc",yScale);
      this["wdg_e"+(2+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_e"+(3+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_e"+(4+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}

ru#PROC:
JavaLikeCalc.JavaScript
name_arg0val = (grpName!=EVAL_STR) ? grpName : "";

if( f_start )
{
  rows = new Array();
  cols = new Array();
  for( i = 0; i < 4; i++ )
  {
    rows[i] = this["wdg_e"+(1+i)].attr("en") || this["wdg_e"+(5+i)].attr("en") || this["wdg_e"+(9+i)].attr("en") || this["wdg_e"+(13+i)].attr("en");
    cols[i] = this["wdg_e"+(1+i*4)].attr("en") || this["wdg_e"+(2+i*4)].attr("en") || this["wdg_e"+(3+i*4)].attr("en") || this["wdg_e"+(4+i*4)].attr("en");
  }

  xScale = 0; for( i = 0; i < 4; i++ ) xScale += cols[i]; if( xScale ) xScale = 4/xScale;
  yScale = 0; for( i = 0; i < 4; i++ ) yScale += rows[i]; if( yScale ) yScale = 4/yScale;
  xScale = yScale = min(xScale,yScale);

  if( xScale > 1 )
    for( i = 1; i <= 4; i++ ) 
    {
      for( j = 1; j <= 4; j++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomXsc",xScale);
      this["wdg_e"+(4+i)].attrSet( "geomX", 1 + 224*xScale*cols[0] );
      this["wdg_e"+(8+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]) );
      this["wdg_e"+(12+i)].attrSet( "geomX", 1 + 224*xScale*(cols[0]+cols[1]+cols[2]) );
    }
  if( yScale > 1 )
    for( j = 1; j <= 4; j++ ) 
    {
      for( i = 1; i <= 4; i++ ) this["wdg_e"+((i-1)*4+j)].attrSet("geomYsc",yScale);
      this["wdg_e"+(2+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*rows[0] );
      this["wdg_e"+(3+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]) );
      this["wdg_e"+(4+4*(j-1))].attrSet( "geomY", 30 + 142*yScale*(rows[0]+rows[1]+rows[2]) );
    }
}


ID: ResultGraphEl
PARENT: /wlb_originals/wdg_Box
ATTRS: name;en;geomW;geomH;backColor;bordWidth;bordColor;bordStyle;
ICO:

PROC:
JavaLikeCalc.JavaScript
en=(p1_addr!=EVAL_STR || p2_addr!=EVAL_STR || p3_addr!=EVAL_STR || p4_addr!=EVAL_STR || p5_addr!=EVAL_STR);
title_text = (title!=EVAL_STR) ? title : "";

p1_text = (p1_name!=EVAL_STR) ? p1_name : ""; p1_color=p1_clr;
p2_text = (p2_name!=EVAL_STR) ? p2_name : ""; p2_color=p2_clr;
p3_text = (p3_name!=EVAL_STR) ? p3_name : ""; p3_color=p3_clr;
p4_text = (p4_name!=EVAL_STR) ? p4_name : ""; p4_color=p4_clr;
p5_text = (p5_name!=EVAL_STR) ? p5_name : ""; p5_color=p5_clr;

trnd_prm0addr=p1_addr; trnd_prm0bordL = p1_min; trnd_prm0bordU = p1_max; trnd_prm0color = p1_clr;
trnd_prm1addr=p2_addr; trnd_prm1bordL = p2_min; trnd_prm1bordU = p2_max; trnd_prm1color = p2_clr;
trnd_prm2addr=p3_addr; trnd_prm2bordL = p3_min; trnd_prm2bordU = p3_max; trnd_prm2color = p3_clr;
trnd_prm3addr=p4_addr; trnd_prm3bordL = p4_min; trnd_prm3bordU = p4_max; trnd_prm3color = p4_clr;
trnd_prm4addr=p5_addr; trnd_prm4bordL = p5_min; trnd_prm4bordU = p5_max; trnd_prm4color = p5_clr;

uk#PROC:
JavaLikeCalc.JavaScript
en=(p1_addr!=EVAL_STR || p2_addr!=EVAL_STR || p3_addr!=EVAL_STR || p4_addr!=EVAL_STR || p5_addr!=EVAL_STR);
title_text = (title!=EVAL_STR) ? title : "";

p1_text = (p1_name!=EVAL_STR) ? p1_name : ""; p1_color=p1_clr;
p2_text = (p2_name!=EVAL_STR) ? p2_name : ""; p2_color=p2_clr;
p3_text = (p3_name!=EVAL_STR) ? p3_name : ""; p3_color=p3_clr;
p4_text = (p4_name!=EVAL_STR) ? p4_name : ""; p4_color=p4_clr;
p5_text = (p5_name!=EVAL_STR) ? p5_name : ""; p5_color=p5_clr;

trnd_prm0addr=p1_addr; trnd_prm0bordL = p1_min; trnd_prm0bordU = p1_max; trnd_prm0color = p1_clr;
trnd_prm1addr=p2_addr; trnd_prm1bordL = p2_min; trnd_prm1bordU = p2_max; trnd_prm1color = p2_clr;
trnd_prm2addr=p3_addr; trnd_prm2bordL = p3_min; trnd_prm2bordU = p3_max; trnd_prm2color = p3_clr;
trnd_prm3addr=p4_addr; trnd_prm3bordL = p4_min; trnd_prm3bordU = p4_max; trnd_prm3color = p4_clr;
trnd_prm4addr=p5_addr; trnd_prm4bordL = p5_min; trnd_prm4bordU = p5_max; trnd_prm4color = p5_clr;

ru#PROC:
JavaLikeCalc.JavaScript
en=(p1_addr!=EVAL_STR || p2_addr!=EVAL_STR || p3_addr!=EVAL_STR || p4_addr!=EVAL_STR || p5_addr!=EVAL_STR);
title_text = (title!=EVAL_STR) ? title : "";

p1_text = (p1_name!=EVAL_STR) ? p1_name : ""; p1_color=p1_clr;
p2_text = (p2_name!=EVAL_STR) ? p2_name : ""; p2_color=p2_clr;
p3_text = (p3_name!=EVAL_STR) ? p3_name : ""; p3_color=p3_clr;
p4_text = (p4_name!=EVAL_STR) ? p4_name : ""; p4_color=p4_clr;
p5_text = (p5_name!=EVAL_STR) ? p5_name : ""; p5_color=p5_clr;

trnd_prm0addr=p1_addr; trnd_prm0bordL = p1_min; trnd_prm0bordU = p1_max; trnd_prm0color = p1_clr;
trnd_prm1addr=p2_addr; trnd_prm1bordL = p2_min; trnd_prm1bordU = p2_max; trnd_prm1color = p2_clr;
trnd_prm2addr=p3_addr; trnd_prm2bordL = p3_min; trnd_prm2bordU = p3_max; trnd_prm2color = p3_clr;
trnd_prm3addr=p4_addr; trnd_prm3bordL = p4_min; trnd_prm3bordU = p4_max; trnd_prm3color = p4_clr;
trnd_prm4addr=p5_addr; trnd_prm4bordL = p5_min; trnd_prm4bordU = p5_max; trnd_prm4color = p5_clr;


ID: doc_panel
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgGrp;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
if(n==0 && !time) { time = curTm; bTime = time-30; }
size_en = tmTp_en = Text1_en = Text2_en = prev1_en = next1_en = date_en = !n;
szVal = time-bTime;

//> Archive size
if(n)
{
	cPos = aCur-vCur;
	if(cPos < 0) cPos += aSize;
	Text3_text = Text3_text.parse(0,"\n") + "\n"+(cPos+1)+"("+aSize+")";
}

//> Events process
ev_cur = ev_rez = "";
off=0;
prevTime = time;
while(true)
{
  ev_cur=strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    szVal = size_value;
    if(tmTp_value=="m") szVal = szVal*60;
    else if(tmTp_value=="h") szVal = szVal*60*60;
    else if(tmTp_value=="d") szVal = szVal*24*60*60;
    else if(tmTp_value.search("\\d+s") >= 0)	szVal = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+m") >= 0)	szVal = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+h") >= 0)	szVal = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+d") >= 0)	szVal = tmTp_value.toInt()*24*60*60;
    time += 1;
  }
  else if(ev_cur == "ws_LnAccept:/date") time = min(curTm,max(szVal,date_value));
  else if(ev_cur == "ws_BtPress:/curtime") 
  {	
	if(n==0) time = curTm;
	else vCur = aCur;
  }
  else if(ev_cur == "ws_BtPress:/prev")
  {
    if(n==0) time = min(curTm,max(szVal,time-szVal));
    else vCur = -2;
  }
  else if(ev_cur == "ws_BtPress:/next") 
  {
    if(n==0) time = min(curTm,max(szVal,time+szVal)); 
    else vCur = -1;
  }
  else if(ev_cur == "ws_BtPress:/prev1") time = min(curTm,max(5*szVal,time-5*szVal));
  else if(ev_cur == "ws_BtPress:/next1") time = min(curTm,max(5*szVal,time+5*szVal));
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//> Time control
date_value=time;
if(n==0 && prevTime != time) { bTime = time-szVal; doc=""; }
if(szVal < 60) { tmTp_value="s"; size_value = szVal; }
else if(szVal < 60*60) { tmTp_value="m"; size_value = szVal/60; }
else if(szVal < 24*60*60) { tmTp_value="h"; size_value = szVal/(60*60); }
else { tmTp_value="d"; size_value = szVal/(24*60*60); }

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
if(n==0 && !time) { time = curTm; bTime = time-30; }
size_en = tmTp_en = Text1_en = Text2_en = prev1_en = next1_en = date_en = !n;
szVal = time-bTime;

//> Archive size
if(n)
{
	cPos = aCur-vCur;
	if(cPos < 0) cPos += aSize;
	Text3_text = Text3_text.parse(0,"\n") + "\n"+(cPos+1)+"("+aSize+")";
}

//> Events process
ev_cur = ev_rez = "";
off=0;
prevTime = time;
while(true)
{
  ev_cur=strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    szVal = size_value;
    if(tmTp_value=="х") szVal = szVal*60;
    else if(tmTp_value=="г") szVal = szVal*60*60;
    else if(tmTp_value=="д") szVal = szVal*24*60*60;
    else if(tmTp_value.search("\\d+с") >= 0)	szVal = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+х") >= 0)	szVal = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+г") >= 0)	szVal = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+д") >= 0)	szVal = tmTp_value.toInt()*24*60*60;
    time += 1;
  }
  else if(ev_cur == "ws_LnAccept:/date") time = min(curTm,max(szVal,date_value));
  else if(ev_cur == "ws_BtPress:/curtime") 
  {	
	if(n==0) time = curTm;
	else vCur = aCur;
  }
  else if(ev_cur == "ws_BtPress:/prev")
  {
    if(n==0) time = min(curTm,max(szVal,time-szVal));
    else vCur = -2;
  }
  else if(ev_cur == "ws_BtPress:/next") 
  {
    if(n==0) time = min(curTm,max(szVal,time+szVal)); 
    else vCur = -1;
  }
  else if(ev_cur == "ws_BtPress:/prev1") time = min(curTm,max(5*szVal,time-5*szVal));
  else if(ev_cur == "ws_BtPress:/next1") time = min(curTm,max(5*szVal,time+5*szVal));
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//> Time control
date_value=time;
if(n==0 && prevTime != time) { bTime = time-szVal; doc=""; }
if(szVal < 60) { tmTp_value="с"; size_value = szVal; }
else if(szVal < 60*60) { tmTp_value="х"; size_value = szVal/60; }
else if(szVal < 24*60*60) { tmTp_value="г"; size_value = szVal/(60*60); }
else { tmTp_value="д"; size_value = szVal/(24*60*60); }

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
if(n==0 && !time) { time = curTm; bTime = time-30; }
size_en = tmTp_en = Text1_en = Text2_en = prev1_en = next1_en = date_en = !n;
szVal = time-bTime;

//> Archive size
if(n)
{
	cPos = aCur-vCur;
	if(cPos < 0) cPos += aSize;
	Text3_text = Text3_text.parse(0,"\n") + "\n"+(cPos+1)+"("+aSize+")";
}

//> Events process
ev_cur = ev_rez = "";
off=0;
prevTime = time;
while(true)
{
  ev_cur=strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    szVal = size_value;
    if(tmTp_value=="м") szVal = szVal*60;
    else if(tmTp_value=="ч") szVal = szVal*60*60;
    else if(tmTp_value=="д") szVal = szVal*24*60*60;
    else if(tmTp_value.search("\\d+с") >= 0)	szVal = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+м") >= 0)	szVal = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+ч") >= 0)	szVal = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+д") >= 0)	szVal = tmTp_value.toInt()*24*60*60;
    time += 1;
  }
  else if(ev_cur == "ws_LnAccept:/date") time = min(curTm,max(szVal,date_value));
  else if(ev_cur == "ws_BtPress:/curtime") 
  {	
	if(n==0) time = curTm;
	else vCur = aCur;
  }
  else if(ev_cur == "ws_BtPress:/prev")
  {
    if(n==0) time = min(curTm,max(szVal,time-szVal));
    else vCur = -2;
  }
  else if(ev_cur == "ws_BtPress:/next") 
  {
    if(n==0) time = min(curTm,max(szVal,time+szVal)); 
    else vCur = -1;
  }
  else if(ev_cur == "ws_BtPress:/prev1") time = min(curTm,max(5*szVal,time-5*szVal));
  else if(ev_cur == "ws_BtPress:/next1") time = min(curTm,max(5*szVal,time+5*szVal));
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

//> Time control
date_value=time;
if(n==0 && prevTime != time) { bTime = time-szVal; doc=""; }
if(szVal < 60) { tmTp_value="с"; size_value = szVal; }
else if(szVal < 60*60) { tmTp_value="м"; size_value = szVal/60; }
else if(szVal < 24*60*60) { tmTp_value="ч"; size_value = szVal/(60*60); }
else { tmTp_value="д"; size_value = szVal/(24*60*60); }


ID: terminator
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgGrp;backColor;bordWidth;
ICO:


ID: grph_panel
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgGrp;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
tSek = tSek ? tSek : curTm;
//> Events process
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur = strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    tSzPrev = tSize;
    tSize = size_value;
    if(tmTp_value == "m")			tSize = tSize*60;
    else if(tmTp_value == "h")	tSize = tSize*60*60;
    else if(tmTp_value == "d")	tSize = tSize*24*60*60;
    else if(tmTp_value.search("\\d+s") >= 0)	tSize = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+m") >= 0)	tSize = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+h") >= 0)	tSize = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+d") >= 0)	tSize = tmTp_value.toInt()*24*60*60;
    if(tSize < tSzPrev) tSek = curSek;
  }
  else if(ev_cur == "ws_LnAccept:/date")		tSek = date_value;
  else if(ev_cur == "ws_BtPress:/curtime")		tSek = curSek = curTm;
  else if(ev_cur == "ws_BtPress:/prev")			tSek -= tSize/2;
  else if(ev_cur == "ws_BtPress:/prev1")		tSek -= 5*tSize;
  else if(ev_cur == "ws_BtPress:/next")			tSek += tSize/2;
  else if(ev_cur == "ws_BtPress:/next1")		tSek += 5*tSize;
  else if(ev_cur == "ws_CombChange:/arch")	valArch=(arch_value=="All")?"":arch_value;
  else if(ev_cur == "ws_ChkChange:/spectr" )	type = spectr_value?1:0;
  else if(ev_cur == "ws_BtPress:/zoomIn")		sclVer*=0.9;
  else if(ev_cur == "ws_BtPress:/zoomOut")		sclVer*=1.1;
  else if(ev_cur == "ws_BtPress:/zoomOffUp")	sclVerOff += sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomOffDown") sclVerOff -= sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomDef")		{ sclVer = 100; sclVerOff = 0; }
  else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//>scaleInfo
scaleInfo_arg0val = 1e4/sclVer;
scaleInfo_arg1val = sclVerOff;

//> Trend time control
date_value=tSek;
if(tSek < curTm) trcPer=0; else { trcPer=1; tSek=0;  }
if(tSize < 60) { tmTp_value = "s"; size_value = tSize; }
else if(tSize < 60*60) { tmTp_value = "m"; size_value = tSize/60; }
else if(tSize < 24*60*60) { tmTp_value = "h"; size_value = tSize/(60*60); }
else { tmTp_value = "d"; size_value = tSize/(24*60*60); }

arch_value = strSize(valArch) ? valArch : "All";
cursor_en = (curSek != EVAL_INT);
if(cursor_en && type == 0) cursor_arg0val = tmFStr(curSek,"%d.%m.%Y %H:%M:%S")+"."+curUSek;
if(cursor_en && type == 1) cursor_arg0val = "Frequency: "+real2str(1e6/(1e6*curSek+curUSek),2)+" Hz";
spectr_value = type;

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
tSek = tSek ? tSek : curTm;
//> Events process
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur = strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    tSzPrev = tSize;
    tSize = size_value;
    if(tmTp_value == "х")			tSize = tSize*60;
    else if(tmTp_value == "г")	tSize = tSize*60*60;
    else if(tmTp_value == "д")	tSize = tSize*24*60*60;
    else if(tmTp_value.search("\\d+с") >= 0)	tSize = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+х") >= 0)	tSize = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+г") >= 0)	tSize = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+д") >= 0)	tSize = tmTp_value.toInt()*24*60*60;
    if(tSize < tSzPrev) tSek = curSek;
  }
  else if(ev_cur == "ws_LnAccept:/date")		tSek = date_value;
  else if(ev_cur == "ws_BtPress:/curtime")		tSek = curSek = curTm;
  else if(ev_cur == "ws_BtPress:/prev")			tSek -= tSize/2;
  else if(ev_cur == "ws_BtPress:/prev1")		tSek -= 5*tSize;
  else if(ev_cur == "ws_BtPress:/next")			tSek += tSize/2;
  else if(ev_cur == "ws_BtPress:/next1")		tSek += 5*tSize;
  else if(ev_cur == "ws_CombChange:/arch")	valArch=(arch_value=="Всі")?"":arch_value;
  else if(ev_cur == "ws_ChkChange:/spectr" )	type = spectr_value?1:0;
  else if(ev_cur == "ws_BtPress:/zoomIn")		sclVer*=0.9;
  else if(ev_cur == "ws_BtPress:/zoomOut")		sclVer*=1.1;
  else if(ev_cur == "ws_BtPress:/zoomOffUp")	sclVerOff += sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomOffDown") sclVerOff -= sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomDef")		{ sclVer = 100; sclVerOff = 0; }
  else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//>scaleInfo
scaleInfo_arg0val = 1e4/sclVer;
scaleInfo_arg1val = sclVerOff;

//> Trend time control
date_value=tSek;
if(tSek < curTm) trcPer=0; else { trcPer=1; tSek=0;  }
if(tSize < 60) { tmTp_value = "с"; size_value = tSize; }
else if(tSize < 60*60) { tmTp_value = "х"; size_value = tSize/60; }
else if(tSize < 24*60*60) { tmTp_value = "г"; size_value = tSize/(60*60); }
else { tmTp_value = "д"; size_value = tSize/(24*60*60); }

arch_value = strSize(valArch) ? valArch : "Всі";
cursor_en = (curSek != EVAL_INT);
if(cursor_en && type == 0) cursor_arg0val = tmFStr(curSek,"%d.%m.%Y %H:%M:%S")+"."+curUSek;
if(cursor_en && type == 1) cursor_arg0val = "Частота: "+real2str(1e6/(1e6*curSek+curUSek),2)+" Гц";
spectr_value = type;

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;
curTm = tmTime();
tSek = tSek ? tSek : curTm;
//> Events process
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur = strParse(event,0,"\n",off);
  if(ev_cur == "") break;
  //messPut("Trend control",0,"Event: "+ev_cur);
  if(ev_cur == "ws_LnAccept:/size" || ev_cur == "ws_CombChange:/tmTp")
  {
    tSzPrev = tSize;
    tSize = size_value;
    if(tmTp_value == "м")			tSize = tSize*60;
    else if(tmTp_value == "ч")	tSize = tSize*60*60;
    else if(tmTp_value == "д")	tSize = tSize*24*60*60;
    else if(tmTp_value.search("\\d+с") >= 0)	tSize = tmTp_value.toInt();
    else if(tmTp_value.search("\\d+м") >= 0)	tSize = tmTp_value.toInt()*60;
    else if(tmTp_value.search("\\d+ч") >= 0)	tSize = tmTp_value.toInt()*60*60;
    else if(tmTp_value.search("\\d+д") >= 0)	tSize = tmTp_value.toInt()*24*60*60;
    if(tSize < tSzPrev) tSek = curSek;
  }
  else if(ev_cur == "ws_LnAccept:/date")		tSek = date_value;
  else if(ev_cur == "ws_BtPress:/curtime")		tSek = curSek = curTm;
  else if(ev_cur == "ws_BtPress:/prev")			tSek -= tSize/2;
  else if(ev_cur == "ws_BtPress:/prev1")		tSek -= 5*tSize;
  else if(ev_cur == "ws_BtPress:/next")			tSek += tSize/2;
  else if(ev_cur == "ws_BtPress:/next1")		tSek += 5*tSize;
  else if(ev_cur == "ws_CombChange:/arch")	valArch=(arch_value=="Все")?"":arch_value;
  else if(ev_cur == "ws_ChkChange:/spectr" )	type = spectr_value?1:0;
  else if(ev_cur == "ws_BtPress:/zoomIn")		sclVer*=0.9;
  else if(ev_cur == "ws_BtPress:/zoomOut")		sclVer*=1.1;
  else if(ev_cur == "ws_BtPress:/zoomOffUp")	sclVerOff += sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomOffDown") sclVerOff -= sclVer/10;
  else if(ev_cur == "ws_BtPress:/zoomDef")		{ sclVer = 100; sclVerOff = 0; }
  else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//>scaleInfo
scaleInfo_arg0val = 1e4/sclVer;
scaleInfo_arg1val = sclVerOff;

//> Trend time control
date_value=tSek;
if(tSek < curTm) trcPer=0; else { trcPer=1; tSek=0;  }
if(tSize < 60) { tmTp_value = "с"; size_value = tSize; }
else if(tSize < 60*60) { tmTp_value = "м"; size_value = tSize/60; }
else if(tSize < 24*60*60) { tmTp_value = "ч"; size_value = tSize/(60*60); }
else { tmTp_value = "д"; size_value = tSize/(24*60*60); }

arch_value = strSize(valArch) ? valArch : "Все";
cursor_en = (curSek != EVAL_INT);
if(cursor_en && type == 0) cursor_arg0val = tmFStr(curSek,"%d.%m.%Y %H:%M:%S")+"."+curUSek;
if(cursor_en && type == 1) cursor_arg0val = "Частота: "+real2str(1e6/(1e6*curSek+curUSek),2)+" Гц";
spectr_value = type;


ID: cntrPasp
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgGrp;backColor;bordWidth;bordColor;bordStyle;
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

//if( f_start ) focus = true;
//if( focus ) messPut("TEST",0,"TEST 00");

wLst = aLst = EVAL_REAL;
pwName = pName;
pwName=pwName.slice(0,pwName.lastIndexOf("/"));
req=xmlNode("info").setAttr("path",pwName+"/%2fval");
doc_tmpl = "<body docProcLang='JavaLikeCalc.JavaScript'><table border='1' cellpadding='2' cellspacing='0' width='100%'>";
if( xmlCntrReq(req) == 0 && req.childSize() )
{
  chldRoot = req.childGet(0);
  for( i = 0; i < chldRoot.childSize(); i++ )
  {
    aID = chldRoot.childGet(i).attr("id");
    aDscr = chldRoot.childGet(i).attr("dscr");
    reqVl=xmlNode("get").setAttr("path",pwName+"/%2fval%2f"+aID);
    xmlCntrReq(reqVl);
    aVl = reqVl.text();

    //> Filter
    if( aID == "com" || aID == "close" || aID == "stop" || aVl.isEVal() ) continue;
    if( aID == "aMax" || aID == "aMin" )
    {
      if( aLst == EVAL_REAL ) { aLst = aVl; continue; }
      aDscr = "Alarm border";
      if( aID == "aMax" && aLst < aVl ) aVl = ""+aLst+" ... "+aVl;
      else if( aID == "aMin" && aLst > aVl ) aVl = ""+aVl+" ... "+aLst;
      else aVl = "not set";
    }
    else if( aID == "wMax" || aID == "wMin" )
    {
      if( wLst == EVAL_REAL ) { wLst = aVl; continue; }
      aDscr = "Warning border";
      if( aID == "wMax" && wLst < aVl ) aVl = ""+wLst+" ... "+aVl;
      else if( aID == "wMin" && wLst > aVl ) aVl = ""+aVl+" ... "+wLst;
      else aVl = "not set";
    }    
    //> Put record
    doc_tmpl += "<tr><td>"+strEnc2HTML(aDscr)+"</td><td>"+strEnc2HTML(aVl)+"</td></tr>\n";
  }
}
doc_tmpl += "</table></body>";

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

//if( f_start ) focus = true;
//if( focus ) messPut("TEST",0,"TEST 00");

wLst = aLst = EVAL_REAL;
pwName = pName;
pwName=pwName.slice(0,pwName.lastIndexOf("/"));
req=xmlNode("info").setAttr("path",pwName+"/%2fval");
doc_tmpl = "<body docProcLang='JavaLikeCalc.JavaScript'><table border='1' cellpadding='2' cellspacing='0' width='100%'>";
if( xmlCntrReq(req) == 0 && req.childSize() )
{
  chldRoot = req.childGet(0);
  for( i = 0; i < chldRoot.childSize(); i++ )
  {
    aID = chldRoot.childGet(i).attr("id");
    aDscr = chldRoot.childGet(i).attr("dscr");
    reqVl=xmlNode("get").setAttr("path",pwName+"/%2fval%2f"+aID);
    xmlCntrReq(reqVl);
    aVl = reqVl.text();

    //> Filter
    if( aID == "com" || aID == "close" || aID == "stop" || aVl.isEVal() ) continue;
    if( aID == "aMax" || aID == "aMin" )
    {
      if( aLst == EVAL_REAL ) { aLst = aVl; continue; }
      aDscr = "Аварійна границя";
      if( aID == "aMax" && aLst < aVl ) aVl = ""+aLst+" ... "+aVl;
      else if( aID == "aMin" && aLst > aVl ) aVl = ""+aVl+" ... "+aLst;
      else aVl = "не встановлена";
    }
    else if( aID == "wMax" || aID == "wMin" )
    {
      if( wLst == EVAL_REAL ) { wLst = aVl; continue; }
      aDscr = "Попереджувальна границя";
      if( aID == "wMax" && wLst < aVl ) aVl = ""+wLst+" ... "+aVl;
      else if( aID == "wMin" && wLst > aVl ) aVl = ""+aVl+" ... "+wLst;
      else aVl = "не встановлена";
    }    
    //> Put record
    doc_tmpl += "<tr><td>"+strEnc2HTML(aDscr)+"</td><td>"+strEnc2HTML(aVl)+"</td></tr>\n";
  }
}
doc_tmpl += "</table></body>";

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

//if( f_start ) focus = true;
//if( focus ) messPut("TEST",0,"TEST 00");

wLst = aLst = EVAL_REAL;
pwName = pName;
pwName=pwName.slice(0,pwName.lastIndexOf("/"));
req=xmlNode("info").setAttr("path",pwName+"/%2fval");
doc_tmpl = "<body docProcLang='JavaLikeCalc.JavaScript'><table border='1' cellpadding='2' cellspacing='0' width='100%'>";
if( xmlCntrReq(req) == 0 && req.childSize() )
{
  chldRoot = req.childGet(0);
  for( i = 0; i < chldRoot.childSize(); i++ )
  {
    aID = chldRoot.childGet(i).attr("id");
    aDscr = chldRoot.childGet(i).attr("dscr");
    reqVl=xmlNode("get").setAttr("path",pwName+"/%2fval%2f"+aID);
    xmlCntrReq(reqVl);
    aVl = reqVl.text();

    //> Filter
    if( aID == "com" || aID == "close" || aID == "stop" || aVl.isEVal() ) continue;
    if( aID == "aMax" || aID == "aMin" )
    {
      if( aLst == EVAL_REAL ) { aLst = aVl; continue; }
      aDscr = "Аварийная граница";
      if( aID == "aMax" && aLst < aVl ) aVl = ""+aLst+" ... "+aVl;
      else if( aID == "aMin" && aLst > aVl ) aVl = ""+aVl+" ... "+aLst;
      else aVl = "не установлена";
    }
    else if( aID == "wMax" || aID == "wMin" )
    {
      if( wLst == EVAL_REAL ) { wLst = aVl; continue; }
      aDscr = "Предупредительная граница";
      if( aID == "wMax" && wLst < aVl ) aVl = ""+wLst+" ... "+aVl;
      else if( aID == "wMin" && wLst > aVl ) aVl = ""+aVl+" ... "+wLst;
      else aVl = "не установлена";
    }    
    //> Put record
    doc_tmpl += "<tr><td>"+strEnc2HTML(aDscr)+"</td><td>"+strEnc2HTML(aVl)+"</td></tr>\n";
  }
}
doc_tmpl += "</table></body>";


ID: ElViewGraph
PARENT: /wlb_originals/wdg_Box
ICO:

PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

if(f_start) en = (name != EVAL_STR);
if(en && name.isEVal()) name = "<No selected>";
lb_sfr_text = name;
if(varEl.isEVal()) lb_val_arg0val = "-";
else if (!digStts.isEVal() && digStts.length)  lb_val_arg0val = (varEl^digRevers) ? strParse(strParse(digStts,0,";"),0,"-") : strParse(strParse(digStts,1,";"),0,"-");
else lb_val_arg0val = (prec.isEVal() || prec == 0) ? varEl.toPrecision(9) :  varEl.toFixed(prec);
lb_val_color = lb_sfr_color = lb_ed_color = "limegreen";
if(varEl.isEVal() || (!min.isEVal() && max > min && varEl < min) || (!max.isEVal() && max > min && varEl > max)) lb_val_color = lb_sfr_color = lb_ed_color =  "grey";
else if(!aMax.isEVal() && !aMin.isEVal() && aMax > aMin && (varEl >= aMax || varEl <= aMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "red";
else if(!wMax.isEVal() && !wMin.isEVal() && wMax > wMin && (varEl >= wMax || varEl <= wMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "yellow";

lb_ed_text = ed.isEVal() ? "" : ed;

//> Blink focused or linked with ElCadr
if(vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == name)
{
  bordColor = bordColor == "white" ? "black" : "white";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "black"; }

//> Check the regulator mode
if(!enMode.isEVal() && enMode) 
{ 
  mode_en = true; 
  if(!pModeC.isEVal() && pModeC) mode_text = "C";
  else mode_text = pModeA.isEVal() ? "" : ((pModeA) ? "A" : "M"); 
}
else mode_en = false;

//Events process
ev_cur = ev_rez = "";
off=0;
while( true )
{
  ev_cur = event.parse(0,"\n",off);
  if( ev_cur == "" ) break;
  //messPut("Trend en",0,"Event: "+ev_cur);
  if(ev_cur == "key_mouseDblClick" || ev_cur == "usr_hideshow") bordStyle = (bordStyle==1) ? 3 : 1;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

if( bordStyle==1 ) color="-";
trClr_lineClr = color;

tipTool = "";
if(!name.isEVal())	tipTool += "Name: "+name+"\n";
if(!min.isEVal() && !max.isEVal() && max > min) tipTool += "Scale: "+min+" ... "+max+"\n";
if(!aMin.isEVal() && !aMax.isEVal() && aMax > aMin) tipTool += "Alarm border: "+aMin+" ... "+aMax+"\n";
if(!wMin.isEVal() && !wMax.isEVal() && wMax > wMin) tipTool += "Warning border: "+wMin+" ... "+wMax+"\n";
if(!dscr.isEVal())
{
	tipTool += "Description: "+dscr+"\n";
	tipStatus = dscr;
}

ATTRS:
path;name;dscr;en;active;geomW;geomH;tipTool;tipStatus;contextMenu;evProc;backColor;bordWidth;bordColor;bordStyle;

uk#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

if(f_start) en = (name != EVAL_STR);
if(en && name.isEVal()) name = "<Не обрано>";
lb_sfr_text = name;
if(varEl.isEVal()) lb_val_arg0val = "-";
else if (!digStts.isEVal() && digStts.length)  lb_val_arg0val = (varEl^digRevers) ? strParse(strParse(digStts,0,";"),0,"-") : strParse(strParse(digStts,1,";"),0,"-");
else lb_val_arg0val = (prec.isEVal() || prec == 0) ? varEl.toPrecision(9) :  varEl.toFixed(prec);
lb_val_color = lb_sfr_color = lb_ed_color = "limegreen";
if(varEl.isEVal() || (!min.isEVal() && max > min && varEl < min) || (!max.isEVal() && max > min && varEl > max)) lb_val_color = lb_sfr_color = lb_ed_color =  "grey";
else if(!aMax.isEVal() && !aMin.isEVal() && aMax > aMin && (varEl >= aMax || varEl <= aMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "red";
else if(!wMax.isEVal() && !wMin.isEVal() && wMax > wMin && (varEl >= wMax || varEl <= wMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "yellow";

lb_ed_text = ed.isEVal() ? "" : ed;

//> Blink focused or linked with ElCadr
if(vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == name)
{
  bordColor = bordColor == "white" ? "black" : "white";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "black"; }

//> Check the regulator mode
if(!enMode.isEVal() && enMode) 
{ 
  mode_en = true; 
  if(!pModeC.isEVal() && pModeC) mode_text = "К";
  else mode_text = pModeA.isEVal() ? "" : ((pModeA) ? "А" : "Р"); 
}
else mode_en = false;

//Events process
ev_cur = ev_rez = "";
off=0;
while( true )
{
  ev_cur = event.parse(0,"\n",off);
  if( ev_cur == "" ) break;
  //messPut("Trend en",0,"Event: "+ev_cur);
  if(ev_cur == "key_mouseDblClick" || ev_cur == "usr_hideshow") bordStyle = (bordStyle==1) ? 3 : 1;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

if( bordStyle==1 ) color="-";
trClr_lineClr = color;

tipTool = "";
if(!name.isEVal())	tipTool += "Ім'я: "+name+"\n";
if(!min.isEVal() && !max.isEVal() && max > min) tipTool += "Шкала: "+min+" ... "+max+"\n";
if(!aMin.isEVal() && !aMax.isEVal() && aMax > aMin) tipTool += "Аварійна границя: "+aMin+" ... "+aMax+"\n";
if(!wMin.isEVal() && !wMax.isEVal() && wMax > wMin) tipTool += "Попередж. границя: "+wMin+" ... "+wMax+"\n";
if(!dscr.isEVal())
{
	tipTool += "Опис: "+dscr+"\n";
	tipStatus = dscr;
}

ru#PROC:
JavaLikeCalc.JavaScript
using Special.FLibSYS;

if(f_start) en = (name != EVAL_STR);
if(en && name.isEVal()) name = "<Не выбран>";
lb_sfr_text = name;
if(varEl.isEVal()) lb_val_arg0val = "-";
else if (!digStts.isEVal() && digStts.length)  lb_val_arg0val = (varEl^digRevers) ? strParse(strParse(digStts,0,";"),0,"-") : strParse(strParse(digStts,1,";"),0,"-");
else lb_val_arg0val = (prec.isEVal() || prec == 0) ? varEl.toPrecision(9) :  varEl.toFixed(prec);
lb_val_color = lb_sfr_color = lb_ed_color = "limegreen";
if(varEl.isEVal() || (!min.isEVal() && max > min && varEl < min) || (!max.isEVal() && max > min && varEl > max)) lb_val_color = lb_sfr_color = lb_ed_color =  "grey";
else if(!aMax.isEVal() && !aMin.isEVal() && aMax > aMin && (varEl >= aMax || varEl <= aMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "red";
else if(!wMax.isEVal() && !wMin.isEVal() && wMax > wMin && (varEl >= wMax || varEl <= wMin)) lb_val_color = lb_sfr_color = lb_ed_color =  "yellow";

lb_ed_text = ed.isEVal() ? "" : ed;

//> Blink focused or linked with ElCadr
if(vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_pgOpen") == true && vcaAttrGet(strParsePath(path,0)+"/pg_control/pg_ElCadr/a_prmShifr") == name)
{
  bordColor = bordColor == "white" ? "black" : "white";
  bordWidth =  2;
}
else { bordWidth =  1; bordColor = "black"; }

//> Check the regulator mode
if(!enMode.isEVal() && enMode) 
{ 
  mode_en = true; 
  if(!pModeC.isEVal() && pModeC) mode_text = "К";
  else mode_text = pModeA.isEVal() ? "" : ((pModeA) ? "А" : "Р"); 
}
else mode_en = false;

//Events process
ev_cur = ev_rez = "";
off=0;
while( true )
{
  ev_cur = event.parse(0,"\n",off);
  if( ev_cur == "" ) break;
  //messPut("Trend en",0,"Event: "+ev_cur);
  if(ev_cur == "key_mouseDblClick" || ev_cur == "usr_hideshow") bordStyle = (bordStyle==1) ? 3 : 1;
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;

if( bordStyle==1 ) color="-";
trClr_lineClr = color;

tipTool = "";
if(!name.isEVal())	tipTool += "Имя: "+name+"\n";
if(!min.isEVal() && !max.isEVal() && max > min) tipTool += "Шкала: "+min+" ... "+max+"\n";
if(!aMin.isEVal() && !aMax.isEVal() && aMax > aMin) tipTool += "Аварийная граница: "+aMin+" ... "+aMax+"\n";
if(!wMin.isEVal() && !wMax.isEVal() && wMax > wMin) tipTool += "Предупр. граница: "+wMin+" ... "+wMax+"\n";
if(!dscr.isEVal())
{
	tipTool += "Описание: "+dscr+"\n";
	tipStatus = dscr;
}


ID: prescrEdit
PARENT: /wlb_originals/wdg_Box
ATTRS: name;dscr;geomW;geomH;evProc;pgGrp;backColor;bordWidth;bordColor;bordStyle;
ICO:

PROC:
JavaLikeCalc.JavaScript
if(f_start) save_active = false;
progLbUpdt = progSelPrg = progSelCom = progSelTp = false;
var comOp = "";

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/progAdd")
	{
		if(!progNm_value.length) progNm_value = "New program";
		SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name) VALUES ('"+progNm_value+"');");
		progLbUpdt = true;
	}
	else if(ev_cur == "ws_BtPress:/progCopy")
	{
		if(!progNm_value.length) progNm_value = "New program";
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name, prgTxt) VALUES ('"+progNm_value+"', '"+rez[1][0].replace("'","''")+"');");
			progLbUpdt = true;
		}
	}
	else if(ev_cur == "dlg_Apply:/progDel" && lib_value.length)
	//else if(ev_cur == "ws_BtPress:/progDel" && lib_value.length)
	{
		SYS.BD.nodeAt(dbDB,".").SQLReq("DELETE FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		lib_value = "";
		progLbUpdt = progSelPrg = true;
	}
	else if(ev_cur == "ws_ListChange:/lib") { progSelPrg = progSelCom = true; prog_value = ""; }
	else if(ev_cur == "ws_BtPress:/comAdd") comOp = "add";
	else if(ev_cur == "ws_BtPress:/comIns") comOp = "ins";
	else if(ev_cur == "ws_BtPress:/comDel") comOp = "del";
	else if(ev_cur == "ws_BtPress:/comUp") comOp = "up";
	else if(ev_cur == "ws_BtPress:/comDwn") comOp = "dwn";
	else if(ev_cur == "ws_ListChange:/prog") { progSelCom = true; save_active = false; }
	else if(ev_cur == "ws_CombChange:/type") { progSelTp = true; save_active = true; }
	else if(ev_cur == "ws_BtPress:/save" && prog_value.length) 
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				comTree.childGet(i_c).setAttr("id",type_value);
				for(i_a = 1; i_a <= 5; i_a++)
				{
					argObj = this["arg"+i_a];
					argVal = argObj.attr("value");
					if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
					if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
					comTree.childGet(i_c).setAttr("arg"+i_a, argVal);
				}
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
				prog_value = i_c.toString()+":"+type_value;
				progSelPrg = true;
			}
		}
		save_active = false;
	}
	else if(ev_cur == "ws_BtPress:/progExport" && lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			comTree.setAttr("id",lib_value);
			//> Load present file
			expTree = SYS.XMLNode("OpenSCADA_Prescr");
			expTree.load(fileExpImp,true);
			//> Remove already present record
			for(i_p = 0; i_p < expTree.childSize(); i_p++)
				if(expTree.childGet(i_p).attr("id") == lib_value)
				{
					expTree.childDel(i_p);
					break;
				}
			expTree.childAdd(comTree);
			expTree.save(0x05,fileExpImp);
		}
	} 
	else if(ev_cur == "ws_BtPress:/progImport")
	{
		//> Load present file
		expTree = SYS.XMLNode("OpenSCADA_Prescr");
		expTree.load(fileExpImp,true);
		//> Save all recors to DB
		SYS.messDebug("Prescription edit control","Items: "+expTree.childSize());
		for(i_p = 0; i_p < expTree.childSize(); i_p++)
		{
			treeNd = expTree.childGet(i_p);
			if(treeNd.name() != "prg") continue;
			if(lib_items.search(treeNd.attr("id")+"(\n|\\z)") < 0)
				SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name,prgTxt) VALUES ('"+treeNd.attr("id")+"','"+treeNd.save().replace("'","''")+"');");
			else
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+treeNd.save().replace("'","''")+"' WHERE name='"+treeNd.attr("id")+"';");	
		}
		progLbUpdt = progSelPrg = progSelCom = true;
	}
	else if((rez=ev_cur.match("ws_LnAccept:\\/arg(\\d)")).length)	save_active = true;
	else if((rez=ev_cur.match("ws_FocusOut:\\/arg(\\d)")).length)
	{
		argObj = this["arg"+rez[1]];
		argVal = argObj.attr("value");
		if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
		if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
		argObj.attrSet("value",argVal);
	}
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Get programms into library list
if(f_start || progLbUpdt)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	lib_items = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		lib_items += ((i_p==1)?"":"\n")+rez[i_p][0];
}
progCopy_active = progDel_active = progExport_active = comAdd_active = lib_value.length;

//> Command operations process
if(comOp.length && lib_value.length)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
	if(rez.length > 1)
	{
		comTree = SYS.XMLNode("prg");
		comTree.load(rez[1][0]);

		if(comOp == "add") comTree.childAdd("com").setAttr("id","New command");
		else 
		{
			//>> Get selected command position
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				if(comOp == "ins")	comTree.childIns(i_c,"com").setAttr("id","New command");
				else if(comOp == "del") { comTree.childDel(i_c); prog_value = ""; }
				else if((comOp == "up" && i_c) || (comOp == "dwn" && i_c < (comTree.childSize()-1)))
				{
					storeNd = comTree.childGet(i_c);
					comTree.childDel(i_c);
					if(comOp == "up") i_c--; else i_c++;
					comTree.childIns(i_c,storeNd);
					prog_value = i_c.toString()+":"+prog_value.parse(1,":");
				}
			}
		}

		//> Save changes
		SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
		progSelPrg = progSelCom = true;
	}
}

//> Get commands of selected program into commands list
if(f_start || progSelPrg)
{
	prog_items = "";
	if(lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			for(i_c = 0; i_c < comTree.childSize(); i_c++)
				prog_items += (i_c?"\n":"")+i_c+":"+comTree.childGet(i_c).attr("id");	
		}
	}
}
comIns_active = comDel_active = comUp_active = comDwn_active = prog_value.length;

//> Get command properties
if(f_start || progSelCom || progSelTp)
{
	if(!progSelTp) type_value = "";
	for(i_a = 1; i_a <= 5; i_a++)
	{
		this["labArg"+i_a].attrSet("en",false).attrSet("text","");
		this["arg"+i_a].attrSet("en",false).attrSet("value","");
	}

	//>> Types/commands list load
	if(f_start && !prExtComLs.isEVal())
	{
		type_items = "";
		for(var c_nm in prExtComLs)
			if(c_nm != "Error" && c_nm != "Stop")
				type_items += (type_items.length?"\n":"")+c_nm;
	}

	if(prog_value.length)
	{
		if(!progSelTp) type_value = prog_value.parse(1,":");
		//>> Load command argument's names
		if(!prExtComLs.isEVal() && !prExtComLs[type_value].isEVal())
			for(i_a = 1; i_a <= 5; i_a++)
			{
				argLab = prExtComLs[type_value]["arg"+i_a];
				if(argLab.isEVal() || !argLab.length)	continue;
				off = 0;
				this["labArg"+i_a].attrSet("en",true).attrSet("text",argLab.parse(0,"|",off));
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("min",argBord.length?argBord.toReal():EVAL_REAL);
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("max",argBord.length?argBord.toReal():EVAL_REAL);
				this["arg"+i_a].attrSet("en",true);
			}

		if(!progSelTp)
		{
			//>> Load arguments' values
			rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
			if(rez.length > 1)
			{
				comTree = SYS.XMLNode("prg");
				comTree.load(rez[1][0]);
				i_c = prog_value.toInt();
				if(i_c < comTree.childSize())
					for(i_a = 1; i_a <= 5; i_a++)
						this["arg"+i_a].attrSet("value",comTree.childGet(i_c).attr("arg"+i_a));
			}
		}
	}
}
type_active = prog_value.length;

uk#PROC:
JavaLikeCalc.JavaScript
if(f_start) save_active = false;
progLbUpdt = progSelPrg = progSelCom = progSelTp = false;
var comOp = "";

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/progAdd")
	{
		if(!progNm_value.length) progNm_value = "Нова програма";
		SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name) VALUES ('"+progNm_value+"');");
		progLbUpdt = true;
	}
	else if(ev_cur == "ws_BtPress:/progCopy")
	{
		if(!progNm_value.length) progNm_value = "Нова програма";
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name, prgTxt) VALUES ('"+progNm_value+"', '"+rez[1][0].replace("'","''")+"');");
			progLbUpdt = true;
		}
	}
	else if(ev_cur == "dlg_Apply:/progDel" && lib_value.length)
	//else if(ev_cur == "ws_BtPress:/progDel" && lib_value.length)
	{
		SYS.BD.nodeAt(dbDB,".").SQLReq("DELETE FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		lib_value = "";
		progLbUpdt = progSelPrg = true;
	}
  	else if(ev_cur == "ws_ListChange:/lib") { progSelPrg = progSelCom = true; prog_value = ""; }
	else if(ev_cur == "ws_BtPress:/comAdd") comOp = "add";
	else if(ev_cur == "ws_BtPress:/comIns") comOp = "ins";
	else if(ev_cur == "ws_BtPress:/comDel") comOp = "del";
	else if(ev_cur == "ws_BtPress:/comUp") comOp = "up";
	else if(ev_cur == "ws_BtPress:/comDwn") comOp = "dwn";
  	else if(ev_cur == "ws_ListChange:/prog") { progSelCom = true; save_active = false; }
	else if(ev_cur == "ws_CombChange:/type") { progSelTp = true; save_active = true; }
	else if(ev_cur == "ws_BtPress:/save" && prog_value.length) 
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				comTree.childGet(i_c).setAttr("id",type_value);
				for(i_a = 1; i_a <= 5; i_a++)
				{
					argObj = this["arg"+i_a];
					argVal = argObj.attr("value");
					if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
					if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
					comTree.childGet(i_c).setAttr("arg"+i_a, argVal);
				}
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
				prog_value = i_c.toString()+":"+type_value;
				progSelPrg = true;
			}
		}
		save_active = false;
	}
	else if(ev_cur == "ws_BtPress:/progExport" && lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			comTree.setAttr("id",lib_value);
			//> Load present file
			expTree = SYS.XMLNode("OpenSCADA_Prescr");
			expTree.load(fileExpImp,true);
			//> Remove already present record
			for(i_p = 0; i_p < expTree.childSize(); i_p++)
				if(expTree.childGet(i_p).attr("id") == lib_value)
				{
					expTree.childDel(i_p);
					break;
				}
			expTree.childAdd(comTree);
			expTree.save(0x05,fileExpImp);
		}
	} 
	else if(ev_cur == "ws_BtPress:/progImport")
	{
		//> Load present file
		expTree = SYS.XMLNode("OpenSCADA_Prescr");
		expTree.load(fileExpImp,true);
		//> Save all recors to DB
		SYS.messDebug("Prescription edit control","Items: "+expTree.childSize());
		for(i_p = 0; i_p < expTree.childSize(); i_p++)
		{
			treeNd = expTree.childGet(i_p);
			if(treeNd.name() != "prg") continue;
			if(lib_items.search(treeNd.attr("id")+"(\n|\\z)") < 0)
				SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name,prgTxt) VALUES ('"+treeNd.attr("id")+"','"+treeNd.save().replace("'","''")+"');");
			else
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+treeNd.save().replace("'","''")+"' WHERE name='"+treeNd.attr("id")+"';");	
		}
		progLbUpdt = progSelPrg = progSelCom = true;
	}
	else if((rez=ev_cur.match("ws_LnAccept:\\/arg(\\d)")).length)	save_active = true;
	else if((rez=ev_cur.match("ws_FocusOut:\\/arg(\\d)")).length)
	{
		argObj = this["arg"+rez[1]];
		argVal = argObj.attr("value");
		if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
		if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
		argObj.attrSet("value",argVal);
	}
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Get programms into library list
if(f_start || progLbUpdt)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	lib_items = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		lib_items += ((i_p==1)?"":"\n")+rez[i_p][0];
}
progCopy_active = progDel_active = progExport_active = comAdd_active = lib_value.length;

//> Command operations process
if(comOp.length && lib_value.length)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
	if(rez.length > 1)
	{
		comTree = SYS.XMLNode("prg");
		comTree.load(rez[1][0]);

		if(comOp == "add") comTree.childAdd("com").setAttr("id","Нова команда");
		else 
		{
			//>> Get selected command position
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				if(comOp == "ins")	comTree.childIns(i_c,"com").setAttr("id","Нова команда");
				else if(comOp == "del") { comTree.childDel(i_c); prog_value = ""; }
				else if((comOp == "up" && i_c) || (comOp == "dwn" && i_c < (comTree.childSize()-1)))
				{
					storeNd = comTree.childGet(i_c);
					comTree.childDel(i_c);
					if(comOp == "up") i_c--; else i_c++;
					comTree.childIns(i_c,storeNd);
					prog_value = i_c.toString()+":"+prog_value.parse(1,":");
				}
			}
		}

		//> Save changes
		SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
		progSelPrg = progSelCom = true;
	}
}

//> Get commands of selected program into commands list
if(f_start || progSelPrg)
{
	prog_items = "";
	if(lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			for(i_c = 0; i_c < comTree.childSize(); i_c++)
				prog_items += (i_c?"\n":"")+i_c+":"+comTree.childGet(i_c).attr("id");	
		}
	}
}
comIns_active = comDel_active = comUp_active = comDwn_active = prog_value.length;

//> Get command properties
if(f_start || progSelCom || progSelTp)
{
	if(!progSelTp) type_value = "";
	for(i_a = 1; i_a <= 5; i_a++)
	{
		this["labArg"+i_a].attrSet("en",false).attrSet("text","");
		this["arg"+i_a].attrSet("en",false).attrSet("value","");
	}

	//>> Types/commands list load
	if(f_start && !prExtComLs.isEVal())
	{
		type_items = "";
		for(var c_nm in prExtComLs)
			if(c_nm != "Error" && c_nm != "Stop")
				type_items += (type_items.length?"\n":"")+c_nm;
	}

	if(prog_value.length)
	{
		if(!progSelTp) type_value = prog_value.parse(1,":");
		//>> Load command argument's names
		if(!prExtComLs.isEVal() && !prExtComLs[type_value].isEVal())
			for(i_a = 1; i_a <= 5; i_a++)
			{
				argLab = prExtComLs[type_value]["arg"+i_a];
				if(argLab.isEVal() || !argLab.length)	continue;
				off = 0;
				this["labArg"+i_a].attrSet("en",true).attrSet("text",argLab.parse(0,"|",off));
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("min",argBord.length?argBord.toReal():EVAL_REAL);
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("max",argBord.length?argBord.toReal():EVAL_REAL);
				this["arg"+i_a].attrSet("en",true);
			}

		if(!progSelTp)
		{
			//>> Load arguments' values
			rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
			if(rez.length > 1)
			{
				comTree = SYS.XMLNode("prg");
				comTree.load(rez[1][0]);
				i_c = prog_value.toInt();
				if(i_c < comTree.childSize())
					for(i_a = 1; i_a <= 5; i_a++)
						this["arg"+i_a].attrSet("value",comTree.childGet(i_c).attr("arg"+i_a));
			}
		}
	}
}
type_active = prog_value.length;

ru#PROC:
JavaLikeCalc.JavaScript
if(f_start) save_active = false;
progLbUpdt = progSelPrg = progSelCom = progSelTp = false;
var comOp = "";

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/progAdd")
	{
		if(!progNm_value.length) progNm_value = "Новая программа";
		SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name) VALUES ('"+progNm_value+"');");
		progLbUpdt = true;
	}
	else if(ev_cur == "ws_BtPress:/progCopy")
	{
		if(!progNm_value.length) progNm_value = "Новая программа";
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name, prgTxt) VALUES ('"+progNm_value+"', '"+rez[1][0].replace("'","''")+"');");
			progLbUpdt = true;
		}
	}
	else if(ev_cur == "dlg_Apply:/progDel" && lib_value.length)
	//else if(ev_cur == "ws_BtPress:/progDel" && lib_value.length)
	{
		SYS.BD.nodeAt(dbDB,".").SQLReq("DELETE FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		lib_value = "";
		progLbUpdt = progSelPrg = true;
	}
     	else if(ev_cur == "ws_ListChange:/lib") { progSelPrg = progSelCom = true; prog_value = ""; }
	else if(ev_cur == "ws_BtPress:/comAdd") comOp = "add";
	else if(ev_cur == "ws_BtPress:/comIns") comOp = "ins";
	else if(ev_cur == "ws_BtPress:/comDel") comOp = "del";
	else if(ev_cur == "ws_BtPress:/comUp") comOp = "up";
	else if(ev_cur == "ws_BtPress:/comDwn") comOp = "dwn";
     	else if(ev_cur == "ws_ListChange:/prog") { progSelCom = true; save_active = false; }
	else if(ev_cur == "ws_CombChange:/type") { progSelTp = true; save_active = true; }
	else if(ev_cur == "ws_BtPress:/save" && prog_value.length) 
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				comTree.childGet(i_c).setAttr("id",type_value);
				for(i_a = 1; i_a <= 5; i_a++)
				{
					argObj = this["arg"+i_a];
					argVal = argObj.attr("value");
					if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
					if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
					comTree.childGet(i_c).setAttr("arg"+i_a, argVal);
				}
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
				prog_value = i_c.toString()+":"+type_value;
				progSelPrg = true;
			}
		}
		save_active = false;
	}
	else if(ev_cur == "ws_BtPress:/progExport" && lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			comTree.setAttr("id",lib_value);
			//> Load present file
			expTree = SYS.XMLNode("OpenSCADA_Prescr");
			expTree.load(fileExpImp,true);
			//> Remove already present record
			for(i_p = 0; i_p < expTree.childSize(); i_p++)
				if(expTree.childGet(i_p).attr("id") == lib_value)
				{
					expTree.childDel(i_p);
					break;
				}
			expTree.childAdd(comTree);
			expTree.save(0x05,fileExpImp);
		}
	} 
	else if(ev_cur == "ws_BtPress:/progImport")
	{
		//> Load present file
		expTree = SYS.XMLNode("OpenSCADA_Prescr");
		expTree.load(fileExpImp,true);
		//> Save all recors to DB
		SYS.messDebug("Prescription edit control","Items: "+expTree.childSize());
		for(i_p = 0; i_p < expTree.childSize(); i_p++)
		{
			treeNd = expTree.childGet(i_p);
			if(treeNd.name() != "prg") continue;
			if(lib_items.search(treeNd.attr("id")+"(\n|\\z)") < 0)
				SYS.BD.nodeAt(dbDB,".").SQLReq("INSERT INTO "+dbProgs+" (name,prgTxt) VALUES ('"+treeNd.attr("id")+"','"+treeNd.save().replace("'","''")+"');");
			else
				SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+treeNd.save().replace("'","''")+"' WHERE name='"+treeNd.attr("id")+"';");	
		}
		progLbUpdt = progSelPrg = progSelCom = true;
	}
	else if((rez=ev_cur.match("ws_LnAccept:\\/arg(\\d)")).length)	save_active = true;
	else if((rez=ev_cur.match("ws_FocusOut:\\/arg(\\d)")).length)
	{
		argObj = this["arg"+rez[1]];
		argVal = argObj.attr("value");
		if(!argObj.attr("min").isEVal()) argVal = max(argVal,argObj.attr("min"));
		if(!argObj.attr("max").isEVal()) argVal = min(argVal,argObj.attr("max"));
		argObj.attrSet("value",argVal);
	}
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Get programms into library list
if(f_start || progLbUpdt)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	lib_items = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		lib_items += ((i_p==1)?"":"\n")+rez[i_p][0];
}
progCopy_active = progDel_active = progExport_active = comAdd_active = lib_value.length;

//> Command operations process
if(comOp.length && lib_value.length)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
	if(rez.length > 1)
	{
		comTree = SYS.XMLNode("prg");
		comTree.load(rez[1][0]);

		if(comOp == "add") comTree.childAdd("com").setAttr("id","Новая команда");
		else 
		{
			//>> Get selected command position
			i_c = prog_value.toInt();
			if(i_c < comTree.childSize())
			{
				if(comOp == "ins")	comTree.childIns(i_c,"com").setAttr("id","Новая команда");
				else if(comOp == "del") { comTree.childDel(i_c); prog_value = ""; }
				else if((comOp == "up" && i_c) || (comOp == "dwn" && i_c < (comTree.childSize()-1)))
				{
					storeNd = comTree.childGet(i_c);
					comTree.childDel(i_c);
					if(comOp == "up") i_c--; else i_c++;
					comTree.childIns(i_c,storeNd);
					prog_value = i_c.toString()+":"+prog_value.parse(1,":");
				}
			}
		}

		//> Save changes
		SYS.BD.nodeAt(dbDB,".").SQLReq("UPDATE "+dbProgs+" SET prgTxt='"+comTree.save().replace("'","''")+"' WHERE name='"+lib_value+"';");
		progSelPrg = progSelCom = true;
	}
}

//> Get commands of selected program into commands list
if(f_start || progSelPrg)
{
	prog_items = "";
	if(lib_value.length)
	{
		rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
		if(rez.length > 1)
		{
			comTree = SYS.XMLNode("prg");
			comTree.load(rez[1][0]);
			for(i_c = 0; i_c < comTree.childSize(); i_c++)
				prog_items += (i_c?"\n":"")+i_c+":"+comTree.childGet(i_c).attr("id");	
		}
	}
}
comIns_active = comDel_active = comUp_active = comDwn_active = prog_value.length;

//> Get command properties
if(f_start || progSelCom || progSelTp)
{
	if(!progSelTp) type_value = "";
	for(i_a = 1; i_a <= 5; i_a++)
	{
		this["labArg"+i_a].attrSet("en",false).attrSet("text","");
		this["arg"+i_a].attrSet("en",false).attrSet("value","");
	}

	//>> Types/commands list load
	if(f_start && !prExtComLs.isEVal())
	{
		type_items = "";
		for(var c_nm in prExtComLs)
			if(c_nm != "Error" && c_nm != "Stop")
				type_items += (type_items.length?"\n":"")+c_nm;
	}

	if(prog_value.length)
	{
		if(!progSelTp) type_value = prog_value.parse(1,":");
		//>> Load command argument's names
		if(!prExtComLs.isEVal() && !prExtComLs[type_value].isEVal())
			for(i_a = 1; i_a <= 5; i_a++)
			{
				argLab = prExtComLs[type_value]["arg"+i_a];
				if(argLab.isEVal() || !argLab.length)	continue;
				off = 0;
				this["labArg"+i_a].attrSet("en",true).attrSet("text",argLab.parse(0,"|",off));
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("min",argBord.length?argBord.toReal():EVAL_REAL);
				argBord = argLab.parse(0,"|",off);
				this["arg"+i_a].attrSet("max",argBord.length?argBord.toReal():EVAL_REAL);
				this["arg"+i_a].attrSet("en",true);
			}

		if(!progSelTp)
		{
			//>> Load arguments' values
			rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT prgTxt FROM "+dbProgs+" WHERE name='"+lib_value+"';");
			if(rez.length > 1)
			{
				comTree = SYS.XMLNode("prg");
				comTree.load(rez[1][0]);
				i_c = prog_value.toInt();
				if(i_c < comTree.childSize())
					for(i_a = 1; i_a <= 5; i_a++)
						this["arg"+i_a].attrSet("value",comTree.childGet(i_c).attr("arg"+i_a));
			}
		}
	}
}
type_active = prog_value.length;


ID: prescrRun
PARENT: /wlb_originals/wdg_Box
ATTRS: name;dscr;geomW;geomH;evProc;pgGrp;backColor;bordWidth;bordColor;
ICO:

PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start)
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start || (prCnt%max(1,f_frq)) == 0)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += (curPrLst.length?"\n":"")+rez[i_p][0];
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)
	{
		prEndRun = true;
		prog_aCur = -1;	//Archiving
	}

	//> Build result table
	pTxt += "<i>Program: </i>"+Special.FLibSYS.strEnc2HTML(labProg_arg0val)+"<br/>\n";
	if(prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0))
	{
		pTxt += "<i>Started: </i>"+SYS.strftime(prExtStartTm)+"<br/>\n";
		if(prog_aCur < 0)
		{
			if(prExtMode == -1) pTxt += "<i>Status: </i>Error<br/>\n";
			else if(prExtMode == -2) pTxt += "<i>Status: </i>Successful finish<br/>\n";
			else if(prExtMode == -3) pTxt += "<i>Status: </i>Terminated<br/>\n";
			else pTxt += "<i>Status: </i>Unknown<br/>\n";
		}
	}
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "<i>Remain: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2)+"<br/>";
	}
	pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>#</th><th>Command</th><th>Comments</th><th>Time</th>";
	pTxt += "</tr>\n";
	for(i_c = 0; i_c < prExtWork.childSize(); i_c++)
	{
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		toMark = true;
		if(i_c < prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+((rezVl.toInt()==-10)?"skip":((rezVl.toInt()<0)?"err":"pass"))+"'>";
		else if(i_c == prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+(prEndRun?"err":"run")+"'>";
		else { pTxt += "<tr>"; toMark = false; }
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(toMark && rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(toMark && comTm)
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		else pTxt += "<td>---</td>";
		pTxt += "</tr>\n";
	}
	pTxt += "</table></body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Select program please</H1></body>";

if(pTxt.length)
{
	this.prog.attrSet("aDoc",pTxt);
	if(this.prog.attr("aCur") == this.prog.attr("vCur")) prog_doc = pTxt;
}

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_ListChange:/lib")
	{
		prog_vCur = prog_aCur;
		prExtProg = lib_value;
	}
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)	prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)
	{
		prExtMode = prExtCurCom = 0;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;

uk#PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start)
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start || (prCnt%max(1,f_frq)) == 0)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += (curPrLst.length?"\n":"")+rez[i_p][0];
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)
	{
		prEndRun = true;
		prog_aCur = -1;	//Archiving
	}

	//> Build result table
	pTxt += "<i>Програма: </i>"+Special.FLibSYS.strEnc2HTML(labProg_arg0val)+"<br/>\n";
	if(prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0))
	{
		pTxt += "<i>Запущено: </i>"+SYS.strftime(prExtStartTm)+"<br/>\n";
		if(prog_aCur < 0)
		{
			if(prExtMode == -1) pTxt += "<i>Стан: </i>Помилка<br/>\n";
			else if(prExtMode == -2) pTxt += "<i>Стан: </i>Вдале завершення<br/>\n";
			else if(prExtMode == -3) pTxt += "<i>Стан: </i>Перервано<br/>\n";
			else pTxt += "<i>Стан: </i>Невідомо<br/>\n";
		}
	}
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "<i>Залишилося: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2)+"<br/>";
	}
	pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>№</th><th>Команда</th><th>Коментарі</th><th>Час</th>";
	pTxt += "</tr>\n";
	for(i_c = 0; i_c < prExtWork.childSize(); i_c++)
	{
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		toMark = true;
		if(i_c < prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+((rezVl.toInt()==-10)?"skip":((rezVl.toInt()<0)?"err":"pass"))+"'>";
		else if(i_c == prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+(prEndRun?"err":"run")+"'>";
		else { pTxt += "<tr>"; toMark = false; }
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(toMark && rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(toMark && comTm)
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		else pTxt += "<td>---</td>";
		pTxt += "</tr>\n";
	}
	pTxt += "</table></body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Оберіть будь ласка програму</H1></body>";

if(pTxt.length)
{
	this.prog.attrSet("aDoc",pTxt);
	if(this.prog.attr("aCur") == this.prog.attr("vCur")) prog_doc = pTxt;
}

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_ListChange:/lib")
	{
		prog_vCur = prog_aCur;
		prExtProg = lib_value;
	}
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)	prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)
	{
		prExtMode = prExtCurCom = 0;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;

ru#PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start)
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start || (prCnt%max(1,f_frq)) == 0)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += (curPrLst.length?"\n":"")+rez[i_p][0];
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)
	{
		prEndRun = true;
		prog_aCur = -1;	//Archiving
	}

	//> Build result table
	pTxt += "<i>Программа: </i>"+Special.FLibSYS.strEnc2HTML(labProg_arg0val)+"<br/>\n";
	if(prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0))
	{
		pTxt += "<i>Запущено: </i>"+SYS.strftime(prExtStartTm)+"<br/>\n";
		if(prog_aCur < 0)
		{
			if(prExtMode == -1) pTxt += "<i>Статус: </i>Ошибка<br/>\n";
			else if(prExtMode == -2) pTxt += "<i>Статус: </i>Успешное завершение<br/>\n";
			else if(prExtMode == -3) pTxt += "<i>Статус: </i>Прерван<br/>\n";
			else pTxt += "<i>Статус: </i>Неизвестно<br/>\n";
		}
	}
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "<i>Осталось: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2)+"<br/>";
	}
	pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>№</th><th>Команда</th><th>Комментарии</th><th>Время</th>";
	pTxt += "</tr>\n";
	for(i_c = 0; i_c < prExtWork.childSize(); i_c++)
	{
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		toMark = true;
		if(i_c < prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+((rezVl.toInt()==-10)?"skip":((rezVl.toInt()<0)?"err":"pass"))+"'>";
		else if(i_c == prExtCurCom && (prExtMode > 0 || (prExtMode < 0 && prog_aCur < 0)))
			pTxt += "<tr class='"+(prEndRun?"err":"run")+"'>";
		else { pTxt += "<tr>"; toMark = false; }
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(toMark && rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(toMark && comTm)
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		else pTxt += "<td>---</td>";
		pTxt += "</tr>\n";
	}
	pTxt += "</table></body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Выберите пожалуйста программу</H1></body>";

if(pTxt.length)
{
	this.prog.attrSet("aDoc",pTxt);
	if(this.prog.attr("aCur") == this.prog.attr("vCur")) prog_doc = pTxt;
}

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off = 0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_ListChange:/lib")
	{
		prog_vCur = prog_aCur;
		prExtProg = lib_value;
	}
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)	prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)
	{
		prExtMode = prExtCurCom = 0;
		prog_vCur = prog_aCur;
	}
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;


ID: prescrRunSimple
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;backColor;bordWidth;bordColor;bordStyle;
ICO:

PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start) 
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += rez[i_p][0]+"\n";
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)	prEndRun = true;

	//> Build result
	pTxt += "<i>Program: </i>"+Special.FLibSYS.strEnc2HTML(lib_value);
	if(prExtMode > 0) pTxt += "\n<br/><i>Started: </i>"+SYS.strftime(prExtStartTm);
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "\n<br/><i>Remain: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2);
	}
	if(prExtMode > 0 && prExtCurCom < prExtWork.childSize())
	{
		pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>#</th><th>Command</th><th>Comments</th><th>Time</th></tr>\n";
		i_c = (prExtMode == 0) ? 0 : prExtCurCom;
		//for(i_c = 0; i_c < comTree.childSize(); i_c++){
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		//if(prExtMode != 0 && i_c < prExtCurCom) pTxt += "<tr class='pass'>";	else
		if(prExtMode != 0 /*&& i_c == prExtCurCom*/) pTxt += "<tr class='"+((prExtMode==-1)?"err":"run")+"'>";
		else pTxt += "<tr>";
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(!comTm) pTxt += "<td>---</td>";
		else 
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		pTxt += "</tr>\n</table>";
	}
	pTxt += "</body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Select program</H1></body>";

if(pTxt.length)	prog_doc = pTxt;

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_CombChange:/lib") prExtProg = lib_value;
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)			prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)	prExtMode = prExtCurCom = 0;
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;

uk#PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start) 
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += rez[i_p][0]+"\n";
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)	prEndRun = true;

	//> Build result
	pTxt += "<i>Програма: </i>"+Special.FLibSYS.strEnc2HTML(lib_value);
	if(prExtMode > 0) pTxt += "\n<br/><i>Запущено: </i>"+SYS.strftime(prExtStartTm);
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "\n<br/><i>Залишилося: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2);
	}
	if(prExtMode > 0 && prExtCurCom < prExtWork.childSize())
	{
		pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>№</th><th>Команда</th><th>Коментарі</th><th>Час</th></tr>\n";
		i_c = (prExtMode == 0) ? 0 : prExtCurCom;
		//for(i_c = 0; i_c < comTree.childSize(); i_c++){
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		//if(prExtMode != 0 && i_c < prExtCurCom) pTxt += "<tr class='pass'>";	else
		if(prExtMode != 0 /*&& i_c == prExtCurCom*/) pTxt += "<tr class='"+((prExtMode==-1)?"err":"run")+"'>";
		else pTxt += "<tr>";
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(!comTm) pTxt += "<td>---</td>";
		else 
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		pTxt += "</tr>\n</table>";
	}
	pTxt += "</body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Оберіть програму</H1></body>";

if(pTxt.length)	prog_doc = pTxt;

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_CombChange:/lib") prExtProg = lib_value;
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)			prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)	prExtMode = prExtCurCom = 0;
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;

ru#PROC:
JavaLikeCalc.JavaScript
//> Get programms into library list
if(f_start) 
{
	prEndRun = true;
	lib_value = "";
	btStop_active = false;
	prCnt = 0;
}
if(prExtMode.isEVal() || prExtProg.isEVal() || prExtStartTm.isEVal() || prExtCurCom.isEVal() || prExtWork.isEVal())
	return;

//> Check for program list update
if(f_start)
{
	rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	curPrLst = "";
	for(i_p = 1; i_p < rez.length; i_p++)
		curPrLst += rez[i_p][0]+"\n";
	if(curPrLst != lib_items) lib_items = curPrLst;
}

//Check for ready
btStart_active = prExtProg.length;

if(prExtMode <= 0)		{ btStart_img = "start"; btStart_value = false; btStop_active = btPass_active = false; }
else if(prExtMode == 1){ btStart_img = "pause"; btStart_value = false; btStop_active = btPass_active = true; prEndRun = false; }
else if(prExtMode == 2){ btStart_img = "start"; btStart_value = true; btStop_active = true; btPass_active = false; }

//> Prepare call status document
pTxt = "";
if((prExtMode == 1 || prExtMode == 3 || ((prCnt%max(1,f_frq)) == 0 && prExtMode <= 0)))
{
	pTxt = "<body>";
	off = 0;
	labProg_arg0val = prExtWork.attr("name");

	if(prExtMode < 0 && !prEndRun)	prEndRun = true;

	//> Build result
	pTxt += "<i>Программа: </i>"+Special.FLibSYS.strEnc2HTML(lib_value);
	if(prExtMode > 0) pTxt += "\n<br/><i>Запущено: </i>"+SYS.strftime(prExtStartTm);
	if(prExtMode == 1)
	{
		wtm = max(0,prExtWork.attr("wtm").toInt()-(SYS.time()-prExtStartTm));
		pTxt += "\n<br/><i>Осталось: </i>"+(wtm/3600).toString(10)+":"+((wtm/60)%60).toString(10,2)+":"+(wtm%60).toString(10,2);
	}
	if(prExtMode > 0 && prExtCurCom < prExtWork.childSize())
	{
		pTxt += "<table border='1' cellpadding='2' cellspacing='0' width='100%'>\n"
					"<tr><th>№</th><th>Команда</th><th>Коментарии</th><th>Время</th></tr>\n";
		i_c = (prExtMode == 0) ? 0 : prExtCurCom;
		//for(i_c = 0; i_c < comTree.childSize(); i_c++){
		comEl = prExtWork.childGet(i_c);
		rezVl = comEl.attr("rez");
		//if(prExtMode != 0 && i_c < prExtCurCom) pTxt += "<tr class='pass'>";	else
		if(prExtMode != 0 /*&& i_c == prExtCurCom*/) pTxt += "<tr class='"+((prExtMode==-1)?"err":"run")+"'>";
		else pTxt += "<tr>";
		pTxt += "<td>"+i_c+"</td>";
		pTxt += "<td>"+Special.FLibSYS.strEnc2HTML(comEl.attr("id"))+"</td><td>";
		if(rezVl.parse(1,":").length) pTxt += Special.FLibSYS.strEnc2HTML(rezVl.parse(1,":"));
		else
		{
			//> Arguments values
			for(i_a = 1; i_a <= 5; i_a++)
				if(comEl.attr("labArg"+i_a).length)
					pTxt += Special.FLibSYS.strEnc2HTML(comEl.attr("labArg"+i_a).parse(0,"|")+" = "+comEl.attr("arg"+i_a)+"; ");
		}
		pTxt += "</td>";
		comTm = comEl.attr("tm").toInt();
		if(!comTm) pTxt += "<td>---</td>";
		else 
		{
			comTm -= prExtStartTm;
			pTxt += "<td>"+(comTm/3600).toString(10)+":"+
									((comTm/60)%60).toString(10,2)+":"+
									(comTm%60).toString(10,2)+"</td>";
		}
		pTxt += "</tr>\n</table>";
	}
	pTxt += "</body>";
}

if(!prExtProg.length && f_start) pTxt = "<body><H1>Выберите программу</H1></body>";

if(pTxt.length)	prog_doc = pTxt;

prCnt++;

//> Events for commands process
ev_cur = ev_rez = "";
off=0;
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_CombChange:/lib") prExtProg = lib_value;
	else if(ev_cur == "ws_BtPress:/btStart")
	{
		if(prExtMode <= 0)			prExtMode = 1;
		else if(prExtMode == 1)	prExtMode = 2;
	}
	else if(ev_cur == "ws_BtRelease:/btStart")	prExtMode = 1;
	else if(ev_cur == "ws_BtPress:/btStop" && prExtMode >= 0)	prExtMode = prExtCurCom = 0;
	else if(ev_cur == "ws_BtPress:/btPass" && prExtMode == 1)	prExtMode = 3;
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//> Programm select process
if(!prExtProg.length || lib_items.search("^"+prExtProg.replace(new RegExp("(\\[|\\]|\\(|\\)|\\.|\\+|\\*|\\?|\\^|\\$|\\<|\\>|\\{|\\}|\\\\)","g"),"\\$1")+"$","m") < 0)
	prExtProg = lib_value;
else lib_value = prExtProg;


ID: accept
PARENT: /wlb_originals/wdg_Box
ATTRS: name;geomW;geomH;pgGrp;backColor;bordWidth;
ICO:

PROC:
JavaLikeCalc.JavaScript
if(f_start) mess_text = elMess;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/apply")
	{
		elEvent += "dlg_Apply\n";
		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

uk#PROC:
JavaLikeCalc.JavaScript
if(f_start) mess_text = elMess;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/apply")
	{
		elEvent += "dlg_Apply\n";
		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

ru#PROC:
JavaLikeCalc.JavaScript
if(f_start) mess_text = elMess;

//> Events for commands process
off=0;
ev_cur = ev_rez = "";
while(true)
{
	ev_cur = event.parse(0,"\n",off);
	if(ev_cur == "") break;
	//SYS.messDebug("Prescription edit control","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/apply")
	{
		elEvent += "dlg_Apply\n";
		this.attrSet("pgOpen",false);
	}
	else if(ev_cur == "ws_BtPress:/cancel")	this.attrSet("pgOpen",false);
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;


