mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
146683 Double clicking on a cell should highlight that cell
This commit is contained in:
parent
4aa55aa207
commit
87988bb1a1
1 changed files with 27 additions and 5 deletions
|
@ -26,6 +26,7 @@ public abstract class AbstractPane extends Canvas
|
|||
protected Rendering fRendering;
|
||||
|
||||
// selection state
|
||||
protected boolean fSelectionStarted = false;
|
||||
protected boolean fSelectionInProgress = false;
|
||||
|
||||
protected BigInteger fSelectionStartAddress = null;
|
||||
|
@ -89,10 +90,12 @@ public abstract class AbstractPane extends Canvas
|
|||
|
||||
fCaret.setVisible(true);
|
||||
|
||||
if(me.button == 1)
|
||||
if(fSelectionInProgress && me.button == 1)
|
||||
{
|
||||
endSelection(me.x, me.y);
|
||||
}
|
||||
|
||||
fSelectionInProgress = fSelectionStarted = false;
|
||||
}
|
||||
|
||||
public void mouseDown(MouseEvent me)
|
||||
|
@ -119,7 +122,7 @@ public abstract class AbstractPane extends Canvas
|
|||
AbstractPane.this.fSelectionStartAddress = fRendering
|
||||
.getSelection().getStart();
|
||||
|
||||
AbstractPane.this.fSelectionInProgress = true;
|
||||
AbstractPane.this.fSelectionStarted = true;
|
||||
|
||||
AbstractPane.this.appendSelection(me.x, me.y);
|
||||
|
||||
|
@ -135,6 +138,21 @@ public abstract class AbstractPane extends Canvas
|
|||
|
||||
public void mouseDoubleClick(MouseEvent me)
|
||||
{
|
||||
try
|
||||
{
|
||||
BigInteger address = getViewportAddress(me.x / getCellWidth(), me.y
|
||||
/ getCellHeight());
|
||||
|
||||
fRendering.getSelection().clear();
|
||||
fRendering.getSelection().setStart(address.add(BigInteger
|
||||
.valueOf(fRendering.getAddressesPerColumn())), address);
|
||||
fRendering.getSelection().setEnd(address.add(BigInteger
|
||||
.valueOf(fRendering.getAddressesPerColumn())), address);
|
||||
}
|
||||
catch(DebugException de)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -142,8 +160,9 @@ public abstract class AbstractPane extends Canvas
|
|||
{
|
||||
public void mouseMove(MouseEvent me)
|
||||
{
|
||||
if(fSelectionInProgress)
|
||||
if(fSelectionStarted)
|
||||
{
|
||||
fSelectionInProgress = true;
|
||||
appendSelection(me.x, me.y);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +288,10 @@ public abstract class AbstractPane extends Canvas
|
|||
else if(Rendering.isValidEditCharacter(ke.character))
|
||||
{
|
||||
if(fRendering.getSelection().hasSelection())
|
||||
{
|
||||
setCaretAddress(fRendering.getSelection().getLow());
|
||||
fSubCellCaretPosition = 0;
|
||||
}
|
||||
|
||||
editCell(fCaretAddress, fSubCellCaretPosition, ke.character);
|
||||
}
|
||||
|
@ -504,7 +526,7 @@ public abstract class AbstractPane extends Canvas
|
|||
fRendering.getSelection().setStart(address.add(BigInteger.valueOf(
|
||||
fRendering.getBytesPerColumn() / fRendering.getAddressableSize())), address);
|
||||
|
||||
fSelectionInProgress = true;
|
||||
fSelectionStarted = true;
|
||||
}
|
||||
}
|
||||
catch(DebugException e)
|
||||
|
|
Loading…
Add table
Reference in a new issue