Changeset 473
- Timestamp:
- Feb 3, 2009 4:38:28 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/SA_includes_v400.ipf
r472 r473 24 24 25 25 #include "CheckVersionFTP" //added June 2008 26 #include "WriteQIS" //added Jan 2009 for fileSaveDialog27 26 28 27 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/WriteModelData_v40.ipf
r472 r473 84 84 if(dialog) 85 85 PathInfo/S catPathName 86 fullPath = DoSaveFileDialog("Save data as",fname=NameofWave(ywave)+".txt")86 fullPath = A_DoSaveFileDialog("Save data as",fname=NameofWave(ywave)+".txt") 87 87 If(cmpstr(fullPath,"")==0) 88 88 //user cancel, don't write out a file … … 100 100 return(0) 101 101 End 102 103 // returns the path to the file, or null if the user cancelled 104 // fancy use of optional parameters 105 // 106 // enforce short file names (26 characters) 107 // DUPLICATE of similar-named function in WriteQIS (including starts a bad dependency chain) 108 Function/S A_DoSaveFileDialog(msg,[fname,suffix]) 109 String msg,fname,suffix 110 Variable refNum 111 // String message = "Save the file as" 112 113 if(ParamIsDefault(fname)) 114 // Print "fname not supplied" 115 fname = "" 116 endif 117 if(ParamIsDefault(suffix)) 118 // Print "suffix not supplied" 119 suffix = "" 120 endif 121 122 String outputPath,tmpName,testStr 123 Variable badLength=0,maxLength=26,l1,l2 124 125 126 tmpName = fname + suffix 127 128 do 129 badLength=0 130 Open/D/M=msg/T="????" refNum as tmpName 131 outputPath = S_fileName 132 133 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename 134 if(strlen(testStr)==0) 135 break //cancel, allow exit 136 endif 137 if(strlen(testStr) > maxLength) 138 badlength = 1 139 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?" 140 if(V_flag==3) 141 outputPath = "" 142 break 143 endif 144 if(V_flag==1) //my suggested name is OK, so trim the output 145 badlength=0 146 l1 = strlen(testStr) //too long length 147 l1 = l1-maxLength //number to trim 148 //Print outputPath 149 l2=strlen(outputPath) 150 outputPath = outputPath[0,l2-1-l1] 151 //Print "modified ",outputPath 152 endif 153 //if(V_flag==2) do nothing, let it go around again 154 endif 155 156 while(badLength) 157 158 return outputPath 159 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/USANS_Includes.ipf
r472 r473 20 20 #include "CheckVersionFTP" //added June 2008 21 21 #include "GaussUtils_v40" //added Oct 2008 for unified file loading 22 #include "WriteQIS" //added Jan 2009 for fileSaveDialog -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/WriteUSANSData.ipf
r472 r473 53 53 if(dialog) 54 54 PathInfo/S catPathName 55 fullPath = DoSaveFileDialog("Save data as")55 fullPath = U_DoSaveFileDialog("Save data as") 56 56 If(cmpstr(fullPath,"")==0) 57 57 //user cancel, don't write out a file … … 199 199 End 200 200 201 201 // returns the path to the file, or null if the user cancelled 202 // fancy use of optional parameters 203 // 204 // enforce short file names (26 characters) 205 //DUPLICATE of similar-named function in WriteQIS (including starts a bad dependency cascade) 206 Function/S U_DoSaveFileDialog(msg,[fname,suffix]) 207 String msg,fname,suffix 208 Variable refNum 209 // String message = "Save the file as" 210 211 if(ParamIsDefault(fname)) 212 // Print "fname not supplied" 213 fname = "" 214 endif 215 if(ParamIsDefault(suffix)) 216 // Print "suffix not supplied" 217 suffix = "" 218 endif 219 220 String outputPath,tmpName,testStr 221 Variable badLength=0,maxLength=26,l1,l2 222 223 224 tmpName = fname + suffix 225 226 do 227 badLength=0 228 Open/D/M=msg/T="????" refNum as tmpName 229 outputPath = S_fileName 230 231 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename 232 if(strlen(testStr)==0) 233 break //cancel, allow exit 234 endif 235 if(strlen(testStr) > maxLength) 236 badlength = 1 237 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?" 238 if(V_flag==3) 239 outputPath = "" 240 break 241 endif 242 if(V_flag==1) //my suggested name is OK, so trim the output 243 badlength=0 244 l1 = strlen(testStr) //too long length 245 l1 = l1-maxLength //number to trim 246 //Print outputPath 247 l2=strlen(outputPath) 248 outputPath = outputPath[0,l2-1-l1] 249 //Print "modified ",outputPath 250 endif 251 //if(V_flag==2) do nothing, let it go around again 252 endif 253 254 while(badLength) 255 256 return outputPath 257 End
Note: See TracChangeset
for help on using the changeset viewer.