return ;
}
-void schema_switch_mode(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets, t_position pos)
+void schema_switch_node(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets, t_position pos)
{
t_node *chosen_node;
return ;
}
+void schema_reverse_switch_node(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets, t_position pos)
+{
+ t_node *chosen_node;
+
+ chosen_node = find_node_at_pos(nodes, pos);
+ if (!chosen_node)
+ return ;
+ if (chosen_node->set_state == off)
+ chosen_node->set_state = unknown;
+ else
+ --chosen_node->set_state;
+ update_nodes(nodes, mosfets);
+ refresh_schema_win(schematics_win, nodes, mosfets);
+ wmove(schematics_win, pos.y, pos.x);
+ return ;
+}
+
int schema_next(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets, t_position pos)
{
if (sim_step(nodes, mosfets))
else if (ch == 'c')
schema_user_draw_node(schematics_win, nodes, mosfets, pos);
else if (ch == 's')
- schema_switch_mode(schematics_win, nodes, mosfets, pos);
+ schema_switch_node(schematics_win, nodes, mosfets, pos);
+ else if (ch == 'S')
+ schema_reverse_switch_node(schematics_win, nodes, mosfets, pos);
else if (ch == 'n')
schema_next(schematics_win, nodes, mosfets, pos);
return (0);