<commit_before>//
// Name: PlantDlg.cpp
//
// Copyright (c) 2001-2008 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifdef __GNUG__
	#pragma implementation "PlantDlg.cpp"
#endif

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "PlantDlg.h"
#include "vtlib/vtlib.h"
#include "vtlib/core/Trees.h"
#include "vtdata/vtLog.h"
#include "EnviroGUI.h"

// helper
void InsertSortedString(wxChoice *ch, const wxString &str)
{
	unsigned int i;
	for (i = 0; i < ch->GetCount(); i++)
	{
		if (str < ch->GetString(i))
			break;
	}
	ch->Insert(str, i);
	return;
}

// WDR: class implementations

//---------------------------------------------------------------------------
// PlantDlg
//---------------------------------------------------------------------------

// WDR: event table for PlantDlg

BEGIN_EVENT_TABLE(PlantDlg,AutoDialog)
	EVT_INIT_DIALOG (PlantDlg::OnInitDialog)
	EVT_TEXT( ID_PLANT_HEIGHT_EDIT, PlantDlg::OnHeightEdit )
	EVT_SLIDER( ID_HEIGHT_SLIDER, PlantDlg::OnHeightSlider )
	EVT_CHOICE( ID_SPECIES, PlantDlg::OnSelChangeSpecies )
	EVT_TEXT( ID_PLANT_SPACING_EDIT, PlantDlg::OnSpacingEdit )
	EVT_RADIOBUTTON( ID_PLANT_INDIVIDUAL, PlantDlg::OnRadio )
	EVT_RADIOBUTTON( ID_PLANT_LINEAR, PlantDlg::OnRadio )
	EVT_RADIOBUTTON( ID_PLANT_CONTINUOUS, PlantDlg::OnRadio )
	EVT_TEXT( ID_PLANT_VARIANCE_EDIT, PlantDlg::OnVariance )
	EVT_SLIDER( ID_PLANT_VARIANCE_SLIDER, PlantDlg::OnVarianceSlider )
	EVT_CHECKBOX( ID_COMMON_NAMES, PlantDlg::OnCommonNames )
	EVT_CHOICE( ID_LANGUAGE, PlantDlg::OnLanguage )
END_EVENT_TABLE()

PlantDlg::PlantDlg( wxWindow *parent, wxWindowID id, const wxString &title,
	const wxPoint &position, const wxSize& size, long style ) :
	AutoDialog( parent, id, title, position, size, style )
{
	VTLOG1("PlantDlg constructing\n");
	PlantDialogFunc( this, TRUE );

	m_pHeightSlider = GetHeightSlider();
	m_pSpecies = GetSpecies();
	m_bSetting = false;
	m_bCommonNames = true;
	m_iLanguage = 0;
	m_iSpeciesChoice = -1;
	m_strLang = _T("en");

	m_opt.m_fSpacing = 2;

	AddValidator(ID_SPECIES, &m_iSpeciesChoice);
	AddValidator(ID_COMMON_NAMES, &m_bCommonNames);
	AddValidator(ID_LANGUAGE, &m_iLanguage);
	AddNumValidator(ID_PLANT_HEIGHT_EDIT, &m_opt.m_fHeight);
	AddNumValidator(ID_PLANT_SPACING_EDIT, &m_opt.m_fSpacing);

	AddNumValidator(ID_PLANT_VARIANCE_EDIT, &m_opt.m_iVariance);
	AddValidator(ID_PLANT_VARIANCE_SLIDER, &m_iVarianceSlider);
}

PlantDlg::~PlantDlg()
{
}

void PlantDlg::SetLang(const wxString &strTwoLetterLangCode)
{
	m_strLang = strTwoLetterLangCode.Left(2);
}

void PlantDlg::SetPlantList(vtSpeciesList3d *plants)
{
	VTLOG1("PlantDlg SetPlantList: ");
	if (plants)
		VTLOG("%d plants\n", plants->NumSpecies());
	else
		VTLOG1("no plant list\n");
	if (m_pPlantList == plants)
		return;
	m_pPlantList = plants;
	UpdateAvailableLanguages();
	UpdatePlantSizes();
	UpdatePlantNames();
}<commit_msg>limit numerics to 2 decimals (cm) for easier entry<commit_after>//
// Name: PlantDlg.cpp
//
// Copyright (c) 2001-2008 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifdef __GNUG__
	#pragma implementation "PlantDlg.cpp"
