Changeset 4474
- Timestamp:
- Apr 14, 2021, 9:20:35 AM (4 years ago)
- Location:
- trunk/src/netlabs/macros
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/netlabs/macros/backup.e ¶
r4412 r4474 229 229 endif 230 230 FileSpec = Dir 231 'TreeDir' FileSpec 231 SortOrder = '/F N' -- = default order 232 'TreeDir' EnquoteFileSpec( FileSpec) SortOrder 232 233 if not rc then 233 .filename = '.TreeBackup' FileSpec234 .filename = '.TreeBackup' EnquoteFileSpec( FileSpec) SortOrder 234 235 endif 235 236 … … 252 253 endif 253 254 FileSpec = strip( Dir, 'T', '\')'\'Name'~*' 254 'TreeBackup' FileSpec255 'TreeBackup' EnquoteFileSpec( FileSpec) 255 256 256 257 ; --------------------------------------------------------------------------- 257 258 defc TreeBackup 258 parse arg FileSpec 259 260 'TreeDir' FileSpec 259 -- Strip appended SortOption 260 ParseTreeTitleFilename( strip( arg( 1)), Filename, SortOption) 261 262 DefaultFileSortOption = '/R D' 263 DefaultDirSortOption = '/F N' 264 265 if SortOption = '' then 266 if NepmdDirExists( Filename) then 267 SortOption = DefaultDirSortOption 268 else 269 SortOption = DefaultFileSortOption 270 endif 271 endif 272 273 'TreeDir' EnquoteFileSpec( Filename) SortOption 261 274 treedirrc = rc 262 275 263 Filename = '.TreeBackup' FileSpec276 Displayname = '.TreeBackup' EnquoteFileSpec( Filename) SortOption 264 277 if not treedirrc then 265 .filename = Filename266 'TreeSort /R D'278 .filename = Displayname 279 'TreeSort' SortOption 267 280 -- TreeDir executes already QuitSameFile, but before renaming it 268 'PostMe QuitSameFile'281 --'PostMe QuitSameFile' -- TreeDir already does this 269 282 else 270 283 -- TreeDir executes already QuitFile, but before naming it Filename 271 'QuitFile' Filename284 'QuitFile' EnquoteFileSpec( Filename) 272 285 endif 273 286 274 287 ; --------------------------------------------------------------------------- 275 288 defproc IsABackupFile 276 Filename = arg( 1)289 Filename = StripQuotesFileSpec( strip( arg( 1))) 277 290 if Filename = '' then 278 291 Filename = .filename … … 297 310 298 311 defc IsABackupFile 299 Filename = arg( 1)312 Filename = StripQuotesFileSpec( strip( arg( 1))) 300 313 if Filename = '' then 301 314 Filename = .filename … … 652 665 ; --------------------------------------------------------------------------- 653 666 defc Restore 654 parse arg BackupFilename 655 if leftstr( BackupFilename, 1) = '"' then 656 parse arg '"'BackupFilename'"' 657 endif 667 BackupFilename = StripQuotesFileSpec( strip( arg( 1))) 658 668 if BackupFilename = '' then 659 669 'SayError Missing argument: BackupFilename' -
TabularUnified trunk/src/netlabs/macros/file.e ¶
r4457 r4474 218 218 ; Syntax: QuitFile Filename 219 219 defc QuitFile 220 Filename = arg( 1)220 Filename = StripquotesFileSpec( strip( arg( 1))) 221 221 NumQuit = 0 222 222 … … 248 248 defc QuitSameFile 249 249 Filename = .filename 250 if upcase( leftstr( Filename, 5)) = '.TREE' then 251 -- Strip appended SortOption 252 ParseTreeTitleFilename( Filename, Filename, PrevSortOption) 253 endif 254 250 255 NumQuit = 0 251 256 … … 257 262 if CurFid = StartFid then 258 263 leave 259 elseif .filename = Filename then 264 endif 265 NextFilename = .filename 266 if upcase( leftstr( NextFilename, 5)) = '.TREE' then 267 -- Strip appended SortOption 268 ParseTreeTitleFilename( NextArgs, NextFilename, NextSortOption) 269 endif 270 if NextFilename = Filename then 260 271 'xcom quit' 261 272 NumQuit = NumQuit + 1 … … 1955 1966 rc = 0 1956 1967 else 1957 if AskOkCancel( 'Delete file "'File1'"?') then 1968 if AskOkCancel( 'Delete file "'File1'"?'\n\n || 1969 '('CTRL_KEY__MSG' to bypass confirmation.)') then 1958 1970 rc = 0 1959 1971 else … … 3023 3035 3024 3036 ; --------------------------------------------------------------------------- 3025 ; Deletes file under cursor for a .Tree file3026 defc DeleteTreeListFile3027 'Delete' EnquoteFilespec( GetTreeListFilename())3028 if pos( '.TREEBACKUP', upcase( .filename)) = 1 then3029 Cmd = substr( .filename, 2)3030 Cmd3031 endif3032 3033 ; ---------------------------------------------------------------------------3034 3037 defproc IsADirList 3035 3038 rcx = 0 … … 3038 3041 if upcase( leftstr( .filename, 8)) = '.DOS DIR' then 3039 3042 rcx = 1 3040 elseif not IsAShell() then3041 leave3042 3043 elseif upcase( leftstr( ShellGetLastCmd(), 4)) = 'DIR ' then 3043 3044 rcx = 1 3045 elseif not IsAShell() then 3046 leave 3044 3047 endif 3045 3048 enddo … … 3183 3186 AltCmd = strip( arg( 1)) 3184 3187 if IsATreeListFilename() then 3185 'Delete' EnquoteFilespec( GetTreeListFilename()) 3186 if pos( '.TREEBACKUP', upcase( .filename)) = 1 then 3187 Cmd = substr( .filename, 2) 3188 Cmd 3189 endif 3190 elseif OnADirListLine() then 3188 pSave_Pos( SavedPos) 3189 Filename = GetTreeListFilename() 3190 'Delete' EnquoteFilespec( Filename) 3191 if not rc then 3192 if pos( '.TREEBACKUP', upcase( .filename)) = 1 then 3193 -- Reload current window 3194 Cmd = substr( .filename, 2) 3195 Cmd 3196 'PostMe RestorePos' SavedPos 3197 endif 3198 endif 3199 elseif IsADirListFilename() then 3191 3200 Filename = GetDirListFilename() 3192 3201 if Filename <> '' then … … 3197 3206 endif 3198 3207 3208 ; --------------------------------------------------------------------------- 3209 defproc ParseTreeTitleFilename( Args, var Filename, var SortOption) 3210 -- Strip appended SortOption 3211 if leftstr( Args, 1) = '"' then 3212 parse value Args with '"'Filename'"' SortOption 3213 else 3214 parse value Args with Filename SortOption 3215 endif 3216 Filename = strip( Filename) 3217 SortOption = strip( SortOption) 3218 -
TabularUnified trunk/src/netlabs/macros/popup.e ¶
r4352 r4474 125 125 126 126 ;compile if WANT_TREE 127 LOAD_FILE_MENU__MSG = '~Load file'128 SORT_ASCENDING_MENU__MSG = '~Sort ascending'129 SORT_DATE_MENU__MSG = 'Sort by ~date'130 SORT_TIME_MENU__MSG = 'Sort by ~time'131 SORT_SIZE_MENU__MSG = 'Sort by ~size'132 SORT_EASIZE_MENU__MSG = 'Sort by ~EA size'133 SORT_FULLNAME_MENU__MSG = 'Sort by ~fully-qualified filename'134 SORT_NAME_MENU__MSG = 'Sort by ~name'135 SORT_EXTENSION_MENU__MSG = 'Sort by ~extension'127 LOAD_FILE_MENU__MSG = '~Load file' 128 SORT_ASCENDING_MENU__MSG = '~Sort ascending' 129 SORT_DATE_MENU__MSG = 'Sort by ~date' 130 SORT_TIME_MENU__MSG = 'Sort by ~time' 131 SORT_SIZE_MENU__MSG = 'Sort by ~size' 132 SORT_EASIZE_MENU__MSG = 'Sort by ~EA size' 133 SORT_FULLNAME_MENU__MSG = 'Sort by ~fully-qualified filename' 134 SORT_NAME_MENU__MSG = 'Sort by ~name' 135 SORT_EXTENSION_MENU__MSG = 'Sort by e~xtension' 136 136 SORT_DESCENDING_MENU__MSG = 'Sort ~descending' 137 137 … … 279 279 DefMenuItem( '', -- Sort by date 280 280 SORT_DATE_MENU__MSG, 281 'TreeSort ' 'D',281 'TreeSort D', 282 282 SORT_XXXX_MENUP__MSG, 283 283 '') 284 284 DefMenuItem( '', -- Sort by time 285 285 SORT_TIME_MENU__MSG, 286 'TreeSort ' 'T',286 'TreeSort T', 287 287 SORT_XXXX_MENUP__MSG, 288 288 '') 289 289 DefMenuItem( '', -- Sort by size 290 290 SORT_SIZE_MENU__MSG, 291 'TreeSort ' 'S',291 'TreeSort S', 292 292 SORT_XXXX_MENUP__MSG, 293 293 '') 294 294 DefMenuItem( '', -- Sort by EA size 295 295 SORT_EASIZE_MENU__MSG, 296 'TreeSort ' 'EA',296 'TreeSort EA', 297 297 SORT_XXXX_MENUP__MSG, 298 298 '') 299 299 DefMenuItem( '', -- Sort by fully-qualified filename 300 300 SORT_FULLNAME_MENU__MSG, 301 'TreeSort ' 'F',301 'TreeSort F', 302 302 SORT_XXXX_MENUP__MSG, 303 303 '') 304 304 DefMenuItem( '', -- Sort by name 305 305 SORT_NAME_MENU__MSG, 306 'TreeSort ' 'N',306 'TreeSort N', 307 307 SORT_XXXX_MENUP__MSG, 308 308 '') … … 310 310 DefMenuItem( '', -- Sort by extension 311 311 SORT_EXTENSION_MENU__MSG, 312 'TreeSort ' 'EX',312 'TreeSort EX', 313 313 SORT_XXXX_MENUP__MSG, 314 314 '') … … 321 321 DefMenuItem( '', -- Sort by date 322 322 SORT_DATE_MENU__MSG, 323 'TreeSort ' '/R' 'D',323 'TreeSort /R D', 324 324 SORT_XXXX_MENUP__MSG, 325 325 '') 326 326 DefMenuItem( '', -- Sort by time 327 327 SORT_TIME_MENU__MSG, 328 'TreeSort ' '/R' 'T',328 'TreeSort /R T', 329 329 SORT_XXXX_MENUP__MSG, 330 330 '') 331 331 DefMenuItem( '', -- Sort by size 332 332 SORT_SIZE_MENU__MSG, 333 'TreeSort ' '/R' 'S',333 'TreeSort /R S', 334 334 SORT_XXXX_MENUP__MSG, 335 335 '') 336 336 DefMenuItem( '', -- Sort by EA size 337 337 SORT_EASIZE_MENU__MSG, 338 'TreeSort ' '/R' 'EA',338 'TreeSort /R EA', 339 339 SORT_XXXX_MENUP__MSG, 340 340 '') 341 341 DefMenuItem( '', -- Sort by fully-qualified filename 342 342 SORT_FULLNAME_MENU__MSG, 343 'TreeSort ' '/R' 'F',343 'TreeSort /R F', 344 344 SORT_XXXX_MENUP__MSG, 345 345 '') 346 346 DefMenuItem( '', -- Sort by name 347 347 SORT_NAME_MENU__MSG, 348 'TreeSort ' '/R' 'N',348 'TreeSort /R N', 349 349 SORT_XXXX_MENUP__MSG, 350 350 '') … … 352 352 DefMenuItem( '', -- Sort by extension 353 353 SORT_EXTENSION_MENU__MSG, 354 'TreeSort ' '/R' 'EX',354 'TreeSort /R EX', 355 355 SORT_XXXX_MENUP__MSG, 356 356 '') -
TabularUnified trunk/src/netlabs/macros/revert.e ¶
r4444 r4474 20 20 ****************************************************************************/ 21 21 22 ; Revert to saved - throw away changes and reload from disk.22 ; Revert to saved - throw away changes and reload from disk 23 23 24 24 ; The following command will throw away any changes made to a file since … … 27 27 28 28 ; by Larry Margolis 29 30 ; Changed:31 ; o Added restoring position32 ; o Changed the msg box33 34 ; Todo:35 ; o Make reload undo-able36 29 37 30 compile if not defined( SMALL) -- If compiled separately … … 61 54 getfileid startfid 62 55 'VSyncCursor' 63 call pSave_Pos( saved_pos)56 call pSave_Pos( SavedPos) 64 57 65 58 if filesinring() = 1 then … … 80 73 Cmd 81 74 'PostMe QuitSameFile' 75 'PostMe RestorePos' SavedPos 82 76 elseif upcase( leftstr( .filename, 5)) = '.TREE' then 83 77 Cmd = substr( .filename, 2) 84 78 Cmd 85 'PostMe QuitSameFile' 79 -- 'PostMe QuitSameFile' -- The Tree cmds already do this 80 'PostMe RestorePos' SavedPos 86 81 elseif upcase( leftstr( .filename, 11)) = '.NEPMD_INFO' then 87 82 Cmd = 'NepmdInfo' … … 116 111 if Mode = 'BIN' then 117 112 Filename = .filename 118 'o ''mc /be 'EnquoteFileSpec( Filename)' /PostMe RestorePos 'saved_pos''113 'o mc /be 'EnquoteFileSpec( Filename)' /PostMe RestorePos 'SavedPos'' 119 114 if rc = 0 then 120 115 activatefile startfid … … 127 122 if not rc then 128 123 'QuitSameFile' 129 'PostMe RestorePos ' saved_pos -- postme required124 'PostMe RestorePos 'SavedPos -- postme required 130 125 endif 131 126 endif … … 139 134 pActivateFile( startfid) 140 135 endif 141 'RingSetFileNumber' -- Why is that required here? 136 -- This is also required when 'xcom quit' is replaced by 'quit'. 137 -- It doesn't seem to work here automatically, so execute it here 138 -- again: 139 'RingSetFileNumber' 142 140 endif 143 141 -
TabularUnified trunk/src/netlabs/macros/tree.e ¶
r4285 r4474 180 180 'xcom e /c .tree' 181 181 if rc & rc <> sayerror( 'New file') then 182 sayerrorERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)182 'SayError' ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc) 183 183 return rc 184 184 endif … … 187 187 'xcom e /c .dirs' 188 188 if rc & rc <> sayerror( 'New file') then 189 sayerrorERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)189 'SayError' ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc) 190 190 return rc 191 191 endif … … 239 239 ; --------------------------------------------------------------------------- 240 240 defc TreeDir, Tree_Dir 241 parse arg Filename 242 DisplayFilename = Filename 243 TreeTitle = '.TreeDir' DisplayFilename 244 241 -- Strip appended SortOption 242 ParseTreeTitleFilename( strip( arg( 1)), Filename, SortOption) 245 243 call Parse_Filename( Filename, .filename) 246 Filename = StripquotesFileSpec( Filename)247 244 248 245 if Filename = '' then … … 264 261 'xcom e /c .tree' 265 262 if rc & rc <> sayerror( 'New file') then 266 sayerrorERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)263 'SayError' ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc) 267 264 return rc 268 265 endif … … 273 270 Attribute = 55 -- Want to see all files 274 271 rcx = TreeSearchDir( Filename, Attribute, FileCount, TotalSize, 0, treefid) 272 TreeTitle = '.TreeDir 'arg( 1) 275 273 call TreeCommonFinish( treefid, FileCount, TotalSize, TreeTitle) 276 274 … … 338 336 compile if not DEBUG_TREE 339 337 if result & result <> 18 & result <> 3 then -- unexpected error, skip remaining masks. 340 sayerror 'result' result 'from DosFindFirst' filename338 'SayError result' result 'from DosFindFirst' filename 341 339 rc = result 342 340 leave … … 460 458 compile if DEBUG_TREE 461 459 defproc DebugMessage( msgstring) 462 sayerror msgstring 460 --'SayError' msgstring 461 dprintf( msgstring) 463 462 compile endif 464 463 … … 467 466 revrse = '' 468 467 startmod = .modify 469 arglist= upcase( arg( 1))468 SortOption = upcase( arg( 1)) 470 469 getfileid thisfid 470 471 Filename = .filename 472 Args = Filename 473 TreeCmd = '' 474 PrevSortOption = '' 475 FileUnderCursor = '' 476 if upcase( leftstr( Args, 5)) = '.TREE' then 477 parse value Args with '.'TreeCmd Args 478 -- Strip appended SortOption 479 ParseTreeTitleFilename( Args, Filename, PrevSortOption) 480 FileUnderCursor = GetTreeListFilename() 481 endif 482 Filename = strip( Filename) 483 PrevSortOption = strip( PrevSortOption) 484 471 485 call pSave_Mark( savemark) 472 486 mt = marktype() … … 481 495 endif 482 496 call NextCmdAltersText() 483 do while arglist <> '' 497 NormalizedOption = '' 498 SortDirection = '/F' 499 SortRow = '' 500 do while SortOption <> '' 484 501 result = 0 485 parse value arglist with thisarg arglist486 if abbrev( '/REVERSE', thisarg, 2) then502 parse value SortOption with ThisOption SortOption 503 if abbrev( '/REVERSE', ThisOption, 2) then 487 504 revrse = 'R' 488 elseif abbrev( '/FORWARD', thisarg, 2) then 505 SortDirection = '/R' 506 elseif abbrev( '/FORWARD', ThisOption, 2) then 489 507 revrse = '' 490 elseif abbrev( 'DATE', thisarg, 1) then 508 elseif abbrev( 'DATE', ThisOption, 1) then 509 SortRow = 'D' 491 510 result = Sort( firstline, lastline, 1, 20, thisfid, revrse) 492 elseif abbrev( 'TIME', thisarg, 1) then 511 elseif abbrev( 'TIME', ThisOption, 1) then 512 SortRow = 'T' 493 513 result = Sort( firstline, lastline, 13, 20, thisfid, revrse) 494 elseif abbrev( 'SIZE', thisarg, 1) then 514 elseif abbrev( 'SIZE', ThisOption, 1) then 515 SortRow = 'S' 495 516 result = Sort( firstline, lastline, 21, 31, thisfid, revrse) 496 elseif abbrev( 'EASIZE', thisarg, 2) then 517 elseif abbrev( 'EASIZE', ThisOption, 2) then 518 SortRow = 'EA' 497 519 result = Sort( firstline, lastline, 32, 42, thisfid, revrse) 498 elseif abbrev( 'FILENAME', thisarg, 1) | 499 abbrev( 'FULLNAME', thisarg, 2) then 520 elseif abbrev( 'FILENAME', ThisOption, 1) | 521 abbrev( 'FULLNAME', ThisOption, 2) then 522 SortRow = 'F' 500 523 result = Sort( firstline, lastline, 52, 260, thisfid, 'CI'revrse) 501 elseif abbrev( 'NAME', thisarg, 1) | 502 abbrev( 'EXTENSION', thisarg, 2) then 503 ext = leftstr( thisarg, 1) = 'E' 524 elseif abbrev( 'NAME', ThisOption, 1) | 525 abbrev( 'EXTENSION', ThisOption, 2) then 526 ext = leftstr( ThisOption, 1) = 'E' 527 if ext then 528 SortRow = 'EX' 529 else 530 SortRow = 'N' 531 endif 504 532 do l = firstline to lastline 505 533 line = textline( l) … … 519 547 enddo 520 548 else 521 sayerror sayerrortext( -263) '-' thisarg549 'SayError' sayerrortext( -263) '-' ThisOption 522 550 endif 523 551 if result then 524 sayerror 'Sort' ERROR_NUMBER__MSG result552 'SayError Sort' ERROR_NUMBER__MSG result 525 553 endif 526 554 enddo 555 if TreeCmd <> '' then 556 DisplayName = strip( '.'TreeCmd Filename SortDirection SortRow) 557 else 558 DisplayName = strip( Filename SortDirection SortRow) 559 endif 527 560 .modify = startmod 528 561 call pRestore_Mark( savemark) 529 562 .filename = DisplayName 563 'RefreshInfoLine FILE' 564 if FileUnderCursor <> '' then 565 -- Place cursor on the same entry as before 566 delim = \1 567 SearchOptions = 't+fa' 568 SearchArgs = delim''FileUnderCursor''delim''SearchOptions 569 display -11 -- Enable only errors to the messageline 570 'xcom l 'SearchArgs 571 lrc = rc 572 display 11 573 if not lrc then 574 -- Center line 575 FoundLine = .line 576 .cursory = .windowheight % 2 577 FoundLine 578 endif 579 endif 580
Note:
See TracChangeset
for help on using the changeset viewer.