* Removed obsolete picture test application.
* Fixed build of print job utilities DumpPrintJob and ShowPrintJob. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,21 +1,9 @@
|
|||||||
SubDir HAIKU_TOP src tests kits interface pictureprint ;
|
SubDir HAIKU_TOP src tests kits interface pictureprint ;
|
||||||
|
|
||||||
|
SubDirHdrs [ FDirName $(HAIKU_TOP) headers libs print libprint ] ;
|
||||||
|
|
||||||
UsePrivateHeaders interface print ;
|
UsePrivateHeaders interface print ;
|
||||||
|
|
||||||
SimpleTest TestPictureApp :
|
|
||||||
PictureTestApp.cpp
|
|
||||||
PictureTestView.cpp
|
|
||||||
TestView.cpp
|
|
||||||
PictureTestWindow.cpp
|
|
||||||
;
|
|
||||||
|
|
||||||
LinkAgainst TestPictureApp :
|
|
||||||
be
|
|
||||||
root
|
|
||||||
libprintutils.a
|
|
||||||
$(TARGET_LIBSUPC++)
|
|
||||||
;
|
|
||||||
|
|
||||||
SimpleTest DumpPrintJob :
|
SimpleTest DumpPrintJob :
|
||||||
DumpPrintJob.cpp
|
DumpPrintJob.cpp
|
||||||
;
|
;
|
||||||
@@ -23,6 +11,7 @@ SimpleTest DumpPrintJob :
|
|||||||
LinkAgainst DumpPrintJob :
|
LinkAgainst DumpPrintJob :
|
||||||
be
|
be
|
||||||
root
|
root
|
||||||
|
libprint.a
|
||||||
libprintutils.a
|
libprintutils.a
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -33,5 +22,5 @@ SimpleTest ShowPrintJob :
|
|||||||
LinkAgainst ShowPrintJob :
|
LinkAgainst ShowPrintJob :
|
||||||
be
|
be
|
||||||
root
|
root
|
||||||
libprintutils.a
|
libprint.a
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestApp
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "PictureTestApp.hpp"
|
|
||||||
#include "PictureTestWindow.hpp"
|
|
||||||
#include "PictureTestView.hpp"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
new PictureTestApp;
|
|
||||||
be_app->Run();
|
|
||||||
delete be_app;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PictureTestApp::PictureTestApp()
|
|
||||||
: Inherited(PRINTTEST_SIGNATURE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestApp::ReadyToRun()
|
|
||||||
{
|
|
||||||
(new PictureTestWindow)->Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestApp
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PICTURETESTAPP_HPP
|
|
||||||
#define PICTURETESTAPP_HPP
|
|
||||||
|
|
||||||
class PictureTestApp;
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <Message.h>
|
|
||||||
|
|
||||||
#define PRINTTEST_SIGNATURE "application/x-vnd.OpenBeOS-picturetest"
|
|
||||||
|
|
||||||
class PictureTestApp : public BApplication
|
|
||||||
{
|
|
||||||
typedef BApplication Inherited;
|
|
||||||
public:
|
|
||||||
PictureTestApp();
|
|
||||||
|
|
||||||
void ReadyToRun();
|
|
||||||
private:
|
|
||||||
void DoPictureTest();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestView
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "PictureTestView.hpp"
|
|
||||||
|
|
||||||
PictureTestView::PictureTestView(BRect frame)
|
|
||||||
: Inherited(frame, "", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestView::Draw(BRect updateRect)
|
|
||||||
{
|
|
||||||
StrokeRoundRect(Bounds().InsetByCopy(20,20), 10, 10);
|
|
||||||
BFont font(be_bold_font);
|
|
||||||
font.SetSize(Bounds().Height()/10);
|
|
||||||
font.SetShear(Bounds().Height()/10);
|
|
||||||
font.SetRotation(Bounds().Width()/10);
|
|
||||||
SetFont(&font, B_FONT_ALL);
|
|
||||||
DrawString("OpenBeOS", 8, BPoint(Bounds().Width()/2,Bounds().Height()/2));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestView
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PICTURETESTVIEW_HPP
|
|
||||||
#define PICTURETESTVIEW_HPP
|
|
||||||
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
class PictureTestView;
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
class PictureTestView : public BView
|
|
||||||
{
|
|
||||||
typedef BView Inherited;
|
|
||||||
public:
|
|
||||||
PictureTestView(BRect frame);
|
|
||||||
void Draw(BRect updateRect);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestWindow
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "PictureTestWindow.hpp"
|
|
||||||
|
|
||||||
#include "PictureTestView.hpp"
|
|
||||||
#include "TestView.hpp"
|
|
||||||
#include "PicturePrinter.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <MenuItem.h>
|
|
||||||
#include <MenuBar.h>
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
PictureTestWindow::PictureTestWindow()
|
|
||||||
: Inherited(BRect(100,100,500,300), "OpenBeOS Picture Test App", B_DOCUMENT_WINDOW, 0)
|
|
||||||
{
|
|
||||||
BuildGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PictureTestWindow::QuitRequested()
|
|
||||||
{
|
|
||||||
bool isOk = Inherited::QuitRequested();
|
|
||||||
if (isOk) {
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PictureTestWindow::BuildGUI()
|
|
||||||
{
|
|
||||||
BView* backdrop = new BView(Bounds(), "backdrop", B_FOLLOW_ALL, B_WILL_DRAW);
|
|
||||||
backdrop->SetViewColor(::ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
AddChild(backdrop);
|
|
||||||
|
|
||||||
BMenuBar* mb = new BMenuBar(Bounds(), "menubar");
|
|
||||||
BMenu* m = new BMenu("File");
|
|
||||||
m->AddItem(new BMenuItem("Picture"B_UTF8_ELLIPSIS, new BMessage('Pict'), 'P'));
|
|
||||||
m->AddSeparatorItem();
|
|
||||||
m->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
|
|
||||||
mb->AddItem(m);
|
|
||||||
|
|
||||||
backdrop->AddChild(mb);
|
|
||||||
|
|
||||||
BRect b = Bounds();
|
|
||||||
b.top = mb->Bounds().bottom +1;
|
|
||||||
backdrop->AddChild(new PictureTestView(b));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestWindow::MessageReceived(BMessage* msg)
|
|
||||||
{
|
|
||||||
switch(msg->what) {
|
|
||||||
case 'Pict':
|
|
||||||
DoPictureTest();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestWindow::DoPictureTest() {
|
|
||||||
fView = new TestView(BRect(0, 0, 10000, 10000));
|
|
||||||
AddChild(fView);
|
|
||||||
bool continue_test = true;
|
|
||||||
for (int i = 0; continue_test; i++) {
|
|
||||||
Begin();
|
|
||||||
continue_test = fView->Test(i, fName);
|
|
||||||
End(continue_test);
|
|
||||||
}
|
|
||||||
RemoveChild(fView);
|
|
||||||
delete fView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestWindow::Begin() {
|
|
||||||
fView->BeginPicture(new BPicture());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureTestWindow::End(bool write) {
|
|
||||||
fView->Sync();
|
|
||||||
if (!write) return;
|
|
||||||
BPicture* picture = fView->EndPicture();
|
|
||||||
printf("\n%s\n", fName.String());
|
|
||||||
if (picture) {
|
|
||||||
bool saved = false;
|
|
||||||
{
|
|
||||||
BFile file(fName.String(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
|
||||||
if (file.InitCheck() == B_OK) {
|
|
||||||
if (picture->Flatten(&file) != B_OK)
|
|
||||||
fprintf(stderr, "Error %s could not flatten BPicture\n", fName.String());
|
|
||||||
else saved = true;
|
|
||||||
} else fprintf(stderr, "Error %s could not create file\n", fName.String());
|
|
||||||
delete picture;
|
|
||||||
}
|
|
||||||
if (saved) {
|
|
||||||
BFile file(fName.String(), B_READ_ONLY);
|
|
||||||
if (file.InitCheck() == B_OK) {
|
|
||||||
BPicture p;
|
|
||||||
if (p.Unflatten(&file) == B_OK) {
|
|
||||||
PicturePrinter printer;
|
|
||||||
printer.Iterate(&p);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error %s could not unflatten BPicture\n", fName.String());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error %s could not open file\n", fName.String());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
PictureTestWindow
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PICTURETESTWINDOW_HPP
|
|
||||||
#define PICTURETESTWINDOW_HPP
|
|
||||||
|
|
||||||
class TestView;
|
|
||||||
|
|
||||||
#include <File.h>
|
|
||||||
#include <Picture.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <Window.h>
|
|
||||||
|
|
||||||
class PictureTestWindow : public BWindow
|
|
||||||
{
|
|
||||||
typedef BWindow Inherited;
|
|
||||||
public:
|
|
||||||
void MessageReceived(BMessage* m);
|
|
||||||
PictureTestWindow();
|
|
||||||
bool QuitRequested();
|
|
||||||
private:
|
|
||||||
void BuildGUI();
|
|
||||||
void DoPictureTest();
|
|
||||||
void Begin();
|
|
||||||
void End(bool write);
|
|
||||||
|
|
||||||
TestView* fView;
|
|
||||||
BString fName;
|
|
||||||
BPicture fPicture;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
TestView
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "TestView.hpp"
|
|
||||||
|
|
||||||
static int NextNum() {
|
|
||||||
static int n = 0;
|
|
||||||
return n ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BPoint NextPoint() {
|
|
||||||
return BPoint(NextNum(), NextNum());
|
|
||||||
}
|
|
||||||
|
|
||||||
static BRect NextRect() {
|
|
||||||
return BRect(NextNum(), NextNum(), NextNum(), NextNum());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TestView::Test(int no, BString& name) {
|
|
||||||
switch (no) {
|
|
||||||
case 0: name = "MoveTo"; MoveTo(NextPoint()); break;
|
|
||||||
case 1: name = "StrokeLine"; StrokeLine(NextPoint(), NextPoint()); break;
|
|
||||||
case 2: name = "StrokeRect"; StrokeRect(NextRect()); break;
|
|
||||||
case 3: name = "FillRect"; FillRect(NextRect()); break;
|
|
||||||
case 4: name = "DrawChar"; MoveTo(NextPoint()); DrawChar('O'); DrawChar('B'); DrawChar('O'); DrawChar('S'); break;
|
|
||||||
case 5: name = "DrawString"; DrawString("OpenBeOS", NextPoint()); break;
|
|
||||||
case 6: name = "BlendingMode";
|
|
||||||
SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
|
|
||||||
StrokeRect(NextRect());
|
|
||||||
break;
|
|
||||||
// case 7: name = ""; break;
|
|
||||||
/*
|
|
||||||
case 6: name = "StrokeEllipse"; break;
|
|
||||||
case 7: name = "FillEllipse"; break;
|
|
||||||
case 8: name = "StrokeBezier"; break;
|
|
||||||
case 9: name = "FillBezier"; break;
|
|
||||||
case 10: name = "StrokePolygone"; break;
|
|
||||||
case 11: name = "FillPolygone"; break;
|
|
||||||
case 12: name = "FillRegion"; break;
|
|
||||||
case 13: name = "StrokeTriangle"; break;
|
|
||||||
case 14: name = "FillTriangle"; break;
|
|
||||||
case 15: name = ""; break;
|
|
||||||
case 16: name = ""; break;
|
|
||||||
case 17: name = ""; break;
|
|
||||||
case 18: name = ""; break;
|
|
||||||
case 19: name = ""; break;
|
|
||||||
case 20: name = ""; break;
|
|
||||||
case 21: name = ""; break;
|
|
||||||
case 22: name = ""; break;
|
|
||||||
*/
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
TestView
|
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Michael Pfeiffer
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TESTVIEW_HPP
|
|
||||||
#define TESTVIEW_HPP
|
|
||||||
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
class TestView : public BView
|
|
||||||
{
|
|
||||||
typedef BView Inherited;
|
|
||||||
public:
|
|
||||||
TestView(BRect frame) : BView(frame, "", B_FOLLOW_NONE, 0) { }
|
|
||||||
void Draw(BRect updateRect) { };
|
|
||||||
bool Test(int no, BString& name);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TESTVIEW_HPP */
|
|
||||||
Reference in New Issue
Block a user