;** Set_Vid ********************************************************************
;*  Configuracao de Video                                                      *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 26/01/1998 por Anivel Augusto Rodrigues
;Ultima Alteracao: 13/06/2006 por Davi Carrano
;Motivo Alteracao: Visualiza Grafico e Relatorios
;Ultima Alteracao: 23/05/2007 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Uso Mouse
;Ultima Alteracao: 14/08/2007 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Deleta_Arquivo
;Ultima Alteracao: 19/09/2012 por Anivel Augusto Rodrigues
;Motivo Alteracao: Ajustes Substitui‡Æo Editor novo arquivo por FileWrite
;Ultima Alteracao: 03/01/2017 por Rafael Matos
;Motivo Alteracao: Ajustes showdialog MensagemRadioButtons()

;*******************************************************************************
;* Rotina                                                                      *
;*******************************************************************************
Proc SD_Dialog(Disparo,Campo,Evento,Elemento)
Temp=True
TECLA    =""
MSG_CAMPO=""
If Disparo="OPEN" Then
    AoCriarShowDialog()
    VSDGVIDEO=NumVal(SubStr(Sys_Set_Video,1,2))
    If Sys_visualiza_Grafico="WIN"
       Then VSDGGRAFICO=1
       Else VSDGGRAFICO=2
    EndIf
    If Sys_Visualiza_Relatorio="WIN"
       Then VSDGRELATORIO=1
       Else VSDGRELATORIO=2
    EndIf
EndIf
If Disparo="EVENT" And Evento["Type"]="KEY" Then
   Switch
     Case Evento["KeyCode"] = -59: Dialog_F1()
     Case Evento["KeyCode"] =  27:
          Temp=False
          Switch
            Case Campo="TG_VIDEO"         : Campo="NO"
            Case Campo="TG_GRAFICO"       : Campo="TG_VIDEO"
            Case Campo="TG_RELATORIO"     : Campo="TG_GRAFICO"
            Case Campo="YES" Or Campo="NO": Campo="TG_RELATORIO"
          EndSwitch
     Case (Evento["KeyCode"] <= -104 And Evento["KeyCode"] >= -113) Or 
           Evento["KeyCode"]  = -139 Or  Evento["KeyCode"]  = -140:
           SYS_TECLA_ACIONADA=Evento["KeyCode"]
           Seta_Tecla_Acionada()
           CancelDialog
     Case Evento["KeyCode"] = 13:
          Temp=False
          If Checa_TAG()
             Then Switch
                    Case Campo="TG_VIDEO"      : Campo="TG_GRAFICO"
                    Case Campo="TG_GRAFICO"    : Campo="TG_RELATORIO"
                    Case Campo="TG_RELATORIO"  : Campo="YES"
                  EndSwitch
          EndIf
          RefreshDialog
   EndSwitch
EndIf

Switch
  Case Campo="TG_VIDEO" or Campo="TG_GRAFICO" or Campo="TG_RELATORIO" :
       MensagemRadioButtons()
EndSwitch
Monta_Prompt(MSG_CAMPO,TECLA)
Return Temp
EndProc

;*******************************************************************************
;* ROTINA PRINCIPAL                                                            *
;*******************************************************************************
AutoLib="\\Sistemas\\Cadastro\\Bib_Show,\\Sistemas\\Cadastro\\Bibliot"
LimpAguarde()
Sys_Set_Video  =""
Sys_ReSet_Video=""
Sys_Visualiza_Grafico  =""
Sys_Visualiza_Relatorio=""
If Not IsFile(PrivDir()+"Cfg_Vid.sc")
   Then Sys_Set_Video  ="01C  Padr„o    80x25"
				Sys_Reset_Video="01C  Padr„o    80x25"
        Sys_Visualiza_Grafico   ="DOS"
        Sys_Visualiza_Relatorio ="DOS"
   Else Play PrivDir()+"Cfg_Vid"
EndIf

