Appendice A : Codice sviluppato

In tale appendice viene presentato tutto il codice sviluppato per la realizzazione del manuale. Per una più agevole lettura, il codice è suddiviso in settori, evidenziati in giallo. Come citato nella sezione 2.2, il linguaggio di sviluppo è orientato agli oggetti e quindi all’interno di ogni settore vengono riportati i vari oggetti, con il loro relativo codice.
 

A.1 Sfondo delle pagine

to handle buttonClick pos -- Commento: Al click…
                          -- "pos" è la posizione dove
                          -- viene premuto il mouse
   item 2 of pos=item 2 of pos-1500 -- Mostra il menu a popup
   scelta= popupMenu(pos, menuBar "mioPop" , "scelte")
   conditions -- Gestione della scelta
      when scelta contains "MAIN" -- Se viene scelto MAIN…
         go to page 1 of book "main.exe" -- Ritorna all'interfaccia
                                         -- di scelta dei 4 libri
      when scelta contains "INDEX" –- Se contiene INDEX…
         go to page indice -- vai alla pagina "indice"
      when a contains "PREFACE"
         go to page Preface
      when a contains "DESCRIPTION"
         go to page descrizione
      when a contains "ASSEMBLY"
         go to page assemblaggio
      when a contains "CONNECTIONS"
         go to page "connections"
      when a contains "SAFETY"
         go to page "safety"
      when a contains "DANIELI"
         go to page "worldwide"
      when a contains "GLOSSARY"
         show viewer "Glossario" as modal
      when a contains "DRAWS"
         show viewer "drawing" as modal
      when a contains "PHOTO"
         show viewer "photo" as modal
      when a contains "CATALOGS"
         show viewer "catalog" as modal
      when a contains "SEARCH"
         show viewer "Ricerca"
      when a contains "PRINT"
         start spooler
           print
         end
      when a contains "EXIT"
         show viewer "credit" as modal
         send exit
   end
end

to handle mouseEnter -- Al passaggio del mouse sopra il bottone
   set fillColor to 0, 90, 0 -- "illumina" il bottone
   sysSuspend=false -– Mostra effetto 3D
   show angledLine "LM1" of background "sfondo"
   show angledLine "LM2" of background "sfondo"
   sysSuspend=true
end

to handle mouseLeave -- All’uscita del mouse dal bottone
   set fillColor to 0, 75, 0 -- "spegni" il bottone
   sysSuspend=false -– Nascondi effetto 3D
   hide angledLine "LM1" of background "sfondo"
   hide angledLine "LM2" of background "sfondo"
   sysSuspend=true
end

to handle buttonClick pos -- Al click…
                          -- "pos" è la posizione dove
                          -- viene premuto il mouse
   item 2 of pos=item 2 of pos-700 -- Mostra il menu a popup
   a= popupMenu(pos, menuBar "mioPop" , "help")
   -- Gestione della scelta (in a)
   conditions -- Gestione della scelta
      when a contains "GENERAL" -- Se viene scelto "GENERAL"
         show viewer "help 1" as modal -- Mostra la finestra "help 1"
      when a contains "NAVIGATION"
         show viewer "help 2" as modal
      when a contains "DRAWINGS"
         show viewer "help 3" as modal
   end
end

to handle mouseEnter -- Al passaggio del mouse sopra il bottone
   set fillColor to 0, 90, 0 -- "illumina" il bottone
   show angledLine "LH1" of background "sfondo" -– Mostra effetto 3D
   show angledLine "LH2" of background "sfondo"
end

to handle mouseLeave -- All’uscita del mouse dal bottone
   set fillColor to 0, 75, 0 -- "spegni" il bottone
   hide angledLine "LH1" of background "sfondo" -– Nascondi effetto 3D
   hide angledLine "LH2" of background "sfondo"
end

to handle buttonClick -- Al click
   pag=0 -- Contiene la pagina dove andare
   if itemCount(sysHistory)>1 –- Guarda se c’è una pagina precedente
      pop into pag -- La toglie dalla lista
      transition "turnPage right" to pag -– e va a quella pagina
   end
end

to handle mouseEnter
   set fillColor to 0, 90, 0 -- "illumina" il bottone
   show angledLine "LI1" of background "sfondo" -– Mostra effetto 3D
   show angledLine "LI2" of background "sfondo"
end

