REVO2700 d PictureChooser 3 @ l @| on closeStackRequest end closeStackRequest on preOpenStack -- center the stack on the main screen global driveInUse put "hd" into driveInUse --FOR HIDDEN TOGGLE REFRESH Global MyDir put the defaultfolder into MyDir show_drives set the loc of this stack to the screenLoc set the left of this stack to 0 set the top of this stack to 28 resizeStack pass preOpenStack end preOpenStack on resumeStack Global AdjustingWindow if AdjustingWindow = 1 then pass resumeStack Global Init Global ScreenInfo Global ScreenWidth Global ScreenHeight Global GapOnRight ----------------------------------------------------------------------------------------- Global GotPathAlready if GotPathAlready = 0 then resizeStack --******************* end if end resumeStack on resizeStack Global AdjustingWindow if AdjustingWindow = 1 then pass resizeStack Global Init Global ScreenInfo Global ScreenWidth Global ScreenHeight Global GapOnRight if Init = 1 then Global WidgetWidth Global WidgetHeight Position_Controls pass resizeStack --************** end if put the screenRect into ScreenInfo ----By default, the itemdelimeter is set to "," put item 3 of ScreenInfo into ScreenWidth put item 4 of ScreenInfo into ScreenHeight set the left of image "Image1" to 0 set the top of image "Image1" to 0 -------------------------------------------------------------------------------------------- --Card1: set the left of field "List1" of card "Card1" to 50 set the top of field "List1" of card "Card1" to 65 set the height of field "List1" of card "Card1" to ScreenHeight - 200 set the width of field "List1" of card "Card1" to 50 * (ScreenWidth / 100) set the height of field "List2" of card "Card1" to the height of field "List1" of card "Card1" set the top of field "List2" of card "Card1" to the top of field "List1" of card "Card1" set the left of field "List2" of card "Card1" to the right of field "List1" of card "Card1" put (ScreenWidth - the left of field "List2" of card "Card1") into GapOnRight set the width of field "List2" of card "Card1" to GapOnRight - 50 show_drives get_ini_parameters call mouseDown of field "DriveField" of card "Card1" delete line 1 of field "List1" of card "Card1" --------------------------------------------------- Global SourceDirectory$ --e.g. c:\ Global StartupPath$ --e.g. c:\francis\posto if the number of chars in StartupPath$ > the number of chars in SourceDirectory$ then get_startup_folder put field "List1" of card "Card1" into field "plain" of card "Card1" --NEW******************* call prettify_List1 of this stack end if --------------------------------------------------- Global InitialLeftOfPreviewBox Global InitialTopOfPreviewBox Global InitialWidthOfPreviewBox Global InitialHeightOfPreviewBox put the left of image "Preview" into InitialLeftOfPreviewBox put the top of image "Preview" into InitialTopOfPreviewBox put the width of image "Preview" into InitialWidthOfPreviewBox put the height of image "Preview" into InitialHeightOfPreviewBox put 1 into Init end resizeStack ---------------------------------------------------------------------------------------------- on show_drives Global AdjustingWindow if AdjustingWindow = 1 then pass show_drives Global DoingDiskError if DoingDiskError = 1 then put 0 into DoingDiskError pass show_drives end if call mouseDown of field "DriveField" of card "Card1" end show_drives ---------------------------------------------------------------------------------------------- on get_ini_parameters Global AdjustingWindow if AdjustingWindow = 1 then pass get_ini_parameters Global SourceDirectory$ Global CDDirectory$ --NEW FOR UNIVERSAL EDITION Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION Global IndentSize Global TreeFontname$ Global TreeFontsize Global TreeFontbold$ Global TreeFontitalic$ Global NumberOfDrives Global tempForeColour Global tempBackColour Global WidgetLeftPosition Global WidgetTopPosition Global WidgetWidth Global WidgetHeight Global ProgramWindowIsMinimized if ProgramWindowIsMinimized = 1 then put 0 into ProgramWindowIsMinimized pass get_ini_parameters end if set the left of image "Image1" of card "Card1" to 0 set the top of image "Image1" of card "Card1" to 0 put URL "file:_picture_chooser.ini" into field "IniParametersField" of card "Card4" of this stack ----------------------------------------- --Startup drive (e.g. Windows only c:\): --In Linux, startup folders can begin as follows: --/ --/media/floppy0 or just "floppy" or "diskette" --/media/cdrom0 or just "cd" or "cdrom" --In the above optional startup drive specifications, you need to check for UCase, trailing slashes, etc. --Specifications such as floppy/subfolder should not be permitted. These should be specified as /media/floppy0/subfolder --Number of spaces for indents (e.g. 8): --Fontname (e.g. Arial): --Fontsize (e.g. 12): --Bold (yes or no): --Italic (yes or no): --Window left position (nnn or centre or center): --Window right position (nnn or centre or center): --Window width (nnn - min=320): --Window height (nnn - min=240): ----------------------------------------- --go Card4 --TEMP ONLY put line 1 of field "IniParametersField" of card "Card4" of this stack into SourceDirectory$ --e.g. "c:\" SourceDirectory$ if the charToNum of the last char of SourceDirectory$ is 13 then --LINUX only put char 1 to -2 of SourceDirectory$ into SourceDirectory$ end if --/ --/media/floppy0 or just "floppy" or "diskette" --/media/cdrom0 or just "cd" or "cdrom" --Changed for UBUNTU later versions: --if toLower(SourceDirectory$) = "floppy" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy0/" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom0/" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "floppy" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$ --REMOVED IN UNIVERSAL EDITION: --if toLower(SourceDirectory$) = "floppy" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/fd0/" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$ --Global CDDirectory$ --NEW FOR UNIVERSAL EDITION --Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION put line 2 of field "IniParametersField" of card "Card4" of this stack into CDDirectory$ --NEW FOR UNIVERSAL EDITION put line 3 of field "IniParametersField" of card "Card4" of this stack into FloppyDirectory$ --NEW FOR UNIVERSAL EDITION if the charToNum of the last char of CDDirectory$ is 13 then --LINUX only put char 1 to -2 of CDDirectory$ into CDDirectory$ end if if the charToNum of the last char of FloppyDirectory$ is 13 then --LINUX only put char 1 to -2 of FloppyDirectory$ into FloppyDirectory$ end if --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 2 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize --put line 3 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$ --put line 4 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize --put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$ --put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ put line 4 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$ put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize put line 7 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$ put line 8 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ if the charToNum of the last char of IndentSize is 13 then --LINUX only put char 1 to -2 of IndentSize into IndentSize end if if the charToNum of the last char of TreeFontname$ is 13 then --LINUX only put char 1 to -2 of TreeFontname$ into TreeFontname$ end if if the charToNum of the last char of TreeFontsize is 13 then --LINUX only put char 1 to -2 of TreeFontsize into TreeFontsize end if if the charToNum of the last char of TreeFontbold$ is 13 then --LINUX only put char 1 to -2 of TreeFontbold$ into TreeFontbold$ end if if the charToNum of the last char of TreeFontitalic$ is 13 then --LINUX only put char 1 to -2 of TreeFontitalic$ into TreeFontitalic$ end if put word 1 to -1 of SourceDirectory$ into SourceDirectory$ Global StartupPath$ put SourceDirectory$ into StartupPath$ --e.g. c:\francis\posto or c:\francis\posto\ (Windows) if the last char of StartupPath$ = "/" then --LINUX put char 1 to -2 of StartupPath$ into StartupPath$ end if --put char 1 to 3 of SourceDirectory$ into SourceDirectory$ --e.g. c:\ --REMOVED FOR LINUX --SourceDirectory$ can be: --"/" --"/media/floppy0/****************" (perhaps with some UCase) --"/media/cdrom0/****************" (perhaps with some UCase) --put toLower(SourceDirectory$) into SourceDirectory$ --WRONG! REMOVED FOR UNIVERSAL EDITION --Changed for UBUNTU later versions: --if char 1 to 14 of SourceDirectory$ = "/media/floppy0" then put "/media/floppy0" into SourceDirectory$ --if char 1 to 13 of SourceDirectory$ = "/media/cdrom0" then put "/media/cdrom0" into SourceDirectory$ --if char 1 to 14 of SourceDirectory$ <> "/media/floppy0" and char 1 to 13 of SourceDirectory$ <> "/media/cdrom0" then put "/" into SourceDirectory$ ----if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/floppy" into SourceDirectory$ --if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/fd0" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION --if char 1 to 12 of SourceDirectory$ = "/media/cdrom" then put "/media/cdrom" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION ----if char 1 to 13 of SourceDirectory$ <> "/media/floppy" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$ --if char 1 to 10 of SourceDirectory$ <> "/media/fd0" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION --put word 1 to -1 of IndentSize into IndentSize put word 1 to -1 of TreeFontname$ into TreeFontname$ --put word 1 to -1 of TreeFontsize into TreeFontsize put word 1 to -1 of TreeFontbold$ into TreeFontbold$ put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$ if SourceDirectory$ = "" then put "/" into SourceDirectory$ --LINUX if IndentSize = "" then put 4 into IndentSize if TreeFontname$ = "" then put "default" into TreeFontname$ if TreeFontsize = "" then put 14 into TreeFontsize if TreeFontbold$ = "" then put "no" into TreeFontbold$ if TreeFontitalic$ = "" then put "no" into TreeFontitalic$ put the toLower of TreeFontbold$ into TreeFontbold$ put the toLower of TreeFontitalic$ into TreeFontitalic$ set the textFont of field "List1" to TreeFontname$ set the textFont of field "List2" to TreeFontname$ set the textFont of button "Filters" to TreeFontname$ set the textFont of button "Cancel" to TreeFontname$ set the textFont of button "OK" to TreeFontname$ set the textFont of field "suggestedFilename" to TreeFontname$ set the textSize of field "List1" to TreeFontsize set the textSize of field "List2" to TreeFontsize --set the textSize of button "Filters" to TreeFontsize --set the textSize of button "Cancel" to TreeFontsize --set the textSize of button "OK" to TreeFontsize set the textSize of field "suggestedFilename" to TreeFontsize if TreeFontbold$ = "yes" then set the textStyle of field "List1" to "bold" set the textStyle of field "List2" to "bold" --set the textStyle of button "Filters" to "bold" --set the textStyle of button "Cancel" to "bold" --set the textStyle of button "OK" to "bold" set the textStyle of field "suggestedFilename" to "bold" end if if TreeFontitalic$ = "yes" then set the textStyle of field "List1" to "italic" set the textStyle of field "List2" to "italic" set the textStyle of button "Filters" to "italic" set the textStyle of button "Cancel" to "italic" set the textStyle of button "OK" to "italic" set the textStyle of field "suggestedFilename" to "italic" end if if TreeFontbold$ = "yes" and TreeFontitalic$ = "yes" then set the textStyle of field "List1" to "bold,italic" set the textStyle of field "List2" to "bold,italic" --set the textStyle of button "Filters" to "bold,italic" --set the textStyle of button "Cancel" to "bold,italic" --set the textStyle of button "OK" to "bold,italic" set the textStyle of field "suggestedFilename" to "bold,italic" end if set the height of field "suggestedFileName" to the textheightSum of field "suggestedFileName" --NEW --SourceDirectory$ --put the first character of SourceDirectory$ into tempVar --NOT LINUX --SourceDirectory$ can be: --"/" --"/media/floppy0" --"/media/cdrom0" put SourceDirectory$ into tempVar -- tempVar can be: --"/" --"/media/floppy0" --"/media/cdrom0" put 255,255,255 into tempBackColour --******************************* put 0,0,215 into tempForeColour ----------------------------------------- global AdjustingWindow put 1 into AdjustingWindow ----------------------------------------- --Window left position (nnn or centre or center): --Window top position (nnn or centre or center): --Window width (nnn - min=320): --Window height (nnn - min=240): --Main background colour (e.g. grey or gray or 128,128,128 or #808080): --Main font colour (e.g. grey or gray or 128,128,128 or #808080): --Button background colour (e.g. grey or gray or 128,128,128 or #808080): --Button font colour (e.g. grey or gray or 128,128,128 or #808080): ----------------------------------------- --Example only: --put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ --put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$ --put the toLower of TreeFontitalic$ into TreeFontitalic$ --if TreeFontitalic$ = "" then put "no" into TreeFontitalic$ ----------------------------------------- --Widget left position (nnn or centre or center): --Widget top position (nnn or centre or center): --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 7 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition --put line 8 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition ---------------------------------------------------------- --put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth --put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight Global OutputMode$ --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 11 of field "IniParametersField" of card "Card4" of this stack into OutputMode$ put line 13 of field "IniParametersField" of card "Card4" of this stack into OutputMode$ ------------------------------------------------------------------- if the charToNum of the last char of WidgetLeftPosition is 13 then --LINUX only put char 1 to -2 of WidgetLeftPosition into WidgetLeftPosition end if if the charToNum of the last char of WidgetTopPosition is 13 then --LINUX only put char 1 to -2 of WidgetTopPosition into WidgetTopPosition end if if the charToNum of the last char of WidgetWidth is 13 then --LINUX only put char 1 to -2 of WidgetWidth into WidgetWidth end if if the charToNum of the last char of WidgetHeight is 13 then --LINUX only put char 1 to -2 of WidgetHeight into WidgetHeight end if if the charToNum of the last char of OutputMode$ is 13 then --LINUX only put char 1 to -2 of OutputMode$ into OutputMode$ end if Global PreviewPictureHeight --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 12 of field "IniParametersField" of card "Card4" of this stack into PreviewPictureHeight put line 14 of field "IniParametersField" of card "Card4" of this stack into PreviewPictureHeight ---------------------------------------------------------------------- if the charToNum of the last char of PreviewPictureHeight is 13 then --LINUX only put char 1 to -2 of PreviewPictureHeight into PreviewPictureHeight end if put word 1 to -1 of WidgetLeftPosition into WidgetLeftPosition put word 1 to -1 of WidgetTopPosition into WidgetTopPosition put word 1 to -1 of WidgetWidth into WidgetWidth put word 1 to -1 of WidgetHeight into WidgetHeight put word 1 to -1 of OutputMode$ into OutputMode$ put word 1 to -1 of PreviewPictureHeight into PreviewPictureHeight put the toLower of WidgetLeftPosition into WidgetLeftPosition put the toLower of WidgetTopPosition into WidgetTopPosition put the toLower of WidgetWidth into WidgetWidth put the toLower of WidgetHeight into WidgetHeight put the toLower of OutputMode$ into OutputMode$ put the toLower of PreviewPictureHeight into PreviewPictureHeight if WidgetLeftPosition = "" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetTopPosition = "" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetLeftPosition = "center" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetTopPosition = "center" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if PreviewPictureHeight < 140 then put 140 into PreviewPictureHeight --breakpoint global temp1 global temp2 call check_max_and_min put WidgetHeight + PreviewPictureHeight into WidgetHeight --****************** if WidgetWidth < 320 then put 320 into WidgetWidth if WidgetHeight < 380 then put 380 into WidgetHeight --New minimum for picture chooser if temp1 <> "max" then set the width of this stack to WidgetWidth end if if temp2 <> "max" then set the height of this stack to WidgetHeight end if ------------------------------------------------------------ --if WidgetLeftPosition <> "centre" and WidgetTopPosition <> "centre" then --set the left of this stack to WidgetLeftPosition --set the top of this stack to WidgetTopPosition --end if --if WidgetLeftPosition = "centre" and WidgetTopPosition = "centre" then --Global ScreenWidth --Global ScreenHeight ----set the rect of this stack to the screenRect ----put the width of this stack into ScreenWidth ----put the height of this stack into ScreenHeight ----The above should have already been done --If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth --If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight --put (ScreenWidth - WidgetWidth) into HorizontalDifference --put (ScreenHeight - WidgetHeight) into VerticalDifference --put (HorizontalDifference / 2) into WidgetLeftMargin --put (VerticalDifference / 2) into WidgetTopMargin --set the left of this stack to WidgetLeftMargin --set the top of this stack to WidgetTopMargin --end if --------------------------------------------- --If WidgetWidth is set to "max" then IGNOR WidgetLeftPosition --If WidgetHeight is set to "max" then IGNOR WidgetTopPosition --------------------------------------------- if WidgetLeftPosition <> "centre" and temp1 <> "max" then set the left of this stack to WidgetLeftPosition end if if WidgetTopPosition <> "centre" and temp2 <> "max" then set the top of this stack to WidgetTopPosition end if ------------- if WidgetLeftPosition = "centre" and temp1 <> "max" then Global ScreenWidth If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth put (ScreenWidth - WidgetWidth) into HorizontalDifference put (HorizontalDifference / 2) into WidgetLeftMargin set the left of this stack to WidgetLeftMargin end if if WidgetTopPosition = "centre" and temp2 <> "max" then Global ScreenHeight If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight put (ScreenHeight - WidgetHeight) into VerticalDifference put (VerticalDifference / 2) into WidgetTopMargin set the top of this stack to WidgetTopMargin end if --------------------------------------------- set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15) set the top of button "Cancel" to the top of button "OK" set the right of button "Cancel" to (the left of button "OK" - 5) set the top of button "Filters" to the top of button "OK" set the width of button "Filters" to (the left of button "Cancel" - 20) set the left of button "Filters" to 15 -------------------------------------------------------------------- set the top of button "Cancel" to the top of button "Cancel" + 4 set the top of button "OK" to the top of button "OK" + 4 ------------------------------------------------------------------- put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width set the width of field "List1" to List1Width set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1") set the left of field "List1" to 15 --set the left of field "List2" to the right of field "List1" set the left of field "List2" to (the right of field "List1" - 4) put (the top of button "Filters" - 10) - (the bottom of image "Root" + 10) - PreviewPictureHeight into theListHeight set the height of field "List1" to theListHeight set the height of field "List2" to theListHeight set the top of field "List1" to (the bottom of image "Root" + 10) set the top of field "List2" to (the bottom of image "Root" + 10) if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then put "hd" into OutputMode$ end if ----------------------------------------- ----------------------------------------- set the width of image "Preview" to (the right of field "List2" - the left of field "List1") set the height of image "Preview" to ((the top of button "Filters" - 10) - (the bottom of field "List1" + 10)) set the left of image "Preview" to the left of field "List1" set the top of image "Preview" to (the bottom of field "List1" + 10) set the minHeight of this stack to WidgetHeight ----------------------------------------- ----------------------------------------- --global AdjustingWindow put 0 into AdjustingWindow -------------------------------------------------------------------------- -------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 13 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour put line 15 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour --------------------------------------------------------------------------- --Colours used for folders: --red (default) --blue --cherry --cyan --darkblue --darkbrown --darkgreen --darkgrey --grey --lightbrown --lightgreen --mauve --white --yellow put toLower(treeFolderColour) into treeFolderColour put treeFolderColour into treeFolderColourWithSpaces put empty into treeFolderColour repeat for each char thisChar in treeFolderColourWithSpaces if thisChar is not space then put treeFolderColour & thisChar into treeFolderColour end if end repeat if treeFolderColour = "gray" then put "grey" into treeFolderColour if treeFolderColour = "darkgray" then put "darkgrey" into treeFolderColour --blue --cherry --cyan --darkblue --darkbrown --darkgreen --darkgrey --grey --lightbrown --lightgreen --mauve --white --yellow if treeFolderColour <> "blue" and\ treeFolderColour <> "cherry" and\ treeFolderColour <> "cyan" and\ treeFolderColour <> "darkblue" and\ treeFolderColour <> "darkbrown" and\ treeFolderColour <> "darkgreen" and\ treeFolderColour <> "darkgrey" and\ treeFolderColour <> "grey" and\ treeFolderColour <> "lightbrown" and\ treeFolderColour <> "lightgreen" and\ treeFolderColour <> "mauve" and\ treeFolderColour <> "white" and\ treeFolderColour <> "yellow" then put "red" into treeFolderColour end if --folderPic --folderOpenPic if treeFolderColour <> "red" then put treeFolderColour & "_closed" into closedImageName put treeFolderColour & "_open" into openImageName put image closedImageName into image "folderPic" put image openImageName into image "folderOpenPic" end if -------------------------------------------------------------------------------------------- --For suggested file name (if it exists): --Can be a name or a filter global suggestedFileNameExists --------------------------------------- --put line 14 of field "IniParametersField" of card "Card4" of this stack into suggestedFileNameExists --put suggestedFileNameExists into field "suggestedFileName" --------------------------------------- global thisIsAFolderChooserWidget global testFileName --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 14 of field "IniParametersField" of card "Card4" of this stack into testFileName put line 16 of field "IniParametersField" of card "Card4" of this stack into testFileName ---------------------------------------- put char 1 to -1 of testFileName into testFileName if toLower(testFileName) = "folder" or toLower(testFileName) = "folder/" then put 1 into thisIsAFolderChooserWidget put empty into suggestedFileNameExists put empty into field "suggestedFileName" enable button "OK" of card "Card1" else if testFileName is empty then put empty into suggestedFileNameExists put empty into field "suggestedFileName" disable button "OK" of card "Card1" else put testFileName into suggestedFileNameExists put testFileName into field "suggestedFileName" enable button "OK" of card "Card1" end if end if ------------------------------------------- --if suggestedFileNameExists is not empty then --************ Position_Controls --end if -------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- put URL "file:_picture_chooser_filters.ini" into field "Filters" of card "Card4" of this stack if line 1 of field "Filters" of card "Card4" of this stack is empty then put "*.* All files" into field "Filters" of card "Card4" of this stack end if put 0 into FilterCounter repeat for each line thisLine in field "Filters" of card "Card4" of this stack --LINUX only put (FilterCounter + 1) into FilterCounter if the charToNum of the last char of thisLine is 13 then put char 1 to -2 of thisLine into newLine$ else put thisLine into newLine$ end if put newLine$ into line FilterCounter of button "Filters" of card "Card1" of this stack --LINUX only end repeat -------------------------------------------------------------------------- --Global NumberOfDrives --For LINUX, this is between 1 and 3 --FOR LINUX: --Highlight the drive according to tempVar, which can be: --"/" --"/media/floppy0" --"/media/cdrom0" Global GotPathAlready if GotPathAlready <> 1 then remove_all_drivebox_highlights --***************************** Global WidgetFolder$ put the defaultfolder into WidgetFolder$ if the last char of WidgetFolder$ is "/" then put char 1 to -2 of WidgetFolder$ into WidgetFolder$ end if --***************************** If tempVar = "/" then call mouseDown of image "Root" end if --Changed for UBUNTU later versions: --If tempVar = "/media/cdrom0" then --call mouseDown of image "CD" --end if --If tempVar = "/media/floppy0" then --call mouseDown of image "Diskette" --end if -------------------------------------------------------------------- --CHANGED FOR UNIVERSAL EDITION: --If tempVar = "/media/cdrom" then --call mouseDown of image "CD" --end if ----If tempVar = "/media/floppy" then --If tempVar = "/media/fd0" then --call mouseDown of image "Diskette" --end if --Global CDDirectory$ --NEW FOR UNIVERSAL EDITION --Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION put the length of CDDirectory$ into lenCDDirectory put the length of FloppyDirectory$ into lenFloppyDirectory --tempVar can contain the startup folder (from ini file line 1) which may be a subfolder of the main CD/floppy folder --cited in lines 2 or 3. put 0 into cdHasAStartupFolder put 0 into floppyHasAStartupFolder if toLower(char 1 to lenCDDirectory of tempVar) = toLower(CDDirectory$) then put 1 into cdHasAStartupFolder end if if toLower(char 1 to lenFloppyDirectory of tempVar) = toLower(FloppyDirectory$) then put 1 into floppyHasAStartupFolder end if if CDDirectory$ is not empty and there is a folder CDDirectory$ and cdHasAStartupFolder = 1 then set the visible of image "CD" to true call mouseDown of image "CD" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?) end if if FloppyDirectory$ is not empty and there is a folder FloppyDirectory$ and floppyHasAStartupFolder = 1 then set the visible of image "Diskette" to true call mouseDown of image "Diskette" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?) end if ----------------------------------------------------------------- end if ---------------------------------------------------------------------------------------------------------------- put IndentSize into field "TextIndentSizeField" of card "Card3" ------------------------------------------------- call mouseDown of image "Root" of card "Card1" --INCLUDED HERE FOR UNIVERSAL EDITION put SourceDirectory$ into field "Text2" --breakpoint Global InputDirectory$ --INCLUDED HERE FOR UNIVERSAL EDITION put SourceDirectory$ into InputDirectory$ put 1 into GotPathAlready put empty into field "List1" --breakpoint --Check InputDirectory$ here: it appears to be empty in this mouseUp call: call mouseUp of button "GetFolderButton" of card "Card3" put field "ListExpandedField" of card "Card3" into field "List1" of this card put field "List1" into field "plain" --##### INTRODUCED IN UNIVERSAL EDITION ############### call Patch_To_Remove_Trailing_Blanks of this stack --##### INTRODUCED IN UNIVERSAL EDITION ############### call prettify_List1 of this stack end get_ini_parameters ---------------------------------------------------------------------------------------------- on iconifyStack Global AdjustingWindow if AdjustingWindow = 1 then pass iconifyStack Global ProgramWindowIsMinimized put 1 into ProgramWindowIsMinimized end iconifyStack ---------------------------------------------------------------------------------------------- on remove_all_drivebox_highlights Global AdjustingWindow if AdjustingWindow = 1 then pass remove_all_drivebox_highlights put image "Root_Blank" into image "Root" put image "CD_Blank" into image "CD" put image "Diskette_Blank" into image "Diskette" end remove_all_drivebox_highlights ---------------------------------------------------------------------------------------------- on error_reading_diskette Global AdjustingWindow if AdjustingWindow = 1 then pass error_reading_diskette put empty into field "List2" of card "Card1" --********************* if the sysError is 21 or the sysError is 1235 then Global DoingDiskError put 1 into DoingDiskError end if remove_all_drivebox_highlights end error_reading_diskette on get_startup_folder Global Init if Init = 1 then pass get_startup_folder Global SourceDirectory$ --e.g. c:\ (Windows) Global StartupPath$ --e.g. c:\francis\posto (Windows) Global InputDirectory$ --PUT EARLIER HERE FOR UNIVERSAL EDITION if field "List1" of card "Card1" is empty then pass get_startup_folder put StartupPath$ into field "Text2" put StartupPath$ into SourceDirectory$ put SourceDirectory$ into InputDirectory$ put 1 into GotPathAlready put empty into field "List1" ----------------------------------------------------------------- Global IndentSize --Global InputDirectory$ --PUT EARLIER FOR UNIVERSAL EDITION (see above) Global Counter put 0 into Counter repeat for 30 times put Counter + 1 into Counter if exists (field ("LabelBlockField" & Counter) of card "Card3") then delete field ("LabelBlockField" & Counter) of card "Card3" end if end repeat if the last character of InputDirectory$ is ":" then put (InputDirectory$ & "/") into InputDirectory$ --LINUX end if put InputDirectory$ into field "Text1Field" of card "Card3" --e.g. InputDirectory$: --d:\program files\howsoft\html slideshow (Windows) --Get the items of this string and put them into LabelBlockField0, LabelBlockField1 .... set the itemDelimiter to "/" --LINUX put 0 into Counter repeat for each item ThisItem in InputDirectory$ put Counter + 1 into Counter if the last item of InputDirectory$ is ThisItem then if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then clone field "LabelBlockField0" of card "Card3" set the name of it to ("LabelBlockField" & Counter) end if put ThisItem into field ("LabelBlockField" & Counter) of card "Card3" exit repeat else if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then clone field "LabelBlockField0" of card "Card3" set the name of it to ("LabelBlockField" & Counter) end if put ThisItem into field ("LabelBlockField" & Counter) of card "Card3" end if end repeat put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ ------------------------------------------------------------------------------ if the sysError is 21 or the sysError is 1235 then put "" into field "Text2" of card "Card1" put "" into SourceDirectory$ error_reading_diskette pass get_startup_folder end if --------------------------------------------------------------------------------- put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ put empty into field "ListSubfoldersField" of card "Card3" put the folders into field "ListSubfoldersField" of card "Card3" --########################### CORRECTION ################################## --delete line 1 of field "ListSubfoldersField" of card "Card3" --***************************** --sort lines of field "ListSubfoldersField" of card "Card3" sort lines of field "ListSubfoldersField" of card "Card3" delete line 1 of field "ListSubfoldersField" of card "Card3" --***************************** --########################### CORRECTION ################################## --######################### HIDDEN OPTION ############################ global showHiddenFolders if showHiddenFolders <> 1 then filter field "ListSubfoldersField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListSubfoldersField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListSubfoldersField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListSubfoldersField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN OPTION ############################ --THIS PART IS TO MAKE LITERALLY THE PORTION OF THE LIST THAT NEEDS TO BE INCLUDED --AS A RESULT OF CLICKING ON A "+" LINE --The new items appearing in ListExpanded need to be tested one by one to see --whether they also contain folders. This determines whether they have "+" or Chr$(160) -- + Chr$(160) before them. if field "ListSubfoldersField" of card "Card3" is empty then put "no" into field "LabelLastBlockContainsFoldersField" of card "Card3" else put "yes" into field "LabelLastBlockContainsFoldersField" of card "Card3" end if put (Counter + 1) into field "LabelNumberOfBlocksField" of card "Card3" put empty into field "ListExpandedField" of card "Card3" --You have items in ListSubfolders such as: --d:\program files\adobe\acrobat 5.0 (Windows) --The number of blocks is in Counter + 1 or LabelNumberOfBlocks.Caption --The IndentSize is multiplied by the Sourcepath's number of blocks - 2, --or in other words, the max block number - 1 ---------------------------------------------------------------------------------------------- Global LHSIndentInBlankChars put ((Counter - 1) * IndentSize) into LHSIndentInBlankChars ---------------------------------------------------------------------------------------------- if LHSIndentInBlankChars < 0 then put 0 into LHSIndentInBlankChars end if put LHSIndentInBlankChars into field "LabelLHSIndentInBlankCharsField" of card "Card3" repeat for each line ThisLine in field "ListSubfoldersField" of card "Card3" put empty into field "TempField" of card "Card3" set the defaultFolder to InputDirectory$ & "/" & ThisLine put the folders into field "TempField" of card "Card3" --######################### CORRECTION ############################## --delete line 1 of field "TempField" of card "Card3" --********************* --sort lines of field "TempField" of card "Card3" sort lines of field "TempField" of card "Card3" delete line 1 of field "TempField" of card "Card3" --********************* --######################### CORRECTION ############################## --######################### HIDDEN OPTION ############################ global showHiddenFolders if showHiddenFolders <> 1 then filter field "TempField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "TempField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "TempField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "TempField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN OPTION ############################ if the number of lines in field "TempField" of card "Card3" is 0 then put (numToChar(160) & numToChar(160) & ThisLine) into ThisLine else put ("+" & ThisLine) into ThisLine end if if the number of characters in ThisLine > 0 then put ((field "ListExpandedField" of card "Card3") & return & ThisLine) into field "ListExpandedField" of card "Card3" end if end repeat ----------------------------------------------------------------- ----------------------------------------------------------------- put field "ListExpandedField" of card "Card3" into field "List1" of this card delete the first line of field "List1" of this card Global PathShowingInText2$ put field "Text2" of card "Card1" into PathShowingInText2$ set the defaultFolder to PathShowingInText2$ put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files of field "List1" of card "Card1" put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" end get_startup_folder ------------------------------------------ on Position_Controls Global PreviewPictureHeight Global WidgetWidth Global WidgetHeight if PreviewPictureHeight < 140 then put 140 into PreviewPictureHeight put the width of this stack into WidgetWidth put the height of this stack into WidgetHeight if WidgetWidth < 320 then put 320 into WidgetWidth end if if WidgetHeight < 380 then put 380 into WidgetHeight --New minimum for picture chooser end if set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15) set the top of button "Cancel" to the top of button "OK" set the right of button "Cancel" to (the left of button "OK" - 5) set the top of button "Filters" to the top of button "OK" set the width of button "Filters" to (the left of button "Cancel" - 20) set the left of button "Filters" to 15 -------------------------------------------------------------------- set the top of button "Cancel" to the top of button "Cancel" + 4 set the top of button "OK" to the top of button "OK" + 4 ------------------------------------------------------------------- put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width set the width of field "List1" to List1Width set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1") set the left of field "List1" to 15 --set the left of field "List2" to the right of field "List1" set the left of field "List2" to (the right of field "List1" - 4) ----------------------------------------------- --Alteration: --List2 is now set to the right of List1 - 4 --Width is adjusted so that RH margin is 15 set the left of field "List2" to (the right of field "List1" - 4) set the width of field "List2" to the right of button "OK" - the right of field "List1" + 4 + 7 --The reason for the +7 is not known --set the width of field "List2" to the right of button "OK" - the right of field "List1" + 7 --The reason for the +7 is not known set the left of field "List2" to (the right of field "List1" - 4) set the width of field "suggestedFilename" to the width of field "List2" - 3 set the left of field "suggestedFilename" to the left of field "List2" ----------------------------------------------- put (the top of button "Filters" - 10) - (the bottom of image "Root" + 10) - PreviewPictureHeight into theListHeight set the height of field "List1" to theListHeight set the height of field "List2" to theListHeight set the top of field "List1" to (the bottom of image "Root" + 10) set the top of field "List2" to (the bottom of image "Root" + 10) set the width of image "Preview" to (the right of field "List2" - the left of field "List1") set the height of image "Preview" to ((the top of button "Filters" - 10) - (the bottom of field "List1" + 10)) set the left of image "Preview" to the left of field "List1" set the top of image "Preview" to (the bottom of field "List1" + 10) set the right of button "hiddenButton" to the right of field "List2" ----------------------------------------- if the selectedline of field "List2" of card "Card1" is not zero then set the visible of image "Preview" to false end if ---------------------------------------------- --Alteration: global suggestedFileNameExists if suggestedFileNameExists is not empty then set the height of field "List2" to (the height of field "List2" - the height of field "suggestedFileName") set the top of field "suggestedFileName" to the bottom of field "List2" -- - 3 #### set the right of field "suggestedFileName" to the right of field "List2" --#### set the visible of field "suggestedFileName" to true end if end Position_Controls ---------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------- on prettify_List1 Patch_To_Correct_Indents --THIS ROUTINE HAS BEEN REFORMED IN ORDER TO ELIMINATE THE USE OF THE find INSTRUCTIONS: --Under some circumstances they cause a crash. if field "List1" is not empty then --put field "List1" into field "list1Pretty" lock screen --folderClosed 1085 --folderOpen 1089 put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter ---------------------------------------------------------------------------- --find string "+" in field "List1" --if the foundChunk is not empty then --set the imageSource of the foundChunk to 1085 --CLOSED FOLDER --end if put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "+" then put charCounter into foundPos exit repeat end if end repeat if foundPos > 0 then set the imageSource of char foundPos of line lineCounter of field "List1" to 1085 --CLOSED FOLDER end if end repeat ----------------------------------- --find empty ----------------------------------- --repeat for each line thisLine in field "List1" --find string "--" in field "List1" ----put the foundChunk --if the foundChunk is not empty then --set the imageSource of the foundChunk to 1089 --OPEN FOLDER --set the itemDelimiter to space --put item 4 of the foundChunk into charToDelete ----delete char charToDelete of field "List1" --****************REMOVED************************ --end if --end repeat --find empty -------------------------------------------------------------------- put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "-" and char (charCounter + 1) of thisLine = "-" then put charCounter into foundPos exit repeat end if end repeat if foundPos > 0 then set the imageSource of char foundPos of line lineCounter of field "List1" to 1089 --OPEN FOLDER put numtochar(160) into char (foundPos + 1) of line lineCounter of field "List1" end if end repeat ------------------------------------------------------------------------------------------------------------------------------- --field "lineTemp" put 0 into counter repeat for each line thisLine in field "List1" put counter + 1 into counter put thisLine into field "lineTemp" of card "Card1" ------------------------------------------------------ --find string "+" in field "lineTemp" of card "Card1" --FOR SUBSTITUTION put line 1 of field "lineTemp" of card "Card1" into thisLine put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "+" then put charCounter into foundPos exit repeat end if end repeat ---------- --if the foundChunk is not empty then if foundPos > 0 then --------------------------------------------------- --set the itemDelimiter to space --FOR SUBSTITUTION --put item 2 of the foundChunk into charPos --FOR SUBSTITUTION put foundPos into charPos -------------------------------------------------- if char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not space and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not space then put "+" into char charPos of line counter of field "List1" --In the case that + appears as part of a folder name and has been accidentally replaced with a folder image, --the above puts the + sign back. end if end if end repeat unlock screen end if end prettify_List1 ---------------------------------------------------------------------------------------------------------------------------------- on Patch_To_Correct_Indents --THIS ROUTINE DOES NOT WORK OK. --THE ONLY SOLUTION IS TO FIND OUT WHY THE INDENTS ARE INCORRECT IN THE FIRST PLACE exit Patch_To_Correct_Indents --For any line in field "List1", if the next line has an indent which is greater than the IndentSize, then reduce it. --"If the indent of the current line is greater than the ORIGINAL indent of the previous line, then --##### --make it ONE IndentSize greater than the previous line's CURRENT indent" --##### --@@@@@@@@@@@@@@@@@@@@@@@@@@ --The problem here is that it may not be just the NEXT line which has a greater indent than it should have, --but a SERIES of lines. --Therefore, once found, you need to examine all following lines to determine whether they have the --same problem. --@@@@@@@@@@@@@@@@@@@@@@@@@@ global IndentSize put 0 into lineCounter put 0 into previousSpaceCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into spaceCounter repeat for each char thisChar in thisLine if thisChar = space then put spaceCounter + 1 into spaceCounter else exit repeat end if end repeat put spaceCounter into previousSpaceCounter --##### --Reduce current line to (previousLineSpaceCounter + IndentSize) exactly: put 0 into previousLineSpaceCounter put 0 into previousLineIsOpenFolder repeat for each char thisChar in line (lineCounter - 1) of field "List1" of card "Card1" if thisChar = space then put previousLineSpaceCounter + 1 into previousLineSpaceCounter else if thisChar = "-" then put 1 into previousLineIsOpenFolder end if exit repeat end if end repeat if (spaceCounter > (previousLineSpaceCounter + IndentSize - 1)) and ((previousLineSpaceCounter + IndentSize) > IndentSize) then put empty into newLine if previousLineIsOpenFolder = 1 then repeat with n = 1 to (previousLineSpaceCounter + IndentSize) put newLine & space into newLine end repeat --put n into theNumberOfBlanksInnewLine --WRONG else repeat with n = 1 to previousLineSpaceCounter --BUT IF PREVIOUS LINE IS NOT AN OPEN FOLDER, DO NOT ADD THE IndentSize as ABOVE put newLine & space into newLine end repeat end if repeat with n = (previousSpaceCounter + 1) to (the length of thisLine) --if char n of thisLine <> space then --CORRECTED FOR UNIVERSAL VERSION put newLine & (char n of thisLine) into newLine --end if end repeat put newLine into line lineCounter of field "List1" of card "Card1" --@@@@@@@@@@@@@@@@@@@@@@@@@@ --The problem here is that it may not be just the NEXT line which has a greater indent than it should have, --but a SERIES of lines. --Therefore, once found, you need to examine all following lines to determine whether they have the --same problem. --@@@@@@@@@@@@@@@@@@@@@@@@@@ --DO IT HERE, and increase lineCounter by the number of lines found with the same problem: --Do these following lines have spaceCounter number of blanks at the beginning of them? --if so, give them the same number of preceding spaces as newLine has. --STOP when you find a line that does NOT have spaceCounter number of blanks at the beginning of it. if lineCounter < (the number of lines in field "List1" of card "Card1") then put 0 into numberOfLinesWithTheSameProblem repeat with lineCounter2 = (lineCounter + 1) to (the number of lines in field "List1" of card "Card1") put numberOfLinesWithTheSameProblem + 1 into numberOfLinesWithTheSameProblem put line lineCounter2 of field "List1" of card "Card1" into thisFollowingLine put 0 into spaceCounter2 repeat for each char thisChar in thisFollowingLine if thisChar = space then put spaceCounter2 + 1 into spaceCounter2 else exit repeat end if end repeat if spaceCounter2 <> spaceCounter then exit repeat else --This line has the same problem as the original line found: --Give it the same number of preceding spaces as newLine has: --Get the bare line without preceding blanks first: put char spaceCounter2 to (the number of chars in thisFollowingLine) of thisFollowingLine into bareNewLine2 --Put in the preceding blanks: --theNumberOfBlanksInnewLine has been saved above --WRONG - NOW REMOVED ABOVE --Calculate the number of blanks in newLine saved previously: put 0 into theNumberOfBlanksInnewLine repeat for each char currentChar in newLine if currentChar = space then put theNumberOfBlanksInnewLine + 1 into theNumberOfBlanksInnewLine else exit repeat end if end repeat put empty into leftIndent repeat with m = 1 to theNumberOfBlanksInnewLine put leftIndent & space into leftIndent end repeat put leftIndent & bareNewLine2 into newLine2 --Now substitute the old line with the new line: put newLine2 into line lineCounter2 of field "List1" end if end repeat --Increase lineCounter by the number of lines found with the same problem: put lineCounter + numberOfLinesWithTheSameProblem into lineCounter end if --@@@@@@@@@@@@@@@@@@@@@@@@@@ else put spaceCounter into previousSpaceCounter end if end repeat end Patch_To_Correct_Indents --------------------------------------------------------------------------------- on Patch_To_Remove_Trailing_Blanks put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into RHSblankCharPos repeat with RHSblankCharPos = -1 down to (-1 * (the length of thisLine)) put char RHSblankCharPos of thisLine into thisChar if thisChar is not space then exit repeat end repeat put char 1 to RHSblankCharPos of thisLine into thisLine put thisLine into line lineCounter of field "List1" of card "Card1" end repeat end Patch_To_Remove_Trailing_Blanks ---------------------------------------------------------- on check_max_and_min Global WidgetLeftPosition Global WidgetTopPosition global WidgetWidth global WidgetHeight global ScreenWidth global ScreenHeight global PreviewPictureHeight global temp1 global temp2 --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 9 of field "IniParametersField" of card "Card4" of this stack into temp1 --put line 10 of field "IniParametersField" of card "Card4" of this stack into temp2 put line 11 of field "IniParametersField" of card "Card4" of this stack into temp1 put line 12 of field "IniParametersField" of card "Card4" of this stack into temp2 put word 1 to -1 of temp1 into temp1 put word 1 to -1 of temp2 into temp2 put the toLower of temp1 into temp1 put the toLower of temp2 into temp2 if temp1 = "max" or temp1 = "maximum" or temp1 = "min" or temp1 = "minimum" or temp1 = empty then if temp1 = "maximum" then put "max" into temp1 end if if temp1 = "minimum" or temp1 = empty then put "min" into temp1 end if if temp1 = "max" then put (ScreenWidth - 11) into WidgetWidth put 6 into WidgetLeftPosition set the width of this stack to WidgetWidth set the left of this stack to WidgetLeftPosition end if if temp1 = "min" then put 320 into WidgetWidth end if else --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth end if if temp2 = "max" or temp2 = "maximum" or temp2 = "min" or temp2 = "minimum" or temp2 = empty then if temp2 = "maximum" then put "max" into temp2 end if if temp2 = "minimum" or temp2 = empty then put "min" into temp2 end if if temp2 = "max" then --########################################################## --CORRECTION: --put (ScreenHeight - PreviewPictureHeight - 78) into WidgetHeight put (ScreenHeight - PreviewPictureHeight - 84) into WidgetHeight --########################################################## put 48 into WidgetTopPosition set the height of this stack to WidgetHeight set the top of this stack to WidgetTopPosition end if if temp2 = "min" then put 240 into WidgetHeight end if else --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight end if end check_max_and_min 4P / @| U Tahoma U Arial U Arial W Arial W Arial W Arial U Arial U Arial $ U Arial $ W Arial U U Arial U Helvetica U Arial U Arial U arial U Arial U Arial U Helvetica U default U default U Helvetica cRevStandaloneSettings ;scriptLibraries Internet Geometry PrintingMacOSX false OSX,name HDTreeMacOS,documentType UNIX,fileSelector trueWindows falseMacOS,longVersion HDTree 1.0.0.0Windows,LegalCopyright .2006 howsoft.com All rights reserved worldwideWindows,Comments Author: Robert J WarrenUNIX,pageSetup trueOSX,documentType Linux trueWindows,documenticonFile ;D:/Program Files/Revolution 2.6/Sample Icons/genericdoc.icoinclusions selectOdt false answerDialog trueSPARC falseOSX,documentExtension SolIntel falseWindows,FileDescription "Picture Chooser 1.0 for Windows XPOSX,longVersion HDTree 1.0.0.0 MacOSfat falseUNIX,printerChooser trueOSX,copyright .2005 howsoft.com All rights reserved worldwideMacOS,MinimumSize 15000MacOS,versionnumber1 1MacOS,Release FinalMacOS,versionnumber2 0MacOS,versionnumber3 0name _picture_chooserOSX,identifier com.howsoft.com.hdtree MacOS,Region 1rs6000 falseHp9k700 falseOSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,fileversion2 1Windows,productversion1 1Windows,fileversion3 0Windows,productversion2 1Windows,fileversion4 0Windows,productversion3 0cursors trueBsd false OSX,info HDTree Version 1.0.0.0Windows,productversion4 0 MacOS68k falseMacOS,dynamicMemory true askDialog trueIris falseWindows,iconFile h_nearly_red_all_resolutions.icoOSX,signature ????Windows,ProductName Picture ChooserMacOS,PreferredSize 15000UNIX,colorChooser true MacOSPPC falseMacOS,creator ???? SolSparc falseWindows,companyname howsoft.com cREVGeometryCache stackID 1124 cREVGeneral @ scriptChecksum i3pER즛a debugObjects breakpoints handlerList closeStackRequest preOpenStack resumeStack resizeStack show_drives get_ini_parameters iconifyStack remove_all_drivebox_highlights error_reading_diskette get_startup_folder Position_Controls prettify_List1 Patch_To_Correct_Indents Patch_To_Remove_Trailing_Blanks check_max_and_minbreakpointstates scriptSelection char 49988 to 49987scripteditorvscroll 29141breakpointconditions bookmarks scripteditorselection 38147tempScript prevHandler Patch_To_Correct_Indentsstackfileversion 2.7script
on closeStackRequest
end closeStackRequest
on preOpenStack -- center the stack on the main screen
Global MyDir
put the defaultfolder into MyDir
show_drives
set the loc of this stack to the screenLoc
set the left of this stack to 0
set the top of this stack to 28
resizeStack
pass preOpenStack
end preOpenStack
on resumeStack
Global AdjustingWindow
if AdjustingWindow = 1 then pass resumeStack
Global Init
Global ScreenInfo
Global ScreenWidth
Global ScreenHeight
Global GapOnRight
-----------------------------------------------------------------------------------------
Global GotPathAlready
if GotPathAlready = 0 then
resizeStack --*******************
end if
end resumeStack
on resizeStack
Global AdjustingWindow
if AdjustingWindow = 1 then pass resizeStack
Global Init
Global ScreenInfo
Global ScreenWidth
Global ScreenHeight
Global GapOnRight
if Init = 1 then
Global WidgetWidth
Global WidgetHeight
Position_Controls
pass resizeStack --**************
end if
put the screenRect into ScreenInfo
----By default, the itemdelimeter is set to ","
put item 3 of ScreenInfo into ScreenWidth
put item 4 of ScreenInfo into ScreenHeight
set the left of image "Image1" to 0
set the top of image "Image1" to 0
--------------------------------------------------------------------------------------------
--Card1:
set the left of field "List1" of card "Card1" to 50
set the top of field "List1" of card "Card1" to 65
set the height of field "List1" of card "Card1" to ScreenHeight - 200
set the width of field "List1" of card "Card1" to 50 * (ScreenWidth / 100)
set the height of field "List2" of card "Card1" to the height of field "List1" of card "Card1"
set the top of field "List2" of card "Card1" to the top of field "List1" of card "Card1"
set the left of field "List2" of card "Card1" to the right of field "List1" of card "Card1"
put (ScreenWidth - the left of field "List2" of card "Card1") into GapOnRight
set the width of field "List2" of card "Card1" to GapOnRight - 50
show_drives
get_ini_parameters
call mouseDown of field "DriveField" of card "Card1"
delete line 1 of field "List1" of card "Card1"
---------------------------------------------------
Global SourceDirectory$ --e.g. c:\
Global StartupPath$ --e.g. c:\francis\posto
if the number of chars in StartupPath$ > the number of chars in SourceDirectory$ then
get_startup_folder
put field "List1" of card "Card1" into field "plain" of card "Card1" --NEW*******************
call prettify_List1 of this stack
end if
---------------------------------------------------
Global InitialLeftOfPreviewBox
Global InitialTopOfPreviewBox
Global InitialWidthOfPreviewBox
Global InitialHeightOfPreviewBox
put the left of image "Preview" into InitialLeftOfPreviewBox
put the top of image "Preview" into InitialTopOfPreviewBox
put the width of image "Preview" into InitialWidthOfPreviewBox
put the height of image "Preview" into InitialHeightOfPreviewBox
put 1 into Init
end resizeStack
----------------------------------------------------------------------------------------------
on show_drives
Global AdjustingWindow
if AdjustingWindow = 1 then pass show_drives
Global DoingDiskError
if DoingDiskError = 1 then
put 0 into DoingDiskError
pass show_drives
end if
call mouseDown of field "DriveField" of card "Card1"
end show_drives
----------------------------------------------------------------------------------------------
on get_ini_parameters
Global AdjustingWindow
if AdjustingWindow = 1 then pass get_ini_parameters
Global SourceDirectory$
Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
Global IndentSize
Global TreeFontname$
Global TreeFontsize
Global TreeFontbold$
Global TreeFontitalic$
Global NumberOfDrives
Global tempForeColour
Global tempBackColour
Global WidgetLeftPosition
Global WidgetTopPosition
Global WidgetWidth
Global WidgetHeight
Global ProgramWindowIsMinimized
if ProgramWindowIsMinimized = 1 then
put 0 into ProgramWindowIsMinimized
pass get_ini_parameters
end if
set the left of image "Image1" of card "Card1" to 0
set the top of image "Image1" of card "Card1" to 0
put URL "file:_picture_chooser.ini" into field "IniParametersField" of card "Card4" of this stack
-----------------------------------------
--Startup drive (e.g. Windows only c:\):
--In Linux, startup folders can begin as follows:
--/
--/media/floppy0 or just "floppy" or "diskette"
--/media/cdrom0 or just "cd" or "cdrom"
--In the above optional startup drive specifications, you need to check for UCase, trailing slashes, etc.
--Specifications such as floppy/subfolder should not be permitted. These should be specified as /media/floppy0/subfolder
--Number of spaces for indents (e.g. 8):
--Fontname (e.g. Arial):
--Fontsize (e.g. 12):
--Bold (yes or no):
--Italic (yes or no):
--Window left position (nnn or centre or center):
--Window right position (nnn or centre or center):
--Window width (nnn - min=320):
--Window height (nnn - min=240):
-----------------------------------------
--go Card4 --TEMP ONLY
put line 1 of field "IniParametersField" of card "Card4" of this stack into SourceDirectory$ --e.g. "c:\" SourceDirectory$
if the charToNum of the last char of SourceDirectory$ is 13 then --LINUX only
put char 1 to -2 of SourceDirectory$ into SourceDirectory$
end if
--/
--/media/floppy0 or just "floppy" or "diskette"
--/media/cdrom0 or just "cd" or "cdrom"
--Changed for UBUNTU later versions:
--if toLower(SourceDirectory$) = "floppy" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy0/" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom0/" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "floppy" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$
--REMOVED IN UNIVERSAL EDITION:
--if toLower(SourceDirectory$) = "floppy" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/fd0/" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$
--Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
--Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
put line 2 of field "IniParametersField" of card "Card4" of this stack into CDDirectory$ --NEW FOR UNIVERSAL EDITION
put line 3 of field "IniParametersField" of card "Card4" of this stack into FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
if the charToNum of the last char of CDDirectory$ is 13 then --LINUX only
put char 1 to -2 of CDDirectory$ into CDDirectory$
end if
if the charToNum of the last char of FloppyDirectory$ is 13 then --LINUX only
put char 1 to -2 of FloppyDirectory$ into FloppyDirectory$
end if
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 2 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize
--put line 3 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$
--put line 4 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize
--put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$
--put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$
put line 4 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize
put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$
put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize
put line 7 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$
put line 8 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$
if the charToNum of the last char of IndentSize is 13 then --LINUX only
put char 1 to -2 of IndentSize into IndentSize
end if
if the charToNum of the last char of TreeFontname$ is 13 then --LINUX only
put char 1 to -2 of TreeFontname$ into TreeFontname$
end if
if the charToNum of the last char of TreeFontsize is 13 then --LINUX only
put char 1 to -2 of TreeFontsize into TreeFontsize
end if
if the charToNum of the last char of TreeFontbold$ is 13 then --LINUX only
put char 1 to -2 of TreeFontbold$ into TreeFontbold$
end if
if the charToNum of the last char of TreeFontitalic$ is 13 then --LINUX only
put char 1 to -2 of TreeFontitalic$ into TreeFontitalic$
end if
put word 1 to -1 of SourceDirectory$ into SourceDirectory$
Global StartupPath$
put SourceDirectory$ into StartupPath$ --e.g. c:\francis\posto or c:\francis\posto\ (Windows)
if the last char of StartupPath$ = "/" then --LINUX
put char 1 to -2 of StartupPath$ into StartupPath$
end if
--put char 1 to 3 of SourceDirectory$ into SourceDirectory$ --e.g. c:\ --REMOVED FOR LINUX
--SourceDirectory$ can be:
--"/"
--"/media/floppy0/****************" (perhaps with some UCase)
--"/media/cdrom0/****************" (perhaps with some UCase)
--put toLower(SourceDirectory$) into SourceDirectory$ --WRONG! REMOVED FOR UNIVERSAL EDITION
--Changed for UBUNTU later versions:
--if char 1 to 14 of SourceDirectory$ = "/media/floppy0" then put "/media/floppy0" into SourceDirectory$
--if char 1 to 13 of SourceDirectory$ = "/media/cdrom0" then put "/media/cdrom0" into SourceDirectory$
--if char 1 to 14 of SourceDirectory$ <> "/media/floppy0" and char 1 to 13 of SourceDirectory$ <> "/media/cdrom0" then put "/" into SourceDirectory$
----if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/floppy" into SourceDirectory$
--if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/fd0" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION
--if char 1 to 12 of SourceDirectory$ = "/media/cdrom" then put "/media/cdrom" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION
----if char 1 to 13 of SourceDirectory$ <> "/media/floppy" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$
--if char 1 to 10 of SourceDirectory$ <> "/media/fd0" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$ --REMOVED FOR UNIVERSAL EDITION
--put word 1 to -1 of IndentSize into IndentSize
put word 1 to -1 of TreeFontname$ into TreeFontname$
--put word 1 to -1 of TreeFontsize into TreeFontsize
put word 1 to -1 of TreeFontbold$ into TreeFontbold$
put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$
if SourceDirectory$ = "" then put "/" into SourceDirectory$ --LINUX
if IndentSize = "" then put 4 into IndentSize
if TreeFontname$ = "" then put "default" into TreeFontname$
if TreeFontsize = "" then put 14 into TreeFontsize
if TreeFontbold$ = "" then put "no" into TreeFontbold$
if TreeFontitalic$ = "" then put "no" into TreeFontitalic$
put the toLower of TreeFontbold$ into TreeFontbold$
put the toLower of TreeFontitalic$ into TreeFontitalic$
set the textFont of field "List1" to TreeFontname$
set the textFont of field "List2" to TreeFontname$
set the textFont of button "Filters" to TreeFontname$
set the textFont of button "Cancel" to TreeFontname$
set the textFont of button "OK" to TreeFontname$
set the textFont of field "suggestedFilename" to TreeFontname$
set the textSize of field "List1" to TreeFontsize
set the textSize of field "List2" to TreeFontsize
--set the textSize of button "Filters" to TreeFontsize
--set the textSize of button "Cancel" to TreeFontsize
--set the textSize of button "OK" to TreeFontsize
set the textSize of field "suggestedFilename" to TreeFontsize
if TreeFontbold$ = "yes" then
set the textStyle of field "List1" to "bold"
set the textStyle of field "List2" to "bold"
--set the textStyle of button "Filters" to "bold"
--set the textStyle of button "Cancel" to "bold"
--set the textStyle of button "OK" to "bold"
set the textStyle of field "suggestedFilename" to "bold"
end if
if TreeFontitalic$ = "yes" then
set the textStyle of field "List1" to "italic"
set the textStyle of field "List2" to "italic"
set the textStyle of button "Filters" to "italic"
set the textStyle of button "Cancel" to "italic"
set the textStyle of button "OK" to "italic"
set the textStyle of field "suggestedFilename" to "italic"
end if
if TreeFontbold$ = "yes" and TreeFontitalic$ = "yes" then
set the textStyle of field "List1" to "bold,italic"
set the textStyle of field "List2" to "bold,italic"
--set the textStyle of button "Filters" to "bold,italic"
--set the textStyle of button "Cancel" to "bold,italic"
--set the textStyle of button "OK" to "bold,italic"
set the textStyle of field "suggestedFilename" to "bold,italic"
end if
set the height of field "suggestedFileName" to the textheightSum of field "suggestedFileName" --NEW
--SourceDirectory$
--put the first character of SourceDirectory$ into tempVar --NOT LINUX
--SourceDirectory$ can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
put SourceDirectory$ into tempVar
-- tempVar can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
put 255,255,255 into tempBackColour --*******************************
put 0,0,215 into tempForeColour
-----------------------------------------
global AdjustingWindow
put 1 into AdjustingWindow
-----------------------------------------
--Window left position (nnn or centre or center):
--Window top position (nnn or centre or center):
--Window width (nnn - min=320):
--Window height (nnn - min=240):
--Main background colour (e.g. grey or gray or 128,128,128 or #808080):
--Main font colour (e.g. grey or gray or 128,128,128 or #808080):
--Button background colour (e.g. grey or gray or 128,128,128 or #808080):
--Button font colour (e.g. grey or gray or 128,128,128 or #808080):
-----------------------------------------
--Example only:
--put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$
--put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$
--put the toLower of TreeFontitalic$ into TreeFontitalic$
--if TreeFontitalic$ = "" then put "no" into TreeFontitalic$
-----------------------------------------
--Widget left position (nnn or centre or center):
--Widget top position (nnn or centre or center):
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 7 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition
--put line 8 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition
put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition
put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition
----------------------------------------------------------
--put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
--put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
Global OutputMode$
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 11 of field "IniParametersField" of card "Card4" of this stack into OutputMode$
put line 13 of field "IniParametersField" of card "Card4" of this stack into OutputMode$
-------------------------------------------------------------------
if the charToNum of the last char of WidgetLeftPosition is 13 then --LINUX only
put char 1 to -2 of WidgetLeftPosition into WidgetLeftPosition
end if
if the charToNum of the last char of WidgetTopPosition is 13 then --LINUX only
put char 1 to -2 of WidgetTopPosition into WidgetTopPosition
end if
if the charToNum of the last char of WidgetWidth is 13 then --LINUX only
put char 1 to -2 of WidgetWidth into WidgetWidth
end if
if the charToNum of the last char of WidgetHeight is 13 then --LINUX only
put char 1 to -2 of WidgetHeight into WidgetHeight
end if
if the charToNum of the last char of OutputMode$ is 13 then --LINUX only
put char 1 to -2 of OutputMode$ into OutputMode$
end if
Global PreviewPictureHeight
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 12 of field "IniParametersField" of card "Card4" of this stack into PreviewPictureHeight
put line 14 of field "IniParametersField" of card "Card4" of this stack into PreviewPictureHeight
----------------------------------------------------------------------
if the charToNum of the last char of PreviewPictureHeight is 13 then --LINUX only
put char 1 to -2 of PreviewPictureHeight into PreviewPictureHeight
end if
put word 1 to -1 of WidgetLeftPosition into WidgetLeftPosition
put word 1 to -1 of WidgetTopPosition into WidgetTopPosition
put word 1 to -1 of WidgetWidth into WidgetWidth
put word 1 to -1 of WidgetHeight into WidgetHeight
put word 1 to -1 of OutputMode$ into OutputMode$
put word 1 to -1 of PreviewPictureHeight into PreviewPictureHeight
put the toLower of WidgetLeftPosition into WidgetLeftPosition
put the toLower of WidgetTopPosition into WidgetTopPosition
put the toLower of WidgetWidth into WidgetWidth
put the toLower of WidgetHeight into WidgetHeight
put the toLower of OutputMode$ into OutputMode$
put the toLower of PreviewPictureHeight into PreviewPictureHeight
if WidgetLeftPosition = "" then
put "centre" into WidgetLeftPosition
put "centre" into WidgetTopPosition
end if
if WidgetTopPosition = "" then
put "centre" into WidgetLeftPosition
put "centre" into WidgetTopPosition
end if
if WidgetLeftPosition = "center" then
put "centre" into WidgetLeftPosition
put "centre" into WidgetTopPosition
end if
if WidgetTopPosition = "center" then
put "centre" into WidgetLeftPosition
put "centre" into WidgetTopPosition
end if
if PreviewPictureHeight < 140 then put 140 into PreviewPictureHeight
--breakpoint
global temp1
global temp2
call check_max_and_min
put WidgetHeight + PreviewPictureHeight into WidgetHeight --******************
if WidgetWidth < 320 then put 320 into WidgetWidth
if WidgetHeight < 380 then put 380 into WidgetHeight --New minimum for picture chooser
if temp1 <> "max" then
set the width of this stack to WidgetWidth
end if
if temp2 <> "max" then
set the height of this stack to WidgetHeight
end if
------------------------------------------------------------
--if WidgetLeftPosition <> "centre" and WidgetTopPosition <> "centre" then
--set the left of this stack to WidgetLeftPosition
--set the top of this stack to WidgetTopPosition
--end if
--if WidgetLeftPosition = "centre" and WidgetTopPosition = "centre" then
--Global ScreenWidth
--Global ScreenHeight
----set the rect of this stack to the screenRect
----put the width of this stack into ScreenWidth
----put the height of this stack into ScreenHeight
----The above should have already been done
--If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth
--If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight
--put (ScreenWidth - WidgetWidth) into HorizontalDifference
--put (ScreenHeight - WidgetHeight) into VerticalDifference
--put (HorizontalDifference / 2) into WidgetLeftMargin
--put (VerticalDifference / 2) into WidgetTopMargin
--set the left of this stack to WidgetLeftMargin
--set the top of this stack to WidgetTopMargin
--end if
---------------------------------------------
--If WidgetWidth is set to "max" then IGNOR WidgetLeftPosition
--If WidgetHeight is set to "max" then IGNOR WidgetTopPosition
---------------------------------------------
if WidgetLeftPosition <> "centre" and temp1 <> "max" then
set the left of this stack to WidgetLeftPosition
end if
if WidgetTopPosition <> "centre" and temp2 <> "max" then
set the top of this stack to WidgetTopPosition
end if
-------------
if WidgetLeftPosition = "centre" and temp1 <> "max" then
Global ScreenWidth
If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth
put (ScreenWidth - WidgetWidth) into HorizontalDifference
put (HorizontalDifference / 2) into WidgetLeftMargin
set the left of this stack to WidgetLeftMargin
end if
if WidgetTopPosition = "centre" and temp2 <> "max" then
Global ScreenHeight
If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight
put (ScreenHeight - WidgetHeight) into VerticalDifference
put (VerticalDifference / 2) into WidgetTopMargin
set the top of this stack to WidgetTopMargin
end if
---------------------------------------------
set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15)
set the top of button "Cancel" to the top of button "OK"
set the right of button "Cancel" to (the left of button "OK" - 5)
set the top of button "Filters" to the top of button "OK"
set the width of button "Filters" to (the left of button "Cancel" - 20)
set the left of button "Filters" to 15
--------------------------------------------------------------------
set the top of button "Cancel" to the top of button "Cancel" + 4
set the top of button "OK" to the top of button "OK" + 4
-------------------------------------------------------------------
put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists
put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width
set the width of field "List1" to List1Width
set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1")
set the left of field "List1" to 15
--set the left of field "List2" to the right of field "List1"
set the left of field "List2" to (the right of field "List1" - 4)
put (the top of button "Filters" - 10) - (the bottom of image "Root" + 10) - PreviewPictureHeight into theListHeight
set the height of field "List1" to theListHeight
set the height of field "List2" to theListHeight
set the top of field "List1" to (the bottom of image "Root" + 10)
set the top of field "List2" to (the bottom of image "Root" + 10)
if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then
put "hd" into OutputMode$
end if
-----------------------------------------
-----------------------------------------
set the width of image "Preview" to (the right of field "List2" - the left of field "List1")
set the height of image "Preview" to ((the top of button "Filters" - 10) - (the bottom of field "List1" + 10))
set the left of image "Preview" to the left of field "List1"
set the top of image "Preview" to (the bottom of field "List1" + 10)
set the minHeight of this stack to WidgetHeight
-----------------------------------------
-----------------------------------------
--global AdjustingWindow
put 0 into AdjustingWindow
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 13 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour
put line 15 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour
---------------------------------------------------------------------------
--Colours used for folders:
--red (default)
--blue
--cherry
--cyan
--darkblue
--darkbrown
--darkgreen
--darkgrey
--grey
--lightbrown
--lightgreen
--mauve
--white
--yellow
put toLower(treeFolderColour) into treeFolderColour
put treeFolderColour into treeFolderColourWithSpaces
put empty into treeFolderColour
repeat for each char thisChar in treeFolderColourWithSpaces
if thisChar is not space then
put treeFolderColour & thisChar into treeFolderColour
end if
end repeat
if treeFolderColour = "gray" then put "grey" into treeFolderColour
if treeFolderColour = "darkgray" then put "darkgrey" into treeFolderColour
--blue
--cherry
--cyan
--darkblue
--darkbrown
--darkgreen
--darkgrey
--grey
--lightbrown
--lightgreen
--mauve
--white
--yellow
if treeFolderColour <> "blue" and\
treeFolderColour <> "cherry" and\
treeFolderColour <> "cyan" and\
treeFolderColour <> "darkblue" and\
treeFolderColour <> "darkbrown" and\
treeFolderColour <> "darkgreen" and\
treeFolderColour <> "darkgrey" and\
treeFolderColour <> "grey" and\
treeFolderColour <> "lightbrown" and\
treeFolderColour <> "lightgreen" and\
treeFolderColour <> "mauve" and\
treeFolderColour <> "white" and\
treeFolderColour <> "yellow" then
put "red" into treeFolderColour
end if
--folderPic
--folderOpenPic
if treeFolderColour <> "red" then
put treeFolderColour & "_closed" into closedImageName
put treeFolderColour & "_open" into openImageName
put image closedImageName into image "folderPic"
put image openImageName into image "folderOpenPic"
end if
--------------------------------------------------------------------------------------------
--For suggested file name (if it exists):
--Can be a name or a filter
global suggestedFileNameExists
---------------------------------------
--put line 14 of field "IniParametersField" of card "Card4" of this stack into suggestedFileNameExists
--put suggestedFileNameExists into field "suggestedFileName"
---------------------------------------
global thisIsAFolderChooserWidget
global testFileName
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 14 of field "IniParametersField" of card "Card4" of this stack into testFileName
put line 16 of field "IniParametersField" of card "Card4" of this stack into testFileName
----------------------------------------
put char 1 to -1 of testFileName into testFileName
if toLower(testFileName) = "folder" or toLower(testFileName) = "folder/" then
put 1 into thisIsAFolderChooserWidget
put empty into suggestedFileNameExists
put empty into field "suggestedFileName"
enable button "OK" of card "Card1"
else
if testFileName is empty then
put empty into suggestedFileNameExists
put empty into field "suggestedFileName"
disable button "OK" of card "Card1"
else
put testFileName into suggestedFileNameExists
put testFileName into field "suggestedFileName"
enable button "OK" of card "Card1"
end if
end if
-------------------------------------------
--if suggestedFileNameExists is not empty then --************
Position_Controls
--end if
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
put URL "file:_picture_chooser_filters.ini" into field "Filters" of card "Card4" of this stack
if line 1 of field "Filters" of card "Card4" of this stack is empty then
put "*.* All files" into field "Filters" of card "Card4" of this stack
end if
put 0 into FilterCounter
repeat for each line thisLine in field "Filters" of card "Card4" of this stack --LINUX only
put (FilterCounter + 1) into FilterCounter
if the charToNum of the last char of thisLine is 13 then
put char 1 to -2 of thisLine into newLine$
else
put thisLine into newLine$
end if
put newLine$ into line FilterCounter of button "Filters" of card "Card1" of this stack --LINUX only
end repeat
--------------------------------------------------------------------------
--Global NumberOfDrives --For LINUX, this is between 1 and 3
--FOR LINUX:
--Highlight the drive according to tempVar, which can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
Global GotPathAlready
if GotPathAlready <> 1 then
remove_all_drivebox_highlights
--*****************************
Global WidgetFolder$
put the defaultfolder into WidgetFolder$
if the last char of WidgetFolder$ is "/" then
put char 1 to -2 of WidgetFolder$ into WidgetFolder$
end if
--*****************************
If tempVar = "/" then
call mouseDown of image "Root"
end if
--Changed for UBUNTU later versions:
--If tempVar = "/media/cdrom0" then
--call mouseDown of image "CD"
--end if
--If tempVar = "/media/floppy0" then
--call mouseDown of image "Diskette"
--end if
--------------------------------------------------------------------
--CHANGED FOR UNIVERSAL EDITION:
--If tempVar = "/media/cdrom" then
--call mouseDown of image "CD"
--end if
----If tempVar = "/media/floppy" then
--If tempVar = "/media/fd0" then
--call mouseDown of image "Diskette"
--end if
--Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
--Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
put the length of CDDirectory$ into lenCDDirectory
put the length of FloppyDirectory$ into lenFloppyDirectory
--tempVar can contain the startup folder (from ini file line 1) which may be a subfolder of the main CD/floppy folder
--cited in lines 2 or 3.
put 0 into cdHasAStartupFolder
put 0 into floppyHasAStartupFolder
if toLower(char 1 to lenCDDirectory of tempVar) = toLower(CDDirectory$) then
put 1 into cdHasAStartupFolder
end if
if toLower(char 1 to lenFloppyDirectory of tempVar) = toLower(FloppyDirectory$) then
put 1 into floppyHasAStartupFolder
end if
if CDDirectory$ is not empty and there is a folder CDDirectory$ and cdHasAStartupFolder = 1 then
set the visible of image "CD" to true
call mouseDown of image "CD" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?)
end if
if FloppyDirectory$ is not empty and there is a folder FloppyDirectory$ and floppyHasAStartupFolder = 1 then
set the visible of image "Diskette" to true
call mouseDown of image "Diskette" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?)
end if
-----------------------------------------------------------------
end if
----------------------------------------------------------------------------------------------------------------
put IndentSize into field "TextIndentSizeField" of card "Card3"
-------------------------------------------------
call mouseDown of image "Root" of card "Card1" --INCLUDED HERE FOR UNIVERSAL EDITION
put SourceDirectory$ into field "Text2"
--breakpoint
Global InputDirectory$ --INCLUDED HERE FOR UNIVERSAL EDITION
put SourceDirectory$ into InputDirectory$
put 1 into GotPathAlready
put empty into field "List1"
--breakpoint
--Check InputDirectory$ here: it appears to be empty in this mouseUp call:
call mouseUp of button "GetFolderButton" of card "Card3"
put field "ListExpandedField" of card "Card3" into field "List1" of this card
put field "List1" into field "plain" --##### INTRODUCED IN UNIVERSAL EDITION ###############
call Patch_To_Remove_Trailing_Blanks of this stack --##### INTRODUCED IN UNIVERSAL EDITION ###############
call prettify_List1 of this stack
end get_ini_parameters
----------------------------------------------------------------------------------------------
on iconifyStack
Global AdjustingWindow
if AdjustingWindow = 1 then pass iconifyStack
Global ProgramWindowIsMinimized
put 1 into ProgramWindowIsMinimized
end iconifyStack
----------------------------------------------------------------------------------------------
on remove_all_drivebox_highlights
Global AdjustingWindow
if AdjustingWindow = 1 then pass remove_all_drivebox_highlights
put image "Root_Blank" into image "Root"
put image "CD_Blank" into image "CD"
put image "Diskette_Blank" into image "Diskette"
end remove_all_drivebox_highlights
----------------------------------------------------------------------------------------------
on error_reading_diskette
Global AdjustingWindow
if AdjustingWindow = 1 then pass error_reading_diskette
put empty into field "List2" of card "Card1" --*********************
if the sysError is 21 or the sysError is 1235 then
Global DoingDiskError
put 1 into DoingDiskError
end if
remove_all_drivebox_highlights
end error_reading_diskette
on get_startup_folder
Global Init
if Init = 1 then pass get_startup_folder
Global SourceDirectory$ --e.g. c:\ (Windows)
Global StartupPath$ --e.g. c:\francis\posto (Windows)
Global InputDirectory$ --PUT EARLIER HERE FOR UNIVERSAL EDITION
if field "List1" of card "Card1" is empty then pass get_startup_folder
put StartupPath$ into field "Text2"
put StartupPath$ into SourceDirectory$
put SourceDirectory$ into InputDirectory$
put 1 into GotPathAlready
put empty into field "List1"
-----------------------------------------------------------------
Global IndentSize
--Global InputDirectory$ --PUT EARLIER FOR UNIVERSAL EDITION (see above)
Global Counter
put 0 into Counter
repeat for 30 times
put Counter + 1 into Counter
if exists (field ("LabelBlockField" & Counter) of card "Card3") then
delete field ("LabelBlockField" & Counter) of card "Card3"
end if
end repeat
if the last character of InputDirectory$ is ":" then
put (InputDirectory$ & "/") into InputDirectory$ --LINUX
end if
put InputDirectory$ into field "Text1Field" of card "Card3"
--e.g. InputDirectory$:
--d:\program files\howsoft\html slideshow (Windows)
--Get the items of this string and put them into LabelBlockField0, LabelBlockField1 ....
set the itemDelimiter to "/" --LINUX
put 0 into Counter
repeat for each item ThisItem in InputDirectory$
put Counter + 1 into Counter
if the last item of InputDirectory$ is ThisItem then
if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then
clone field "LabelBlockField0" of card "Card3"
set the name of it to ("LabelBlockField" & Counter)
end if
put ThisItem into field ("LabelBlockField" & Counter) of card "Card3"
exit repeat
else
if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then
clone field "LabelBlockField0" of card "Card3"
set the name of it to ("LabelBlockField" & Counter)
end if
put ThisItem into field ("LabelBlockField" & Counter) of card "Card3"
end if
end repeat
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to InputDirectory$
------------------------------------------------------------------------------
if the sysError is 21 or the sysError is 1235 then
put "" into field "Text2" of card "Card1"
put "" into SourceDirectory$
error_reading_diskette
pass get_startup_folder
end if
---------------------------------------------------------------------------------
put the files into field "ListFilesField" of card "Card3"
sort lines of field "ListFilesField" of card "Card3"
put empty into field "ListSubfoldersField" of card "Card3"
put the folders into field "ListSubfoldersField" of card "Card3"
delete line 1 of field "ListSubfoldersField" of card "Card3" --*****************************
sort lines of field "ListSubfoldersField" of card "Card3"
--THIS PART IS TO MAKE LITERALLY THE PORTION OF THE LIST THAT NEEDS TO BE INCLUDED
--AS A RESULT OF CLICKING ON A "+" LINE
--The new items appearing in ListExpanded need to be tested one by one to see
--whether they also contain folders. This determines whether they have "+" or Chr$(160)
-- + Chr$(160) before them.
if field "ListSubfoldersField" of card "Card3" is empty then
put "no" into field "LabelLastBlockContainsFoldersField" of card "Card3"
else
put "yes" into field "LabelLastBlockContainsFoldersField" of card "Card3"
end if
put (Counter + 1) into field "LabelNumberOfBlocksField" of card "Card3"
put empty into field "ListExpandedField" of card "Card3"
--You have items in ListSubfolders such as:
--d:\program files\adobe\acrobat 5.0 (Windows)
--The number of blocks is in Counter + 1 or LabelNumberOfBlocks.Caption
--The IndentSize is multiplied by the Sourcepath's number of blocks - 2,
--or in other words, the max block number - 1
----------------------------------------------------------------------------------------------
Global LHSIndentInBlankChars
put ((Counter - 1) * IndentSize) into LHSIndentInBlankChars
----------------------------------------------------------------------------------------------
if LHSIndentInBlankChars < 0 then
put 0 into LHSIndentInBlankChars
end if
put LHSIndentInBlankChars into field "LabelLHSIndentInBlankCharsField" of card "Card3"
repeat for each line ThisLine in field "ListSubfoldersField" of card "Card3"
put empty into field "TempField" of card "Card3"
set the defaultFolder to InputDirectory$ & "/" & ThisLine
put the folders into field "TempField" of card "Card3"
delete line 1 of field "TempField" of card "Card3" --*********************
sort lines of field "TempField" of card "Card3"
if the number of lines in field "TempField" of card "Card3" is 0 then
put (numToChar(160) & numToChar(160) & ThisLine) into ThisLine
else
put ("+" & ThisLine) into ThisLine
end if
if the number of characters in ThisLine > 0 then
put ((field "ListExpandedField" of card "Card3") & return & ThisLine) into field "ListExpandedField" of card "Card3"
end if
end repeat
-----------------------------------------------------------------
-----------------------------------------------------------------
put field "ListExpandedField" of card "Card3" into field "List1" of this card
delete the first line of field "List1" of this card
Global PathShowingInText2$
put field "Text2" of card "Card1" into PathShowingInText2$
set the defaultFolder to PathShowingInText2$
put the files into field "ListFilesField" of card "Card3"
sort lines of field "ListFilesField" of card "Card3"
call filter_out_files of field "List1" of card "Card1"
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
end get_startup_folder
------------------------------------------
on Position_Controls
Global PreviewPictureHeight
Global WidgetWidth
Global WidgetHeight
if PreviewPictureHeight < 140 then put 140 into PreviewPictureHeight
put the width of this stack into WidgetWidth
put the height of this stack into WidgetHeight
if WidgetWidth < 320 then
put 320 into WidgetWidth
end if
if WidgetHeight < 380 then
put 380 into WidgetHeight --New minimum for picture chooser
end if
set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15)
set the top of button "Cancel" to the top of button "OK"
set the right of button "Cancel" to (the left of button "OK" - 5)
set the top of button "Filters" to the top of button "OK"
set the width of button "Filters" to (the left of button "Cancel" - 20)
set the left of button "Filters" to 15
--------------------------------------------------------------------
set the top of button "Cancel" to the top of button "Cancel" + 4
set the top of button "OK" to the top of button "OK" + 4
-------------------------------------------------------------------
put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists
put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width
set the width of field "List1" to List1Width
set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1")
set the left of field "List1" to 15
--set the left of field "List2" to the right of field "List1"
set the left of field "List2" to (the right of field "List1" - 4)
-----------------------------------------------
--Alteration:
--List2 is now set to the right of List1 - 4
--Width is adjusted so that RH margin is 15
set the left of field "List2" to (the right of field "List1" - 4)
set the width of field "List2" to the right of button "OK" - the right of field "List1" + 4 + 7 --The reason for the +7 is not known
--set the width of field "List2" to the right of button "OK" - the right of field "List1" + 7 --The reason for the +7 is not known
set the left of field "List2" to (the right of field "List1" - 4)
set the width of field "suggestedFilename" to the width of field "List2" - 3
set the left of field "suggestedFilename" to the left of field "List2"
-----------------------------------------------
put (the top of button "Filters" - 10) - (the bottom of image "Root" + 10) - PreviewPictureHeight into theListHeight
set the height of field "List1" to theListHeight
set the height of field "List2" to theListHeight
set the top of field "List1" to (the bottom of image "Root" + 10)
set the top of field "List2" to (the bottom of image "Root" + 10)
set the width of image "Preview" to (the right of field "List2" - the left of field "List1")
set the height of image "Preview" to ((the top of button "Filters" - 10) - (the bottom of field "List1" + 10))
set the left of image "Preview" to the left of field "List1"
set the top of image "Preview" to (the bottom of field "List1" + 10)
-----------------------------------------
if the selectedline of field "List2" of card "Card1" is not zero then
set the visible of image "Preview" to false
end if
----------------------------------------------
--Alteration:
global suggestedFileNameExists
if suggestedFileNameExists is not empty then
set the height of field "List2" to (the height of field "List2" - the height of field "suggestedFileName")
set the top of field "suggestedFileName" to the bottom of field "List2" - 3
set the visible of field "suggestedFileName" to true
end if
end Position_Controls
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
on prettify_List1
Patch_To_Correct_Indents
--THIS ROUTINE HAS BEEN REFORMED IN ORDER TO ELIMINATE THE USE OF THE find INSTRUCTIONS:
--Under some circumstances they cause a crash.
if field "List1" is not empty then
--put field "List1" into field "list1Pretty"
lock screen
--folderClosed 1085
--folderOpen 1089
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
----------------------------------------------------------------------------
--find string "+" in field "List1"
--if the foundChunk is not empty then
--set the imageSource of the foundChunk to 1085 --CLOSED FOLDER
--end if
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "+" then
put charCounter into foundPos
exit repeat
end if
end repeat
if foundPos > 0 then
set the imageSource of char foundPos of line lineCounter of field "List1" to 1085 --CLOSED FOLDER
end if
end repeat
-----------------------------------
--find empty
-----------------------------------
--repeat for each line thisLine in field "List1"
--find string "--" in field "List1"
----put the foundChunk
--if the foundChunk is not empty then
--set the imageSource of the foundChunk to 1089 --OPEN FOLDER
--set the itemDelimiter to space
--put item 4 of the foundChunk into charToDelete
----delete char charToDelete of field "List1" --****************REMOVED************************
--end if
--end repeat
--find empty
--------------------------------------------------------------------
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "-" and char (charCounter + 1) of thisLine = "-" then
put charCounter into foundPos
exit repeat
end if
end repeat
if foundPos > 0 then
set the imageSource of char foundPos of line lineCounter of field "List1" to 1089 --OPEN FOLDER
put numtochar(160) into char (foundPos + 1) of line lineCounter of field "List1"
end if
end repeat
-------------------------------------------------------------------------------------------------------------------------------
--field "lineTemp"
put 0 into counter
repeat for each line thisLine in field "List1"
put counter + 1 into counter
put thisLine into field "lineTemp" of card "Card1"
------------------------------------------------------
--find string "+" in field "lineTemp" of card "Card1" --FOR SUBSTITUTION
put line 1 of field "lineTemp" of card "Card1" into thisLine
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "+" then
put charCounter into foundPos
exit repeat
end if
end repeat
----------
--if the foundChunk is not empty then
if foundPos > 0 then
---------------------------------------------------
--set the itemDelimiter to space --FOR SUBSTITUTION
--put item 2 of the foundChunk into charPos --FOR SUBSTITUTION
put foundPos into charPos
--------------------------------------------------
if char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not space and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not space then
put "+" into char charPos of line counter of field "List1"
--In the case that + appears as part of a folder name and has been accidentally replaced with a folder image,
--the above puts the + sign back.
end if
end if
end repeat
unlock screen
end if
end prettify_List1
----------------------------------------------------------------------------------------------------------------------------------
on Patch_To_Correct_Indents
--THIS ROUTINE DOES NOT WORK OK.
--THE ONLY SOLUTION IS TO FIND OUT WHY THE INDENTS ARE INCORRECT IN THE FIRST PLACE
exit Patch_To_Correct_Indents
--For any line in field "List1", if the next line has an indent which is greater than the IndentSize, then reduce it.
--"If the indent of the current line is greater than the ORIGINAL indent of the previous line, then --#####
--make it ONE IndentSize greater than the previous line's CURRENT indent" --#####
--@@@@@@@@@@@@@@@@@@@@@@@@@@
--The problem here is that it may not be just the NEXT line which has a greater indent than it should have,
--but a SERIES of lines.
--Therefore, once found, you need to examine all following lines to determine whether they have the
--same problem.
--@@@@@@@@@@@@@@@@@@@@@@@@@@
global IndentSize
put 0 into lineCounter
put 0 into previousSpaceCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into spaceCounter
repeat for each char thisChar in thisLine
if thisChar = space then
put spaceCounter + 1 into spaceCounter
else
exit repeat
end if
end repeat
put spaceCounter into previousSpaceCounter --#####
--Reduce current line to (previousLineSpaceCounter + IndentSize) exactly:
put 0 into previousLineSpaceCounter
put 0 into previousLineIsOpenFolder
repeat for each char thisChar in line (lineCounter - 1) of field "List1" of card "Card1"
if thisChar = space then
put previousLineSpaceCounter + 1 into previousLineSpaceCounter
else
if thisChar = "-" then
put 1 into previousLineIsOpenFolder
end if
exit repeat
end if
end repeat
if (spaceCounter > (previousLineSpaceCounter + IndentSize - 1)) and ((previousLineSpaceCounter + IndentSize) > IndentSize) then
put empty into newLine
if previousLineIsOpenFolder = 1 then
repeat with n = 1 to (previousLineSpaceCounter + IndentSize)
put newLine & space into newLine
end repeat
--put n into theNumberOfBlanksInnewLine --WRONG
else
repeat with n = 1 to previousLineSpaceCounter
--BUT IF PREVIOUS LINE IS NOT AN OPEN FOLDER, DO NOT ADD THE IndentSize as ABOVE
put newLine & space into newLine
end repeat
end if
repeat with n = (previousSpaceCounter + 1) to (the length of thisLine)
--if char n of thisLine <> space then --CORRECTED FOR UNIVERSAL VERSION
put newLine & (char n of thisLine) into newLine
--end if
end repeat
put newLine into line lineCounter of field "List1" of card "Card1"
--@@@@@@@@@@@@@@@@@@@@@@@@@@
--The problem here is that it may not be just the NEXT line which has a greater indent than it should have,
--but a SERIES of lines.
--Therefore, once found, you need to examine all following lines to determine whether they have the
--same problem.
--@@@@@@@@@@@@@@@@@@@@@@@@@@
--DO IT HERE, and increase lineCounter by the number of lines found with the same problem:
--Do these following lines have spaceCounter number of blanks at the beginning of them?
--if so, give them the same number of preceding spaces as newLine has.
--STOP when you find a line that does NOT have spaceCounter number of blanks at the beginning of it.
if lineCounter < (the number of lines in field "List1" of card "Card1") then
put 0 into numberOfLinesWithTheSameProblem
repeat with lineCounter2 = (lineCounter + 1) to (the number of lines in field "List1" of card "Card1")
put numberOfLinesWithTheSameProblem + 1 into numberOfLinesWithTheSameProblem
put line lineCounter2 of field "List1" of card "Card1" into thisFollowingLine
put 0 into spaceCounter2
repeat for each char thisChar in thisFollowingLine
if thisChar = space then
put spaceCounter2 + 1 into spaceCounter2
else
exit repeat
end if
end repeat
if spaceCounter2 <> spaceCounter then
exit repeat
else
--This line has the same problem as the original line found:
--Give it the same number of preceding spaces as newLine has:
--Get the bare line without preceding blanks first:
put char spaceCounter2 to (the number of chars in thisFollowingLine) of thisFollowingLine into bareNewLine2
--Put in the preceding blanks:
--theNumberOfBlanksInnewLine has been saved above --WRONG - NOW REMOVED ABOVE
--Calculate the number of blanks in newLine saved previously:
put 0 into theNumberOfBlanksInnewLine
repeat for each char currentChar in newLine
if currentChar = space then
put theNumberOfBlanksInnewLine + 1 into theNumberOfBlanksInnewLine
else
exit repeat
end if
end repeat
put empty into leftIndent
repeat with m = 1 to theNumberOfBlanksInnewLine
put leftIndent & space into leftIndent
end repeat
put leftIndent & bareNewLine2 into newLine2
--Now substitute the old line with the new line:
put newLine2 into line lineCounter2 of field "List1"
end if
end repeat
--Increase lineCounter by the number of lines found with the same problem:
put lineCounter + numberOfLinesWithTheSameProblem into lineCounter
end if
--@@@@@@@@@@@@@@@@@@@@@@@@@@
else
put spaceCounter into previousSpaceCounter
end if
end repeat
end Patch_To_Correct_Indents
---------------------------------------------------------------------------------
on Patch_To_Remove_Trailing_Blanks
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into RHSblankCharPos
repeat with RHSblankCharPos = -1 down to (-1 * (the length of thisLine))
put char RHSblankCharPos of thisLine into thisChar
if thisChar is not space then exit repeat
end repeat
put char 1 to RHSblankCharPos of thisLine into thisLine
put thisLine into line lineCounter of field "List1" of card "Card1"
end repeat
end Patch_To_Remove_Trailing_Blanks
----------------------------------------------------------
on check_max_and_min
Global WidgetLeftPosition
Global WidgetTopPosition
global WidgetWidth
global WidgetHeight
global ScreenWidth
global ScreenHeight
global PreviewPictureHeight
global temp1
global temp2
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 9 of field "IniParametersField" of card "Card4" of this stack into temp1
--put line 10 of field "IniParametersField" of card "Card4" of this stack into temp2
put line 11 of field "IniParametersField" of card "Card4" of this stack into temp1
put line 12 of field "IniParametersField" of card "Card4" of this stack into temp2
put word 1 to -1 of temp1 into temp1
put word 1 to -1 of temp2 into temp2
put the toLower of temp1 into temp1
put the toLower of temp2 into temp2
if temp1 = "max" or temp1 = "maximum" or temp1 = "min" or temp1 = "minimum" or temp1 = empty then
if temp1 = "maximum" then
put "max" into temp1
end if
if temp1 = "minimum" or temp1 = empty then
put "min" into temp1
end if
if temp1 = "max" then
put (ScreenWidth - 11) into WidgetWidth
put 6 into WidgetLeftPosition
set the width of this stack to WidgetWidth
set the left of this stack to WidgetLeftPosition
end if
if temp1 = "min" then
put 320 into WidgetWidth
end if
else
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
end if
if temp2 = "max" or temp2 = "maximum" or temp2 = "min" or temp2 = "minimum" or temp2 = empty then
if temp2 = "maximum" then
put "max" into temp2
end if
if temp2 = "minimum" or temp2 = empty then
put "min" into temp2
end if
if temp2 = "max" then
put (ScreenHeight - PreviewPictureHeight - 78) into WidgetHeight
put 48 into WidgetTopPosition
set the height of this stack to WidgetHeight
set the top of this stack to WidgetTopPosition
end if
if temp2 = "min" then
put 240 into WidgetHeight
end if
else
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
end if
end check_max_and_min
AlreadyHidden false Card1 P Oon openCard /* hide this stack show this stack */ set the systemWindow of this stack to true --####################### set the visible of this stack to true --####################### -------------------------------------------------------------------------------------- --Private Sub Form_Load() --On Error Resume Next --'Global SourceDirectory$ --'Global IndentSize --'Global TreeFontname$ --'Global TreeFontsize --'Global TreeFontbold --'Global TreeFontitalic --Open App.Path + "\_HDtree.ini" For Input As #1 --Input #1, SourceDirectory$ --Input #1, IndentSize --Input #1, TreeFontname$ --Input #1, TreeFontsize --Input #1, TreeFontbold --Input #1, TreeFontitalic --Input #1, ScrollSmallAndLargeChange --Close #1 --If SourceDirectory$ = "" Then SourceDirectory$ = Form1.LabelSourceDirectory.Caption --If IndentSize = 0 Then IndentSize = Val(Form1.LabelIndentSize.Caption) --If TreeFontname$ = "" Then TreeFontname$ = Form1.LabelFontname.Caption --If TreeFontsize = 0 Then TreeFontsize = Val(Form1.LabelFontsize.Caption) --If Err <> 0 Then --If Trim$(LCase$(Form1.LabelFontbold.Caption)) = "yes" Then --TreeFontbold = -1 --Else --TreeFontbold = 0 --End If --End If --If Err <> 0 Then --If Trim$(LCase$(Form1.LabelFontitalic.Caption)) = "yes" Then --TreeFontitalic = -1 --Else --TreeFontitalic = 0 --End If --End If --If ScrollSmallAndLargeChange = 0 Then ScrollSmallAndLargeChange = 120 --Err = 0 --'Global IndentSize --Form3.TextIndentSize.Text = CStr(IndentSize) --Form1.List1.FontName = TreeFontname$ --Form1.List1.FontSize = TreeFontsize --Form1.List1.FontBold = TreeFontbold --Form1.List1.FontItalic = TreeFontitalic --Form1.List2.FontName = TreeFontname$ --Form1.Text2.FontName = TreeFontname$ --Form1.List2.FontSize = TreeFontsize --Form1.List2.FontBold = TreeFontbold --Form1.List2.FontItalic = TreeFontitalic --Form1.Text1.Text = SourceDirectory$ --Form3.Text1.Text = SourceDirectory$ --Form1.Text2.Text = SourceDirectory$ --Form1.VScroll1.SmallChange = ScrollSmallAndLargeChange --Form1.VScroll1.LargeChange = ScrollSmallAndLargeChange --'Global GotPathAlready --GotPathAlready = 1 --'Global InputDirectory$ --InputDirectory$ = SourceDirectory$ --Call Form3.Command1_Click --'Form3.Show 'for removal --'ListExpanded --For n = 0 To Form3.ListExpanded.ListCount - 1 --ThisItem$ = Form3.ListExpanded.List(n) --Form1.List1.AddItem ThisItem$ --Next n --'Form1.VScroll1.Min = -1 --'Form1.VScroll1.Max = ((Form1.List1.Height - Form1.VScroll1.Height + 270) / 15) + 10 --Adjust_Scroll --Set_Up_Drive_Icons --End Sub end openCard @| cREVGeometryCacheIDs 41172756560134 11231171838345429 11071171838637097 11131171838556736 11111139788054689 10791171838443051 11091171632939255 10891171838252773 11051171838312105 11061118892123274 10131171837839162 10971139787812740 10771171841116121 11221171839280827 11211136678675556 10731136222147167 10651136243598395 10661136244250907 10681171838409921 11081171839048849 11151283101878010 11241171838506879 11101171839011956 11141118863130578 10081171837897638 10981171664527105 10901118793781548 10041171838600238 11121139784011274 10761171838008685 11001171838218709 11041171838127911 11031139783554152 10741171752615433 10941171838092518 11021171839209663 11191171839086372 11161131039307932 10491139788302460 10821171837950981 10991139783681869 10751171837710309 10961171839123670 11171171839247658 11201139788124433 10801136297627586 10691139788241472 10811118793845487 10061139787915817 10781171631541321 10851171839174614 11181171838040257 1101 cREVGeometrycache total 52order cREVGeneral scriptChecksum ']Ӯ"scripteditorvscroll 0 bookmarks handlerList openCardscriptSelection char 15 to 14prevHandler openCardtempScript scripton openCard
hide this stack
show this stack
--------------------------------------------------------------------------------------
--Private Sub Form_Load()
--On Error Resume Next
--'Global SourceDirectory$
--'Global IndentSize
--'Global TreeFontname$
--'Global TreeFontsize
--'Global TreeFontbold
--'Global TreeFontitalic
--Open App.Path + "\_HDtree.ini" For Input As #1
--Input #1, SourceDirectory$
--Input #1, IndentSize
--Input #1, TreeFontname$
--Input #1, TreeFontsize
--Input #1, TreeFontbold
--Input #1, TreeFontitalic
--Input #1, ScrollSmallAndLargeChange
--Close #1
--If SourceDirectory$ = "" Then SourceDirectory$ = Form1.LabelSourceDirectory.Caption
--If IndentSize = 0 Then IndentSize = Val(Form1.LabelIndentSize.Caption)
--If TreeFontname$ = "" Then TreeFontname$ = Form1.LabelFontname.Caption
--If TreeFontsize = 0 Then TreeFontsize = Val(Form1.LabelFontsize.Caption)
--If Err <> 0 Then
--If Trim$(LCase$(Form1.LabelFontbold.Caption)) = "yes" Then
--TreeFontbold = -1
--Else
--TreeFontbold = 0
--End If
--End If
--If Err <> 0 Then
--If Trim$(LCase$(Form1.LabelFontitalic.Caption)) = "yes" Then
--TreeFontitalic = -1
--Else
--TreeFontitalic = 0
--End If
--End If
--If ScrollSmallAndLargeChange = 0 Then ScrollSmallAndLargeChange = 120
--Err = 0
--'Global IndentSize
--Form3.TextIndentSize.Text = CStr(IndentSize)
--Form1.List1.FontName = TreeFontname$
--Form1.List1.FontSize = TreeFontsize
--Form1.List1.FontBold = TreeFontbold
--Form1.List1.FontItalic = TreeFontitalic
--Form1.List2.FontName = TreeFontname$
--Form1.Text2.FontName = TreeFontname$
--Form1.List2.FontSize = TreeFontsize
--Form1.List2.FontBold = TreeFontbold
--Form1.List2.FontItalic = TreeFontitalic
--Form1.Text1.Text = SourceDirectory$
--Form3.Text1.Text = SourceDirectory$
--Form1.Text2.Text = SourceDirectory$
--Form1.VScroll1.SmallChange = ScrollSmallAndLargeChange
--Form1.VScroll1.LargeChange = ScrollSmallAndLargeChange
--'Global GotPathAlready
--GotPathAlready = 1
--'Global InputDirectory$
--InputDirectory$ = SourceDirectory$
--Call Form3.Command1_Click
--'Form3.Show 'for removal
--'ListExpanded
--For n = 0 To Form3.ListExpanded.ListCount - 1
--ThisItem$ = Form3.ListExpanded.List(n)
--Form1.List1.AddItem ThisItem$
--Next n
--'Form1.VScroll1.Min = -1
--'Form1.VScroll1.Max = ((Form1.List1.Height - Form1.VScroll1.Height + 270) / 15) + 10
--Adjust_Scroll
--Set_Up_Drive_Icons
--End Sub
end openCard
- ) * , 1 2 3 4 5 6 7 8 9 : B F b c d Card2 @ @| cREVGeometryCacheIDs 1133977327166 10561133977215380 10551133977612235 10591134039519824 10601133977086796 10541133976982003 10531133976894579 10521133977427446 10571133977512847 1058 cREVGeneral bookmarks handlerList tempScript prevHandler script cREVGeometryCache order total 9 ! " # $ ; Card3 @ @| cREVGeometryCacheIDs 1119190048195 10351119189931159 10311119190816768 10441119189985468 10331119189455452 10281119307150731 10471119190793357 10421136311191229 10701119189777949 10301119190612056 10401119190806827 10431119190588911 10391119190165934 10371119189538606 10291136400604207 10721119190535316 10381119190784587 1041 cREVGeometryCache order total 17 . 0 Card4 @ cREVGeometryCacheIDs 1136214694160 10631136215150469 10641119121093971 1015 cREVGeometryCache order total 3 ' ( List1 )8 |on rawKeyDown end rawKeyDown on mouseUp --call prettify_List1Copy of this stack --set the HTMLtext of field "List1" to the HTMLtext of field "List1Copy" end mouseUp on mouseDown put empty into image "Preview" of card "Card1" set the visible of image "Preview" of card "Card1" to false --disable button "OK" of card "Card1" Global DoingSelect If DoingSelect = 1 Then pass mouseDown --''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --'When the operator clicks on a line with "+" WITH SOME INDENT --'1) Save the tree up to and including the clicked line in traceback.txt --'2) Set the SourceDirectory$ (see original program) and run the traceback module. --'3) Note the HDpath (to the line clicked) --'4) Input the ENTIRE HDpath from above to the Expand Folder module --'5) This module produces a new segment (with the expanded folders) to be included --'in the tree immediately after the line with "+" that was clicked. --'6) Put the traceback.txt data from 1), the new segment data from 5) and the rest --'of the treefile after the "+" line that was clicked all together to form a new treefile. --''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --'When the operator clicks on a line with "+" WITH NO INDENT --'a) Deduce the path to the line clicked from the line clicked itself --'b) Continue for 4) above --'c) When copying back the data in step 6), a single indent will be needed in the --'new segment --'************************************************************************************** --put field "plain" into field "List1" --#################### Global LineNumberClicked Global ItemClicked$ lock screen ------------------------------------------------------------------------- put the second word of the mouseline into LineNumberClicked --put the the value of the clickLine into ItemClicked$ --e.g. +home (whole line) --It seems that the LineNumberClicked is no longer being detected correctly (because of put field "plain" into field "List1" --above??) --Experiment: --put 6 into LineNumberClicked --YOU NEED TO CLICK ON THE +home LINE ----------------------------------------------------------------------- --EXPERIMENTAL FOR UNIVERSAL VERSION --THIS LINE HAS BEEN MOVED UPWARDS (SEE BELOW) put line LineNumberClicked of field "List1" into ItemClicked$ ---------------------------------------------------------------------- --PATCH FOR UNIVERSAL EDITION: if line 1 of field "plain" is empty then delete line 1 of field "plain" end if ---------------------------------------------------------------------- put field "plain" into field "List1" --#################### call Patch_To_Remove_Trailing_Blanks of this stack --------------------------------------------------------------------- --put line LineNumberClicked of field "List1" into ItemClicked$ ----The above has now been modified: --put the second word of the mouseline into LineNumberClicked ----put LineNumberClicked --TEMP ONLY ******** ----put field "List1Copy" into field "List1" ----THE ABOVE LINE SEEMS TO UPSET THE Card3 GetFolderButton mouseUp routine!!! ----This is not surprising, since you are changing List1 before the mouseDown routine has been completed! --put line LineNumberClicked of field "List1Copy" into ItemClicked$ --e.g. +home (whole line) ----put ItemClicked$ --TEMP ONLY ******** ----------------------------------------------------------------------- if char 1 of ItemClicked$ <> " " Then call LineClickedWithNoIndent unlock screen pass mouseDown end if if char 1 of ItemClicked$ = " " then call LineClickedWithIndent unlock screen pass mouseDown end if pass mouseDown end mouseDown ----------------------------------------------------------------------------------- on LineClickedWithNoIndent Global ItemClicked$ if char 1 of ItemClicked$ = "+" Then call LineClickedWithNoIndentButPlus --******************************************************************** if the charToNum of the last char of field "List1" = 10 then delete the last char of field "List1" --************************* Global LineNumberClicked select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if if char 1 of ItemClicked$ = "-" Then call LineClickedWithNoIndentButMinus --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if if char 1 of ItemClicked$ = numtochar(160) then call LineClickedWithNoIndentButChr160 --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if end LineClickedWithNoIndent ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButPlus Global PathBlock$ Global SourceDirectory$ Global ItemClicked$ Global HDPathToExpand$ put char 2 to -1 of ItemClicked$ into PathBlock$ If char -1 of SourceDirectory$ = "/" Then --LINUX put SourceDirectory$ & PathBlock$ into HDPathToExpand$ Else put SourceDirectory$ & "/" & PathBlock$ into HDPathToExpand$ --LINUX End If Global InputDirectory$ put HDPathToExpand$ into field "Text1Field" of card "card3" put word 1 to -1 of field "Text1Field" of card "card3" into InputDirectory$ Global GotPathAlready put 1 into GotPathAlready call mouseUp of button "GetFolderButton" of card "card3" --'The new segment is now in Form3.ListExpanded --'It will need indents added to it. put empty into field "List3" Global LineNumberClicked put 0 into n repeat (LineNumberClicked -1) times put n + 1 into n put line n of field "List1" into ThisItem$ put field "List3" & ThisItem$ & return into field "List3" end repeat Global PathBlock$ put "--" & PathBlock$ into NewItemClicked$ put field "List3" & NewItemClicked$ into field "List3" Global IndentSize put 0 into n repeat until n = the number of lines of field "ListExpandedField" of card "Card3" put n + 1 into n put line n of field "ListExpandedField" of card "Card3" into ThisItem$ put 0 into c if IndentSize > 0 then repeat until c = IndentSize put c + 1 into c put space & ThisItem$ into ThisItem$ end repeat end if put field "List3" & ThisItem$ & return into field "List3" end repeat --Global LineNumberClicked If LineNumberClicked < the number of lines of field "List1" then put LineNumberClicked into n repeat until n = the number of lines of field "List1" put n + 1 into n put line n of field "List1" into ThisItem$ put field "List3" & ThisItem$ & return into field "List3" end repeat --NewTreeNowMounted: end if put empty into field "List1" put 0 into n repeat until n = the number of lines of field "List3" put n + 1 into n put line n of field "List3" into ThisItem$ put field "List1" & ThisItem$ & return into field "List1" end repeat put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack Global LineNumberClicked select line LineNumberClicked of field "List1" put HDPathToExpand$ into field "Text2" set the label of this stack to field "Text2" of card "Card1" put empty into field "List2" ------------------------------------------ Global HDPathToExpand$ set the defaultFolder to HDPathToExpand$ put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files ----------------------------------------- if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithNoIndentButPlus end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --FilesAllListed: Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButPlus ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButMinus --'e.g. --'--Program Files <--------------------YOU CLICKED HERE --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader --' ActiveX --' Browser --' JavaScripts --' Legal --' Optional --' --plug_ins --' InterTrust --' Movie --' +WEBBUY --'+rebol --'The task here is simply to remove everything following the line clicked up to (but --'not including) +rebol and to change the line clicked from minus to plus: --'+Program Files <--------------------YOU CLICKED HERE --'Then, you need to show what files (if any) are present in the clicked line folder --'The path to the directory is simply Global SourceDirectory$ + "\Program Files" --'''''''''''''''''''''''''''''''''''''''''''''' --'e.g. --'--Program Files <--------------------YOU CLICKED HERE Global LineNumberClicked --######################### CORRECTION ######################## --put the second word of the mouseline into LineNumberClicked --REMOVED (Causes trouble) --THE ABOVE HAD ALREADY BEEN REMOVED IN THE PREVIOUS VERSION --######################### CORRECTION ######################## Global ItemClicked$ --put the value of the clickLine into ItemClicked$ put line LineNumberClicked of field "List1" into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "/" Then --LINUX put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'Show files straight away: put empty into field "List2" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to PathToLineClicked$ put the files into field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files ------------------------------- sort lines of field "ListFilesField" of card "Card3" if field "ListFilesField" of card "Card3" is not empty then put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end if --ShownAllFilesNIB: --'''''''''''''''''''''''''''' --'--Program Files <--------------------YOU CLICKED HERE --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader --' ActiveX --' Browser --' JavaScripts --' Legal --' Optional --' --plug_ins --' InterTrust --' Movie --' +WEBBUY --'+rebol --'The task here is simply to remove everything following the line clicked up to (but --'not including) +rebol and to change the line clicked from minus to plus: put empty into field "List3" of card "Card1" put 0 into n if LineNumberClicked > 0 then repeat for (LineNumberClicked -1) times put (n + 1) into n put line n of field "List1" into LineToAdd put (field "List3" & return & LineToAdd) into field "List3" end repeat delete line 1 of field "List3" --************* end if --CopiedUpToLineBeforeLineClickedNIB: --'Change the line clicked from minus to plus and copy it: put ("+" & EndBlock$) into NewLineClicked$ put (field "List3" & return & NewLineClicked$) into field "List3" --'Remove all following lines until you find another line with no blanks on the LHS --'OR EOF: put LineNumberClicked into ThisLineNumber repeat forever put (ThisLineNumber + 1) into ThisLineNumber If the first char of line ThisLineNumber of field "List1" <> space then exit repeat if ThisLineNumber = the number of lines in field "List1" then exit repeat end repeat if ThisLineNumber < the number of lines in field "List1" then put (ThisLineNumber - 1) into n put (field "List3" & return) into field "List3" repeat forever put (n + 1) into n put line n of field "List1" into ThisItem$ put (field "List3" & ThisItem$ & return) into field "List3" if n = the number of lines in field "List1" then exit repeat end repeat end if --CopiedRestOfFileNIB: --'Copy from List3 back to List1: -------------------------------------------------- if LineNumberClicked = 1 then delete line 1 of field "List3" --************************************* -------------------------------------------------- put field "List3" into field "List1" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButMinus ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButChr160 --'e.g. --'+Program Files --'+rebol --'+shit --'shit2 <-----------YOU CLICKED HERE --'+VB1 --'+VisualWx --'+WINDOWS --'+WindowsME.BAK --'--WINICON --' BIN --' +IPL --'The only action here is to show what files may or may not be present in shit2 --'The path to the directory is simply Global SourceDirectory$ + "\shit2" --'''''''''''''''''''''''''''''''''''''''''''''' --'shit2 <-----------YOU CLICKED HERE Global LineNumberClicked --put the second word of the mouseline into LineNumberClicked --REMOVED (Causes trouble) Global ItemClicked$ --put the the value of the clickLine into ItemClicked$ put line LineNumberClicked of field "List1" into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "/" Then --LINUX put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'Show files straight away: put empty into field "List2" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to PathToLineClicked$ put the files into field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" if field "ListFilesField" of card "Card3" is not empty then put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end if put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack --ShownAllFilesChr160: select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButChr160 --------------------------------------------------------------------------------------------------------------- on LineClickedWithIndent Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --********** --put the the value of the clickLine into ItemClicked$ --********** --put line LineNumberClicked of field "List1" into ItemClicked$ put ItemClicked$ into TestString$ put word 1 to -1 of TestString$ into TestString$ if the first char of TestString$ is "+" then call LineClickedWithIndentAndPlus if the first char of TestString$ is "-" then call LineClickedWithIndentAndMinus if the charToNum of the first char of TestString$ is 160 then call LineClickedWithIndentAndChr160 --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithIndent -------------------------------------------------------------- on LineClickedWithIndentAndPlus Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --********** --put the the value of the clickLine into ItemClicked$ --********** --put line LineNumberClicked of field "List1" into ItemClicked$ --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine Global PathToLineClicked$ Global HDPathToExpand$ put PathToLineClicked$ into HDPathToExpand$ Global InputDirectory$ put HDPathToExpand$ into field "Text1Field" of card "Card3" put word 1 to -1 of field "Text1Field" of card "Card3" into InputDirectory$ Global GotPathAlready put 1 into GotPathAlready call mouseUp of button "GetFolderButton" of card "Card3" --'************************************* --'THE ITEMS IN Card3.ListExpanded WILL ALSO NEED ANOTHER INDENT ADDED TO THEM --'************************************* --'The new segment is now in Card3.ListExpanded --'It will need indents added to it. put empty into field "List3" of card "Card1" put 0 into n repeat until n = LineNumberClicked -1 --Corrected (-1 now included) put n + 1 into n put ((field "List3" of card "Card1") & (line n of field "List1" of card "Card1") & return) into field "List3" of card "Card1" end repeat Global PathBlock$ --**** put (the number of characters in ItemClicked$ - the number of characters in PathBlock$ - 1) into NumberOfBlanks put empty into LHSBlanks$ put 0 into n repeat until n = NumberOfBlanks put n + 1 into n put LHSBlanks$ & space into LHSBlanks$ end repeat put LHSBlanks$ & "--" & PathBlock$ into NewItemClicked$ put field "List3" of card "Card1" & NewItemClicked$ & return into field "List3" of card "Card1" Global IndentSize put 0 into n put empty into PrecedingSpaces$ repeat until n = IndentSize put n + 1 into n put (PrecedingSpaces$ & space) into PrecedingSpaces$ end repeat ------------------------------------------------------- put LHSBlanks$ & PrecedingSpaces$ into PrecedingSpaces$ --EXPERIMENTAL ONLY ------------------------------------------------------- ------------------------------------------------------- --PATCH --Global LHSIndentInBlankChars --EXPERIMENTALLY REMOVED --put 0 into n --EXPERIMENTALLY REMOVED --put empty into PrecedingSpaces$ --EXPERIMENTALLY REMOVED --repeat until n = LHSIndentInBlankChars --EXPERIMENTALLY REMOVED --put n + 1 into n --EXPERIMENTALLY REMOVED --put (PrecedingSpaces$ & space) into PrecedingSpaces$ --EXPERIMENTALLY REMOVED --end repeat --EXPERIMENTALLY REMOVED ------------------------------------------------------- put 0 into n delete the first line of field "ListExpandedField" of card "Card3" --********************** repeat until n = the number of lines in field "ListExpandedField" of card "Card3" put n + 1 into n put line n of field "ListExpandedField" of card "Card3" into ThisItem$ put (PrecedingSpaces$ & ThisItem$) into ThisItem$ put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1" end repeat if the number of lines in field "List1" of card "Card1" > LineNumberClicked then put LineNumberClicked into n repeat until n = the number of lines in field "List1" of card "Card1" put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1" end repeat end if --NewTreeNowMountedB: put empty into field "List1" of card "Card1" put 0 into n repeat until n = the number of lines in field "List3" of card "Card1" put n + 1 into n put line n of field "List3" of card "Card1" into ThisItem$ Put field "List1" of card "Card1" & ThisItem$ & return into field "List1" of card "Card1" end repeat put HDPathToExpand$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" put empty into field "List2" of card "Card1" if the number of lines in field "ListFilesField" of card "Card3" > 0 then put 0 into n repeat until n = the number of lines in field "ListFilesField" of card "Card3" put n + 1 into n put line n of field "ListFilesField" of card "Card3" into ThisItem$ put field "List2" of card "Card1" & ThisItem$ & return into field "List2" of card "Card1" end repeat end if --FilesAllListedB: --select line LineNumberClicked of field "List1" of card "Card1" --REMOVED IN UNIVERSAL VERSION (SEE BELOW) ------------------------------------------------------ Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ set the label of this stack to field "Text2" of card "Card1" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --*********** put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack select line LineNumberClicked of field "List1" of card "Card1" end LineClickedWithIndentAndPlus -------------------------------------------------------------- on LineClickedWithIndentAndMinus --'e.g. --'--Program Files --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader <--------------------YOU CLICKED HERE --' ActiveX --' Browser --' JavaScripts --' Legal --' Optional --' --plug_ins --' InterTrust --' Movie --' +WEBBUY --'+rebol --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent. --'Then you need to change the line clicked into --' +Reader <--------------------YOU CLICKED HERE --'and show what files (if any) it contains. --'HOWEVER: --'You do not know what the path to "Reader" is. You need to do a TRACEBACK in order --'to discover the path. This can be done at any time before attempting to show --'the files. --'''''''''''''''''''''''''''''''''''''''''''' Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --********** --put the the value of the clickLine into ItemClicked$ --********** --put line LineNumberClicked of field "List1" into ItemClicked$ --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine --'Output is PathToLineClicked$ --'e.g. c:\Program Files\-Adobe (Windows) Global PathToLineClicked$ --'Rather than mess with the traceback routine itself, it is easier to remove the --'incorrect "-" here: put ((the number of chars in PathToLineClicked$) + 1) into n repeat until n = 1 put n - 1 into n put char n of PathToLineClicked$ into ThisChar$ if ThisChar$ = "/" then exit repeat --LINUX end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\-posto --N.B. minus sign in front of posto (Windows) put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$ put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$ put LeftBit$ & RightBit$ into PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'''''''''''''''''''''''''''''''''''''''''''' --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent. --'Then you need to change the line clicked into --' +Reader <--------------------YOU CLICKED HERE --'and show what files (if any) it contains. --'''''''''''''''''''''''''''''''''''''''''''' --'Copy up to line before the one clicked: put empty into field "List3" of card "Card1" if LineNumberClicked > 0 then put 0 into n repeat until n = LineNumberClicked - 1 put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1" end repeat end if --NOTE THAT IN LIST 3, CURSOR IS PLACED AT LINE LineNumberClicked --CopiedUpToLineBeforeLineClickedIM: --'Now change -- into + and copy the line clicked: --'e.g. --' --Reader <--------------------YOU CLICKED HERE put word 1 to -1 of ItemClicked$ into ItemClickedWithoutLHSblanks$ put ((the number of chars in ItemClicked$) - (the number of chars in ItemClickedWithoutLHSblanks$)) into NumberOfBlanksOnLHSItemClicked put ItemClickedWithoutLHSblanks$ into ItemClicked$ put char 3 to -1 of ItemClicked$ into ItemClicked$ put empty into LHSBlanks$ put 0 into n repeat until n = NumberOfBlanksOnLHSItemClicked put n + 1 into n put LHSBlanks$ & space into LHSBlanks$ end repeat put LHSBlanks$ & "+" & ItemClicked$ into ItemClicked$ --'e.g. --' +Reader <--------------------YOU CLICKED HERE put ((field "List3" of card "Card1") & (ItemClicked$)) into field "List3" of card "Card1" --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent OR EOF. repeat with n = (LineNumberClicked + 1) to (the number of lines in field "List1" of card "Card1") put line n of field "List1" of card "Card1" into ThisItem$ put word 1 to -1 of ThisItem$ into ThisItemWithoutLHSBlanks$ put the number of chars in ThisItem$ - the number of chars in ThisItemWithoutLHSBlanks$ into NumberOfBlanksOnLHS If NumberOfBlanksOnLHS <= NumberOfBlanksOnLHSItemClicked Then exit repeat end repeat --FoundLineWithEqualOrLesserNumberOfIndentsIM: --'Copy rest of list: if n < the number of lines in field "List1" of card "Card1" then put field "List3" of card "Card1" & return into field "List3" of card "Card1" --*********************************** put n - 1 into n repeat until n = ((the number of lines in field "List1" of card "Card1") -1) put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1" end repeat put ((field "List3" of card "Card1") & (the last line of field "List1" of card "Card1")) into field "List3" of card "Card1" --i.e. the last line copied does not have return after it end if --CopiedRestOfListIM: --'Copy List3 back to List1: put field "List3" of card "Card1" into field "List1" of card "Card1" --'Show what files (if any) ItemClicked$ contains put empty into field "List2" ------------------------------------------------------ Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ set the label of this stack to field "Text2" of card "Card1" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithIndentAndMinus end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --ShownAllFilesIM: end LineClickedWithIndentAndMinus -------------------------------------------------------------- on LineClickedWithIndentAndChr160 --'e.g. --'+WINDOWS --'+WindowsME.BAK --'--WINICON --' BIN <--------------------YOU CLICKED HERE --' +IPL --'You just need to show what files (if any) the clicked directory contains. --'HOWEVER: --'You do not know what the path to "BIN" is. You need to do a TRACEBACK in order --'to discover the path. This needs to be done before attempting to show --'the files. --''''''''''''''''''''''''''''''''''''''''''' Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --********** --put the the value of the clickLine into ItemClicked$ --********** --put line LineNumberClicked of field "List1" into ItemClicked$ --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine --'Output is PathToLineClicked$ Global PathToLineClicked$ --'e.g. --'c:\Program Files\Adobe\Acrobat 5.0\Reader\Browser (Windows) --'This has an incorrect Chr$(160) inserted in the last path block. --'Rather than mess with the traceback routine itself, it is easier to remove the --'incorrect chr(160) here: put ((the number of chars in PathToLineClicked$) + 1) into n repeat until n = 1 put n - 1 into n put char n of PathToLineClicked$ into ThisChar$ if ThisChar$ = "/" then exit repeat --LINUX end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\ posto --N.B. chr$(160) sign in front of posto (Windows) put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$ put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$ put LeftBit$ & RightBit$ into PathToLineClicked$ --Form1.Text2.Text = PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'Show files straight away: Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ put empty into field "List2" of card "Card1" --********************************** put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithIndentAndChr160 end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end LineClickedWithIndentAndChr160 --------------------------------------------------------------------------------------------------------------- on TracebackSubroutine Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --put the the value of the clickLine into ItemClicked$ --put line LineNumberClicked of field "List1" into ItemClicked$ put 0 into n put empty into field "traceback_txt" of card "Card2" repeat until n = LineNumberClicked put (n + 1) into n put ((field "traceback_txt" of card "Card2") & (line n of field "List1" of card "Card1") & return) into field "traceback_txt" of card "Card2" end repeat Global SourceDirectory$ put SourceDirectory$ into field "TextSourceDirectory" of card "Card2" call Do_Traceback --'e.g. +Help Global PathBlock$ --*** put word 1 to -1 of ItemClicked$ into tempString$ put tempString$ into PathBlock$ put char 2 to -1 of PathBlock$ into PathBlock$ --*****************************corrected******* Global PathToLineClicked$ put field "TextPath" of card "Card2" & "/" & PathBlock$ into PathToLineClicked$ --LINUX end TracebackSubroutine --'#################################################################################### on Do_Traceback put 0 into n --***************** LabelBlock0 NO LONGER DELETED repeat until n = 30 put (n + 1) into n if exists(field ("LabelBlock" & n) of card "Card2") then delete field ("LabelBlock" & n) of card "Card2" --NOTE THAT THIS ALSO DELETES THE ORIGINAL LabelBlock0 field end if end repeat put empty into field "List1" of card "Card2" put 0 into CounterX repeat until CounterX = the number of lines in field "traceback_txt" of card "Card2" put (CounterX + 1) into CounterX put ((field "List1" of card "Card2") & (line CounterX of field "traceback_txt" of card "Card2") & return) into field "List1" of card "Card2" end repeat put CounterX into NumberOfLinesInTracebackFile --'It is the last line in this file that needs to be traced back put CounterX into field "LabelNumberOfLinesInTracebackFile" of card "Card2" put CounterX into LastLineListNumber put LastLineListNumber into field "LabelLastLineListNumber" of card "Card2" put 0 into CounterX put 0 into n repeat until n = LastLineListNumber put n + 1 into n put line n of field "List1" of card "Card2" into ThisItem$ if char 1 of ThisItem$ <> " " Then put n into CounterX end if end repeat put CounterX into TracebackLineNumber put TracebackLineNumber into field "LabelTracebackLineNumber" of card "Card2" put CounterX into TracebackListNumber put TracebackListNumber into field "LabelTracebackListNumber" of card "Card2" put the last line of field "List1" of card "Card2" into LastLineInTracebackFile$ put word 1 to -1 of LastLineInTracebackFile$ into trimmedString$ put ((the number of chars in LastLineInTracebackFile$) - (the number of chars in trimmedString$)) into NumberOfBlanksOnLHSOfLastLineInTracebackFile --'************************************************************************************** put NumberOfBlanksOnLHSOfLastLineInTracebackFile + 1 into NumberOfBlanksOnLHSOfLastLineInTracebackFile --'THE ADDITION OF 1 TO THIS VALUE IS SIMPLY TO MAKE SURE THE PROGRAM DETECTS THE --'DIFFERENCE IN INDENT in relation to the previous item being traced back --'(see also correction at ###). --'************************************************************************************** --'NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile --NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 'to compensate for the adjustment above put NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 into NumberOfPrecedingBlanksPreviousLine --'The above compensates for the "artificial" adjustment of 1 made immediately above, --'OTHERWISE THE "ERROR" IS CARRIED FORWARD IN NumberOfPrecedingBlanksPreviousLine --'AND CONTINUES GROWING!!!!! put 0 into CounterX repeat with c = LastLineListNumber down to TracebackListNumber put line c of field "List1" of card "Card2" into ThisItem$ --**************************************************** --SOMEHOW OR OTHER, BLANKS ARE GETTING PUT ON THE RHS OF --ThisItem$, causing this routine not to be executed --correctly. Until the cause is found, the following --patch simply lops off the blanks put char 1 to length(word 1 to -1 of ThisItem$) + (offset(word 1 of ThisItem$, ThisItem$) - 1) of ThisItem$ into ThisItem$ --**************************************************** put word 1 to -1 of ThisItem$ into trimmedItem$ put ((the number of chars in ThisItem$) - (the number of chars in trimmedItem$)) into NumberOfPrecedingBlanksThisLine put trimmedItem$ into ThisItem$ if char 1 to 2 of ThisItem$ = "--" And NumberOfPrecedingBlanksThisLine < NumberOfPrecedingBlanksPreviousLine Then put NumberOfPrecedingBlanksThisLine into NumberOfPrecedingBlanksPreviousLine put CounterX + 1 into CounterX clone field "LabelBlock0" of card "Card2" set the name of it to ("LabelBlock" & CounterX) set the visible of field ("LabelBlock" & CounterX) of card "Card2" to true --PROBABLY NOT NEC set the left of field ("LabelBlock" & CounterX) of card "Card2" to (the left of field ("LabelBlock" & (CounterX -1)) of card "Card2" + the width of field ("LabelBlock" & (CounterX -1)) of card "Card2") set the top of field ("LabelBlock" & CounterX) of card "Card2" to the top of field "LabelBlock0" of card "Card2" put char 3 to -1 of ThisItem$ into field ("LabelBlock" & CounterX) of card "Card2" end if end repeat put field "TextSourceDirectory" of card "Card2" into field "LabelBlock0" of card "Card2" --'Blocks 1 onwards are in the wrong order, so reverse them to make the path: put field "LabelBlock0" of card "Card2" into OutputPath$ if the last char of OutputPath$ <> "/" Then put OutputPath$ & "/" into OutputPath$ --LINUX repeat with c = CounterX down to 1 put OutputPath$ & field ("LabelBlock" & c) of card "Card2" & "/" into OutputPath$ --LINUX end repeat ------------------------------------------------------------------ put char 1 to -2 of OutputPath$ into OutputPath$ put OutputPath$ into field "TextPath" of card "Card2" end Do_Traceback --------------------------------------------------------------------------------------------------------------- on filter_out_files put the selectedText of button "Filters" of card "Card1" into currentSelectedFilter$ --e.g. *.* All files if (word 1 of currentSelectedFilter$ <> "*.*") and (the number of lines of field "ListFilesField" of card "Card3" > 0) then put word 1 of currentSelectedFilter$ into FilterSelected$ --e.g. *.* repeat with n = 1 to the number of chars in FilterSelected$ put char n of FilterSelected$ into ThisChar$ if ThisChar$ = "." then exit repeat end repeat put n into dotPosition put char dotPosition to -1 of FilterSelected$ into dotAndSuffixOfCurrentFilter$ put toLower(dotAndSuffixOfCurrentFilter$) into LowerCasedotAndSuffixOfCurrentFilter$ put empty into field "FilteredFiles" of card "Card3" repeat with n = 1 to the number of lines of field "ListFilesField" of card "Card3" put line n of field "ListFilesField" of card "Card3" into ThisLine$ put toLower(ThisLine$) into LowerCaseThisLine$ --e.g. tomas.JPG -- N.B. Capital letters --IF YOU DELETE LINES DURING THIS REPEAT, YOU MAY HAVE CONFUSION RE-DEFINING ThisLine$ CORRECTLY. --IT MIGHT BE SAFER TO CREATE A NEW FIELD. --matchChunk("Hello","Hel") -- returns true if matchChunk(LowerCaseThisLine$, LowerCasedotAndSuffixOfCurrentFilter$) is true and LowerCaseThisLine$ <> "" then put (the number of chars in LowerCasedotAndSuffixOfCurrentFilter$) into SuffixLength put (-1 * SuffixLength) into SuffixLength put 1 into MatchIsOK repeat with s = SuffixLength down to -1 -- or DOWN to ??? put char s of LowerCaseThisLine$ into a put char s of LowerCasedotAndSuffixOfCurrentFilter$ into b if a <> b then put 0 into MatchIsOK end repeat if MatchIsOK = 1 then put field "FilteredFiles" of card "Card3" & ThisLine$ & return into field "FilteredFiles" of card "Card3" end if end if end repeat --delete the last char (return) of field "FilteredFiles": if the charToNum of the last char of field "FilteredFiles" of card "Card3" = 10 then delete the last char of field "FilteredFiles" of card "Card3" end if put field "FilteredFiles" of card "Card3" into field "ListFilesField" of card "Card3" end if end filter_out_files --------------------------------------------------------------------------------------------------------------------------- @ 2 cREVGeneral @ scriptChecksum ѳaqmwphandlerList 6rawKeyDown mouseUp mouseDown LineClickedWithNoIndent LineClickedWithNoIndentButPlus LineClickedWithNoIndentButMinus LineClickedWithNoIndentButChr160 LineClickedWithIndent LineClickedWithIndentAndPlus LineClickedWithIndentAndMinus LineClickedWithIndentAndChr160 TracebackSubroutine Do_Traceback filter_out_filesbreakPoints scriptSelection char 20820 to 20819scripteditorvscroll 6293revUniqueID 1118793781548 bookmarks scripteditorselection 12924tempScript prevHandler mouseUpscripton rawKeyDown
end rawKeyDown
on mouseUp
--call prettify_List1Copy of this stack
--set the HTMLtext of field "List1" to the HTMLtext of field "List1Copy"
end mouseUp
on mouseDown
put empty into image "Preview" of card "Card1"
set the visible of image "Preview" of card "Card1" to false
--disable button "OK" of card "Card1"
Global DoingSelect
If DoingSelect = 1 Then pass mouseDown
--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
--'When the operator clicks on a line with "+" WITH SOME INDENT
--'1) Save the tree up to and including the clicked line in traceback.txt
--'2) Set the SourceDirectory$ (see original program) and run the traceback module.
--'3) Note the HDpath (to the line clicked)
--'4) Input the ENTIRE HDpath from above to the Expand Folder module
--'5) This module produces a new segment (with the expanded folders) to be included
--'in the tree immediately after the line with "+" that was clicked.
--'6) Put the traceback.txt data from 1), the new segment data from 5) and the rest
--'of the treefile after the "+" line that was clicked all together to form a new treefile.
--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
--'When the operator clicks on a line with "+" WITH NO INDENT
--'a) Deduce the path to the line clicked from the line clicked itself
--'b) Continue for 4) above
--'c) When copying back the data in step 6), a single indent will be needed in the
--'new segment
--'**************************************************************************************
--put field "plain" into field "List1" --####################
Global LineNumberClicked
Global ItemClicked$
lock screen
-------------------------------------------------------------------------
put the second word of the mouseline into LineNumberClicked
--put the the value of the clickLine into ItemClicked$ --e.g. +home (whole line)
--It seems that the LineNumberClicked is no longer being detected correctly (because of put field "plain" into field "List1"
--above??)
--Experiment:
--put 6 into LineNumberClicked --YOU NEED TO CLICK ON THE +home LINE
-----------------------------------------------------------------------
--EXPERIMENTAL FOR UNIVERSAL VERSION
--THIS LINE HAS BEEN MOVED UPWARDS (SEE BELOW)
put line LineNumberClicked of field "List1" into ItemClicked$
----------------------------------------------------------------------
--PATCH FOR UNIVERSAL EDITION:
if line 1 of field "plain" is empty then
delete line 1 of field "plain"
end if
----------------------------------------------------------------------
put field "plain" into field "List1" --####################
call Patch_To_Remove_Trailing_Blanks of this stack
---------------------------------------------------------------------
--put line LineNumberClicked of field "List1" into ItemClicked$
----The above has now been modified:
--put the second word of the mouseline into LineNumberClicked
----put LineNumberClicked --TEMP ONLY ********
----put field "List1Copy" into field "List1"
----THE ABOVE LINE SEEMS TO UPSET THE Card3 GetFolderButton mouseUp routine!!!
----This is not surprising, since you are changing List1 before the mouseDown routine has been completed!
--put line LineNumberClicked of field "List1Copy" into ItemClicked$ --e.g. +home (whole line)
----put ItemClicked$ --TEMP ONLY ********
-----------------------------------------------------------------------
if char 1 of ItemClicked$ <> " " Then
call LineClickedWithNoIndent
unlock screen
pass mouseDown
end if
if char 1 of ItemClicked$ = " " then
call LineClickedWithIndent
unlock screen
pass mouseDown
end if
pass mouseDown
end mouseDown
-----------------------------------------------------------------------------------
on LineClickedWithNoIndent
Global ItemClicked$
if char 1 of ItemClicked$ = "+" Then
call LineClickedWithNoIndentButPlus
--********************************************************************
if the charToNum of the last char of field "List1" = 10 then
delete the last char of field "List1" --*************************
Global LineNumberClicked
select line LineNumberClicked of field "List1"
end if
--********************************************************************
pass LineClickedWithNoIndent
end if
if char 1 of ItemClicked$ = "-" Then
call LineClickedWithNoIndentButMinus
--********************************************************************
if the charToNum of the last char of field "List1" = 10 then
Global LineNumberClicked
delete the last char of field "List1" --*************************
select line LineNumberClicked of field "List1"
end if
--********************************************************************
pass LineClickedWithNoIndent
end if
if char 1 of ItemClicked$ = numtochar(160) then
call LineClickedWithNoIndentButChr160
--********************************************************************
if the charToNum of the last char of field "List1" = 10 then
Global LineNumberClicked
delete the last char of field "List1" --*************************
select line LineNumberClicked of field "List1"
end if
--********************************************************************
pass LineClickedWithNoIndent
end if
end LineClickedWithNoIndent
-----------------------------------------------------------------------------------
on LineClickedWithNoIndentButPlus
Global PathBlock$
Global SourceDirectory$
Global ItemClicked$
Global HDPathToExpand$
put char 2 to -1 of ItemClicked$ into PathBlock$
If char -1 of SourceDirectory$ = "/" Then --LINUX
put SourceDirectory$ & PathBlock$ into HDPathToExpand$
Else
put SourceDirectory$ & "/" & PathBlock$ into HDPathToExpand$ --LINUX
End If
Global InputDirectory$
put HDPathToExpand$ into field "Text1Field" of card "card3"
put word 1 to -1 of field "Text1Field" of card "card3" into InputDirectory$
Global GotPathAlready
put 1 into GotPathAlready
call mouseUp of button "GetFolderButton" of card "card3"
--'The new segment is now in Form3.ListExpanded
--'It will need indents added to it.
put empty into field "List3"
Global LineNumberClicked
put 0 into n
repeat (LineNumberClicked -1) times
put n + 1 into n
put line n of field "List1" into ThisItem$
put field "List3" & ThisItem$ & return into field "List3"
end repeat
Global PathBlock$
put "--" & PathBlock$ into NewItemClicked$
put field "List3" & NewItemClicked$ into field "List3"
Global IndentSize
put 0 into n
repeat until n = the number of lines of field "ListExpandedField" of card "Card3"
put n + 1 into n
put line n of field "ListExpandedField" of card "Card3" into ThisItem$
put 0 into c
if IndentSize > 0 then
repeat until c = IndentSize
put c + 1 into c
put space & ThisItem$ into ThisItem$
end repeat
end if
put field "List3" & ThisItem$ & return into field "List3"
end repeat
--Global LineNumberClicked
If LineNumberClicked < the number of lines of field "List1" then
put LineNumberClicked into n
repeat until n = the number of lines of field "List1"
put n + 1 into n
put line n of field "List1" into ThisItem$
put field "List3" & ThisItem$ & return into field "List3"
end repeat
--NewTreeNowMounted:
end if
put empty into field "List1"
put 0 into n
repeat until n = the number of lines of field "List3"
put n + 1 into n
put line n of field "List3" into ThisItem$
put field "List1" & ThisItem$ & return into field "List1"
end repeat
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
Global LineNumberClicked
select line LineNumberClicked of field "List1"
put HDPathToExpand$ into field "Text2"
set the label of this stack to field "Text2" of card "Card1"
put empty into field "List2"
------------------------------------------
Global HDPathToExpand$
set the defaultFolder to HDPathToExpand$
put the files into field "ListFilesField" of card "Card3"
sort lines of field "ListFilesField" of card "Card3"
call filter_out_files
-----------------------------------------
if the number of lines of field "ListFilesField" of card "Card3" = 0 then
pass LineClickedWithNoIndentButPlus
end if
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
--FilesAllListed:
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
end LineClickedWithNoIndentButPlus
-----------------------------------------------------------------------------------
on LineClickedWithNoIndentButMinus
--'e.g.
--'--Program Files <--------------------YOU CLICKED HERE
--' +Accessories
--' +Adaptec
--' --Adobe
--' --Acrobat 5.0
--' +Help
--' --Reader
--' ActiveX
--' Browser
--' JavaScripts
--' Legal
--' Optional
--' --plug_ins
--' InterTrust
--' Movie
--' +WEBBUY
--'+rebol
--'The task here is simply to remove everything following the line clicked up to (but
--'not including) +rebol and to change the line clicked from minus to plus:
--'+Program Files <--------------------YOU CLICKED HERE
--'Then, you need to show what files (if any) are present in the clicked line folder
--'The path to the directory is simply Global SourceDirectory$ + "\Program Files"
--''''''''''''''''''''''''''''''''''''''''''''''
--'e.g.
--'--Program Files <--------------------YOU CLICKED HERE
Global LineNumberClicked
--put the second word of the mouseline into LineNumberClicked --REMOVED (Causes trouble)
Global ItemClicked$
--put the value of the clickLine into ItemClicked$
put line LineNumberClicked of field "List1" into ItemClicked$
Global SourceDirectory$
put char 3 to -1 of ItemClicked$ into EndBlock$
put SourceDirectory$ into DriveEtcBit$
If char -1 of DriveEtcBit$ = "/" Then --LINUX
put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$
end if
put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX
put PathToLineClicked$ into field "Text2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
--'Show files straight away:
put empty into field "List2"
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to PathToLineClicked$
put the files into field "ListFilesField" of card "Card3"
call filter_out_files
-------------------------------
sort lines of field "ListFilesField" of card "Card3"
if field "ListFilesField" of card "Card3" is not empty then
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
end if
--ShownAllFilesNIB:
--''''''''''''''''''''''''''''
--'--Program Files <--------------------YOU CLICKED HERE
--' +Accessories
--' +Adaptec
--' --Adobe
--' --Acrobat 5.0
--' +Help
--' --Reader
--' ActiveX
--' Browser
--' JavaScripts
--' Legal
--' Optional
--' --plug_ins
--' InterTrust
--' Movie
--' +WEBBUY
--'+rebol
--'The task here is simply to remove everything following the line clicked up to (but
--'not including) +rebol and to change the line clicked from minus to plus:
put empty into field "List3" of card "Card1"
put 0 into n
if LineNumberClicked > 0 then
repeat for (LineNumberClicked -1) times
put (n + 1) into n
put line n of field "List1" into LineToAdd
put (field "List3" & return & LineToAdd) into field "List3"
end repeat
delete line 1 of field "List3" --*************
end if
--CopiedUpToLineBeforeLineClickedNIB:
--'Change the line clicked from minus to plus and copy it:
put ("+" & EndBlock$) into NewLineClicked$
put (field "List3" & return & NewLineClicked$) into field "List3"
--'Remove all following lines until you find another line with no blanks on the LHS
--'OR EOF:
put LineNumberClicked into ThisLineNumber
repeat forever
put (ThisLineNumber + 1) into ThisLineNumber
If the first char of line ThisLineNumber of field "List1" <> space then exit repeat
if ThisLineNumber = the number of lines in field "List1" then exit repeat
end repeat
if ThisLineNumber < the number of lines in field "List1" then
put (ThisLineNumber - 1) into n
put (field "List3" & return) into field "List3"
repeat forever
put (n + 1) into n
put line n of field "List1" into ThisItem$
put (field "List3" & ThisItem$ & return) into field "List3"
if n = the number of lines in field "List1" then exit repeat
end repeat
end if
--CopiedRestOfFileNIB:
--'Copy from List3 back to List1:
--------------------------------------------------
if LineNumberClicked = 1 then delete line 1 of field "List3" --*************************************
--------------------------------------------------
put field "List3" into field "List1"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
select line LineNumberClicked of field "List1"
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
end LineClickedWithNoIndentButMinus
-----------------------------------------------------------------------------------
on LineClickedWithNoIndentButChr160
--'e.g.
--'+Program Files
--'+rebol
--'+shit
--' shit2 <-----------YOU CLICKED HERE
--'+VB1
--'+VisualWx
--'+WINDOWS
--'+WindowsME.BAK
--'--WINICON
--' BIN
--' +IPL
--'The only action here is to show what files may or may not be present in shit2
--'The path to the directory is simply Global SourceDirectory$ + "\shit2"
--''''''''''''''''''''''''''''''''''''''''''''''
--' shit2 <-----------YOU CLICKED HERE
Global LineNumberClicked
--put the second word of the mouseline into LineNumberClicked --REMOVED (Causes trouble)
Global ItemClicked$
--put the the value of the clickLine into ItemClicked$
put line LineNumberClicked of field "List1" into ItemClicked$
Global SourceDirectory$
put char 3 to -1 of ItemClicked$ into EndBlock$
put SourceDirectory$ into DriveEtcBit$
If char -1 of DriveEtcBit$ = "/" Then --LINUX
put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$
end if
put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX
put PathToLineClicked$ into field "Text2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
--'Show files straight away:
put empty into field "List2"
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to PathToLineClicked$
put the files into field "ListFilesField" of card "Card3"
call filter_out_files
sort lines of field "ListFilesField" of card "Card3"
if field "ListFilesField" of card "Card3" is not empty then
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
end if
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
--ShownAllFilesChr160:
select line LineNumberClicked of field "List1"
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
end LineClickedWithNoIndentButChr160
---------------------------------------------------------------------------------------------------------------
on LineClickedWithIndent
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked --**********
--put the the value of the clickLine into ItemClicked$ --**********
--put line LineNumberClicked of field "List1" into ItemClicked$
put ItemClicked$ into TestString$
put word 1 to -1 of TestString$ into TestString$
if the first char of TestString$ is "+" then call LineClickedWithIndentAndPlus
if the first char of TestString$ is "-" then call LineClickedWithIndentAndMinus
if the charToNum of the first char of TestString$ is 160 then call LineClickedWithIndentAndChr160
--********************************************************************
if the charToNum of the last char of field "List1" = 10 then
Global LineNumberClicked
delete the last char of field "List1" --*************************
select line LineNumberClicked of field "List1"
end if
--********************************************************************
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
end LineClickedWithIndent
--------------------------------------------------------------
on LineClickedWithIndentAndPlus
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked --**********
--put the the value of the clickLine into ItemClicked$ --**********
--put line LineNumberClicked of field "List1" into ItemClicked$
--SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE
call TracebackSubroutine
Global PathToLineClicked$
Global HDPathToExpand$
put PathToLineClicked$ into HDPathToExpand$
Global InputDirectory$
put HDPathToExpand$ into field "Text1Field" of card "Card3"
put word 1 to -1 of field "Text1Field" of card "Card3" into InputDirectory$
Global GotPathAlready
put 1 into GotPathAlready
call mouseUp of button "GetFolderButton" of card "Card3"
--'*************************************
--'THE ITEMS IN Card3.ListExpanded WILL ALSO NEED ANOTHER INDENT ADDED TO THEM
--'*************************************
--'The new segment is now in Card3.ListExpanded
--'It will need indents added to it.
put empty into field "List3" of card "Card1"
put 0 into n
repeat until n = LineNumberClicked -1 --Corrected (-1 now included)
put n + 1 into n
put ((field "List3" of card "Card1") & (line n of field "List1" of card "Card1") & return) into field "List3" of card "Card1"
end repeat
Global PathBlock$ --****
put (the number of characters in ItemClicked$ - the number of characters in PathBlock$ - 1) into NumberOfBlanks
put empty into LHSBlanks$
put 0 into n
repeat until n = NumberOfBlanks
put n + 1 into n
put LHSBlanks$ & space into LHSBlanks$
end repeat
put LHSBlanks$ & "--" & PathBlock$ into NewItemClicked$
put field "List3" of card "Card1" & NewItemClicked$ & return into field "List3" of card "Card1"
Global IndentSize
put 0 into n
put empty into PrecedingSpaces$
repeat until n = IndentSize
put n + 1 into n
put (PrecedingSpaces$ & space) into PrecedingSpaces$
end repeat
-------------------------------------------------------
put LHSBlanks$ & PrecedingSpaces$ into PrecedingSpaces$ --EXPERIMENTAL ONLY
-------------------------------------------------------
-------------------------------------------------------
--PATCH
--Global LHSIndentInBlankChars --EXPERIMENTALLY REMOVED
--put 0 into n --EXPERIMENTALLY REMOVED
--put empty into PrecedingSpaces$ --EXPERIMENTALLY REMOVED
--repeat until n = LHSIndentInBlankChars --EXPERIMENTALLY REMOVED
--put n + 1 into n --EXPERIMENTALLY REMOVED
--put (PrecedingSpaces$ & space) into PrecedingSpaces$ --EXPERIMENTALLY REMOVED
--end repeat --EXPERIMENTALLY REMOVED
-------------------------------------------------------
put 0 into n
delete the first line of field "ListExpandedField" of card "Card3" --**********************
repeat until n = the number of lines in field "ListExpandedField" of card "Card3"
put n + 1 into n
put line n of field "ListExpandedField" of card "Card3" into ThisItem$
put (PrecedingSpaces$ & ThisItem$) into ThisItem$
put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1"
end repeat
if the number of lines in field "List1" of card "Card1" > LineNumberClicked then
put LineNumberClicked into n
repeat until n = the number of lines in field "List1" of card "Card1"
put n + 1 into n
put line n of field "List1" of card "Card1" into ThisItem$
put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1"
end repeat
end if
--NewTreeNowMountedB:
put empty into field "List1" of card "Card1"
put 0 into n
repeat until n = the number of lines in field "List3" of card "Card1"
put n + 1 into n
put line n of field "List3" of card "Card1" into ThisItem$
Put field "List1" of card "Card1" & ThisItem$ & return into field "List1" of card "Card1"
end repeat
put HDPathToExpand$ into field "Text2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
put empty into field "List2" of card "Card1"
if the number of lines in field "ListFilesField" of card "Card3" > 0 then
put 0 into n
repeat until n = the number of lines in field "ListFilesField" of card "Card3"
put n + 1 into n
put line n of field "ListFilesField" of card "Card3" into ThisItem$
put field "List2" of card "Card1" & ThisItem$ & return into field "List2" of card "Card1"
end repeat
end if
--FilesAllListedB:
--select line LineNumberClicked of field "List1" of card "Card1" --REMOVED IN UNIVERSAL VERSION (SEE BELOW)
------------------------------------------------------
Global InputDirectory$
put field "Text2" of card "Card1" into InputDirectory$
set the label of this stack to field "Text2" of card "Card1"
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to InputDirectory$
put the files into field "ListFilesField" of card "Card3"
call filter_out_files
sort lines of field "ListFilesField" of card "Card3"
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --***********
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
select line LineNumberClicked of field "List1" of card "Card1"
end LineClickedWithIndentAndPlus
--------------------------------------------------------------
on LineClickedWithIndentAndMinus
--'e.g.
--'--Program Files
--' +Accessories
--' +Adaptec
--' --Adobe
--' --Acrobat 5.0
--' +Help
--' --Reader <--------------------YOU CLICKED HERE
--' ActiveX
--' Browser
--' JavaScripts
--' Legal
--' Optional
--' --plug_ins
--' InterTrust
--' Movie
--' +WEBBUY
--'+rebol
--'What you need to do here is to remove everything up to (but not including)
--'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you
--'find a line of equal or lesser indent.
--'Then you need to change the line clicked into
--' +Reader <--------------------YOU CLICKED HERE
--'and show what files (if any) it contains.
--'HOWEVER:
--'You do not know what the path to "Reader" is. You need to do a TRACEBACK in order
--'to discover the path. This can be done at any time before attempting to show
--'the files.
--''''''''''''''''''''''''''''''''''''''''''''
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked --**********
--put the the value of the clickLine into ItemClicked$ --**********
--put line LineNumberClicked of field "List1" into ItemClicked$
--SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE
call TracebackSubroutine
--'Output is PathToLineClicked$
--'e.g. c:\Program Files\-Adobe (Windows)
Global PathToLineClicked$
--'Rather than mess with the traceback routine itself, it is easier to remove the
--'incorrect "-" here:
put ((the number of chars in PathToLineClicked$) + 1) into n
repeat until n = 1
put n - 1 into n
put char n of PathToLineClicked$ into ThisChar$
if ThisChar$ = "/" then exit repeat --LINUX
end repeat
put n into LastBackslashPos
--e.g. PathToLineClicked$ = c:\francis\-posto --N.B. minus sign in front of posto (Windows)
put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$
put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$
put LeftBit$ & RightBit$ into PathToLineClicked$
put PathToLineClicked$ into field "Text2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
--''''''''''''''''''''''''''''''''''''''''''''
--'What you need to do here is to remove everything up to (but not including)
--'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you
--'find a line of equal or lesser indent.
--'Then you need to change the line clicked into
--' +Reader <--------------------YOU CLICKED HERE
--'and show what files (if any) it contains.
--''''''''''''''''''''''''''''''''''''''''''''
--'Copy up to line before the one clicked:
put empty into field "List3" of card "Card1"
if LineNumberClicked > 0 then
put 0 into n
repeat until n = LineNumberClicked - 1
put n + 1 into n
put line n of field "List1" of card "Card1" into ThisItem$
put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1"
end repeat
end if
--NOTE THAT IN LIST 3, CURSOR IS PLACED AT LINE LineNumberClicked
--CopiedUpToLineBeforeLineClickedIM:
--'Now change -- into + and copy the line clicked:
--'e.g.
--' --Reader <--------------------YOU CLICKED HERE
put word 1 to -1 of ItemClicked$ into ItemClickedWithoutLHSblanks$
put ((the number of chars in ItemClicked$) - (the number of chars in ItemClickedWithoutLHSblanks$)) into NumberOfBlanksOnLHSItemClicked
put ItemClickedWithoutLHSblanks$ into ItemClicked$
put char 3 to -1 of ItemClicked$ into ItemClicked$
put empty into LHSBlanks$
put 0 into n
repeat until n = NumberOfBlanksOnLHSItemClicked
put n + 1 into n
put LHSBlanks$ & space into LHSBlanks$
end repeat
put LHSBlanks$ & "+" & ItemClicked$ into ItemClicked$
--'e.g.
--' +Reader <--------------------YOU CLICKED HERE
put ((field "List3" of card "Card1") & (ItemClicked$)) into field "List3" of card "Card1"
--'What you need to do here is to remove everything up to (but not including)
--'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you
--'find a line of equal or lesser indent OR EOF.
repeat with n = (LineNumberClicked + 1) to (the number of lines in field "List1" of card "Card1")
put line n of field "List1" of card "Card1" into ThisItem$
put word 1 to -1 of ThisItem$ into ThisItemWithoutLHSBlanks$
put the number of chars in ThisItem$ - the number of chars in ThisItemWithoutLHSBlanks$ into NumberOfBlanksOnLHS
If NumberOfBlanksOnLHS <= NumberOfBlanksOnLHSItemClicked Then exit repeat
end repeat
--FoundLineWithEqualOrLesserNumberOfIndentsIM:
--'Copy rest of list:
if n < the number of lines in field "List1" of card "Card1" then
put field "List3" of card "Card1" & return into field "List3" of card "Card1" --***********************************
put n - 1 into n
repeat until n = ((the number of lines in field "List1" of card "Card1") -1)
put n + 1 into n
put line n of field "List1" of card "Card1" into ThisItem$
put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1"
end repeat
put ((field "List3" of card "Card1") & (the last line of field "List1" of card "Card1")) into field "List3" of card "Card1"
--i.e. the last line copied does not have return after it
end if
--CopiedRestOfListIM:
--'Copy List3 back to List1:
put field "List3" of card "Card1" into field "List1" of card "Card1"
--'Show what files (if any) ItemClicked$ contains
put empty into field "List2"
------------------------------------------------------
Global InputDirectory$
put field "Text2" of card "Card1" into InputDirectory$
set the label of this stack to field "Text2" of card "Card1"
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to InputDirectory$
put the files into field "ListFilesField" of card "Card3"
call filter_out_files
sort lines of field "ListFilesField" of card "Card3"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
select line LineNumberClicked of field "List1" of card "Card1"
------------------------------------------------------
if the number of lines of field "ListFilesField" of card "Card3" = 0 then
pass LineClickedWithIndentAndMinus
end if
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
--ShownAllFilesIM:
end LineClickedWithIndentAndMinus
--------------------------------------------------------------
on LineClickedWithIndentAndChr160
--'e.g.
--'+WINDOWS
--'+WindowsME.BAK
--'--WINICON
--' BIN <--------------------YOU CLICKED HERE
--' +IPL
--'You just need to show what files (if any) the clicked directory contains.
--'HOWEVER:
--'You do not know what the path to "BIN" is. You need to do a TRACEBACK in order
--'to discover the path. This needs to be done before attempting to show
--'the files.
--'''''''''''''''''''''''''''''''''''''''''''
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked --**********
--put the the value of the clickLine into ItemClicked$ --**********
--put line LineNumberClicked of field "List1" into ItemClicked$
--SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE
call TracebackSubroutine
--'Output is PathToLineClicked$
Global PathToLineClicked$
--'e.g.
--'c:\Program Files\Adobe\Acrobat 5.0\Reader\ Browser (Windows)
--'This has an incorrect Chr$(160) inserted in the last path block.
--'Rather than mess with the traceback routine itself, it is easier to remove the
--'incorrect chr(160) here:
put ((the number of chars in PathToLineClicked$) + 1) into n
repeat until n = 1
put n - 1 into n
put char n of PathToLineClicked$ into ThisChar$
if ThisChar$ = "/" then exit repeat --LINUX
end repeat
put n into LastBackslashPos
--e.g. PathToLineClicked$ = c:\francis\ posto --N.B. chr$(160) sign in front of posto (Windows)
put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$
put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$
put LeftBit$ & RightBit$ into PathToLineClicked$
--Form1.Text2.Text = PathToLineClicked$
put PathToLineClicked$ into field "Text2" of card "Card1"
set the label of this stack to field "Text2" of card "Card1"
--'Show files straight away:
Global InputDirectory$
put field "Text2" of card "Card1" into InputDirectory$
put empty into field "List2" of card "Card1" --**********************************
put empty into field "ListFilesField" of card "Card3"
set the defaultFolder to InputDirectory$
put the files into field "ListFilesField" of card "Card3"
call filter_out_files
sort lines of field "ListFilesField" of card "Card3"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
select line LineNumberClicked of field "List1" of card "Card1"
------------------------------------------------------
if the number of lines of field "ListFilesField" of card "Card3" = 0 then
pass LineClickedWithIndentAndChr160
end if
put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"
end LineClickedWithIndentAndChr160
---------------------------------------------------------------------------------------------------------------
on TracebackSubroutine
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked
--put the the value of the clickLine into ItemClicked$
--put line LineNumberClicked of field "List1" into ItemClicked$
put 0 into n
put empty into field "traceback_txt" of card "Card2"
repeat until n = LineNumberClicked
put (n + 1) into n
put ((field "traceback_txt" of card "Card2") & (line n of field "List1" of card "Card1") & return) into field "traceback_txt" of card "Card2"
end repeat
Global SourceDirectory$
put SourceDirectory$ into field "TextSourceDirectory" of card "Card2"
call Do_Traceback
--'e.g. +Help
Global PathBlock$ --***
put word 1 to -1 of ItemClicked$ into tempString$
put tempString$ into PathBlock$
put char 2 to -1 of PathBlock$ into PathBlock$ --*****************************corrected*******
Global PathToLineClicked$
put field "TextPath" of card "Card2" & "/" & PathBlock$ into PathToLineClicked$ --LINUX
end TracebackSubroutine
--'####################################################################################
on Do_Traceback
put 0 into n --***************** LabelBlock0 NO LONGER DELETED
repeat until n = 30
put (n + 1) into n
if exists(field ("LabelBlock" & n) of card "Card2") then
delete field ("LabelBlock" & n) of card "Card2" --NOTE THAT THIS ALSO DELETES THE ORIGINAL LabelBlock0 field
end if
end repeat
put empty into field "List1" of card "Card2"
put 0 into CounterX
repeat until CounterX = the number of lines in field "traceback_txt" of card "Card2"
put (CounterX + 1) into CounterX
put ((field "List1" of card "Card2") & (line CounterX of field "traceback_txt" of card "Card2") & return) into field "List1" of card "Card2"
end repeat
put CounterX into NumberOfLinesInTracebackFile
--'It is the last line in this file that needs to be traced back
put CounterX into field "LabelNumberOfLinesInTracebackFile" of card "Card2"
put CounterX into LastLineListNumber
put LastLineListNumber into field "LabelLastLineListNumber" of card "Card2"
put 0 into CounterX
put 0 into n
repeat until n = LastLineListNumber
put n + 1 into n
put line n of field "List1" of card "Card2" into ThisItem$
if char 1 of ThisItem$ <> " " Then
put n into CounterX
end if
end repeat
put CounterX into TracebackLineNumber
put TracebackLineNumber into field "LabelTracebackLineNumber" of card "Card2"
put CounterX into TracebackListNumber
put TracebackListNumber into field "LabelTracebackListNumber" of card "Card2"
put the last line of field "List1" of card "Card2" into LastLineInTracebackFile$
put word 1 to -1 of LastLineInTracebackFile$ into trimmedString$
put ((the number of chars in LastLineInTracebackFile$) - (the number of chars in trimmedString$)) into NumberOfBlanksOnLHSOfLastLineInTracebackFile
--'**************************************************************************************
put NumberOfBlanksOnLHSOfLastLineInTracebackFile + 1 into NumberOfBlanksOnLHSOfLastLineInTracebackFile
--'THE ADDITION OF 1 TO THIS VALUE IS SIMPLY TO MAKE SURE THE PROGRAM DETECTS THE
--'DIFFERENCE IN INDENT in relation to the previous item being traced back
--'(see also correction at ###).
--'**************************************************************************************
--'NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile
--NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 'to compensate for the adjustment above
put NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 into NumberOfPrecedingBlanksPreviousLine
--'The above compensates for the "artificial" adjustment of 1 made immediately above,
--'OTHERWISE THE "ERROR" IS CARRIED FORWARD IN NumberOfPrecedingBlanksPreviousLine
--'AND CONTINUES GROWING!!!!!
put 0 into CounterX
repeat with c = LastLineListNumber down to TracebackListNumber
put line c of field "List1" of card "Card2" into ThisItem$
--****************************************************
--SOMEHOW OR OTHER, BLANKS ARE GETTING PUT ON THE RHS OF
--ThisItem$, causing this routine not to be executed
--correctly. Until the cause is found, the following
--patch simply lops off the blanks
put char 1 to length(word 1 to -1 of ThisItem$) + (offset(word 1 of ThisItem$, ThisItem$) - 1) of ThisItem$ into ThisItem$
--****************************************************
put word 1 to -1 of ThisItem$ into trimmedItem$
put ((the number of chars in ThisItem$) - (the number of chars in trimmedItem$)) into NumberOfPrecedingBlanksThisLine
put trimmedItem$ into ThisItem$
if char 1 to 2 of ThisItem$ = "--" And NumberOfPrecedingBlanksThisLine < NumberOfPrecedingBlanksPreviousLine Then
put NumberOfPrecedingBlanksThisLine into NumberOfPrecedingBlanksPreviousLine
put CounterX + 1 into CounterX
clone field "LabelBlock0" of card "Card2"
set the name of it to ("LabelBlock" & CounterX)
set the visible of field ("LabelBlock" & CounterX) of card "Card2" to true --PROBABLY NOT NEC
set the left of field ("LabelBlock" & CounterX) of card "Card2" to (the left of field ("LabelBlock" & (CounterX -1)) of card "Card2" + the width of field ("LabelBlock" & (CounterX -1)) of card "Card2")
set the top of field ("LabelBlock" & CounterX) of card "Card2" to the top of field "LabelBlock0" of card "Card2"
put char 3 to -1 of ThisItem$ into field ("LabelBlock" & CounterX) of card "Card2"
end if
end repeat
put field "TextSourceDirectory" of card "Card2" into field "LabelBlock0" of card "Card2"
--'Blocks 1 onwards are in the wrong order, so reverse them to make the path:
put field "LabelBlock0" of card "Card2" into OutputPath$
if the last char of OutputPath$ <> "/" Then put OutputPath$ & "/" into OutputPath$ --LINUX
repeat with c = CounterX down to 1
put OutputPath$ & field ("LabelBlock" & c) of card "Card2" & "/" into OutputPath$ --LINUX
end repeat
------------------------------------------------------------------
put char 1 to -2 of OutputPath$ into OutputPath$
put OutputPath$ into field "TextPath" of card "Card2"
end Do_Traceback
---------------------------------------------------------------------------------------------------------------
on filter_out_files
put the selectedText of button "Filters" of card "Card1" into currentSelectedFilter$
--e.g. *.* All files
if (word 1 of currentSelectedFilter$ <> "*.*") and (the number of lines of field "ListFilesField" of card "Card3" > 0) then
put word 1 of currentSelectedFilter$ into FilterSelected$
--e.g. *.*
repeat with n = 1 to the number of chars in FilterSelected$
put char n of FilterSelected$ into ThisChar$
if ThisChar$ = "." then exit repeat
end repeat
put n into dotPosition
put char dotPosition to -1 of FilterSelected$ into dotAndSuffixOfCurrentFilter$
put toLower(dotAndSuffixOfCurrentFilter$) into LowerCasedotAndSuffixOfCurrentFilter$
put empty into field "FilteredFiles" of card "Card3"
repeat with n = 1 to the number of lines of field "ListFilesField" of card "Card3"
put line n of field "ListFilesField" of card "Card3" into ThisLine$
put toLower(ThisLine$) into LowerCaseThisLine$
--e.g. tomas.JPG -- N.B. Capital letters
--IF YOU DELETE LINES DURING THIS REPEAT, YOU MAY HAVE CONFUSION RE-DEFINING ThisLine$ CORRECTLY.
--IT MIGHT BE SAFER TO CREATE A NEW FIELD.
--matchChunk("Hello","Hel") -- returns true
if matchChunk(LowerCaseThisLine$, LowerCasedotAndSuffixOfCurrentFilter$) is true and LowerCaseThisLine$ <> "" then
put (the number of chars in LowerCasedotAndSuffixOfCurrentFilter$) into SuffixLength
put (-1 * SuffixLength) into SuffixLength
put 1 into MatchIsOK
repeat with s = SuffixLength down to -1 -- or DOWN to ???
put char s of LowerCaseThisLine$ into a
put char s of LowerCasedotAndSuffixOfCurrentFilter$ into b
if a <> b then put 0 into MatchIsOK
end repeat
if MatchIsOK = 1 then
put field "FilteredFiles" of card "Card3" & ThisLine$ & return into field "FilteredFiles" of card "Card3"
end if
end if
end repeat
--delete the last char (return) of field "FilteredFiles":
if the charToNum of the last char of field "FilteredFiles" of card "Card3" = 10 then
delete the last char of field "FilteredFiles" of card "Card3"
end if
put field "FilteredFiles" of card "Card3" into field "ListFilesField" of card "Card3"
end if
end filter_out_files
---------------------------------------------------------------------------------------------------------------------------
@ 3 % ! @ List2 )8 ton rawKeyDown end rawKeyDown on mouseDown ------------------------------##################-------------------------------------- --This is a patch to avoid the program from exiting if the actual file is not found on the diskette --because it has been taken out of the drive (even though the drive is still mounted): --global disketteContentsOnShow --if disketteContentsOnShow =1 then --call mouseDown of image "Diskette" of this card --end if -----------------------------###################---------------------------------------------------- Global LineNumberClicked --REFERS TO List1 select line LineNumberClicked of field "List1" of card "Card1" enable button "OK" of card "Card1" Global FileItemClicked$ --put the the value of the clickLine into FileItemClicked$ --!!!!!!!!!2 "THEs"!! put the value of the clickLine into FileItemClicked$ put word 1 to -1 of field "Text2" of card "Card1" into PathToChosenFile$ if the last char of PathToChosenFile$ is "/" then --LINUX put char 1 to -2 of PathToChosenFile$ into PathToChosenFile$ end if Global OutputLine$ put PathToChosenFile$ & "/" & FileItemClicked$ into OutputLine$ --LINUX put FileItemClicked$ into field "suggestedFileName" ---------------------------------------------------------------------------------- --This is a patch to avoid the program from exiting if the actual file is not found on the diskette --because it has been taken out of the drive (even though the drive is still mounted): --if there is not a file OutputLine$ then --exit mouseDown --end if --THE ABOVE IS NOT SUFFICIENT ALONE (see beginning of mouseDown) ---------------------------------------------------------------------------------- set the visible of image "Preview" to false set the defaultStack to "InvisibleSubstack" create image OutputLine$ import paint from file OutputLine$ --In Windows, the whole path to the picture is used to form the name of the image imported, --but in Linux, only the file name (i.e. picture name) is used: put image FileItemClicked$ of stack "InvisibleSubstack" into image "Preview" of stack "PictureChooser" delete image OutputLine$ of stack "InvisibleSubstack" set the defaultStack to "PictureChooser" ---------------------------------------------------------------------------------- Global InitialLeftOfPreviewBox Global InitialTopOfPreviewBox Global InitialWidthOfPreviewBox Global InitialHeightOfPreviewBox ---------------------- -- Get the natural proportions of the picture: put the width of image "Preview" / the height of image "Preview" into Aspect -- The height of the picture is fixed as Global InitialHeightOfPreviewBox if the height of image "Preview" > InitialHeightOfPreviewBox then --***** set the height of image "Preview" to InitialHeightOfPreviewBox --FOR SOME PICTURES, THIS CAN FAIL! set the width of image "Preview" to (the height of image "Preview" * Aspect) end if --Work out what the width should be, maintaining the Aspect: --------------------------------------------- if the width of image "Preview" > InitialWidthOfPreviewBox then --***** set the width of image "Preview" to InitialWidthOfPreviewBox --FOR SOME PICTURES, THIS CAN FAIL! set the height of image "Preview" to (the width of image "Preview" / Aspect) end if --------------------------------------------- --Centralise the image horizontally: put (the width of card "Card1" - the width of image "Preview") into theDifference ------------------------------------------ if theDifference < 0 then put 30 into theDifference set the width of image "Preview" to (the right of field "List2" - the left of field "List1") set the height of image "Preview" to (the width of image "Preview" / Aspect) end if ----------------------------------------- put theDifference / 2 into theMargin set the left of image "Preview" to theMargin -- Make sure the top is correct: set the top of image "Preview" to (the bottom of field "List1" + 10) set the visible of image "Preview" to true end mouseDown @ 2 l cREVGeneral scriptChecksum \F1as8krrevUniqueID 1118793845487 bookmarks handlerList rawKeyDown mouseDowntempScript prevHandler mouseDoubleUpscriptSelection char 1273 to 1272script con rawKeyDown
end rawKeyDown
on mouseDown
------------------------------##################--------------------------------------
--This is a patch to avoid the program from exiting if the actual file is not found on the diskette
--because it has been taken out of the drive (even though the drive is still mounted):
--global disketteContentsOnShow
--if disketteContentsOnShow =1 then
--call mouseDown of image "Diskette" of this card
--end if
-----------------------------###################----------------------------------------------------
Global LineNumberClicked --REFERS TO List1
select line LineNumberClicked of field "List1" of card "Card1"
enable button "OK" of card "Card1"
Global FileItemClicked$
--put the the value of the clickLine into FileItemClicked$ --!!!!!!!!!2 "THEs"!!
put the value of the clickLine into FileItemClicked$
put word 1 to -1 of field "Text2" of card "Card1" into PathToChosenFile$
if the last char of PathToChosenFile$ is "/" then --LINUX
put char 1 to -2 of PathToChosenFile$ into PathToChosenFile$
end if
Global OutputLine$
put PathToChosenFile$ & "/" & FileItemClicked$ into OutputLine$ --LINUX
put FileItemClicked$ into field "suggestedFileName"
----------------------------------------------------------------------------------
--This is a patch to avoid the program from exiting if the actual file is not found on the diskette
--because it has been taken out of the drive (even though the drive is still mounted):
--if there is not a file OutputLine$ then
--exit mouseDown
--end if
--THE ABOVE IS NOT SUFFICIENT ALONE (see beginning of mouseDown)
----------------------------------------------------------------------------------
set the visible of image "Preview" to false
set the defaultStack to "InvisibleSubstack"
create image OutputLine$
import paint from file OutputLine$
--In Windows, the whole path to the picture is used to form the name of the image imported,
--but in Linux, only the file name (i.e. picture name) is used:
put image FileItemClicked$ of stack "InvisibleSubstack" into image "Preview" of stack "PictureChooser"
delete image OutputLine$ of stack "InvisibleSubstack"
set the defaultStack to "PictureChooser"
----------------------------------------------------------------------------------
Global InitialLeftOfPreviewBox
Global InitialTopOfPreviewBox
Global InitialWidthOfPreviewBox
Global InitialHeightOfPreviewBox
----------------------
-- Get the natural proportions of the picture:
put the width of image "Preview" / the height of image "Preview" into Aspect
-- The height of the picture is fixed as Global InitialHeightOfPreviewBox
if the height of image "Preview" > InitialHeightOfPreviewBox then --*****
set the height of image "Preview" to InitialHeightOfPreviewBox --FOR SOME PICTURES, THIS CAN FAIL!
set the width of image "Preview" to (the height of image "Preview" * Aspect)
end if
--Work out what the width should be, maintaining the Aspect:
---------------------------------------------
if the width of image "Preview" > InitialWidthOfPreviewBox then --*****
set the width of image "Preview" to InitialWidthOfPreviewBox --FOR SOME PICTURES, THIS CAN FAIL!
set the height of image "Preview" to (the width of image "Preview" / Aspect)
end if
---------------------------------------------
--Centralise the image horizontally:
put (the width of card "Card1" - the width of image "Preview") into theDifference
------------------------------------------
if theDifference < 0 then
put 30 into theDifference
set the width of image "Preview" to (the right of field "List2" - the left of field "List1")
set the height of image "Preview" to (the width of image "Preview" / Aspect)
end if
-----------------------------------------
put theDifference / 2 into theMargin
set the left of image "Preview" to theMargin
-- Make sure the top is correct:
set the top of image "Preview" to (the bottom of field "List1" + 10)
set the visible of image "Preview" to true
end mouseDown
initrd.img initrd.img.old vmlinuz vmlinuz.old @ ( 3 &