From c99b2f4819b178c8d6af6f46ce6fbbf8f62a1e45 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 7 Jan 2002 14:36:10 +0000 Subject: [PATCH] Move Box methods and functions out of box.h and into box.C. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3302 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/Makefile.am | 1 + src/box.C | 33 +++++++++++++++++++++++++++++++++ src/box.h | 22 +++++++--------------- 4 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 src/box.C diff --git a/src/ChangeLog b/src/ChangeLog index d8887e140f..75a681f198 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-07 Angus Leeming + + * box.C: New file. Move the Box methods and functions out of box.h, + following Lars' suggestion. + 2002-01-07 Angus Leeming * box.h: #include "support/LOstream.h", needed for inlined function. diff --git a/src/Makefile.am b/src/Makefile.am index 33e614e78f..51cd8b2859 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,6 +90,7 @@ lyx_SOURCES = \ XFormsView.C \ XFormsView.h \ box.h \ + box.C \ broken_headers.h \ buffer.C \ buffer.h \ diff --git a/src/box.C b/src/box.C new file mode 100644 index 0000000000..023c382f91 --- /dev/null +++ b/src/box.C @@ -0,0 +1,33 @@ +/** + * \file box.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +// Code moved out of line and out of box.h by Angus (7 Jan 2002) + +#include "box.h" + +#include "support/LOstream.h" + +using std::ostream; + +Box::Box(int x1_, int x2_, int y1_, int y2_) : + x1(x1_), x2(x2_), y1(y1_), y2(y2_) +{} + +bool Box::contained(int x, int y) +{ + return (x1 < x && x2 > x && + y1 < y && y2 > y); +} + + +ostream & operator<<(ostream & o, Box & b) +{ + return o << "x1,y1: " << b.x1 << "," << b.y1 + << " x2,y2: " << b.x2 << "," << b.y2 << std::endl; +} + diff --git a/src/box.h b/src/box.h index 8a53c737a7..1d083663ba 100644 --- a/src/box.h +++ b/src/box.h @@ -1,3 +1,4 @@ +// -*- C++ -*- /** * \file box.h * Copyright 2001 the LyX Team @@ -9,7 +10,7 @@ #ifndef BOX_H #define BOX_H -#include "support/LOstream.h" +#include /** * A simple class representing rectangular regions. @@ -25,27 +26,18 @@ struct Box { int y1; int y2; - Box(int x1_, int x2_, - int y1_, int y2_) : - x1(x1_), x2(x2_), y1(y1_), y2(y2_) {} + /// Initialise the member variables. + Box(int x1_, int x2_, int y1_, int y2_); /** * Returns true if the given co-ordinates are within * the box. Check is exclusive (point on a border * returns false). */ - bool contained(int x, int y) { - return (x1 < x && x2 > x && - y1 < y && y2 > y); - } - - + bool contained(int x, int y); }; -inline std::ostream & operator<<(std::ostream & o, Box & b) -{ - return o << "x1,y1: " << b.x1 << "," << b.y1 - << " x2,y2: " << b.x2 << "," << b.y2 << std::endl; -} + +std::ostream & operator<<(std::ostream &, Box &); #endif // BOX_H