diff --git a/resources/settings.yaml b/resources/settings.yaml
index d81c77fb..402ea130 100644
--- a/resources/settings.yaml
+++ b/resources/settings.yaml
@@ -1,15 +1,16 @@
-# BOSS Settings File
+# Example Default BOSS Settings File
# This file is written in YAML .
-Language: eng # An ISO 639-3 language string.
+Language: eng # One of 'eng', 'spa', 'rus' or ''.
Game: auto # auto, or one of the 'folder' values below.
Last Game: auto # auto, or one of the 'folder' values below.
Debug Verbosity: 0 # 0, 1, 2, 3. Logging takes place if > 0.
Update Masterlist: true
View Report Externally: false
+Generate Graph Image: false
-# Games. The four archetypes are 'Oblivion', 'Skyrim', 'Fallout3' and 'FalloutNV'. They correspond to each base game's libespm and libloadorder settings.
+# Games. The four types are 'Oblivion', 'Skyrim', 'Fallout3' and 'FalloutNV'. They correspond to each base game's libespm and libloadorder settings.
Games:
- folder: Oblivion
name: "TES IV: Oblivion"
@@ -18,7 +19,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-oblivion/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\Oblivion\Installed Path
-
+
- folder: Skyrim
name: "TES V: Skyrim"
type: Skyrim
@@ -26,7 +27,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-skyrim/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\Skyrim\Installed Path
-
+
- folder: Fallout3
name: Fallout 3
type: Fallout3
@@ -42,7 +43,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-fallout-nv/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\FalloutNV\Installed Path
-
+
- folder: Nehrim
name: Nehrim - At Fate's Edge
type: Oblivion
diff --git a/src/backend/generators.h b/src/backend/generators.h
index b32abc71..46905a18 100644
--- a/src/backend/generators.h
+++ b/src/backend/generators.h
@@ -168,7 +168,7 @@ namespace boss {
node.text().set(" ");
}
- inline void AppendNav(pugi::xml_node& body) {
+ inline void AppendNav(pugi::xml_node& body, bool createGraphTab) {
pugi::xml_node nav, div;
nav = body.append_child();
@@ -187,11 +187,13 @@ namespace boss {
div.append_attribute("data-section").set_value("plugins");
div.text().set("Details");
- div = nav.append_child();
- div.set_name("div");
- div.append_attribute("class").set_value("button");
- div.append_attribute("data-section").set_value("graph");
- div.text().set("Graph");
+ if (createGraphTab) {
+ div = nav.append_child();
+ div.set_name("div");
+ div.append_attribute("class").set_value("button");
+ div.append_attribute("data-section").set_value("graph");
+ div.text().set("Graph");
+ }
div = nav.append_child();
div.set_name("div");
@@ -407,23 +409,25 @@ namespace boss {
AppendSummary(main, hasChanged, masterlistVersion, masterlistUpdateEnabled, messageNo, warnNo, errorNo, messages);
- //Append graph tag.
- pugi::xml_node graph = main.append_child();
- graph.set_name("div");
- graph.append_attribute("id").set_value("graph");
- graph.append_attribute("class").set_value("hidden");
+ if (boost::filesystem::exists(graphPath)) {
+ //Append graph tag.
+ pugi::xml_node graph = main.append_child();
+ graph.set_name("div");
+ graph.append_attribute("id").set_value("graph");
+ graph.append_attribute("class").set_value("hidden");
- pugi::xml_node img = graph.append_child();
- img.set_name("object");
- img.append_attribute("data").set_value(ToFileURL(graphPath).c_str());
- img.append_attribute("type").set_value("image/svg+xml");
+ pugi::xml_node img = graph.append_child();
+ img.set_name("object");
+ img.append_attribute("data").set_value(ToFileURL(graphPath).c_str());
+ img.append_attribute("type").set_value("image/svg+xml");
- //Also need to set image dimensions, get them from the graph file.
- std::string width, height;
- GetGraphWidthHeight(graphPath, width, height);
+ //Also need to set image dimensions, get them from the graph file.
+ std::string width, height;
+ GetGraphWidthHeight(graphPath, width, height);
- img.append_attribute("width").set_value(width.c_str());
- img.append_attribute("height").set_value(height.c_str());
+ img.append_attribute("width").set_value(width.c_str());
+ img.append_attribute("height").set_value(height.c_str());
+ }
}
inline void AppendFilters(pugi::xml_node& body, int messageNo, int pluginNo) {
@@ -538,7 +542,7 @@ namespace boss {
pugi::xml_node body = doc.append_child();
body.set_name("body");
- AppendNav(body);
+ AppendNav(body, boost::filesystem::exists(graphPath));
int messageNo=0;
AppendMain(body, oldDetails, masterlistVersion, graphPath, masterlistUpdateEnabled, messages, plugins, messageNo);
@@ -565,6 +569,7 @@ namespace boss {
root["Debug Verbosity"] = 0;
root["Update Masterlist"] = true;
root["View Report Externally"] = false;
+ root["Generate Graph Image"] = false;
games.push_back(Game(g_game_tes4));
games.push_back(Game(g_game_tes5));
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index e3819314..a036cb92 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -631,10 +631,9 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
AddNonOverlapEdges(graph, priorityMap);
AddOverlapEdges(graph, overlapMap);
-
- //Just for fun - output the graph as a ".dot" file for external rendering. If I can get this pretty, I might add it to a tab in the BOSS Report - here's a few Javascript libraries for displaying .dot files, but in my test case the graph is too complex and both libraries I found ran out of memory.
- //The .dot file can be converted to an SVG using Graphviz: the command is `dot -Tsvg output.dot -o output.svg`.
- if (fs::exists(g_path_graphvis)) {
+ //First delete any existing graph file.
+ fs::remove(_game.GraphPath());
+ if (_settings["Generate Graph Image"].as() && fs::exists(g_path_graphvis)) {
BOOST_LOG_TRIVIAL(trace) << "Outputting the graph.";
fs::path temp = fs::path(_game.GraphPath().string() + ".temp");
boss::SaveGraph(graph, temp);
diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp
index 258a9165..c7502614 100644
--- a/src/gui/settings.cpp
+++ b/src/gui/settings.cpp
@@ -57,6 +57,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
UpdateMasterlistBox = new wxCheckBox(this, wxID_ANY, translate("Update masterlist before sorting."));
reportViewBox = new wxCheckBox(this, wxID_ANY, translate("View reports externally in default browser."));
+ displayGraphImageBox = new wxCheckBox(this, wxID_ANY, translate("Generate and display plugin graph images."));
//Set up list columns.
gamesList->AppendColumn(translate("Name"));
@@ -112,6 +113,8 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
bigBox->Add(reportViewBox, wholeItem);
+ bigBox->Add(displayGraphImageBox, wholeItem);
+
bigBox->AddSpacer(10);
bigBox->AddStretchSpacer(1);
@@ -128,7 +131,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
SetDefaultValues();
//Tooltips.
- DebugVerbosityChoice->SetToolTip(translate("The output is logged to the BOSSDebugLog.txt file"));
+ DebugVerbosityChoice->SetToolTip(translate("The output is logged to the BOSSDebugLog.txt file."));
//Now set the layout and sizes.
SetBackgroundColour(wxColour(255,255,255));
@@ -171,6 +174,11 @@ void SettingsFrame::SetDefaultValues() {
reportViewBox->SetValue(view);
}
+ if (_settings["Generate Graph Image"]) {
+ bool graph = _settings["Generate Graph Image"].as();
+ displayGraphImageBox->SetValue(graph);
+ }
+
for (size_t i=0, max=_games.size(); i < max; ++i) {
gamesList->InsertItem(i, FromUTF8(_games[i].Name()));
gamesList->SetItem(i, 1, FromUTF8(boss::Game(_games[i].Id()).FolderName()));
@@ -204,6 +212,8 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
_settings["View Report Externally"] = reportViewBox->IsChecked();
+ _settings["Generate Graph Image"] = displayGraphImageBox->IsChecked();
+
for (size_t i=0,max=gamesList->GetItemCount(); i < max; ++i) {
string name, folder, master, url, path, registry;
unsigned int id;
diff --git a/src/gui/settings.h b/src/gui/settings.h
index 1aadd672..ad16fb88 100644
--- a/src/gui/settings.h
+++ b/src/gui/settings.h
@@ -33,13 +33,13 @@
class SettingsFrame : public wxDialog {
public:
SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games);
-
+
void OnQuit(wxCommandEvent& event);
void OnGameSelect(wxListEvent& event);
void OnAddGame(wxCommandEvent& event);
void OnEditGame(wxCommandEvent& event);
void OnRemoveGame(wxCommandEvent& event);
-
+
void SetDefaultValues();
private:
wxChoice *DebugVerbosityChoice;
@@ -47,6 +47,7 @@ private:
wxChoice *LanguageChoice;
wxCheckBox *UpdateMasterlistBox;
wxCheckBox *reportViewBox;
+ wxCheckBox *displayGraphImageBox;
wxListView *gamesList;
wxButton * addBtn;