]> Shamusworld >> Repos - guemap/commitdiff
Fix room adding to work properly, misc. small changes. master v3.0.2
authorShamus Hammons <jlhamm@acm.org>
Tue, 11 Jul 2023 21:25:33 +0000 (16:25 -0500)
committerShamus Hammons <jlhamm@acm.org>
Tue, 11 Jul 2023 21:25:33 +0000 (16:25 -0500)
13 files changed:
src/about.cpp
src/about.h
src/file.cpp
src/globals.cpp
src/globals.h
src/guemapapp.cpp
src/mainwin.cpp
src/mainwin.h
src/mapdialog.cpp
src/mapdialog.h
src/mapdoc.cpp
src/mapdoc.h
src/mapview.cpp

index 09708ad02cbc697b6082b6e22812f4ed3e47aa51..090f20d8764f21d1370d9beb05d8c1c5ad27c5e6 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "about.h"
 
-
 AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
 {
        setWindowTitle(tr("About GUEmap..."));
@@ -25,7 +24,7 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
 
                "<table>"
                "<tr><td align='right' width='140'><b>GUEmap: </b></td><td>Free, IF Mapping Software</td></tr>"
-               "<tr><td align='right'><b>Version: </b></td><td>3.0.1</td></tr>"
+               "<tr><td align='right'><b>Version: </b></td><td>3.0.2</td></tr>"
                "<tr><td align='right'><b>License: </b></td><td>GPL v2 or later</td></tr>"
                "<tr><td align='right'><b>Chief Architect: </b></td><td>James Hammons (shamus)</td></tr>"
                "<tr><td align='right'><b>Coders: </b></td><td>James Hammons (shamus)<br>Christopher J. Madsen</td></tr>"
@@ -58,10 +57,8 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
        layout->addWidget(text);
 }
 
-
 void AboutWindow::keyPressEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
                hide();
 }
-
index 5e4d80b9c926bbefe0346aedadc311a705b168e0..f4d4ff20b65e44c76b99ea3c1303713abdeadf72 100644 (file)
@@ -25,4 +25,3 @@ class AboutWindow: public QWidget
 };
 
 #endif // __ABOUT_H__
-
index 38ac4b5d7e0bbca69e64db2e79cc2acac6fcac09..036ee80d73ec0e957ebb556c6e33990fde29e088 100644 (file)
@@ -20,7 +20,6 @@
 #include "globals.h"
 #include "mapdoc.h"
 
-
 static const uint8_t fileHeader[8] = { 0xC7, 0x55, 0xC5, 0x6D, 0xE1, 0x70, 0x83, 0x0D };
 
 //
@@ -43,13 +42,11 @@ FileReader::FileReader(FILE * archive): ar(archive), rcCache(-1)
 {
 }
 
-
 uint8_t FileReader::byte()
 {
        return fgetc(ar);
 }
 
-
 uint16_t FileReader::word()
 {
        uint16_t b1 = fgetc(ar);
@@ -58,7 +55,6 @@ uint16_t FileReader::word()
        return (b2 << 8) | b1;
 }
 
-
 uint32_t FileReader::dword()
 {
        uint32_t dword = 0;
@@ -69,7 +65,6 @@ uint32_t FileReader::dword()
        return dword;
 }
 
-
 void FileReader::str(string & s)
 {
        StrIdx len;
@@ -101,13 +96,11 @@ void FileReader::str(string & s)
                s.erase();
 }
 
-
 bool FileReader::boolean()
 {
        return bool(byte());
 }
 
-
 //
 // Skip to the beginning of a record:
 //
@@ -163,7 +156,6 @@ void FileReader::findRecord(uint8_t type)
        }
 }
 
-
 //
 // Find out what type the next record is:
 //
@@ -216,7 +208,6 @@ uint8_t FileReader::peekNextRecord()
        return b;
 }
 
-
 //
 // Skip an unrecognized field:
 //
@@ -269,20 +260,17 @@ void FileReader::skipField(uint8_t fieldCode)
                fgetc(ar);
 }
 
-
 void WriteByte(FILE * fp, uint8_t b)
 {
        fputc(b, fp);
 }
 
-
 void WriteWord(FILE * fp, uint16_t w)
 {
        fputc(w & 0xFF, fp);
        fputc(w >> 8, fp);
 }
 
-
 void WriteDWord(FILE * fp, uint32_t dw)
 {
        fputc((dw >> 0) & 0xFF, fp);
@@ -291,13 +279,11 @@ void WriteDWord(FILE * fp, uint32_t dw)
        fputc((dw >> 24) & 0xFF, fp);
 }
 
-
 void WriteBool(FILE * fp, bool b)
 {
        fputc((b ? 1 : 0), fp);
 }
 
-
 void WriteString(FILE * fp, std::string s)
 {
        const int len = s.length();
@@ -321,7 +307,6 @@ void WriteString(FILE * fp, std::string s)
                fwrite(s.c_str(), 1, len, fp);
 }
 
