eeshow/gui/gui.c |
34 | 34 | #include "kicad/pl.h" |
35 | 35 | #include "kicad/lib.h" |
36 | 36 | #include "kicad/sch.h" |
| 37 | #include "kicad/pro.h" |
37 | 38 | #include "kicad/delta.h" |
38 | 39 | #include "gui/aoi.h" |
39 | 40 | #include "gui/input.h" |
... | ... | |
216 | 217 | const struct file_names *fn, bool recurse, struct gui_hist *prev) |
217 | 218 | { |
218 | 219 | char *rev = NULL; |
219 | | struct file sch_file; |
220 | | struct file lib_files[fn->n_libs]; |
| 220 | struct file pro_file, sch_file; |
221 | 221 | struct file pl_file; |
| 222 | const struct file *leader = NULL; |
222 | 223 | unsigned libs_open, i; |
223 | 224 | bool libs_cached = 0; |
224 | 225 | bool ok; |
... | ... | |
226 | 227 | if (hist->vcs_hist && hist->vcs_hist->commit) |
227 | 228 | rev = vcs_git_get_rev(hist->vcs_hist); |
228 | 229 | |
| 230 | if (fn->pro) { |
| 231 | if (file_open_revision(&pro_file, rev, fn->pro, NULL)) { |
| 232 | free(rev); |
| 233 | rev = NULL; /* thus sch_file opens as with file_open */ |
| 234 | fn = pro_parse_file(&pro_file, fn); |
| 235 | if (!fn) |
| 236 | return NULL; |
| 237 | leader = &pro_file; |
| 238 | } else { |
| 239 | /* |
| 240 | * If we happen to have a top sheet name, we may as |
| 241 | * well try to use it. |
| 242 | */ |
| 243 | if (!fn->sch) { |
| 244 | free(rev); |
| 245 | return NULL; |
| 246 | } |
| 247 | } |
| 248 | } |
229 | 249 | sch_init(&hist->sch_ctx, recurse); |
230 | | ok = file_open_revision(&sch_file, rev, fn->sch, NULL); |
| 250 | ok = file_open_revision(&sch_file, rev, fn->sch, leader); |
231 | 251 | |
232 | | if (rev) |
233 | | free(rev); |
| 252 | free(rev); |
234 | 253 | if (!ok) { |
235 | 254 | sch_free(&hist->sch_ctx); |
236 | 255 | return NULL; |
237 | 256 | } |
238 | 257 | |
| 258 | if (!leader) |
| 259 | leader = &sch_file; |
| 260 | |
| 261 | struct file lib_files[fn->n_libs]; |
| 262 | |
239 | 263 | lib_init(&hist->lib); |
240 | 264 | for (libs_open = 0; libs_open != fn->n_libs; libs_open++) |
241 | 265 | if (!file_open(lib_files + libs_open, fn->libs[libs_open], |
242 | | &sch_file)) |
| 266 | leader)) |
243 | 267 | goto fail; |
244 | 268 | |
245 | 269 | if (fn->pl) { |
246 | | if (!file_open(&pl_file, fn->pl, &sch_file)) |
| 270 | if (!file_open(&pl_file, fn->pl, leader)) |
247 | 271 | goto fail; |
248 | 272 | hist->pl = pl_parse(&pl_file); |
249 | 273 | file_close(&pl_file); |
... | ... | |
281 | 305 | for (i = 0; i != libs_open; i++) |
282 | 306 | file_close(lib_files + i); |
283 | 307 | file_close(&sch_file); |
| 308 | // @@@ close pro_file |
284 | 309 | |
285 | | if (prev && sheet_eq(prev->sch_ctx.sheets, hist->sch_ctx.sheets)) |
| 310 | if (prev && prev->sheets && |
| 311 | sheet_eq(prev->sch_ctx.sheets, hist->sch_ctx.sheets)) |
286 | 312 | prev->identical = 1; |
287 | 313 | |
288 | 314 | /* |
... | ... | |
300 | 326 | sch_free(&hist->sch_ctx); |
301 | 327 | lib_free(&hist->lib); |
302 | 328 | file_close(&sch_file); |
| 329 | // @@@ close pro_file |
303 | 330 | return NULL; |
304 | 331 | } |
305 | 332 | |
... | ... | |
432 | 459 | |
433 | 460 | gtk_widget_show_all(window); |
434 | 461 | |
435 | | get_history(&ctx, fn->sch, limit); |
| 462 | get_history(&ctx, fn->pro ? fn->pro : fn->sch, limit); |
436 | 463 | if (ctx.hist_size) |
437 | 464 | setup_progress_bar(&ctx, window); |
438 | 465 | |