analog artist resize

Discussion in 'Cadence' started by fogh, Jul 20, 2004.

  1. fogh

    fogh Guest

    Hi All,

    the following piece of code fixes the problem with resizing analog artist. If you don t know what I mean, ask someone who used analog artist.
    It works for me, and for some heroic alpha-test designer at our site, but is not perfect. I you find how to remove the glitches and improve, please post. If you want to comment on the ugly indentation, please don t post ;)



    /***************************************************************************************
    analog artist UI fix by F. Oghdayan. 2004.
    This works OK with IC50 and IC446, but probably not with IC51, because of modifications in the analog artist form.
    Home brewed. May cause slight blindness or sporadic death, you get my point: use at your own risk.
    ****************************************************************************************/

    /*
    goal: In the call chain
    sevStartSession --> sevCreateMainWindow --> sevSetWindowForm --> hiCreateAppForm
    we must modify the call to hiCreateAppForm to support field attachments (cf. skill UI reference chapter 7 = "Forms" )
    The best would be to redefine hiCreateAppForm so that it makes an "intelligent" guess for attachments and initialsize, and handle at least in a few cases (analog artist vars, calculator "screen").
    But the next best thing is what we do here: modify sevSetWindowForm.
    */

    ;; enable overwrite of read-only functions. This is necessary if this file is loaded after the artist context file.
    sstatus(debugMode t)
    ;; declare the functions read only , to avoid overwrite by artist context file
    sstatus(writeProtect t)

    when( fboundp('sevSetWindowForm) && !fboundp('CsevSetWindowForm)
    CsevSetWindowForm_org=getd('sevSetWindowForm)
    procedure( ADErollback() putd('sevSetWindowForm CsevSetWindowForm_org) );proc
    )

    procedure( CsevSetWindowForm(session)
    let(((row 0)
    Csevfields
    ;Csevattachments
    )
    session->windowForm = hiCreateAppForm(
    ?name sevGlobalSymbol('WindowForm session)
    ;;?initialSize t ;; this should be set to a meaningful value such as list( width height)
    /* to be tried for initialsize: list(sevMainFormWidth() sevMainFormHeight())*/
    /* sevWindowWidth() => 578 ; sevWindowHeight() => 372 */
    ;;?initialSize list(sevMainFormWidth() CsevMainFormHeight())
    ;; CsevMainFormHeight should in fact retrieve window Ysize and substract banner+menu from that . Now gives roughly 372-49 = 323
    ?initialSize list( sevWindowWidth()-3 sevWindowHeight()-49-6 )
    ;; from "X11/bin/xprop" : program specified size: 578 by 372
    ?fields Csevfields=mapcan(
    lambda( (fieldWithArgs) apply('sevMainFormFieldSets cons(session fieldWithArgs) ))
    list(list('design row) list('lib ++row) list('cell ++row) list('view ++row) list('varListBox) list('anaListBox row=0) list('outListBox) list('prompt))
    );mapcan
    /* we need an attachment argument with length equal to that of the field generated by mapcan */
    ?attachmentList Csevattachments=mapcar(
    'CsevMainFormAttachmentSets
    mapcar(lambda( (Csevfield) symbolToString( getq(car(Csevfield) hiFieldSym) ) ) Csevfields)
    );mapcar
    );create app form
    )
    )

    /*****************************************************************************/
    /*
    the variable Csevfields inserted in the hicreateAppForm in sevSetWindowForm has lenght 15. Each of the 15 lists contains 2 elements. first element is a GUI structure.
    foreach(struct mapcar('car Csevfields) printf("%L\n" getq(struct hiFieldSym)) )
    =>
    \o design
    \o designLabel
    \o lib
    \o cell
    \o view
    \o varListBoxHeader
    \o varListBoxLabel
    \o varListBox
    \o anaListBoxHeader
    \o anaListBoxLabel
    \o anaListBox
    \o outListBoxHeader
    \o outListBoxLabel
    \o outListBox
    \o prompt

    Thus we can template on sevMainFormFieldSets a function that returns attachments. We should return topleft for design (1) , bottomleft for varListBox (8) , topright for anaListBox (11) , bottomright for outListBox (14)
    */
    procedure( CsevMainFormAttachmentSets( fieldName )
    let(
    ;; - position attachment can attach right(of the field)-to-right(of the form) , or left-to-left, ...
    ;; - "nil" attachment makes the field widht constant, and is an indirect way to attach right-to-left, left-to-right, bottom-to-top, or top-to-bottom
    ;; - percent attachment can attach right-to-both-left-and-right, left-to-both-left-and-right, ... they just maintain the proportional position
    ;;The poor man's solution would be to use percent everywhere.
    (
    (TS hicTopPositionSet) (TD hicTopPercentSet) (BS hicBottomPositionSet) (BD hicBottomPercentSet)
    (LS hicLeftPositionSet) (LD hicLeftPercentSet) (RS hicRightPositionSet) (RD hicRightPercentSet)
    VS VSL VSR HD
    TL TR BL BR
    );local vars
    VS = LD|RD|TS
    VSL= LS|RD|TS
    VSR= LD|RS|TS
    TL = TS|BS|LS|RD
    TR = TS|BS|LD|RS
    BL = TD|BS|LS|RD
    BR = TD|BS|LD|RS
    ;; select an attachment that fits the fieldname
    case( stringToSymbol(fieldName) ;; do we really need the symboltostring -> stringtosymbol , or is there no evaluation problem ? . try remove it here and in the hiCreateAppForm call.
    (design VSL)
    (designLabel VSL)
    (lib VSL)
    (cell VSL)
    (view VSL)

    (anaListBoxHeader VSR)
    (anaListBoxLabel VSR)
    (anaListBox VSR)

    (varListBoxHeader VSL)
    (varListBoxLabel VSL)
    (varListBox TL)

    (outListBoxHeader VSR)
    (outListBoxLabel VSR)
    (outListBox TR)

    (prompt BS|LD|RD)
    );case
    );let
    );proc

    procedure( CsevMainFormHeight() /* this one definitely needs improvement... */
    let(( (labelHeight 30) (boxLabelHeight sevListBoxHeight(1)) ySecondRow (topBoxRows 3) (bottomBoxRows 6) )
    ySecondRow = labelHeight + boxLabelHeight + -3 + sevListBoxHeight(topBoxRows) + -3 ;wrong: this returns stg like 122
    ;;372 ;that is the total window size
    ;;312 ;trial and error value : seems to give nice results.
    312
    );let
    );proc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    /*_______overwrite cadence func_______*/
    putd('sevSetWindowForm getd('CsevSetWindowForm) )

    ;; set write protect flag back to default.
    sstatus(writeProtect nil)
    ;; disable overwrite of read-only functions.
    sstatus(debugMode nil)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    fogh, Jul 20, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.