-
 //
 // Current GUEmap file version is 5; can read 2 thru 4 too
 //
@@ -521,7 +506,6 @@ printf("ReadFile: Version # is %i\n", version);
        return true;
 }
 
-
 //
 // Write a GUEmap v5 file
 //
@@ -662,4 +646,3 @@ bool WriteFile(MapDoc * doc, const char * name)
 
        return true;
 }
-
index 804960c7ad98ba96e9c86d49357de94f3da2c8d7..7be74e16e1112e3c15f2c9ebdae981b9db4728e2 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "globals.h"
 #include <math.h>
-
+#include "mathconstants.h"
 
 //
 // Class MapEdge:
@@ -29,11 +29,16 @@ MapEdge::MapEdge(): room1(0), room2(0), end1(rcNone), end2(rcNone), type1(0), ty
 {
 }
 
-
 MapEdge::MapEdge(RoomNum r1, RoomNum r2, EdgeType t1, EdgeType t2, RoomCorner e1, RoomCorner e2): room1(r1), room2(r2), end1(e1), end2(e2), type1(t1), type2(t2)
 {
 }
 
+void MapEdge::Clear(void)
+{
+       room1 = room2 = 0;
+       end1 = end2 = rcNone;
+       type1 = type2 = 0;
+}
 
 //
 // Actually swap the rooms for this edge
@@ -53,7 +58,6 @@ void MapEdge::Swap(void)
        end2 = tc;
 }
 
-
 bool MapEdge::HasRoom(RoomNum r)
 {
        if ((room1 != r) && (room2 != r))
@@ -62,7 +66,6 @@ bool MapEdge::HasRoom(RoomNum r)
        return true;
 }
 
-
 //
 // Return the MapEdge but with the RoomNums, EdgeTypes, & RoomCorners swapped
 //
@@ -72,7 +75,6 @@ MapEdge MapEdge::Swapped(void) const
        return MapEdge(room2, room1, type2 | (type1 & etObstructed), type1 & ~etObstructed, end2, end1);
 }
 
-
 //
 // Class MapRoom:
 //
@@ -91,13 +93,11 @@ MapRoom::MapRoom(): flags(0)
 {
 }
 
-
 MapRoom::MapRoom(const MapRoom & o)
 {
        *this = o;
 }
 
-
 MapRoom & MapRoom::operator=(const MapRoom & source)
 {
        pos = source.pos;
@@ -107,21 +107,18 @@ MapRoom & MapRoom::operator=(const MapRoom & source)
        return *this;
 }
 
-
 QRect MapRoom::getRect(void)
 {
        return QRect(pos,
                (flags & rfCorner ? QSize(gridX, gridY) : QSize(roomWidth, roomHeight)));
 }
 
-
 QRect MapRoom::getTranslatedRect(QPoint t)
 {
        return QRect(pos + t,
                (flags & rfCorner ? QSize(gridX, gridY) : QSize(roomWidth, roomHeight)));
 }
 
-
 QPoint MapRoom::GetCenter(void)
 {
        return QPoint(pos +
@@ -130,13 +127,11 @@ QPoint MapRoom::GetCenter(void)
                        : QPoint(roomWidth / 2, roomHeight / 2)));
 }
 
-
 RoomFlags MapRoom::isCorner() const
 {
        return (flags & rfCorner);
 }
 
-
 bool MapRoom::operator!=(const MapRoom & mr) const
 {
        if (pos != mr.pos)
@@ -151,7 +146,6 @@ bool MapRoom::operator!=(const MapRoom & mr) const
        return true;
 }
 
-
 //
 // Miscellaneous functions:
 //--------------------------------------------------------------------
@@ -166,7 +160,6 @@ void trimLeft(string & s)
                s.erase(0, p);
 }
 
-
 //
 // Trim whitespace from right of string:
 //
@@ -178,7 +171,6 @@ void trimRight(string & s)
                s.erase(p + 1);
 }
 
-
 //
 // Consolidates action creation from a multi-step process to a single-step one.
 //
@@ -194,7 +186,6 @@ QAction * CreateAction(QString name, QString tooltip,
        return action;
 }
 
-
 //
 // This is essentially the same as the previous function, but this allows more
 // than one key sequence to be added as key shortcuts.
@@ -215,7 +206,6 @@ QAction * CreateAction(QString name, QString tooltip,
        return action;
 }
 
-
 //
 // Miscellaneous geometrical helper functions
 //
@@ -224,7 +214,6 @@ double Magnitude(QPointF p)
        return sqrt((p.x() * p.x()) + (p.y() * p.y()));
 }
 
-
 QPointF UnitVector(QPointF p)
 {
        double magnitude = Magnitude(p);
@@ -235,31 +224,36 @@ QPointF UnitVector(QPointF p)
        return QPointF(p.x() / magnitude, p.y() / magnitude);
 }
 
-
 double Angle(QPointF p)
 {
-       return atan2(p.y(), p.x());
-}
+       double angle = atan2(p.y(), p.x());
 
