Saturday, October 27, 2012

Cicode-SCADA


/*These are simple functions used around the super genies to allow the user to do simple associations.*/


INT
FUNCTION
AssTag(INT nArg, STRING sTag, STRING sCluster = "")

    RETURN Ass(WinNumber(), nArg, sTag, 0, sCluster);
END

FUNCTION
AssVarTags(INT hWin, INT offset, STRING sTag1 = "", STRING sTag2 = "", STRING sTag3 = "",
 STRING sTag4 = "", STRING sTag5 = "", STRING sTag6 = "", STRING sTag7 = "", STRING sTag8 = "")

   
    Ass(hWin, offset + 1, sTag1, 0);
    Ass(hWin, offset + 2, sTag2, 0);
    Ass(hWin, offset + 3, sTag3, 0);
    Ass(hWin, offset + 4, sTag4, 0);
    Ass(hWin, offset + 5, sTag5, 0);
    Ass(hWin, offset + 6, sTag6, 0);
    Ass(hWin, offset + 7, sTag7, 0);
    Ass(hWin, offset + 8, sTag8, 0);
END

INT
FUNCTION
AssPage(STRING sPage, STRING sTag1 = "", STRING sTag2 = "", STRING sTag3 = "",
 STRING sTag4 = "", STRING sTag5 = "", STRING sTag6 = "", STRING sTag7 = "", STRING sTag8 = "")

    AssVarTags(WinNumber(), 0, sTag1, sTag2, sTag3, sTag4, sTag5, sTag6, sTag7, sTag8);

    RETURN _PageDisplay(sPage);
END

INT
FUNCTION
AssMetadataPage(STRING sPage, INT nAN = -2)

    AssMetadata(-2, nAN);

    RETURN _PageDisplay(sPage);
END


INT
FUNCTION
AssMetadataWin(STRING sPage, INT x = 0, INT y = 0, INT mode = 0, INT nAN = -2)

    AssMetadata(-2, nAN);

    IF WinNewAt(sPage, x, y, mode) = -1 THEN
        RETURN 269;
    ELSE
        RETURN 0;
    END
END


INT
FUNCTION
AssMetadataPopUp(STRING sPage, INT nAN = -2)

    INT     x, y;
    REAL    ScaleX, ScaleY;
    AssMetadata(-2, nAN);

    DspGetMouse(x, y);
    PageTransformCoords(WinNumber(), x, y, x, y, 0);
    ScaleX = StrToReal(PageInfo(16));
    ScaleY = StrToReal(PageInfo(17));
    x = x / ScaleX;
    y = y / ScaleY;
   
    IF WinNewAt(sPage, x, y, 1 + 8 + 32 + 256 + 512) = -1 THEN
        RETURN 269;
    ELSE
        RETURN 0;
    END
END


INT
FUNCTION
AssWin(STRING sPage, INT x = 0, INT y = 0, INT mode = 0, STRING sTag1 = "", STRING sTag2 = "", STRING sTag3 = "",
 STRING sTag4 = "", STRING sTag5 = "", STRING sTag6 = "", STRING sTag7 = "", STRING sTag8 = "")

    AssVarTags(-2, 0, sTag1, sTag2, sTag3, sTag4, sTag5, sTag6, sTag7, sTag8);

   
    IF WinNewAt(sPage, x, y, mode) = -1 THEN
        RETURN 269;
    ELSE
        RETURN 0;
    END
END


INT
FUNCTION
AssPopUp(STRING sPage, STRING sTag1 = "", STRING sTag2 = "", STRING sTag3 = "",
 STRING sTag4 = "", STRING sTag5 = "", STRING sTag6 = "", STRING sTag7 = "", STRING sTag8 = "")

    INT x, y;
    REAL    ScaleX, ScaleY;

    DspGetMouse(x, y);
    PageTransformCoords(WinNumber(), x, y, x, y, 0);
    ScaleX = StrToReal(PageInfo(16));
    ScaleY = StrToReal(PageInfo(17));
    x = x / ScaleX;
    y = y / ScaleY;
    RETURN AssWin(sPage, x, y, 1 + 8 + 32 + 256 + 512, sTag1, sTag2, sTag3, sTag4, sTag5, sTag6, sTag7, sTag8);
END


INT
FUNCTION
AssChainPage(STRING sPage)

    AssChain(WinNumber(), WinNumber(), 0);

    RETURN _PageDisplay(sPage);
END

INT
FUNCTION
AssChainWin(STRING sPage, INT x = 0, INT y = 0, INT mode = 0)

    AssChain(-2, WinNumber(), 0);

    IF WinNewAt(sPage, x, y, mode) = -1 THEN
        RETURN 269;
    ELSE
        RETURN 0;
    END
END

INT
FUNCTION
AssChainPopUp(STRING sPage)
    INT x, y;
    REAL    ScaleX, ScaleY;

    DspGetMouse(x, y);
    PageTransformCoords(WinNumber(), x, y, x, y, 0);
    ScaleX = StrToReal(PageInfo(16));
    ScaleY = StrToReal(PageInfo(17));
    x = x / ScaleX;
    y = y / ScaleY;
    RETURN AssChainWin(sPage, x, y, 1 + 8 + 32 + 256 + 512);
END

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.