From 8002202d9d7b3e77cef5d69e3ffd2bd7e6fa731a Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Sun, 28 Jul 2002 17:53:03 +0000 Subject: [PATCH] Renamed View.* to PathView.* and Application.* to LPBApp.*. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@504 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../add-ons/print/pdf/linepathbuilder/Jamfile | 11 +- .../{Application.cpp => LPBApp.cpp} | 6 +- .../{Application.h => LPBApp.h} | 6 +- ...{Application.rsrc => LinePathBuilder.rsrc} | Bin 4193 -> 4193 bytes .../print/pdf/linepathbuilder/View.cpp | 124 ------------------ .../add-ons/print/pdf/linepathbuilder/View.h | 24 ---- 6 files changed, 9 insertions(+), 162 deletions(-) rename src/tests/add-ons/print/pdf/linepathbuilder/{Application.cpp => LPBApp.cpp} (97%) rename src/tests/add-ons/print/pdf/linepathbuilder/{Application.h => LPBApp.h} (83%) rename src/tests/add-ons/print/pdf/linepathbuilder/{Application.rsrc => LinePathBuilder.rsrc} (95%) delete mode 100644 src/tests/add-ons/print/pdf/linepathbuilder/View.cpp delete mode 100644 src/tests/add-ons/print/pdf/linepathbuilder/View.h diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/Jamfile b/src/tests/add-ons/print/pdf/linepathbuilder/Jamfile index 076b40d63d..690f573c0f 100644 --- a/src/tests/add-ons/print/pdf/linepathbuilder/Jamfile +++ b/src/tests/add-ons/print/pdf/linepathbuilder/Jamfile @@ -2,11 +2,11 @@ SubDir OBOS_TOP src tests add-ons print pdf linepathbuilder ; SubDirHdrs $(OBOS_TOP) src add-ons print drivers pdf source ; -AddResources LinePathBuilder : <$(SOURCE_GRIST)>Application.rsrc ; +AddResources LinePathBuilder : LinePathBuilder.rsrc ; local sources = - Application.cpp - View.cpp + LPBApp.cpp + PathView.cpp SubPath.cpp LinePathBuilder.cpp ; @@ -20,9 +20,4 @@ SimpleTest LinePathBuilder SEARCH on [ FGristFiles LinePathBuilder.cpp SubPath.cpp ] = [ FDirName $(OBOS_TOP) src add-ons print drivers pdf source ] ; -# Ugly hack: Prepend the dirs containing Be's Application.h/View.h to the list -# of include search dirs. Otherwise they won't be found. -# It is certainly a good idea to rename the local files. -PrependObjectHdrs $(sources) - : /boot/develop/headers/be/app /boot/develop/headers/be/interface ; diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/Application.cpp b/src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.cpp similarity index 97% rename from src/tests/add-ons/print/pdf/linepathbuilder/Application.cpp rename to src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.cpp index c3c517abed..65bab45f35 100644 --- a/src/tests/add-ons/print/pdf/linepathbuilder/Application.cpp +++ b/src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.cpp @@ -1,4 +1,4 @@ -#include "Application.h" +#include "LPBApp.h" BMessage* NewMessage(uint32 what, uint32 data) { @@ -43,10 +43,10 @@ AppWindow::AppWindow(BRect aRect) menubar->AddItem(menu); AddChild(menubar); - // add view + // add path view aRect.Set(0, menubar->Bounds().Height()+1, aRect.Width(), aRect.Height()); view = NULL; - AddChild(view = new View(aRect)); + AddChild(view = new PathView(aRect)); // make window visible Show(); } diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/Application.h b/src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.h similarity index 83% rename from src/tests/add-ons/print/pdf/linepathbuilder/Application.h rename to src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.h index 043382a4ca..d3a184c7f1 100644 --- a/src/tests/add-ons/print/pdf/linepathbuilder/Application.h +++ b/src/tests/add-ons/print/pdf/linepathbuilder/LPBApp.h @@ -3,16 +3,16 @@ #include #include -#include "View.h" +#include "PathView.h" #include "MsgConsts.h" -#define APPLICATION "Application" +#define APPLICATION "LinePathBuilder" #define VERSION "1.0" class AppWindow : public BWindow { public: BMenuBar *menubar; - View *view; + PathView *view; AppWindow(BRect); bool QuitRequested(); void AboutRequested(); diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/Application.rsrc b/src/tests/add-ons/print/pdf/linepathbuilder/LinePathBuilder.rsrc similarity index 95% rename from src/tests/add-ons/print/pdf/linepathbuilder/Application.rsrc rename to src/tests/add-ons/print/pdf/linepathbuilder/LinePathBuilder.rsrc index 681796520d6cfafc7e3ed8e85a89993c6d72503c..0bd4eb441038641a403a2e5d9ba6674ddfc3bf3d 100644 GIT binary patch delta 49 ucmaE;@K9mHR~`jM1_WRNF?}-gQUel8GMq{?b5c@^HVg80FioDze*^#`{|ylU delta 48 scmaE;@K9mHR~{J#B)|k>I~Ek=WF{w;Waj5>R^+W=niwE3c`pAE02Q$enE(I) diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/View.cpp b/src/tests/add-ons/print/pdf/linepathbuilder/View.cpp deleted file mode 100644 index 2e24a4cb49..0000000000 --- a/src/tests/add-ons/print/pdf/linepathbuilder/View.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "View.h" -#include "LinePathBuilder.h" -#include - -class ShapeLPB : public LinePathBuilder -{ - BShape fShape; - -protected: - virtual void MoveTo(BPoint p); - virtual void LineTo(BPoint p); - virtual void BezierTo(BPoint* p); - virtual void ClosePath(void); - -public: - ShapeLPB(SubPath *subPath, float penSize, cap_mode capMode, join_mode joinMode, float miterLimit); - BShape *Shape() { return &fShape; } -}; - -ShapeLPB::ShapeLPB(SubPath *subPath, float penSize, cap_mode capMode, join_mode joinMode, float miterLimit) - : LinePathBuilder(subPath, penSize, capMode, joinMode, miterLimit) -{ -} - -void ShapeLPB::MoveTo(BPoint p) -{ - fShape.MoveTo(p); -} - -void ShapeLPB::LineTo(BPoint p) -{ - fShape.LineTo(p); -} - -void ShapeLPB::BezierTo(BPoint p[3]) -{ - fShape.BezierTo(p); -} - -void ShapeLPB::ClosePath(void) -{ - fShape.Close(); -} - -View::View(BRect rect) - : BView(rect, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_SUBPIXEL_PRECISE) { - //SetViewColor(B_TRANSPARENT_COLOR); - fMode = kStroke; - fCurPoint = -1; - fWidth = 16; -} - -void View::Draw(BRect updateRect) { - if (fMode == kDrawOutline) { - - } else if (fMode == kStroke) { - const int n = fPath.CountPoints(); - BShape shape; - for (int i = 0; i < n; i++) { - if (i == 0) - shape.MoveTo(fPath.PointAt(i)); - else - shape.LineTo(fPath.PointAt(i)); - } - if (fPath.IsClosed()) shape.Close(); - SetPenSize(fWidth); - StrokeShape(&shape); - - ShapeLPB path(&fPath, fWidth, LineCapMode(), LineJoinMode(), LineMiterLimit()); - path.CreateLinePath(); - SetPenSize(1); - - BPicture picture; - BeginPicture(&picture); - FillShape(path.Shape()); - EndPicture(); - - PushState(); - ClipToPicture(&picture); - SetHighColor(0, 255, 0); - FillRect(Bounds()); - PopState(); - - SetOrigin(200, 0); - SetHighColor(255, 0, 0); - StrokeShape(path.Shape()); - Flush(); - } -} - -void View::MouseDown(BPoint point) { - uint32 buttons; - GetMouse(&point, &buttons, false); - - if (buttons == B_SECONDARY_MOUSE_BUTTON) { - fCurPoint = fPath.CountPoints(); - fPath.AddPoint(point); - } else { - float d = 100000000000.0; - for (int i = 0; i < fPath.CountPoints(); i++) { - BPoint p = point - fPath.PointAt(i); - float e = p.x*p.x + p.y*p.y; - if (e < d) { fCurPoint = i; d = e; } - } - fPath.AtPut(fCurPoint, point); - } - Invalidate(); -} - -void View::MouseMoved(BPoint point, uint32 transit, const BMessage *message) { - if (fCurPoint != -1) { - fPath.AtPut(fCurPoint, point); - Invalidate(); - } -} - -void View::MouseUp(BPoint point) { - fCurPoint = -1; -} - -void View::SetClose(bool close) { - if (close) fPath.Close(); - else fPath.Open(); -} \ No newline at end of file diff --git a/src/tests/add-ons/print/pdf/linepathbuilder/View.h b/src/tests/add-ons/print/pdf/linepathbuilder/View.h deleted file mode 100644 index a9abae4984..0000000000 --- a/src/tests/add-ons/print/pdf/linepathbuilder/View.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef VIEW_H -#define VIEW_H - -#include "SubPath.h" -#include - -class View : public BView { - SubPath fPath; - enum { - kDrawOutline, - kStroke - } fMode; - int fCurPoint; - float fWidth; - -public: - View(BRect rect); - void Draw(BRect updateRect); - void MouseDown(BPoint point); - void MouseUp(BPoint point); - void MouseMoved(BPoint point, uint32 transit, const BMessage *message); - void SetClose(bool close); -}; -#endif