(include "sci.sh")
(use "Main")
(use "n255")
(use "Print")
(use "ClickMenu")
(use "DlgWindow")
(use "SysWindow")
(use "File")
(use "Obj")
(script 947)


(local
    theGSq5Win
    local1
    local2[40]
    local42[20]
    local62[28] = (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 120 )
    local90[22] = (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
    local112[110] = (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )

)
(procedure (localproc_229e param1 param2)
    (if (> StrLen(param1) param2)
        StrAt(param1 param2 0)
        StrAt(param1 --param2 46)
        StrAt(param1 --param2 46)
        StrAt(param1 --param2 46)
    )
    return param1
)


(procedure (localproc_22dc param1)
    (var temp0, temp1, temp2, temp3, temp4, temp5[10], temp15[10], temp25[10], temp35[10], temp45[12])
    (asm
        pushi   #noun
        pushi   0
        lap     param1
        send    4
        sat     temp0
        pushi   #verb
        pushi   0
        lap     param1
        send    4
        sat     temp1
        pushi   #case
        pushi   0
        lap     param1
        send    4
        sat     temp2
        pushi   #seq
        pushi   0
        lap     param1
        send    4
        sat     temp3
        pushi   #modNum
        pushi   0
        lap     param1
        send    4
        sat     temp4
        pushi   3
        lea     @temp5
        push    
        lofsa   "%d"
        push    
        lst     temp0
        callk   Format, 6
        pushi   3
        lea     @temp15
        push    
        lofsa   "%d"
        push    
        lst     temp1
        callk   Format, 6
        pushi   3
        lea     @temp25
        push    
        lofsa   "%d"
        push    
        lst     temp2
        callk   Format, 6
        pushi   3
        lea     @temp35
        push    
        lofsa   "%d"
        push    
        lst     temp3
        callk   Format, 6
        pushi   3
        lea     @temp45
        push    
        lofsa   "%d"
        push    
        lst     temp4
        callk   Format, 6
        pushi   #addTitle
        pushi   1
        lea     @local42
        push    
        pushi   30
        pushi   1
        pushi   0
        pushi   205
        pushi   1
        lofsa   "Enter new message parameters:"
        push    
        pushi   205
        pushi   3
        lofsa   "Noun"
        push    
        pushi   5
        pushi   25
        pushi   205
        pushi   3
        lofsa   "Verb"
        push    
        pushi   85
        pushi   25
        pushi   205
        pushi   3
        lofsa   "Case"
        push    
        pushi   5
        pushi   39
        pushi   205
        pushi   3
        lofsa   "Seq"
        push    
        pushi   85
        pushi   39
        pushi   205
        pushi   3
        lofsa   "Module"
        push    
        pushi   47
        pushi   53
        pushi   207
        pushi   5
        lea     @temp5
        push    
        pushi   4
        pushi   45
        pushi   25
        lea     @temp5
        push    
        pushi   207
        pushi   5
        lea     @temp15
        push    
        pushi   4
        pushi   125
        pushi   25
        lea     @temp15
        push    
        pushi   207
        pushi   5
        lea     @temp25
        push    
        pushi   4
        pushi   45
        pushi   39
        lea     @temp25
        push    
        pushi   207
        pushi   5
        lea     @temp35
        push    
        pushi   4
        pushi   125
        pushi   39
        lea     @temp35
        push    
        pushi   207
        pushi   5
        lea     @temp45
        push    
        pushi   5
        pushi   101
        pushi   53
        lea     @temp45
        push    
        pushi   212
        pushi   4
        pushi   1
        lofsa   "   OK   "
        push    
        pushi   18
        pushi   67
        pushi   212
        pushi   4
        pushi   0
        lofsa   "Cancel"
        push    
        pushi   91
        pushi   67
        pushi   110
        pushi   0
        class   Print
        send    166
        bnt     code_24d7
        pushi   1
        lea     @temp5
        push    
        callk   ReadNumber, 2
        sat     temp0
        pushi   1
        lea     @temp15
        push    
        callk   ReadNumber, 2
        sat     temp1
        pushi   1
        lea     @temp25
        push    
        callk   ReadNumber, 2
        sat     temp2
        pushi   1
        lea     @temp35
        push    
        callk   ReadNumber, 2
        sat     temp3
        pushi   1
        lea     @temp45
        push    
        callk   ReadNumber, 2
        sat     temp4
        pushi   6
        pushi   0
        push    
        lst     temp0
        lst     temp1
        lst     temp2
        lst     temp3
        callk   GetMessage, 12
        not     
        bnt     code_248b
        pushi   1
        lofsa   "Can't find message!"
        push    
        calle   proc921_0, 2
        ldi     0
        ret     
        jmp     code_24da
code_248b:pushi   6
        pushi   2
        lst     temp4
        lst     temp0
        lst     temp1
        lst     temp2
        lst     temp3
        callk   GetMessage, 12
        not     
        bnt     code_24b0
        pushi   1
        lofsa   "Message contains no text!"
        push    
        calle   proc921_0, 2
        ldi     0
        ret     
        jmp     code_24da
code_24b0:pushi   #noun
        pushi   1
        lst     temp0
        pushi   508
        pushi   1
        lst     temp1
        pushi   509
        pushi   1
        lst     temp2
        pushi   510
        pushi   1
        lst     temp3
        pushi   222
        pushi   1
        lst     temp4
        lap     param1
        send    30
        ldi     1
        ret     
        jmp     code_24da
code_24d7:ldi     0
        ret     
code_24da:ret     
    )
)


(procedure (localproc_24db param1)
    (Print:
        addTitle(@local42)
        font(0)
        width(50)
        addText("What kind of text?")
        addButton(1 " Literal " 60 0)
        addButton(2 "MSG file" 60 14)
        addButton(0 "  Cancel  " 60 28)
        first(
            (if ((send param1:seq))
                2
            )(else
                1
            )
)
        init()
    )
)


(instance mainMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local62))
    )

)
(instance editBMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local90))
    )

)
(instance editTMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local112))
    )

)
(instance editEMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local65417))
    )

)
(instance editIMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local65439))
    )

)
(instance editSMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local65461))
    )

)
(instance editWMenu of ClickMenu
    (properties)

    (method (init)
        (super:init(@local65480))
    )

)
(class DlgWindow of SysWindow
    (properties
        top 0
        left 0
        bottom 0
        right 0
        color 0
        back 15
        priority 15
        window 0
        type 0
        title 0
        brTop 0
        brLeft 0
        brBottom 190
        brRight 320
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        eraseOnly 0
        noun 0
        verb 0
        case 0
        seq 0
        modNum 0
    )

    (method (dispose)
        (super:dispose())
        = local1 0
    )


    (method (open param1)
        (var temp0)
        = type 
            (if (title)
                4
            )(else
                0
            )
        = temp0 GetPort()
        (super:open(rest param1))
        SetPort(temp0)
        = local1 1
    )


    (method (create)
        (var temp0, temp1, temp2, temp3, temp4, temp5)
        = temp0 190
        = temp1 320
        = temp2 0
        = temp3 0
        = temp4 0
        (while (< temp4 (DialogEditor:size))
            = temp0 proc999_2((send ((= temp5 (DialogEditor:at(temp4)))):nsTop) temp0)
            = temp1 proc999_2((send temp5:nsLeft) temp1)
            = temp2 proc999_3((send temp5:nsBottom) temp2)
            = temp3 proc999_3((send temp5:nsRight) temp3)
            ++temp4
        )
        (DialogEditor:eachElementDo(102))
        (self:dispose())
        = top (- temp0 4)
        = bottom (+ temp2 4)
        = left (- temp1 4)
        = right (+ temp3 4)
        (self:open())
        (DialogEditor:eachElementDo(80))
    )


    (method (moveTo theLeft theTop)
        (var temp0, temp1, temp2, temp3)
        = temp0 0
        (while (< temp0 (DialogEditor:size))
            = temp2 (- (send ((= temp1 (DialogEditor:at(temp0)))):nsLeft) left)
            = temp3 (- (send temp1:nsTop) top)
            (send temp1:
                hide()
                moveTo(+ theLeft temp2 + theTop temp3)
            )
            ++temp0
        )
        = left theLeft
        = top theTop
        (self:create())
    )


    (method (editMsg)
        (if (localproc_22dc(self))
            (if (title)
                Memory(3 title)
            )
            = title Memory(1 GetMessage(2 modNum noun verb case seq))
            GetMessage(0 modNum noun verb case seq title)
        )
        (self:create())
    )


    (method (editPosn)
        (var newEvent, newEventX, temp2, temp3, temp4)
        (if (local1)
            proc921_0("Click to where the top left of the window should be")
            (while (<> (send ((= newEvent (Event:new()))):type) 1)
                (send newEvent:dispose())
            )
            = newEventX (send newEvent:x)
            = temp2 (- (send newEvent:y) 10)
            (send newEvent:dispose())
            = temp3 (- bottom top)
            = newEventX proc999_3(0 proc999_2(newEventX (- 320 (= temp4 (- right left)))))
            (self:moveTo(newEventX (= temp2 proc999_3(0 proc999_2(temp2 (- 190 temp3))))))
        )(else
            proc921_0("No window to position!")
        )
    )


    (method (editTitle)
        (switch (localproc_24db(self))
            (case 0
                (return   )
            )
            (case 2
                ((self:editMsg()) return  )
            )
        )
        (if (seq)
            Memory(3 title)
            = noun (= verb (= case (= seq (= modNum (= title 0)))))
        )
        (if (not title)
            = title Memory(1 50)
            StrCpy(title "title")
        )
        (Print:
            addTitle(@local42)
            addText("Enter new title:")
            addEdit(title 50 0 12 title)
            init()
        )
        (self:create())
    )

)
(class _DItem of Class_255_0
    (properties
        type 0
        state 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
    )

    (method (dispose param1)
        (self:hide())
        (super:dispose(rest param1))
    )


    (method (select param1)
        (self:hide())
        (if (param1)
            = state (| state $0008)
        )(else
            = state (& state $fff7)
        )
        (self:draw())
    )


    (method (handleEvent pEvent)
        (var temp0)
        = temp0 0
        (send pEvent:claimed(1))
        = temp0 (self:track(pEvent))
    )


    (method (track param1)
        (var temp0, temp1, temp2[40])
        (if (== (send param1:type) 1)
            (self:hide())
            (do 
                (send (= param1 (Event:new(32768))):localize())
                = temp0 (send param1:x)
                = temp1 (send param1:y)
                DrawStatus(Format(@temp2 "DRAGGING: %d, %d" temp0 temp1))
                (self:moveTo(temp0 temp1))
                (send param1:dispose())
            ) while (not not Print())
            DrawStatus(" " 0 0)
            DrawStatus(0)
            (if ((DialogEditor:curMenu))
                (send ((DialogEditor:curMenu)):init())
            )
            DrawPic((send gRoom:picture) 100)
            (if (local1)
                (DlgWindow:create())
            )(else
                (DialogEditor:eachElementDo(80))
            )
        )
    )


    (method (draw)
        (var temp0, temp1, temp2, temp3)
        = temp0 (- nsTop 1)
        = temp1 (- nsLeft 1)
        = temp2 (+ nsBottom 1)
        = temp3 (+ nsRight 1)
        (if (underBits)
            UnLoad(133 underBits)
            = underBits 0
        )
        = underBits Graph(7 temp0 temp1 temp2 temp3 1)
        DrawControl(self)
    )


    (method (hide)
        (var temp0, temp1, temp2, temp3)
        (if (underBits)
            Graph(8 underBits)
            = temp0 (- nsTop 1)
            = temp1 (- nsLeft 1)
            = temp2 (+ nsBottom 1)
            = temp3 (+ nsRight 1)
            = underBits 0
            Graph(13 temp0 temp1 temp2 temp3)
        )
    )


    (method (editPosn)
        (var temp0[25], temp25[5], temp30, temp31, temp32)
        Format(@temp0 "%d" nsLeft)
        Format(@temp25 "%d" nsTop)
        (if (= temp30 (Print:
                addTitle(@local42)
                addText("Enter new position:")
                addText("x = " 0 12)
                addText("y = " 65 12)
                addEdit(@temp0 5 25 12 @temp0)
                addEdit(@temp25 6 90 12 @temp25)
                font(0)
                addButton(0 " Cancel " 35 26)
                init()
            )
)
            = temp31 proc999_3(4 ReadNumber(@temp0))
            (self:
                hide()
                moveTo(temp31 = temp32 proc999_3(4 ReadNumber(@temp25)))
                draw()
            )
        )
    )

)
(class _DText of _DItem
    (properties
        type 2
        state 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
        text 0
        font 0
        mode 0
        width 0
        noun 0
        verb 0
        case 0
        seq 0
        modNum 0
    )

    (method (setSize param1)
        (var temp0[4])
        TextSize(@temp0[0] text font 
            (if (paramTotal)
                param1
            )(else
                width
            )
)
        --nsLeft
        --nsTop
        = nsBottom (+ (+ nsTop temp0[2]) 1)
        = nsRight (+ (+ nsLeft temp0[3]) 1)
    )


    (method (showHelp)
        (Print:
            font(gFont)
            width(250)
            addText("Text Menu:\n\n  Text - Change the text\n  Font - Change the font of the text\n  Just - Change justification mode\n  Position - Change the position of the text\n  Menu - Return to the Main Menu\n")
            init()
        )
    )


    (method (editFont)
        (var temp0[25], temp25)
        = temp25 (Print:
                addTitle(@local42)
                font(0)
                width(90)
                addText("Enter new font number:")
                addEdit(@temp0 6 0 24)
                addButton(0 " System " 100 0)
                addButton(gFont "  User  " 100 14)
                addButton(global23 "  Small  " 100 28)
                addButton(global26 "   Big   " 100 42)
                addButton(-1 " Cancel " 100 56)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (<> temp25 -1)
            (self:
                hide()
                font(temp25)
                setSize()
                draw()
            )
        )
    )


    (method (editJust)
        (var temp0[25], temp25)
        = temp0 0
        = temp25 (Print:
                addTitle(@local42)
                font(0)
                width(100)
                addText("Enter justification mode:")
                addButton(1 "   Left   " 100 0)
                addButton(2 " Center " 100 14)
                addButton(3 "  Right  " 100 28)
                addButton(0 " Cancel " 100 42)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (temp25)
            102
            (self:)
        )
    )


    (method (editMsg)
        (if (localproc_22dc(self))
            Memory(3 text)
            = text Memory(1 GetMessage(2 modNum noun verb case seq))
            GetMessage(0 modNum noun verb case seq text)
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editText)
        (switch (localproc_24db(self))
            (case 0
                (return   )
            )
            (case 2
                ((self:editMsg()) return  )
            )
        )
        (if (seq)
            Memory(3 text)
            = text Memory(1 100)
            StrCpy(text "text")
            = noun (= verb (= case (= seq (= modNum 0))))
        )
        (Print:
            addTitle(@local42)
            addText("Enter new text:")
            addEdit(text 50 0 12 text)
            init()
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editWidth)
        (var temp0[25], temp25)
        Format(@temp0 "%d" width)
        = temp25 (Print:
                addTitle(@local42)
                addText("Enter new width:")
                addEdit(@temp0 6 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (temp25)
            (self:
                hide()
                width(temp25)
                setSize()
                draw()
            )
        )
    )

)
(class _DIcon of _DItem
    (properties
        type 4
        state 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
        view 0
        loop 0
        cel 0
    )

    (method (setSize)
        = nsRight (+ nsLeft CelWide(view loop cel))
        = nsBottom (+ nsTop CelHigh(view loop cel))
    )


    (method (showHelp)
        (Print:
            font(gFont)
            width(250)
            addText("Icon Menu:\n\n  View - Change the view of the icon\n  Loop - Change the loop of the icon\n  Cel - Change the cel of the icon\n  Position - Change the position of the icon\n  Menu - Return to the Main Menu\n")
            init()
        )
    )


    (method (editView)
        (var temp0[25], theView)
        Format(@temp0 "%d" view)
        = theView (Print:
                addTitle(@local42)
                addText("Enter new view number:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = theView ReadNumber(@temp0)
        )
        (if (theView)
            = view theView
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editLoop)
        (var temp0[25], theLoop)
        Format(@temp0 "%d" loop)
        = theLoop (Print:
                addTitle(@local42)
                addText("Enter new loop number:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = theLoop ReadNumber(@temp0)
        )
        (if (theLoop)
            = loop theLoop
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editCel)
        (var temp0[25], theCel)
        Format(@temp0 "%d" cel)
        = theCel (Print:
                addTitle(@local42)
                addText("Enter new cel number:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = theCel ReadNumber(@temp0)
        )
        (if (theCel)
            = cel theCel
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )

)
(class _DButton of _DItem
    (properties
        type 1
        state 1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
        text 0
        font 0
        noun 0
        verb 0
        case 0
        seq 0
        modNum 0
    )

    (method (setSize)
        (var temp0[4])
        = temp0[2] (+ temp0[2] TextSize(@temp0[0] text font 0 0))
        = temp0[3] (+ temp0[3] 2)
        = nsBottom (+ nsTop temp0[2])
        = temp0[3] (* (/ (+ temp0[3] 15) 16) 16)
        = nsRight (+ temp0[3] nsLeft)
    )


    (method (showHelp)
        (Print:
            font(gFont)
            width(250)
            addText("Button Menu:\n\n  Text - Change the button text\n  Font - Change the font of the button text\n  Value - Change the return value of the button\n  Position - Change the position of the button\n  Menu - Return to the Main Menu\n")
            init()
        )
    )


    (method (editFont)
        (var temp0[25], temp25)
        = temp25 (Print:
                addTitle(@local42)
                font(0)
                width(90)
                addText("Enter new font number:")
                addEdit(@temp0 6 0 24)
                addButton(0 " System " 100 0)
                addButton(gFont "  User  " 100 14)
                addButton(global23 "  Small  " 100 28)
                addButton(global26 "   Big   " 100 42)
                addButton(-1 " Cancel " 100 56)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (<> temp25 -1)
            (self:
                hide()
                font(temp25)
                setSize()
                draw()
            )
        )
    )


    (method (editMsg)
        (if (localproc_22dc(self))
            Memory(3 text)
            = text Memory(1 GetMessage(2 modNum noun verb case seq))
            GetMessage(0 modNum noun verb case seq text)
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editText)
        (switch (localproc_24db(self))
            (case 0
                (return   )
            )
            (case 2
                ((self:editMsg()) return  )
            )
        )
        (if (seq)
            Memory(3 text)
            = text Memory(1 50)
            StrCpy(text "button")
            = noun (= verb (= case (= seq (= modNum 0))))
        )
        (Print:
            addTitle(@local42)
            addText("Enter new text:")
            addEdit(text 50 0 12 text)
            init()
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )


    (method (editValue)
        (var temp0[25], theValue)
        Format(@temp0 "%d" value)
        = theValue (Print:
                addTitle(@local42)
                addText("Enter new value:")
                addEdit(@temp0 6 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = theValue ReadNumber(@temp0)
        )
        (if (theValue)
            = value theValue
        )
    )

)
(class _DEdit of _DItem
    (properties
        type 3
        state 1
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
        text 0
        font 0
        max 0
        cursor 0
    )

    (method (setSize)
        (var temp0[4])
        TextSize(@temp0[0] "M" font 0 0)
        = nsBottom (+ nsTop temp0[2])
        = nsRight (+ nsLeft (/ (* (* temp0[3] max) 3) 4))
        = cursor StrLen(text)
    )


    (method (showHelp)
        (Print:
            font(gFont)
            width(250)
            addText("Edit Menu:\n\n  Font - Change the font of the edit text\n  Length - Change the maximum length of input\n  Position - Change the position of the edit\n  Text - Change the default edit text\n  Menu - Return to the Main Menu\n")
            init()
        )
    )


    (method (editFont)
        (var temp0[25], temp25)
        = temp25 (Print:
                addTitle(@local42)
                font(0)
                width(90)
                addText("Enter new font number:")
                addEdit(@temp0 6 0 24)
                addButton(0 " System " 100 0)
                addButton(gFont "  User  " 100 14)
                addButton(global23 "  Small  " 100 28)
                addButton(global26 "   Big   " 100 42)
                addButton(-1 " Cancel " 100 56)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (<> temp25 -1)
            (self:
                hide()
                font(temp25)
                setSize()
                draw()
            )
        )
    )


    (method (editLength)
        (var temp0[25], temp25)
        Format(@temp0 "%d" max)
        = temp25 (Print:
                addTitle(@local42)
                addText("Enter new maximum length:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (temp25)
            (self:
                max(temp25)
                hide()
                setSize()
                draw()
            )
        )
    )


    (method (editText)
        (Print:
            addTitle(@local42)
            addText("Enter new default text:")
            addEdit(text 25 0 12 text)
            init()
        )
        (self:
            hide()
            setSize()
            draw()
        )
    )

)
(class _DSelector of _DItem
    (properties
        type 6
        state 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        key 0
        said 0
        value 0
        underBits 0
        font 0
        x 20
        y 6
    )

    (method (setSize)
        (var temp0[4])
        TextSize(@temp0[0] "M" font 0 0)
        = nsBottom (+ (+ nsTop 20) (* temp0[2] y))
        = nsRight (+ nsLeft (/ (* (* temp0[3] x) 3) 4))
    )


    (method (showHelp)
        (Print:
            font(gFont)
            width(250)
            addText("Selector Menu:\n\n  Width - Change the selector width (in chars)\n  Length - Change number of selector lines\n  Position - Change the position of the selector\n  Menu - Return to the Main Menu\n")
            init()
        )
    )


    (method (editLength)
        (var temp0[25], temp25)
        Format(@temp0 "%d" y)
        = temp25 (Print:
                addTitle(@local42)
                addText("Enter new length:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (temp25)
            (self:
                y(temp25)
                hide()
                setSize()
                draw()
            )
        )
    )


    (method (editWidth)
        (var temp0[25], temp25)
        Format(@temp0 "%d" x)
        = temp25 (Print:
                addTitle(@local42)
                addText("Enter new width:")
                addEdit(@temp0 5 0 12 @temp0)
                font(0)
                addButton(0 " Cancel " 0 26)
                init()
            )
        (if (temp0)
            = temp25 ReadNumber(@temp0)
        )
        (if (temp25)
            (self:
                x(temp25)
                hide()
                setSize()
                draw()
            )
        )
    )

)
(class DialogEditor of List
    (properties
        elements 0
        size 0
        state 0
        curItem 0
        curMenu 0
    )

    (method (init)
        = theGSq5Win gSq5Win
        StrCpy(@local42 "DialogEditor  v1.1")
        (send (= gSq5Win SysWindow):
            color(0)
            back(255)
        )
        (send gSQ5:setCursor(999))
        (self:changeState(0))
    )


    (method (doit)
        (var temp0, temp1[100])
        (asm
            pushi   #init
            pushi   0
            self    4
code_14d3:  pushi   #new
            pushi   0
            class   Event
            send    4
            sat     temp0
            pushi   #handleEvent
            pushi   1
            push    
            pToa    curMenu
            send    6
            not     
            bnt     code_14f8
            pushi   1
            lst     temp0
            callk   GlobalToLocal, 2
            pushi   #handleEvent
            pushi   1
            lst     temp0
            self    6
            bt      code_1501
code_14f8:  pushi   #dispose
            pushi   0
            lat     temp0
            send    4
            jmp     code_14d3
code_1501:  pushi   #dispose
            pushi   0
            lat     temp0
            send    4
            pushi   #dispose
            pushi   0
            self    4
            ret     
        )
    )


    (method (dispose)
        (mainMenu:dispose())
        (DlgWindow:dispose())
        = gSq5Win theGSq5Win
        (send gSQ5:setCursor((send ((send gSq5IconBar:curIcon)):cursor)))
        DrawStatus(" " 0 0)
        DrawStatus(0)
        (super:dispose())
        DrawPic((send gRoom:picture) 100)
        DisposeScript(111)
    )


    (method (handleEvent pEvent)
        (var temp0, theCurItem, temp2[506], temp508[30], temp538[30], temp568[30], temp598[30], temp628[30], temp658[20], temp678[30], temp708[30], temp738[20], temp758[30], temp788[30])
        (switch ((send pEvent:type))
            (case 0
                ( )
            )
            (case 1
                (
                (if (= theCurItem (self:firstTrue(180 pEvent)))
                    (send pEvent:claimed(1))
                    (if (== (send pEvent:modifiers) 3)
                        (send theCurItem:handleEvent(pEvent))
                    )(else
                        (if (curItem)
                            (send curItem:select(0))
                        )
                        (send (= curItem theCurItem):select(1))
                        (self:changeState(0))
                    )
                )
 )
            )
            (case 2
                ( )
            )
            (case 4
                (
                (switch ((send pEvent:message))
                    (case 63
                        ((send pEvent:message(104))  )
                    )
                    (case 19
                        ((send pEvent:message(120)) )
                    )
                )
 
                (switch ((send pEvent:message))
                    (case 9
                        ((send curItem:select(0)) = temp0 (DialogEditor:indexOf(curItem)) 
                        (if (== ++temp0 (DialogEditor:size))
                            = curItem (DialogEditor:at(0))
                        )(else
                            = curItem (DialogEditor:at(temp0))
                        )
 (send curItem:select(1)) (DialogEditor:changeState(0))  )
                    )
                    (case 3840
                        ((send curItem:select(0)) 
                        (if (== (= temp0 (DialogEditor:indexOf(curItem))) 0)
                            = curItem (DialogEditor:at((- (DialogEditor:size) 1)))
                        )(else
                            = curItem (DialogEditor:at(--temp0))
                        )
 )
                    )
                    (case 32
                        ( )
                    )
                    (case 8
                        ( )
                    )
                    (case 97
                        ((Print:
                            addTitle(@local42)
                            mode(1)
                            width(140)
                            addText("by Brian K. Hughes\n17 July, 1992")
                            init()
                        )
  )
                    )
                    (case 99
                        (
                        (switch (state)
                            (case 4
                                ((send curItem:editCel())  )
                            )
                            (case 6
                                (
                                (if (size)
                                    (DlgWindow:create())
                                )(else
                                    proc921_0("Can't create window: no items!")
                                )
 )
                            )
                        )
  )
                    )
                    (case 100
                        (
                        (switch (state)
                            (case 0
                                ((self:delItem())  )
                            )
                            (case 6
                                (
                                (if (local1)
                                    (DlgWindow:dispose())
                                    (self:eachElementDo(80))
                                )(else
                                    proc921_0("No window to delete!")
                                )
 )
                            )
                        )
  )
                    )
                    (case 101
                        (
                        (if (size)
                            144
                            (self:x)
                        )(else
                            proc921_0("No items to edit!")
                        )
 )
                    )
                    (case 102
                        (
                        (if (proc999_5(state 2 1 3))
                            (send curItem:editFont())
                        )
 )
                    )
                    (case 104
                        (
                        (switch (state)
                            (case 0
                                ((Print:
                                    font(gFont)
                                    width(250)
                                    addText("Main Menu:\n\n  About - About the DialogEditor\n  Item - Create a new item\n  Edit - Edit properties of the current item\n  Look - View properties of the current item\n  Del - Delete the current item\n  Win - Create a window background\n  Help - You're here!\n  eXit - Exit the DialogEditor (& maybe save)\n")
                                    init()
                                )
  )
                            )
                            (case 6
                                ((Print:
                                    font(gFont)
                                    width(250)
                                    addText("Window Menu:\n\n  Create - Draw the window to the correct size\n  Position - Move the window and all items\n  Delete - Remove the window\n  Menu - Return to the Main Menu")
                                    init()
                                )
  )
                            )
                            (default 
                                ((send curItem:showHelp()) )
                            )
                        )
  )
                    )
                    (case 105
                        (= theCurItem 0 
                        (switch ((Print:
                            addTitle(@local42)
                            width(65)
                            addText("Select the kind of item you want to add to the dialog:")
                            font(0)
                            addButton(1 "  Button  " 80 0)
                            addButton(2 "   Text   " 80 14)
                            addButton(3 "   Edit   " 80 28)
                            addButton(4 "   Icon   " 80 42)
                            addButton(6 " Selector " 80 56)
                            addButton(0 "  Cancel  " 80 70)
                            init()
                        )
)
                            (case 1
                                (StrCpy(= temp0 Memory(1 50) "button") = theCurItem (send ((_DButton:new())):
                                        text(temp0)
                                        yourself()
                                    )
  )
                            )
                            (case 2
                                (StrCpy(= temp0 Memory(1 100) "text") = theCurItem (send ((_DText:new())):
                                        text(temp0)
                                        yourself()
                                    )
  )
                            )
                            (case 3
                                (StrCpy(= temp0 Memory(1 50) "LOOKUP_ERROR") = theCurItem (send ((_DEdit:new())):
                                        text(temp0)
                                        max(5)
                                        yourself()
                                    )
  )
                            )
                            (case 4
                                (= theCurItem (send ((_DIcon:new())):
                                        view(0)
                                        loop(0)
                                        cel(0)
                                        yourself()
                                    )
  )
                            )
                            (case 6
                                (= theCurItem (send ((_DSelector:new())):
                                        x(10)
                                        y(1)
                                        yourself()
                                    )
 )
                            )
                        )
 
                        (if (theCurItem)
                            (if (curItem)
                                (send curItem:select(0))
                            )
                            = curItem theCurItem
                            (if (local1)
                                (DlgWindow:dispose())
                            )
                            (self:
                                addToEnd((send curItem:
                                        setSize()
                                        moveTo(4 4)
                                        yourself()
                                    )
)
                                eachElementDo(80)
                            )
                            (send curItem:select(1))
                        )
 )
                    )
                    (case 106
                        (
                        (if (== state 2)
                            (send curItem:editJust())
                        )
 )
                    )
                    (case 108
                        (
                        (switch (state)
                            (case 0
                                (
                                (if (curItem)
                                    Format(@temp508 "  x:       %d" (send curItem:nsLeft))
                                    Format(@temp538 "  y:       %d" (send curItem:nsTop))
                                    (switch ((send curItem:{-super-}))
                                        (case _DText
                                            StrCpy(@temp788 "Text Item")
                                            StrCpy(@temp2 (send curItem:text))
                                            Format(@temp568 "  text:   %s" localproc_229e(@temp2 15))
                                            Format(@temp598 "  font:   %d" (send curItem:font))
                                            Format(@temp628 "  width:  %d" (send curItem:width))
                                            Format(@temp658 "  noun:   %d" (send curItem:noun))
                                            Format(@temp678 "  verb:   %d" (send curItem:verb))
                                            Format(@temp708 "  case:   %d" (send curItem:case))
                                            Format(@temp738 "  seq:    %d" (send curItem:seq))
                                            Format(@temp758 "  modNum: %d" (send curItem:modNum))
                                        )
                                        (case _DButton
                                            StrCpy(@temp788 "Button Item")
                                            StrCpy(@temp2 (send curItem:text))
                                            Format(@temp568 "  text:   %s" localproc_229e(@temp2 15))
                                            Format(@temp598 "  font:   %d" (send curItem:font))
                                            Format(@temp628 "  value:  %d" (send curItem:value))
                                            Format(@temp658 "  noun:   %d" (send curItem:noun))
                                            Format(@temp678 "  verb:   %d" (send curItem:verb))
                                            Format(@temp708 "  case:   %d" (send curItem:case))
                                            Format(@temp738 "  seq:    %d" (send curItem:seq))
                                            Format(@temp758 "  modNum: %d" (send curItem:modNum))
                                        )
                                        (case _DIcon
                                            StrCpy(@temp788 "Icon Item")
                                            Format(@temp568 "  view:   %d" (send curItem:view))
                                            Format(@temp598 "  loop:   %d" (send curItem:loop))
                                            Format(@temp628 "  cel:    %d" (send curItem:cel))
                                            = temp658 (= temp678 (= temp708 (= temp738 (= temp758 0))))
                                        )
                                        (case _DEdit
                                            StrCpy(@temp788 "Edit Item")
                                            StrCpy(@temp2 (send curItem:text))
                                            Format(@temp568 "  text:   %s" localproc_229e(@temp2 15))
                                            Format(@temp598 "  font:   %d" (send curItem:font))
                                            Format(@temp628 "  max:    %d" (send curItem:max))
                                            = temp658 (= temp678 (= temp708 (= temp738 (= temp758 0))))
                                        )
                                        (case _DSelector
                                            StrCpy(@temp788 "Selector Item")
                                            Format(@temp568 "  width:  %d" (send curItem:x))
                                            Format(@temp598 "  length: %d" (send curItem:y))
                                            = temp628 (= temp658 (= temp678 (= temp708 (= temp738 (= temp758 0)))))
                                        )
                                    )
                                    (Print:
                                        addTitle(@temp788)
                                        addText(@temp508)
                                        addText(@temp538 0 12)
                                        addText(@temp568 0 24)
                                        addText(@temp598 0 36)
                                        addText(@temp628 0 48)
                                        addText(@temp658 0 60)
                                        addText(@temp678 0 72)
                                        addText(@temp708 0 84)
                                        addText(@temp738 0 96)
                                        addText(@temp758 0 108)
                                        init()
                                    )
                                    (if (local1)
                                        (DlgWindow:create())
                                    )
                                )(else
                                    proc921_0("No item to look at!")
                                )
 )
                            )
                            (case 4
                                ((send curItem:editLoop())  )
                            )
                            (case 3
                                ((send curItem:editLength())  )
                            )
                            (case 5
                                ((send curItem:editLength()) )
                            )
                        )
  )
                    )
                    (case 109
                        ((self:changeState(0))  )
                    )
                    (case 112
                        (
                        (switch (state)
                            (case 6
                                ((DlgWindow:editPosn())  )
                            )
                            (default 
                                ((send curItem:editPosn()) )
                            )
                        )
  )
                    )
                    (case 116
                        (
                        (switch (state)
                            (case 6
                                ((DlgWindow:editTitle())  )
                            )
                            (default 
                                ((send curItem:editText()) )
                            )
                        )
  )
                    )
                    (case 118
                        (
                        (switch (state)
                            (case 4
                                ((send curItem:editView())  )
                            )
                            (case 1
                                ((send curItem:editValue()) )
                            )
                        )
  )
                    )
                    (case 119
                        (
                        (switch (state)
                            (case 0
                                ((self:changeState(6))  )
                            )
                            (case 5
                                ((send curItem:editWidth())  )
                            )
                            (case 2
                                ((send curItem:editWidth()) )
                            )
                        )
  )
                    )
                    (case 120
                        (return (self:exit()) )
                    )
                )
 )
            )
        )
        return 0
    )


    (method (delItem)
        (var temp0[45])
        (if (size)
            (if ((Print:
                addText("Delete current item?")
                font(0)
                addButton(1 "Yes" 0 12)
                addButton(0 "No" 40 12)
                init()
            )
)
                (self:delete(curItem))
                (send curItem:dispose())
                = curItem 0
                (if (size)
                    = curItem (self:at(0))
                )
            )
        )(else
            proc921_0("Nothing to delete!")
        )
    )


    (method (exit)
        (var temp0[100], temp100, newFile, temp102)
        (if (not local1)
            (DlgWindow:create())
        )
        (if (not local2)
            Format(@local2 "%d.dlg" gModNum)
        )
        (if (not = temp100 (Print:
                addTitle(@local42)
                addText("Save to: ")
                addEdit(@local2 25 60 0 @local2)
                font(0)
                addButton(1 "  Save  " 10 12)
                addButton(2 " Abandon " 80 12)
                addButton(0 " Cancel " 151 12)
                init()
            )
)
            return 0
        )
        (if (== temp100 2)
            return 1
        )
        (if (FileIO(10 @local2))
            Format(@temp0 "The file '%s' already exists.  Now what?" @local2)
            (if (not = temp100 (Print:
                    addTitle(@local42)
                    addText(@temp0)
                    font(0)
                    addButton(1 " Replace " 0 24)
                    addButton(2 " Append " 70 24)
                    addButton(0 " Cancel " 125 24)
                    init()
                )
)
                return 0
            )
        )
        = temp102 
            (if (== temp100 1)
                2
            )(else
                0
            )
        (if (not (send (= newFile (File:new())):
            name(@local2)
            open(temp102)
        )
)
            proc921_1("Error opening '%s'" (send newFile:name))
            (send newFile:dispose())
            return 0
        )
        (send newFile:
            writeString("\t\t; DialogEditor v1.0
\n")
            writeString("\t\t; by Brian K. Hughes
\n")
            writeString("\t\t(Print
\n")
        )
        (if (local1)
            Format(@temp0 "\t\t\tposn:\t\t\t%d %d,
\n" (DlgWindow:left) (DlgWindow:top))
            (send newFile:writeString(@temp0))
            (if ((DlgWindow:title))
                (if ((DlgWindow:seq))
                    Format(@temp0 "\t\t\taddTitle:\t%d %d %d %d %d,
\n" (DlgWindow:noun) (DlgWindow:verb) (DlgWindow:case) (DlgWindow:seq) (DlgWindow:modNum))
                )(else
                    Format(@temp0 "\t\t\taddTitle:\t{%s},
\n" (DlgWindow:title))
                )
                (send newFile:writeString(@temp0))
            )
        )
        (self:writeFile(newFile))
        (if ((Print:
            addTitle(@local42)
            addText("This dialog should be...")
            font(0)
            addButton(0 "   Modal   " 0 24)
            addButton(1 " Modeless " 0 38)
            init()
        )
)
            (send newFile:writeString("\t\t\tmodeless:\tTRUE,
\n"))
        )
        (send newFile:
            writeString("\t\t\tinit:
\n")
            writeString("\t\t)
\n")
        )
        (send newFile:dispose())
        return 1
    )


    (method (writeFile param1)
        (var temp0, temp1, temp2[100], temp102, temp103, temp104)
        (asm
            ldi     65535
            sat     temp102
            ldi     0
            sat     temp103
            ldi     0
            sat     temp104
            ldi     0
            sat     temp0
code_1eed:  lst     temp0
            pToa    size
            lt?     
            bnt     code_229d
            pushi   #at
            pushi   1
            lst     temp0
            self    6
            sat     temp1
            pushi   #{-super-}
            pushi   0
            send    4
            push    
            dup     
            class   _DButton
            eq?     
            bnt     code_2012
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            push    
            lat     temp102
            ne?     
            bnt     code_1f3e
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            sat     temp102
            pushi   3
            lea     @temp2
            push    
            lofsa   "\t\t\tfont:\t\t\t%d,
\n"
            push    
            lst     temp102
            callk   Format, 6
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
code_1f3e:  pushi   #seq
            pushi   0
            lat     temp1
            send    4
            bnt     code_1fba
            pushi   10
            lea     @temp2
            push    
            lofsa   "\t\t\taddButton:\t%d %d %d %d %d %d %d %d, 
\n"
            push    
            pushi   #value
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #noun
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #verb
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #case
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #seq
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #modNum
            pushi   0
            lat     temp1
            send    4
            push    
            callk   Format, 20
            jmp     code_2003
code_1fba:  pushi   6
            lea     @temp2
            push    
            lofsa   "\t\t\taddButton:\t%d {%s} %d %d,
\n"
            push    
            pushi   #value
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #text
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            callk   Format, 12
code_2003:  pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
            jmp     code_2297
code_2012:  dup     
            class   _DText
            eq?     
            bnt     code_219d
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            push    
            lat     temp102
            ne?     
            bnt     code_204b
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            sat     temp102
            pushi   3
            lea     @temp2
            push    
            lofsa   "\t\t\tfont:\t\t\t%d,
\n"
            push    
            lst     temp102
            callk   Format, 6
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
code_204b:  pushi   #mode
            pushi   0
            lat     temp1
            send    4
            push    
            lat     temp103
            ne?     
            bnt     code_20a7
            pushi   #mode
            pushi   0
            lat     temp1
            send    4
            sat     temp103
            pushi   3
            lea     @temp2
            push    
            lofsa   "\t\t\tmode:\t\t\t%s,
\n"
            push    
            pushi   #mode
            pushi   0
            lat     temp1
            send    4
            push    
            dup     
            ldi     0
            eq?     
            bnt     code_2080
            lofsa   "teJustLeft"
            jmp     code_2096
code_2080:  dup     
            ldi     65535
            eq?     
            bnt     code_208d
            lofsa   "teJustRight"
            jmp     code_2096
code_208d:  dup     
            ldi     1
            eq?     
            bnt     code_2096
            lofsa   "teJustCenter"
code_2096:  toss    
            push    
            callk   Format, 6
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
code_20a7:  pushi   #width
            pushi   0
            lat     temp1
            send    4
            push    
            lat     temp104
            ne?     
            bnt     code_20d9
            pushi   #width
            pushi   0
            lat     temp1
            send    4
            sat     temp104
            pushi   3
            lea     @temp2
            push    
            lofsa   "\t\t\twidth:\t\t%d, 
\n"
            push    
            lst     temp104
            callk   Format, 6
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
code_20d9:  pushi   #seq
            pushi   0
            lat     temp1
            send    4
            bnt     code_214d
            pushi   9
            lea     @temp2
            push    
            lofsa   "\t\t\taddText:\t\t%d %d %d %d %d %d %d, 
\n"
            push    
            pushi   #noun
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #verb
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #case
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #seq
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #modNum
            pushi   0
            lat     temp1
            send    4
            push    
            callk   Format, 18
            jmp     code_218e
code_214d:  pushi   5
            lea     @temp2
            push    
            lofsa   "\t\t\taddText:\t\t{%s} %d %d,
\n"
            push    
            pushi   #text
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            callk   Format, 10
code_218e:  pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
            jmp     code_2297
code_219d:  dup     
            class   _DEdit
            eq?     
            bnt     code_222e
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            push    
            lat     temp102
            ne?     
            bnt     code_21d6
            pushi   #font
            pushi   0
            lat     temp1
            send    4
            sat     temp102
            pushi   3
            lea     @temp2
            push    
            lofsa   "\t\t\tfont:\t\t\t%d,
\n"
            push    
            lst     temp102
            callk   Format, 6
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
code_21d6:  pushi   6
            lea     @temp2
            push    
            lofsa   "\t\t\taddEdit:\t\t@str %d %d %d {%s},
\n"
            push    
            pushi   #max
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #text
            pushi   0
            lat     temp1
            send    4
            push    
            callk   Format, 12
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
            jmp     code_2297
code_222e:  dup     
            class   _DIcon
            eq?     
            bnt     code_2293
            pushi   7
            lea     @temp2
            push    
            lofsa   "\t\t\taddIcon:\t\t%d %d %d %d %d,
\n"
            push    
            pushi   #view
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #loop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #cel
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #nsLeft
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #left
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            pushi   #nsTop
            pushi   0
            lat     temp1
            send    4
            push    
            pushi   #top
            pushi   0
            class   DlgWindow
            send    4
            sub     
            push    
            ldi     4
            sub     
            push    
            callk   Format, 14
            pushi   #writeString
            pushi   1
            lea     @temp2
            push    
            lap     param1
            send    6
            jmp     code_2297
code_2293:  dup     
            class   _DSelector
            eq?     
code_2297:  toss    
            +at     temp0
            jmp     code_1eed
code_229d:  ret     
        )
    )


    (method (changeState newState)
        (if (curMenu)
            (send curMenu:dispose())
        )
        = curMenu 
            (switch ((= state newState))
                (case 0
                    (mainMenu  )
                )
                (case 1
                    (editBMenu  )
                )
                (case 2
                    (editTMenu  )
                )
                (case 3
                    (editEMenu  )
                )
                (case 4
                    (editIMenu  )
                )
                (case 5
                    (editSMenu  )
                )
                (case 6
                    (editWMenu  )
                )
                (default 
                    (0 )
                )
            )
        (if (curMenu)
            (send curMenu:init())
        )
    )

)
