home *** CD-ROM | disk | FTP | other *** search
/ Galleria D'arte: Manet / Manet.iso / Dati / Gadgets.dxr / Internal_11_stampacalendario.ls < prev    next >
Encoding:
Text File  |  2000-12-21  |  6.2 KB  |  191 lines

  1. global gDoc, gMese, gAnn, gPict
  2.  
  3. on mouseUp me
  4.   controllamesi()
  5. end
  6.  
  7. on controllamesi
  8.   elencostampa = []
  9.   repeat with i = 31 to 43
  10.     tmp = the member of sprite i
  11.     nome = member(tmp).name
  12.     if nome <> "dummymesi" then
  13.       append(elencostampa, i)
  14.     end if
  15.   end repeat
  16.   if count(elencostampa) > 0 then
  17.     stampa(elencostampa)
  18.   else
  19.     openMessageWindow("Prima di stampare ├¿ necessario selezionare le immagini da assegnare ad ogni mese." & RETURN & RETURN & "E' possibile stampare anche solo un mese o solo la copertina lasciando vuote le altre caselle.", "Galleria d'arte", "Warning")
  20.   end if
  21. end
  22.  
  23. on stampa elencostampa
  24.   if checkstampanti() = 1 then
  25.     exit
  26.   end if
  27.   sprite(60).visible = 1
  28.   member("stato di stampa").text = "Preparazione per la stampa in corso"
  29.   gDoc = new(xtra("printomatic"))
  30.   if objectp(gDoc) then
  31.     setDocumentName(gDoc, "Calendario" && gAnn && "- De Agostini")
  32.     setLandscapeMode(gDoc, 0)
  33.     setMargins(gDoc, rect(10, 10, 10, 10))
  34.     setTextFont(gDoc, "arial")
  35.     setTextSize(gDoc, 8)
  36.     if objectp(gDoc) then
  37.       lanciastampa(elencostampa)
  38.     end if
  39.   end if
  40. end
  41.  
  42. on lanciastampa elencostampa
  43.   cursor(4)
  44.   tmp = getOne(elencostampa, 43)
  45.   if tmp <> 0 then
  46.     deleteAt(elencostampa, tmp)
  47.     member("stato di stampa").text = "Formattazione copertina"
  48.     newPage(gDoc)
  49.     tmp = the member of sprite 43
  50.     gPict = member(tmp, "pict").name
  51.     put "1" into char 7 of gPict
  52.     newFrame(gDoc, rect(0, 5, 575, 655), 0)
  53.     x = getPageWidth(gDoc)
  54.     y = getPageHeight(gDoc)
  55.     w = member(gPict, "stampa").width
  56.     h = member(gPict, "stampa").height
  57.     if w < h then
  58.       nuovaW = w * 650 / h
  59.       puntoX = (x - nuovaW) / 2
  60.       puntoY = puntoX + nuovaW
  61.       drawPicture(gDoc, member("cpyrght", "calendario"), rect(5, 5, 12, 575))
  62.       drawPicture(gDoc, member(gPict, "stampa"), rect(puntoX, 5, puntoY, 655))
  63.       newFrame(gDoc, rect(puntoX, 655, puntoY, 685), 0)
  64.       put "4" into char 7 of gPict
  65.       the itemDelimiter = "#"
  66.       repeat with i = 1 to the number of lines in field "titolo#nomefile"
  67.         if item 2 of line i of field "titolo#nomefile" = gPict then
  68.           titquadro = item 1 of line i of field "titolo#nomefile"
  69.           exit repeat
  70.         end if
  71.       end repeat
  72.       nomepittore = the text of field "nomepittore" of castLib "common"
  73.       titquadro = nomepittore & "." && titquadro
  74.       append(gDoc, titquadro)
  75.     else
  76.       nuovaW = x
  77.       nuovaH = nuovaW * h / w
  78.       puntoX = (650 - nuovaH) / 2
  79.       puntoY = puntoX + nuovaH
  80.       drawPicture(gDoc, member("cpyrght", "calendario"), rect(5, puntoX, 12, 575))
  81.       drawPicture(gDoc, member(gPict, "stampa"), rect(12, puntoX, 560, puntoY))
  82.       newFrame(gDoc, rect(12, puntoY, 560, puntoY + 30), 0)
  83.       put "4" into char 7 of gPict
  84.       the itemDelimiter = "#"
  85.       repeat with i = 1 to the number of lines in field "titolo#nomefile"
  86.         if item 2 of line i of field "titolo#nomefile" = gPict then
  87.           titquadro = item 1 of line i of field "titolo#nomefile"
  88.           exit repeat
  89.         end if
  90.       end repeat
  91.       nomepittore = the text of field "nomepittore" of castLib "common"
  92.       titquadro = nomepittore & "." && titquadro
  93.       append(gDoc, titquadro)
  94.     end if
  95.     newFrame(gDoc, rect(18, 685, 557, 800), 0)
  96.     anno = string(gAnn)
  97.     drawPicture(gDoc, member(anno, "calendario"), rect(18, 685, 557, 800))
  98.   end if
  99.   repeat with q = 1 to count(elencostampa)
  100.     i = getAt(elencostampa, q)
  101.     newPage(gDoc)
  102.     tmp = the member of sprite i
  103.     gPict = member(tmp, "pict").name
  104.     put "1" into char 7 of gPict
  105.     case i of
  106.       31:
  107.         mese = "Gen"
  108.       32:
  109.         mese = "Feb"
  110.       33:
  111.         mese = "Mar"
  112.       34:
  113.         mese = "Apr"
  114.       35:
  115.         mese = "Mag"
  116.       36:
  117.         mese = "Giu"
  118.       37:
  119.         mese = "Lug"
  120.       38:
  121.         mese = "Ago"
  122.       39:
  123.         mese = "Set"
  124.       40:
  125.         mese = "Ott"
  126.       41:
  127.         mese = "Nov"
  128.       42:
  129.         mese = "Dic"
  130.     end case
  131.     member("stato di stampa").text = "Formattazione mese:   " && mese && gAnn
  132.     newFrame(gDoc, rect(0, 0, 575, 565), 0)
  133.     x = getPageWidth(gDoc)
  134.     y = getPageHeight(gDoc)
  135.     w = member(gPict, "stampa").width
  136.     h = member(gPict, "stampa").height
  137.     if w < h then
  138.       nuovaW = w * 565 / h
  139.       puntoX = (x - nuovaW) / 2
  140.       puntoY = puntoX + nuovaW
  141.       drawPicture(gDoc, member("cpyrght", "calendario"), rect(5, 5, 12, 575))
  142.       drawPicture(gDoc, member(gPict, "stampa"), rect(puntoX, 5, puntoY, 565))
  143.       newFrame(gDoc, rect(puntoX, 565, puntoY, 595), 0)
  144.       put "4" into char 7 of gPict
  145.       the itemDelimiter = "#"
  146.       repeat with i = 1 to the number of lines in field "titolo#nomefile"
  147.         if item 2 of line i of field "titolo#nomefile" = gPict then
  148.           titquadro = item 1 of line i of field "titolo#nomefile"
  149.           exit repeat
  150.         end if
  151.       end repeat
  152.       nomepittore = the text of field "nomepittore" of castLib "common"
  153.       titquadro = nomepittore & "." && titquadro
  154.       append(gDoc, titquadro)
  155.     else
  156.       nuovaW = x
  157.       nuovaH = nuovaW * h / w
  158.       puntoX = (565 - nuovaH) / 2
  159.       puntoY = puntoX + nuovaH
  160.       drawPicture(gDoc, member("cpyrght", "calendario"), rect(5, puntoX, 12, 575))
  161.       drawPicture(gDoc, member(gPict, "stampa"), rect(12, puntoX, 560, puntoY))
  162.       newFrame(gDoc, rect(12, puntoY - 5, 560, puntoY + 25), 0)
  163.       put "4" into char 7 of gPict
  164.       the itemDelimiter = "#"
  165.       repeat with i = 1 to the number of lines in field "titolo#nomefile"
  166.         if item 2 of line i of field "titolo#nomefile" = gPict then
  167.           titquadro = item 1 of line i of field "titolo#nomefile"
  168.           exit repeat
  169.         end if
  170.       end repeat
  171.       nomepittore = the text of field "nomepittore" of castLib "common"
  172.       titquadro = nomepittore & "." && titquadro
  173.       append(gDoc, titquadro)
  174.     end if
  175.     anno = string(gAnn)
  176.     newFrame(gDoc, rect(18, 600, 557, 770), 0)
  177.     cal = mese & anno
  178.     drawPicture(gDoc, member(cal, "calendario"), rect(18, 600, 557, 770))
  179.   end repeat
  180.   cursor(-1)
  181.   member("stato di stampa").text = "Impostazioni stampante"
  182.   if doJobSetup(gDoc) = 1 then
  183.     member("stato di stampa").text = "Stampa in corso"
  184.     print(gDoc)
  185.   end if
  186.   member("stato di stampa").text = EMPTY
  187.   sprite(60).visible = 0
  188.   unLoad()
  189.   gDoc = 0
  190. end
  191.