KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_database_lib_settings.cpp File Reference
#include <algorithm>
#include <set>
#include <wx/app.h>
#include <wx/display.h>
#include <wx/filedlg.h>
#include <wx/filename.h>
#include <wx/menu.h>
#include <wx/regex.h>
#include <wx/settings.h>
#include <wx/stdpaths.h>
#include <wx/utils.h>
#include <bitmaps.h>
#include <confirm.h>
#include <core/kicad_algo.h>
#include <database/database_autofill.h>
#include <database/database_lib_settings.h>
#include <dialogs/dialog_database_lib_settings.h>
#include <eda_draw_frame.h>
#include <eeschema_settings.h>
#include <grid_tricks.h>
#include <i18n_utility.h>
#include <kiplatform/ui.h>
#include <lib_symbol.h>
#include <pgm_base.h>
#include <reporter.h>
#include <sch_io/database/sch_io_database.h>
#include <thread_pool.h>
#include <scoped_set_reset.h>
#include <settings/json_settings_internals.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <string_utils.h>
#include <widgets/db_lib_preview_panel.h>
#include <widgets/grid_combobox.h>
#include <widgets/std_bitmap_button.h>
#include <widgets/wx_grid.h>
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>

Go to the source code of this file.

Classes

struct  AUTOFILL_FIELD
 A symbol field that autofill maps from a like-named column. More...
 

Enumerations

enum  FIELD_COLUMNS {
  FIELD_COL_COLUMN = 0 , FIELD_COL_NAME , FIELD_COL_VISIBLE_ON_ADD , FIELD_COL_VISIBLE_IN_CHOOSER ,
  FIELD_COL_SHOW_NAME , FIELD_COL_INHERIT
}
 

Functions

static void relayoutPage (wxScrolledWindow *aPage)
 Re-lays out a scrolled page and refits its scroll area after its contents change size.
 
template<typename MAP>
static bool isAutofilled (const MAP &aAutofilled, const typename MAP::key_type &aKey, const std::string &aValue)
 True if autofill wrote aValue for aKey and the user has not changed it since.
 
static wxString displayName (const DATABASE_LIB_TABLE &aTable)
 
static wxString describeFailure (const DATABASE_CONNECTION &aConn, const DATABASE_SOURCE &aSource)
 
static const std::vector< AUTOFILL_FIELD > & autofillFields ()
 
static std::string fieldChoiceId (const char *aFieldName)
 
static DB_AUTOFILL::ROLE autofillRole (const std::string &aChoiceId, const std::vector< wxString > &aTerms)
 
static DATABASE_FIELD_MAPPING * findField (DATABASE_LIB_TABLE &aLib, const char *aName)
 

Variables

static constexpr size_t PREVIEW_ROW_LIMIT = 200
 Rows read for the Data page and preview; enough to judge a mapping without loading a whole table.
 
static constexpr int PREVIEW_MIN_WIDTH_DIP = 450
 Narrowest the preview next to the settings can be before its tree columns are cut off.
 
static constexpr int PREVIEW_DEBOUNCE_MS = 750
 Delay after the last edit before the preview is rebuilt.
 

Enumeration Type Documentation

◆ FIELD_COLUMNS

Enumerator
FIELD_COL_COLUMN 
FIELD_COL_NAME 
FIELD_COL_VISIBLE_ON_ADD 
FIELD_COL_VISIBLE_IN_CHOOSER 
FIELD_COL_SHOW_NAME 
FIELD_COL_INHERIT 

Definition at line 90 of file dialog_database_lib_settings.cpp.

Function Documentation

◆ autofillFields()

static const std::vector< AUTOFILL_FIELD > & autofillFields ( )
static

◆ autofillRole()

static DB_AUTOFILL::ROLE autofillRole ( const std::string & aChoiceId,
const std::vector< wxString > & aTerms )
static

◆ describeFailure()

◆ displayName()

◆ fieldChoiceId()

static std::string fieldChoiceId ( const char * aFieldName)
static

◆ findField()

◆ isAutofilled()

template<typename MAP>
static bool isAutofilled ( const MAP & aAutofilled,
const typename MAP::key_type & aKey,
const std::string & aValue )
static

True if autofill wrote aValue for aKey and the user has not changed it since.

Definition at line 82 of file dialog_database_lib_settings.cpp.

Referenced by DIALOG_DATABASE_LIB_SETTINGS::autofillColumns(), and DIALOG_DATABASE_LIB_SETTINGS::updateAutofillStyle().

◆ relayoutPage()

Variable Documentation

◆ PREVIEW_DEBOUNCE_MS

int PREVIEW_DEBOUNCE_MS = 750
staticconstexpr

Delay after the last edit before the preview is rebuilt.

Definition at line 70 of file dialog_database_lib_settings.cpp.

◆ PREVIEW_MIN_WIDTH_DIP

int PREVIEW_MIN_WIDTH_DIP = 450
staticconstexpr

Narrowest the preview next to the settings can be before its tree columns are cut off.

Definition at line 67 of file dialog_database_lib_settings.cpp.

Referenced by DIALOG_DATABASE_LIB_SETTINGS::onSplitterIdle().

◆ PREVIEW_ROW_LIMIT

size_t PREVIEW_ROW_LIMIT = 200
staticconstexpr

Rows read for the Data page and preview; enough to judge a mapping without loading a whole table.

Definition at line 64 of file dialog_database_lib_settings.cpp.

Referenced by DIALOG_DATABASE_LIB_SETTINGS::ensureSample(), DIALOG_DATABASE_LIB_SETTINGS::updateDataLabels(), and DIALOG_DATABASE_LIB_SETTINGS::updatePreview().