+       if (angle < 0)
+               angle += TAU;
+
+       return angle;
+}
 
 double Angle(QPoint p)
 {
-       return atan2((double)p.y(), (double)p.x());
-}
+       double angle = atan2((double)p.y(), (double)p.x());
+
+       if (angle < 0)
+               angle += TAU;
 
+       return angle;
+}
 
 double Dot(QPointF a, QPointF b)
 {
        return (a.x() * b.x()) + (a.y() * b.y());
 }
 
-
 double Determinant(QPointF a, QPointF b)
 {
        return (a.x() * b.y()) - (b.x() * a.y());
 }
 
-
 // Returns the parameter of a point in space to this vector. If the parameter
 // is between 0 and 1, the normal of the vector to the point is on the vector.
 double ParameterOfLineAndPoint(QPointF tail, QPointF head, QPointF point)
@@ -274,6 +268,6 @@ double ParameterOfLineAndPoint(QPointF tail, QPointF head, QPointF point)
        double magnitude = Magnitude(lineSegment);
        QPointF pointSegment = point - tail;
        double t = Dot(lineSegment, pointSegment) / (magnitude * magnitude);
+
        return t;
 }
-
index a39836cac6d052c0f26ffe0c4655dfb4b4952073..953b8df1612f3022d737b4814aa52be6e6d779ba 100644 (file)
@@ -73,6 +73,7 @@ struct MapEdge
 
        MapEdge();
        MapEdge(RoomNum r1, RoomNum r2, EdgeType t1, EdgeType t2, RoomCorner e1, RoomCorner e2);
+       void Clear(void);
        void Swap(void);
        MapEdge Swapped(void) const;
        bool HasRoom(RoomNum);
index 5f0a5da19c9844c891d67f0746cbe18743ad8a53..df920303cd761a4b0d3dee95d3e37f1df93a6e9e 100644 (file)
@@ -22,7 +22,6 @@ GUEMapApp::GUEMapApp(int & argc, char * argv[]): QApplication(argc, argv)//, cha
        mainWindow->show();
 }
 
-
 // Here's the main application loop--short and simple...
 int main(int argc, char * argv[])
 {
@@ -654,4 +653,3 @@ void CMapApp::editOptions()
   } // end if OK pressed
 } // end CMapApp::editOptions
 #endif
-
index 186e085917129d204280aa6ad549ba69cb6cf725..fa99724814dea1dec38d91b4f4982c404e6a32ac 100644 (file)
@@ -606,7 +606,6 @@ int MainWin::OnCreate(LPCREATESTRUCT lpCreateStruct)
        return 0;
 }
 
-
 void MainWin::OnDestroy()
 {
        CDockState  state;
@@ -621,7 +620,6 @@ void MainWin::OnDestroy()
        CMDIFrameWnd::OnDestroy();
 }
 
-
 bool MainWin::PreCreateWindow(CREATESTRUCT & cs)
 {
        // TODO: Modify the Window class or styles here by modifying
@@ -630,7 +628,6 @@ bool MainWin::PreCreateWindow(CREATESTRUCT & cs)
        return CMDIFrameWnd::PreCreateWindow(cs);
 }
 
-
 /////////////////////////////////////////////////////////////////////////////
 // CMainWin message handlers
 //--------------------------------------------------------------------
@@ -642,7 +639,6 @@ void MainWin::OnActivateApp(bool bActive, HTASK task)
        CMDIFrameWnd::OnActivateApp(bActive, task);
 }
 
-
 /////////////////////////////////////////////////////////////////////////////
 // Dock control bars on the same line:
 //
index bcb30d2c18b6a66208a140b3e5f8fb15f39017d7..aa877687276e7330ff2c43fcfe0222877a28a72c 100644 (file)
@@ -77,7 +77,6 @@ class MainWin: public QMainWindow
                QAction * deleteAct;
                QAction * selectAllAct;
                QAction * aboutAct;
-//             QAction * Act;
                QList<QAction *> mruAct;
 #if 0
        public:
@@ -110,4 +109,3 @@ class MainWin: public QMainWindow
 };
 
 #endif // __MAINWIN_H__
-
index ee72c8e5e70790f6c286ed720d6059c30146094a..dcb7cf3b19e012d960b9b0fbab46668774fb0475 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "mapdialog.h"
 
-
 MapDialog::MapDialog(QWidget * parent/*= 0*/): QDialog(parent), navMode("Navigation Mode"), displayGrid("Display Grid"), showCorners("Show Corners"), showPages("Show Pages")
 {
        QFormLayout * fl = new QFormLayout;
@@ -36,8 +35,6 @@ MapDialog::MapDialog(QWidget * parent/*= 0*/): QDialog(parent), navMode("Navigat
        setWindowTitle(tr("Map Settings"));
 }
 
-
 MapDialog::~MapDialog()
 {
 }
-
index ccac7abdc68dd48ed9bdd20114d8689019cb969e..6bf63cd5e62be0e87e6135a92c83bc3afe3b7071 100644 (file)
@@ -24,4 +24,3 @@ class MapDialog: public QDialog
 };
 
 #endif // __MAPDIALOG_H__
