source: tags/ms_r18q1/NTREE/ColumnStat_2_gnuplot.cxx

Last change on this file was 16763, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.7 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : ColumnStat_2_gnuplot.cxx                          //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#include "NT_local.h"
12
13#include <ColumnStat.hxx>
14#include <AP_filter.hxx>
15#include <awt_filter.hxx>
16#include <aw_awars.hxx>
17#include <aw_file.hxx>
18#include <aw_msg.hxx>
19#include <aw_root.hxx>
20#include <aw_select.hxx>
21#include <arbdbt.h>
22#include <arb_file.h>
23
24#include <unistd.h>
25
26#define AWAR_CS2GP "tmp/ntree/colstat_2_gnuplot"
27
28#define AWAR_CS2GP_NAME      AWAR_CS2GP "/name"
29#define AWAR_CS2GP_SUFFIX    AWAR_CS2GP "/filter"
30#define AWAR_CS2GP_DIRECTORY AWAR_CS2GP "/directory"
31#define AWAR_CS2GP_FILENAME  AWAR_CS2GP "/file_name"
32
33#define AWAR_CS2GP_SMOOTH_VALUES           AWAR_CS2GP "/smooth_values"
34#define AWAR_CS2GP_SMOOTH_GNUPLOT          AWAR_CS2GP "/smooth_gnuplot"
35#define AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX  AWAR_CS2GP "/gnuplot_overlay_prefix"
36#define AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX AWAR_CS2GP "/gnuplot_overlay_postfix"
37#define AWAR_CS2GP_FILTER_NAME             AWAR_CS2GP "/ap_filter/name"
38
39static GB_ERROR split_stat_filename(const char *fname, char **dirPtr, char **name_prefixPtr, char **name_postfixPtr) {
40    // 'fname' is sth like 'directory/prefix.sth_gnu'
41    // 'dirPtr' is set to a malloc-copy of 'directory'
42    // 'name_prefixPtr' is set to a malloc-copy of 'prefix' (defaults to '*')
43    // 'name_postfixPtr' is set to a malloc-copy of 'sth_gnu' (defaults to '*_gnu')
44
45    *dirPtr          = NULp;
46    *name_prefixPtr  = NULp;
47    *name_postfixPtr = NULp;
48
49    const char *lslash = strrchr(fname, '/');
50    if (!lslash) return GB_export_errorf("'%s' has to contain a '/'", fname);
51
52    char *dir         = ARB_strdup(fname);
53    dir[lslash-fname] = 0; // cut off at last '/'
54
55    char *name_prefix  = ARB_strdup(lslash+1);
56    char *name_postfix = NULp;
57    char *ldot         = strrchr(name_prefix, '.');
58
59    if (ldot) {
60        ldot[0]      = 0;
61        name_postfix = ARB_strdup(ldot+1);
62    }
63    if (!ldot || name_prefix[0] == 0) freedup(name_prefix, "*"); // no dot or empty name_prefix
64    if (!name_postfix || name_postfix[0] == 0) freedup(name_postfix, "*_gnu");
65
66    nt_assert(name_prefix);
67    nt_assert(name_postfix);
68
69    *dirPtr          = dir;
70    *name_prefixPtr  = name_prefix;
71    *name_postfixPtr = name_postfix;
72
73    return NULp;
74}
75
76static char * get_overlay_files(AW_root *awr, const char *fname, GB_ERROR& error) {
77    nt_assert(!error);
78
79    bool overlay_prefix  = awr->awar(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX)->read_int();
80    bool overlay_postfix = awr->awar(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX)->read_int();
81
82    char *dir, *name_prefix, *name_postfix;
83    error = split_stat_filename(fname, &dir, &name_prefix, &name_postfix);
84
85    char *found_files = NULp;
86    if (!error) {
87        char *found_prefix_files  = NULp;
88        char *found_postfix_files = NULp;
89
90        if (overlay_prefix || overlay_postfix) {
91            char *mask = GBS_global_string_copy("%s.*_gnu", name_prefix);
92            if (overlay_prefix) {
93#if defined(WARN_TODO)
94#warning change error handling for GB_find_all_files() - globally!
95#endif
96                found_prefix_files             = GB_find_all_files(dir, mask, false);
97                if (!found_prefix_files) error = GB_get_error();
98            }
99            free(mask);
100
101            if (!error) {
102                mask = GBS_global_string_copy("*.%s", name_postfix);
103                if (overlay_postfix) {
104                    found_postfix_files             = GB_find_all_files(dir, mask, false);
105                    if (!found_postfix_files) error = GB_get_error();
106                }
107                free(mask);
108            }
109        }
110
111        if (!error) {
112            if (found_prefix_files) {
113                if (found_postfix_files) {
114                    found_files = GBS_global_string_copy("%s*%s", found_prefix_files, found_postfix_files);
115                }
116                else { // only found_prefix_files
117                    found_files        = found_prefix_files;
118                    found_prefix_files = NULp;
119                }
120            }
121            else {
122                found_files         = found_postfix_files;
123                found_postfix_files = NULp;
124            }
125        }
126
127        free(found_postfix_files);
128        free(found_prefix_files);
129    }
130
131    free(name_postfix);
132    free(name_prefix);
133    free(dir);
134
135    return found_files;
136}
137
138enum PlotType {
139    PT_GC_RATIO,
140    PT_GA_RATIO,
141    PT_RATE,
142    PT_TT_RATIO,
143    PT_MOST_FREQUENT_BASE,
144    PT_SECOND_FREQUENT_BASE,
145    PT_THIRD_FREQUENT_BASE,
146    PT_LEAST_FREQUENT_BASE,
147    PT_BASE_A,
148    PT_BASE_C,
149    PT_BASE_G,
150    PT_BASE_TU,
151    PT_HELIX,
152
153    PT_PLOT_TYPES,
154    PT_UNKNOWN
155};
156
157static const char *plotTypeName[PT_PLOT_TYPES] = {
158    "gc_gnu",
159    "ga_gnu",
160    "rate_gnu",
161    "tt_gnu",
162    "f1_gnu",
163    "f2_gnu",
164    "f3_gnu",
165    "f4_gnu",
166    "a_gnu",
167    "c_gnu",
168    "g_gnu",
169    "tu_gnu",
170    "helix_gnu"
171};
172
173static const char *plotTypeDescription[PT_PLOT_TYPES] = {
174    "G+C ratio",
175    "G+A ratio",
176    "Rate",
177    "TT Ratio",
178    "Most frequent base",
179    "2nd frequent base",
180    "3rd frequent base",
181    "Least frequent base",
182    "A ratio",
183    "C ratio",
184    "G ratio",
185    "T/U ratio",
186    "Helix"
187};
188
189static PlotType string2PlotType(const char *type) {
190    for (int pt = 0; pt<PT_PLOT_TYPES; ++pt) {
191        if (strcmp(type, plotTypeName[pt]) == 0) {
192            return PlotType(pt);
193        }
194    }
195
196    return PT_UNKNOWN;
197}
198
199static const char *makeTitle(const char *fname) {
200    const char *rslash = strrchr(fname, '/');
201    if (rslash) rslash++;
202    else        rslash = fname;
203
204    char *name = ARB_strdup(rslash);
205    char *rdot = strrchr(name, '.');
206
207    PlotType pt  = PT_UNKNOWN;
208    if (rdot) pt = string2PlotType(rdot+1);
209
210    static char *title = NULp;
211    freenull(title);
212
213    if (pt == PT_UNKNOWN) {
214        title = GBS_global_string_copy("%s (unknown type)", name);
215    }
216    else {
217        rdot[0] = 0;
218        title = GBS_global_string_copy("%s (%s)", name, plotTypeDescription[pt]);
219    }
220
221    free(name);
222
223    return title;
224}
225
226// -------------------
227//      SortedFreq
228
229class SortedFreq : virtual Noncopyable {
230    float *freq[4];
231
232public:
233    SortedFreq(const ColumnStat *column_stat);
234    ~SortedFreq();
235
236    float get(PlotType plot_type, size_t pos) const {
237        float f;
238        switch (plot_type) {
239            case PT_MOST_FREQUENT_BASE:   f = freq[0][pos]; break;
240            case PT_SECOND_FREQUENT_BASE: f = freq[1][pos]; break;
241            case PT_THIRD_FREQUENT_BASE:  f = freq[2][pos]; break;
242            case PT_LEAST_FREQUENT_BASE:  f = freq[3][pos]; break;
243            default: nt_assert(0); f = 0; break;
244        }
245        return f;
246    }
247};
248
249SortedFreq::SortedFreq(const ColumnStat *column_stat) {
250    size_t len = column_stat->get_length();
251    for (int i = 0; i<4; ++i) { // 4 best frequencies
252        freq[i] = new float[len];
253        for (size_t p = 0; p<len; ++p) freq[i][p] = 0.0; // clear
254    }
255
256    for (unsigned int c = 0; c<256; ++c) { // all character stats
257        const float *cfreq = column_stat->get_frequencies((unsigned char)c);
258        if (cfreq) {
259            for (size_t p = 0; p<len; ++p) {            // all positions
260                if (freq[3][p] < cfreq[p]) {
261                    freq[3][p] = cfreq[p];          // found higher freq
262
263                    for (int i = 3; i > 0; --i) { // bubble upwards to sort
264                        if (freq[i-1][p] >= freq[i][p]) break; // sorted!
265
266                        float f      = freq[i][p];
267                        freq[i][p]   = freq[i-1][p];
268                        freq[i-1][p] = f;
269                    }
270                }
271            }
272        }
273    }
274
275#if defined(DEBUG)
276    for (size_t p = 0; p<len; ++p) {                // all positions
277        nt_assert(freq[0][p] >= freq[1][p]);
278        nt_assert(freq[1][p] >= freq[2][p]);
279        nt_assert(freq[2][p] >= freq[3][p]);
280    }
281#endif // DEBUG
282}
283SortedFreq::~SortedFreq() {
284    for (int i = 0; i<4; ++i) delete [] freq[i];
285}
286
287class Smoother : virtual Noncopyable {
288    double *value;
289    size_t *index;
290    size_t  size;
291    size_t  halfsize;
292    size_t  next;
293    size_t  added;
294    double  sum;
295
296    size_t wrap(size_t idx) { return idx >= size ? idx-size : idx; }
297
298public:
299    Smoother(size_t smooth_range)
300        : size(smooth_range),
301          halfsize(size/2), 
302          next(0),
303          added(0),
304          sum(0.0)
305    {
306        nt_assert(size>0);
307       
308        value = new double[size];
309        index = new size_t[size];
310
311        for (size_t i = 0; i<size; ++i) value[i] = 0.0;
312    }
313    ~Smoother() {
314        delete [] value;
315        delete [] index;
316    }
317
318    void print(FILE *out, size_t i, double v) {
319        sum = sum+v-value[next];
320
321        index[next] = i;
322        value[next] = v;
323
324        next = wrap(next+1);
325
326        if (added<size) ++added;
327        if (added == size) {
328            size_t printNext = wrap(next+halfsize);
329            fprintf(out, "%zu %f\n", index[printNext], sum/size);
330        }
331    }
332};
333
334enum PlotMode {
335    PLOT,          // write file
336    PLOT_AND_VIEW, // write file and run gnuplot
337    PLOT_CLEANUP,  // delete all files with same prefix
338};
339
340struct PlotParam {
341    ColumnStat       *colstat;
342    adfiltercbstruct *filterdef;
343
344    PlotParam(ColumnStat *colstat_, adfiltercbstruct *filterdef_)
345        : colstat(colstat_),
346          filterdef(filterdef_)
347    {}
348};
349
350static void colstat_2_gnuplot_cb(AW_window *aww, PlotParam *param, PlotMode mode) {
351    GB_transaction  ta(GLOBAL.gb_main);
352    GB_ERROR        error       = NULp;
353    ColumnStat     *column_stat = param->colstat;
354    AW_root        *awr         = aww->get_root();
355
356    if (mode == PLOT || mode == PLOT_AND_VIEW) {
357        char *filterstring     = awr->awar(param->filterdef->def_filter)->read_string();
358        char *alignment_name   = awr->awar(param->filterdef->def_alignment)->read_string();
359        long  alignment_length = GBT_get_alignment_len(GLOBAL.gb_main, alignment_name);
360
361        if (alignment_length<0) {
362            GB_clear_error();
363            error = "Please select a valid alignment";
364        }
365        else {
366            AP_filter filter(filterstring, "0", alignment_length);
367
368            error = column_stat->calculate(&filter);
369
370            if (!error && !column_stat->get_length()) error = "Please select column statistic";
371        }
372
373        free(alignment_name);
374        free(filterstring);
375    }
376
377    if (!error) {
378        char *fname = awr->awar(AWAR_CS2GP_FILENAME)->read_string();
379
380        if (!strchr(fname, '/')) freeset(fname, GBS_global_string_copy("./%s", fname));
381        if (strlen(fname) < 1) error = "Please enter file name";
382
383        if (mode == PLOT_CLEANUP) { // delete overlay files
384            if (!error) {
385                char *found_files = get_overlay_files(awr, fname, error);
386
387                if (found_files) {
388                    for (char *name = strtok(found_files, "*"); name; name = strtok(NULp, "*")) {
389                        printf("Deleting gnuplot file '%s'\n", name);
390                        if (unlink(name) != 0) printf("Can't delete '%s'\n", name);
391                    }
392                    free(found_files);
393                    awr->awar(AWAR_CS2GP_DIRECTORY)->touch(); // reload file selection box
394                }
395            }
396        }
397        else {
398            FILE *out = NULp;
399            if (!error) {
400                out = fopen(fname, "w");
401                if (!out) error = GB_export_errorf("Cannot write to file '%s'", fname);
402            }
403
404            nt_assert(out || error);
405
406            if (!error) {
407                char   *type       = awr->awar(AWAR_CS2GP_SUFFIX)->read_string();
408                long    smoothSize = awr->awar(AWAR_CS2GP_SMOOTH_VALUES)->read_int();  // 1 = discrete values
409                size_t  columns    = column_stat->get_length();
410
411                enum {
412                    STAT_AMOUNT,
413                    STAT_SIMPLE_FLOAT,
414                    STAT_SIMPLE_BOOL,
415                    STAT_SORT,
416                    STAT_UNKNOWN
417                } stat_type = STAT_UNKNOWN;
418                union {
419                    struct {
420                        const float *A;
421                        const float *C;
422                        const float *G;
423                        const float *TU;
424                    } amount;                       // STAT_AMOUNT
425                    const float *floatVals;         // STAT_SIMPLE_FLOAT
426                    const bool  *boolVals;          // STAT_SIMPLE_BOOL
427                    SortedFreq  *sorted;            // STAT_SORT
428                } data;
429
430                data.amount.= NULp; // silence warnings
431                data.amount.= NULp;
432                data.amount.= NULp;
433                data.amount.TU = NULp;
434
435                PlotType plot_type = string2PlotType(type);
436                switch (plot_type) {
437                    case PT_GC_RATIO:
438                    case PT_GA_RATIO:
439                    case PT_BASE_A:
440                    case PT_BASE_C:
441                    case PT_BASE_G:
442                    case PT_BASE_TU: {
443                        stat_type = STAT_AMOUNT;
444
445                        data.amount.= column_stat->get_frequencies('A');
446                        data.amount.= column_stat->get_frequencies('C');
447                        data.amount.= column_stat->get_frequencies('G');
448                        data.amount.TU = column_stat->get_frequencies('U');
449                        break;
450                    }
451                    case PT_RATE:
452                        stat_type = STAT_SIMPLE_FLOAT;
453                        data.floatVals = column_stat->get_rates();
454                        break;
455
456                    case PT_TT_RATIO:
457                        stat_type = STAT_SIMPLE_FLOAT;
458                        data.floatVals = column_stat->get_ttratio();
459                        break;
460
461                    case PT_HELIX: {
462                        stat_type = STAT_SIMPLE_BOOL;
463                        data.boolVals  = column_stat->get_is_helix();
464                        break;
465                    }
466                    case PT_MOST_FREQUENT_BASE:
467                    case PT_SECOND_FREQUENT_BASE:
468                    case PT_THIRD_FREQUENT_BASE:
469                    case PT_LEAST_FREQUENT_BASE: {
470                        stat_type   = STAT_SORT;
471                        data.sorted = new SortedFreq(column_stat);
472                        break;
473                    }
474                    case PT_PLOT_TYPES:
475                    case PT_UNKNOWN:
476                        error = "Please select what to plot";
477                        break;
478                }
479
480                const GB_UINT4 *weights = column_stat->get_weights();
481
482                if (!error) {
483                    Smoother smoother(smoothSize);
484
485                    for (size_t j=0; j<columns; ++j) {
486                        if (!weights[j]) continue;
487
488                        double val = 0;
489                        switch (stat_type) {
490                            case STAT_AMOUNT: {
491                                float A  = data.amount.A[j];
492                                float C  = data.amount.C[j];
493                                float G  = data.amount.G[j];
494                                float TU = data.amount.TU[j];
495
496                                float amount = A+C+G+TU;
497
498                                switch (plot_type) {
499                                    case PT_GC_RATIO: val = (G+C)/amount; break;
500                                    case PT_GA_RATIO: val = (G+A)/amount; break;
501                                    case PT_BASE_A:   val = A/amount; break;
502                                    case PT_BASE_C:   val = C/amount; break;
503                                    case PT_BASE_G:   val = G/amount; break;
504                                    case PT_BASE_TU:  val = TU/amount; break;
505
506                                    default: nt_assert(0); break;
507                                }
508                                break;
509                            }
510                            case STAT_SIMPLE_FLOAT: val = data.floatVals[j]; break;
511                            case STAT_SIMPLE_BOOL:  val = data.boolVals[j]; break;
512                            case STAT_SORT:         val = data.sorted->get(plot_type, j); break;
513
514                            case STAT_UNKNOWN: nt_assert(0); break;
515                        }
516
517                        smoother.print(out, j, val);
518                    }
519                }
520
521                if (stat_type == STAT_SORT) delete data.sorted;
522                free(type);
523            }
524
525            if (out) {
526                fclose(out);
527                out = NULp;
528            }
529
530            if (!error) {
531                awr->awar(AWAR_CS2GP_DIRECTORY)->touch(); // reload file selection box
532
533                if (mode == PLOT_AND_VIEW) { // run gnuplot?
534                    char *command_file;
535                    char *command_name = GB_unique_filename("arb", "gnuplot");
536
537                    out             = GB_fopen_tempfile(command_name, "wt", &command_file);
538                    if (!out) error = GB_await_error();
539                    else {
540                        char *smooth      = awr->awar(AWAR_CS2GP_SMOOTH_GNUPLOT)->read_string();
541                        char *found_files = get_overlay_files(awr, fname, error);
542
543                        fprintf(out, "set samples 1000\n");
544
545                        bool plotted = false; // set to true after first 'plot' command (other plots use 'replot')
546                        const char *plot_command[] = { "plot", "replot" };
547
548                        if (found_files) {
549                            for (char *name = strtok(found_files, "*"); name; name = strtok(NULp, "*")) {
550                                if (strcmp(name, fname) != 0) { // latest data file is done below
551                                    fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], name, smooth, makeTitle(name));
552                                    plotted = true;
553                                }
554                            }
555                            free(found_files);
556                        }
557
558                        fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], fname, smooth, makeTitle(fname));
559                        fprintf(out, "pause mouse any \"Any key or button will terminate gnuplot\"\n");
560                        fclose(out);
561                        out = NULp;
562
563                        char *script = GBS_global_string_copy("gnuplot %s && rm -f %s", command_file, command_file);
564                        GB_xcmd(script, XCMD_ASYNC_WAIT_ON_ERROR);
565                        free(script);
566                        free(smooth);
567                    }
568                    free(command_file);
569                    free(command_name);
570                }
571            }
572        }
573        free(fname);
574    }
575
576    if (error) aw_message(error);
577}
578
579static void colstat_ali_changed_cb(AW_root *root, AW_awar *awar_ali) {
580    if (GLOBAL.gb_main) {
581        long smooth_max = GBT_get_alignment_len(GLOBAL.gb_main, awar_ali->read_char_pntr());
582        if (smooth_max<0) { // ali not found
583            GB_clear_error();
584            smooth_max = INT_MAX;
585        }
586        root->awar(AWAR_CS2GP_SMOOTH_VALUES)->set_minmax(1, smooth_max);
587    }
588}
589
590AW_window *NT_create_colstat_2_gnuplot_window(AW_root *root) {
591    GB_transaction ta(GLOBAL.gb_main);
592
593    AW_awar *awar_default_alignment = root->awar_string(AWAR_DEFAULT_ALIGNMENT, "", GLOBAL.gb_main);
594
595    ColumnStat       *column_stat = new ColumnStat(GLOBAL.gb_main, root, AWAR_CS2GP_NAME, awar_default_alignment);
596    AW_window_simple *aws         = new AW_window_simple;
597
598    aws->init(root, "EXPORT_CSP_TO_GNUPLOT", "Export Column statistic to GnuPlot");
599    aws->load_xfig("cpro/csp_2_gnuplot.fig");
600
601    root->awar_int(AWAR_CS2GP_SMOOTH_VALUES, 1);
602    root->awar_int(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX);
603    root->awar_int(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX);
604    root->awar_string(AWAR_CS2GP_SMOOTH_GNUPLOT);
605
606    AW_create_fileselection_awars(root, AWAR_CS2GP, "", ".gc_gnu", "noname.gc_gnu");
607
608    aws->at("close");
609    aws->callback(AW_POPDOWN);
610    aws->create_button("CLOSE", "CLOSE", "C");
611
612    aws->at("help"); aws->callback(makeHelpCallback("csp_2_gnuplot.hlp"));
613    aws->create_button("HELP", "HELP", "H");
614
615    AW_create_standard_fileselection(aws, AWAR_CS2GP);
616
617    aws->at("csp");
618    COLSTAT_create_selection_list(aws, column_stat);
619
620    aws->at("what");
621    AW_selection_list *plotTypeList = aws->create_selection_list(AWAR_CS2GP_SUFFIX, true);
622    for (int pt = 0; pt<PT_PLOT_TYPES; ++pt) {
623        plotTypeList->insert(plotTypeDescription[pt], plotTypeName[pt]);
624    }
625    plotTypeList->insert_default("<select one>", "");
626    plotTypeList->update();
627
628    awt_create_filter_awars(root, AW_ROOT_DEFAULT, AWAR_CS2GP_FILTER_NAME, AWAR_DEFAULT_ALIGNMENT);
629    adfiltercbstruct *filter = awt_create_select_filter(root, GLOBAL.gb_main, AWAR_CS2GP_FILTER_NAME);
630    {
631        AW_awar *awar_ali = root->awar(filter->def_alignment);
632        awar_ali->add_callback(makeRootCallback(colstat_ali_changed_cb, awar_ali));
633        awar_ali->touch();
634    }
635
636    aws->at("ap_filter");
637    aws->callback(makeCreateWindowCallback(awt_create_select_filter_win, filter));
638    aws->create_button("SELECT_FILTER", AWAR_CS2GP_FILTER_NAME);
639
640    aws->at("smooth");
641    aws->create_input_field(AWAR_CS2GP_SMOOTH_VALUES, 8);
642
643    aws->at("smooth2");
644    aws->create_toggle_field(AWAR_CS2GP_SMOOTH_GNUPLOT, 1);
645    aws->insert_default_toggle("None", "N", "");
646    aws->insert_toggle("Unique", "U", "smooth unique");
647    aws->insert_toggle("CSpline", "S", "smooth cspline");
648    aws->insert_toggle("Bezier", "B", "smooth bezier");
649    aws->update_toggle_field();
650
651    aws->auto_space(10, 10);
652    aws->button_length(13);
653
654    PlotParam *param = new PlotParam(column_stat, filter); // bound to CB, dont free
655
656    aws->at("save");
657    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT));
658    aws->create_button("SAVE", "Save");
659
660    aws->highlight();
661    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_AND_VIEW));
662    aws->create_button("SAVE_AND_VIEW", "Save & View");
663
664    aws->at("overlay1");
665    aws->label("Overlay statistics with same prefix?");
666    aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX);
667
668    aws->at("overlay2");
669    aws->label("Overlay statistics with same postfix?");
670    aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX);
671
672    aws->at("del_overlays");
673    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_CLEANUP));
674    aws->create_autosize_button("DEL_OVERLAYS", "Delete currently overlayed files", "D", 2);
675
676    return aws;
677}
678
679
Note: See TracBrowser for help on using the repository browser.