Get rid of markers.png and use original MW texture, cleanup

deque
scrawl 10 years ago
parent 4f0fc79ea4
commit 97df7c9b22

@ -26,15 +26,55 @@ namespace
const int cellSize = 8192; const int cellSize = 8192;
enum WidgetDepth enum LocalMapWidgetDepth
{ {
CompassLayer = 0, Local_CompassLayer = 0,
MarkerAboveFogLayer = 1, Local_MarkerAboveFogLayer = 1,
FogLayer = 2, Local_FogLayer = 2,
MarkerLayer = 3, Local_MarkerLayer = 3,
MapLayer = 4 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 namespace MWGui
@ -140,7 +180,7 @@ namespace MWGui
mLocalMap = widget; mLocalMap = widget;
mCompass = compass; mCompass = compass;
mCompass->setDepth(CompassLayer); mCompass->setDepth(Local_CompassLayer);
mCompass->setNeedMouseFocus(false); mCompass->setNeedMouseFocus(false);
// create 3x3 map widgets, 512x512 each, holding a 1024x1024 texture each // 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::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize), MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
MyGUI::Align::Top | MyGUI::Align::Left); MyGUI::Align::Top | MyGUI::Align::Left);
map->setDepth(MapLayer); map->setDepth(Local_MapLayer);
MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize), MyGUI::IntCoord(mx*widgetSize, my*widgetSize, widgetSize, widgetSize),
MyGUI::Align::Top | MyGUI::Align::Left); MyGUI::Align::Top | MyGUI::Align::Left);
fog->setDepth(FogLayer); fog->setDepth(Local_FogLayer);
map->setNeedMouseFocus(false); map->setNeedMouseFocus(false);
fog->setNeedMouseFocus(false); fog->setNeedMouseFocus(false);
@ -273,15 +313,17 @@ namespace MWGui
MyGUI::IntCoord widgetCoord(widgetPos.left - 4, MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
widgetPos.top - 4, widgetPos.top - 4,
8, 8); 8, 8);
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage", MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
widgetCoord, MyGUI::Align::Default); widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(MarkerAboveFogLayer); markerWidget->setDepth(Local_MarkerAboveFogLayer);
markerWidget->setImageResource("DoorMarker");
markerWidget->setUserString("ToolTipType", "Layout"); markerWidget->setUserString("ToolTipType", "Layout");
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine"); markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote)); markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
markerWidget->setColour(MyGUI::Colour(1.0,0.3,0.3)); 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->setUserData(marker);
markerWidget->setNeedMouseFocus(true);
markerWidget->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &LocalMapBase::onCustomMarkerDoubleClicked); markerWidget->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &LocalMapBase::onCustomMarkerDoubleClicked);
mCustomMarkerWidgets.push_back(markerWidget); mCustomMarkerWidgets.push_back(markerWidget);
} }
@ -357,10 +399,12 @@ namespace MWGui
widgetPos.top - 4, widgetPos.top - 4,
8, 8); 8, 8);
++counter; ++counter;
MyGUI::Button* markerWidget = mLocalMap->createWidget<MyGUI::Button>("ButtonImage", MarkerWidget* markerWidget = mLocalMap->createWidget<MarkerWidget>("MarkerButton",
widgetCoord, MyGUI::Align::Default); widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(MarkerLayer); markerWidget->setNormalColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
markerWidget->setImageResource("DoorMarker"); 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("ToolTipType", "Layout");
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine"); markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
markerWidget->setUserString("Caption_TextOneLine", marker.name); markerWidget->setUserString("Caption_TextOneLine", marker.name);
@ -458,7 +502,7 @@ namespace MWGui
++counter; ++counter;
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
widgetCoord, MyGUI::Align::Default); widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(MarkerAboveFogLayer); markerWidget->setDepth(Local_MarkerAboveFogLayer);
markerWidget->setImageTexture(markerTexture); markerWidget->setImageTexture(markerTexture);
markerWidget->setUserString("IsMarker", "true"); markerWidget->setUserString("IsMarker", "true");
markerWidget->setUserData(markerPos); markerWidget->setUserData(markerPos);
@ -503,7 +547,7 @@ namespace MWGui
8, 8); 8, 8);
MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::ImageBox* markerWidget = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
widgetCoord, MyGUI::Align::Default); widgetCoord, MyGUI::Align::Default);
markerWidget->setDepth(MarkerAboveFogLayer); markerWidget->setDepth(Local_MarkerAboveFogLayer);
markerWidget->setImageTexture("textures\\menu_map_smark.dds"); markerWidget->setImageTexture("textures\\menu_map_smark.dds");
markerWidget->setUserString("IsMarker", "true"); markerWidget->setUserString("IsMarker", "true");
markerWidget->setUserData(markerPos); markerWidget->setUserData(markerPos);
@ -523,7 +567,18 @@ namespace MWGui
, mGlobalMap(0) , mGlobalMap(0)
, mGlobalMapRender(0) , mGlobalMapRender(0)
, mEditNoteDialog() , 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.setVisible(false);
mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk); mEditNoteDialog.eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditOk);
mEditNoteDialog.eventDeleteClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDelete); mEditNoteDialog.eventDeleteClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDelete);
@ -537,6 +592,11 @@ namespace MWGui
getWidget(mPlayerArrowLocal, "CompassLocal"); getWidget(mPlayerArrowLocal, "CompassLocal");
getWidget(mPlayerArrowGlobal, "CompassGlobal"); getWidget(mPlayerArrowGlobal, "CompassGlobal");
mPlayerArrowGlobal->setDepth(Global_CompassLayer);
mPlayerArrowGlobal->setNeedMouseFocus(false);
mGlobalMapImage->setDepth(Global_MapLayer);
mGlobalMapOverlay->setDepth(Global_ExploreOverlayLayer);
mLastScrollWindowCoordinates = mLocalMap->getCoord(); mLastScrollWindowCoordinates = mLocalMap->getCoord();
mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord); mLocalMap->eventChangeCoord += MyGUI::newDelegate(this, &MapWindow::onChangeScrollWindowCoord);
@ -549,6 +609,8 @@ namespace MWGui
getWidget(mEventBoxGlobal, "EventBoxGlobal"); getWidget(mEventBoxGlobal, "EventBoxGlobal");
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart); mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
mEventBoxGlobal->setDepth(Global_ExploreOverlayLayer);
getWidget(mEventBoxLocal, "EventBoxLocal"); getWidget(mEventBoxLocal, "EventBoxLocal");
mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart); mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
@ -683,21 +745,16 @@ namespace MWGui
markerSize, markerSize); markerSize, markerSize);
static int _counter=0; static int _counter=0;
MyGUI::Button* markerWidget = mGlobalMapOverlay->createWidget<MyGUI::Button>("ButtonImage", MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
widgetCoord, MyGUI::Align::Default); widgetCoord, MyGUI::Align::Default);
markerWidget->setImageResource("DoorMarker"); markerWidget->setNeedMouseFocus(true);
markerWidget->setColour(MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
markerWidget->setUserString("ToolTipType", "Layout"); markerWidget->setUserString("ToolTipType", "Layout");
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine"); markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
markerWidget->setUserString("Caption_TextOneLine", name); markerWidget->setUserString("Caption_TextOneLine", name);
markerWidget->setDepth(Global_MarkerLayer);
++_counter; ++_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; CellId cell;
cell.first = x; cell.first = x;
cell.second = y; cell.second = y;
@ -829,8 +886,6 @@ namespace MWGui
while (mEventBoxGlobal->getChildCount()) while (mEventBoxGlobal->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mEventBoxGlobal->getChildAt(0)); 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) void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)

