'
' map activity over an amiage
'
Sub MapImage(PicNo As Int)
If StartX > IV(PicNo).Left AND StartX < (IV(PicNo).Left + IV(PicNo).Width) AND StartY > IV(PicNo).Top AND StartY < (IV(PicNo).Top + IV(PicNo).Height) Then
If ((Page * 9) + 0) >= PicList.Size Then Return
Dim pic As Pics = PicList.Get((Page * 9) + PicNo)
Path = pic.Path & "/" & pic.FName
TitleBar("Page " & Page & " of " & Pages)
#If debug
Log("IV(" & (PicNo + 1) & ")")
#End If
If pic.Checked Then
pic.Checked = False
Else
pic.Checked = True
End If
PicList.Set((Page * 9) + PicNo,pic)
CB(PicNo).Checked = pic.Checked
BTNClearAll.Enabled = True
BTNSelectAll.Enabled = True
End If
End Sub
'
' This takes care of the swipe and click actions over the panel
'
Sub PAN1_Touch (Action As Int, X As Float, Y As Float)
Dim DifX As Float
Dim DifY As Float
Select Action
Case PAN1.ACTION_DOWN
#If debug
Log("Down")
#End If
StartX = X
StartY = Y
Case PAN1.ACTION_MOVE
' we don't care for now
Case PAN1.ACTION_UP
DifX = X - StartX
DifY = Y - StartY
#If debug
Log("Up")
#End If
' we are only concerned with left-right swipes, and clicks
' we will require 1/6 of screen for valid swipe
' mouse click should not have more than 10 pixs movement
If Abs(DifX) > (PAN1.Width / 6) Then
#If debug
Log("good swipe x:" & DifX & " y:" & DifY)
#End If
If DifX > 0 Then
' swipe left
Page = Page - 1
If Page < 0 Then Page = 0
Else
'swipe right
Page = Page + 1
If Page > Pages Then Page = Pages
End If
RedrawPage
Else If Abs(DifX) < (PAN1.Width / 10) AND Abs(DifY) < (PAN1.Height / 10) Then
' we will just see this as a region click
#If debug
Log("click x:" & StartX & " y:" & StartY)
#End If
'lets map the pics
Dim a As Int
For a = 0 To MaxPics - 1
MapImage(a)
Next
End If
End Select
Return
End Sub
Sub SetupView
Dim width As Int = (PAN1.width / 3)
Dim height As Int = (PAN1.height / 3)
Dim a As Int
Dim r As Int = 0
Dim c As Int = 0
For a=0 To MaxPics - 1
If IV(a).IsInitialized = False Then
' if the object is NOT intalized, we also need to add it to the view
IV(a).Initialize("")
PAN1.AddView(IV(a),0,0,0,0) ' no values here, as we need to scale the object first
Scale.ScaleViewDS(IV(a))
End If
IV(a).Top = r * (height)
IV(a).Left = c * (width)
IV(a).width = width
IV(a).height = height
If CB(a).IsInitialized = False Then
' if the object is NOT intalized, we also need to add it to the view
CB(a).Initialize("")
PAN1.AddView(CB(a),0,0,0,0) ' no values here, as we need to scale the object first
Scale.ScaleViewDS(CB(a))
End If
CB(a).Top = r * (height)
CB(a).Left = c * (width)
CB(a).width = width
CB(a).height = height
c = c + 1
If c = 3 Then
c = 0
r = r + 1
End If
Next
End Sub