ShowDialog "Configurar V¡deo/Gr fico/Relat¢rios" Proc "SD_Dialog"
Trigger "OPEN","ARRIVE"
Key "F1","ENTER","ESC",
      -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -139, -140
 @ 02,16   Height 16 Width 50

  Frame Single From 00,00 to 06,47
  Label @ 00,01 "Placa de ~V~¡deo " For "TG_VIDEO"
  RadioButtons @ 01,01 Height 5 Width 42
     "Padr„o    80x25",
     "SBT      132x25",
     "Sigma    132x25",
     "Paradise 132x25",
     "Orchid   132x25",
     "Genoa    132x25",
     "Everex   132x25",
     "Compaq   132x25",
     "Ahead    132/25",
     "ATI      132x25"
     Tag "TG_VIDEO"
     To VSDGVIDEO

  Frame Single From 07,00 to 10,23
  Label @ 07,01 "Visualiza ~G~r fico " For "TG_GRAFICO"
  RadioButtons @ 08,01 Height 2 Width 22
     "Windows/Visegraf",
     "DOS"
     Tag "TG_GRAFICO"
     To VSDGGRAFICO

  Frame Single From 07,24 to 10,47
  Label @ 07,25 "Visualiza ~R~elat¢rios " For "TG_RELATORIO"
  RadioButtons @ 08,25 Height 2 Width 22
     "Windows/Adobe PDF",
     "DOS"
     Tag "TG_RELATORIO"
     To VSDGRELATORIO

  Pushbutton @ 12,08 width 11 "~O~k"      OK     Default Value "Ok" Tag "YES" To BottonValue
  Pushbutton @ 12,26 width 11 "~C~ancela" CANCEL                    Tag "NO"  To BottonValue

EndDialog
If RetVal
   Then Aguarde("Aguarde, salvando configura‡„o")

        FileWrite        PrivDir()+"Cfg_Vid.sc" From ";****** Variaveis de Configura‡„o de Video Vise Informatica"+"\n"

        Linha=""
        Switch
          Case VSDGVIDEO=1:  Linha="Sys_Set_Video  =\"01C  Padr„o    80x25\""
          Case VSDGVIDEO=2:  Linha="Sys_Set_Video  =\"02MA SBT      132x25\""
          Case VSDGVIDEO=3:  Linha="Sys_Set_Video  =\"03LA Sigma    132x25\""
          Case VSDGVIDEO=4:  Linha="Sys_Set_Video  =\"04KA Paradise 132x25\""
          Case VSDGVIDEO=5:  Linha="Sys_Set_Video  =\"05JB Orchid   132x25\""
          Case VSDGVIDEO=6:  Linha="Sys_Set_Video  =\"06IA Genoa    132x25\""
          Case VSDGVIDEO=7:  Linha="Sys_Set_Video  =\"07HE Everex   132x25\""
          Case VSDGVIDEO=8:  Linha="Sys_Set_Video  =\"08GA Compaq   132x25\""
          Case VSDGVIDEO=9:  Linha="Sys_Set_Video  =\"09EC Ahead    132/25\""
          Case VSDGVIDEO=10: Linha="Sys_Set_Video  =\"10FA ATI      132x25\""
        EndSwitch
        FileWrite Append PrivDir()+"Cfg_Vid.sc" From Linha+"\n"

        Linha=""
        Switch
          Case VSDGGRAFICO=1: Linha="Sys_Visualiza_Grafico  =\"WIN\""
          Case VSDGGRAFICO=2: Linha="Sys_Visualiza_Grafico  =\"DOS\""
        EndSwitch
        FileWrite Append PrivDir()+"Cfg_Vid.sc" From Linha+"\n"

        Linha=""
        Switch
          Case VSDGRELATORIO=1: Linha="Sys_Visualiza_Relatorio  =\"WIN\""
          Case VSDGRELATORIO=2: Linha="Sys_Visualiza_Relatorio  =\"DOS\""
        EndSwitch
        FileWrite Append PrivDir()+"Cfg_Vid.sc" From Linha+"\n"

        FileWrite Append PrivDir()+"Cfg_Vid.sc" From "Sys_Reset_Video=\"01C  Padr„o    80x25\""+"\n"
        ClearAll

        Play PrivDir()+"Cfg_Vid"
        LimpAguarde()
        Mensagem("Configura‡„o salva !")
EndIf
ClearAll
Release Vars All
Release Procs All