@ -84,7 +84,6 @@ set(MYGUI_FILES
openmw_screen_fader.layout openmw_screen_fader.layout
openmw_edit_note.layout openmw_edit_note.layout
DejaVuLGCSansMono.ttf DejaVuLGCSansMono.ttf
markers.png
../launcher/images/openmw.png ../launcher/images/openmw.png
OpenMWResourcePlugin.xml OpenMWResourcePlugin.xml
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

@ -25,36 +25,10 @@
</Group> </Group>
</Resource> </Resource>
<Resource type="ResourceImageSet" name="DoorMarker"> <Resource type="ResourceSkin" name="MarkerButton" size="8 8" texture="textures\door_icon.dds">
<Group name="States" texture="markers.png" size="8 8"> <BasisSkin type="MainSkin" offset="0 0 8 8" align="Stretch">
<Index name="disabled"> <State name="normal" offset="0 0 8 8"/>
<Frame point="8 0"/> </BasisSkin>
</Index>
<Index name="normal">
<Frame point="8 0"/>
</Index>
<Index name="highlighted">
<Frame point="0 0"/>
</Index>
<Index name="pushed">
<Frame point="0 0"/>
</Index>
</Group>
</Resource>
<!-- Skins -->
<Resource type="ResourceLayout" name="ButtonImage" version="3.2.0">
<Widget type="Widget" skin="Default" position="20 20 16 16" name="Root">
<Property key="TextAlign" value="Center"/>
<Property key="FontName" value="Default"/>
<Property key="ModeImage" value="true"/>
<Widget type="ImageBox" skin="ImageBox" position="0 0 16 16" align="Stretch" name="Image">
<Property key="NeedMouse" value="false"/>
</Widget>
</Widget>
</Resource> </Resource>
<Resource type="ResourceLayout" name="TabControl" version="3.2.0"> <Resource type="ResourceLayout" name="TabControl" version="3.2.0">

Loading…
Cancel
Save