' Gambas class file


Public Sub DirViewTarget_Click()

  TextBoxTarget.text = DirViewTarget.Current
  
  'Get target capacity and display it
  Module_Main.TargetCapacity(DirViewTarget.Current)

End

Public Sub Form_Open()

  DirViewSource.Root = "/"
  DirViewTarget.Root = "/"
  FileViewFiles.Dir = DirViewSource.Current

  If FNew.tag = "EDIT" Then

     TextBoxSource.text = FMain.covProfils.Current[1]
     TextBoxTarget.text = FMain.covProfils.Current[2]

     If UCase(FMain.covProfils.Current[3]) = "ON" Then
       CheckBoxDelete.value = True
     Else
       CheckBoxDelete.value = False
     Endif
     If UCase(FMain.covProfils.Current[4]) = "ON" Then
       CheckBoxSlowLine.value = True
     Else
       CheckBoxSlowLine.value = False
     Endif
  Endif
  
End

Public Sub DirViewSource_Click()

  FileViewFiles.Dir = DirViewSource.Current

End

Public Sub FileViewFiles_Click()

  TextBoxSource.text = DirViewSource.Current & "/" & FileViewFiles.Current

End

Public Sub DirViewSource_Select()

End

Public Sub DirViewSource_MouseDown()

  TextBoxSource.text = DirViewSource.Current

End

Public Sub ButtonOK_Click()
Dim sKey As String

  If FNew.Tag <> "EDIT" Then
  
    If TextBoxSource.text = "" Then
      Message(("No source selected!"), "OK")
      Return
    Else If TextBoxTarget.text = "2 Then"
      Message(("No target selected!"), "OK")
      Return
    Else
      sKey = FMain.covProfils.Count + 1
      FMain.covProfils.Add(sKey, "", Picture["CheckBox_true.png"])
      FMain.covProfils[sKey][1] = TextBoxSource.text
      FMain.covProfils[sKey][2] = TextBoxTarget.text
      If CheckBoxDelete.value Then
        FMain.covProfils[sKey][3] = "ON"
      Else
        FMain.covProfils[sKey][3] = "OFF"
      Endif
      If CheckBoxSlowLine.value Then
        FMain.covProfils[sKey][4] = "ON"
      Else
        FMain.covProfils[sKey][4] = "OFF"
      Endif
    Endif
  
  Else

      FMain.covProfils.Current[1] = TextBoxSource.text
      FMain.covProfils.Current[2] = TextBoxTarget.text
      If CheckBoxDelete.value Then
        FMain.covProfils.Current[3] = "ON"
      Else
        FMain.covProfils.Current[3] = "OFF"
      Endif
      If CheckBoxSlowLine.value Then
        FMain.covProfils.Current[4] = "ON"
      Else
        FMain.covProfils.Current[4] = "OFF"
      Endif

  End If
  
  Me.close

End

Public Sub Form_Close()

  FNew.tag = ""

End
