2020-05-31 21:42:04 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 CERN
|
2021-06-08 17:47:06 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-05-31 21:42:04 +00:00
|
|
|
* @author Jon Evans <jon@craftyjon.com>
|
|
|
|
*
|
|
|
|
* 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 KICAD_PROJECT_LOCAL_SETTINGS_H
|
|
|
|
#define KICAD_PROJECT_LOCAL_SETTINGS_H
|
|
|
|
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2020-07-11 17:40:23 +00:00
|
|
|
#include <project/board_project_settings.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
#include <settings/json_settings.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2020-08-24 02:01:14 +00:00
|
|
|
#include <settings/app_settings.h>
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
class PROJECT;
|
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
struct PROJECT_FILE_STATE
|
|
|
|
{
|
|
|
|
wxString fileName;
|
|
|
|
bool open;
|
|
|
|
struct WINDOW_STATE window;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
/**
|
|
|
|
* The project local settings are things that are attached to a particular project, but also might
|
|
|
|
* be particular to a certain user editing that project, or change quickly, and therefore may not
|
|
|
|
* want to be checked in to version control or otherwise distributed with the main project.
|
|
|
|
*
|
|
|
|
* Examples include layer visibility, recently-used design entry settings, and so on.
|
|
|
|
*
|
|
|
|
* The backing store is a JSON file named <project>.kicad_prl
|
|
|
|
*
|
|
|
|
* This file doesn't need to exist for a project to be loaded. It will be created on-demand if
|
|
|
|
* any of the things stored here are modified by the user.
|
|
|
|
*/
|
|
|
|
class PROJECT_LOCAL_SETTINGS : public JSON_SETTINGS
|
|
|
|
{
|
|
|
|
public:
|
2020-08-16 14:17:20 +00:00
|
|
|
PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxString& aFilename );
|
2020-05-31 21:42:04 +00:00
|
|
|
|
|
|
|
virtual ~PROJECT_LOCAL_SETTINGS() {}
|
|
|
|
|
|
|
|
bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
|
|
|
|
2021-11-09 17:24:53 +00:00
|
|
|
bool SaveAs( const wxString& aDirectory, const wxString& aFile );
|
|
|
|
|
2020-08-02 09:23:21 +00:00
|
|
|
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2021-12-26 00:36:12 +00:00
|
|
|
void SetProject( PROJECT* aProject ) { m_project = aProject; }
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2021-06-08 17:47:06 +00:00
|
|
|
void SaveFileState( const wxString& aFileName, const WINDOW_SETTINGS* aWindowCfg, bool aOpen );
|
|
|
|
|
|
|
|
const PROJECT_FILE_STATE* GetFileState( const wxString& aFileName );
|
|
|
|
|
|
|
|
void ClearFileState();
|
2020-05-31 21:42:04 +00:00
|
|
|
|
2021-06-08 17:47:06 +00:00
|
|
|
protected:
|
2020-05-31 21:42:04 +00:00
|
|
|
wxString getFileExt() const override
|
|
|
|
{
|
|
|
|
return ProjectLocalSettingsFileExtension;
|
|
|
|
}
|
|
|
|
|
2020-07-05 16:25:04 +00:00
|
|
|
wxString getLegacyFileExt() const override
|
|
|
|
{
|
|
|
|
return wxT( "NO_SUCH_FILE_EXTENSION" );
|
|
|
|
}
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
public:
|
|
|
|
|
2020-08-24 02:01:14 +00:00
|
|
|
/**
|
|
|
|
* Project scope
|
|
|
|
*/
|
|
|
|
|
|
|
|
/// File based state
|
|
|
|
std::vector<PROJECT_FILE_STATE> m_files;
|
|
|
|
|
2020-05-31 21:42:04 +00:00
|
|
|
/**
|
|
|
|
* Board settings
|
|
|
|
*/
|
|
|
|
|
|
|
|
/// The board layers that are turned on for viewing (@see PCB_LAYER_ID)
|
|
|
|
LSET m_VisibleLayers;
|
|
|
|
|
|
|
|
/// The GAL layers (aka items) that are turned on for viewing (@see GAL_LAYER_ID)
|
|
|
|
GAL_SET m_VisibleItems;
|
2020-07-07 01:53:12 +00:00
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
/// The current (active) board layer for editing
|
|
|
|
PCB_LAYER_ID m_ActiveLayer;
|
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
/// The name of a LAYER_PRESET that is currently activated (or blank if none)
|
|
|
|
wxString m_ActiveLayerPreset;
|
|
|
|
|
|
|
|
/// The current contrast mode
|
|
|
|
HIGH_CONTRAST_MODE m_ContrastModeDisplay;
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
/// The current net color mode
|
|
|
|
NET_COLOR_MODE m_NetColorMode;
|
|
|
|
|
2021-01-07 04:11:06 +00:00
|
|
|
/// The current setting for whether to automatically adjust track widths to match
|
|
|
|
bool m_AutoTrackWidth;
|
|
|
|
|
2020-12-29 22:19:01 +00:00
|
|
|
/// How zones are drawn
|
2020-07-11 17:42:00 +00:00
|
|
|
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
|
|
|
|
|
|
|
|
double m_TrackOpacity; ///< Opacity override for all tracks
|
|
|
|
double m_ViaOpacity; ///< Opacity override for all types of via
|
|
|
|
double m_PadOpacity; ///< Opacity override for SMD pads and PTH
|
|
|
|
double m_ZoneOpacity; ///< Opacity override for filled zones
|
2022-06-27 18:07:52 +00:00
|
|
|
double m_ImageOpacity; ///< Opacity override for user images
|
2020-07-11 17:42:00 +00:00
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
/**
|
|
|
|
* A list of netnames that have been manually hidden in the board editor.
|
|
|
|
* Currently, hiding nets means hiding the ratsnest for those nets.
|
|
|
|
*/
|
|
|
|
std::vector<wxString> m_HiddenNets;
|
2022-10-01 23:53:39 +00:00
|
|
|
std::set<wxString> m_HiddenNetclasses;
|
2020-07-11 01:06:17 +00:00
|
|
|
|
2020-07-07 01:53:12 +00:00
|
|
|
/// State of the selection filter widget
|
|
|
|
SELECTION_FILTER_OPTIONS m_SelectionFilter;
|
2020-08-24 02:01:14 +00:00
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
// Upstream git repo info
|
|
|
|
wxString m_GitRepoUsername;
|
|
|
|
wxString m_GitRepoPassword;
|
|
|
|
wxString m_GitRepoType;
|
|
|
|
wxString m_GitSSHKey;
|
|
|
|
|
2021-06-08 17:47:06 +00:00
|
|
|
private:
|
|
|
|
/// A link to the owning project
|
|
|
|
PROJECT* m_project;
|
2020-05-31 21:42:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|