]> git.donarmstrong.com Git - samtools.git/commitdiff
cont
authorPierre Lindenbaum <plindenbaum@yahoo.fr>
Fri, 25 Jan 2013 07:14:22 +0000 (08:14 +0100)
committerPierre Lindenbaum <plindenbaum@yahoo.fr>
Fri, 25 Jan 2013 07:14:22 +0000 (08:14 +0100)
bam_tview.c
bam_tview_curses.c
bam_tview_curses.h

index 165eadda02fdfef828733b97bd8edaabbc3a5f5c..183630a0ef44d743324cfdad1842f9a2ede4ea23 100644 (file)
@@ -8,7 +8,7 @@ int base_tv_init(tview_t* tv,const char *fn, const char *fn_fa, const char *samp
        tv->mrow = 24; tv->mcol = 80;
        tv->color_for = TV_COLOR_MAPQ;
        tv->is_dot = 1;
-       fprintf(stderr,"Opening '%s'\n",fn);
+       
        tv->fp = bam_open(fn, "r");
        if(tv->fp==0)
                {
@@ -17,7 +17,7 @@ int base_tv_init(tview_t* tv,const char *fn, const char *fn_fa, const char *samp
                }
        bgzf_set_cache_size(tv->fp, 8 * 1024 *1024);
        assert(tv->fp);
-       fprintf(stderr,"Opening header '%s'\n",fn);
+       
        tv->header = bam_header_read(tv->fp);
        if(tv->header==0)
                {
@@ -25,7 +25,11 @@ int base_tv_init(tview_t* tv,const char *fn, const char *fn_fa, const char *samp
                exit(EXIT_FAILURE);
                }
        tv->idx = bam_index_load(fn);
-       if (tv->idx == 0) exit(1);
+       if (tv->idx == 0)
+               {
+               fprintf(stderr,"Cannot read index for '%s'.\n", fn);
+               exit(EXIT_FAILURE);
+               }
        tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv);
        if (fn_fa) tv->fai = fai_load(fn_fa);
        tv->bca = bcf_call_init(0.83, 13);
index 571633c817b1e7a9fd899817c7972269898f5547..0c18ac7834b63b6a97fedb5c21f6ff8cb2e71e88 100644 (file)
@@ -16,6 +16,40 @@ static void curses_tv_destroy(tview_t* base)
        free(tv);
        }
 
+/*
+ void (*my_mvprintw)(struct AbstractTview* ,int,int,const char*,...);
+    void (*my_)(struct AbstractTview*,int,int,int);
+    void (*my_attron)(struct AbstractTview*,int);
+    void (*my_attroff)(struct AbstractTview*,int);
+    void (*my_clear)(struct AbstractTview*);
+    int (*my_colorpair)(struct AbstractTview*,int);
+*/
+
+static void curses_mvprintw(struct AbstractTview* tv,int y ,int x,const char* fmt,...)
+       {
+       }
+static void curses_mvaddch(struct AbstractTview* tv,int y,int x,int ch)
+       {
+       }
+static void curses_attron(struct AbstractTview* tv,int flag)
+    {
+    }
+static void curses_attroff(struct AbstractTview* tv,int flag)
+    {
+    }
+static void curses_clear(struct AbstractTview* tv)
+    {
+    }
+    
+static int curses_colorpair(struct AbstractTview* tv,int flag)
+    {
+    }
+
+
+#define SET_CALLBACK(fun) base->my_##fun=curses_##fun;
+
+
+
 curses_tview_t* curses_tv_init(const char *fn, const char *fn_fa, const char *samples)
        {
        curses_tview_t *tv = (curses_tview_t*)calloc(1, sizeof(curses_tview_t));
@@ -28,7 +62,13 @@ curses_tview_t* curses_tv_init(const char *fn, const char *fn_fa, const char *sa
        
        base_tv_init(base,fn,fn_fa,samples);
        /* initialize callbacks */
-       base->destroy=curses_tv_destroy;
+       SET_CALLBACK(destroy);
+       SET_CALLBACK(mvprintw);
+       SET_CALLBACK(mvaddch);
+       SET_CALLBACK(attron);
+       SET_CALLBACK(attroff);
+       SET_CALLBACK(clear);
+       SET_CALLBACK(colorpair);
        
        initscr();
        keypad(stdscr, TRUE);
index 1d616d61d9a5da85d9c20963f7ec096ee1ac0b9e..ef9b20a6c6b74ca082f3b9b0dae0954001623e9d 100644 (file)
@@ -5,7 +5,7 @@
 #include "bam_tview.h"
 
 typedef struct CursesTview {
-       struct AbstractTview* view;
+       tview_t view;
        WINDOW *wgoto, *whelp;
        } curses_tview_t;