Beispiel #1
0
LONG CutBlock(struct InstData *data, BOOL Clipboard, BOOL NoCut, BOOL update)
{
  struct  marking newblock;
  LONG result;

  ENTER();

  //D(DBF_STARTUP, "CutBlock: %ld %ld %ld", Clipboard, NoCut, update);

  NiceBlock(&data->blockinfo, &newblock);
  if(!NoCut)
    AddToUndoBuffer(ET_DELETEBLOCK, (char *)&newblock, data);

  result = CutBlock2(data, Clipboard, NoCut, &newblock, update);

  RETURN(result);
  return(result);
}
Beispiel #2
0
/// MangleCharacters()
static void MangleCharacters(struct InstData *data, char (*change)(char c))
{
  LONG startx;
  LONG stopx;
  LONG _startx;
  struct line_node *startline;
  struct line_node *stopline;
  struct line_node *_startline;
  struct marking newblock;

  ENTER();

  if(Enabled(data))
  {
    NiceBlock(&data->blockinfo, &newblock);
    startx    = newblock.startx;
    stopx     = newblock.stopx;
    startline = newblock.startline;
    stopline  = newblock.stopline;
  }
  else
  {
    startx    = data->CPos_X;
    stopx     = startx+1;
    startline = data->actualline;
    stopline  = startline;

    newblock.enabled   = FALSE;
    newblock.startline = startline;
    newblock.stopline  = stopline;
    newblock.startx    = startx;
    newblock.stopx     = stopx;
  }

  AddToUndoBuffer(data, ET_DELETEBLOCK, &newblock);
  AddToUndoBuffer(data, ET_PASTEBLOCK, &newblock);

  _startx = startx;
  _startline = startline;

  while(startline != GetNextLine(stopline))
  {
    while(startline->line.Contents[startx] != '\n')
    {
      if(startx == stopx && startline == stopline)
        break;

      startline->line.Contents[startx] = change(startline->line.Contents[startx]);

      startx++;
    }
    startx = 0;
    startline = GetNextLine(startline);
  }

  data->HasChanged = TRUE;
  data->ChangeEvent = TRUE;
  RedrawArea(data, _startx, _startline, stopx, stopline);

  LEAVE();
}