to handle mouseLeave -- All’uscita del mouse
   set fillColor to 0, 75, 0 -- "spegni" il bottone
   hide angledLine "LI1" of background "sfondo" -– Nascondi effetto 3D
   hide angledLine "LI2" of background "sfondo"
end

to handle buttonClick -- Al click
   transition "turnPage left" to next page -- Va alla pagina successiva
end

to handle mouseEnter
   set fillColor to 0, 90, 0 -- "illumina" il bottone
   show angledLine "LA1" of background "sfondo" -– Mostra effetto 3D
   show angledLine "LA2" of background "sfondo"
end

to handle mouseLeave -- All’uscita del mouse
   set fillColor to 0, 75, 0 -- "spegni" il bottone
   hide angledLine "LA1" of background "sfondo" -– Nascondi effetto 3D
   hide angledLine "LA2" of background "sfondo"
end

to handle mouseEnter pos -- Al passaggio del mouse sopra il bottone
   system tempo
   sysTimeFormat="seconds"
   put sysTime into tempo -- Setta il tempo
   item 1 of pos=item 1 of pos-1000
   item 2 of pos=item 2 of pos-300
   show field sessione at pos -- Mostra il nome della sezione
end

to handle mouseLeave -- All’uscita del mouse
   hide field sessione -- Nasconde il nome della sezione
   system tempo
   tempo=0 -- Azzera il tempo
end

to handle buttonClick -- Al click
   testo=text of recordfield "pagina" -- memorizza la pagina relativa
   pos=offset("/",testo) -- Trova la posizione della "/"
   if pos <> 0 -- Se la "/" c’è…
      attuale=""
      step i from 1 to pos-1 -- Trova il numero di pagina attuale
         attuale=attuale & char i of testo -- Concatena carattere i-esimo
      end
      format attuale as "?" -- Converte da stringa a decimale
      Prima=pageNumber of this page - attuale + 1 -- Prima pagina assoluta
      attuale=""
      step i from pos+1 to charCount(testo) -- Trova il numero totale
                                            -- di pagine
         attuale=attuale & char i of testo -- Concatena carattere i-esimo
      end
      format attuale as "?" -- Converte da stringa a decimale
      Ultima=prima+attuale-1 -- Ultima pagina assoluta della sez.
      ask "Go to page" with "1" -- Chiede all’utente quale pagina e
                                -- mette il risultato in It
      if It is not null and isType("word",It) -- Se è un numero ¹ 0
         format It as "?" -- Converte da stringa a decimale
         pagina=Prima+It-1 -- Pagina assoluta dove andare
         if pagina>=Prima and pagina <=Ultima -- Se è una pagina valida
            go to page pagina -- Va a quella pagina
         else -- Altrimenti…
            request "Sorry, there isn't that page"
      end
   end
end

to handle mouseEnter pos -- Al passaggio del mouse sopra il bottone
   system tempo
   sysTimeFormat="seconds"
   put sysTime into tempo
   item 1 of pos=item 1 of pos-1000
   item 2 of pos=item 2 of pos-300
   show field "paghelp" of background "sfondo" at pos
end

to handle mouseLeave pos -- All’uscita del mouse
   hide field "paghelp" of background "sfondo"
   system tempo
   tempo=0
end
 

to handle mouseEnter -- Al entrata sullo sfondo
   system timer -- Variabile globale, contatore di tempo
   timer=0
   sysCursor=default
   hide field sessione -- Nasconde i possibili campi attivi
   hide field paghelp of background sfondo
   hide field logo of background sfondo
   -- Non in tutte le pagine
   sysSuspend=false
   hide field fighelp
   sysSuspend=true
end
 
 

to handle idle -- Eseguito quando l’utente non fa niente
   system tempo -- Variabile globale, contatore di tempo
   system timer -- Variabile globale, secondo contatore di tempo
   if tempo<>0
      sysTimeFormat="seconds"
      put sysTime into corr -- trova il tempo attuale
      if corr-tempo>4 -- Nasconde le caselle di help dopo 4 secondi
         sysSuspend=false
         hide field sessione
         hide field "paghelp" of background sfondo
         hide field fighelp
         sysSuspend=true
      end
   end
    if timer=0
       sysTimeFormat="seconds"
       put sysTime into timer
    end
   if timer<>0
      sysTimeFormat="seconds"
      put sysTime into corr
      if corr-timer=90 -- Mostra i crediti dopo 90 secondi
         show viewer credit as modal
      end
   end
end
 
 

Next Page

Indice