-
index e01046c45498568e852de304f5a2248a097ecf11..f911690633791a4c07e352a6ca22b2723131d2f2 100644 (file)
@@ -399,6 +399,8 @@ int MapDoc::findEdge(RoomNum n, RoomCorner corner, MapEdge & newEdge) const
                }
        }
 
+       newEdge.Clear();
+
        return -1;
 }
 
index f84c9f423d83c9569174e7baa953f8e7648745a5..6514b89245dbf6fea2ecdb1186faffd807642867 100644 (file)
@@ -27,10 +27,8 @@ extern const RoomCorner oppositeCorner[rcNumCorners];
 
 const QSize defaultRoomSize(roomWidth, roomHeight);
 
-
 class UndoRec;
 
-
 class MapDoc
 {
        public:
@@ -129,7 +127,6 @@ class MapDoc
 #endif
 };
 
-
 #if 0
 class RoomScrap
 {
@@ -146,4 +143,3 @@ class RoomScrap
 #endif
 
 #endif // __MAPDOC_H__
-
index 6e1199fa87e61242c8b3a075071fa2de4738c287..f745caf9cd36f238f976b73afaaf3189e9b0ccb4 100644 (file)
@@ -20,7 +20,6 @@
 #include "roomdialog.h"
 #include "undo.h"
 
-
 const int
        penEdgeWidth = 9,
        penPageWidth = 20,
@@ -53,7 +52,6 @@ static const DirectionName directions[] = {
 
 static const char a2z[] = "abcdefghijklmnopqrstuvwxyz";
 
-
 //
 // Parse a direction word:
 //
@@ -89,7 +87,6 @@ RoomCorner parseDirection(string & text)
        return rcNone;
 }
 
-
 #if 0
 /////////////////////////////////////////////////////////////////////////////
 // CRepaginateDlg dialog
@@ -122,8 +119,6 @@ class CRepaginateDlg : public CDialog
 };
 #endif
 
-
-
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 // CMapView
@@ -360,14 +355,12 @@ MapView::MapView(QWidget * parent/*= NULL*/): QWidget(parent),
        mapContextMenu->addAction(deleteRoomAct);
 }
 
-
 MapView::~MapView()
 {
        delete doc;
 //     gueApp()->closingView(this);  // Remove any comment for this view
 }
 
-
 void MapView::DrawArrowhead(QPainter * painter, QPointF head, QPointF tail)
 {
        QPolygonF arrow;
@@ -387,7 +380,6 @@ void MapView::DrawArrowhead(QPainter * painter, QPointF head, QPointF tail)
        painter->drawPolygon(arrow);
 }
 
-
 void MapView::DrawNoExit(QPainter * painter, QPointF head, QPointF tail)
 {
        const double angle = Angle(tail - head);
@@ -403,7 +395,6 @@ void MapView::DrawNoExit(QPainter * painter, QPointF head, QPointF tail)
        painter->drawLine(p2, p3);
 }
 
-
 //
 // MapView drawing
 //
