;Flash LipSync, created by J. Baker, http://www.flashpulse.com/ 2005

;Source may be edited as long as it remains freeware and credits are given to

;those who contribute to it in the "About" window.

 

;Compiled with PureBasic 4.0 beta 9  

   

   LoadImage(0, "images\A.bmp")

   LoadImage(1, "images\B.bmp")

   LoadImage(2, "images\C.bmp")

   LoadImage(3, "images\E.bmp")

   LoadImage(4, "images\F.bmp")

   LoadImage(5, "images\L.bmp")

   LoadImage(6, "images\O.bmp")

   LoadImage(7, "images\Q.bmp")

   LoadImage(8, "images\R.bmp")

   LoadImage(9, "images\S.bmp")

   

   LoadImage(10, "images\A.ico")

   LoadImage(11, "images\B.ico")

   LoadImage(12, "images\C.ico")

   LoadImage(13, "images\E.ico")

   LoadImage(14, "images\F.ico")

   LoadImage(15, "images\L.ico")

   LoadImage(16, "images\O.ico")

   LoadImage(17, "images\Q.ico")

   LoadImage(18, "images\R.ico")

   LoadImage(19, "images\S.ico")

   

   LoadImage(20, "images\about.bmp")

   

 

Procedure About()

 

  If OpenWindow(1, 0, 0, 320, 115,"About - Flash LipSync", #PB_Window_SystemMenu | #PB_Window_WindowCentered, WindowID(0))

   CreateGadgetList(WindowID(1))

   

   EnableWindow_(WindowID(0), #False) ;disable main window from closing

   

    ImageGadget(500, 5, 5, 80, 80, ImageID(20), #PB_Image_Border)

      

     LoadFont(501,"Arial", 10, #PB_Font_Bold | #PB_Font_Underline)

     

      TextGadget(502, 115, 5, 200, 20, "Flash LipSync v1.02", #PB_Text_Center)

      

       ;SetGadgetFont(502, FontID(1))

      

      TextGadget(503, 115, 25, 200, 30, "Created By:  J. Baker", #PB_Text_Center)

      

     HyperLinkGadget(504, 167, 40, 200, 20, "www.flashpulse.com", RGB(0,0,255))

   

    TextGadget(505, 115, 60, 200, 30, "ActionScript By:  Remus Marinescu", #PB_Text_Center)

      

   HyperLinkGadget(506, 157, 75, 200, 20, "www.necromanthus.com", RGB(0,0,255))

   

   TextGadget(507, 190, 95, 200, 30, Chr(169) + Chr(32) + "2005")

        

  EndIf

EndProcedure

 

 ;UseJPEGImageDecoder()

 ;UsePNGImageDecoder()

 

;---

;----------Window & Gadgets----------

;---

 

 InitMovie()

 

 LoadFont(508,"Arial", 12)

 

If OpenWindow(0, 0, 0, 530, 260,"Flash LipSync", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))

 

;---       Menu

      

      CreateMenu(0, WindowID(0))

      MenuTitle("File")

        MenuItem(1, "New               Ctrl+N")

        MenuItem(2, "Open...         Ctrl+O")

        MenuItem(3, "Save              Ctrl+S")

        MenuItem(4, "Save As...")

        SetMenuItemState(0, 4, 0)

       MenuBar()

        MenuItem(5, "Load Audio...")

       MenuBar()

        MenuItem(6, "Export Script...")

       MenuBar()                 

        MenuItem(7, "Exit                 Esc")

      MenuTitle("Shapes")

        MenuItem(8, "Load Images...")

        MenuItem(9, "Default Images")

      MenuTitle("Help")

        MenuItem(10, "Help...      F1")

        MenuItem(12, "About...")

        

        

;---       Preview

        

   ImageID(0)

   ImageGadget(0, 10, 20, 160, 160, ImageID(0), #PB_Image_Border)

   

;---       Sequencer

   

   ListIconGadget(1, 189, 20, 156, 165,"#",35, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)

    AddGadgetColumn(1, 1, "Image", 50)

    AddGadgetColumn(1, 2, "Delay", 50)

For frameNumbersA = 1 To 25

    AddGadgetItem(1,-1,Str(frameNumbersA))

Next

 

;---       Shapes   

   

   ListIconGadget(2, 361, 20, 95, 210, "",110, #PB_ListIcon_MultiSelect)

    ChangeListIconGadgetDisplay(2, 0)

    AddGadgetItem(2,-1,"Closed",ImageID(12))

    AddGadgetItem(2,-1,"CH",ImageID(19))

    AddGadgetItem(2,-1,"SH",ImageID(19))

    AddGadgetItem(2,-1,"TH",ImageID(15))

    AddGadgetItem(2,-1,"A",ImageID(10))

    AddGadgetItem(2,-1,"B",ImageID(11))

    AddGadgetItem(2,-1,"C",ImageID(18))

    AddGadgetItem(2,-1,"D",ImageID(19))

    AddGadgetItem(2,-1,"E",ImageID(13))

    AddGadgetItem(2,-1,"F",ImageID(14))

    AddGadgetItem(2,-1,"G",ImageID(18))

    AddGadgetItem(2,-1,"H",ImageID(18))

    AddGadgetItem(2,-1,"I",ImageID(10))

    AddGadgetItem(2,-1,"J",ImageID(19))

    AddGadgetItem(2,-1,"K",ImageID(18))

    AddGadgetItem(2,-1,"L",ImageID(15))

    AddGadgetItem(2,-1,"M",ImageID(11))

    AddGadgetItem(2,-1,"N",ImageID(19))

    AddGadgetItem(2,-1,"O",ImageID(16))

    AddGadgetItem(2,-1,"P",ImageID(11))

    AddGadgetItem(2,-1,"Q",ImageID(17))

    AddGadgetItem(2,-1,"R",ImageID(18))

    AddGadgetItem(2,-1,"S",ImageID(19))

    AddGadgetItem(2,-1,"T",ImageID(19))

    AddGadgetItem(2,-1,"U",ImageID(17))

    AddGadgetItem(2,-1,"V",ImageID(14))

    AddGadgetItem(2,-1,"W",ImageID(17))

    AddGadgetItem(2,-1,"X",ImageID(18))

    AddGadgetItem(2,-1,"Y",ImageID(17))

    AddGadgetItem(2,-1,"Z",ImageID(19))

    

;---       Play

     

   ButtonGadget(3, 25, 206, 50, 25, "Play")

   

;---       FPS   

   

   TextGadget(4, 90, 212, 30, 20, "FPS:")

      

      ComboBoxGadget(5, 118, 208, 40, 150)

      For combo = 12 To 30 : AddGadgetItem(5,-1,Str(combo)) : Next

      SetGadgetState(5,18)

 

;---       Delays      

      

   ButtonGadget(6, 465, 24, 25, 25, "1")

   ButtonGadget(7, 490, 24, 25, 25, "2")

   ButtonGadget(8, 465, 49, 25, 25, "3")

   ButtonGadget(9, 490, 49, 25, 25, "4")

   ButtonGadget(10, 465, 74, 25, 25, "5")

   ButtonGadget(11, 490, 74, 25, 25, "6")

   ButtonGadget(12, 465, 99, 25, 25, "7")

   ButtonGadget(13, 490, 99, 25, 25, "8")

   ButtonGadget(14, 465, 124, 25, 25, "9")

   ButtonGadget(15, 490, 124, 25, 25, "10")

   ButtonGadget(16, 465, 149, 25, 25, "11")

   ButtonGadget(17, 490, 149, 25, 25, "12")

   ButtonGadget(18, 465, 199, 25, 25, "-")

   ButtonGadget(19, 490, 199, 25, 25, "+")

   

   ;SetGadgetFont(18, FontID(1))

   ;SetGadgetFont(19, FontID(1))

 

;---       Frames   

   

   TextGadget(20, 233, 190, 65, 20, "Total Frames")

   ButtonGadget(21, 215, 205, 25, 25, "-")

   ButtonGadget(22, 290, 205, 25, 25, "+")

   StringGadget(23, 240, 207, 50, 20, Str(frameNumbersA -1), #PB_String_ReadOnly)

   

   ;SetGadgetFont(21, FontID(1))

   ;SetGadgetFont(22, FontID(1))

   

;---       3D Frames

 

  Frame3DGadget(24, 5,  5, 175, 231, "Preview Window")

  Frame3DGadget(25, 184,  5, 167, 231, "Sequencer")

  Frame3DGadget(26, 355,  5, 170, 231, "Shapes and Delay")

  

;---       Timing

  

  OptionGadget(27, 35, 189, 55, 15, "Browser")

  SetGadgetState(27,1)  

  OptionGadget(28, 95, 189, 65, 15, "Projector")      

  

;---       Set "Sequencer" selection

   

  SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

  

;---       AddKeyboardShortcuts

  

  AddKeyboardShortcut(0, #PB_Shortcut_A, #PB_Shortcut_A)

  AddKeyboardShortcut(0, #PB_Shortcut_B, #PB_Shortcut_B)

  AddKeyboardShortcut(0, #PB_Shortcut_C, #PB_Shortcut_C)

  AddKeyboardShortcut(0, #PB_Shortcut_D, #PB_Shortcut_D)

  AddKeyboardShortcut(0, #PB_Shortcut_E, #PB_Shortcut_E)

  AddKeyboardShortcut(0, #PB_Shortcut_F, #PB_Shortcut_F)

  AddKeyboardShortcut(0, #PB_Shortcut_G, #PB_Shortcut_G)

  AddKeyboardShortcut(0, #PB_Shortcut_H, #PB_Shortcut_H)

  AddKeyboardShortcut(0, #PB_Shortcut_I, #PB_Shortcut_I)

  AddKeyboardShortcut(0, #PB_Shortcut_J, #PB_Shortcut_J)

  AddKeyboardShortcut(0, #PB_Shortcut_K, #PB_Shortcut_K)

  AddKeyboardShortcut(0, #PB_Shortcut_L, #PB_Shortcut_L)

  AddKeyboardShortcut(0, #PB_Shortcut_M, #PB_Shortcut_M)

  AddKeyboardShortcut(0, #PB_Shortcut_N, #PB_Shortcut_N)

  AddKeyboardShortcut(0, #PB_Shortcut_O, #PB_Shortcut_O)

  AddKeyboardShortcut(0, #PB_Shortcut_P, #PB_Shortcut_P)

  AddKeyboardShortcut(0, #PB_Shortcut_Q, #PB_Shortcut_Q)

  AddKeyboardShortcut(0, #PB_Shortcut_R, #PB_Shortcut_R)

  AddKeyboardShortcut(0, #PB_Shortcut_S, #PB_Shortcut_S)

  AddKeyboardShortcut(0, #PB_Shortcut_T, #PB_Shortcut_T)

  AddKeyboardShortcut(0, #PB_Shortcut_U, #PB_Shortcut_U)

  AddKeyboardShortcut(0, #PB_Shortcut_V, #PB_Shortcut_V)

  AddKeyboardShortcut(0, #PB_Shortcut_W, #PB_Shortcut_W)

  AddKeyboardShortcut(0, #PB_Shortcut_X, #PB_Shortcut_X)

  AddKeyboardShortcut(0, #PB_Shortcut_Y, #PB_Shortcut_Y)

  AddKeyboardShortcut(0, #PB_Shortcut_Z, #PB_Shortcut_Z)

  

  AddKeyboardShortcut(0, #PB_Shortcut_Space, #PB_Shortcut_Space)

  

  AddKeyboardShortcut(0, #PB_Shortcut_Pad1, #PB_Shortcut_Pad1)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad2, #PB_Shortcut_Pad2)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad3, #PB_Shortcut_Pad3)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad4, #PB_Shortcut_Pad4)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad5, #PB_Shortcut_Pad5)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad6, #PB_Shortcut_Pad6)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad7, #PB_Shortcut_Pad7)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad8, #PB_Shortcut_Pad8)

  AddKeyboardShortcut(0, #PB_Shortcut_Pad9, #PB_Shortcut_Pad9)

  

  AddKeyboardShortcut(0, #PB_Shortcut_Add, #PB_Shortcut_Add) ;Add to Delay

  AddKeyboardShortcut(0, #PB_Shortcut_Subtract, #PB_Shortcut_Subtract) ;Subtract from Delay

  

  AddKeyboardShortcut(0, #PB_Shortcut_Insert, #PB_Shortcut_Insert) ;Add Frame

  AddKeyboardShortcut(0, #PB_Shortcut_Delete, #PB_Shortcut_Delete) ;Delete Frame

  

  AddKeyboardShortcut(0, #PB_Shortcut_Return, #PB_Shortcut_Return) ;Play

  

  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_N, 1) ;New

  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_O, 2) ;Open

  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_S, 3) ;Save

  

  AddKeyboardShortcut(0, #PB_Shortcut_Escape, 7) ;Esc

  

  AddKeyboardShortcut(0, #PB_Shortcut_F1, 10) ;Help

  

  

;---

;----------RepeatEvents----------

;---   

Repeat

  Event=WaitWindowEvent()

  Select Event

Case #PB_Event_Menu

Select EventMenu()

 

;---Shortcuts--

;---       Shapes

 

     Case #PB_Shortcut_A

           SetGadgetItemText(1, getState1, "A", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(0))

           

     Case #PB_Shortcut_B

           SetGadgetItemText(1, getState1, "B", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(1))

           

     Case #PB_Shortcut_C

           SetGadgetItemText(1, getState1, "C", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_D

           SetGadgetItemText(1, getState1, "D", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_E

           SetGadgetItemText(1, getState1, "E", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(3))

           

     Case #PB_Shortcut_F

           SetGadgetItemText(1, getState1, "F", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(4))

           

     Case #PB_Shortcut_G

           SetGadgetItemText(1, getState1, "G", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_H

           SetGadgetItemText(1, getState1, "H", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_I

           SetGadgetItemText(1, getState1, "I", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(0))

           

     Case #PB_Shortcut_J

           SetGadgetItemText(1, getState1, "J", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_K

           SetGadgetItemText(1, getState1, "K", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_L

           SetGadgetItemText(1, getState1, "L", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(5))

           

     Case #PB_Shortcut_M

           SetGadgetItemText(1, getState1, "M", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(1))

           

     Case #PB_Shortcut_N

           SetGadgetItemText(1, getState1, "N", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_O

           SetGadgetItemText(1, getState1, "O", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(6))

           

     Case #PB_Shortcut_P

           SetGadgetItemText(1, getState1, "P", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(1))

           

     Case #PB_Shortcut_Q

           SetGadgetItemText(1, getState1, "Q", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(7))

           

     Case #PB_Shortcut_R

           SetGadgetItemText(1, getState1, "R", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_S

           SetGadgetItemText(1, getState1, "S", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_T

           SetGadgetItemText(1, getState1, "T", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_U

           SetGadgetItemText(1, getState1, "U", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(7))

           

     Case #PB_Shortcut_V

           SetGadgetItemText(1, getState1, "V", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(4))

           

     Case #PB_Shortcut_W

           SetGadgetItemText(1, getState1, "W", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(7))

           

     Case #PB_Shortcut_X

           SetGadgetItemText(1, getState1, "X", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(8))

           

     Case #PB_Shortcut_Y

           SetGadgetItemText(1, getState1, "Y", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(7))

           

     Case #PB_Shortcut_Z

           SetGadgetItemText(1, getState1, "Z", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(9))

           

     Case #PB_Shortcut_Space

           SetGadgetItemText(1, getState1, "Closed", 1)

           If GetGadgetItemText(1, getState1, 2) = ""

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           SetGadgetState(0,ImageID(2))

           

 

;---       Delays

           

     Case #PB_Shortcut_Pad1

           SetGadgetItemText(1, getState1, "1", 2)

           

     Case #PB_Shortcut_Pad2

           SetGadgetItemText(1, getState1, "2", 2)

           

     Case #PB_Shortcut_Pad3

           SetGadgetItemText(1, getState1, "3", 2)

           

     Case #PB_Shortcut_Pad4

           SetGadgetItemText(1, getState1, "4", 2)

           

     Case #PB_Shortcut_Pad5

           SetGadgetItemText(1, getState1, "5", 2)

           

     Case #PB_Shortcut_Pad6

           SetGadgetItemText(1, getState1, "6", 2)

           

     Case #PB_Shortcut_Pad7

           SetGadgetItemText(1, getState1, "7", 2)

           

     Case #PB_Shortcut_Pad8

           SetGadgetItemText(1, getState1, "8", 2)

           

     Case #PB_Shortcut_Pad9

           SetGadgetItemText(1, getState1, "9", 2)

           

;---       Add & Subtract Delays

           

     Case #PB_Shortcut_Add

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +1)), 2)

     

     Case #PB_Shortcut_Subtract

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) -1)), 2)

          

          If GetGadgetItemText(1, getState1, 2) = "0"

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +1)), 2)

          EndIf

          

          If GetGadgetItemText(1, getState1, 2) = "-1"

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +2)), 2)

          EndIf

          

;---       Add Frame

     

     Case #PB_Shortcut_Insert

          count = CountGadgetItems(1)

          newFrame = count + 1

          AddGadgetItem(1, -1, Str(newFrame))

          

          SetGadgetText(23, Str(newFrame))

 

;---       Delete Frame

     

     Case #PB_Shortcut_Delete

          count = CountGadgetItems(1)

          deleteFrame = count - 1

          RemoveGadgetItem(1, deleteFrame)

          

          SetGadgetText(23, Str(deleteFrame))

          

          If count = 2

          AddGadgetItem(1, -1, "2")

          SetGadgetText(23, Str(count))

          SetGadgetState(1, 0)

          EndIf

     

;---       Play

 

     Case #PB_Shortcut_Return

          frameNumbersB = CountGadgetItems(1)

          newFrame = frameNumbersB + 1

          AddGadgetItem(1, -1, Str(newFrame))

    

          If GetGadgetState(27) = 1 ;browser speed

               AD = - 2

           Else

               AD = 0 ;realtime speed

           EndIf

                                                          

          getFPS$ = GetGadgetText(5)

          divide.f = (Val(getFPS$) + AD)  / 2 ;edited for browser viewing / original was divide.f = Val(getFPS$) / 2

          setDelay.f = 1000 / divide

          

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

       If LoadMovie(0, AudioFile$) = 0

          MessageRequester("Play","Please select an audio file.",#PB_MessageRequester_Ok | #MB_ICONSTOP | #MB_SYSTEMMODAL)

          

          frameNumbersB = CountGadgetItems(1)

          deleteFrame = frameNumbersB - 1

          RemoveGadgetItem(1, deleteFrame)

          

          Continue

          

       Else

          PlayMovie(0, WindowID(0))

       EndIf

           

       

         Repeat

           

             getState1 = GetGadgetState(1)

             

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

          

            If  GetGadgetItemText(1, getState1, 1) = "Closed"   

              SetGadgetState(0,ImageID(2))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "CH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "SH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "TH"   

              SetGadgetState(0,ImageID(5))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "A"   

              SetGadgetState(0,ImageID(0))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "B"   

              SetGadgetState(0,ImageID(1))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "C"   

              SetGadgetState(0,ImageID(8))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "D"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "E"   

              SetGadgetState(0,ImageID(3))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "F"   

              SetGadgetState(0,ImageID(4))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "G"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "H"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "I"   

              SetGadgetState(0,ImageID(0))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "J"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "K"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "L"   

              SetGadgetState(0,ImageID(5))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "M"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "N"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "O"   

              SetGadgetState(0,ImageID(6))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "P"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Q"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "R"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "S"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "T"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "U"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "V"   

              SetGadgetState(0,ImageID(4))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "W"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "X"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Y"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Z"   

              SetGadgetState(0,ImageID(9))

            EndIf

             

         Delay(Val(GetGadgetItemText(1, getState1, 2)) * setDelay)

             

     Until GetGadgetState(1) = newFrame -1

           

       If GetGadgetState(1) = newFrame -1

           SetGadgetState(1, 0)

       EndIf

       

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

       

       

       

     Case #PB_Shortcut_Control | #PB_Shortcut_N    ;New

     

     Case #PB_Shortcut_Control | #PB_Shortcut_O    ;Open

     

     Case #PB_Shortcut_Control | #PB_Shortcut_S    ;Save

            

       

          

;---       New     

     

     Case 1

           new = MessageRequester("New","Save your current work?",#PB_MessageRequester_YesNoCancel | #MB_ICONQUESTION)

           

        If new = 6

           

           frameNumbersB = CountGadgetItems(1)

           newFrame = frameNumbersB + 1

           AddGadgetItem(1, -1, Str(newFrame))

     

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

          

          saveSettings$ = SaveFileRequester("Save As...", "", "Lip (*.lip)|*.lip", 0)

         

           

        If saveSettings$

           

           CreatePreferences(saveSettings$+".lip")

           

           PreferenceGroup("Total Frames")

           

           WritePreferenceString("Frames", Str(frameNumbersB))

           

           PreferenceGroup("Shapes")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getShape$ =  GetGadgetItemText(1, getState1, 1)

           

           WritePreferenceString(Str(GetGadgetState(1)), getShape$)

           

        Until GetGadgetState(1) = newFrame -1

        

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

        

           PreferenceGroup("Delays")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getDelays$ =  GetGadgetItemText(1, getState1, 2)

           

           WritePreferenceString(Str(GetGadgetState(1)), getDelays$)

           

      Until GetGadgetState(1) = newFrame -1

        

        ClosePreferences()

        

     EndIf

        

       If GetGadgetState(1) = newFrame -1

          SetGadgetState(1, 0)

       EndIf

        

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

       

       

       ClearGadgetItemList(1)

           

          If LoadMovie(0, AudioFile$)

           AudioFile$ = Str(FreeMovie(0))

          EndIf

           

           For frameNumbersA = 1 To 25

             AddGadgetItem(1,-1,Str(frameNumbersA))

           Next

           

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

 

            

        ElseIf new = 7

           

           ClearGadgetItemList(1)

           

          If LoadMovie(0, AudioFile$)

           AudioFile$ = Str(FreeMovie(0))

          EndIf

           

           For frameNumbersA = 1 To 25

             AddGadgetItem(1,-1,Str(frameNumbersA))

           Next

           

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

        Else                 

            

        EndIf

 

       

;---       Open *.fls File     

     

     Case 2

           frameNumbersB = CountGadgetItems(1)

           newFrame = frameNumbersB + 1

           AddGadgetItem(1, -1, Str(newFrame))

           

          SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

          

          openSettings$ = OpenFileRequester("Open File...", "", "FLS (*.fls)|*.fls", 0)

     

        If openSettings$

        

           OpenFile(0, "~DIR")

           WriteString(0, openSettings$)

           CloseFile(0)

        

           SetMenuItemState(0, 4, 1)    ;Enable quick save

        

           SetClipboardText(openSettings$)    ;Send directory and file name to clipboard

        

           ClearGadgetItemList(1)

        

           OpenPreferences(openSettings$)

           

           PreferenceGroup("Total Frames")

           

           totalFrames$ = ReadPreferenceString("Frames", "")

           

        For setF = 1 To Val(totalFrames$)

           

           AddGadgetItem(1, -1, Str(setF))

           

        Next

        

           PreferenceGroup("FPS")

           

           framesPS$ = ReadPreferenceString("FPS", "")

           

           SetGadgetText(5, framesPS$)

           

             PreferenceGroup("Timing")

           

             playTiming$ = ReadPreferenceString("Timing", "")

           

             If playTiming$ = "1"

              SetGadgetState(27, 1)

             Else

              SetGadgetState(28, 1)

             EndIf

           

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

           PreferenceGroup("Shapes")

           

     Repeat

        

          For setF = 1 To Val(totalFrames$)

          

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

              

              allFrames$ = ReadPreferenceString(Str(setF), "")

           

           SetGadgetItemText(1, setF-1, allFrames$, 1)

           

          Next

          

        Until GetGadgetState(1) = Val(totalFrames$) -1

        

         SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

         

         PreferenceGroup("Delays")

         

     Repeat

        

          For setF = 1 To Val(totalFrames$)

          

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

              

              allDelays$ = ReadPreferenceString(Str(setF), "")

           

           SetGadgetItemText(1, setF-1, allDelays$, 2)

           

          Next

          

        Until GetGadgetState(1) = Val(totalFrames$) -1

        

         SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

         

         frameNumbersB = CountGadgetItems(1)

         

        SetGadgetText(23, Str(frameNumbersB))

        

          PreferenceGroup("Audio")

          

           AudioFile$ = ReadPreferenceString("Audio", "")

           Delay(100)

           LoadMovie(0, AudioFile$)

         

       If LoadMovie(0, AudioFile$) = 0

          MessageRequester("No Audio","Unable to load... " + getAudioDirectory$,#PB_MessageRequester_Ok | #MB_ICONEXCLAMATION)

       EndIf

        

         ClosePreferences()

         

       EndIf

       

       

     

;---       Quick - Save *.fls file   

     

     Case 3

           frameNumbersB = CountGadgetItems(1)

           newFrame = frameNumbersB + 1

           AddGadgetItem(1, -1, Str(newFrame))

           

           If GetMenuItemState(0, 4) = 0

           

           MessageRequester("Save","No file exist, please use ''Save As...'' first.",#PB_MessageRequester_Ok | #MB_ICONEXCLAMATION)

     Else

           

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

           OpenFile(0, "~DIR")

           quickSave$ = ReadString(0)

           CloseFile(0)

           

           If quickSave$

              Index = SelectedFilePattern()

           If (index = 0) And (GetExtensionPart(quickSave$) = "")

              quickSave$ = quickSave$ +".fls"

           EndIf

           

           CreatePreferences(quickSave$)

           

           PreferenceGroup("Total Frames")

           

           WritePreferenceString("Frames", Str(frameNumbersB))

           

           PreferenceGroup("FPS")

           

           WritePreferenceString("FPS", GetGadgetText(5))

           

           PreferenceGroup("Timing")

           

           WritePreferenceString("Timing", Str(GetGadgetState(27)))

           

           PreferenceGroup("Shapes")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getShape$ =  GetGadgetItemText(1, getState1, 1)

           

           WritePreferenceString(Str(GetGadgetState(1)), getShape$)

           

        Until GetGadgetState(1) = newFrame -1

        

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

        

           PreferenceGroup("Delays")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getDelays$ =  GetGadgetItemText(1, getState1, 2)

           

           WritePreferenceString(Str(GetGadgetState(1)), getDelays$)

           

      Until GetGadgetState(1) = newFrame -1

      

           PreferenceGroup("Audio")

      

             OpenFile(1, "~AUD")

             audioDirectory$ = ReadString(0)

             CloseFile(1)

             

           WritePreferenceString("Audio", audioDirectory$)

        

        ClosePreferences()

        

     EndIf

       EndIf

       If GetGadgetState(1) = newFrame -1

          SetGadgetState(1, 0)

       EndIf

        

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

          

 

;---       Save *.fls File           

           

     Case 4

           frameNumbersB = CountGadgetItems(1)

           newFrame = frameNumbersB + 1

           AddGadgetItem(1, -1, Str(newFrame))

     

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

          ;OpenFile(0, "~DIR")

          ;checkSame$ = ReadString()

          ;CloseFile(0)

           

          pattern$ = "FLS (*.fls)|*.fls"

          

          saveSettings$ = SaveFileRequester("Save As...", "", pattern$, 0)

          

           

        If saveSettings$

           Index = SelectedFilePattern()

           If (index = 0) And (GetExtensionPart(saveSettings$) = "")

              saveSettings$ = saveSettings$ +".fls"

           EndIf

          

          SetMenuItemState(0, 4, 1)    ;Enable quick save

        

           OpenFile(0, "~DIR")

           WriteString(0, saveSettings$)

           CloseFile(0)

        

          CreatePreferences(saveSettings$)

           

           PreferenceGroup("Total Frames")

           

           WritePreferenceString("Frames", Str(frameNumbersB))

           

           PreferenceGroup("FPS")

           

           WritePreferenceString("FPS", GetGadgetText(5))

           

           PreferenceGroup("Timing")

           

           WritePreferenceString("Timing", Str(GetGadgetState(27)))

           

           PreferenceGroup("Shapes")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getShape$ =  GetGadgetItemText(1, getState1, 1)

           

           WritePreferenceString(Str(GetGadgetState(1)), getShape$)

           

        Until GetGadgetState(1) = newFrame -1

        

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

        

           PreferenceGroup("Delays")

           

        Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              getDelays$ =  GetGadgetItemText(1, getState1, 2)

           

           WritePreferenceString(Str(GetGadgetState(1)), getDelays$)

           

      Until GetGadgetState(1) = newFrame -1

      

           PreferenceGroup("Audio")

      

             OpenFile(1, "~AUD")

             audioDirectory$ = ReadString(0)

             CloseFile(1)

             

           WritePreferenceString("Audio", audioDirectory$)

        

        ClosePreferences()

        

     EndIf

     

        

       If GetGadgetState(1) = newFrame -1

          SetGadgetState(1, 0)

       EndIf

        

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

             

     

;---       Load Audio    

     

     Case 5

        

         AudioFile$ = OpenFileRequester("Open File...", "", "Audio (*.wav), (*.mp3)|*.wav;*.mp3|WAV (*.wav)|*.wav|MP3 (*.mp3)|*.mp3|All files (*.*)|*.*", 0)

          LoadMovie(0, AudioFile$)

         

       If LoadMovie(0, AudioFile$) = 0

          MessageRequester("No Audio","Please (re)select an audio file.",#PB_MessageRequester_Ok | #MB_ICONEXCLAMATION)

       EndIf

       

       CreateFile(1, "~AUD")

       WriteString(0, AudioFile$)

       CloseFile(1)

    

;---       Export Script

       

    Case 6

          frameNumbersB = CountGadgetItems(1)

          newFrame = frameNumbersB + 1

          AddGadgetItem(1, -1, Str(newFrame))

     

          SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

          

         pattern$ = "Actionscript (*.as)|*.as"

          

         saveFile$ = SaveFileRequester("Save Script As...", "", pattern$, 0)

         

           

        If saveFile$

           Index = SelectedFilePattern()

           If (index = 0) And (GetExtensionPart(saveFile$) = "")

              saveFile$ = saveFile$ +".as"

           EndIf

        

           CreateFile(0, saveFile$)

        

           WriteStringN(0, "onClipEvent(load){")

           

           WriteStringN(0, "faz = 1;")

           

           WriteString(0, "del = [0")

           

      Repeat

      

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected);+Val(GetGadgetItemText(1, p, 0))

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

           

              delayTime$ =  GetGadgetItemText(1, getState1, 2)

           

           WriteString(0, ","+delayTime$)

           

      Until GetGadgetState(1) = newFrame -1

           

           WriteString(0, "];")

           

           WriteStringN(0, "")

           

           WriteString(0, "jmp = [0")

           

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

           

      Repeat     

           

           getState1 = GetGadgetState(1)

          

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected);+Val(GetGadgetItemText(1, p, 0))

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

              

              changeText$ = GetGadgetItemText(1, getState1, 1)

              

              If GetGadgetItemText(1, getState1, 1) = "Closed"

                 changeText$ = "1"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "CH"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "SH"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "TH"

                 changeText$ = "6"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "A"

                 changeText$ = "2"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "B"

                 changeText$ = "3"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "C"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "D"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "E"

                 changeText$ = "4"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "F"

                 changeText$ = "5"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "G"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "H"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "I"

                 changeText$ = "2"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "J"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "K"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "L"

                 changeText$ = "6"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "M"

                 changeText$ = "3"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "N"

                 changeText$ = "10"    

              EndIf

   

              If GetGadgetItemText(1, getState1, 1) = "O"

                 changeText$ = "7"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "P"

                 changeText$ = "3"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "Q"

                 changeText$ = "8"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "R"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "S"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "T"

                 changeText$ = "10"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "U"

                 changeText$ = "8"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "V"

                 changeText$ = "5"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "W"

                 changeText$ = "8"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "X"

                 changeText$ = "9"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "Y"

                 changeText$ = "8"    

              EndIf

              

              If GetGadgetItemText(1, getState1, 1) = "Z"

                 changeText$ = "10"    

              EndIf

              

           WriteString(0, ","+changeText$)

         

      Until GetGadgetState(1) = newFrame -1

      

           WriteString(0, "];")     

           

           WriteStringN(0, "")

           

           WriteStringN(0, "}")

           

           WriteStringN(0, "onClipEvent(enterFrame){")

           

           WriteStringN(0, "if( faz < "+Str(frameNumbersB +2)+"){")

           

           WriteStringN(0, "if(del[faz]>0){")

           

           WriteStringN(0, "del[faz] -= 1;")

           

           WriteStringN(0, "}else{")

           

           WriteStringN(0, "this.gotoAndPlay(jmp[faz]);")

           

           WriteStringN(0, "faz += 1;")

           

           WriteStringN(0, "}")

           

           WriteStringN(0, "}")

           

           WriteStringN(0, "}")

 

           CloseFile(0)

           

        EndIf

        

        If GetGadgetState(1) = newFrame -1

           SetGadgetState(1, 0)

        EndIf

        

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

           

;---       Quit

 

    Case 7

          Quit=1

          

;---       Load Images

 

    Case 8

          InitialPath$ = "C:\"

             

          ImageDirectory$ = PathRequester("Select Image Folder", InitialPath$)

          

          If ImageDirectory$

          

              FreeImage(0)

              FreeImage(1)

              FreeImage(2)

              FreeImage(3)

              FreeImage(4)

              FreeImage(5)

              FreeImage(6)

              FreeImage(7)

              FreeImage(8)

              FreeImage(9)

          

              LoadImage(0, ImageDirectory$ + "A.bmp")

              LoadImage(1, ImageDirectory$ + "B.bmp")

              LoadImage(2, ImageDirectory$ + "C.bmp")

              LoadImage(3, ImageDirectory$ + "E.bmp")

              LoadImage(4, ImageDirectory$ + "F.bmp")

              LoadImage(5, ImageDirectory$ + "L.bmp")

              LoadImage(6, ImageDirectory$ + "O.bmp")

              LoadImage(7, ImageDirectory$ + "Q.bmp")

              LoadImage(8, ImageDirectory$ + "R.bmp")

              LoadImage(9, ImageDirectory$ + "S.bmp")

              

              SetGadgetState(0,ImageID(0))

              

          Else

              MessageRequester("Canceled", "Canceled, last set of images will be used.", #PB_MessageRequester_Ok | #MB_ICONEXCLAMATION)

              

          EndIf

          

;---       Default Images

 

    Case 9

          FreeImage(0)

          FreeImage(1)

          FreeImage(2)

          FreeImage(3)

          FreeImage(4)

          FreeImage(5)

          FreeImage(6)

          FreeImage(7)

          FreeImage(8)

          FreeImage(9)

    

          LoadImage(0, "images\A.bmp")

          LoadImage(1, "images\B.bmp")

          LoadImage(2, "images\C.bmp")

          LoadImage(3, "images\E.bmp")

          LoadImage(4, "images\F.bmp")

          LoadImage(5, "images\L.bmp")

          LoadImage(6, "images\O.bmp")

          LoadImage(7, "images\Q.bmp")

          LoadImage(8, "images\R.bmp")

          LoadImage(9, "images\S.bmp")

          

          SetGadgetState(0,ImageID(0))

          

;---       Open Help File

          

    Case 10

          RunProgram("Help.chm","","")

       

          

;---       Open About Window

          

    Case 12

           About()

 

 

          

EndSelect

 

;---   

;---ButtonGadgets--

 

Case #PB_Event_Gadget

Select EventGadget()

 

   Case 1 ;---       Change "Preview" from "Sequencer"

          getState1 = GetGadgetState(1)

          

        

            If  GetGadgetItemText(1, getState1, 1) = "Closed"   

              SetGadgetState(0,ImageID(2))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "CH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "SH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "TH"   

              SetGadgetState(0,ImageID(5))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "A"   

              SetGadgetState(0,ImageID(0))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "B"   

              SetGadgetState(0,ImageID(1))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "C"   

              SetGadgetState(0,ImageID(8))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "D"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "E"   

              SetGadgetState(0,ImageID(3))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "F"   

              SetGadgetState(0,ImageID(4))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "G"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "H"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "I"   

              SetGadgetState(0,ImageID(0))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "J"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "K"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "L"   

              SetGadgetState(0,ImageID(5))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "M"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "N"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "O"   

              SetGadgetState(0,ImageID(6))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "P"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Q"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "R"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "S"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "T"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "U"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "V"   

              SetGadgetState(0,ImageID(4))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "W"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "X"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Y"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Z"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

;---       Shapes            

        

   Case 2

         frameNumbersB = CountGadgetItems(1)

   

          getState2 = GetGadgetState(2)

          

        

        If GetGadgetItemState(1, frameNumbersB) = 0

            getText$ = GetGadgetItemText(2, getState2, 0)

            getState1 = GetGadgetState(1)

            SetGadgetItemText(1, getState1, getText$, 1)

            

           If GetGadgetItemText(1, getState1, 2) = "" ;Add a delay of "1" when a shape is added

           SetGadgetItemText(1, getState1, "1", 2)

           EndIf

           

        EndIf

        

        

        If GetGadgetItemState(2, 0) = 1 ;Closed

           SetGadgetState(0,ImageID(2))

        EndIf

        

        If GetGadgetItemState(2, 1) = 1 ;CH

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 2) = 1 ;SH

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 3) = 1 ;TH

           SetGadgetState(0,ImageID(5))

        EndIf

        

        If GetGadgetItemState(2, 4) = 1 ;A

           SetGadgetState(0,ImageID(0))

        EndIf

        

        If GetGadgetItemState(2, 5) = 1 ;B

           SetGadgetState(0,ImageID(1))

        EndIf

        

        If GetGadgetItemState(2, 6) = 1 ;C

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 7) = 1 ;D

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 8) = 1 ;E

           SetGadgetState(0,ImageID(3))

        EndIf

        

        If GetGadgetItemState(2, 9) = 1 ;F

           SetGadgetState(0,ImageID(4))

        EndIf

        

        If GetGadgetItemState(2, 10) = 1 ;G

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 11) = 1 ;H

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 12) = 1 ;I

           SetGadgetState(0,ImageID(0))

        EndIf

        

        If GetGadgetItemState(2, 13) = 1 ;J

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 14) = 1 ;K

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 15) = 1 ;L

           SetGadgetState(0,ImageID(5))

        EndIf

        

        If GetGadgetItemState(2, 16) = 1 ;M

           SetGadgetState(0,ImageID(1))

        EndIf

        

        If GetGadgetItemState(2, 17) = 1 ;N

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 18) = 1 ;O

           SetGadgetState(0,ImageID(6))

        EndIf

        

        If GetGadgetItemState(2, 19) = 1 ;P

           SetGadgetState(0,ImageID(1))

        EndIf

        

        If GetGadgetItemState(2, 20) = 1 ;Q

           SetGadgetState(0,ImageID(7))

        EndIf

        

        If GetGadgetItemState(2, 21) = 1 ;R

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 22) = 1 ;S

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 23) = 1 ;T

           SetGadgetState(0,ImageID(9))

        EndIf

        

        If GetGadgetItemState(2, 24) = 1 ;U

           SetGadgetState(0,ImageID(7))

        EndIf

        

        If GetGadgetItemState(2, 25) = 1 ;V

           SetGadgetState(0,ImageID(4))

        EndIf

        

        If GetGadgetItemState(2, 26) = 1 ;W

           SetGadgetState(0,ImageID(7))

        EndIf

        

        If GetGadgetItemState(2, 27) = 1 ;X

           SetGadgetState(0,ImageID(8))

        EndIf

        

        If GetGadgetItemState(2, 28) = 1 ;Y

           SetGadgetState(0,ImageID(7))

        EndIf

        

        If GetGadgetItemState(2, 29) = 1 ;Z

           SetGadgetState(0,ImageID(9))

        EndIf   

   

   

   

   ;---       Play

   Case 3

          frameNumbersB = CountGadgetItems(1)

          newFrame = frameNumbersB + 1

          AddGadgetItem(1, -1, Str(newFrame))

          

          

          If GetGadgetState(27) = 1 ;browser speed

               AD = - 2

           Else

               AD = 0 ;realtime speed

           EndIf

                                                          

          getFPS$ = GetGadgetText(5)

          divide.f = (Val(getFPS$) + AD)  / 2 ;edited for browser viewing / original was divide.f = Val(getFPS$) / 2

          setDelay.f = 1000 / divide                   

          

           SetGadgetItemState(1, 0, #PB_ListIcon_Selected)

   

       If LoadMovie(0, AudioFile$) = 0

          MessageRequester("Stop","Please open an audio file before playing.",#PB_MessageRequester_Ok | #MB_ICONSTOP)

          

          frameNumbersB = CountGadgetItems(1)

          deleteFrame = frameNumbersB - 1

          RemoveGadgetItem(1, deleteFrame)

          

          Continue

          

       Else

          PlayMovie(0, WindowID(0))

       EndIf

       

         Repeat

           

             getState1 = GetGadgetState(1)

             

              SetGadgetItemState(1, getState1 +1, #PB_ListIcon_Selected)

              SendMessage_(GadgetID(1), #LVM_UPDATE, getState1 +1, 0)

          

            If  GetGadgetItemText(1, getState1, 1) = "Closed"   

              SetGadgetState(0,ImageID(2))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "CH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "SH"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "TH"   

              SetGadgetState(0,ImageID(5))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "A"   

              SetGadgetState(0,ImageID(0))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "B"   

              SetGadgetState(0,ImageID(1))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "C"   

              SetGadgetState(0,ImageID(8))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "D"   

              SetGadgetState(0,ImageID(9))

             EndIf

            If  GetGadgetItemText(1, getState1, 1) = "E"   

              SetGadgetState(0,ImageID(3))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "F"   

              SetGadgetState(0,ImageID(4))

             EndIf

             

            If  GetGadgetItemText(1, getState1, 1) = "G"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "H"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "I"   

              SetGadgetState(0,ImageID(0))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "J"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "K"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "L"   

              SetGadgetState(0,ImageID(5))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "M"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "N"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "O"   

              SetGadgetState(0,ImageID(6))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "P"   

              SetGadgetState(0,ImageID(1))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Q"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "R"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "S"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "T"   

              SetGadgetState(0,ImageID(9))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "U"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "V"   

              SetGadgetState(0,ImageID(4))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "W"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "X"   

              SetGadgetState(0,ImageID(8))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Y"   

              SetGadgetState(0,ImageID(7))

            EndIf

            

            If  GetGadgetItemText(1, getState1, 1) = "Z"   

              SetGadgetState(0,ImageID(9))

            EndIf

             

         Delay(Val(GetGadgetItemText(1, getState1, 2)) * setDelay)

             

     Until GetGadgetState(1) = newFrame -1

           

       If GetGadgetState(1) = newFrame -1

           SetGadgetState(1, 0)

       EndIf

       

       frameNumbersB = CountGadgetItems(1)

       deleteFrame = frameNumbersB - 1

       RemoveGadgetItem(1, deleteFrame)

   

;---       Delays

   

   Case 6

          SetGadgetItemText(1, getState1, "1", 2)

          

   Case 7

          SetGadgetItemText(1, getState1, "2", 2)

          

   Case 8

          SetGadgetItemText(1, getState1, "3", 2)

          

   Case 9

          SetGadgetItemText(1, getState1, "4", 2)

          

   Case 10

          SetGadgetItemText(1, getState1, "5", 2)        

           

   Case 11

          SetGadgetItemText(1, getState1, "6", 2)

          

   Case 12

          SetGadgetItemText(1, getState1, "7", 2)

          

   Case 13

          SetGadgetItemText(1, getState1, "8", 2)

          

   Case 14

          SetGadgetItemText(1, getState1, "9", 2)

          

   Case 15

          SetGadgetItemText(1, getState1, "10", 2)

          

   Case 16

          SetGadgetItemText(1, getState1, "11", 2)

          

   Case 17

          SetGadgetItemText(1, getState1, "12", 2)

          

   Case 18

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) -1)), 2)

          

          If GetGadgetItemText(1, getState1, 2) = "0"

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +1)), 2)

          EndIf

          

          If GetGadgetItemText(1, getState1, 2) = "-1"

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +2)), 2)

          EndIf

          

   Case 19

          SetGadgetItemText(1, getState1, Str((Val(GetGadgetItemText(1, getState1, 2)) +1)), 2)

 

;---       Delete Frame

          

   Case 21

          count = CountGadgetItems(1)

          deleteFrame = count - 1

          RemoveGadgetItem(1, deleteFrame)

          

          SetGadgetText(23, Str(deleteFrame))

          

          If count = 2

          AddGadgetItem(1, -1, "2")

          SetGadgetText(23, Str(count))

          SetGadgetState(1, 0)

          EndIf

 

;---       Add Frame

           

   Case 22

          count = CountGadgetItems(1)

          newFrame = count + 1

          AddGadgetItem(1, -1, Str(newFrame))

          

          SetGadgetText(23, Str(newFrame))

 

          

    EndSelect

    

;---       Close "About" Window

    

    Case #PB_Event_CloseWindow

      If EventWindow() = 1

        CloseWindow(1)

       ;UseWindow(0)

       EnableWindow_(WindowID(0),#True)

       SetFocus_(WindowID(0))

      Else

        Quit = 1

      EndIf

    

     

  EndSelect

  

;---       Launch Websites

  

  EventGadgetID = EventGadget()

  EventType = EventType()

  

  

    If EventGadgetID = 504 And EventType = #PB_EventType_LeftClick

    

       ShellExecute_(hParent,"open","http://www.flashpulse.com/","","",#SW_SHOWNORMAL)

       

    EndIf

  

  

    If EventGadgetID = 506 And EventType = #PB_EventType_LeftClick

    

       ShellExecute_(hParent,"open","http://www.necromanthus.com/","","",#SW_SHOWNORMAL)

       

    EndIf

  

    

Until Quit = 1

 

EndIf

; IDE Options = PureBasic v3.94 (Windows - x86)

; CursorPosition = 4

; Folding = -

; EnableNT4

; EnableXP

; UseIcon = images\flsico.ico

; Executable = Flash LipSync2.exe

; HideErrorLog