// // FAVOURIT.VDM "Favourites Window" for VEDIT // // Written by: Christian Ziemski Germany // // 03/18/1998 some optimizations // 01/25/1999 Shift-Enter: ignore comment line // 03/16/1999 R114 // 09/29/1999 fixes in Alt-Home, Alt-End // 03/22/2000 optional line comment possible now // 08/15/2000 f. 5.20 (HOME->USER_MACRO) // 09/12/2000 workaround f. file locking problem // Last change: 08/10/2001 VEDIT 6.0 36->XBUF4 // // // Requires: VEDIT 6.00 or up // // // Usage: Select {MISC, Load/Execute macro}. // Enter filename "FAVOURIT.VDM". Use default register number "100". // // For regular use: // - use CALLF(101, "FAVOURIT.VDM") in STARTUP.VDM // or (at least) // - save the new keyboard layout to VEDIT.KEY // // // The Favourites file (default: "!VEDIT.FAV") is searched in the // current directory (local) and then in VEDIT's USER_MACRO. // // // It can contain a) comments beginning with # (in 1st column) or ; // b) filenames (with or without path) // c) directory names // and wildcards (for files) // each one on a single line. // Long filename (with blanks too) are allowed. No quotes required. // // // # sample favourites file // # // ; that's a comment too // C:\AUTOEXEC.BAT ; line comments are allowed with a ';' // C:\VEDIT\STARTUP.VDM ; this is my most important file :-) // FILE IN CURRENT DIR // C:\TOOLS\ // C:\WINDOWS\*.INI // // // The following key assignments are done: // // Shft-Bksp : open/close fav. window // Shft-Enter : select fav. file/dir // Alt-Ins : add current filename to Favourites // Alt-Home : load main Favourites from VEDIT's home directory // Alt-End : load local Favourites file // // // After opening the fav. window with Shift-Backspace you can // select with Shift-Enter: // // - a directory or wildcard to open the Point&Shoot box // for opening a file in that directory or // - a filename to open that file directly. // // // >>> As usual with my descriptions: simply try it! ;-) // // // F5/F6 als BufferSwitch berücksichtigt im Prinzip den Buffer36, aber // die Icons/Menüeinträge zum Buffer switchen NICHT!! // (weil PrevKey nicht gefüllt und damit nicht ausgewertet wird // //----------------------------------------------------------------------------- // // The macro uses text register 89 and numeric register #89 for // the whole session and R90/#90, #91, #99, R103/#103 temporarly. // These registers are not saved/restored by the macro. // // (some more documentation see below.) // //----------------------------------------------------------------------------- // Switch off the Cursorline-Highlighting for all buffers but XBUF4 // (executed on every buffer switch) //Reg_Set(114, 'Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2)') //Reg_Set(114, '#11=BN if(BN==XBUF4){BS(1)} Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2)') //Reg_Set(114, '#11=BN if(BN==XBUF4){if(Previous_Key(0,RAW)==0x3F00){BS(BF-1)}else{BS(1)}} Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2)') // falls Prev_Key noch abstürzt, wenn noch keine Taste gedrückt wurde: ohne Bufswitch-Check // Reg_Set(114, 'Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2)') Reg_Set(114, 'if(BN==XBUF4){if(Previous_Key(0,RAW)==0x3F00){#99=BN-1 while(Buf_Status(#99)==-1){#99--} BS(#99)}else{BS(1)}} Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2)') #89=Buf_Num // current buffer number if(File_Exist("!VEDIT.FAV")){ // file in current directory ? // Win_Switch(XBUF4,ATTACH) // Buf_Switch(XBUF4,ATTACH) // Buffer XBUF4 holds the Favourites Buf_Switch(XBUF4) // Buffer XBUF4 holds the Favourites //File_open("!VEDIT.FAV") Ins_File("!VEDIT.FAV",1,ALL,BEGIN) } else { if(File_Exist("|(USER_MACRO)\!VEDIT.FAV")){ // in VEDIT HOME ? // Win_Switch(XBUF4,ATTACH) // Buf_Switch(XBUF4,ATTACH) Buf_Switch(XBUF4) // Win_Attach(XBUF4) //File_open("|(USER_MACRO)\!VEDIT.FAV") Ins_File("|(USER_MACRO)\!VEDIT.FAV",1,ALL,BEGIN) } } Buf_Switch(#89, EVENT) // back to edit buffer Key_Add("Shft-Bksp", '[VISUAL EXIT] if(BN!=XBUF4){#89=BN BS(XBUF4,NOEVENT) Config(S_H_CR_LINE,1)}else{BS(#89,EVENT)} ',OK) Key_Add("Shft-Enter", '[VISUAL EXIT] if(BN==XBUF4){if(CC(0)==35||CC(0)==59){return} Save_Pos() RS(89,/"/) BoL Search_Block(";",CP, EoL_Pos, NOERR) if(EM){EoL} RCB(89,BoL_Pos, CP, APPEND) RS(89,/"/,APPEND) #90=FEXIST("|@(89)", NOERR) if(#90==0){Alert() Restore_Pos() Return} if(#90>1){#91=Get_Filename(90,@89) RS(89,@90)} if((#90==1)||(#91>2)){BS(Buf_Next,EVENT) FO(/|@(89)/) #89=BN}Restore_Pos(CLEAR)}',OK) Key_Add("Alt-Ins", '[VISUAL EXIT] #103=BN if(#103==XBUF4){Alert() Return} Reg_Set(103, PATHNAME) BS(XBUF4) BoF RI(103) IN(1) BoF BS(#103)', OK) Key_Add("Alt-Home", '[VISUAL EXIT] if(FExist("|(USER_MACRO)\!VEDIT.FAV")){if(BN!=XBUF4){#89=BN} BS(XBUF4) BC(NOMSG) BS(XBUF4) FO("|(USER_MACRO)\!VEDIT.FAV")}', OK) Key_Add("Alt-End", '[VISUAL EXIT] if(FExist("!VEDIT.FAV")){if(BN!=XBUF4){#89=BN} BS(XBUF4) BC(NOMSG) BS(XBUF4) FO("!VEDIT.FAV")}', OK) Return //============================================================================= // more Documentation: //============================================================================= // // Buffer-Switch-Event-Macro 114 // // if(BN==XBUF4){ // if the Buf_Switch leads to Buf XBUF4 // if(Previous_Key(0,RAW)==0x3F00){ // if [Prev.Buffer] // #99=BN-1 // search for last used buffer // while(Buf_Status(#99)==-1){ // below XBUF4 // #99-- // . // } // . // BS(#99) // and switch to that one // }else{ // if [next.Buffer] // Buf_Switch(1) // just switch to buffer 1 // // // // verbessern !!! // // // } // } // Config(S_H_CR_LINE,"Highlight Cursor Line (0-2)",(BN==XBUF4)*2) // //--------- // // Shft-Bksp: Open/Close Favourites Window // // if(Buf_Num != XBUF4){ // if not yet in Fav. win // #89=Buf_Num // remember current buffer // Buf_Switch(XBUF4, EVENT) // and go // } else { // Buf_Switch(#89, EVENT) // back to prev. buffer // } // //--------- // // Shft-Enter: Open choosen favourite file/directory // // if(Buf_Num == XBUF4){ // only if in Fav. win // if(Cur_Char(0) == 35 || CC(0) == 59){ // if comment line // return // // } // Save_Pos() // Reg_Set(89, /"/) // build the filename // BoL // with double quotes // Search_Block(";",CP, EoL_Pos, NOERR) // and ignore all after an optional ';' // if(EM){EoL} // up to EoL // RCB(89,BoL_Pos, CP, APPEND) // Reg_Set(89, /"/, APPEND) // around it // #90=File_Exist("|@(89)", NOERR) // check if file exists // if(#90 == 0){ // no -> return // Alert() // Restore_Pos // return // } // // if(#90 > 1){ // it's a directory! // #91=Get_Filename(90,@89) // => get filename // Reg_Set(89,@90) // } // if((#90 == 1) || (#91 > 2)){ // if one file selected // Buf_Switch(Buf_Next, EVENT) // File_Open('|@(89)') // open the choosen file // #89=Buf_Num // } // Restore_Pos(CLEAR) // } // //--------- // // Alt-Ins: Add current Filename to Favourites // // #103=Buf_Num // current buffer // if(#103 == XBUF4){ // if already in the Fav. win // Alert() // no action here // Return // } // Reg_Set(103, PATHNAME) // get current filename // Buf_Switch(XBUF4) // // BoF // and insert it into // Reg_Ins(103) // the favourites // IN(1) // BoF // Buf_Switch(#103) // and back // //--------- // // Alt-Home: Load the main Favourites from VEDIT HOME // // if(File_Exist("|(USER_MACRO)\!VEDIT.FAV")){ // in VEDIT USER_MACRO ? // if(Buf_Num != XBUF4){ // #89=Buf_Num // } // Buf_Switch(XBUF4) // Buf_Close(NOMSG) // Buf_Switch(XBUF4) // File_open("|(USER_MACRO)\!VEDIT.FAV") // } // //--------- // // Alt-End: Load the local Favourites from current directory // // if(File_Exist("!VEDIT.FAV")){ // in current directory ? // if(Buf_Num != XBUF4){ // #89=Buf_Num // } // Buf_Switch(XBUF4) // Buf_Close(NOMSG) // Buf_Switch(XBUF4) // File_open("!VEDIT.FAV") // } // // //=============================================================================