|
|
|
@ -26,15 +26,55 @@ namespace
|
|
|
|
|
|
|
|
|
|
const int cellSize = 8192;
|
|
|
|
|
|
|
|
|
|
enum WidgetDepth
|
|
|
|
|
enum LocalMapWidgetDepth
|
|
|
|
|
{
|
|
|
|
|
CompassLayer = 0,
|
|
|
|
|
MarkerAboveFogLayer = 1,
|
|
|
|
|
FogLayer = 2,
|
|
|
|
|
MarkerLayer = 3,
|
|
|
|
|
MapLayer = 4
|
|
|
|
|
Local_CompassLayer = 0,
|
|
|
|
|
Local_MarkerAboveFogLayer = 1,
|
|
|
|
|
Local_FogLayer = 2,
|
|
|
|
|
Local_MarkerLayer = 3,
|
|
|
|
|
Local_MapLayer = 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum GlobalMapWidgetDepth
|
|
|
|
|
{
|
|
|
|
|
Global_CompassLayer = 0,
|
|
|
|
|
Global_MarkerLayer = 1,
|
|
|
|
|
Global_ExploreOverlayLayer = 2,
|
|
|
|
|
Global_MapLayer = 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// @brief A widget that changes its color when hovered.
|
|
|
|
|
class MarkerWidget: public MyGUI::Widget
|
|
|
|
|
{
|
|
|
|
|
MYGUI_RTTI_DERIVED(MarkerWidget)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void setNormalColour(const MyGUI::Colour& colour)
|
|
|
|
|
{
|
|
|
|
|
mNormalColour = colour;
|
|
|
|
|
setColour(colour);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setHoverColour(const MyGUI::Colour& colour)
|
|
|
|
|
{
|
|
|
|
|
mHoverColour = colour;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
MyGUI::Colour mNormalColour;
|
|
|
|
|
MyGUI::Colour mHoverColour;
|
|
|
|
|
|
|
|
|
|
void onMouseLostFocus(MyGUI::Widget* _new)
|
|
|
|
|
{
|
|
|
|
|
setColour(mNormalColour);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void onMouseSetFocus(MyGUI::Widget* _old)
|
|
|
|
|
{
|
|
|
|
|
setColour(mHoverColour);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
@ -140,7 +180,7 @@ namespace MWGui
|
|
|
|
|
mLocalMap = widget;
|
|
|
|
|
mCompass = compass;
|
|
|
|
|
|
|
|
|
|
mCompass->setDepth(CompassLayer);
|
|
|
|
|
mCompass->setDepth(Local_CompassLayer);
|
|
|
|
|
mCompass->setNeedMouseFocus(false);
|
|
|
|
|
|
|
|
|
|
// create 3x3 map widgets, 512x512 each, holding a 1024x1024 texture each
|
|
|
|
@ -151,12 +191,12 @@ namespace MWGui
|
|
|
|
|
MyGUI::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
|
|
|
|
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
|
|
|
|
|
MyGUI::Align::Top | MyGUI::Align::Left);
|
|
|
|
|
map->setDepth(MapLayer);
|
|
|
|
|
map->setDepth(Local_MapLayer);
|
|
|
|
|
|
|
|
|
|
MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
|
|
|
|
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
|
|
|
|
|
MyGUI::Align::Top | MyGUI::Align::Left);
|
|
|
|
|
fog->setDepth(FogLayer);
|
|
|
|
|
fog->setDepth(Local_FogLayer);
|
|
|
|
|
|
|
|
|
|
map->setNeedMouseFocus(false);
|
|
|
|
|
fog->setNeedMouseFocus(false);
|
|
|
|
@ -273,16 +313,17 @@ namespace MWGui
|
|
|
|
|
MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
|
|
|
|
|
widgetPos.top - 4,
|
|
|
|
|
8, 8);
|
|
|
|
|
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage",
|
|
|
|
|
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setDepth(MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setImageResource("DoorMarker");
|
|
|
|
|
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setUserString("ToolTipType", "Layout");
|
|
|
|
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
|
|
|
|
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
|
|
|
|
markerWidget->setColour(MyGUI::Colour(1.0,0.3,0.3));
|
|
|
|
|
markerWidget->setNormalColour(MyGUI::Colour(1.0,0.3,0.3));
|
|
|
|
|
markerWidget->setHoverColour(MyGUI::Colour(1.0,0.5,0.5));
|
|
|
|
|
markerWidget->setUserData(marker);
|
|
|
|
|
markerWidget->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &LocalMapBase::onCustomMarkerDoubleClicked);
|
|
|
|
|
markerWidget->setNeedMouseFocus(true);
|
|
|
|
|
customMarkerCreated(markerWidget);
|
|
|
|
|
mCustomMarkerWidgets.push_back(markerWidget);
|
|
|
|
|
}
|
|
|
|
|
redraw();
|
|
|
|
@ -357,16 +398,19 @@ namespace MWGui
|
|
|
|
|
widgetPos.top - 4,
|
|
|
|
|
8, 8);
|
|
|
|
|
++counter;
|
|
|
|
|
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage",
|
|
|
|
|
MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setDepth(MarkerLayer);
|
|
|
|
|
markerWidget->setImageResource("DoorMarker");
|
|
|
|
|
markerWidget->setNormalColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
|
|
|
|
markerWidget->setHoverColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal_over}")));
|
|
|
|
|
markerWidget->setDepth(Local_MarkerLayer);
|
|
|
|
|
markerWidget->setNeedMouseFocus(true);
|
|
|
|
|
markerWidget->setUserString("ToolTipType", "Layout");
|
|
|
|
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
|
|
|
|
markerWidget->setUserString("Caption_TextOneLine", marker.name);
|
|
|
|
|
// Used by tooltips to not show the tooltip if marker is hidden by fog of war
|
|
|
|
|
markerWidget->setUserString("IsMarker", "true");
|
|
|
|
|
markerWidget->setUserData(markerPos);
|
|
|
|
|
doorMarkerCreated(markerWidget);
|
|
|
|
|
|
|
|
|
|
mDoorMarkerWidgets.push_back(markerWidget);
|
|
|
|
|
}
|
|
|
|
@ -458,7 +502,7 @@ namespace MWGui
|
|
|
|
|
++counter;
|
|
|
|
|
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setDepth(MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setImageTexture(markerTexture);
|
|
|
|
|
markerWidget->setUserString("IsMarker", "true");
|
|
|
|
|
markerWidget->setUserData(markerPos);
|
|
|
|
@ -503,7 +547,7 @@ namespace MWGui
|
|
|
|
|
8, 8);
|
|
|
|
|
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setDepth(MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setDepth(Local_MarkerAboveFogLayer);
|
|
|
|
|
markerWidget->setImageTexture("textures\\menu_map_smark.dds");
|
|
|
|
|
markerWidget->setUserString("IsMarker", "true");
|
|
|
|
|
markerWidget->setUserData(markerPos);
|
|
|
|
@ -523,7 +567,18 @@ namespace MWGui
|
|
|
|
|
, mGlobalMap(0)
|
|
|
|
|
, mGlobalMapRender(0)
|
|
|
|
|
, mEditNoteDialog()
|
|
|
|
|
, mEventBoxGlobal(NULL)
|
|
|
|
|
, mEventBoxLocal(NULL)
|
|
|
|
|
, mGlobalMapImage(NULL)
|
|
|
|
|
, mGlobalMapOverlay(NULL)
|
|
|
|
|
{
|
|
|
|
|
static bool registered = false;
|
|
|
|
|
if (!registered)
|
|
|
|
|
{
|
|
|
|
|
MyGUI::FactoryManager::getInstance().registerFactory<MarkerWidget>("Widget");
|
|
|
|
|
registered = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mEditNoteDialog.setVisible(false);
|
|
|
|
|
mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk);
|
|
|
|
|
mEditNoteDialog.eventDeleteClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDelete);
|
|
|
|
@ -537,6 +592,11 @@ namespace MWGui
|
|
|
|
|
getWidget(mPlayerArrowLocal, "CompassLocal");
|
|
|
|
|
getWidget(mPlayerArrowGlobal, "CompassGlobal");
|
|
|
|
|
|
|
|
|
|
mPlayerArrowGlobal->setDepth(Global_CompassLayer);
|
|
|
|
|
mPlayerArrowGlobal->setNeedMouseFocus(false);
|
|
|
|
|
mGlobalMapImage->setDepth(Global_MapLayer);
|
|
|
|
|
mGlobalMapOverlay->setDepth(Global_ExploreOverlayLayer);
|
|
|
|
|
|
|
|
|
|
mLastScrollWindowCoordinates = mLocalMap->getCoord();
|
|
|
|
|
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord);
|
|
|
|
|
|
|
|
|
@ -549,6 +609,8 @@ namespace MWGui
|
|
|
|
|
getWidget(mEventBoxGlobal, "EventBoxGlobal");
|
|
|
|
|
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
|
mEventBoxGlobal->setDepth(Global_ExploreOverlayLayer);
|
|
|
|
|
|
|
|
|
|
getWidget(mEventBoxLocal, "EventBoxLocal");
|
|
|
|
|
mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
@ -672,34 +734,32 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
void MapWindow::addVisitedLocation(const std::string& name, int x, int y)
|
|
|
|
|
{
|
|
|
|
|
float worldX, worldY;
|
|
|
|
|
mGlobalMapRender->cellTopLeftCornerToImageSpace (x, y, worldX, worldY);
|
|
|
|
|
|
|
|
|
|
MyGUI::IntCoord widgetCoord(
|
|
|
|
|
worldX * mGlobalMapRender->getWidth()+6,
|
|
|
|
|
worldY * mGlobalMapRender->getHeight()+6,
|
|
|
|
|
12, 12);
|
|
|
|
|
|
|
|
|
|
static int _counter=0;
|
|
|
|
|
MyGUI::Button* markerWidget = mGlobalMapOverlay->createWidget<MyGUI::Button>("ButtonImage",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setImageResource("DoorMarker");
|
|
|
|
|
markerWidget->setUserString("ToolTipType", "Layout");
|
|
|
|
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
|
|
|
|
markerWidget->setUserString("Caption_TextOneLine", name);
|
|
|
|
|
++_counter;
|
|
|
|
|
|
|
|
|
|
markerWidget = mEventBoxGlobal->createWidget<MyGUI::Button>("",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setNeedMouseFocus (true);
|
|
|
|
|
markerWidget->setUserString("ToolTipType", "Layout");
|
|
|
|
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
|
|
|
|
markerWidget->setUserString("Caption_TextOneLine", name);
|
|
|
|
|
|
|
|
|
|
CellId cell;
|
|
|
|
|
cell.first = x;
|
|
|
|
|
cell.second = y;
|
|
|
|
|
mMarkers.push_back(cell);
|
|
|
|
|
if (mMarkers.insert(cell).second)
|
|
|
|
|
{
|
|
|
|
|
float worldX, worldY;
|
|
|
|
|
mGlobalMapRender->cellTopLeftCornerToImageSpace (x, y, worldX, worldY);
|
|
|
|
|
|
|
|
|
|
int markerSize = 12;
|
|
|
|
|
int offset = mGlobalMapRender->getCellSize()/2 - markerSize/2;
|
|
|
|
|
MyGUI::IntCoord widgetCoord(
|
|
|
|
|
worldX * mGlobalMapRender->getWidth()+offset,
|
|
|
|
|
worldY * mGlobalMapRender->getHeight()+offset,
|
|
|
|
|
markerSize, markerSize);
|
|
|
|
|
|
|
|
|
|
MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
|
|
|
|
|
widgetCoord, MyGUI::Align::Default);
|
|
|
|
|
markerWidget->setNeedMouseFocus(true);
|
|
|
|
|
markerWidget->setColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
|
|
|
|
markerWidget->setUserString("ToolTipType", "Layout");
|
|
|
|
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
|
|
|
|
markerWidget->setUserString("Caption_TextOneLine", name);
|
|
|
|
|
markerWidget->setDepth(Global_MarkerLayer);
|
|
|
|
|
markerWidget->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
markerWidget->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::cellExplored(int x, int y)
|
|
|
|
@ -827,8 +887,6 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
while (mEventBoxGlobal->getChildCount())
|
|
|
|
|
MyGUI::Gui::getInstance().destroyWidget(mEventBoxGlobal->getChildAt(0));
|
|
|
|
|
while (mGlobalMapOverlay->getChildCount())
|
|
|
|
|
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
|
|
|
@ -853,7 +911,7 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
mGlobalMapRender->read(map);
|
|
|
|
|
|
|
|
|
|
for (std::vector<ESM::GlobalMap::CellId>::iterator it = map.mMarkers.begin(); it != map.mMarkers.end(); ++it)
|
|
|
|
|
for (std::set<ESM::GlobalMap::CellId>::iterator it = map.mMarkers.begin(); it != map.mMarkers.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Cell>().search(it->first, it->second);
|
|
|
|
|
if (cell && !cell->mName.empty())
|
|
|
|
@ -871,6 +929,19 @@ namespace MWGui
|
|
|
|
|
(*it)->setVisible(alpha == 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::customMarkerCreated(MyGUI::Widget *marker)
|
|
|
|
|
{
|
|
|
|
|
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
|
marker->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onCustomMarkerDoubleClicked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::doorMarkerCreated(MyGUI::Widget *marker)
|
|
|
|
|
{
|
|
|
|
|
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
|
|
|
|
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
EditNoteDialog::EditNoteDialog()
|
|
|
|
|