<commit_before>/*************
 *  Toolbox  *
 *************/

var current_tool;

var button_color_inactive = new HsbColor(250, 0.6, 0.45);
var button_color_active = new HsbColor(120, 0.6, 0.45);

var button_size = new Size(150, 40);
var button_corners = new Size(5, 5);
var button_text_offset = new Point(10, 25);
var button_hotkey_offset = new Point(button_size.width - 30, 25);

function make_button(label, hotkey, x, y) {
	var rectangle = new Rectangle(new Point(x, y), button_size);

	var button = new Path.RoundRectangle(rectangle, button_corners);
	button.fillColor = button_color_inactive;

	var label_text = new PointText(rectangle.point + button_text_offset);
	label_text.content = label;
	label_text.characterStyle.fillColor = 'white';

	var hotkey_text = new PointText(rectangle.point + button_hotkey_offset);
	hotkey_text.content = '[' + hotkey + ']';
	hotkey_text.characterStyle.fillColor = 'white';

	return new Group([button, label_text, hotkey_text]);
}

var toolbox_buttons =
	{ add_vertex: make_button('Add vertex', 'V', 10, 10)
	, remove_vertex: make_button('Remove vertex', 'R', 10, 55)
	, add_edge: make_button('Add edge', 'E', 10, 100)
	, delete_edge: make_button('Delete edge', 'D', 10, 145)
}

function set_button_color(button, color) {
	button.firstChild.fillColor = color;
}

function set_active_tool(name) {<commit_msg>Dynamically generate the toolbox<commit_after>/*************
 *  Toolbox  *
 *************/

var current_tool;

var button_color_inactive = new HsbColor(250, 0.6, 0.45);
var button_color_active = new HsbColor(120, 0.6, 0.45);

var button_size = new Size(150, 40);
var button_corners = new Size(5, 5);
var button_text_offset = new Point(10, 25);
var button_hotkey_offset = new Point(button_size.width - 30, 25);

function make_button(label, hotkey, x, y) {
	var rectangle = new Rectangle(new Point(x, y), button_size);

	var button = new Path.RoundRectangle(rectangle, button_corners);
	button.fillColor = button_color_inactive;

	var label_text = new PointText(rectangle.point + button_text_offset);
	label_text.content = label;
	label_text.characterStyle.fillColor = 'white';

	var hotkey_text = new PointText(rectangle.point + button_hotkey_offset);
	hotkey_text.content = '[' + hotkey + ']';
	hotkey_text.characterStyle.fillColor = 'white';

	return new Group([button, label_text, hotkey_text]);
}

var toolbox_buttons = {};
var toolbox_button_ypos = 10;

function add_toolbox_button(name, label, hotkey) {
	toolbox_buttons[name] = make_button(label, hotkey, 10, toolbox_button_ypos);

	toolbox_button_ypos += button_size.height + 5;
}

add_toolbox_button('add_vertex', 'Add vertex', 'V');
add_toolbox_button('remove_vertex', 'Remove vertex', 'R');
add_toolbox_button('add_edge', 'Add edge', 'E');
add_toolbox_button('delete_edge', 'Delete edge', 'D');

function set_button_color(button, color) {
	button.firstChild.fillColor = color;
}

function set_active_tool(name) {
{'fraction_non_alphanumeric': 0.144570058239123, 'fraction_numerical': 0.029119561493662214, 'mean_word_length': 6.104622871046229, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1621491', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1019, 'n_words': 234}