Style fixes and automatic whitespace cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31570 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -972,7 +972,6 @@ SourceView::TextView::MouseDown(BPoint where)
|
|||||||
void
|
void
|
||||||
SourceView::TextView::MouseMoved(BPoint where, uint32 transit,
|
SourceView::TextView::MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage)
|
const BMessage* dragMessage)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (fSelectionMode) {
|
if (fSelectionMode) {
|
||||||
BRegion oldRegion;
|
BRegion oldRegion;
|
||||||
@@ -1053,7 +1052,8 @@ SourceView::TextView::SelectionPoint
|
|||||||
SourceView::TextView::_SelectionPointAt(BPoint where) const
|
SourceView::TextView::_SelectionPointAt(BPoint where) const
|
||||||
{
|
{
|
||||||
int32 line = LineAtOffset(where.y);
|
int32 line = LineAtOffset(where.y);
|
||||||
int32 offset = (int32)max_c((where.x - kLeftTextMargin) / fCharacterWidth, 0);
|
int32 offset = (int32)max_c((where.x - kLeftTextMargin)
|
||||||
|
/ fCharacterWidth, 0);
|
||||||
int32 lineLength = strlen(fSourceCode->LineAt(line));
|
int32 lineLength = strlen(fSourceCode->LineAt(line));
|
||||||
if (offset > lineLength)
|
if (offset > lineLength)
|
||||||
offset = (lineLength > 0) ? lineLength - 1 : 0;
|
offset = (lineLength > 0) ? lineLength - 1 : 0;
|
||||||
@@ -1085,6 +1085,7 @@ SourceView::TextView::_GetSelectionRegion(BRegion ®ion) const
|
|||||||
selectionRect.right = Bounds().right;
|
selectionRect.right = Bounds().right;
|
||||||
selectionRect.bottom = selectionRect.top + fFontInfo->lineHeight;
|
selectionRect.bottom = selectionRect.top + fFontInfo->lineHeight;
|
||||||
region.Include(selectionRect);
|
region.Include(selectionRect);
|
||||||
|
|
||||||
// compute rect for all lines in middle of selection
|
// compute rect for all lines in middle of selection
|
||||||
if (fSelectionEnd.line - fSelectionStart.line > 1) {
|
if (fSelectionEnd.line - fSelectionStart.line > 1) {
|
||||||
selectionRect.left = 0.0;
|
selectionRect.left = 0.0;
|
||||||
@@ -1094,6 +1095,7 @@ SourceView::TextView::_GetSelectionRegion(BRegion ®ion) const
|
|||||||
selectionRect.bottom = fSelectionEnd.line * fFontInfo->lineHeight;
|
selectionRect.bottom = fSelectionEnd.line * fFontInfo->lineHeight;
|
||||||
region.Include(selectionRect);
|
region.Include(selectionRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add rect for last line (if needed)
|
// add rect for last line (if needed)
|
||||||
if (fSelectionEnd.offset > 0) {
|
if (fSelectionEnd.offset > 0) {
|
||||||
selectionRect.left = 0.0;
|
selectionRect.left = 0.0;
|
||||||
@@ -1114,11 +1116,11 @@ SourceView::TextView::CopySelectionToClipboard(void) const
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BString text;
|
BString text;
|
||||||
if (fSelectionStart.line == fSelectionEnd.line)
|
if (fSelectionStart.line == fSelectionEnd.line) {
|
||||||
text.SetTo(fSourceCode->LineAt(fSelectionStart.line)
|
text.SetTo(fSourceCode->LineAt(fSelectionStart.line)
|
||||||
+ fSelectionStart.offset, fSelectionEnd.offset
|
+ fSelectionStart.offset, fSelectionEnd.offset
|
||||||
- fSelectionStart.offset);
|
- fSelectionStart.offset);
|
||||||
else {
|
} else {
|
||||||
text.SetTo(fSourceCode->LineAt(fSelectionStart.line)
|
text.SetTo(fSourceCode->LineAt(fSelectionStart.line)
|
||||||
+ fSelectionStart.offset);
|
+ fSelectionStart.offset);
|
||||||
text << "\n";
|
text << "\n";
|
||||||
@@ -1134,7 +1136,6 @@ SourceView::TextView::CopySelectionToClipboard(void) const
|
|||||||
B_MIME_TYPE, text.String(), text.Length());
|
B_MIME_TYPE, text.String(), text.Length());
|
||||||
be_clipboard->Commit();
|
be_clipboard->Commit();
|
||||||
be_clipboard->Unlock();
|
be_clipboard->Unlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1324,7 +1325,7 @@ void
|
|||||||
SourceView::HighlightBorder(bool state)
|
SourceView::HighlightBorder(bool state)
|
||||||
{
|
{
|
||||||
BScrollView* parent = dynamic_cast<BScrollView*>(Parent());
|
BScrollView* parent = dynamic_cast<BScrollView*>(Parent());
|
||||||
if (parent)
|
if (parent != NULL)
|
||||||
parent->SetBorderHighlighted(state);
|
parent->SetBorderHighlighted(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ private:
|
|||||||
float lineHeight;
|
float lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init();
|
void _Init();
|
||||||
void _UpdateScrollBars();
|
void _UpdateScrollBars();
|
||||||
|
|||||||
Reference in New Issue
Block a user