From 71bd3ede48fb4ea2d6aa5f61e7e7d8cbb32194b5 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sat, 7 Jun 2014 16:58:02 +0100 Subject: [PATCH] Removed old report viewer window. There's no useful code in it. --- src/gui/viewer.cpp | 90 ---------------------------------------------- src/gui/viewer.h | 49 ------------------------- 2 files changed, 139 deletions(-) delete mode 100644 src/gui/viewer.cpp delete mode 100644 src/gui/viewer.h diff --git a/src/gui/viewer.cpp b/src/gui/viewer.cpp deleted file mode 100644 index 309cf018..00000000 --- a/src/gui/viewer.cpp +++ /dev/null @@ -1,90 +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 - . -*/ - -#include "viewer.h" -#include "../backend/helpers.h" - -Viewer::Viewer(wxWindow *parent, const wxString& title, const wxString& url, wxPoint pos, wxSize size, YAML::Node& settings) : wxFrame(parent, wxID_ANY, title, pos, size), _settings(settings) { - web = wxWebView::New(this, wxID_ANY, url); - - web->Bind(wxEVT_WEBVIEW_NAVIGATING, &Viewer::OnNavigationStart, this); - web->Bind(wxEVT_CHAR_HOOK, &Viewer::OnKeyUp, this); - Bind(wxEVT_CLOSE_WINDOW, &Viewer::OnClose, this); - - wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL); - - topsizer->Add(web, 1, wxEXPAND); - - SetSizer(topsizer); - if (size != wxDefaultSize) - SetSize(size); - else - SetSize(800, 600); - SetIcon(wxIconLocation("LOOT.exe")); -} - -void Viewer::OnNavigationStart(wxWebViewEvent& event) { - wxLaunchDefaultBrowser(event.GetURL()); - event.Veto(); -} - -void Viewer::OnKeyUp(wxKeyEvent &event) { - if (event.GetUnicodeKey() != 0x46 || event.GetModifiers() != wxMOD_CONTROL) // "F" - return; - - wxFindReplaceDialog * findDia = new wxFindReplaceDialog(this, &data, translate("Find in Page")); - - findDia->Bind(wxEVT_FIND, &Viewer::OnFind, this); - findDia->Bind(wxEVT_FIND_NEXT, &Viewer::OnFind, this); - - findDia->Show(); -} - -void Viewer::OnFind(wxFindDialogEvent &event) { - int dialogFlags = event.GetFlags(); - int findFlags = wxWEBVIEW_FIND_WRAP | wxWEBVIEW_FIND_HIGHLIGHT_RESULT; - - if ((dialogFlags & wxFR_DOWN) == 0) - findFlags = findFlags | wxWEBVIEW_FIND_BACKWARDS; - if (dialogFlags & wxFR_WHOLEWORD) - findFlags = findFlags | wxWEBVIEW_FIND_ENTIRE_WORD; - if (dialogFlags & wxFR_MATCHCASE) - findFlags = findFlags | wxWEBVIEW_FIND_MATCH_CASE; - - - web->Find(event.GetFindString(), findFlags); -} - -void Viewer::OnClose(wxCloseEvent &event) { - //Record window settings. - YAML::Node node; - node["height"] = GetSize().GetHeight(); - node["width"] = GetSize().GetWidth(); - node["xPos"] = GetPosition().x; - node["yPos"] = GetPosition().y; - - _settings["windows"]["viewer"] = node; - - Destroy(); -} \ No newline at end of file diff --git a/src/gui/viewer.h b/src/gui/viewer.h deleted file mode 100644 index 90621fa2..00000000 --- a/src/gui/viewer.h +++ /dev/null @@ -1,49 +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 - . -*/ - -#ifndef __LOOT_GUI_VIEWER__ -#define __LOOT_GUI_VIEWER__ - -#include "ids.h" - -#include -#include -#include - -class Viewer : public wxFrame { -public: - Viewer(wxWindow *parent, const wxString& title, const wxString& url, wxPoint pos, wxSize size, YAML::Node& settings); - - void OnNavigationStart(wxWebViewEvent& event); - void OnKeyUp(wxKeyEvent &event); - void OnFind(wxFindDialogEvent &event); - void OnClose(wxCloseEvent &event); - - wxWebView * web; - wxFindReplaceData data; - - YAML::Node& _settings; -}; - -#endif