#endif

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "PlantDlg.h"
#include "vtlib/vtlib.h"
#include "vtlib/core/Trees.h"
#include "vtdata/vtLog.h"
#include "EnviroGUI.h"

// helper
void InsertSortedString(wxChoice *ch, const wxString &str)
{
	unsigned int i;
	for (i = 0; i < ch->GetCount(); i++)
	{
		if (str < ch->GetString(i))
			break;
	}
	ch->Insert(str, i);
	return;
}

// WDR: class implementations

//---------------------------------------------------------------------------
// PlantDlg
//---------------------------------------------------------------------------

// WDR: event table for PlantDlg

BEGIN_EVENT_TABLE(PlantDlg,AutoDialog)
	EVT_INIT_DIALOG (PlantDlg::OnInitDialog)
	EVT_TEXT( ID_PLANT_HEIGHT_EDIT, PlantDlg::OnHeightEdit )
	EVT_SLIDER( ID_HEIGHT_SLIDER, PlantDlg::OnHeightSlider )
	EVT_CHOICE( ID_SPECIES, PlantDlg::OnSelChangeSpecies )
	EVT_TEXT( ID_PLANT_SPACING_EDIT, PlantDlg::OnSpacingEdit )
	EVT_RADIOBUTTON( ID_PLANT_INDIVIDUAL, PlantDlg::OnRadio )
	EVT_RADIOBUTTON( ID_PLANT_LINEAR, PlantDlg::OnRadio )
	EVT_RADIOBUTTON( ID_PLANT_CONTINUOUS, PlantDlg::OnRadio )
	EVT_TEXT( ID_PLANT_VARIANCE_EDIT, PlantDlg::OnVariance )
	EVT_SLIDER( ID_PLANT_VARIANCE_SLIDER, PlantDlg::OnVarianceSlider )
	EVT_CHECKBOX( ID_COMMON_NAMES, PlantDlg::OnCommonNames )
	EVT_CHOICE( ID_LANGUAGE, PlantDlg::OnLanguage )
END_EVENT_TABLE()

PlantDlg::PlantDlg( wxWindow *parent, wxWindowID id, const wxString &title,
	const wxPoint &position, const wxSize& size, long style ) :
	AutoDialog( parent, id, title, position, size, style )
{
	VTLOG1("PlantDlg constructing\n");
	PlantDialogFunc( this, TRUE );

	m_pHeightSlider = GetHeightSlider();
	m_pSpecies = GetSpecies();
	m_bSetting = false;
	m_bCommonNames = true;
	m_iLanguage = 0;
	m_iSpeciesChoice = -1;
	m_strLang = _T("en");

	m_opt.m_fSpacing = 2;

	AddValidator(ID_SPECIES, &m_iSpeciesChoice);
	AddValidator(ID_COMMON_NAMES, &m_bCommonNames);
	AddValidator(ID_LANGUAGE, &m_iLanguage);
	AddNumValidator(ID_PLANT_HEIGHT_EDIT, &m_opt.m_fHeight, 2);		// 2 digits = cm
	AddNumValidator(ID_PLANT_SPACING_EDIT, &m_opt.m_fSpacing, 2);

	AddNumValidator(ID_PLANT_VARIANCE_EDIT, &m_opt.m_iVariance);
	AddValidator(ID_PLANT_VARIANCE_SLIDER, &m_iVarianceSlider);
}

PlantDlg::~PlantDlg()
{
}

void PlantDlg::SetLang(const wxString &strTwoLetterLangCode)
{
	m_strLang = strTwoLetterLangCode.Left(2);
}

void PlantDlg::SetPlantList(vtSpeciesList3d *plants)
{
	VTLOG1("PlantDlg SetPlantList: ");
	if (plants)
		VTLOG("%d plants\n", plants->NumSpecies());
	else
		VTLOG1("no plant list\n");
	if (m_pPlantList == plants)
		return;
	m_pPlantList = plants;
	UpdateAvailableLanguages();
	UpdatePlantSizes();
	UpdatePlantNames();
}
{'fraction_non_alphanumeric': 0.16897414512093412, 'fraction_numerical': 0.00633861551292744, 'mean_word_length': 4.436083408884859, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6324792', 'n_tokens_mistral': 2360, 'n_tokens_neox': 2358, 'n_words': 421}