home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 2 / BBS in a box - Trilogy II.iso / Files / Hyper / Q-R / ResGenie™ 1.0 / ResGenie™ / ResGenie™.rsrc / TEXT_162_ScalePath.txt < prev    next >
Encoding:
Text File  |  1993-08-02  |  15.3 KB  |  419 lines

  1. --  colorizeHC "add", "HD:Desktop Folder:PICT:Browse Resources", "90,134,254,172", , "copy with dithering"
  2. --  ,HD:Desktop Folder:PICT:Browse Resources,  <-- This (item 2 of line 2) is the full path name of my current picture
  3. --   HD:Desktop Folder:PICT: <-- This is the path to pictures
  4. --  Browse Resources <-- This (word 2 of line 4) is the name of the PICT file that I will open
  5.  
  6. on mouseUp
  7.   if the short name of me is "Scaling Path" then
  8.     newfile
  9.     put "Click on the button again to make it scale"
  10.     exit mouseup
  11.   end if
  12.   global Tools
  13.   if the shiftkey is down and the optionkey is down then
  14.     changeAttributes
  15.     exit mouseup
  16.   end if
  17.   if the shiftkey is down and the commandkey is down then
  18.     checkTools
  19.     if Tools is not "Nope" then
  20.       newClipPict
  21.       exit mouseup
  22.     else exit mouseup
  23.   end if
  24.   if the optionKey is down then
  25.     locateme
  26.     readytoScript
  27.     exit mouseup
  28.   end if
  29.   if the commandKey is down then
  30.     newFile
  31.     exit mouseup
  32.   end if
  33.   if the shiftKey is down then
  34.     deleteLastColor
  35.     colorizeHC "Erase", rect of me
  36.     set the showName of me to true
  37.     go to this cd
  38.     exit mouseup
  39.   end if
  40.   togglePicture
  41. end mouseup
  42.  
  43. on newClipPict
  44.   global myPicture
  45.   get FullSFPack (P,,,"Name your new PICT file:", "Untitled")
  46.   if it is empty then exit newClipPict
  47.   put it into holdPictName
  48.   put holdPictName into myPicture
  49.   answer "Create thumbnail custom icon for your new PICT file?"¬¨
  50.   with "No" or "Yes"
  51.   if it is "Yes" then
  52.     ClipToPICT holdPictName
  53.     if the result ‚↠empty  then
  54.       answer the Result
  55.       exit newClipPict
  56.     end if
  57.     CreateCustomIcon holdPictName
  58.     if the result ‚↠empty
  59.     then answer the Result
  60.     dothePicture
  61.     exit newClipPict
  62.   end if
  63.   ClipToPICT holdPictName
  64.   if the result ‚↠empty  then
  65.     answer the Result
  66.     exit newClipPict
  67.   end if
  68.   dothePicture
  69. end newClipPict
  70.  
  71.  
  72. on togglePicture
  73.   locateme
  74.   if the showName of me is true then
  75.     put line 1 of the script of me into colorCommand
  76.     delete word 1 of colorCommand
  77.     do colorCommand
  78.     set the showName of me to false
  79.     go to this cd
  80.   else
  81.     set the lockscreen to true
  82.     colorizeHC "Erase", rect of me
  83.     set the showName of me to true
  84.     go to this cd
  85.   end if
  86. end togglePicture
  87.  
  88.  
  89.  
  90. on locateMe
  91.   put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  92.   item 2 of line 2 of the script of me & quote & ","   ¬¨
  93.   && quote & the rect of me & quote & "," &&  "," && quote & "copy with dithering" & quote into line 1 of insertLine
  94.   put the script of me into holdScript
  95.   put line 1 of insertLine into line 1 of holdScript
  96.   set the script of me to holdScript
  97. end locateMe
  98.  
  99.  
  100. on newFile
  101.   global myPicture
  102.   answer file "Choose your picture:" of type PICT
  103.   if it is empty then exit newFile
  104.   put it into myPicture
  105.   dothePicture
  106. end newFile
  107.  
  108. on dothePicture
  109.   global myPicture
  110.   -- put "Look inside the button script for the path you just set" into message
  111.   colorizeHC "Erase", rect of me
  112.   go to this cd
  113.   colorizeHC "Add",  myPicture , TopLeft of me, rect of me
  114.   set the showName of me to false
  115.   go to this cd
  116.   put the script of me into holdScript
  117.   put "-- " && "colorizeHC" && quote & "Add" & quote & "," && quote & myPicture & quote & ¬¨
  118.   "," && quote & TopLeft of me & quote & "," && quote & rect of me & quote into holdLine
  119.   put holdLine into line 1 of holdScript
  120.   put "-- " && "," & myPicture & "," && " <-- This (item 2 of line 2) is the full path name of my current picture" into line 2 of holdScript
  121.   put myPicture into process
  122.   get the last char of process
  123.   if it is ":" then
  124.     exit dothePicture
  125.     answer "Try later with a better picture name." with "I know"
  126.   end if
  127.   if it is not ":" then
  128.     put it into holdPictName
  129.     delete last char of process
  130.     repeat until it is ":"
  131.       get the last char of process
  132.       if it is not ":" then  put it before char 1 of holdPictName
  133.       delete the last char of process
  134.     end repeat
  135.   end if
  136.   put "--  " && process & ":" && "<-- This is the path to pictures" into line 3 of holdScript
  137.   put "-- " && holdPictName && "<-- This (word 2 of line 4) is the name of the PICT file that I will open" into line 4 of holdScript
  138.   set the script of me to holdScript
  139.   put word 2 of line 4 of the script of me && the id of me into newName
  140.   set the name of me to newName
  141.   go to this cd
  142. end dothePicture
  143.  
  144.  
  145. on checkTools
  146.   global Tools
  147.   get the short name of this stack
  148.   if it is "ResGenie‚Ñ¢" then
  149.     put "Yep" into Tools
  150.     exit checkTools
  151.   end if
  152.   do get offset ("ResGenie‚Ñ¢", the stacksinuse)
  153.   if it is not "0" then
  154.     put "Yes" into tools
  155.     exit checktools
  156.   end if
  157.   if it is "0" then
  158.     answer "You need to use" && quote & "ResGenie‚Ñ¢" & quote &¬¨
  159.     "for this feature to work." with "Cancel" or "Use"
  160.     if it is "Use" then
  161.       start using stack "ResGenie‚Ñ¢"
  162.       put "Yes" into Tools
  163.     else
  164.       if it is "Cancel" then
  165.         put "Nope" into Tools
  166.       end if
  167.     end if
  168.   end if
  169. end checkTools
  170.  
  171.  
  172. on newbutton
  173.   put word 2 of line 4 of the script of me && the id of me into newName
  174.   set the name of me to newName
  175. end newbutton
  176.  
  177. on deletebutton
  178.   colorizeHC "erase", the rect of me
  179. end deletebutton
  180.  
  181.  
  182. on readytoScript
  183.   set cursor to watch
  184.   put "Now checking all scripts..."
  185.   global holdScript
  186.   global colorauthoringpath
  187.   get offset ("makeitcolor", the script of this stack)
  188.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  189.   get offset ("on makeitcolor", the script of this bg)
  190.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  191.   get offset ("on makeitcolor", the script of this cd)
  192.   if it is "0" then do restext ("TEXT", "colorscriptsmoothe", colorauthoringpath)
  193.   set the showname of me to true
  194.   togglepicture
  195.   put line 1 of the script of me into line 1 of insertLine
  196.   delete word 1 of insertLine
  197.   put the name of me into check
  198.   if word 1 of check is "bkgnd" then
  199.     put the script of this bg into holdScript
  200.     put "bg" into wheretoGo
  201.     put "send makeitcolor to this cd" into whattoSee
  202.     put the name of this bg into myName
  203.   end if
  204.   if word 1 of check is "card" then
  205.     put the script of this cd into holdScript
  206.     put "cd" into wheretoGo
  207.     put "end makeitcolor" into whattoSee
  208.     put the name of this cd into myName
  209.   end if
  210.   
  211.   get offset (insertLine, holdScript)
  212.   if it is not "0" then
  213.     answer "This picture has already been added here. Do you want to convert this to an ordinary button now?"¬¨
  214.     with "Yes" or "No"
  215.     if it is "Yes" then
  216.      do showdialog 3, "510",  , ,short name of me , "7",,
  217.       if the result is empty then exit readytoscript
  218.       put the result into hold
  219.       if line 1 of hold is "6" then set the style of me to "Transparent"
  220.       if line 1 of hold is "5" then
  221.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  222.         select hold
  223.         domenu "Clear Button"
  224.         choose browse tool
  225.         set lockscreen to true
  226.         opencard
  227.         exit readytoscript
  228.       end if
  229.       set the name of me to line 2 of hold
  230.       put "on mouseup" into line 1 of temp
  231.       put "   " into line 2 of temp
  232.       put "end mouseup" into line 3 of temp
  233.       set the script of me to temp
  234.     end if
  235.     exit readytoscript
  236.     if it is "No" then exit readytoscript
  237.   end if
  238.   put quote & rect of me & quote into checkRegion
  239.   get offset (checkRegion, holdScript)
  240.   if it is  "0" then
  241.     do put offset (whattoSee, holdscript)  into whereGo
  242.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  243.     do set the script of  myName to holdScript
  244.     do put "This picture has been added to" && the name of wheretoGo into message
  245.     answer "Do you want to convert this to an ordinary button now?"¬¨
  246.     with "Yes" or "No"
  247.     if it is "Yes" then
  248.      do showdialog 3, "510",  , ,short name of me , "7",,
  249.       if the result is empty then exit readytoscript
  250.       put the result into hold
  251.       if line 1 of hold is "6" then set the style of me to "Transparent"
  252.       if line 1 of hold is "5" then
  253.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  254.         select hold
  255.         domenu "Clear Button"
  256.         choose browse tool
  257.         set lockscreen to true
  258.         opencard
  259.         exit readytoscript
  260.       end if
  261.       set the name of me to line 2 of hold
  262.       put "on mouseup" into line 1 of temp
  263.       put "   " into line 2 of temp
  264.       put "end mouseup" into line 3 of temp
  265.       set the script of me to temp
  266.     end if
  267.     exit readytoscript
  268.   end if
  269.   if it is not "0" then
  270.     answer "You are painting in an area already painted. This is not necessarily a problem, but painting the same region twice will take longer." ¬¨
  271.     with "Cancel" or "Continue"
  272.   end if
  273.   if it is "Cancel" then exit readytoScript
  274.   if it is "Continue" then
  275.     do put offset (whattoSee, holdscript)  into whereGo
  276.     put insertLine & return before char  whereGo of holdScript -- this should add the new colors
  277.     do set the script of  myName to holdScript
  278.     do put "This overlapping color has been added to" && the name of wheretoGo into message
  279.     answer "Do you want to convert this to an ordinary button now?"¬¨
  280.     with "Yes" or "No"
  281.     if it is "Yes" then
  282.      do showdialog 3, "510",  , ,short name of me , "7",,
  283.       if the result is empty then exit readytoscript
  284.       put the result into hold
  285.       if line 1 of hold is "6" then set the style of me to "Transparent"
  286.       if line 1 of hold is "5" then
  287.         put word 1 to 2 of the  name of me && "id" && the id of me into hold
  288.         select hold
  289.         domenu "Clear Button"
  290.         choose browse tool
  291.         set lockscreen to true
  292.         opencard
  293.         exit readytoscript
  294.       end if
  295.       set the name of me to line 2 of hold
  296.       put "on mouseup" into line 1 of temp
  297.       put "   " into line 2 of temp
  298.       put "end mouseup" into line 3 of temp
  299.       set the script of me to temp
  300.     end if
  301.     exit readytoscript
  302.   end if
  303. end readytoScript
  304.  
  305. on deleteLastColor
  306.   put line 1 of the script of me into line 1 of insertLine
  307.   delete word 1 of insertLine
  308.   put the name of me into check
  309.   if word 1 of check is "bkgnd" then
  310.     put the script of this bg into holdscript
  311.     put "bg" into wheretoGo
  312.     put the name of this bg into myName
  313.   else
  314.     put the script of this cd into holdScript
  315.     put "cd" into wheretoGo
  316.     put the name of this cd into myName
  317.   end if
  318.   get offset (insertLine, holdScript)
  319.   if it is  0 then
  320.     answer "This picture has already been deleted" with "Okay"
  321.     exit deleteLastColor
  322.   end if
  323.   get offset ("add", holdScript)
  324.   if it  is 0 then
  325.     answer "You have already erased all the pictures here" with "I knew that"
  326.     exit deleteLastColor
  327.   end if
  328.   put the number of lines of char 1 to offset(insertLine, holdScript) ¬¨
  329.   of holdscript into KillLine
  330.   delete line KillLine of holdScript
  331.   colorizeHC "Erase", rect of me
  332.   go to this cd
  333.   do put "This picture has been removed from" && the name of wheretoGo into message
  334.   do set the script of myName to holdScript
  335. end deleteLastColor
  336.  
  337. on changeAttributes
  338.   put "--" into test --  because using "--" in a repeat structure causes format trouble
  339.   answer "Do you want this button to create a" && quote & "scaling" & quote && "picture?"¬¨
  340.   with "Cancel" or "Scaling" or "Normal"
  341.   if it is "Cancel" then exit changeAttributes -- 1 major end if
  342.   put the script of me into holdScript
  343.   put offset ("on locateMe", holdScript) into startPoint
  344.   put startPoint into oldStart
  345.   put offset ("end locateMe", holdScript) + 11 into endPoint
  346.   put char startpoint to endPoint of holdScript into newLocateMe
  347.   delete char startpoint to endPoint of holdScript
  348.   put offset ("put", newLocateMe) into startPoint
  349.   put offset ("insertline", newLocateMe) + 10 into endPoint
  350.   delete char startPoint to endPoint of newLocateMe
  351.   colorizeHC "erase", the rect of me
  352.   set the showName of me to false
  353.   if it is "Normal" then
  354.     --  foop put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  355.     --  item 2 of line 2 of the script of me & quote & ","   ¬¨
  356.     --  && quote & the topleft of me & quote & "," && quote & the rect of me & quote & "," && quote & "transparent" & quote into line 1 of insertLine -- endfoop
  357.     put offset ("foop", holdScript) + 4 into startpoint
  358.     put offset ("endfoop", holdScript) - 4 into stopPoint
  359.     put char startpoint to stoppoint of holdScript into holdCommand
  360.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  361.     "Transparent" or "Opaque"
  362.     if it is "Transparent" then
  363.       repeat with x = 1 to the number of lines of holdCommand
  364.         get word 1 of line x of holdCommand
  365.         if it is test then delete word 1 of line x of holdCommand
  366.       end repeat
  367.       put return & holdCommand  after line 1 of newLocateme
  368.       put newLocateme & return into char oldStart of holdScript
  369.       colorizeHC "Add", item 2 of line 2 of the script of me, the topleft of me , the rect of me, "transparent"
  370.     end if --  **
  371.     if it is "Opaque" then
  372.       put offset ("the rect of me", holdCommand) into startpoint
  373.       put the number of chars of holdCommand into endPoint
  374.       delete char startpoint to endPoint of holdCommand
  375.       put space & "rect of me & quote into line 1 of insertline" after last char of holdCommand
  376.       repeat with x = 1 to the number of lines of holdCommand
  377.         get word 1 of line x of holdCommand
  378.         if it is test then delete  word 1 of line x of holdCommand
  379.       end repeat
  380.       put return & holdCommand  after line 1 of newLocateme
  381.       put newLocateme & return into char oldStart of holdScript
  382.       colorizeHC "Add", item 2 of line 2 of the script of me, the topleft of me, the rect of me
  383.     end if -- **
  384.   end if -- **  end Normal branch
  385.   if it is "Scaling" then
  386.     --  boink put "-- " && "colorizeHC" && quote & "add" & quote & "," && quote &¬¨
  387.     --  item 2 of line 2 of the script of me & quote & ","   ¬¨
  388.     --  && quote & the rect of me & quote & "," &&  "," && quote & "copy with dithering" & quote into line 1 of insertLine -- endboink
  389.     put offset ("boink", holdScript) + 5 into startpoint
  390.     put offset ("endboink", holdScript) - 4 into stopPoint
  391.     put char startpoint to stoppoint of holdScript into holdCommand
  392.     answer "Do you want an opaque or transparent picture to be used?" with¬¨
  393.     "Transparent" or "Opaque"
  394.     if it is "Opaque" then
  395.       repeat with x = 1 to the number of lines of holdCommand
  396.         get word 1 of line x of holdCommand
  397.         if it is test then delete word 1 of line x of holdCommand
  398.       end repeat
  399.       put return & holdCommand  after line 1 of newLocateme
  400.       put newLocateme & return into char oldStart of holdScript
  401.       colorizeHC "Add", item 2 of line 2 of the script of me,  the rect of me ,, "copy with dithering"
  402.     end if -- **
  403.     if it is "Transparent" then
  404.       put offset ("copy", holdCommand) into startpoint -- because the default phrase was with "copy"
  405.       put startpoint + 4 into stoppoint
  406.       delete char startpoint to  stoppoint of holdCommand
  407.       put  "transparent" & space before char startpoint of holdCommand
  408.       repeat with x = 1 to the number of lines of holdCommand
  409.         get word 1 of line x of holdCommand
  410.         if it is test then delete word 1 of line x of holdCommand
  411.       end repeat
  412.       put return & holdCommand  after line 1 of newLocateme
  413.       put newLocateme & return into char oldStart of holdScript
  414.       colorizeHC "Add", item 2 of line 2 of the script of me,  the rect of me,, "transparent with dithering"
  415.     end if -- **
  416.   end if -- **  Should end Scaling branch
  417.   set the script of me to holdScript
  418.   go to this cd
  419. end changeAttributes