189 lines
6.5 KiB
C++
189 lines
6.5 KiB
C++
/*
|
|
speciesgen
|
|
Copyright (C) 2022-2023 prisixia
|
|
|
|
This file is part of speciesgen.
|
|
|
|
speciesgen 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.
|
|
|
|
speciesgen 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 speciesgen. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: speciesgen.cpp
|
|
// Purpose: Generating species support mods for StarPounds
|
|
// Author: prisixia
|
|
// Created: 2022-02-13
|
|
// Copyright: (C) 2022-2023 prisixia
|
|
// Licence: GNU General Public License version 3
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef SPECIESGEN_H
|
|
#define SPECIESGEN_H
|
|
|
|
#define CEREAL_SERIALIZE_FUNCTION_NAME Serialise
|
|
#define CEREAL_LOAD_FUNCTION_NAME Load
|
|
#define CEREAL_SAVE_FUNCTION_NAME Save
|
|
#define CEREAL_LOAD_MINIMAL_FUNCTION_NAME LoadMinimal
|
|
#define CEREAL_SAVE_MINIMAL_FUNCTION_NAME SaveMinimal
|
|
|
|
#include <wx/wxprec.h>
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include <wx/wx.h>
|
|
#endif // WX_PRECOMP
|
|
|
|
#if wxUSE_CLIPBOARD
|
|
#include <wx/clipbrd.h>
|
|
#include <wx/dataobj.h>
|
|
#endif // wxUSE_CLIPBOARD
|
|
|
|
// We test for wxUSE_DRAG_AND_DROP also, because data objects may not be
|
|
// implemented for compilers that can't cope with the OLE parts in
|
|
// wxUSE_DRAG_AND_DROP.
|
|
#if !wxUSE_DRAG_AND_DROP
|
|
#undef wxUSE_CLIPBOARD
|
|
#define wxUSE_CLIPBOARD 0
|
|
#endif // wxUSE_DRAG_AND_DROP
|
|
|
|
#include <wx/notebook.h>
|
|
#include <wx/propgrid/propgrid.h>
|
|
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
#include <optional>
|
|
|
|
#include "error.h"
|
|
#include "gui/main_panel.h"
|
|
#include "gui/stages_panel.h"
|
|
#include "starbound/frames.h"
|
|
#include "starbound/item.h"
|
|
#include "starbound/metadata.h"
|
|
#include "starbound/patch.h"
|
|
#include "starpounds/species.h"
|
|
#include "starpounds/weightstage.h"
|
|
|
|
#include "cereal/archives/json.hpp"
|
|
#include "magic_enum.hpp"
|
|
|
|
#define SPECIESGEN_ABOUT_PAGE \
|
|
"This program generates mods to add support for\n" \
|
|
"modded species in Starpounds.\n\n" \
|
|
"Version " SPECIESGEN_VERSION "\n" \
|
|
"Copyright (C) 2022-2023 prisixia" \
|
|
"\n" \
|
|
"GNU General Public License version 3" \
|
|
"\n" \
|
|
"\n\n" \
|
|
"The author(s) of this program is in no way affiliated\n" \
|
|
"with the hereunder licensed software" \
|
|
"\n\n" \
|
|
"wxWidgets:\n" \
|
|
"Copyright (c) 1998-2005 Julian Smart, Robert Roebling et al" \
|
|
"\n" \
|
|
"wxWindows Library Licence, Version 3.1" \
|
|
"\n\n" \
|
|
"cereal:\n" \
|
|
"Copyright (c) 2013-2022, Randolph Voorhies, Shane Grant" \
|
|
"\n" \
|
|
"BSD 3-Clause License" \
|
|
"\n" \
|
|
"All rights reserved." \
|
|
"\n\n" \
|
|
"magic_enum:\n" \
|
|
"Copyright (c) 2019-2022 Daniil Goncharov" \
|
|
"\n" \
|
|
"MIT License" \
|
|
"\n" \
|
|
"All rights reserved."
|
|
|
|
//----------------------------------------------------------------------
|
|
// class definitions
|
|
//----------------------------------------------------------------------
|
|
|
|
namespace SpeciesGen {
|
|
enum {
|
|
TEXT_QUIT = wxID_EXIT,
|
|
TEXT_ABOUT = wxID_ABOUT,
|
|
TEXT_EXPORT = 2,
|
|
TEXT_IMPORT,
|
|
TEXT_IMPORT_APPEND,
|
|
|
|
// TEXT_CLIPBOARD_COPY,
|
|
// TEXT_CLIPBOARD_PASTE,
|
|
// TEXT_CLIPBOARD_VETO,
|
|
|
|
CONFIG_IMPORT = (1 << 0),
|
|
CONFIG_IMPORT_APPEND = (1 << 1),
|
|
CONFIG_EXPORT = (1 << 2)
|
|
};
|
|
|
|
class App : public wxApp {
|
|
public:
|
|
bool OnInit() wxOVERRIDE;
|
|
};
|
|
|
|
/*
|
|
class SpritesPanel: public wxPanel, public ErrorHandler
|
|
{
|
|
public:
|
|
SpritesPanel(wxWindow *, int, int, int, int, const std::string);
|
|
};
|
|
*/
|
|
|
|
class Frame : public wxFrame {
|
|
public:
|
|
Frame(const wxString &, int, int);
|
|
|
|
private:
|
|
void DoReadWeightStages(int);
|
|
void DoGenerateMod(wxCommandEvent &WXUNUSED(event));
|
|
bool DoCheckErrors();
|
|
|
|
#if wxUSE_CLIPBOARD
|
|
// void OnPasteFromClipboard(wxCommandEvent &WXUNUSED(event));
|
|
// void OnCopyToClipboard(wxCommandEvent &WXUNUSED(event));
|
|
// void OnUpdatePasteFromClipboard(wxUpdateUIEvent &);
|
|
// void OnUpdateCopyToClipboard(wxUpdateUIEvent &);
|
|
#endif // wxUSE_CLIPBOARD
|
|
|
|
#if wxUSE_FILEDLG
|
|
void OnFileOpen(const std::string &, const std::string &, int,
|
|
std::filesystem::path &);
|
|
#endif // wxUSE_FILEDLG
|
|
|
|
#if wxUSE_FILEDLG
|
|
void OnExport(wxCommandEvent &WXUNUSED(event));
|
|
void OnImport(wxCommandEvent &WXUNUSED(event));
|
|
void OnImportAppend(wxCommandEvent &WXUNUSED(event));
|
|
#endif // wxUSE_FILEDLG
|
|
|
|
void OnQuit(wxCommandEvent &WXUNUSED(event));
|
|
void OnAbout(wxCommandEvent &WXUNUSED(event));
|
|
void OnCheckErrors(wxCommandEvent &WXUNUSED(event));
|
|
void OnAddWeightStage(wxCommandEvent &WXUNUSED(event));
|
|
void OnRemoveWeightStage(wxCommandEvent &WXUNUSED(event));
|
|
void OnAddWeightStageSub(wxCommandEvent &WXUNUSED(event));
|
|
void OnRemoveWeightStageSub(wxCommandEvent &WXUNUSED(event));
|
|
void OnClickCheckboxID(wxCommandEvent &);
|
|
|
|
MainPanel *m_panel_main;
|
|
StagesPanel *m_panel_stages;
|
|
// SpritesPanel *m_panel_sprites;
|
|
wxNotebook *m_notebook;
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
};
|
|
} // namespace SpeciesGen
|
|
|
|
#endif // SPECIESGEN_H
|