mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Removed old UI code.
This commit is contained in:
-1267
File diff suppressed because it is too large
Load Diff
@@ -1,161 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __LOOT_GUI_EDITOR__
|
||||
#define __LOOT_GUI_EDITOR__
|
||||
|
||||
#include "ids.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include "../backend/metadata.h"
|
||||
#include "../backend/game.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <yaml-cpp/yaml.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/tglbtn.h>
|
||||
#include <wx/dnd.h>
|
||||
|
||||
/* Have two versions of the editor: one mini editor that only contains
|
||||
controls for editing the load order related metadata, and a full editor
|
||||
that contains controls for editing all the metadata.
|
||||
|
||||
Both editors need to convert between metadata and control data, and to
|
||||
keep track of what edits have been made.
|
||||
|
||||
Have a immutable plugin list to keep track of non-user-edit metadata,
|
||||
and a mutable plugin list to keep track of user-edit metadata. When
|
||||
recording edits, diff the metadata obtained from the control values with
|
||||
the metadata in the immutable plugin entry to get the new user-edit metadata.
|
||||
|
||||
If a metadata type's corresponding control is not present (ie. in the mini
|
||||
editor), then use the immutable plugin entry's metadata for that type.
|
||||
*/
|
||||
|
||||
class TextDropTarget : public wxTextDropTarget { //Class to override virtual functions.
|
||||
public:
|
||||
TextDropTarget(wxListView * owner, wxControl * name);
|
||||
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString &data);
|
||||
private:
|
||||
wxListView * targetOwner;
|
||||
wxControl * targetName;
|
||||
};
|
||||
|
||||
class EditorPanel : public wxPanel {
|
||||
public:
|
||||
EditorPanel(wxWindow *parent, const std::list<loot::Plugin>& basePlugins, std::list<loot::Plugin>& editedPlugins, const unsigned int language, const loot::Game& game);
|
||||
|
||||
void SetSimpleView(bool on = true);
|
||||
void ApplyCurrentEdits();
|
||||
|
||||
loot::MetadataList GetNewUserlist() const;
|
||||
|
||||
void OnPluginSelect(wxListEvent& event);
|
||||
void OnPluginListRightClick(wxListEvent& event);
|
||||
void OnPluginCopyName(wxCommandEvent& event);
|
||||
void OnPluginCopyMetadata(wxCommandEvent& event);
|
||||
void OnPluginClearMetadata(wxCommandEvent& event);
|
||||
void OnClearAllMetadata(wxCommandEvent& event);
|
||||
void OnListBookChange(wxBookCtrlEvent& event);
|
||||
void OnAddRow(wxCommandEvent& event);
|
||||
void OnEditRow(wxCommandEvent& event);
|
||||
void OnRemoveRow(wxCommandEvent& event);
|
||||
void OnRowSelect(wxListEvent& event);
|
||||
void OnFilterToggle(wxCommandEvent& event);
|
||||
void OnDragStart(wxListEvent& event);
|
||||
private:
|
||||
wxMenu * pluginMenu;
|
||||
wxButton * addBtn;
|
||||
wxButton * editBtn;
|
||||
wxButton * removeBtn;
|
||||
wxListView * pluginList;
|
||||
wxListView * reqsList;
|
||||
wxListView * incsList;
|
||||
wxListView * loadAfterList;
|
||||
MessageList * messageList;
|
||||
wxListView * tagsList;
|
||||
wxListView * dirtyList;
|
||||
wxNotebook * listBook;
|
||||
wxCheckBox * priorityCheckbox;
|
||||
wxSpinCtrl * prioritySpin;
|
||||
wxCheckBox * pluginCheckbox;
|
||||
wxCheckBox * filterCheckbox;
|
||||
|
||||
wxPanel * reqsTab;
|
||||
wxPanel * incsTab;
|
||||
wxPanel * loadAfterTab;
|
||||
wxPanel * messagesTab;
|
||||
wxPanel * tagsTab;
|
||||
wxPanel * dirtyTab;
|
||||
|
||||
void AddPluginToList(const loot::Plugin& plugin, int position);
|
||||
protected:
|
||||
const loot::Game& _game;
|
||||
const std::list<loot::Plugin> _basePlugins;
|
||||
std::list<loot::Plugin> _editedPlugins;
|
||||
|
||||
loot::Plugin GetMasterData(const wxString& plugin) const;
|
||||
loot::Plugin GetUserData(const wxString& plugin) const;
|
||||
loot::Plugin GetNewData(const wxString& plugin) const;
|
||||
|
||||
void ApplyEdits(const wxString& plugin);
|
||||
long FindPlugin(const wxString& plugin);
|
||||
|
||||
loot::File RowToFile(wxListView * list, long row) const;
|
||||
loot::Tag RowToTag(wxListView * list, long row) const;
|
||||
loot::PluginDirtyInfo RowToPluginDirtyInfo(wxListView * list, long row) const;
|
||||
};
|
||||
|
||||
class MiniEditor : public wxDialog {
|
||||
public:
|
||||
MiniEditor(wxWindow *parent, const wxString& title, wxPoint pos, wxSize size, const std::list<loot::Plugin>& basePlugins, std::list<loot::Plugin>& editedPlugins, const loot::Game& game);
|
||||
|
||||
void OnApply(wxCommandEvent& event);
|
||||
void OnResize(wxSizeEvent& event);
|
||||
|
||||
loot::MetadataList GetNewUserlist() const;
|
||||
private:
|
||||
EditorPanel * editorPanel;
|
||||
wxStaticText * descText;
|
||||
|
||||
wxString feedbackText;
|
||||
};
|
||||
|
||||
class FullEditor : public wxFrame {
|
||||
public:
|
||||
FullEditor(wxWindow *parent, const wxString& title, wxPoint pos, wxSize size, const boost::filesystem::path& userlistPath, const std::list<loot::Plugin>& basePlugins, std::list<loot::Plugin>& editedPlugins, const unsigned int language, const loot::Game& game, YAML::Node &settings);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent &event);
|
||||
private:
|
||||
EditorPanel * editorPanel;
|
||||
wxButton * applyBtn;
|
||||
wxButton * cancelBtn;
|
||||
|
||||
const boost::filesystem::path _userlistPath;
|
||||
YAML::Node& _settings;
|
||||
};
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ids.h"
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
|
||||
wxString translate(const std::string& str) {
|
||||
return wxString::FromUTF8(boost::locale::translate(str).str().c_str());
|
||||
}
|
||||
|
||||
wxString FromUTF8(const std::string& str) {
|
||||
return wxString::FromUTF8(str.c_str());
|
||||
}
|
||||
|
||||
wxString FromUTF8(const boost::format& f) {
|
||||
return FromUTF8(f.str());
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LOOT_GUI_IDS__
|
||||
#define __LOOT_GUI_IDS__
|
||||
|
||||
#include <string>
|
||||
#include <boost/format.hpp>
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
# include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
//Main window.
|
||||
OPTION_EditMetadata = wxID_HIGHEST + 1, // declares an id which will be used to call our button
|
||||
OPTION_ViewLastReport,
|
||||
OPTION_SortPlugins,
|
||||
MENU_ViewDebugLog,
|
||||
MENU_ShowSettings,
|
||||
MENU_RedatePlugins,
|
||||
//Settings window.
|
||||
LIST_Games,
|
||||
BUTTON_AddGame,
|
||||
BUTTON_EditGame,
|
||||
BUTTON_RemoveGame,
|
||||
//Editor window.
|
||||
LIST_Plugins,
|
||||
LIST_Reqs,
|
||||
LIST_Incs,
|
||||
LIST_LoadAfter,
|
||||
LIST_Messages,
|
||||
LIST_BashTags,
|
||||
LIST_DirtyInfo,
|
||||
LIST_MessageContent,
|
||||
BUTTON_AddRow,
|
||||
BUTTON_EditRow,
|
||||
BUTTON_RemoveRow,
|
||||
BUTTON_AddContent,
|
||||
BUTTON_EditContent,
|
||||
BUTTON_RemoveContent,
|
||||
BUTTON_Apply,
|
||||
BUTTON_Cancel,
|
||||
BOOK_Lists,
|
||||
MENU_CopyName,
|
||||
MENU_CopyMetadata,
|
||||
MENU_ClearPluginMetadata,
|
||||
MENU_ClearAllMetadata,
|
||||
CHECKBOX_Filter,
|
||||
//Main window - dynamically created IDs.
|
||||
MENU_LowestDynamicGameID,
|
||||
};
|
||||
|
||||
wxString translate(const std::string& str);
|
||||
|
||||
wxString FromUTF8(const std::string& str);
|
||||
|
||||
wxString FromUTF8(const boost::format& f);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,75 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LOOT_GUI_MAIN__
|
||||
#define __LOOT_GUI_MAIN__
|
||||
|
||||
#include "ids.h"
|
||||
#include "../backend/game.h"
|
||||
|
||||
#include <vector>
|
||||
#include <yaml-cpp/yaml.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
//Program class.
|
||||
class LOOT : public wxApp {
|
||||
public:
|
||||
bool OnInit(); //Load settings, apply logging and language settings, check if LOOT is already running, detect games, set game to last game or to first detected game if auto, create launcher window.
|
||||
private:
|
||||
wxLocale * wxLoc;
|
||||
|
||||
YAML::Node _settings;
|
||||
std::vector<loot::Game> _games;
|
||||
};
|
||||
|
||||
class Launcher : public wxFrame {
|
||||
public:
|
||||
Launcher(const wxChar *title, YAML::Node& settings, std::vector<loot::Game>& games, size_t currentGame, wxPoint pos, wxSize size);
|
||||
|
||||
void OnSortPlugins(wxCommandEvent& event);
|
||||
void OnEditMetadata(wxCommandEvent& event);
|
||||
void OnViewLastReport(wxCommandEvent& event);
|
||||
void OnRedatePlugins(wxCommandEvent& event);
|
||||
|
||||
void OnOpenSettings(wxCommandEvent& event);
|
||||
void OnOpenDebugLog(wxCommandEvent& event);
|
||||
void OnGameChange(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
private:
|
||||
wxMenu * GameMenu;
|
||||
wxMenuItem * RedatePluginsItem;
|
||||
wxButton * ViewButton;
|
||||
|
||||
YAML::Node& _settings; //LOOT Settings.
|
||||
std::vector<loot::Game>& _games;
|
||||
size_t _currentGame;
|
||||
|
||||
void GetWindowSizePos(const YAML::Node& node, wxPoint& pos, wxSize& size);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,481 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "misc.h"
|
||||
#include "../backend/helpers.h"
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
MessageList::MessageList(wxWindow * parent, wxWindowID id, const unsigned int language) : wxListView(parent, id, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL), _language(language) {
|
||||
InsertColumn(0, translate("Type"));
|
||||
InsertColumn(1, translate("Content"));
|
||||
InsertColumn(2, translate("Condition"));
|
||||
InsertColumn(3, translate("Language"));
|
||||
|
||||
Bind(wxEVT_LIST_DELETE_ITEM, &MessageList::OnDeleteItem, this);
|
||||
|
||||
SetItemCount(0);
|
||||
}
|
||||
|
||||
std::vector<loot::Message> MessageList::GetItems() const {
|
||||
return _messages;
|
||||
}
|
||||
|
||||
void MessageList::SetItems(const std::vector<loot::Message>& messages) {
|
||||
_messages = messages;
|
||||
SetItemCount(_messages.size());
|
||||
RefreshItems(0, _messages.size() - 1);
|
||||
}
|
||||
|
||||
loot::Message MessageList::GetItem(long item) const {
|
||||
return _messages[item];
|
||||
}
|
||||
|
||||
void MessageList::SetItem(long item, const loot::Message& message) {
|
||||
_messages[item] = message;
|
||||
RefreshItem(item);
|
||||
}
|
||||
|
||||
void MessageList::AppendItem(const loot::Message& message) {
|
||||
_messages.push_back(message);
|
||||
SetItemCount(_messages.size());
|
||||
RefreshItem(_messages.size() - 1);
|
||||
}
|
||||
|
||||
void MessageList::OnDeleteItem(wxListEvent& event) {
|
||||
_messages.erase(_messages.begin() + event.GetIndex());
|
||||
SetItemCount(_messages.size());
|
||||
RefreshItems(event.GetIndex(), _messages.size() - 1);
|
||||
}
|
||||
|
||||
wxString MessageList::OnGetItemText(long item, long column) const {
|
||||
if (column < 0 || column > 3 || item < 0 || item > _messages.size() - 1)
|
||||
return wxString();
|
||||
|
||||
if (column == 0) {
|
||||
if (_messages[item].Type() == loot::Message::say)
|
||||
return Type[0];
|
||||
else if (_messages[item].Type() == loot::Message::warn)
|
||||
return Type[1];
|
||||
else
|
||||
return Type[2];
|
||||
}
|
||||
else if (column == 1) {
|
||||
return FromUTF8(_messages[item].ChooseContent(_language).Str());
|
||||
}
|
||||
else if (column == 2) {
|
||||
return FromUTF8(_messages[item].Condition());
|
||||
}
|
||||
else {
|
||||
return FromUTF8(loot::Language(_messages[item].ChooseContent(_language).Language()).Name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileEditDialog::FileEditDialog(wxWindow *parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
_name = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_EMPTY));
|
||||
_display = new wxTextCtrl(this, wxID_ANY);
|
||||
_condition = new wxTextCtrl(this, wxID_ANY);
|
||||
|
||||
wxSizerFlags leftItem(0);
|
||||
leftItem.Left();
|
||||
|
||||
wxSizerFlags rightItem(1);
|
||||
rightItem.Right().Expand();
|
||||
|
||||
wxBoxSizer * bigBox = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxFlexGridSizer * GridSizer = new wxFlexGridSizer(2, 5, 5);
|
||||
GridSizer->AddGrowableCol(1, 1);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Filename (required):")), leftItem);
|
||||
GridSizer->Add(_name, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Displayed Name:")), leftItem);
|
||||
GridSizer->Add(_display, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Condition:")), leftItem);
|
||||
GridSizer->Add(_condition, rightItem);
|
||||
|
||||
bigBox->Add(GridSizer, 0, wxEXPAND | wxALL, 15);
|
||||
|
||||
bigBox->AddSpacer(10);
|
||||
bigBox->AddStretchSpacer(1);
|
||||
|
||||
//Need to add 'OK' and 'Cancel' buttons.
|
||||
wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
|
||||
if (sizer != nullptr)
|
||||
bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15);
|
||||
|
||||
SetBackgroundColour(wxColour(255, 255, 255));
|
||||
SetIcon(wxIconLocation("LOOT.exe"));
|
||||
SetSizerAndFit(bigBox);
|
||||
}
|
||||
|
||||
void FileEditDialog::SetValues(const wxString& name, const wxString& display, const wxString& condition) {
|
||||
|
||||
_name->SetValue(name);
|
||||
_display->SetValue(display);
|
||||
_condition->SetValue(condition);
|
||||
}
|
||||
|
||||
wxString FileEditDialog::GetName() const {
|
||||
return _name->GetValue();
|
||||
}
|
||||
|
||||
wxString FileEditDialog::GetDisplayName() const {
|
||||
return _display->GetValue();
|
||||
}
|
||||
|
||||
wxString FileEditDialog::GetCondition() const {
|
||||
return _condition->GetValue();
|
||||
}
|
||||
|
||||
MessageEditDialog::MessageEditDialog(wxWindow *parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
wxArrayString languages;
|
||||
vector<string> langs = loot::Language::Names();
|
||||
for (size_t i = 0; i < langs.size(); i++) {
|
||||
languages.Add(FromUTF8(langs[i]));
|
||||
}
|
||||
|
||||
//Initialise controls.
|
||||
_type = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3, Type);
|
||||
_language = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, languages);
|
||||
|
||||
_condition = new wxTextCtrl(this, wxID_ANY);
|
||||
_str = new wxTextCtrl(this, wxID_ANY);
|
||||
|
||||
_content = new wxListView(this, LIST_MessageContent, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL);
|
||||
|
||||
addBtn = new wxButton(this, BUTTON_AddContent, translate("Add Content"));
|
||||
editBtn = new wxButton(this, BUTTON_EditContent, translate("Edit Content"));
|
||||
removeBtn = new wxButton(this, BUTTON_RemoveContent, translate("Remove Content"));
|
||||
|
||||
_content->InsertColumn(0, translate("Language"));
|
||||
_content->InsertColumn(1, translate("String"));
|
||||
|
||||
//Set up event handling.
|
||||
Bind(wxEVT_BUTTON, &MessageEditDialog::OnAdd, this, BUTTON_AddContent);
|
||||
Bind(wxEVT_BUTTON, &MessageEditDialog::OnEdit, this, BUTTON_EditContent);
|
||||
Bind(wxEVT_BUTTON, &MessageEditDialog::OnRemove, this, BUTTON_RemoveContent);
|
||||
Bind(wxEVT_LIST_ITEM_SELECTED, &MessageEditDialog::OnSelect, this, LIST_MessageContent);
|
||||
|
||||
wxSizerFlags leftItem(0);
|
||||
leftItem.Left();
|
||||
|
||||
wxSizerFlags rightItem(1);
|
||||
rightItem.Right();
|
||||
|
||||
wxSizerFlags wholeItem(0);
|
||||
wholeItem.Expand().Border(wxLEFT | wxRIGHT | wxBOTTOM, 15);
|
||||
|
||||
wxBoxSizer * bigBox = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxFlexGridSizer * GridSizer = new wxFlexGridSizer(2, 5, 5);
|
||||
GridSizer->AddGrowableCol(1, 1);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Type:")), leftItem);
|
||||
GridSizer->Add(_type, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Condition:")), leftItem);
|
||||
GridSizer->Add(_condition, rightItem);
|
||||
|
||||
bigBox->AddSpacer(15);
|
||||
|
||||
bigBox->Add(GridSizer, wholeItem);
|
||||
|
||||
bigBox->Add(_content, wholeItem);
|
||||
|
||||
wxFlexGridSizer * GridSizer2 = new wxFlexGridSizer(2, 5, 5);
|
||||
GridSizer2->AddGrowableCol(1, 1);
|
||||
|
||||
GridSizer2->Add(new wxStaticText(this, wxID_ANY, translate("Language:")), leftItem);
|
||||
GridSizer2->Add(_language, rightItem);
|
||||
|
||||
GridSizer2->Add(new wxStaticText(this, wxID_ANY, translate("Content:")), leftItem);
|
||||
GridSizer2->Add(_str, rightItem);
|
||||
|
||||
bigBox->Add(GridSizer2, wholeItem);
|
||||
|
||||
wxBoxSizer * hbox = new wxBoxSizer(wxHORIZONTAL);
|
||||
hbox->Add(addBtn, 0, wxRIGHT, 5);
|
||||
hbox->Add(editBtn, 0, wxLEFT | wxRIGHT, 5);
|
||||
hbox->Add(removeBtn, 0, wxLEFT, 5);
|
||||
bigBox->Add(hbox, 0, wxALIGN_RIGHT | wxLEFT | wxRIGHT, 15);
|
||||
|
||||
bigBox->AddSpacer(10);
|
||||
bigBox->AddStretchSpacer(1);
|
||||
|
||||
//Need to add 'OK' and 'Cancel' buttons.
|
||||
wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
|
||||
if (sizer != nullptr)
|
||||
bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15);
|
||||
|
||||
//Set defaults.
|
||||
_type->SetSelection(0);
|
||||
_language->SetSelection(0);
|
||||
editBtn->Enable(false);
|
||||
removeBtn->Enable(false);
|
||||
|
||||
SetBackgroundColour(wxColour(255, 255, 255));
|
||||
SetIcon(wxIconLocation("LOOT.exe"));
|
||||
SetSizerAndFit(bigBox);
|
||||
}
|
||||
|
||||
void MessageEditDialog::SetMessage(const loot::Message& message) {
|
||||
|
||||
if (message.Type() == loot::Message::say)
|
||||
_type->SetSelection(0);
|
||||
else if (message.Type() == loot::Message::warn)
|
||||
_type->SetSelection(1);
|
||||
else
|
||||
_type->SetSelection(2);
|
||||
|
||||
_condition->SetValue(FromUTF8(message.Condition()));
|
||||
|
||||
vector<loot::MessageContent> contents = message.Content();
|
||||
for (size_t i = 0, max = contents.size(); i < max; ++i) {
|
||||
_content->InsertItem(i, FromUTF8(loot::Language(contents[i].Language()).Name()));
|
||||
_content->SetItem(i, 1, FromUTF8(contents[i].Str()));
|
||||
}
|
||||
}
|
||||
|
||||
loot::Message MessageEditDialog::GetMessage() const {
|
||||
|
||||
unsigned int type;
|
||||
string condition;
|
||||
if (_type->GetSelection() == 0)
|
||||
type = loot::Message::say;
|
||||
else if (_type->GetSelection() == 1)
|
||||
type = loot::Message::warn;
|
||||
else
|
||||
type = loot::Message::error;
|
||||
|
||||
condition = string(_condition->GetValue().ToUTF8());
|
||||
|
||||
vector<loot::MessageContent> contents;
|
||||
for (size_t i = 0, max = _content->GetItemCount(); i < max; ++i) {
|
||||
|
||||
string str = string(_content->GetItemText(i, 1).ToUTF8());
|
||||
unsigned int lang = loot::Language(string(_content->GetItemText(i, 0).ToUTF8())).Code();
|
||||
|
||||
contents.push_back(loot::MessageContent(str, lang));
|
||||
}
|
||||
|
||||
return loot::Message(type, contents, condition);
|
||||
}
|
||||
|
||||
void MessageEditDialog::OnSelect(wxListEvent& event) {
|
||||
_language->SetSelection(loot::Language(string(_content->GetItemText(event.GetIndex(), 0).ToUTF8())).Code());
|
||||
_str->SetValue(_content->GetItemText(event.GetIndex(), 1));
|
||||
editBtn->Enable(true);
|
||||
removeBtn->Enable(true);
|
||||
}
|
||||
|
||||
void MessageEditDialog::OnAdd(wxCommandEvent& event) {
|
||||
long i = _content->GetItemCount();
|
||||
_content->InsertItem(i, FromUTF8(loot::Language(_language->GetSelection()).Name()));
|
||||
_content->SetItem(i, 1, _str->GetValue());
|
||||
}
|
||||
|
||||
void MessageEditDialog::OnEdit(wxCommandEvent& event) {
|
||||
if (_content->GetFirstSelected() == -1) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Attempting to edit message content, but no content row selected.";
|
||||
wxMessageBox(
|
||||
translate("Error: No content row selected."),
|
||||
translate("LOOT: Error"),
|
||||
wxOK | wxICON_ERROR,
|
||||
nullptr);
|
||||
return;
|
||||
}
|
||||
long i = _content->GetFirstSelected();
|
||||
_content->SetItem(i, 0, FromUTF8(loot::Language(_language->GetSelection()).Name()));
|
||||
_content->SetItem(i, 1, _str->GetValue());
|
||||
}
|
||||
|
||||
void MessageEditDialog::OnRemove(wxCommandEvent& event) {
|
||||
if (_content->GetFirstSelected() == -1) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Attempting to remove message content, but no content row selected.";
|
||||
wxMessageBox(
|
||||
translate("Error: No content row selected."),
|
||||
translate("LOOT: Error"),
|
||||
wxOK | wxICON_ERROR,
|
||||
nullptr);
|
||||
return;
|
||||
}
|
||||
_content->DeleteItem(_content->GetFirstSelected());
|
||||
editBtn->Enable(false);
|
||||
removeBtn->Enable(false);
|
||||
}
|
||||
|
||||
TagEditDialog::TagEditDialog(wxWindow *parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
|
||||
//Initialise controls.
|
||||
_state = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, State);
|
||||
|
||||
_name = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_EMPTY));
|
||||
_condition = new wxTextCtrl(this, wxID_ANY);
|
||||
|
||||
wxSizerFlags leftItem(0);
|
||||
leftItem.Left();
|
||||
|
||||
wxSizerFlags rightItem(1);
|
||||
rightItem.Right().Expand();
|
||||
|
||||
wxBoxSizer * bigBox = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxFlexGridSizer * GridSizer = new wxFlexGridSizer(2, 5, 5);
|
||||
GridSizer->AddGrowableCol(1, 1);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Add/Remove:")), leftItem);
|
||||
GridSizer->Add(_state, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Name (required):")), leftItem);
|
||||
GridSizer->Add(_name, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Condition:")), leftItem);
|
||||
GridSizer->Add(_condition, rightItem);
|
||||
|
||||
bigBox->Add(GridSizer, 0, wxEXPAND | wxALL, 15);
|
||||
|
||||
bigBox->AddSpacer(10);
|
||||
bigBox->AddStretchSpacer(1);
|
||||
|
||||
//Need to add 'OK' and 'Cancel' buttons.
|
||||
wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
|
||||
if (sizer != nullptr)
|
||||
bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15);
|
||||
|
||||
//Set defaults.
|
||||
_state->SetSelection(0);
|
||||
|
||||
SetBackgroundColour(wxColour(255, 255, 255));
|
||||
SetIcon(wxIconLocation("LOOT.exe"));
|
||||
SetSizerAndFit(bigBox);
|
||||
}
|
||||
|
||||
void TagEditDialog::SetValues(int state, const wxString& name, const wxString& condition) {
|
||||
|
||||
_state->SetSelection(state);
|
||||
_name->SetValue(name);
|
||||
_condition->SetValue(condition);
|
||||
}
|
||||
|
||||
wxString TagEditDialog::GetState() const {
|
||||
return State[_state->GetSelection()];
|
||||
}
|
||||
|
||||
wxString TagEditDialog::GetName() const {
|
||||
return _name->GetValue();
|
||||
}
|
||||
|
||||
wxString TagEditDialog::GetCondition() const {
|
||||
return _condition->GetValue();
|
||||
}
|
||||
|
||||
DirtInfoEditDialog::DirtInfoEditDialog(wxWindow * parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {
|
||||
//Initialise controls.
|
||||
wxTextValidator val(wxFILTER_EMPTY | wxFILTER_INCLUDE_CHAR_LIST);
|
||||
val.SetCharIncludes("0123456789ABCDEFabcdef");
|
||||
|
||||
_itm = new wxSpinCtrl(this, wxID_ANY, "0");
|
||||
_udr = new wxSpinCtrl(this, wxID_ANY, "0");
|
||||
_nav = new wxSpinCtrl(this, wxID_ANY, "0");
|
||||
_crc = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, val);
|
||||
_utility = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_EMPTY));
|
||||
|
||||
wxSizerFlags leftItem(0);
|
||||
leftItem.Left();
|
||||
|
||||
wxSizerFlags rightItem(1);
|
||||
rightItem.Right().Expand();
|
||||
|
||||
wxBoxSizer * bigBox = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxFlexGridSizer * GridSizer = new wxFlexGridSizer(2, 5, 5);
|
||||
GridSizer->AddGrowableCol(1, 1);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("CRC (required):")), leftItem);
|
||||
GridSizer->Add(_crc, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("ITM Count:")), leftItem);
|
||||
GridSizer->Add(_itm, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("UDR Count:")), leftItem);
|
||||
GridSizer->Add(_udr, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Deleted Navmesh Count:")), leftItem);
|
||||
GridSizer->Add(_nav, rightItem);
|
||||
|
||||
GridSizer->Add(new wxStaticText(this, wxID_ANY, translate("Cleaning Utility (required):")), leftItem);
|
||||
GridSizer->Add(_utility, rightItem);
|
||||
|
||||
bigBox->Add(GridSizer, 0, wxEXPAND | wxALL, 15);
|
||||
|
||||
bigBox->AddSpacer(10);
|
||||
bigBox->AddStretchSpacer(1);
|
||||
|
||||
//Need to add 'OK' and 'Cancel' buttons.
|
||||
wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
|
||||
if (sizer != nullptr)
|
||||
bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15);
|
||||
|
||||
SetBackgroundColour(wxColour(255, 255, 255));
|
||||
SetIcon(wxIconLocation("LOOT.exe"));
|
||||
SetSizerAndFit(bigBox);
|
||||
}
|
||||
|
||||
void DirtInfoEditDialog::SetValues(const wxString& crc, unsigned int itm, unsigned int udr, unsigned int nav, const wxString& utility) {
|
||||
_crc->SetValue(crc);
|
||||
_itm->SetValue(itm);
|
||||
_udr->SetValue(udr);
|
||||
_nav->SetValue(nav);
|
||||
_utility->SetValue(utility);
|
||||
}
|
||||
|
||||
wxString DirtInfoEditDialog::GetCRC() const {
|
||||
return _crc->GetValue();
|
||||
}
|
||||
|
||||
unsigned int DirtInfoEditDialog::GetITMs() const {
|
||||
return _itm->GetValue();
|
||||
}
|
||||
|
||||
unsigned int DirtInfoEditDialog::GetUDRs() const {
|
||||
return _udr->GetValue();
|
||||
}
|
||||
|
||||
unsigned int DirtInfoEditDialog::GetDeletedNavmeshes() const {
|
||||
return _nav->GetValue();
|
||||
}
|
||||
|
||||
wxString DirtInfoEditDialog::GetUtility() const {
|
||||
return _utility->GetValue();
|
||||
}
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __LOOT_GUI_MISC__
|
||||
#define __LOOT_GUI_MISC__
|
||||
|
||||
#include "ids.h"
|
||||
#include "../backend/metadata.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/spinctrl.h>
|
||||
|
||||
const wxString Type[3] = {
|
||||
translate("Note"),
|
||||
translate("Warning"),
|
||||
translate("Error")
|
||||
};
|
||||
|
||||
const wxString State[2] = {
|
||||
translate("Add"),
|
||||
translate("Remove")
|
||||
};
|
||||
|
||||
class MessageList : public wxListView {
|
||||
public:
|
||||
MessageList(wxWindow * parent, wxWindowID id, const unsigned int language);
|
||||
|
||||
void SetItems(const std::vector<loot::Message>& messages);
|
||||
std::vector<loot::Message> GetItems() const;
|
||||
|
||||
loot::Message GetItem(long item) const;
|
||||
void SetItem(long item, const loot::Message& message);
|
||||
void AppendItem(const loot::Message& message);
|
||||
|
||||
void OnDeleteItem(wxListEvent& event);
|
||||
protected:
|
||||
wxString OnGetItemText(long item, long column) const;
|
||||
|
||||
private:
|
||||
std::vector<loot::Message> _messages;
|
||||
const unsigned int _language;
|
||||
};
|
||||
|
||||
class FileEditDialog : public wxDialog {
|
||||
public:
|
||||
FileEditDialog(wxWindow *parent, const wxString& title);
|
||||
|
||||
void SetValues(const wxString& name, const wxString& display, const wxString& condition);
|
||||
wxString GetName() const;
|
||||
wxString GetDisplayName() const;
|
||||
wxString GetCondition() const;
|
||||
private:
|
||||
wxTextCtrl * _name;
|
||||
wxTextCtrl * _display;
|
||||
wxTextCtrl * _condition;
|
||||
};
|
||||
|
||||
class MessageEditDialog : public wxDialog {
|
||||
public:
|
||||
MessageEditDialog(wxWindow *parent, const wxString& title);
|
||||
|
||||
void SetMessage(const loot::Message& message);
|
||||
loot::Message GetMessage() const;
|
||||
|
||||
void OnSelect(wxListEvent& event);
|
||||
void OnAdd(wxCommandEvent& event);
|
||||
void OnEdit(wxCommandEvent& event);
|
||||
void OnRemove(wxCommandEvent& event);
|
||||
private:
|
||||
wxButton * addBtn;
|
||||
wxButton * editBtn;
|
||||
wxButton * removeBtn;
|
||||
wxChoice * _type;
|
||||
wxChoice * _language;
|
||||
wxListView * _content;
|
||||
wxTextCtrl * _condition;
|
||||
wxTextCtrl * _str;
|
||||
};
|
||||
|
||||
class TagEditDialog : public wxDialog {
|
||||
public:
|
||||
TagEditDialog(wxWindow *parent, const wxString& title);
|
||||
|
||||
void SetValues(int state, const wxString& name, const wxString& condition);
|
||||
wxString GetState() const;
|
||||
wxString GetName() const;
|
||||
wxString GetCondition() const;
|
||||
private:
|
||||
wxChoice * _state;
|
||||
wxTextCtrl * _name;
|
||||
wxTextCtrl * _condition;
|
||||
};
|
||||
|
||||
class DirtInfoEditDialog : public wxDialog {
|
||||
public:
|
||||
DirtInfoEditDialog(wxWindow * parent, const wxString& title);
|
||||
|
||||
void SetValues(const wxString& crc, unsigned int itm, unsigned int udr, unsigned int nav, const wxString& utility);
|
||||
wxString GetCRC() const;
|
||||
wxString GetUtility() const;
|
||||
unsigned int GetITMs() const;
|
||||
unsigned int GetUDRs() const;
|
||||
unsigned int GetDeletedNavmeshes() const;
|
||||
private:
|
||||
wxTextCtrl * _crc;
|
||||
wxSpinCtrl * _itm;
|
||||
wxSpinCtrl * _udr;
|
||||
wxSpinCtrl * _nav;
|
||||
wxTextCtrl * _utility;
|
||||
};
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,86 +0,0 @@
|
||||
/* LOOT
|
||||
|
||||
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
|
||||
Fallout: New Vegas.
|
||||
|
||||
Copyright (C) 2013-2014 WrinklyNinja
|
||||
|
||||
This file is part of LOOT.
|
||||
|
||||
LOOT 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 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
LOOT 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 LOOT. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LOOT_GUI_SETTINGS__
|
||||
#define __LOOT_GUI_SETTINGS__
|
||||
|
||||
#include "ids.h"
|
||||
#include "../backend/game.h"
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
class SettingsFrame : public wxDialog {
|
||||
public:
|
||||
SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector<loot::Game>& games, size_t currentGameIndex, wxPoint pos, wxSize size);
|
||||
|
||||
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;
|
||||
wxChoice *GameChoice;
|
||||
wxChoice *LanguageChoice;
|
||||
wxCheckBox *UpdateMasterlistBox;
|
||||
|
||||
wxListView *gamesList;
|
||||
wxButton * addBtn;
|
||||
wxButton * editBtn;
|
||||
wxButton * removeBtn;
|
||||
|
||||
YAML::Node& _settings;
|
||||
std::vector<loot::Game>& _games;
|
||||
size_t _currentGameIndex;
|
||||
};
|
||||
|
||||
class GameEditDialog : public wxDialog {
|
||||
public:
|
||||
GameEditDialog(wxWindow *parent, const wxString& title);
|
||||
|
||||
void SetValues(unsigned int type, const wxString& name, const wxString& folderName, const wxString& master,
|
||||
const wxString& repo, const wxString& branch, const wxString& path, const wxString& registry);
|
||||
wxString GetName() const;
|
||||
wxString GetType() const;
|
||||
wxString GetFolderName() const;
|
||||
wxString GetMaster() const;
|
||||
wxString GetRepoURL() const;
|
||||
wxString GetRepoBranch() const;
|
||||
wxString GetPath() const;
|
||||
wxString GetRegistryKey() const;
|
||||
private:
|
||||
wxChoice * _type;
|
||||
wxTextCtrl * _name;
|
||||
wxTextCtrl * _folderName;
|
||||
wxTextCtrl * _master;
|
||||
wxTextCtrl * _repo;
|
||||
wxTextCtrl * _branch;
|
||||
wxTextCtrl * _path;
|
||||
wxTextCtrl * _registry;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user