2023-03-27 20:48:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 Mike Williams <mike@mikebwilliams.com>
|
|
|
|
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BOM_SETTINGS_H
|
|
|
|
#define _BOM_SETTINGS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <settings/json_settings.h>
|
|
|
|
#include <settings/parameters.h>
|
|
|
|
#include <i18n_utility.h>
|
|
|
|
|
|
|
|
// A single field within a BOM, e.g. Reference, Value, Footprint
|
2024-03-14 02:49:01 +00:00
|
|
|
struct KICOMMON_API BOM_FIELD
|
2023-03-27 20:48:37 +00:00
|
|
|
{
|
|
|
|
wxString name;
|
|
|
|
wxString label;
|
|
|
|
bool show = false;
|
|
|
|
bool groupBy = false;
|
|
|
|
|
|
|
|
bool operator==( const BOM_FIELD& rhs ) const;
|
|
|
|
};
|
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API bool operator!=( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
|
|
|
|
KICOMMON_API bool operator<( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API void to_json( nlohmann::json& j, const BOM_FIELD& f );
|
|
|
|
KICOMMON_API void from_json( const nlohmann::json& j, BOM_FIELD& f );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// A complete preset defining a BOM "View" with a list of all the fields to show,
|
|
|
|
// group by, order, filtering settings, etc.
|
2024-03-14 02:49:01 +00:00
|
|
|
struct KICOMMON_API BOM_PRESET
|
2023-03-27 20:48:37 +00:00
|
|
|
{
|
|
|
|
wxString name;
|
|
|
|
bool readOnly = false;
|
|
|
|
std::vector<BOM_FIELD> fieldsOrdered;
|
|
|
|
wxString sortField;
|
|
|
|
bool sortAsc = true;
|
|
|
|
wxString filterString;
|
|
|
|
bool groupSymbols = false;
|
2023-03-30 14:17:09 +00:00
|
|
|
bool excludeDNP = false;
|
2023-03-27 20:48:37 +00:00
|
|
|
|
|
|
|
bool operator==( const BOM_PRESET& rhs ) const;
|
|
|
|
|
|
|
|
static BOM_PRESET GroupedByValue();
|
|
|
|
static BOM_PRESET GroupedByValueFootprint();
|
2023-08-01 18:29:25 +00:00
|
|
|
static BOM_PRESET Attributes();
|
2023-09-20 14:54:37 +00:00
|
|
|
|
|
|
|
static std::vector<BOM_PRESET> BuiltInPresets();
|
2023-03-27 20:48:37 +00:00
|
|
|
};
|
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API bool operator!=( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
|
|
|
|
KICOMMON_API bool operator<( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API void to_json( nlohmann::json& j, const BOM_PRESET& f );
|
|
|
|
KICOMMON_API void from_json( const nlohmann::json& j, BOM_PRESET& f );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// A formatting preset, like CSV (Comma Separated Values)
|
2024-03-14 02:49:01 +00:00
|
|
|
struct KICOMMON_API BOM_FMT_PRESET
|
2023-03-27 20:48:37 +00:00
|
|
|
{
|
|
|
|
wxString name;
|
|
|
|
bool readOnly = false;
|
|
|
|
wxString fieldDelimiter;
|
|
|
|
wxString stringDelimiter;
|
|
|
|
wxString refDelimiter;
|
|
|
|
wxString refRangeDelimiter;
|
|
|
|
bool keepTabs = false;
|
|
|
|
bool keepLineBreaks = false;
|
|
|
|
|
|
|
|
bool operator==( const BOM_FMT_PRESET& rhs ) const;
|
|
|
|
|
|
|
|
static BOM_FMT_PRESET CSV();
|
|
|
|
static BOM_FMT_PRESET TSV();
|
|
|
|
static BOM_FMT_PRESET Semicolons();
|
2023-09-20 14:54:37 +00:00
|
|
|
|
|
|
|
static std::vector<BOM_FMT_PRESET> BuiltInPresets();
|
2023-03-27 20:48:37 +00:00
|
|
|
};
|
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API bool operator!=( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
|
|
|
|
KICOMMON_API bool operator<( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
2024-03-14 02:49:01 +00:00
|
|
|
KICOMMON_API void to_json( nlohmann::json& j, const BOM_FMT_PRESET& f );
|
|
|
|
KICOMMON_API void from_json( const nlohmann::json& j, BOM_FMT_PRESET& f );
|
2023-03-27 20:48:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|