summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-10 21:34:14 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-10 21:34:14 +0300
commitcb6f070779f94f3d69ba7576affb0588b61e7b7c (patch)
tree2ae6218ffff3691ca883de66007a4cd3b833bf5c /src/gui
parentb7d3acab99fe4975d4598b6c9ac1ad88edfa8506 (diff)
downloadplus-cb6f070779f94f3d69ba7576affb0588b61e7b7c.tar.gz
plus-cb6f070779f94f3d69ba7576affb0588b61e7b7c.tar.bz2
plus-cb6f070779f94f3d69ba7576affb0588b61e7b7c.tar.xz
plus-cb6f070779f94f3d69ba7576affb0588b61e7b7c.zip
Add close to minimap context menu.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp15
-rw-r--r--src/gui/popups/popupmenu.h3
-rw-r--r--src/gui/viewport.cpp3
-rw-r--r--src/gui/windows/minimap.cpp3
4 files changed, 19 insertions, 5 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 71a6d81d5..d9d3999c1 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -41,10 +41,12 @@
#include "gui/buttontext.h"
#include "gui/gui.h"
#include "gui/viewport.h"
+#include "gui/windowmenu.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/equipmentwindow.h"
#include "gui/windows/inventorywindow.h"
+#include "gui/windows/minimap.h"
#include "gui/windows/ministatuswindow.h"
#include "gui/windows/npcdialog.h"
#include "gui/windows/outfitwindow.h"
@@ -52,7 +54,6 @@
#include "gui/windows/textcommandeditor.h"
#include "gui/windows/textdialog.h"
#include "gui/windows/tradewindow.h"
-#include "gui/windowmenu.h"
#include "gui/widgets/button.h"
#include "gui/widgets/createwidget.h"
@@ -638,11 +639,15 @@ void PopupMenu::showPopup(const int x, const int y, MapItem *const mapItem)
}
void PopupMenu::showMapPopup(const int x, const int y,
- const int x2, const int y2)
+ const int x2, const int y2,
+ const bool isMinimap)
{
mX = x2;
mY = y2;
+ if (isMinimap)
+ mWindow = minimap;
+
mBrowserBox->clearRows();
// TRANSLATORS: popup menu header
@@ -661,6 +666,12 @@ void PopupMenu::showMapPopup(const int x, const int y,
// TRANSLATORS: move camera to map item
mBrowserBox->addRow("/movecamera 'X' 'Y'", _("Move camera"));
mBrowserBox->addRow("##3---");
+ if (isMinimap)
+ {
+ // TRANSLATORS: popup menu item
+ mBrowserBox->addRow("window close", _("Close"));
+ }
+ mBrowserBox->addRow("##3---");
// TRANSLATORS: popup menu item
// TRANSLATORS: close menu
mBrowserBox->addRow("cancel", _("Cancel"));
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 3952178f2..e8e0ddeb4 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -128,7 +128,8 @@ class PopupMenu final : public Popup, public LinkHandler
Item *const item);
void showMapPopup(const int x, const int y,
- const int x2, const int y2);
+ const int x2, const int y2,
+ const bool isMinimap);
/**
* Shows the related popup menu when right click on the chat
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 832708a45..69a7dd1e8 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -411,7 +411,8 @@ bool Viewport::openContextMenu(const MouseEvent &event)
return false;
popupMenu->showMapPopup(eventX, eventY,
(mMouseX + mPixelViewX) / mMap->getTileWidth(),
- (mMouseY + mPixelViewY) / mMap->getTileHeight());
+ (mMouseY + mPixelViewY) / mMap->getTileHeight(),
+ false);
return true;
}
return false;
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 06531c69b..9c586c6f3 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -494,7 +494,8 @@ void Minimap::mouseReleased(MouseEvent &event)
screenToMap(x, y);
popupMenu->showMapPopup(viewport->mMouseX,
viewport->mMouseY,
- x, y);
+ x, y,
+ true);
}
}