]> git.lyx.org Git - features.git/commitdiff
Move Box methods and functions out of box.h and into box.C.
authorAngus Leeming <leeming@lyx.org>
Mon, 7 Jan 2002 14:36:10 +0000 (14:36 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 7 Jan 2002 14:36:10 +0000 (14:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3302 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/Makefile.am
src/box.C [new file with mode: 0644]
src/box.h

index d8887e140f3f78ea9aca6a98cf53e49a498c6b8b..75a681f1982ffb48232c7b7dab6e9682f82947ad 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-07  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * box.C: New file. Move the Box methods and functions out of box.h,
+       following Lars' suggestion.
+
 2002-01-07  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * box.h: #include "support/LOstream.h", needed for inlined function.
index 33e614e78f1003c1411f7dd591b8b11ad45fcb61..51cd8b2859eb83ab022ad861a9f8ca945d3957a3 100644 (file)
@@ -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 (file)
index 0000000..023c382
--- /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 <moz@compsoc.man.ac.uk>
+ */
+
+// 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;
+}
index 8a53c737a76757919b9759a1dc357234f5fa93ab..1d083663bacdcdfc89494063ee75f54cb28b5b79 100644 (file)
--- 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 <iosfwd>
 
 /**
  * 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