updates various stuff, Jamefiles and run scripts for the most part... clicking a list view object entry selects the object in Playground... alpha drawing in the scrolling test would reveal problems in the app_server scrolling implementation... more I have forgotten

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-12-21 11:19:16 +00:00
parent a90bd9535b
commit 75bf993e08
15 changed files with 170 additions and 84 deletions
+16 -11
View File
@@ -101,9 +101,9 @@ TestView::TestView(BRect frame, const char* name,
// fBitmap(new BBitmap(BRect(0, 0, kBitmapWidth - 1, kBitmapHeight -1), 0, kBitmapFormat)),
// fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), 0, B_CMAP8)),
// fBitmap(new BBitmap(BRect(0, 0, 32 - 1, 8 - 1), 0, B_GRAY8)),
fBitmap(new BBitmap(BRect(0, 0, 99, 99), B_RGB32, true)),
// fBitmap(new BBitmap(BRect(0, 0, 99, 99), B_CMAP8, true)),
// fBitmap(new BBitmap(BRect(0, 0, 31, 31), B_GRAY8, true)),
fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_RGB32, true)),
// fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_CMAP8, true)),
// fBitmap(new BBitmap(BRect(0, 0, 199, 99), B_GRAY8, true)),
fOffscreenView(new BView(fBitmap->Bounds(), "Offscreen view",
B_FOLLOW_ALL, B_WILL_DRAW | B_SUBPIXEL_PRECISE)),
fTicker(NULL),
@@ -385,15 +385,20 @@ TestView::_FillBitmap(point* polygon)
fOffscreenView->FillRect(fOffscreenView->Bounds(), B_SOLID_LOW);
fOffscreenView->SetDrawingMode(B_OP_OVER);
fOffscreenView->SetPenSize(4);
fOffscreenView->SetLineMode(B_BUTT_CAP, B_ROUND_JOIN);
fOffscreenView->StrokeLine(BPoint(polygon[0].x, polygon[0].y),
BPoint(polygon[1].x, polygon[1].y));
fOffscreenView->StrokeLine(BPoint(polygon[1].x, polygon[1].y),
BPoint(polygon[2].x, polygon[2].y));
fOffscreenView->StrokeLine(BPoint(polygon[2].x, polygon[2].y),
BPoint(polygon[3].x, polygon[3].y));
fOffscreenView->StrokeLine(BPoint(polygon[3].x, polygon[3].y),
BPoint(polygon[0].x, polygon[0].y));
BPoint pointList[4];
pointList[0].x = polygon[0].x;
pointList[0].y = polygon[0].y;
pointList[1].x = polygon[1].x;
pointList[1].y = polygon[1].y;
pointList[2].x = polygon[2].x;
pointList[2].y = polygon[2].y;
pointList[3].x = polygon[3].x;
pointList[3].y = polygon[3].y;
fOffscreenView->StrokePolygon(pointList, 4);
fOffscreenView->Sync();
fBitmap->Unlock();
+15 -3
View File
@@ -1,6 +1,18 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server &
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
sleep 1s
../../../../../distro/x86.release.r5/beos/apps/BitmapDrawing
if test -f ../../../../../generated/tests/apps/BitmapDrawing; then
../../../../../generated/tests/apps/BitmapDrawing
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
+4 -4
View File
@@ -10,7 +10,7 @@ SimpleTest CopyBits :
main.cpp
: be ;
if ( $(TARGET_PLATFORM) = libbe_test ) {
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CopyBits
: tests!apps ;
}
#if ( $(TARGET_PLATFORM) = libbe_test ) {
# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : CopyBits
# : tests!apps ;
#}
+14 -3
View File
@@ -1,6 +1,17 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server &
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
sleep 1s
../../../../../tests/servers/app/copy_bits/CopyBits
if test -f ../../../../../generated/tests/apps/CopyBits; then
../../../../../generated/tests/apps/CopyBits
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
+17 -30
View File
@@ -16,7 +16,7 @@
// constructor
ObjectView::ObjectView(BRect frame, const char* name,
uint32 resizeFlags, uint32 flags)
: BView(frame, name, resizeFlags, flags | B_FRAME_EVENTS),
: BView(frame, name, resizeFlags, flags),
fState(NULL),
fObjectType(OBJECT_LINE),
fStateList(20),
@@ -31,11 +31,12 @@ ObjectView::ObjectView(BRect frame, const char* name,
SetLowColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_1_TINT));
BFont font;
GetFont(&font);
font.SetSize(20.0);
font.SetRotation(6.0);
SetFont(&font, B_FONT_ROTATION | B_FONT_SIZE);
// BFont font;
// GetFont(&font);
// font.SetFamilyAndStyle("Bitstream Vera Serif", "Roman");
// font.SetSize(20.0);
//// font.SetRotation(6.0);
// SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_ROTATION | B_FONT_SIZE);
}
// AttachedToWindow
@@ -70,35 +71,18 @@ ObjectView::Draw(BRect updateRect)
SetHighColor(255, 0, 0, 128);
const char* message = "Click and drag";
const char* message = "Click and drag to draw an object";
float width = StringWidth(message);
BPoint p(r.Width() / 2.0 - width / 2.0,
r.Height() / 2.0);
Sync();
bigtime_t now = system_time();
DrawString(message, p);
message = "to draw an ";
width = StringWidth("to draw an object");
p.x = r.Width() / 2.0 - width / 2.0;
p.y += 25;
DrawString(message, p);
// SetOrigin(BPoint(50.0, 50.0));
// SetScale(0.5);
DrawChar('o');
DrawChar('b');
DrawChar('j');
DrawChar('e');
DrawChar('c');
DrawChar('t');
DrawChar('!');
// SetHighColor(0, 0, 0);
// StrokeLine(BPoint(-50, -50), BPoint(0.0, 0.0));
Sync();
printf("Drawing Text: %lld\n", system_time() - now);
for (int32 i = 0; State* state = (State*)fStateList.ItemAt(i); i++)
state->Draw(this);
@@ -236,7 +220,10 @@ ObjectView::AddObject(State* state)
{
if (state) {
fStateList.AddItem((void*)state);
Window()->PostMessage(MSG_OBJECT_COUNT_CHANGED);
BMessage message(MSG_OBJECT_ADDED);
message.AddPointer("object", state);
Window()->PostMessage(&message);
SetState(state);
}
@@ -9,7 +9,8 @@
class State;
enum {
MSG_OBJECT_COUNT_CHANGED = 'obcc',
MSG_OBJECT_COUNT_CHANGED = 'obcc',
MSG_OBJECT_ADDED = 'obad',
};
class ObjectView : public BView {
@@ -43,14 +43,34 @@ enum {
MSG_REDO = 'redo',
MSG_CLEAR = 'clir',
MSG_OBJECT_SELECTED = 'obsl',
};
// ObjectItem
class ObjectItem : public BStringItem {
public:
ObjectItem(const char* name, State* object)
: BStringItem(name),
fObject(object)
{
}
State* Object() const
{ return fObject; }
private:
State* fObject;
};
// #pragma mark -
// constructor
ObjectWindow::ObjectWindow(BRect frame, const char* name)
: BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
// : BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
// : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
// B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
: BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
// : BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
// B_ASYNCHRONOUS_CONTROLS)
// : BWindow(frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
@@ -281,6 +301,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
b.bottom = fDrawingModeMF->Frame().top - 5.0;
fObjectLV = new BListView(b, "object list", B_MULTIPLE_SELECTION_LIST);
fObjectLV->SetSelectionMessage(new BMessage(MSG_OBJECT_SELECTED));
// wrap a scroll view around the list view
scrollView = new BScrollView("list scroller", fObjectLV,
@@ -343,21 +364,23 @@ ObjectWindow::MessageReceived(BMessage* message)
fObjectView->SetStateColor(_GetColor());
_UpdateColorControls();
break;
case MSG_OBJECT_COUNT_CHANGED: {
int32 count = fObjectView->CountObjects();
//printf("MSG_OBJECT_COUNT_CHANGED: %ld\n", count);
fClearB->SetEnabled(count > 0);
int32 listCount = fObjectLV->CountItems();
int32 diff = count - listCount;
if (diff >= 0) {
for (int32 i = 0; i < diff; i++)
fObjectLV->AddItem(new BStringItem("Object"));
} else {
for (int32 i = listCount - 1; i >= count; i--)
delete fObjectLV->RemoveItem(i);
case MSG_OBJECT_ADDED: {
State* object;
if (message->FindPointer("object", (void**)&object) >= B_OK) {
fObjectLV->AddItem(new ObjectItem("Object", object));
}
break;
// fall through
}
case MSG_OBJECT_COUNT_CHANGED:
fClearB->SetEnabled(fObjectView->CountObjects() > 0);
break;
case MSG_OBJECT_SELECTED:
printf("MSG_OBJECT_SELECTED\n");
if (ObjectItem* item = (ObjectItem*)fObjectLV->ItemAt(fObjectLV->CurrentSelection(0))) {
fObjectView->SetState(item->Object());
} else
fObjectView->SetState(NULL);
break;
case MSG_NEW_OBJECT:
fObjectView->SetState(NULL);
break;
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
@@ -19,5 +19,7 @@ SimpleTest TestApp_Clock :
: Clock.rdef
;
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TestApp_Clock
: tests!apps ;
} # if $(TARGET_PLATFORM) = libbe_test
+14 -3
View File
@@ -1,6 +1,17 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server &
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
sleep 1s
../../../../../distro/x86.release.r5/beos/apps/ResizeLimits
if test -f ../../../../../generated/tests/apps/ResizeLimits; then
../../../../../generated/tests/apps/ResizeLimits
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
+5
View File
@@ -10,3 +10,8 @@ SimpleTest Scrolling :
main.cpp
: be ;
#if ( $(TARGET_PLATFORM) = libbe_test ) {
# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Scrolling
# : tests!apps ;
#}
+7 -6
View File
@@ -55,21 +55,22 @@ void
TestView::Draw(BRect updateRect)
{
// ellipses
// TODO: this should be unnecessary
SetPenSize(1.0);
SetHighColor(200, 90, 0, 255);
SetHighColor(200, 90, 0, 100);
StrokeEllipse(BPoint(80.0, 50.0), 70.0, 40.0);
SetDrawingMode(B_OP_ALPHA);
SetPenSize(2.0);
SetHighColor(20, 40, 180, 255);
SetHighColor(20, 40, 180, 150);
StrokeEllipse(BPoint(230.0, 90.0), 14.0, 60.0);
SetPenSize(5.0);
SetHighColor(60, 20, 110, 255);
SetHighColor(60, 20, 110, 100);
StrokeEllipse(BPoint(100.0, 180.0), 35.0, 25.0);
// text
SetHighColor(0, 0, 0, 255);
SetDrawingMode(B_OP_OVER);
const char* message = "Click and drag to scroll this view!";
DrawString(message, BPoint(0.0, 30.0));
}
@@ -80,6 +81,7 @@ TestView::MouseDown(BPoint where)
{
fTracking = true;
fLastMousePos = where;
SetMouseEventMask(B_POINTER_EVENTS);
}
// MouseUp
@@ -95,7 +97,6 @@ TestView::MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage)
{
if (fTracking) {
printf("TestView::MouseMoved(%.1f, %.1f)\n", where.x, where.y);
BPoint offset = fLastMousePos - where;
ScrollBy(offset.x, offset.y);
fLastMousePos = where + offset;
+15 -3
View File
@@ -1,6 +1,18 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server &
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
sleep 1s
../../../../../tests/servers/app/scrolling/Scrolling
if test -f ../../../../../generated/tests/apps/Scrolling; then
../../../../../generated/tests/apps/Scrolling
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
+4
View File
@@ -10,3 +10,7 @@ SimpleTest TextView :
main.cpp
: be ;
#if ( $(TARGET_PLATFORM) = libbe_test ) {
# HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : TextView
# : tests!apps ;
#}
+15 -3
View File
@@ -1,6 +1,18 @@
#!/bin/sh
../../../../../tests/servers/registrar/run_haiku_registrar || exit
../../../../../distro/x86.release.r5/beos/system/servers/haiku_app_server &
../../../../../generated/tests/apps/run_haiku_registrar || exit
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
../../../../../generated/tests/apps/haiku_app_server &
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi
sleep 1s
../../../../../tests/servers/app/windows/Window
if test -f ../../../../../generated/tests/apps/TextView; then
../../../../../generated/tests/apps/TextView
else
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
fi