source: tags/ms_r17q3/NTREE/ColumnStat_2_gnuplot.cxx

Last change on this file was 15268, checked in by westram, 8 years ago
  • GB_xcmd
    • remove from perl interface
    • replace bool-flag-couple by enum
    • guard unused case XCMD_SYNC_WAITKEY
  • 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          = 0;
46    *name_prefixPtr  = 0;
47    *name_postfixPtr = 0;
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 = 0;
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 0;
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 = 0;
86    if (!error) {
87        char *found_prefix_files  = 0;
88        char *found_postfix_files = 0;
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 = 0;
119                }
120            }
121            else {
122                found_files         = found_postfix_files;
123                found_postfix_files = 0;
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 = 0;
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       = NULL;
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(0, "*")) {
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 = 0;
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.= NULL; // silence warnings
431                data.amount.= NULL;
432                data.amount.TU = NULL;
433
434                PlotType plot_type = string2PlotType(type);
435                switch (plot_type) {
436                    case PT_GC_RATIO:
437                    case PT_GA_RATIO:
438                    case PT_BASE_A:
439                    case PT_BASE_C:
440                    case PT_BASE_G:
441                    case PT_BASE_TU: {
442                        stat_type = STAT_AMOUNT;
443
444                        data.amount.= column_stat->get_frequencies('A');
445                        data.amount.= column_stat->get_frequencies('C');
446                        data.amount.= column_stat->get_frequencies('G');
447                        data.amount.TU = column_stat->get_frequencies('U');
448                        break;
449                    }
450                    case PT_RATE:
451                        stat_type = STAT_SIMPLE_FLOAT;
452                        data.floatVals = column_stat->get_rates();
453                        break;
454
455                    case PT_TT_RATIO:
456                        stat_type = STAT_SIMPLE_FLOAT;
457                        data.floatVals = column_stat->get_ttratio();
458                        break;
459
460                    case PT_HELIX: {
461                        stat_type = STAT_SIMPLE_BOOL;
462                        data.boolVals  = column_stat->get_is_helix();
463                        break;
464                    }
465                    case PT_MOST_FREQUENT_BASE:
466                    case PT_SECOND_FREQUENT_BASE:
467                    case PT_THIRD_FREQUENT_BASE:
468                    case PT_LEAST_FREQUENT_BASE: {
469                        stat_type   = STAT_SORT;
470                        data.sorted = new SortedFreq(column_stat);
471                        break;
472                    }
473                    case PT_PLOT_TYPES:
474                    case PT_UNKNOWN:
475                        error = "Please select what to plot";
476                        break;
477                }
478
479                const GB_UINT4 *weights = column_stat->get_weights();
480
481                if (!error) {
482                    Smoother smoother(smoothSize);
483
484                    for (size_t j=0; j<columns; ++j) {
485                        if (!weights[j]) continue;
486
487                        double val = 0;
488                        switch (stat_type) {
489                            case STAT_AMOUNT: {
490                                float A  = data.amount.A[j];
491                                float C  = data.amount.C[j];
492                                float G  = data.amount.G[j];
493                                float TU = data.amount.TU[j];
494
495                                float amount = A+C+G+TU;
496
497                                switch (plot_type) {
498                                    case PT_GC_RATIO: val = (G+C)/amount; break;
499                                    case PT_GA_RATIO: val = (G+A)/amount; break;
500                                    case PT_BASE_A:   val = A/amount; break;
501                                    case PT_BASE_C:   val = C/amount; break;
502                                    case PT_BASE_G:   val = G/amount; break;
503                                    case PT_BASE_TU:  val = TU/amount; break;
504
505                                    default: nt_assert(0); break;
506                                }
507                                break;
508                            }
509                            case STAT_SIMPLE_FLOAT: val = data.floatVals[j]; break;
510                            case STAT_SIMPLE_BOOL:  val = data.boolVals[j]; break;
511                            case STAT_SORT:         val = data.sorted->get(plot_type, j); break;
512
513                            case STAT_UNKNOWN: nt_assert(0); break;
514                        }
515
516                        smoother.print(out, j, val);
517                    }
518                }
519
520                if (stat_type == STAT_SORT) delete data.sorted;
521                free(type);
522            }
523
524            if (out) {
525                fclose(out);
526                out = NULL;
527            }
528
529            if (!error) {
530                awr->awar(AWAR_CS2GP_DIRECTORY)->touch(); // reload file selection box
531
532                if (mode == PLOT_AND_VIEW) { // run gnuplot?
533                    char *command_file;
534                    char *command_name = GB_unique_filename("arb", "gnuplot");
535
536                    out             = GB_fopen_tempfile(command_name, "wt", &command_file);
537                    if (!out) error = GB_await_error();
538                    else {
539                        char *smooth      = awr->awar(AWAR_CS2GP_SMOOTH_GNUPLOT)->read_string();
540                        char *found_files = get_overlay_files(awr, fname, error);
541
542                        fprintf(out, "set samples 1000\n");
543
544                        bool plotted = false; // set to true after first 'plot' command (other plots use 'replot')
545                        const char *plot_command[] = { "plot", "replot" };
546
547                        if (found_files) {
548                            for (char *name = strtok(found_files, "*"); name; name = strtok(0, "*")) {
549                                if (strcmp(name, fname) != 0) { // latest data file is done below
550                                    fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], name, smooth, makeTitle(name));
551                                    plotted = true;
552                                }
553                            }
554                            free(found_files);
555                        }
556
557                        fprintf(out, "%s \"%s\" %s title \"%s\"\n", plot_command[int(plotted)], fname, smooth, makeTitle(fname));
558                        fprintf(out, "pause mouse any \"Any key or button will terminate gnuplot\"\n");
559                        fclose(out);
560                        out = 0;
561
562                        char *script = GBS_global_string_copy("gnuplot %s && rm -f %s", command_file, command_file);
563                        GB_xcmd(script, XCMD_ASYNC_WAIT_ON_ERROR);
564                        free(script);
565                        free(smooth);
566                    }
567                    free(command_file);
568                    free(command_name);
569                }
570            }
571        }
572        free(fname);
573    }
574
575    if (error) aw_message(error);
576}
577
578static void colstat_ali_changed_cb(AW_root *root, AW_awar *awar_ali) {
579    if (GLOBAL.gb_main) {
580        long smooth_max = GBT_get_alignment_len(GLOBAL.gb_main, awar_ali->read_char_pntr());
581        if (smooth_max<0) { // ali not found
582            GB_clear_error();
583            smooth_max = INT_MAX;
584        }
585        root->awar(AWAR_CS2GP_SMOOTH_VALUES)->set_minmax(1, smooth_max);
586    }
587}
588
589AW_window *NT_create_colstat_2_gnuplot_window(AW_root *root) {
590    GB_transaction ta(GLOBAL.gb_main);
591
592    AW_awar *awar_default_alignment = root->awar_string(AWAR_DEFAULT_ALIGNMENT, "", GLOBAL.gb_main);
593
594    ColumnStat       *column_stat = new ColumnStat(GLOBAL.gb_main, root, AWAR_CS2GP_NAME, awar_default_alignment);
595    AW_window_simple *aws         = new AW_window_simple;
596
597    aws->init(root, "EXPORT_CSP_TO_GNUPLOT", "Export Column statistic to GnuPlot");
598    aws->load_xfig("cpro/csp_2_gnuplot.fig");
599
600    root->awar_int(AWAR_CS2GP_SMOOTH_VALUES, 1);
601    root->awar_int(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX);
602    root->awar_int(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX);
603    root->awar_string(AWAR_CS2GP_SMOOTH_GNUPLOT);
604
605    AW_create_fileselection_awars(root, AWAR_CS2GP, "", ".gc_gnu", "noname.gc_gnu");
606
607    aws->at("close");
608    aws->callback(AW_POPDOWN);
609    aws->create_button("CLOSE", "CLOSE", "C");
610
611    aws->at("help"); aws->callback(makeHelpCallback("csp_2_gnuplot.hlp"));
612    aws->create_button("HELP", "HELP", "H");
613
614    AW_create_standard_fileselection(aws, AWAR_CS2GP);
615
616    aws->at("csp");
617    COLSTAT_create_selection_list(aws, column_stat);
618
619    aws->at("what");
620    AW_selection_list *plotTypeList = aws->create_selection_list(AWAR_CS2GP_SUFFIX, true);
621    for (int pt = 0; pt<PT_PLOT_TYPES; ++pt) {
622        plotTypeList->insert(plotTypeDescription[pt], plotTypeName[pt]);
623    }
624    plotTypeList->insert_default("<select one>", "");
625    plotTypeList->update();
626
627    awt_create_filter_awars(root, AW_ROOT_DEFAULT, AWAR_CS2GP_FILTER_NAME, AWAR_DEFAULT_ALIGNMENT);
628    adfiltercbstruct *filter = awt_create_select_filter(root, GLOBAL.gb_main, AWAR_CS2GP_FILTER_NAME);
629    {
630        AW_awar *awar_ali = root->awar(filter->def_alignment);
631        awar_ali->add_callback(makeRootCallback(colstat_ali_changed_cb, awar_ali));
632        awar_ali->touch();
633    }
634
635    aws->at("ap_filter");
636    aws->callback(makeCreateWindowCallback(awt_create_select_filter_win, filter));
637    aws->create_button("SELECT_FILTER", AWAR_CS2GP_FILTER_NAME);
638
639    aws->at("smooth");
640    aws->create_input_field(AWAR_CS2GP_SMOOTH_VALUES, 8);
641
642    aws->at("smooth2");
643    aws->create_toggle_field(AWAR_CS2GP_SMOOTH_GNUPLOT, 1);
644    aws->insert_default_toggle("None", "N", "");
645    aws->insert_toggle("Unique", "U", "smooth unique");
646    aws->insert_toggle("CSpline", "S", "smooth cspline");
647    aws->insert_toggle("Bezier", "B", "smooth bezier");
648    aws->update_toggle_field();
649
650    aws->auto_space(10, 10);
651    aws->button_length(13);
652
653    PlotParam *param = new PlotParam(column_stat, filter); // bound to CB, dont free
654
655    aws->at("save");
656    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT));
657    aws->create_button("SAVE", "Save");
658
659    aws->highlight();
660    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_AND_VIEW));
661    aws->create_button("SAVE_AND_VIEW", "Save & View");
662
663    aws->at("overlay1");
664    aws->label("Overlay statistics with same prefix?");
665    aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_PREFIX);
666
667    aws->at("overlay2");
668    aws->label("Overlay statistics with same postfix?");
669    aws->create_toggle(AWAR_CS2GP_GNUPLOT_OVERLAY_POSTFIX);
670
671    aws->at("del_overlays");
672    aws->callback(makeWindowCallback(colstat_2_gnuplot_cb, param, PLOT_CLEANUP));
673    aws->create_autosize_button("DEL_OVERLAYS", "Delete currently overlayed files", "D", 2);
674
675    return aws;
676}
677
678
Note: See TracBrowser for help on using the repository browser.