home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Editor / DVD!FX17.LHA / FrexxEd / fpl / SoftEdit.FPL < prev    next >
Encoding:
Text File  |  1994-11-23  |  2.4 KB  |  97 lines

  1. export int MouseMark(int mode)
  2. {
  3.    int x, y;
  4.  
  5.    x = ReadInfo("mouse_x");
  6.    y = ReadInfo("mouse_y");
  7.    SetInfo(-1, "cursor_marking", 0);
  8.    if (mode)
  9.    {
  10.       BlockMark(0);
  11.       PlaceCursor(x, y);
  12.    }
  13.    else if (x >= 0 && y >= 0)
  14.    {
  15.       BlockMark(1);
  16.       PlaceCursor(x, y);
  17.    }
  18. }
  19.  
  20. export int MouseMark2()
  21. {
  22.    SetInfo(-1, "cursor_marking", 0);
  23.    BlockMark(1);
  24.    PlaceCursor(ReadInfo("mouse_x"), ReadInfo("mouse_y"));
  25.    BlockMark(1);
  26. }
  27.  
  28. export int MouseMarkDouble()
  29. {
  30.    string str = GetLine();
  31.    int x;
  32.    int y = 0;
  33.  
  34.    SetInfo(-1, "cursor_marking", 1);
  35.    CursorRightWord();
  36.    CursorLeftWord();
  37.    x = ReadInfo("byte_position");
  38.  
  39.    while(Isword(str[x++])) y++;
  40.    
  41.    BlockMark(1);
  42.    CursorRight(y);
  43.    BlockMark(1);
  44.    SetInfo(-1, "cursor_marking", 0);
  45. }
  46.  
  47. export int MM_BlockHook()
  48. {
  49.    if (!ReadInfo("cursor_marking"))
  50.    {
  51.       BlockMark(0);
  52.       return (0);
  53.    }
  54. }
  55.  
  56. export int MM_OutputHook()
  57. {
  58.    BlockDelete();
  59.    return(0);
  60. }
  61.  
  62. /* Mouse Drag assigns */
  63. AssignKey("MouseMark(1);", "MouseLeft");
  64. AssignKey("MouseMark(0);", "MouseLeftDrag");
  65. AssignKey("BlockMark(2);", "MouseLeftUp", "block_exist");
  66.  
  67. /* Doubleclick marks a word */
  68. AssignKey("MouseMarkDouble();", "MouseLeftDouble");
  69.  
  70. /* Mouse buttons for cut, copy & paste */
  71. AssignKey("BlockPaste();", "ctrl MouseLeft");
  72. AssignKey("BlockCopy();", "MouseRight");
  73. AssignKey("BlockCut();", "ctrl MouseRight");
  74.  
  75. /* Shift + Left button marks from cursor */
  76. AssignKey("MouseMark2();", "Shift MouseLeft");
  77.  
  78. /* Output clears the marked block */
  79. Hook("Output", "MM_OutputHook();", "block_exist");
  80.  
  81. /* Cursor movements removes the block marking */
  82. Hook("CursorUp", "MM_BlockHook();", "block_exist");
  83. Hook("CursorDown", "MM_BlockHook();", "block_exist");
  84. Hook("CursorLeft", "MM_BlockHook();", "block_exist");
  85. Hook("CursorRight", "MM_BlockHook();", "block_exist");
  86. Hook("CursorLeftWord", "MM_BlockHook();", "block_exist");
  87. Hook("CursorRightWord", "MM_BlockHook();", "block_exist");
  88. Hook("PageUp", "MM_BlockHook();", "block_exist");
  89. Hook("PageDown", "MM_BlockHook();", "block_exist");
  90. Hook("Backspace", "MM_OutputHook(); return(1);", "block_exist");
  91. Hook("Delete", "MM_OutputHook(); return(1);", "block_exist");
  92.  
  93. /* This hack makes it possible for us to mark with Amiga b as usual */
  94. ConstructInfo("cursor_marking", "", "", "LBH", "", 0, 1);
  95. SetInfo(-2, "cursor_marking", 0);
  96. AssignKey("SetInfo(-1, \"cursor_marking\", 1); BlockMark();", "Amiga b");
  97.