@@ -736,9 +727,6 @@ printf("    clip = %i, %i, %i, %i; docSize = %i, %i\n", clip.left(), clip.right(
                        QPoint ex = QPoint(0, 0);
                        double angle = Angle(end - start);
 
-                       if (angle < 0)
-                               angle += TAU;
-
                        // Adjust text position if it runs into an edge
                        if (((edge->end1 == rcNNW || edge->end1 == rcN || edge->end1 == rcNNE) && (angle > THREE_QTR_TAU && angle < TAU))
                                || ((edge->end1 == rcSSW || edge->end1 == rcS || edge->end1 == rcSSE) && (angle > QTR_TAU && angle < HALF_TAU))
@@ -753,14 +741,12 @@ printf("    clip = %i, %i, %i, %i; docSize = %i, %i\n", clip.left(), clip.right(
                        dc->drawText(p + edgLblOffset[edge->end1] + ex, elBuf);
                }
 
-               if (edge->type2 & etDirection)
+               // Make sure there's an actual room #2 for this edge...
+               if (!(edge->type1 & etNoRoom2) && (edge->type2 & etDirection))
                {
                        QPoint ex = QPoint(0, 0);
                        double angle = Angle(start - end);
 
-                       if (angle < 0)
-                               angle += TAU;
-
                        // Adjust text position if it runs into an edge
                        if (((edge->end2 == rcNNW || edge->end2 == rcN || edge->end2 == rcNNE) && (angle > THREE_QTR_TAU && angle < TAU))
                                || ((edge->end2 == rcSSW || edge->end2 == rcS || edge->end2 == rcSSE) && (angle > QTR_TAU && angle < HALF_TAU))
@@ -891,7 +877,6 @@ printf("    clip = %i, %i, %i, %i; docSize = %i, %i\n", clip.left(), clip.right(
        }
 }
 
-
 void MapView::keyPressEvent(QKeyEvent * event)
 {
        bool oldShift = shiftDown;
@@ -975,7 +960,6 @@ void MapView::keyPressEvent(QKeyEvent * event)
 #endif
 }
 
-
 void MapView::keyReleaseEvent(QKeyEvent * event)
 {
        bool oldShift = shiftDown;
@@ -1006,7 +990,6 @@ void MapView::keyReleaseEvent(QKeyEvent * event)
        }
 }
 
-
 #if 0
 /////////////////////////////////////////////////////////////////////////////
 // CMapView printing
@@ -1026,7 +1009,6 @@ void MapView::OnPrepareDC(QPainter * dc, CPrintInfo * pInfo)
                printingPage = 0;
 }
 
-
 bool MapView::OnPreparePrinting(CPrintInfo * pInfo)
 {
        // Require registration before printing map with more than 10 rooms:
@@ -1051,7 +1033,6 @@ bool MapView::OnPreparePrinting(CPrintInfo * pInfo)
        return DoPreparePrinting(pInfo);
 }
 
-
 void MapView::OnBeginPrinting(QPainter * /*pDC*/, CPrintInfo * /*pInfo*/)
 {
        // Don't show selection or corners while printing:
@@ -1062,7 +1043,6 @@ void MapView::OnBeginPrinting(QPainter * /*pDC*/, CPrintInfo * /*pInfo*/)
        showCorners = false;
 }
 
-
 void MapView::OnEndPrinting(QPainter* /*pDC*/, CPrintInfo* /*pInfo*/)
 {
        if (GetDocument()->locked)
@@ -1070,7 +1050,6 @@ void MapView::OnEndPrinting(QPainter* /*pDC*/, CPrintInfo* /*pInfo*/)
 }
 #endif
 
-
 //
 // CMapView miscellaneous
 //
@@ -1089,9 +1068,7 @@ void MapView::addRoom(QPoint & point)
                return;
        }
 
-       point.rx() -= roomWidth / 2 - gridX / 2;
        point.rx() -= point.x() % gridX;
-       point.ry() -= roomHeight / 2 - gridY / 2;
        point.ry() -= point.y() % gridY;
 
        if (point.x() < 0)
@@ -1115,7 +1092,6 @@ void MapView::addRoom(QPoint & point)
        editProperties(epuAddRoom, wasModified);
 }
 
-
 //
 // Make sure we aren't dragging a room off the edge:
 //
@@ -1145,7 +1121,6 @@ void MapView::adjustOffset(QPoint & p) const
                p.ry() = size.height() - rTmp.bottom();
 }
 
-
 //
 // Deselect all rooms:
 //
@@ -1187,7 +1162,6 @@ void MapView::clearSelection(bool update/* = true*/)
        deselectPages(update);
 }
 
-
 //
 // Compute a rectangle enclosing all selected rooms:
 //
@@ -1226,7 +1200,6 @@ void MapView::computeSelectedRect(QRect & r) const
        }
 }
 
-
 //
 // Deselect a page:
 //
@@ -1270,7 +1243,6 @@ void MapView::deselectPage(int n, bool update/* = true*/)
        }
 }
 
-
 //
 // Deselect all pages:
 //
@@ -1327,7 +1299,6 @@ void MapView::deselectPages(bool update/* = true*/)
                selectedOne = -1;
 }
 
-
 //
 // Deselect a room:
 //
@@ -1374,7 +1345,6 @@ void MapView::deselectRoom(RoomNum n, bool update/* = true*/)
        }
 }
 
-
 //
 // Update the room comments dialog after the selection changes:
 //
@@ -1383,7 +1353,6 @@ void MapView::selectDone()
 //     static_cast<CMapApp *>(AfxGetApp())->setComment(this, (selectedOne >= 0 ? &(GetDocument()->getRoom(selectedOne)) : NULL));
 }
 
-
 //
 // Select a page:
 //
@@ -1419,7 +1388,6 @@ void MapView::selectPage(int n, bool update/* = true*/)
        }
 }
 
-
 //
 // Select a room:
 //
@@ -1461,7 +1429,6 @@ void MapView::selectRoom(RoomNum n, bool update/*= true*/)
        }
 }
 
-
 void MapView::selectOnlyRoom(RoomNum n)
 {
        if (selectedOne != n)
@@ -1472,7 +1439,6 @@ void MapView::selectOnlyRoom(RoomNum n)
        }
 }
 
-
 //
 // Make sure that a room is visible:
 //
@@ -1542,7 +1508,6 @@ void MapView::makeRoomVisible(RoomNum n)
 #endif
 }
 
-
 //
 // Paste a string to the clipboard:
 //
@@ -1582,7 +1547,6 @@ bool MapView::pasteClipboard(const string & text)
        return true;
 }
 
-
 //
 // Update the selected room's comment from the floating dialog:
 //
