bind,
help,
connect,
+ refresh_schema,
switch_to_schema,
exitsim,
} t_command;
int c_help(WINDOW *command_win, t_input input);
int c_next(t_input input, t_vec *nodes, t_vec *mosfets);
int c_setnode(WINDOW *command_win, t_input input, t_vec *nodes);
-
+int refresh_schema_win(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets);
int schema_mode(WINDOW *schematics_win, t_vec *nodes, t_vec *mosfets);
#endif //FET_SIM_H
draw_bottom(command_win, mosfet);
return ;
}
+
+int refresh_schema_win(WINDOW *schematics_win, __attribute__((unused)) t_vec *nodes, t_vec *mosfets)
+{
+ size_t i;
+ const t_mosfet *mosfet;
+
+ werase(schematics_win);
+ i = 0;
+ while (i < mosfets->size)
+ {
+ mosfet = ft_vec_caccess(mosfets, i);
+ schema_draw_mosfet(schematics_win, mosfet);
+ ++i;
+ }
+ wrefresh(schematics_win);
+ return (1);
+}
{
if (!ft_strcmp(str, "n") || !ft_strcmp(str, "next"))
*cmd = next;
+ else if (!ft_strcmp(str, "r") || !ft_strcmp(str, "refresh"))
+ *cmd = refresh_schema;
else if (!ft_strcmp(str, "d") || !ft_strcmp(str, "draw"))
*cmd = draw;
else if (!ft_strcmp(str, "s") || !ft_strcmp(str, "set") || !ft_strcmp(str, "setnode"))
return (0);
if (c == connect && argc != 4)
return (0);
- if (c == switch_to_schema && argc > 0)
+ if ((c == switch_to_schema || c == refresh_schema) && argc > 0)
return (0);
return (1);
}
res = c_connect(windows->command_win, input, nodes, mosfets);
else if (input.command == help)
res = c_help(windows->command_win, input);
+ else if(input.command == refresh_schema)
+ res = refresh_schema_win(windows->schematics_win, nodes, mosfets);
else if (input.command == switch_to_schema)
res = schema_mode(windows->schematics_win, nodes, mosfets);
else if (input.command == exitsim)