3c0955a1ce
* Introduced SourceCode::LineLengthAt(index) and respective implementations in FileSourceCode and DisassembledCode for getting the cached length of the line at the given index. * Use LineLengthAt in various places in SourceView::TextView to avoid having to calculate string lengths on the fly. * Clamp the size of the drag and drop rect to the window size. Otherwise in cases of large selections, said rect would get quite large. * Add support for double click word and triple click line selection. * Fix problems with tracking state which would erroneously cause the mouse entering the view while dragging on a scroll bar to initiate a drag and drop if there was selected text. * Add Select All menu/keyboard shortcut and implement corresponding functionality in SourceView::TextView. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31587 a95241bf-73f2-0310-859d-f6bbb57e9c96
72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
/*
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef DISASSEMBLED_CODE_H
|
|
#define DISASSEMBLED_CODE_H
|
|
|
|
|
|
#include <ObjectList.h>
|
|
|
|
#include "SourceCode.h"
|
|
|
|
|
|
class BString;
|
|
class ContiguousStatement;
|
|
|
|
|
|
class DisassembledCode : public SourceCode {
|
|
public:
|
|
DisassembledCode(SourceLanguage* language);
|
|
~DisassembledCode();
|
|
|
|
virtual bool Lock();
|
|
virtual void Unlock();
|
|
|
|
virtual SourceLanguage* GetSourceLanguage() const;
|
|
|
|
virtual int32 CountLines() const;
|
|
virtual const char* LineAt(int32 index) const;
|
|
virtual int32 LineLengthAt(int32 index) const;
|
|
|
|
virtual bool GetStatementLocationRange(
|
|
const SourceLocation& location,
|
|
SourceLocation& _start,
|
|
SourceLocation& _end) const;
|
|
|
|
virtual LocatableFile* GetSourceFile() const;
|
|
|
|
Statement* StatementAtAddress(target_addr_t address) const;
|
|
Statement* StatementAtLocation(
|
|
const SourceLocation& location) const;
|
|
TargetAddressRange StatementAddressRange() const;
|
|
|
|
public:
|
|
bool AddCommentLine(const BString& line);
|
|
bool AddInstructionLine(const BString& line,
|
|
target_addr_t address, target_size_t size);
|
|
// instructions must be added in
|
|
// ascending address order
|
|
|
|
private:
|
|
struct Line;
|
|
|
|
typedef BObjectList<Line> LineList;
|
|
typedef BObjectList<ContiguousStatement> StatementList;
|
|
|
|
private:
|
|
bool _AddLine(const BString& line,
|
|
ContiguousStatement* statement);
|
|
static int _CompareAddressStatement(
|
|
const target_addr_t* address,
|
|
const ContiguousStatement* statement);
|
|
|
|
private:
|
|
SourceLanguage* fLanguage;
|
|
LineList fLines;
|
|
StatementList fStatements;
|
|
};
|
|
|
|
|
|
#endif // DISASSEMBLED_CODE_H
|