1e3a631c0SIngo Weinhold /* 2e3a631c0SIngo Weinhold * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3b1975a59SRene Gollent * Copyright 2013, Rene Gollent, rene@gollent.com. 4e3a631c0SIngo Weinhold * Distributed under the terms of the MIT License. 5e3a631c0SIngo Weinhold */ 6e3a631c0SIngo Weinhold #ifndef SOURCE_VIEW_H 7e3a631c0SIngo Weinhold #define SOURCE_VIEW_H 8e3a631c0SIngo Weinhold 9e3a631c0SIngo Weinhold 10e3a631c0SIngo Weinhold #include <Font.h> 11e3a631c0SIngo Weinhold #include <View.h> 12e3a631c0SIngo Weinhold 13e3a631c0SIngo Weinhold #include "Types.h" 14e3a631c0SIngo Weinhold 15e3a631c0SIngo Weinhold 16e3a631c0SIngo Weinhold class Breakpoint; 17b1975a59SRene Gollent class FunctionInstance; 18e3a631c0SIngo Weinhold class SourceCode; 19e3a631c0SIngo Weinhold class StackFrame; 20e3a631c0SIngo Weinhold class StackTrace; 21e3a631c0SIngo Weinhold class Statement; 22*177202d8SRene Gollent class SyntaxHighlightInfo; 23e3a631c0SIngo Weinhold class Team; 2442d73abaSRene Gollent class Thread; 25e3a631c0SIngo Weinhold class UserBreakpoint; 26e3a631c0SIngo Weinhold 27e3a631c0SIngo Weinhold 28e3a631c0SIngo Weinhold class SourceView : public BView { 29e3a631c0SIngo Weinhold public: 30e3a631c0SIngo Weinhold class Listener; 31e3a631c0SIngo Weinhold 32e3a631c0SIngo Weinhold public: 33e3a631c0SIngo Weinhold SourceView(Team* team, Listener* listener); 34e3a631c0SIngo Weinhold ~SourceView(); 35e3a631c0SIngo Weinhold 36e3a631c0SIngo Weinhold static SourceView* Create(Team* team, Listener* listener); 37e3a631c0SIngo Weinhold // throws 38e3a631c0SIngo Weinhold 3942d73abaSRene Gollent virtual void MessageReceived(BMessage* message); 4042d73abaSRene Gollent 41e3a631c0SIngo Weinhold void UnsetListener(); 42e3a631c0SIngo Weinhold 4342d73abaSRene Gollent void SetStackTrace(StackTrace* stackTrace, 4442d73abaSRene Gollent Thread* thread); 45e3a631c0SIngo Weinhold void SetStackFrame(StackFrame* stackFrame); 46e3a631c0SIngo Weinhold void SetSourceCode(SourceCode* sourceCode); 47e3a631c0SIngo Weinhold 48e3a631c0SIngo Weinhold void UserBreakpointChanged( 49e3a631c0SIngo Weinhold UserBreakpoint* breakpoint); 50e3a631c0SIngo Weinhold 51e3a631c0SIngo Weinhold bool ScrollToAddress(target_addr_t address); 52e3a631c0SIngo Weinhold bool ScrollToLine(uint32 line); 53e3a631c0SIngo Weinhold 54e3a631c0SIngo Weinhold void HighlightBorder(bool state); 55e3a631c0SIngo Weinhold virtual void TargetedByScrollView(BScrollView* scrollView); 56e3a631c0SIngo Weinhold 57e3a631c0SIngo Weinhold virtual BSize MinSize(); 58e3a631c0SIngo Weinhold virtual BSize MaxSize(); 59e3a631c0SIngo Weinhold virtual BSize PreferredSize(); 60e3a631c0SIngo Weinhold 61e3a631c0SIngo Weinhold virtual void DoLayout(); 62e3a631c0SIngo Weinhold 63e3a631c0SIngo Weinhold private: 64e3a631c0SIngo Weinhold class BaseView; 65e3a631c0SIngo Weinhold class MarkerManager; 66e3a631c0SIngo Weinhold class MarkerView; 67e3a631c0SIngo Weinhold class TextView; 68e3a631c0SIngo Weinhold 6953393666SRene Gollent // for gcc2 7053393666SRene Gollent friend class TextView; 7153393666SRene Gollent friend class MarkerView; 7253393666SRene Gollent 73e3a631c0SIngo Weinhold struct FontInfo { 74e3a631c0SIngo Weinhold BFont font; 75e3a631c0SIngo Weinhold font_height fontHeight; 76e3a631c0SIngo Weinhold float lineHeight; 77e3a631c0SIngo Weinhold }; 78e3a631c0SIngo Weinhold 7942d73abaSRene Gollent protected: 8042d73abaSRene Gollent bool GetStatementForLine(int32 line, 8142d73abaSRene Gollent Statement*& _statement); 8242d73abaSRene Gollent 83e3a631c0SIngo Weinhold private: 84e3a631c0SIngo Weinhold void _Init(); 85e3a631c0SIngo Weinhold void _UpdateScrollBars(); 86e3a631c0SIngo Weinhold BSize _DataRectSize() const; 87e3a631c0SIngo Weinhold 88e3a631c0SIngo Weinhold private: 89e3a631c0SIngo Weinhold Team* fTeam; 9042d73abaSRene Gollent Thread* fActiveThread; 91e3a631c0SIngo Weinhold StackTrace* fStackTrace; 92e3a631c0SIngo Weinhold StackFrame* fStackFrame; 93e3a631c0SIngo Weinhold SourceCode* fSourceCode; 94e3a631c0SIngo Weinhold MarkerManager* fMarkerManager; 95e3a631c0SIngo Weinhold MarkerView* fMarkerView; 96e3a631c0SIngo Weinhold TextView* fTextView; 97e3a631c0SIngo Weinhold FontInfo fFontInfo; 98e3a631c0SIngo Weinhold Listener* fListener; 99*177202d8SRene Gollent SyntaxHighlightInfo* fCurrentSyntaxInfo; 100e3a631c0SIngo Weinhold }; 101e3a631c0SIngo Weinhold 102e3a631c0SIngo Weinhold 103e3a631c0SIngo Weinhold class SourceView::Listener { 104e3a631c0SIngo Weinhold public: 105e3a631c0SIngo Weinhold virtual ~Listener(); 106e3a631c0SIngo Weinhold 107e3a631c0SIngo Weinhold virtual void SetBreakpointRequested( 108e3a631c0SIngo Weinhold target_addr_t address, bool enabled) = 0; 109e3a631c0SIngo Weinhold virtual void ClearBreakpointRequested( 110e3a631c0SIngo Weinhold target_addr_t address) = 0; 11142d73abaSRene Gollent virtual void ThreadActionRequested(Thread* thread, 11242d73abaSRene Gollent uint32 action, target_addr_t address) = 0; 113b1975a59SRene Gollent virtual void FunctionSourceCodeRequested( 114b1975a59SRene Gollent FunctionInstance* function, 115b1975a59SRene Gollent bool forceDisassembly) = 0; 116e3a631c0SIngo Weinhold }; 117e3a631c0SIngo Weinhold 118e3a631c0SIngo Weinhold 119e3a631c0SIngo Weinhold #endif // SOURCE_VIEW_H 120