@@ -1600,7 +1564,6 @@ void MapView::setRoomNote(const char * comment)
        }
 }
 
-
 int MapView::FindHoveredEdge(void)
 {
        for(int i=0; i<doc->edge.size(); i++)
@@ -1632,7 +1595,6 @@ int MapView::FindHoveredEdge(void)
        return -1;
 }
 
-
 //
 // Set the step size of the scroll bars:
 //
@@ -1659,7 +1621,6 @@ void MapView::setScrollBars()
 #endif
 }
 
-
 //
 // Zoom the display:
 //
@@ -1688,7 +1649,6 @@ void MapView::zoomTo(short newZoom)
        }
 }
 
-
 //
 // Navigation:
 //---------------------------------------------------------------------------
@@ -1903,7 +1863,6 @@ void MapView::navigate(RoomCorner corner, bool toggleStubs/* = true*/)
        }
 }
 
-
 //
 // Fill in the edge type from the navigation box:
 //
@@ -1984,7 +1943,6 @@ void MapView::setEdgeType(MapEdge & e)
        }
 }
 
-
 //
 // Start typing in the navigation bar:
 //
@@ -2007,7 +1965,6 @@ void MapView::setNavText(char c)
 #endif
 }
 
-
 #if 0
 void MapView::OnChar(unsigned int c, unsigned int nRepCnt, unsigned int nFlags)
 {
@@ -2020,7 +1977,6 @@ void MapView::OnChar(unsigned int c, unsigned int nRepCnt, unsigned int nFlags)
 }
 #endif
 
-
 //
 // Parse the text in the navigation bar:
 //
@@ -2095,7 +2051,6 @@ void MapView::getNavText(char & initial, RoomCorner & dir1, char & separator, Ro
 #endif
 }
 
-
 #if 0
 //
 // Handle the Go button in the navigation bar:
@@ -2137,7 +2092,6 @@ void MapView::OnNavGo()
        }
 }
 
-
 //
 // Handle the direction keys on the numeric keypad:
 //
@@ -2178,7 +2132,6 @@ void MapView::OnNavGoDir(unsigned int cmd)
                MessageBeep(MB_ICONASTERISK);
 }
 
-
 //
 // CMapView message handlers
 //---------------------------------------------------------------------------
@@ -2193,7 +2146,6 @@ void MapView::OnActivateView(bool bActivate, CView * pActivateView, CView * pDea
 }
 #endif
 
-
 // N.B.: If you click on a corner with no edge coming out of it, it will crash here...  !!! FIX !!! [MOSTLY DONE--there's still a way to make it crash with "Add Corner", but I can't remember the specifics...]
 //void MapView::OnEditAddCorner()
 void MapView::HandleAddCorner(void)
@@ -2213,7 +2165,6 @@ void MapView::HandleAddCorner(void)
        update();
 }
 
-
 void MapView::HandleAddUnexplored(void)
 {
        EdgeVec deletedEdges;
@@ -2249,7 +2200,6 @@ void MapView::HandleAddUnexplored(void)
        update();
 }
 
-
 void MapView::HandleAddLoopBack(void)
 {
        EdgeVec deletedEdges;
@@ -2285,7 +2235,6 @@ void MapView::HandleAddLoopBack(void)
        update();
 }
 
-
 void MapView::HandleAddNoExit(void)
 {
        EdgeVec deletedEdges;
@@ -2321,7 +2270,6 @@ void MapView::HandleAddNoExit(void)
        update();
 }
 
-
 void MapView::SetEdgeDirection(EdgeType et)
 {
        MapEdge e;
@@ -2348,31 +2296,26 @@ void MapView::SetEdgeDirection(EdgeType et)
        update();
 }
 
-
 void MapView::HandleAddUp(void)
 {
        SetEdgeDirection(etUp);
 }
 
-
 void MapView::HandleAddDown(void)
 {
        SetEdgeDirection(etDown);
 }
 
-
 void MapView::HandleAddIn(void)
 {
        SetEdgeDirection(etIn);
 }
 
-
 void MapView::HandleAddOut(void)
 {
        SetEdgeDirection(etOut);
 }
 
