Date:2016-08-23 03:35:43 (7 years 3 months ago)
Author:Werner Almesberger
Commit:2adc6979b73e7bfab9edcbc7739e2dc32dca22a5
Message:eeshow/gui/gui.c: support using project file as leader (instead of top sheet)

Files: eeshow/gui/gui.c (6 diffs)

Change Details

eeshow/gui/gui.c
3434#include "kicad/pl.h"
3535#include "kicad/lib.h"
3636#include "kicad/sch.h"
37#include "kicad/pro.h"
3738#include "kicad/delta.h"
3839#include "gui/aoi.h"
3940#include "gui/input.h"
...... 
216217    const struct file_names *fn, bool recurse, struct gui_hist *prev)
217218{
218219    char *rev = NULL;
219    struct file sch_file;
220    struct file lib_files[fn->n_libs];
220    struct file pro_file, sch_file;
221221    struct file pl_file;
222    const struct file *leader = NULL;
222223    unsigned libs_open, i;
223224    bool libs_cached = 0;
224225    bool ok;
...... 
226227    if (hist->vcs_hist && hist->vcs_hist->commit)
227228        rev = vcs_git_get_rev(hist->vcs_hist);
228229
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    }
229249    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);
231251
232    if (rev)
233        free(rev);
252    free(rev);
234253    if (!ok) {
235254        sch_free(&hist->sch_ctx);
236255        return NULL;
237256    }
238257
258    if (!leader)
259        leader = &sch_file;
260
261    struct file lib_files[fn->n_libs];
262
239263    lib_init(&hist->lib);
240264    for (libs_open = 0; libs_open != fn->n_libs; libs_open++)
241265        if (!file_open(lib_files + libs_open, fn->libs[libs_open],
242            &sch_file))
266            leader))
243267            goto fail;
244268
245269    if (fn->pl) {
246        if (!file_open(&pl_file, fn->pl, &sch_file))
270        if (!file_open(&pl_file, fn->pl, leader))
247271            goto fail;
248272         hist->pl = pl_parse(&pl_file);
249273        file_close(&pl_file);
...... 
281305    for (i = 0; i != libs_open; i++)
282306        file_close(lib_files + i);
283307    file_close(&sch_file);
308    // @@@ close pro_file
284309
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))
286312        prev->identical = 1;
287313
288314    /*
...... 
300326    sch_free(&hist->sch_ctx);
301327    lib_free(&hist->lib);
302328    file_close(&sch_file);
329    // @@@ close pro_file
303330    return NULL;
304331}
305332
...... 
432459
433460    gtk_widget_show_all(window);
434461
435    get_history(&ctx, fn->sch, limit);
462    get_history(&ctx, fn->pro ? fn->pro : fn->sch, limit);
436463    if (ctx.hist_size)
437464        setup_progress_bar(&ctx, window);
438465

Archive Download the corresponding diff file

Branches:
master



interactive