home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / text / edit / FrexxEdA.lha / FrexxEd / fpl / MultiBlock.FPL < prev    next >
Text File  |  1995-07-19  |  925b  |  54 lines

  1. export int PasteFromBlock()
  2. {
  3.   string key;
  4.   int id;
  5.  
  6.   Status(0, "Press key to get block!");
  7.  
  8.   key = GetKey();
  9.   if(!strcmp("\x1b", key)) {
  10.     /* escape was pressed! */
  11.     ReturnStatus("Aborted...");
  12.   }
  13.  
  14.   id = GetBufferID(sprintf("MultiBlock_%s", key));
  15.   if(id) {
  16.     BlockPaste(id);
  17.   }
  18.  
  19. }
  20.  
  21. export int CopyToNewBlock()
  22. {
  23.   string key;
  24.   string blockname;
  25.   int id;
  26.   int ourid = GetEntryID();
  27.  
  28.   Status(0, "Press a key to name the block!");
  29.  
  30.   key = GetKey();
  31.   if(!strcmp("\x1b", key)) {
  32.     /* escape was pressed! */
  33.     ReturnStatus("Aborted...");
  34.   }
  35.   Visible(0);
  36.   blockname = sprintf("MultiBlock_%s", key);
  37.  
  38.   id = GetBufferID(blockname);
  39.   if(!id) {
  40.     /* there is no such block! */
  41.     id = BlockCreate(blockname);
  42.     
  43.   }
  44.   else {
  45.     Clear(id);
  46.   }
  47.   CurrentBuffer(id);
  48.   BlockPaste();
  49.   CurrentBuffer(ourid);
  50. }
  51.  
  52. AssignKey("CopyToNewBlock();", "amiga t c");
  53. AssignKey("PasteFromBlock();", "amiga t p");
  54.