From 075de16b7430454597f1cde039405b18232f0058 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Tue, 11 Jul 2023 16:25:33 -0500 Subject: [PATCH] Fix room adding to work properly, misc. small changes. --- src/about.cpp | 5 +- src/about.h | 1 - src/file.cpp | 17 ------ src/globals.cpp | 46 ++++++++--------- src/globals.h | 1 + src/guemapapp.cpp | 2 - src/mainwin.cpp | 4 -- src/mainwin.h | 2 - src/mapdialog.cpp | 3 -- src/mapdialog.h | 1 - src/mapdoc.cpp | 2 + src/mapdoc.h | 4 -- src/mapview.cpp | 128 ++++++++++------------------------------------ 13 files changed, 50 insertions(+), 166 deletions(-) diff --git a/src/about.cpp b/src/about.cpp index 09708ad..090f20d 100644 --- a/src/about.cpp +++ b/src/about.cpp @@ -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) "" "" - "" + "" "" "" "" @@ -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(); } - diff --git a/src/about.h b/src/about.h index 5e4d80b..f4d4ff2 100644 --- a/src/about.h +++ b/src/about.h @@ -25,4 +25,3 @@ class AboutWindow: public QWidget }; #endif // __ABOUT_H__ - diff --git a/src/file.cpp b/src/file.cpp index 38ac4b5..036ee80 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -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; } - diff --git a/src/globals.cpp b/src/globals.cpp index 804960c..7be74e1 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -9,7 +9,7 @@ #include "globals.h" #include - +#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; } - diff --git a/src/globals.h b/src/globals.h index a39836c..953b8df 100644 --- a/src/globals.h +++ b/src/globals.h @@ -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); diff --git a/src/guemapapp.cpp b/src/guemapapp.cpp index 5f0a5da..df92030 100644 --- a/src/guemapapp.cpp +++ b/src/guemapapp.cpp @@ -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 - diff --git a/src/mainwin.cpp b/src/mainwin.cpp index 186e085..fa99724 100644 --- a/src/mainwin.cpp +++ b/src/mainwin.cpp @@ -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: // diff --git a/src/mainwin.h b/src/mainwin.h index bcb30d2..aa87768 100644 --- a/src/mainwin.h +++ b/src/mainwin.h @@ -77,7 +77,6 @@ class MainWin: public QMainWindow QAction * deleteAct; QAction * selectAllAct; QAction * aboutAct; -// QAction * Act; QList mruAct; #if 0 public: @@ -110,4 +109,3 @@ class MainWin: public QMainWindow }; #endif // __MAINWIN_H__ - diff --git a/src/mapdialog.cpp b/src/mapdialog.cpp index ee72c8e..dcb7cf3 100644 --- a/src/mapdialog.cpp +++ b/src/mapdialog.cpp @@ -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() { } - diff --git a/src/mapdialog.h b/src/mapdialog.h index ccac7ab..6bf63cd 100644 --- a/src/mapdialog.h +++ b/src/mapdialog.h @@ -24,4 +24,3 @@ class MapDialog: public QDialog }; #endif // __MAPDIALOG_H__ - diff --git a/src/mapdoc.cpp b/src/mapdoc.cpp index e01046c..f911690 100644 --- a/src/mapdoc.cpp +++ b/src/mapdoc.cpp @@ -399,6 +399,8 @@ int MapDoc::findEdge(RoomNum n, RoomCorner corner, MapEdge & newEdge) const } } + newEdge.Clear(); + return -1; } diff --git a/src/mapdoc.h b/src/mapdoc.h index f84c9f4..6514b89 100644 --- a/src/mapdoc.h +++ b/src/mapdoc.h @@ -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__ - diff --git a/src/mapview.cpp b/src/mapview.cpp index 6e1199f..f745caf 100644 --- a/src/mapview.cpp +++ b/src/mapview.cpp @@ -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(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; iedge.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(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(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 - -- 2.37.2
GUEmap: Free, IF Mapping Software
Version: 3.0.1
Version: 3.0.2
License: GPL v2 or later
Chief Architect: James Hammons (shamus)
Coders: James Hammons (shamus)
Christopher J. Madsen