-
 void MapView::SetEdges(int room, int edgeNum, EdgeType eType)
 {
 /*
@@ -2426,7 +2369,6 @@ One way to make that less awful is to overload the RoomCorner (which, for some r
        }
 }
 
-
 void MapView::ClearEdges(int room, int edgeNum, EdgeType eType)
 {
        // Go thru from current room to all connected "corner" rooms
@@ -2462,7 +2404,6 @@ void MapView::ClearEdges(int room, int edgeNum, EdgeType eType)
        }
 }
 
-
 void MapView::HandleAddOneWay(void)
 {
        MapEdge e;
@@ -2477,7 +2418,6 @@ void MapView::HandleAddOneWay(void)
        update();
 }
 
-
 void MapView::HandleClearOneWay(void)
 {
        MapEdge e;
@@ -2492,7 +2432,6 @@ void MapView::HandleClearOneWay(void)
        update();
 }
 
-
 void MapView::HandleAddRestricted(void)
 {
        MapEdge e;
@@ -2507,7 +2446,6 @@ void MapView::HandleAddRestricted(void)
        update();
 }
 
-
 void MapView::HandleClearRestricted(void)
 {
        MapEdge e;
@@ -2522,13 +2460,32 @@ void MapView::HandleClearRestricted(void)
        update();
 }
 
-
 //void MapView::OnEditAddRoom()
 void MapView::HandleAddRoom(void)
 {
-       addRoom(scrollDragStart);
-}
+#if 0
+       MapDoc * const doc = GetDocument();
+       ASSERT_VALID(doc);
+
+       const int p = doc->page.size();
 
+       if (p < maxPages)
+       {
+               MapPage page;
+               page.pos = scrollDragStart;
+               page.pos.x -= page.pos.x % gridX;
+               page.pos.y -= page.pos.y % gridY;
+               doc->setUndoData(new UndoAdd(doc->isDirty, p));
+               showPages = true;
+               doc->addPage(p, page);
+               clearSelection();
+               selectPage(p);
+       }
+#else
+       QPoint roomPt(scrollDragStart - offset);
+       addRoom(roomPt);
+#endif
+}
 
 void MapView::HandleMapProperties(void)
 {
@@ -2557,7 +2514,6 @@ void MapView::HandleMapProperties(void)
        update();
 }
 
-
 //void MapView::OnEditClear()
 void MapView::HandleDelete(void)
 {
@@ -2565,7 +2521,6 @@ void MapView::HandleDelete(void)
        update();
 }
 
-
 #if 0
 //--------------------------------------------------------------------
 void MapView::OnEditAddPage()
@@ -2590,7 +2545,6 @@ void MapView::OnEditAddPage()
 }
 #endif
 
-
 //
 // Input:
 //   removeCorner: (default true)
@@ -2661,7 +2615,6 @@ void MapView::deleteSelection(bool removeCorner/* = true*/)
        }
 }
 
-
 #if 0
 //--------------------------------------------------------------------
 // Cut, Copy & Paste:
@@ -2716,14 +2669,12 @@ void MapView::OnEditCopy()
        }
 }
 
-
 void MapView::OnEditCut()
 {
        OnEditCopy();
        deleteSelection();
 }
 
-
 void MapView::OnEditPaste()
 {
        const RoomScrap * scrap = static_cast<CMapApp *>(AfxGetApp())->getClipboard();
@@ -2750,7 +2701,6 @@ void MapView::OnEditPaste()
        }
 }
 
-
 void MapView::OnEditPaginate()
 {
        showPages = true;
@@ -2758,7 +2708,6 @@ void MapView::OnEditPaginate()
 }
 #endif
 
-
 //
 // Handle Edit Properties:
 //
@@ -2768,7 +2717,6 @@ void MapView::HandleRoomProperties(void)
        editProperties(epuRoomInfo);
 }
 
-
 //
 // Bring up the Properties dialog:
 //
@@ -2933,7 +2881,6 @@ void MapView::editProperties(EditPropUndo undoType, bool wasModified/*= false*/,
        delete undoRoom;
 }
 
-
 #if 0
 //
 // Select all rooms:
@@ -2946,7 +2893,6 @@ void MapView::OnEditSelectAll()
        selectDone();
 }
 
-
 //---------------------------------------------------------------------------
 // Select connected rooms:
 
@@ -2979,7 +2925,6 @@ void MapView::OnEditSelectConnected()
        selectDone();
 }
 
-
 void MapView::OnInitialUpdate()
 {
        const MapDoc * doc = GetDocument();
@@ -3005,7 +2950,6 @@ void MapView::OnInitialUpdate()
        setScrollBars();              // Now fix the scroll bars
 }
 
-
 void MapView::OnKeyDown(unsigned int c, unsigned int nRepCnt, unsigned int nFlags)
 {
        bool ctrl = (GetKeyState(VK_CONTROL) < 0);
@@ -3035,7 +2979,6 @@ void MapView::OnKeyDown(unsigned int c, unsigned int nRepCnt, unsigned int nFlag
 }
 #endif
 
-
 void MapView::mouseDoubleClickEvent(QMouseEvent * event)
 //void MapView::OnLButtonDblClk(unsigned int nFlags, QPoint point)
 {
@@ -3072,7 +3015,6 @@ void MapView::mouseDoubleClickEvent(QMouseEvent * event)
                addRoom(point);
 }
 
-
 /* N.B.: Handles RButton & MButton too */
 void MapView::mousePressEvent(QMouseEvent * event)
 //void MapView::OnLButtonDown(unsigned int nFlags, QPoint point)
@@ -3273,7 +3215,8 @@ Qt::NoModifier, Qt::ShiftModifier, Qt::ControlModifier, Qt::AltModifier, etc.
                                {
                                        edgeTmp.room1 = room;
                                        edgeTmp.end1 = corner;
-                                       setEdgeType(edgeTmp);
+// This is setting edge types when it shouldn't...  So we're commenting this out for now.
+//                                     setEdgeType(edgeTmp);
                                }
 
                                edgeTmp.room2 = 0;
@@ -3744,7 +3687,6 @@ void MapView::mouseMoveEvent(QMouseEvent * event)
        update();
 }
 
