DisasmViewer.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef DISASMVIEWER_H
  2. #define DISASMVIEWER_H
  3. #include "Dasm.h"
  4. #include <QFrame>
  5. #include <QPixmap>
  6. class CommMemoryRequest;
  7. class QScrollBar;
  8. class Breakpoints;
  9. class SymbolTable;
  10. struct MemoryLayout;
  11. class DisasmViewer : public QFrame
  12. {
  13. Q_OBJECT;
  14. public:
  15. DisasmViewer(QWidget* parent = 0);
  16. void setMemory(unsigned char* memPtr);
  17. void setBreakpoints(Breakpoints* bps);
  18. void setMemoryLayout(MemoryLayout* ml);
  19. void setSymbolTable(SymbolTable* st);
  20. void memoryUpdated(CommMemoryRequest* req);
  21. void updateCancelled(CommMemoryRequest* req);
  22. quint16 programCounter() const;
  23. quint16 cursorAddress() const;
  24. QSize sizeHint() const;
  25. enum {Top, Middle, Bottom, Closest, TopAlways, MiddleAlways, BottomAlways};
  26. public slots:
  27. void setAddress(quint16 addr, int infoLine = FIRST_INFO_LINE, int method = Top);
  28. void setCursorAddress(quint16 addr, int infoLine = FIRST_INFO_LINE, int method = Top);
  29. void setProgramCounter(quint16 pc);
  30. void scrollBarAction(int action);
  31. void scrollBarChanged(int value);
  32. void settingsChanged();
  33. void symbolsChanged();
  34. private:
  35. void resizeEvent(QResizeEvent* e);
  36. void paintEvent(QPaintEvent* e);
  37. void keyPressEvent(QKeyEvent* e);
  38. void mousePressEvent(QMouseEvent* e);
  39. void wheelEvent(QWheelEvent* e);
  40. QScrollBar* scrollBar;
  41. QPixmap breakMarker;
  42. QPixmap watchMarker;
  43. QPixmap pcMarker;
  44. quint16 programAddr;
  45. quint16 cursorAddr;
  46. int cursorLine;
  47. QList<int> jumpStack;
  48. // layout information
  49. int frameL, frameR, frameT, frameB;
  50. int labelFontHeight, labelFontAscent;
  51. int codeFontHeight, codeFontAscent;
  52. int xAddr, xMCode[4], xMnem, xMnemArg;
  53. int visibleLines, partialBottomLine;
  54. int disasmTopLine;
  55. DisasmLines disasmLines;
  56. // display data
  57. unsigned char* memory;
  58. bool waitingForData;
  59. CommMemoryRequest* nextRequest;
  60. Breakpoints* breakpoints;
  61. MemoryLayout* memLayout;
  62. SymbolTable* symTable;
  63. int findDisasmLine(quint16 lineAddr, int infoLine = 0);
  64. int lineAtPos(const QPoint& pos);
  65. signals:
  66. void toggleBreakpoint(int addr);
  67. };
  68. #endif // DISASMVIEWER_H