|
From: <cn...@us...> - 2024-08-21 19:58:25
|
Revision: 1523
http://sourceforge.net/p/seq/svn/1523
Author: cn187
Date: 2024-08-21 19:58:23 +0000 (Wed, 21 Aug 2024)
Log Message:
-----------
Allow user to configure map line/location colors
Modified Paths:
--------------
showeq/trunk/src/Makefile.am
showeq/trunk/src/interface.cpp
showeq/trunk/src/interface.h
showeq/trunk/src/map.cpp
showeq/trunk/src/map.h
showeq/trunk/src/mapcore.cpp
showeq/trunk/src/mapcore.h
Added Paths:
-----------
showeq/trunk/src/mapcolors.h
Modified: showeq/trunk/src/Makefile.am
===================================================================
--- showeq/trunk/src/Makefile.am 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/Makefile.am 2024-08-21 19:58:23 UTC (rev 1523)
@@ -113,7 +113,7 @@
EXTRA_DIST = h2info.pl
-noinst_HEADERS = classes.h compass.h everquest.h interface.h main.h map.h filter.h vpacket.h editor.h packet.h packetcapture.h packetcommon.h packetformat.h packetstream.h packetfragment.h packetinfo.h races.h skills.h spells.h util.h experiencelog.h combatlog.h spawn.h spawnshell.h spawnlist.h spellshell.h spelllist.h languages.h weapons.h weapons1.h weapons27.h weapons28.h weapons29.h weapons2a.h weapons2b.h weapons2c.h weapons2d.h weapons2e.h weapons2f.h weapons30.h weapons4e.h decode.h cgiconv.h skilllist.h statlist.h deity.h player.h crctab.h filtermgr.h point.h pointarray.h mapcore.h category.h compassframe.h group.h guild.h fixpt.h netdiag.h zones.h logger.h xmlconv.h xmlpreferences.h seqwindow.h seqlistview.h zonemgr.h spawnmonitor.h spawnpointlist.h typenames.h spawnlistcommon.h spawnlist2.h datetimemgr.h spawnlog.h packetlog.h datalocationmgr.h eqstr.h messages.h messagefilter.h messagewindow.h messageshell.h terminal.h filteredspawnlog.h messagefilterdialog.h diagnosticmessages.h mapicon.h mapicondialog.h mapicondialog.ui filternotifications.h netstream.h guildshell.h guildlist.h bazaarlog.h message.h s_everquest.h staticspells.h packetcaptureprovider.h
+noinst_HEADERS = classes.h compass.h everquest.h interface.h main.h map.h filter.h vpacket.h editor.h packet.h packetcapture.h packetcommon.h packetformat.h packetstream.h packetfragment.h packetinfo.h races.h skills.h spells.h util.h experiencelog.h combatlog.h spawn.h spawnshell.h spawnlist.h spellshell.h spelllist.h languages.h weapons.h weapons1.h weapons27.h weapons28.h weapons29.h weapons2a.h weapons2b.h weapons2c.h weapons2d.h weapons2e.h weapons2f.h weapons30.h weapons4e.h decode.h cgiconv.h skilllist.h statlist.h deity.h player.h crctab.h filtermgr.h point.h pointarray.h mapcore.h category.h compassframe.h group.h guild.h fixpt.h netdiag.h zones.h logger.h xmlconv.h xmlpreferences.h seqwindow.h seqlistview.h zonemgr.h spawnmonitor.h spawnpointlist.h typenames.h spawnlistcommon.h spawnlist2.h datetimemgr.h spawnlog.h packetlog.h datalocationmgr.h eqstr.h messages.h messagefilter.h messagewindow.h messageshell.h terminal.h filteredspawnlog.h messagefilterdialog.h diagnosticmessages.h mapicon.h mapicondialog.h mapicondialog.ui filternotifications.h netstream.h guildshell.h guildlist.h bazaarlog.h message.h s_everquest.h staticspells.h packetcaptureprovider.h mapcolors.h
CLEANFILES = $(nodist_showeq_SOURCES)
Modified: showeq/trunk/src/interface.cpp
===================================================================
--- showeq/trunk/src/interface.cpp 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/interface.cpp 2024-08-21 19:58:23 UTC (rev 1523)
@@ -149,7 +149,8 @@
m_netDiag(0),
m_messageFilterDialog(0),
m_guildListWindow(0),
- m_deviceList(enumerateNetworkDevices())
+ m_deviceList(enumerateNetworkDevices()),
+ m_mapColorDialog(new MapColorDialog())
{
setObjectName(name);
setWindowFlags(Qt::Window);
@@ -1156,6 +1157,8 @@
pOptMenu->addMenu(conColorBaseMenu);
+ pOptMenu->addAction("Map Colors...", this, SLOT(select_opt_mapColors()));
+
m_action_opt_UseUpdateRadius = pOptMenu->addAction("Use EQ's Update Radius",
this, SLOT(toggle_opt_UseUpdateRadius()));
m_action_opt_UseUpdateRadius->setCheckable(true);
@@ -4624,6 +4627,11 @@
}
}
+void EQInterface::select_opt_mapColors()
+{
+ m_mapColorDialog->show();
+}
+
void EQInterface::setExp(uint32_t totalExp, uint32_t totalTick,
uint32_t minExpLevel, uint32_t maxExpLevel,
uint32_t tickExpLevel)
Modified: showeq/trunk/src/interface.h
===================================================================
--- showeq/trunk/src/interface.h 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/interface.h 2024-08-21 19:58:23 UTC (rev 1523)
@@ -43,6 +43,7 @@
#include "packetlog.h"
#include "message.h"
#include "messagefilter.h"
+#include "map.h"
//--------------------------------------------------
// forward declarations
@@ -264,6 +265,7 @@
void toggle_opt_RetardedCoords(bool enable);
void toggle_opt_SystimeSpawntime(bool enable);
void select_opt_conColorBase(QAction* con);
+ void select_opt_mapColors();
void toggle_view_SpawnList();
void toggle_view_SpawnList2();
void toggle_view_SpawnPointList();
@@ -501,6 +503,8 @@
QStringList m_StringList;
QDialog *dialogbox;
+ MapColorDialog* m_mapColorDialog;
+
bool m_isSkillListDocked;
bool m_isStatListDocked;
bool m_isMapDocked[maxNumMaps];
Modified: showeq/trunk/src/map.cpp
===================================================================
--- showeq/trunk/src/map.cpp 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/map.cpp 2024-08-21 19:58:23 UTC (rev 1523)
@@ -67,6 +67,8 @@
#include <QImageWriter>
#include <QMenu>
#include <QWidgetAction>
+#include <QGridLayout>
+#include <QCommonStyle>
#if 1 // ZBTEMP: Until we setup a better way to enter location name/color
#include <QInputDialog>
@@ -5614,7 +5616,127 @@
}
}
+MapColorDialog::MapColorDialog(QWidget* parent) : QDialog(parent)
+{
+ #define X(a,b) m_color_base_table[b] = a;
+ SEQMAP_COLOR_TABLE
+ #undef X
+ setWindowTitle("Map Colors");
+
+ loadUserColors();
+
+ QVBoxLayout* vbox = new QVBoxLayout(this);
+
+ QGridLayout* gridLayout = new QGridLayout();
+ vbox->addLayout(gridLayout);
+
+ int col = 0;
+ int row = 0;
+ for (int i = 0; i < SEQMAP_NUM_COLORS; ++i)
+ {
+ row = floor(i / 8);
+ col = i % 8;
+
+ m_color_pb[i] = new QPushButton(QString::number(i), this);
+ m_color_pb[i]->setStyle(new QCommonStyle());
+ m_color_pb[i]->setPalette(QPalette(QColor(m_color_user_table[i])));
+ m_color_pb[i]->setProperty("colorIndex", i);
+ connect(m_color_pb[i], SIGNAL(clicked()), this, SLOT(selectColor()));
+
+ gridLayout->addWidget(m_color_pb[i], row, col);
+ }
+
+ QHBoxLayout* hbox = new QHBoxLayout();
+ vbox->addItem(new QSpacerItem(20, 25));
+ vbox->addLayout(hbox);
+
+ QPushButton* resetButton = new QPushButton("Reset");
+ resetButton->setDefault(false);
+ resetButton->setAutoDefault(false);
+ hbox->addWidget(resetButton);
+ connect(resetButton, SIGNAL(clicked()), this, SLOT(resetDialog()));
+
+ QPushButton* defaultsButton = new QPushButton("Load Defaults");
+ defaultsButton->setDefault(false);
+ defaultsButton->setAutoDefault(false);
+ hbox->addWidget(defaultsButton);
+ connect(defaultsButton, SIGNAL(clicked()), this, SLOT(loadDefaults()));
+
+ hbox->addItem(new QSpacerItem(20, 1));
+
+ QPushButton* okButton = new QPushButton("Ok");
+ okButton->setDefault(false);
+ okButton->setAutoDefault(false);
+ hbox->addWidget(okButton);
+ connect(okButton, SIGNAL(clicked()), this, SLOT(acceptDialog()));
+
+ QPushButton* cancelButton = new QPushButton("Cancel");
+ okButton->setDefault(false);
+ okButton->setAutoDefault(false);
+ hbox->addWidget(cancelButton);
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+
+ setLayout(vbox);
+
+ resetDialog();
+}
+
+MapColorDialog::~MapColorDialog()
+{ }
+
+void MapColorDialog::resetDialog()
+{
+ loadUserColors();
+ for (int i=0; i<SEQMAP_NUM_COLORS; ++i)
+ m_color_pb[i]->setPalette(QPalette(QColor(m_color_user_table[i])));
+}
+
+void MapColorDialog::acceptDialog()
+{
+ updateUserColors();
+ done(QDialog::Accepted);
+}
+
+void MapColorDialog::loadDefaults()
+{
+ for (int i=0; i<SEQMAP_NUM_COLORS; ++i)
+ {
+ m_color_user_table[i] = m_color_base_table[i];
+ m_color_pb[i]->setPalette(QPalette(QColor(m_color_base_table[i])));
+ }
+}
+
+void MapColorDialog::loadUserColors()
+{
+ for (int i=0; i<SEQMAP_NUM_COLORS; ++i)
+ m_color_user_table[i] = pSEQPrefs->getPrefString("MapColor" + QString::number(i),
+ "MapColors", m_color_base_table[i]);
+}
+
+void MapColorDialog::updateUserColors()
+{
+ for (int i=0; i<SEQMAP_NUM_COLORS; ++i)
+ pSEQPrefs->setPrefString("MapColor" + QString::number(i), "MapColors", m_color_user_table[i]);
+}
+
+
+
+void MapColorDialog::selectColor()
+{
+ QPushButton* pb = qobject_cast<QPushButton*>(sender());
+ if (!pb) return;
+
+ QColor newColor = QColorDialog::getColor(pb->palette().color(backgroundRole()), this);
+ if (newColor.isValid())
+ {
+ int i = pb->property("colorIndex").toInt();
+ m_color_user_table[i] = newColor.name();
+ pb->setPalette(QPalette(QColor(m_color_user_table[i])));
+ }
+
+}
+
#ifndef QMAKEBUILD
#include "map.moc"
#endif
Modified: showeq/trunk/src/map.h
===================================================================
--- showeq/trunk/src/map.h 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/map.h 2024-08-21 19:58:23 UTC (rev 1523)
@@ -44,6 +44,7 @@
#include <QDateTime>
#include <QPen>
#include <QBrush>
+#include <QPushButton>
// includes required for MapMenu
#include <QMenu>
@@ -69,6 +70,7 @@
#include "seqwindow.h"
#include "spawn.h"
#include "mapicon.h"
+#include "mapcolors.h"
//----------------------------------------------------------------------
// forward declarations
@@ -105,6 +107,8 @@
tFOVClassic = 2
};
+
+
//----------------------------------------------------------------------
// constants
const int maxFrameTimes = 40;
@@ -790,5 +794,29 @@
QAction* m_action_bottomControl_Options;
};
+class MapColorDialog : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ MapColorDialog(QWidget* parent=0);
+ ~MapColorDialog();
+
+ private slots:
+ void selectColor();
+ void resetDialog();
+ void acceptDialog();
+ void loadDefaults();
+
+ private:
+ void loadUserColors();
+ void updateUserColors();
+
+ QString m_color_base_table[SEQMAP_NUM_COLORS];
+ QString m_color_user_table[SEQMAP_NUM_COLORS];
+ QPushButton* m_color_pb[SEQMAP_NUM_COLORS];
+
+};
+
#endif // _EQMAP_H_
Added: showeq/trunk/src/mapcolors.h
===================================================================
--- showeq/trunk/src/mapcolors.h (rev 0)
+++ showeq/trunk/src/mapcolors.h 2024-08-21 19:58:23 UTC (rev 1523)
@@ -0,0 +1,95 @@
+/*
+ * mapcolors.h
+ * Copyright 2024 by the respective ShowEQ Developers
+ *
+ * This file is part of ShowEQ.
+ * http://www.sourceforge.net/projects/seq
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+//colors used in SEQ maps, and after converting SOE maps.
+#ifndef SEQMAP_COLORS_H
+#define SEQMAP_COLORS_H
+
+#define SEQMAP_NUM_COLORS 64
+
+#define SEQMAP_COLOR_TABLE\
+ X("Black", 0) \
+ X("DarkRed", 1) \
+ X("FireBrick", 2) \
+ X("Red", 3) \
+ X("DarkGreen", 4) \
+ X("Orange", 5) \
+ X("DarkOrange", 6) \
+ X("DarkOrange", 7) \
+ X("Green", 8) \
+ X("Chartreuse", 9) \
+ X("Gold", 10) \
+ X("Gold", 11) \
+ X("Green", 12) \
+ X("Chartreuse", 13) \
+ X("Goldenrod", 14) \
+ X("Yellow", 15) \
+ X("DarkBlue", 16) \
+ X("Magenta", 17) \
+ X("DeepPink", 18) \
+ X("DeepPink", 19) \
+ X("DarkCyan", 20) \
+ X("Grey", 21) \
+ X("IndianRed", 22) \
+ X("LightCoral", 23) \
+ X("SpringGreen", 24) \
+ X("LightGreen", 25) \
+ X("DarkKhaki", 26) \
+ X("Khaki", 27) \
+ X("SpringGreen", 28) \
+ X("PaleGreen", 29) \
+ X("DarkOliveGreen",30) \
+ X("Khaki", 31) \
+ X("MediumBlue", 32) \
+ X("DarkViolet", 33) \
+ X("Magenta", 34) \
+ X("Maroon", 35) \
+ X("RoyalBlue", 36) \
+ X("SlateBlue", 37) \
+ X("Orchid", 38) \
+ X("HotPink", 39) \
+ X("Turquoise", 40) \
+ X("SkyBlue", 41) \
+ X("Snow", 42) \
+ X("LightPink", 43) \
+ X("Cyan", 44) \
+ X("Aquamarine", 45) \
+ X("DarkSeaGreen", 46) \
+ X("Beige", 47) \
+ X("Blue", 48) \
+ X("Purple", 49) \
+ X("Purple", 50) \
+ X("Magenta", 51) \
+ X("DodgerBlue", 52) \
+ X("SlateBlue", 53) \
+ X("MediumPurple", 54) \
+ X("Orchid", 55) \
+ X("DeepSkyBlue", 56) \
+ X("LightBlue", 57) \
+ X("Plum", 58) \
+ X("Cyan", 59) \
+ X("CadetBlue", 60) \
+ X("PaleTurquoise", 61) \
+ X("LightCyan", 62) \
+ X("White", 63)
+
+#endif
Modified: showeq/trunk/src/mapcore.cpp
===================================================================
--- showeq/trunk/src/mapcore.cpp 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/mapcore.cpp 2024-08-21 19:58:23 UTC (rev 1523)
@@ -47,7 +47,10 @@
#include <QPolygon>
#include <QByteArray>
#include <QPixmap>
+#include "xmlpreferences.h"
+extern XMLPreferences* pSEQPrefs;
+
//----------------------------------------------------------------------
// MapParameters
MapParameters::MapParameters(const MapData& mapData)
@@ -1080,7 +1083,10 @@
// create an M line (start with 2 points because of SOE's lame
// format).
- currentLineM = new MapLineM("soe", getMapConvertColor(r, g, b), 2);
+ unsigned short map_color_index = getMapConvertColorIndex(r, g, b);
+ QColor lineColor = pSEQPrefs->getPrefString("MapColor" + QString::number(map_color_index),
+ "MapColors", getMapConvertColor(r, g, b));
+ currentLineM = new MapLineM("soe", lineColor, 2);
currentLineM->setOrigColor(QColor(r, g, b));
// set the first point
@@ -1142,8 +1148,10 @@
name.replace("_", " ");
// add it to the list of locations
- MapLocation* loc = new MapLocation(name, getMapConvertColor(r, g, b),
- x1, y1, z1);
+ unsigned short map_color_index = getMapConvertColorIndex(r, g, b);
+ QColor lineColor = pSEQPrefs->getPrefString("MapColor" + QString::number(map_color_index),
+ "MapColors", getMapConvertColor(r, g, b));
+ MapLocation* loc = new MapLocation(name, lineColor, x1, y1, z1);
loc->setOrigColor(QColor(r, g, b));
layer->locations().append(loc);
Modified: showeq/trunk/src/mapcore.h
===================================================================
--- showeq/trunk/src/mapcore.h 2024-08-21 19:58:12 UTC (rev 1522)
+++ showeq/trunk/src/mapcore.h 2024-08-21 19:58:23 UTC (rev 1523)
@@ -48,6 +48,7 @@
#include <QList>
#include <QPolygon>
+#include "mapcolors.h"
#include "point.h"
#include "pointarray.h"
#include "fixpt.h"
@@ -732,6 +733,16 @@
(z >= floorRoom));
}
+inline unsigned short getMapConvertColorIndex(const unsigned short r, const unsigned short g,
+ const unsigned short b)
+{
+ unsigned short index = floor(r/80) + floor(g/80)*4 + floor(b/80)*16;
+ if (index == 0)
+ return 63;
+ else
+ return index;
+}
+
inline QString getMapConvertColor(const unsigned short r, const unsigned short g,
const unsigned short b)
{
@@ -739,70 +750,9 @@
//This adjusts the SOE map colors to colors that work for SEQs default color scheme
QString sColor[64] = {
- "Black", //0
- "DarkRed", //1
- "FireBrick", //2
- "Red", //3
- "DarkGreen", //4
- "Orange", //5
- "DarkOrange", //6
- "DarkOrange", //7
- "Green", //8
- "Chartreuse", //9
- "Gold", //10
- "Gold", //11
- "Green", //12
- "Chartreuse", //13
- "Goldenrod", //14
- "Yellow", //15
- "DarkBlue", //16
- "Magenta", //17
- "DeepPink", //18
- "DeepPink", //19
- "DarkCyan", //20
- "Grey", //21
- "IndianRed", //22
- "LightCoral", //23
- "SpringGreen", //24
- "LightGreen", //25
- "DarkKhaki", //26
- "Khaki", //27
- "SpringGreen", //28
- "PaleGreen", //29
- "DarkOliveGreen",//30
- "Khaki", //31
- "MediumBlue", //32
- "DarkViolet", //33
- "Magenta", //34
- "Maroon", //35
- "RoyalBlue", //36
- "SlateBlue", //37
- "Orchid", //38
- "HotPink", //39
- "Turquoise", //40
- "SkyBlue", //41
- "Snow", //42
- "LightPink", //43
- "Cyan", //44
- "Aquamarine", //45
- "DarkSeaGreen", //46
- "Beige", //47
- "Blue", //48
- "Purple", //49
- "Purple", //50
- "Magenta", //51
- "DodgerBlue", //52
- "SlateBlue", //53
- "MediumPurple", //54
- "Orchid", //55
- "DeepSkyBlue", //56
- "LightBlue", //57
- "Plum", //58
- "Cyan", //59
- "CadetBlue", //60
- "PaleTurquoise",//61
- "LightCyan", //62
- "White" //63
+ #define X(a,b) a,
+ SEQMAP_COLOR_TABLE
+ #undef X
};
unsigned short color = floor(r/80) + floor(g/80)*4 + floor(b/80)*16;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|