public void cutSelection() {
    if (selected) {
      copySelection();
      if (wave.length() - (selectEnd - selectStart + 1) <= 0) {
        wave = null;
	selectNone();
	observer.waveCanvasEvent (this, NULL);
      } else {
        double[] s = wave.getWave();
        double[] d = new double [wave.length() - (selectEnd - selectStart + 1)];
        int i, j;
        for (i = 0; i < selectStart; i++)
          d[i] = s[i];
        for (j = selectEnd + 1; j < s.length; j++, i++)
          d[i] = s[j];
        wave.setWave (d);

        int start, end;
        if (selectStart >= wave.length()) start = wave.length() - 1;
        else start = selectStart;
        select (start, start);
        i = viewEnd - viewStart + 1;
        if (viewStart >= wave.length())
          viewStart = wave.length() - 1;
        viewEnd = viewStart + i;
        if (viewEnd >= wave.length())
          viewEnd = wave.length() - 1;
        repaint();
      }
    }
  }