mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bugzilla 282313 & 227780
This commit is contained in:
parent
4f1b016261
commit
73d415ec62
4 changed files with 186 additions and 163 deletions
|
@ -135,6 +135,31 @@ public abstract class AbstractPane extends Canvas
|
|||
}
|
||||
}
|
||||
|
||||
class AbstractPaneFocusListener implements FocusListener
|
||||
{
|
||||
public void focusLost(FocusEvent fe)
|
||||
{
|
||||
IPreferenceStore store = TraditionalRenderingPlugin.getDefault().getPreferenceStore();
|
||||
if(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE_ON_ENTER_ONLY
|
||||
.equals(store.getString(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE)))
|
||||
{
|
||||
fRendering.getViewportCache().clearEditBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
fRendering.getViewportCache().writeEditBuffer();
|
||||
}
|
||||
|
||||
// clear the pane local selection start
|
||||
AbstractPane.this.fSelectionStartAddress = null;
|
||||
}
|
||||
|
||||
public void focusGained(FocusEvent fe)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class AbstractPaneKeyListener implements KeyListener
|
||||
{
|
||||
public void keyPressed(KeyEvent ke)
|
||||
|
@ -272,29 +297,7 @@ public abstract class AbstractPane extends Canvas
|
|||
|
||||
this.addKeyListener(createKeyListener());
|
||||
|
||||
this.addFocusListener(new FocusListener()
|
||||
{
|
||||
public void focusLost(FocusEvent fe)
|
||||
{
|
||||
IPreferenceStore store = TraditionalRenderingPlugin.getDefault().getPreferenceStore();
|
||||
if(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE_ON_ENTER_ONLY
|
||||
.equals(store.getString(TraditionalRenderingPreferenceConstants.MEM_EDIT_BUFFER_SAVE)))
|
||||
{
|
||||
fRendering.getViewportCache().clearEditBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
fRendering.getViewportCache().writeEditBuffer();
|
||||
}
|
||||
|
||||
// clear the pane local selection start
|
||||
AbstractPane.this.fSelectionStartAddress = null;
|
||||
}
|
||||
|
||||
public void focusGained(FocusEvent fe)
|
||||
{
|
||||
}
|
||||
});
|
||||
this.addFocusListener(createFocusListener());
|
||||
}
|
||||
|
||||
protected MouseListener createMouseListener(){
|
||||
|
@ -304,6 +307,10 @@ public abstract class AbstractPane extends Canvas
|
|||
protected MouseMoveListener createMouseMoveListener(){
|
||||
return new AbstractPaneMouseMoveListener();
|
||||
}
|
||||
|
||||
protected FocusListener createFocusListener() {
|
||||
return new AbstractPaneFocusListener();
|
||||
}
|
||||
|
||||
protected KeyListener createKeyListener(){
|
||||
return new AbstractPaneKeyListener();
|
||||
|
@ -549,16 +556,7 @@ public abstract class AbstractPane extends Canvas
|
|||
|
||||
protected void advanceCursor()
|
||||
{
|
||||
fSubCellCaretPosition++;
|
||||
if(fSubCellCaretPosition >= getCellCharacterCount())
|
||||
{
|
||||
fSubCellCaretPosition = 0;
|
||||
fCaretAddress = fCaretAddress.add(BigInteger
|
||||
.valueOf(getNumberOfBytesRepresentedByColumn() / fRendering.getAddressableSize()));
|
||||
|
||||
}
|
||||
updateCaret();
|
||||
ensureCaretWithinViewport();
|
||||
handleRightArrowKey();
|
||||
}
|
||||
|
||||
protected void positionCaret(int x, int y)
|
||||
|
|
|
@ -70,7 +70,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
|
||||
private GoToAddressComposite fAddressBar;
|
||||
|
||||
private Control fAddressBarControl; // FIXME why isn't there a getControl() ?
|
||||
private Control fAddressBarControl;
|
||||
|
||||
private Selection fSelection = new Selection();
|
||||
|
||||
|
@ -215,83 +215,9 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
|
||||
this.fAddressBarControl.setVisible(false);
|
||||
|
||||
getHorizontalBar().addSelectionListener(new SelectionListener()
|
||||
{
|
||||
public void widgetSelected(SelectionEvent se)
|
||||
{
|
||||
Rendering.this.layout();
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent se)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
getHorizontalBar().addSelectionListener(createHorizontalBarSelectionListener());
|
||||
|
||||
getVerticalBar().addSelectionListener(
|
||||
new SelectionListener()
|
||||
{
|
||||
public void widgetSelected(SelectionEvent se)
|
||||
{
|
||||
int addressableSize = getAddressableSize();
|
||||
|
||||
switch(se.detail)
|
||||
{
|
||||
case SWT.ARROW_DOWN:
|
||||
handleDownArrow();
|
||||
break;
|
||||
case SWT.PAGE_DOWN:
|
||||
handlePageDown();
|
||||
break;
|
||||
case SWT.ARROW_UP:
|
||||
handleUpArrow();
|
||||
break;
|
||||
case SWT.PAGE_UP:
|
||||
handlePageUp();
|
||||
break;
|
||||
case SWT.SCROLL_LINE:
|
||||
// See: BUG 203068 selection event details broken on GTK < 2.6
|
||||
default:
|
||||
if(getVerticalBar().getSelection() == getVerticalBar().getMinimum())
|
||||
{
|
||||
// Set view port start address to the start address of the Memory Block
|
||||
fViewportAddress = Rendering.this.getMemoryBlockStartAddress();
|
||||
}
|
||||
else if(getVerticalBar().getSelection() == getVerticalBar().getMaximum())
|
||||
{
|
||||
// The view port end address should be less or equal to the the end address of the Memory Block
|
||||
// Set view port address to be bigger than the end address of the Memory Block for now
|
||||
// and let ensureViewportAddressDisplayable() to figure out the correct view port start address
|
||||
fViewportAddress = Rendering.this.getMemoryBlockEndAddress();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Figure out the delta
|
||||
int delta = getVerticalBar().getSelection() - fCurrentScrollSelection;
|
||||
fViewportAddress = fViewportAddress.add(BigInteger.valueOf(
|
||||
getAddressableCellsPerRow() * delta));
|
||||
}
|
||||
ensureViewportAddressDisplayable();
|
||||
// Update tooltip
|
||||
// FIXME conversion from slider to scrollbar
|
||||
// getVerticalBar().setToolTipText(Rendering.this.getAddressString(fViewportAddress));
|
||||
|
||||
// Update the addresses on the Address pane.
|
||||
if(fAddressPane.isPaneVisible())
|
||||
{
|
||||
fAddressPane.redraw();
|
||||
}
|
||||
redrawPanes();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent se)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
getVerticalBar().addSelectionListener(createVerticalBarSelectinListener());
|
||||
|
||||
this.addPaintListener(new PaintListener()
|
||||
{
|
||||
|
@ -427,6 +353,88 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
ensureViewportAddressDisplayable();
|
||||
redrawPanes();
|
||||
}
|
||||
protected SelectionListener createHorizontalBarSelectionListener()
|
||||
{
|
||||
return new SelectionListener()
|
||||
{
|
||||
public void widgetSelected(SelectionEvent se)
|
||||
{
|
||||
Rendering.this.layout();
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent se)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected SelectionListener createVerticalBarSelectinListener()
|
||||
{
|
||||
return new SelectionListener()
|
||||
{
|
||||
public void widgetSelected(SelectionEvent se)
|
||||
{
|
||||
int addressableSize = getAddressableSize();
|
||||
|
||||
switch(se.detail)
|
||||
{
|
||||
case SWT.ARROW_DOWN:
|
||||
handleDownArrow();
|
||||
break;
|
||||
case SWT.PAGE_DOWN:
|
||||
handlePageDown();
|
||||
break;
|
||||
case SWT.ARROW_UP:
|
||||
handleUpArrow();
|
||||
break;
|
||||
case SWT.PAGE_UP:
|
||||
handlePageUp();
|
||||
break;
|
||||
case SWT.SCROLL_LINE:
|
||||
// See: BUG 203068 selection event details broken on GTK < 2.6
|
||||
default:
|
||||
if(getVerticalBar().getSelection() == getVerticalBar().getMinimum())
|
||||
{
|
||||
// Set view port start address to the start address of the Memory Block
|
||||
fViewportAddress = Rendering.this.getMemoryBlockStartAddress();
|
||||
}
|
||||
else if(getVerticalBar().getSelection() == getVerticalBar().getMaximum())
|
||||
{
|
||||
// The view port end address should be less or equal to the the end address of the Memory Block
|
||||
// Set view port address to be bigger than the end address of the Memory Block for now
|
||||
// and let ensureViewportAddressDisplayable() to figure out the correct view port start address
|
||||
fViewportAddress = Rendering.this.getMemoryBlockEndAddress();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Figure out the delta
|
||||
int delta = getVerticalBar().getSelection() - fCurrentScrollSelection;
|
||||
fViewportAddress = fViewportAddress.add(BigInteger.valueOf(
|
||||
getAddressableCellsPerRow() * delta));
|
||||
}
|
||||
ensureViewportAddressDisplayable();
|
||||
// Update tooltip
|
||||
// FIXME conversion from slider to scrollbar
|
||||
// getVerticalBar().setToolTipText(Rendering.this.getAddressString(fViewportAddress));
|
||||
|
||||
// Update the addresses on the Address pane.
|
||||
if(fAddressPane.isPaneVisible())
|
||||
{
|
||||
fAddressPane.redraw();
|
||||
}
|
||||
redrawPanes();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent se)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected AddressPane createAddressPane()
|
||||
{
|
||||
|
@ -1497,6 +1505,11 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
{
|
||||
return fParent.getAddressSize();
|
||||
}
|
||||
|
||||
public Control getAddressBarControl()
|
||||
{
|
||||
return fAddressBarControl;
|
||||
}
|
||||
|
||||
public int getColumnCount()
|
||||
{
|
||||
|
@ -1508,6 +1521,16 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
return fColumnsSetting;
|
||||
}
|
||||
|
||||
protected void setBytesPerRow(int count)
|
||||
{
|
||||
fBytesPerRow = count;
|
||||
}
|
||||
|
||||
protected void setColumnCount(int count)
|
||||
{
|
||||
fColumnCount = count;
|
||||
}
|
||||
|
||||
public void setColumnsSetting(int columns)
|
||||
{
|
||||
if(fColumnsSetting != columns)
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package org.eclipse.cdt.debug.ui.memory.traditional;
|
||||
|
||||
import org.eclipse.debug.core.model.MemoryByte;
|
||||
|
||||
public class TraditionalMemoryByte extends MemoryByte implements IMemoryByte
|
||||
{
|
||||
private boolean isEdited = false;
|
||||
|
||||
private boolean[] changeHistory = new boolean[0];
|
||||
|
||||
public TraditionalMemoryByte()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public TraditionalMemoryByte(byte byteValue)
|
||||
{
|
||||
super(byteValue);
|
||||
}
|
||||
|
||||
public TraditionalMemoryByte(byte byteValue, byte byteFlags)
|
||||
{
|
||||
super(byteValue, byteFlags);
|
||||
}
|
||||
|
||||
public boolean isEdited()
|
||||
{
|
||||
return isEdited;
|
||||
}
|
||||
|
||||
public void setEdited(boolean edited)
|
||||
{
|
||||
isEdited = edited;
|
||||
}
|
||||
|
||||
public boolean isChanged(int historyDepth)
|
||||
{
|
||||
return changeHistory.length > historyDepth && changeHistory[historyDepth];
|
||||
}
|
||||
|
||||
public void setChanged(int historyDepth, boolean changed)
|
||||
{
|
||||
if(historyDepth >= changeHistory.length)
|
||||
{
|
||||
boolean newChangeHistory[] = new boolean[historyDepth + 1];
|
||||
System.arraycopy(changeHistory, 0, newChangeHistory, 0, changeHistory.length);
|
||||
changeHistory = newChangeHistory;
|
||||
}
|
||||
|
||||
changeHistory[historyDepth] = changed;
|
||||
|
||||
if(historyDepth == 0)
|
||||
this.setChanged(changed);
|
||||
}
|
||||
}
|
|
@ -1274,59 +1274,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class TraditionalMemoryByte extends MemoryByte implements IMemoryByte
|
||||
{
|
||||
private boolean isEdited = false;
|
||||
|
||||
private boolean[] changeHistory = new boolean[0];
|
||||
|
||||
public TraditionalMemoryByte()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public TraditionalMemoryByte(byte byteValue)
|
||||
{
|
||||
super(byteValue);
|
||||
}
|
||||
|
||||
public TraditionalMemoryByte(byte byteValue, byte byteFlags)
|
||||
{
|
||||
super(byteValue, byteFlags);
|
||||
}
|
||||
|
||||
public boolean isEdited()
|
||||
{
|
||||
return isEdited;
|
||||
}
|
||||
|
||||
public void setEdited(boolean edited)
|
||||
{
|
||||
isEdited = edited;
|
||||
}
|
||||
|
||||
public boolean isChanged(int historyDepth)
|
||||
{
|
||||
return changeHistory.length > historyDepth && changeHistory[historyDepth];
|
||||
}
|
||||
|
||||
public void setChanged(int historyDepth, boolean changed)
|
||||
{
|
||||
if(historyDepth >= changeHistory.length)
|
||||
{
|
||||
boolean newChangeHistory[] = new boolean[historyDepth + 1];
|
||||
System.arraycopy(changeHistory, 0, newChangeHistory, 0, changeHistory.length);
|
||||
changeHistory = newChangeHistory;
|
||||
}
|
||||
|
||||
changeHistory[historyDepth] = changed;
|
||||
|
||||
if(historyDepth == 0)
|
||||
this.setChanged(changed);
|
||||
}
|
||||
}
|
||||
|
||||
class CopyAction extends Action
|
||||
{
|
||||
// TODO for the sake of large copies, this action should probably read in
|
||||
|
|
Loading…
Add table
Reference in a new issue