BrowseHBVariants Script

Build 1501 on 14/Nov/2017  This topic last edited on: 9/May/2012, at 13:02

Description

Browses various head-body variants (incomplete).

Syntax

BrowseHBVariants(iDir, iMode)

iDir

1=next, -1=previous

iMode

1=head position, 2=picture position

Code

Public Sub BrowseHBVariants(ByVal iDir, ByVal iMode)

    ' iDir = 1 > next; -1 > previous

    ' iMode = 1: head position

    ' iMode = 2: picture position

    ' browse hardcoded variants for SplitHB

    If Page.GetSelectionCount = 0 Then Exit Sub ' if no selection, nothing to browse

    ' get data of current s        election

    Dim aO = PushSelectionEx()

    FredApp.DisableDraw = True

    Dim idxHead = GetObjTypeProp(headname, aO, 0) ' aO idx of the first head frame

    Dim nHead = GetObjTypeProp(headname, aO, 6)

    Dim wHead = GetObjTypeProp(headname, aO, 2)

    Dim hHead = GetObjTypeProp(headname, aO, 1)

 

    Dim idxBody = GetObjTypeProp(bodyname, aO, 0) ' aO idx of the first body frame

    Dim nbody = GetObjTypeProp(bodyname, aO, 6)

    Dim wbody = GetObjTypeProp(bodyname, aO, 2)

    Dim hBody = GetObjTypeProp(bodyname, aO, 1)

    Dim nColBody = GetObjTypeProp(bodyname, aO, 4)

    Dim gBody = CInt(GetObjTypeProp(bodyname, aO, 5))

    Dim idxHighestBody = GetObjTypeProp(bodyname, aO, 7)

    Dim idxTopMostBody = GetObjTypeProp(bodyname, aO, 8)

 

    Dim nImg = GetObjTypeProp(photoname, aO, 6)

    Dim wImg = GetObjTypeProp(photoname, aO, 2)

    Dim hImg = GetObjTypeProp(photoname, aO, 1)

    Dim nColImg = GetObjTypeProp(photoname, aO, 4)

    Dim idxColImg = GetColIdxHB(photoname, -POK.oBitmap, aO, 1)

    ' add here recognizing of the current variant

 

    Select Case iMode

      Case 1

        ' vary position of head:

        ' default : tophead, above body, entire width

        ' var1: inside head: on central columns, 

        Dim minCol As Short = 3

        ' check the current position

        If aO(idxHead, 1) = aO(idxBody, 1) And aO(idxHead, 2) + aO(idxHead, 4) <= aO(idxTopMostBody, 2) Then

          ' now, it is a top head, let's vary it as the inside head

          If nColBody >= minCol Then

            Page.ObjSelectId(aO(idxHead, 0), False)

            Page.ObjSetHW(-1, aO(idxBody, 3) * (nColBody - minCol + 1) + gBody * (nColBody - minCol)) 'make it wide as body column

            ObjMoveTo(aO(idxBody + 1, 1), aO(idxBody, 2))

            EngraveIt(0, 0, 0, GetVG, True)

            PopSelection(aO) ' reselect all, before moving up

            Page.ObjMove(0, -(aO(idxBody, 2) - aO(idxHead, 2)))

          End If

        ElseIf aO(idxHead, 2) = aO(idxTopMostBody, 2) Then

          'it is already an insidehead, revert to tophead

          Page.ObjSelectId(aO(idxHead, 0), False)

          Page.ObjSetHW(-1, aO(0, 13)) 'make it wide as all body 

          ObjMoveTo(aO(idxBody, 1), aO(idxBody, 2) - aO(idxHead, 4) - Units.ToVal(SystemUserOptions.AFCS_BodyDistHead))

          Dim elem As ElementProp = Page.SelElement()

          elem.DE_Active = False

          PopSelection(aO) ' reselect all, before moving down

          Page.ObjMove(0, (aO(idxHead, 4) + Units.ToVal(SystemUserOptions.AFCS_BodyDistHead)))

        Else

          MsgBox(My.Resources.IDS_HeadToggle, vbExclamation, m_Label) ' Fred cannot vary the position of the headline as it it appears neither top head nor inside head

        End If

      Case 2

 

    End Select

    ' variants of unlinked shapes with same x/y over same w/h

    ' 1-head and body

    ' 2-

    ' ANALYZE

    ' spec cases: 3-nwc,p31

    ' pictures: 2pics over black background with white border (3-nwc,p53)

    ' 6 column shapes

    ' 2-deck head over 3 narrower, picture left, caption TLangle (3-nwc,p16)

    ' central 2deck head over 2-5, 1 and 6 full height, no pic (4-nwp,p9)

    ' 1-dec head over 4, picture in first 2, no capt (4-nwp,p11)

    ' 2-deck head over 5, 1col full height, picture over central 2 columns, no caption (4-nwc,p14)

    ' example with subhead, 4-nwp,p53

 

    ' 4-columns shapes

    ' Head over 2, picture over 2, not entire height, caption on picture (4-nwp, p10)

    ' head over 4, 1 pic in first col bottom, 2nd pic in right, 3 narrower cols of body

    ' head over 3, 1 pic with caption in rightmost col, 3 narrower cols of body

    ' 2-deck head over central 2, body 1 and 4 full height  (5wh-p2)

    ' 1-deck head over 4, pic in first col no capt, body remaining 3cols (5wh-p2)

    ' 3-deck head over 4, single body col over 2, pic over 2 on right, caption below (5wh,p3)

 

    ' 3-column shapes

    ' Head over 2, picture over 1, entire height, no caption

    ' head over 3, two pictures on top, captions on pictures or under (3-nwc,p18)

    ' head over 3, picture over 2, caption on picture

    ' 2deck head over 3, picture on bottom over first 2, no caption (4-nwp, p14)

    ' 3-deck head over 3, byline as middle intro, no pic

    ' head over 3 over top picture, all in black border/background, text on white background (3-nwc,p17)

    ' 3 deck head over 3, first columm overlaps, picture 2.5col bottom, caption under (3-nwc p15)

    ' 2-deck head over 2 and 3, first body col full height, (4-nwp,p7)

    ' 2-deck head over 3, picture between head and body full width (4-nwp, p17)

    ' 3 deck head over 1, on right 2 body cols (5-wh, p3)

 

    ' 2-column shapes

    ' head over 2, picture on top, caption below

    ' head over 2, picture or 2 in right col

    ' head over 2, picture in the middle, no caption

    ' head over 2, picture left over 1.4, entire height, caption

    ' 2-deck head over 2, picture bottom, caption 2 lines (3-nwc,p24)

    ' 1-deck head, picture over 2 between head and body, caption narrow on right (4-nwp,p3) 

    ' 1-column shapes

    ' head over 1, picture on top over 1, with or without caption

    ' head over 1, picture right over 1, boxed separately

    ' head over 1, picture bottom, on background

    ' 2deck head over 1, 2,5col picture right, caption over picture

    FredApp.DisableDraw = False

 

    '    PopSelection(aO)

 

  End Sub