-
 //void MapView::OnLButtonUp(unsigned int nFlags, QPoint point)
 void MapView::mouseReleaseEvent(QMouseEvent * event)
 {
@@ -3985,7 +3927,6 @@ void MapView::mouseReleaseEvent(QMouseEvent * event)
        update();
 }
 
-
 #if 0
 int MapView::OnMouseActivate(CWnd * wnd, unsigned int hitTest, unsigned int message)
 {
@@ -3997,7 +3938,6 @@ int MapView::OnMouseActivate(CWnd * wnd, unsigned int hitTest, unsigned int mess
                return result;
 }
 
-
 bool MapView::OnMouseWheel(unsigned int nFlags, short zDelta, QPoint pt)
 {
        if (nFlags == MK_CONTROL)
@@ -4009,7 +3949,6 @@ bool MapView::OnMouseWheel(unsigned int nFlags, short zDelta, QPoint pt)
        return CScrollZoomView::OnMouseWheel(nFlags, zDelta, pt);
 }
 
-
 void MapView::OnSize(unsigned int nType, int cx, int cy)
 {
        CScrollZoomView::OnSize(nType, cx, cy);
@@ -4018,7 +3957,6 @@ void MapView::OnSize(unsigned int nType, int cx, int cy)
                setScrollBars();
 }
 
-
 void MapView::OnTimer(unsigned int idEvent)
 {
        if (idEvent == menuTimer)
@@ -4034,7 +3972,6 @@ void MapView::OnTimer(unsigned int idEvent)
                CScrollZoomView::OnTimer(idEvent);
 }
 
-
 //
 // Update the view after the document changes:
 //
@@ -4107,20 +4044,17 @@ void MapView::OnUpdate(CView * pSender, LPARAM lHint, CObject * pHint)
                Invalidate();
 }
 
-
 void MapView::OnUpdateEditAddCorner(CCmdUI* pCmdUI)
 {
        pCmdUI->Enable(opInProgress == gmoAddCorner);
 }
 
-
 void MapView::OnUpdateEditPaste(CCmdUI* pCmdUI)
 {
        pCmdUI->Enable((static_cast<CMapApp*>(AfxGetApp())->getClipboard() != NULL)
                && !GetDocument()->locked);
 }
 
-
 //
 // Commands which require selected rooms and unlocked document:
 //
@@ -4148,7 +4082,6 @@ void MapView::OnUpdateSelectedUnlocked(CCmdUI * pCmdUI)
        pCmdUI->Enable(selected && !doc->locked);
 }
 
-
 //
 // Commands which require the document to be unlocked:
 //
@@ -4159,7 +4092,6 @@ void MapView::OnUpdateUnlocked(CCmdUI* pCmdUI)
        pCmdUI->Enable(!GetDocument()->locked);
 }
 
-
 //
 // Toggle the grid on and off:
 //
@@ -4169,13 +4101,11 @@ void MapView::OnViewGrid()
        InvalidateRect(NULL);
 }
 
-
 void MapView::OnUpdateViewGrid(CCmdUI * pCmdUI)
 {
        pCmdUI->SetCheck(showGrid);
 }
 
-
 void MapView::OnViewZoom(unsigned int cmd)
 {
        ASSERT((cmd == ID_VIEW_ZOOM_IN) || (cmd == ID_VIEW_ZOOM_OUT));
@@ -4186,14 +4116,12 @@ void MapView::OnViewZoom(unsigned int cmd)
                zoomTo(zoom + 10 - zoom % 10);
 }
 
-
 void MapView::OnUpdateViewZoom(CCmdUI * pCmdUI)
 {
        pCmdUI->Enable((pCmdUI->m_nID == ID_VIEW_ZOOM_IN)
                ? (zoom < maxZoom) : (zoom > minZoom));
 }
 
-
 //
 // Redraw the window:
 //
@@ -4202,7 +4130,6 @@ void MapView::OnWindowRefresh()
        InvalidateRect(NULL);
 }
 
-
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 // CRepaginateDlg dialog
@@ -4222,7 +4149,6 @@ END_MESSAGE_MAP();
 /////////////////////////////////////////////////////////////////////////////
 // CRepaginateDlg message handlers
 
-
 bool CRepaginateDlg::OnInitDialog()
 {
        CDialog::OnInitDialog();
@@ -4233,10 +4159,8 @@ bool CRepaginateDlg::OnInitDialog()
        return true;  // return TRUE unless you set the focus to a control
 }
 
-
 void CRepaginateDlg::OnYes()
 {
        EndDialog(IDYES);
 }
 #endif
-