diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index fb083cf9..17bde129 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -41,7 +41,7 @@ using namespace std; // TextDropTarget class ////////////////////////////// -TextDropTarget::TextDropTarget(wxListView * owner, wxStaticText * name) : targetOwner(owner), targetName(name) {} +TextDropTarget::TextDropTarget(wxListView * owner, wxControl * name) : targetOwner(owner), targetName(name) {} bool TextDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString &data) { if (data == targetName->GetLabelText() || targetOwner->FindItem(-1, data) != wxNOT_FOUND) @@ -507,19 +507,19 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli //Initialise child windows. listBook = new wxNotebook(this, BOOK_Lists); - wxPanel * reqsTab = new wxPanel(listBook); - wxPanel * incsTab = new wxPanel(listBook); - wxPanel * loadAfterTab = new wxPanel(listBook); - wxPanel * messagesTab = new wxPanel(listBook); - wxPanel * tagsTab = new wxPanel(listBook); - wxPanel * dirtyTab = new wxPanel(listBook); + reqsTab = new wxPanel(listBook); + incsTab = new wxPanel(listBook); + loadAfterTab = new wxPanel(listBook); + messagesTab = new wxPanel(listBook); + tagsTab = new wxPanel(listBook); + dirtyTab = new wxPanel(listBook); //Initialise controls. - pluginText = new wxStaticText(this, wxID_ANY, ""); prioritySpin = new wxSpinCtrl(this, wxID_ANY, "0"); prioritySpin->SetRange(-999999, 999999); priorityCheckbox = new wxCheckBox(this, wxID_ANY, translate("Compare priority against all other plugins")); - enableUserEditsBox = new wxCheckBox(this, wxID_ANY, translate("Enable User Changes")); + pluginCheckbox = new wxCheckBox(this, wxID_ANY, ""); + filterCheckbox = new wxCheckBox(this, CHECKBOX_Filter, translate("Show only conflicting plugins")); addBtn = new wxButton(this, BUTTON_AddRow, translate("Add File")); editBtn = new wxButton(this, BUTTON_EditRow, translate("Edit File")); @@ -546,7 +546,10 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli listBook->AddPage(dirtyTab, translate("Dirty Info")); //Set up list columns. - pluginList->AppendColumn(translate("Plugins")); + pluginList->AppendColumn(translate("User Metadata Enabled")); + pluginList->AppendColumn(translate("Plugin Name")); + pluginList->AppendColumn(translate("Priority")); + pluginList->AppendColumn(translate("Global Priority")); reqsList->AppendColumn(translate("Filename")); reqsList->AppendColumn(translate("Display Name")); @@ -583,12 +586,13 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli removeBtn->Enable(false); prioritySpin->Enable(false); priorityCheckbox->Enable(false); - enableUserEditsBox->Enable(false); + pluginCheckbox->Enable(false); + filterCheckbox->Enable(false); //Make plugin name bold text. - wxFont font = pluginText->GetFont(); + wxFont font = pluginCheckbox->GetFont(); font.SetWeight(wxFONTWEIGHT_BOLD); - pluginText->SetFont(font); + pluginCheckbox->SetFont(font); //Set up event handling. Bind(wxEVT_LIST_ITEM_SELECTED, &Editor::OnPluginSelect, this, LIST_Plugins); @@ -609,27 +613,38 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli Bind(wxEVT_MENU, &Editor::OnPluginCopyMetadata, this, MENU_CopyMetadata); Bind(wxEVT_MENU, &Editor::OnPluginClearMetadata, this, MENU_ClearPluginMetadata); Bind(wxEVT_MENU, &Editor::OnClearAllMetadata, this, MENU_ClearAllMetadata); + Bind(wxEVT_LIST_BEGIN_DRAG, &Editor::OnDragStart, this, LIST_Plugins); + Bind(wxEVT_CHECKBOX, &Editor::OnFilterToggle, this, CHECKBOX_Filter); + + //Set up drag 'n' drop. + reqsList->SetDropTarget(new TextDropTarget(reqsList, pluginCheckbox)); + incsList->SetDropTarget(new TextDropTarget(incsList, pluginCheckbox)); + loadAfterList->SetDropTarget(new TextDropTarget(loadAfterList, pluginCheckbox)); //Set up tooltips. pluginList->SetToolTip(translate("Select a plugin to edit its load order metadata.")); + reqsList->SetToolTip(translate("Drag and drop a plugin here to add it to the list. The \"Show only conflicting plugins\" checkbox must be checked.")); + incsList->SetToolTip(translate("Drag and drop a plugin here to add it to the list. The \"Show only conflicting plugins\" checkbox must be checked.")); + loadAfterList->SetToolTip(translate("Drag and drop a plugin here to make the selected plugin load after it. The \"Show only conflicting plugins\" checkbox must be checked.")); prioritySpin->SetToolTip(translate("Plugins with higher priorities will load after plugins with smaller priorities that they conflict with, unless one must explicitly load after the other.")); - enableUserEditsBox->SetToolTip(translate("If unchecked, any user-added metadata will be ignored during sorting.")); + pluginCheckbox->SetToolTip(translate("If unchecked, any user-added metadata will be ignored during sorting.")); editBtn->SetToolTip(translate("Only user-added data may be removed.")); removeBtn->SetToolTip(translate("Only user-added data may be removed.")); priorityCheckbox->SetToolTip(translate("Otherwise, priorities are only compared between conflicting plugins.")); + filterCheckbox->SetToolTip(translate("Filters the plugin list to only display plugins which can be loaded after the currently selected plugin, and which either conflict with it, or, if it loads a BSA, also load BSAs. Also enables drag and drop of plugins into the Load After box.")); //Set up layout. wxBoxSizer * bigBox = new wxBoxSizer(wxHORIZONTAL); - bigBox->Add(pluginList, 1, wxEXPAND|wxALL, 10); + bigBox->Add(pluginList, 0, wxEXPAND | wxALL, 10); wxBoxSizer * mainBox = new wxBoxSizer(wxVERTICAL); - mainBox->Add(pluginText, 0, wxTOP|wxBOTTOM, 10); + mainBox->Add(pluginCheckbox, 0, wxTOP | wxBOTTOM | wxEXPAND, 10); wxBoxSizer * hbox1 = new wxBoxSizer(wxHORIZONTAL); - hbox1->Add(enableUserEditsBox, 0, wxALIGN_LEFT|wxRIGHT, 10); + hbox1->Add(filterCheckbox, 0, wxALIGN_LEFT|wxRIGHT, 10); hbox1->AddStretchSpacer(1); hbox1->Add(new wxStaticText(this, wxID_ANY, translate("Priority: ")), 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5); hbox1->Add(prioritySpin, 0, wxALIGN_RIGHT); @@ -676,21 +691,18 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli hbox6->Add(cancelBtn, 0, wxLEFT, 5); mainBox->Add(hbox6, 0, wxALIGN_RIGHT); - bigBox->Add(mainBox, 2, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10); + bigBox->Add(mainBox, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10); //Fill pluginList with the contents of basePlugins. int i = 0; for (list::const_iterator it = _basePlugins.begin(); it != _basePlugins.end(); ++it) { - pluginList->InsertItem(i, FromUTF8(it->Name())); - if (it->LoadsBSA(_game)) { - pluginList->SetItemTextColour(i, wxColour(0, 142, 219)); - } - if (std::find(_editedPlugins.begin(), _editedPlugins.end(), *it) != _editedPlugins.end()) { - pluginList->SetItemFont(i, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold()); - } + AddPluginToList(*it, i); ++i; } pluginList->SetColumnWidth(0, wxLIST_AUTOSIZE); + pluginList->SetColumnWidth(1, wxLIST_AUTOSIZE); + pluginList->SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER); + pluginList->SetColumnWidth(3, wxLIST_AUTOSIZE_USEHEADER); SetBackgroundColour(wxColour(255,255,255)); SetIcon(wxIconLocation("LOOT.exe")); @@ -701,16 +713,31 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli void Editor::OnPluginSelect(wxListEvent& event) { //Create Plugin object for selected plugin. - wxString selectedPlugin = pluginList->GetItemText(event.GetIndex()); - wxString currentPlugin = pluginText->GetLabelText(); + wxString selectedPlugin = pluginList->GetItemText(event.GetIndex(), 1); + wxString currentPlugin = pluginCheckbox->GetLabelText(); //Check if the selected plugin is the same as the current plugin. if (selectedPlugin != currentPlugin) { BOOST_LOG_TRIVIAL(debug) << "User selected plugin: " << selectedPlugin.ToUTF8(); //Apply any current edits. - if (!currentPlugin.empty()) + if (!currentPlugin.empty()) { ApplyEdits(currentPlugin, pluginList); + //Also update plugin list UI. + loot::Plugin userEdits = GetUserData(currentPlugin); + if (!userEdits.HasNameOnly()) { + if (userEdits.Enabled()) + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 0, FromUTF8("\xE2\x9C\x93")); + else + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 0, FromUTF8("\xE2\x9C\x97")); + } + //Also update the item's priority value in the plugins list in case it has changed. + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 2, FromUTF8(loot::IntToString(prioritySpin->GetValue()))); + if (priorityCheckbox->IsChecked()) + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 3, FromUTF8("\xE2\x9C\x93")); + else + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 3, FromUTF8("\xE2\x9C\x97")); + } //Merge metadata. loot::Plugin plugin = GetMasterData(selectedPlugin); @@ -718,7 +745,7 @@ void Editor::OnPluginSelect(wxListEvent& event) { //Now fill editor fields with new plugin's info and update control states. BOOST_LOG_TRIVIAL(debug) << "Filling editor fields with plugin info."; - pluginText->SetLabelText(FromUTF8(plugin.Name())); + pluginCheckbox->SetLabelText(FromUTF8(plugin.Name())); prioritySpin->SetValue(loot::modulo(plugin.Priority(), loot::max_priority)); @@ -727,7 +754,7 @@ void Editor::OnPluginSelect(wxListEvent& event) { else priorityCheckbox->SetValue(false); - enableUserEditsBox->SetValue(plugin.Enabled()); + pluginCheckbox->SetValue(plugin.Enabled()); loadAfterList->DeleteAllItems(); reqsList->DeleteAllItems(); @@ -813,12 +840,16 @@ void Editor::OnPluginSelect(wxListEvent& event) { //Set control states. prioritySpin->Enable(true); priorityCheckbox->Enable(true); - enableUserEditsBox->Enable(true); + pluginCheckbox->Enable(true); + filterCheckbox->Enable(true); addBtn->Enable(true); editBtn->Enable(false); removeBtn->Enable(false); } - Fit(); + InvalidateBestSize(); //Makes the priority column visible without scrolling. + if (GetBestSize().GetHeight() > GetSize().GetHeight() || GetBestSize().GetWidth() > GetSize().GetWidth()) { + Fit(); + } } void Editor::OnPluginListRightClick(wxListEvent& event) { @@ -827,13 +858,13 @@ void Editor::OnPluginListRightClick(wxListEvent& event) { void Editor::OnPluginCopyName(wxCommandEvent& event) { if (wxTheClipboard->Open()) { - wxTheClipboard->SetData(new wxTextDataObject(pluginList->GetItemText(pluginList->GetFirstSelected()))); + wxTheClipboard->SetData(new wxTextDataObject(pluginList->GetItemText(pluginList->GetFirstSelected(), 1))); wxTheClipboard->Close(); } } void Editor::OnPluginCopyMetadata(wxCommandEvent& event) { - wxString selectedPlugin = pluginList->GetItemText(pluginList->GetFirstSelected()); + wxString selectedPlugin = pluginList->GetItemText(pluginList->GetFirstSelected(), 1); loot::Plugin plugin = GetUserData(selectedPlugin); string text; @@ -862,7 +893,7 @@ void Editor::OnPluginClearMetadata(wxCommandEvent& event) { if (dialog.ShowModal() == wxID_YES) { long i = pluginList->GetFirstSelected(); - wxString selectedPlugin = pluginList->GetItemText(i); + wxString selectedPlugin = pluginList->GetItemText(i, 1); loot::Plugin p(string(selectedPlugin.ToUTF8())); //Need to clear what's currently in the editor and what's from the userlist. @@ -874,7 +905,7 @@ void Editor::OnPluginClearMetadata(wxCommandEvent& event) { _editedPlugins.erase(it); //Also clear any unapplied data. Easiest way to do this is to simulate loading the plugin's data again. - pluginText->SetLabelText(""); + pluginCheckbox->SetLabelText(""); pluginList->Select(i, false); pluginList->Select(i, true); pluginList->SetItemFont(i, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); @@ -892,7 +923,7 @@ void Editor::OnClearAllMetadata(wxCommandEvent& event) { _editedPlugins.clear(); //Also clear any unapplied data. Easiest way to do this is to simulate loading the plugin's data again. - pluginText->SetLabelText(""); + pluginCheckbox->SetLabelText(""); long i = pluginList->GetFirstSelected(); pluginList->Select(i, false); pluginList->Select(i, true); @@ -904,14 +935,14 @@ void Editor::OnClearAllMetadata(wxCommandEvent& event) { void Editor::OnListBookChange(wxBookCtrlEvent& event) { BOOST_LOG_TRIVIAL(trace) << "Changed list tab."; - if (event.GetSelection() == 0 || event.GetSelection() == 1) { - addBtn->SetLabel(translate("Add File")); - editBtn->SetLabel(translate("Edit File")); - removeBtn->SetLabel(translate("Remove File")); - } else if (event.GetSelection() == 2) { + if (listBook->GetPageCount() == 1 || event.GetSelection() == 2) { //First check is for simple view mode. addBtn->SetLabel(translate("Add Plugin")); editBtn->SetLabel(translate("Edit Plugin")); removeBtn->SetLabel(translate("Remove Plugin")); + } else if (event.GetSelection() == 0 || event.GetSelection() == 1) { + addBtn->SetLabel(translate("Add File")); + editBtn->SetLabel(translate("Edit File")); + removeBtn->SetLabel(translate("Remove File")); } else if (event.GetSelection() == 3) { addBtn->SetLabel(translate("Add Message")); editBtn->SetLabel(translate("Edit Message")); @@ -949,12 +980,12 @@ void Editor::OnAddRow(wxCommandEvent& event) { } wxListView * list; - if (listBook->GetSelection() == 0) + if (listBook->GetPageCount() == 1 || listBook->GetSelection() == 2) + list = loadAfterList; + else if (listBook->GetSelection() == 0) list = reqsList; else if (listBook->GetSelection() == 1) list = incsList; - else - list = loadAfterList; long i = list->GetItemCount(); list->InsertItem(i, rowDialog->GetName()); @@ -1020,12 +1051,12 @@ void Editor::OnEditRow(wxCommandEvent& event) { FileEditDialog * rowDialog = new FileEditDialog(this, translate("LOOT: Edit File/Plugin")); wxListView * list; - if (listBook->GetSelection() == 0) + if (listBook->GetPageCount() == 1 || listBook->GetSelection() == 2) + list = loadAfterList; + else if (listBook->GetSelection() == 0) list = reqsList; else if (listBook->GetSelection() == 1) list = incsList; - else - list = loadAfterList; long i = list->GetFirstSelected(); @@ -1113,16 +1144,18 @@ void Editor::OnEditRow(wxCommandEvent& event) { void Editor::OnRemoveRow(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(debug) << "Removing row."; wxListView * list; - if (listBook->GetSelection() == 0) + if (listBook->GetPageCount() == 1 || listBook->GetSelection() == 2) + list = loadAfterList; + else if (listBook->GetSelection() == 0) list = reqsList; else if (listBook->GetSelection() == 1) list = incsList; - else if (listBook->GetSelection() == 2) - list = loadAfterList; else if (listBook->GetSelection() == 3) list = messageList; - else + else if (listBook->GetSelection() == 4) list = tagsList; + else if (listBook->GetSelection() == 5) + list = dirtyList; list->DeleteItem(list->GetFirstSelected()); @@ -1135,7 +1168,7 @@ void Editor::OnRowSelect(wxListEvent& event) { //Create File object, search the masterlist vector for the plugin and search its reqs for this object. loot::File file = RowToFile(reqsList, event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1159,7 +1192,7 @@ void Editor::OnRowSelect(wxListEvent& event) { } else if (event.GetId() == LIST_Incs) { loot::File file = RowToFile(incsList, event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1183,7 +1216,7 @@ void Editor::OnRowSelect(wxListEvent& event) { } else if (event.GetId() == LIST_LoadAfter) { loot::File file = RowToFile(loadAfterList, event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1207,7 +1240,7 @@ void Editor::OnRowSelect(wxListEvent& event) { } else if (event.GetId() == LIST_Messages) { loot::Message message = messageList->GetItem(event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1231,7 +1264,7 @@ void Editor::OnRowSelect(wxListEvent& event) { } else if (event.GetId() == LIST_BashTags) { loot::Tag tag = RowToTag(tagsList, event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1254,7 +1287,7 @@ void Editor::OnRowSelect(wxListEvent& event) { } else { loot::PluginDirtyInfo dirtyData = RowToPluginDirtyInfo(dirtyList, event.GetIndex()); - loot::Plugin plugin(string(pluginText->GetLabelText().ToUTF8())); + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); list::const_iterator it = std::find(_basePlugins.begin(), _basePlugins.end(), plugin); @@ -1282,7 +1315,7 @@ void Editor::OnQuit(wxCommandEvent& event) { if (event.GetId() == BUTTON_Apply) { //Apply any current edits. - wxString currentPlugin = pluginText->GetLabelText(); + wxString currentPlugin = pluginCheckbox->GetLabelText(); if (!currentPlugin.empty()) ApplyEdits(currentPlugin, pluginList); @@ -1307,7 +1340,7 @@ loot::Plugin Editor::GetNewData(const wxString& plugin) const { BOOST_LOG_TRIVIAL(debug) << "Getting metadata from editor fields for plugin: " << plugin.ToUTF8(); loot::Plugin p(string(plugin.ToUTF8())); - p.Enabled(enableUserEditsBox->IsChecked()); + p.Enabled(pluginCheckbox->IsChecked()); int priority = prioritySpin->GetValue(); if (priorityCheckbox->IsChecked()) { @@ -1354,3 +1387,108 @@ loot::Plugin Editor::GetNewData(const wxString& plugin) const { return p; } + +void Editor::OnFilterToggle(wxCommandEvent& event) { + //First need to merge the base and edited plugin lists so that the right priority values get displayed. + + list plugins(_basePlugins); + for (list::const_iterator it = _editedPlugins.begin(); it != _editedPlugins.end(); ++it) { + list::iterator pos = std::find(plugins.begin(), plugins.end(), *it); + pos->MergeMetadata(*it); + } + + //Disable list selection. + if (event.IsChecked()) + Unbind(wxEVT_LIST_ITEM_SELECTED, &Editor::OnPluginSelect, this, LIST_Plugins); + else + Bind(wxEVT_LIST_ITEM_SELECTED, &Editor::OnPluginSelect, this, LIST_Plugins); + + pluginList->Freeze(); + if (event.IsChecked()) { + loot::Plugin plugin(string(pluginCheckbox->GetLabelText().ToUTF8())); + list::const_iterator pos = std::find(plugins.begin(), plugins.end(), plugin); + + if (pos != plugins.end()) { + pluginList->DeleteAllItems(); + + bool loadsBSA = pos->LoadsBSA(_game); + + int i = 0; + for (list::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { + //Want to filter to show only those the selected plugin can load after validly, and which also either conflict with it, + //or which load a BSA (if the selected plugin loads a BSA). + if (*it == *pos || !it->MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(*it) || (loadsBSA && it->LoadsBSA(_game)))) { + AddPluginToList(*it, i); + ++i; + } + } + } + } + else { + pluginList->DeleteAllItems(); + int i = 0; + for (list::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { + AddPluginToList(*it, i); + ++i; + } + } + + //Now re-select the current plugin in the list. + pluginList->Select(pluginList->FindItem(-1, pluginCheckbox->GetLabelText())); + pluginList->Thaw(); + Refresh(); +} + +void Editor::OnDragStart(wxListEvent& event) { + wxTextDataObject data(pluginList->GetItemText(event.GetItem(), 1)); + wxDropSource dropSource(pluginList); + dropSource.SetData(data); + wxDragResult result = dropSource.DoDragDrop(); +} + +void Editor::AddPluginToList(const loot::Plugin& plugin, int position) { + loot::Plugin userEdits = GetUserData(plugin.Name()); + if (!userEdits.HasNameOnly()) { + if (userEdits.Enabled()) + pluginList->InsertItem(position, FromUTF8("\xE2\x9C\x93")); + else + pluginList->InsertItem(position, FromUTF8("\xE2\x9C\x97")); + } + else + pluginList->InsertItem(position, ""); + + pluginList->SetItem(position, 1, FromUTF8(plugin.Name())); + pluginList->SetItem(position, 2, FromUTF8(loot::IntToString(loot::modulo(plugin.Priority(), loot::max_priority)))); + if (abs(plugin.Priority()) >= loot::max_priority) + pluginList->SetItem(position, 3, FromUTF8("\xE2\x9C\x93")); + else + pluginList->SetItem(position, 3, FromUTF8("\xE2\x9C\x97")); + if (plugin.LoadsBSA(_game)) { + pluginList->SetItemTextColour(position, wxColour(0, 142, 219)); + } +} + +void Editor::SetSimpleView(bool on) { + if (on) { + listBook->RemovePage(5); + listBook->RemovePage(4); + listBook->RemovePage(3); + listBook->RemovePage(1); + listBook->RemovePage(0); + addBtn->Show(false); + editBtn->Show(false); + loadAfterList->SetColumnWidth(1, 0); + loadAfterList->SetColumnWidth(2, 0); + } + else { + listBook->InsertPage(0, reqsTab, translate("Requirements")); + listBook->InsertPage(1, incsTab, translate("Incompatibilities")); + listBook->AddPage(messagesTab, translate("Messages")); + listBook->AddPage(tagsTab, translate("Bash Tags")); + listBook->AddPage(dirtyTab, translate("Dirty Info")); + addBtn->Show(true); + editBtn->Show(true); + loadAfterList->SetColumnWidth(1, wxLIST_AUTOSIZE); + loadAfterList->SetColumnWidth(2, wxLIST_AUTOSIZE); + } +} \ No newline at end of file diff --git a/src/gui/editor.h b/src/gui/editor.h index 560790c8..81ae0725 100644 --- a/src/gui/editor.h +++ b/src/gui/editor.h @@ -54,11 +54,11 @@ class TextDropTarget : public wxTextDropTarget { //Class to override virtual functions. public: - TextDropTarget(wxListView * owner, wxStaticText * name); + TextDropTarget(wxListView * owner, wxControl * name); virtual bool OnDropText(wxCoord x, wxCoord y, const wxString &data); private: wxListView * targetOwner; - wxStaticText * targetName; + wxControl * targetName; }; class CommonEditor { @@ -114,6 +114,8 @@ class Editor : public wxFrame, public CommonEditor { public: Editor(wxWindow *parent, const wxString& title, const std::string userlistPath, const std::list& basePlugins, std::list& editedPlugins, const unsigned int language, const loot::Game& game); + void SetSimpleView(bool on = true); + void OnPluginSelect(wxListEvent& event); void OnPluginListRightClick(wxListEvent& event); void OnPluginCopyName(wxCommandEvent& event); @@ -125,6 +127,8 @@ public: void OnEditRow(wxCommandEvent& event); void OnRemoveRow(wxCommandEvent& event); void OnRowSelect(wxListEvent& event); + void OnFilterToggle(wxCommandEvent& event); + void OnDragStart(wxListEvent& event); void OnQuit(wxCommandEvent& event); private: wxMenu * pluginMenu; @@ -142,12 +146,20 @@ private: wxListView * dirtyList; wxNotebook * listBook; wxCheckBox * priorityCheckbox; - wxCheckBox * enableUserEditsBox; wxSpinCtrl * prioritySpin; - wxStaticText * pluginText; + wxCheckBox * pluginCheckbox; + wxCheckBox * filterCheckbox; + + wxPanel * reqsTab; + wxPanel * incsTab; + wxPanel * loadAfterTab; + wxPanel * messagesTab; + wxPanel * tagsTab; + wxPanel * dirtyTab; const std::string _userlistPath; loot::Plugin GetNewData(const wxString& plugin) const; + void AddPluginToList(const loot::Plugin& plugin, int position); }; #endif