~ubuntu-branches/debian/jessie/arb/jessie

« back to all changes in this revision

Viewing changes to AWT/AWT_item_sel_list.cxx

  • Committer: Package Import Robot
  • Author(s): Elmar Pruesse, Andreas Tille, Elmar Pruesse
  • Date: 2014-09-02 15:15:06 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140902151506-jihq58b3iz342wif
Tags: 6.0.2-1
[ Andreas Tille ]
* New upstream version
  Closes: #741890
* debian/upstream -> debian/upstream/metadata
* debian/control:
   - Build-Depends: added libglib2.0-dev
   - Depends: added mafft, mrbayes
* debian/rules
   - Add explicite --remove-section=.comment option to manual strip call
* cme fix dpkg-control
* arb-common.dirs: Do not create unneeded lintian dir
* Add turkish debconf translation (thanks for the patch to Mert Dirik
  <mertdirik@gmail.com>)
  Closes: #757497

[ Elmar Pruesse ]
* patches removed:
   - 10_config.makefiles.patch,
     80_no_GL.patch
       removed in favor of creating file from config.makefile.template via 
       sed in debian/control
   - 20_Makefile_main.patch
       merged upstream
   - 21_Makefiles.patch
       no longer needed
   - 30_tmpfile_CVE-2008-5378.patch: 
       merged upstream
   - 50_fix_gcc-4.8.patch:
       merged upstream
   - 40_add_libGLU.patch:
       libGLU not needed for arb_ntree)
   - 60_use_debian_packaged_raxml.patch:
       merged upstream
   - 70_hardening.patch
       merged upstream
   - 72_add_math_lib_to_linker.patch
       does not appear to be needed
* patches added:
   - 10_upstream_r12793__show_db_load_progress:
       backported patch showing progress while ARB is loading a database
       (needed as indicator/splash screen while ARB is launching)
   - 20_upstream_r12794__socket_permissions:
       backported security fix
   - 30_upstream_r12814__desktop_keywords:
       backported add keywords to desktop (fixes lintian warning)
   - 40_upstream_r12815__lintian_spelling:
       backported fix for lintian reported spelling errors
   - 50_private_nameservers
       change configuration to put nameservers into users home dirs
       (avoids need for shared writeable directory)
   - 60_use_debian_phyml
       use phyml from debian package for both interfaces in ARB
* debian/rules:
   - create config.makefile from override_dh_configure target
   - use "make tarfile" in override_dh_install
   - remove extra cleaning not needed for ARB 6
   - use "dh_install --list-missing" to avoid missing files
   - added override_dh_fixperms target
* debian/control:
   - added libarb-dev package
   - Depends: added phyml, xdg-utils
   - Suggests: removed phyml
   - fix lintian duplicate-short-description (new descriptions)
* debian/*.install:
   - "unrolled" confusing globbing to select files
   - pick files from debian/tmp
   - moved all config files to /etc/arb
* debian/arb-common.templates: updated
* scripts:
   - removed arb-add-pt-server
   - launch-wrapper: 
     - only add demo.arb to newly created $ARBUSERDATA
     - pass commandline arguments through bin/arb wrapper
   - preinst: removing old PT server index files on upgrade from 5.5*
   - postinst: set setgid on shared PT dir
* rewrote arb.1 manfile
* added file icon for ARB databases
* using upstream arb_tcp.dat

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ==================================================================== //
2
 
//                                                                      //
3
 
//   File      : AWT_item_sel_list.cxx                                  //
4
 
//   Purpose   : selection lists for items (ad_item_selector)           //
5
 
//                                                                      //
6
 
//                                                                      //
7
 
// Coded by Ralf Westram (coder@reallysoft.de) in May 2005              //
8
 
// Copyright Department of Microbiology (Technical University Munich)   //
9
 
//                                                                      //
10
 
// Visit our web site at: http://www.arb-home.de/                       //
11
 
//                                                                      //
12
 
// ==================================================================== //
13
 
 
14
 
#include <string.h>
15
 
 
16
 
#include <aw_awars.hxx>
17
 
 
18
 
#include "awt.hxx"
19
 
#include "awtlocal.hxx"
20
 
#include "awt_item_sel_list.hxx"
21
 
 
22
 
#include <arbdbt.h>
23
 
 
24
 
static AW_window *awt_existing_window(AW_window *, AW_CL cl1, AW_CL) {
25
 
    return (AW_window*)cl1;
26
 
}
27
 
 
28
 
static void populate_selection_list_on_scandb_cb(GBDATA *dummy, struct adawcbstruct *cbs)
29
 
{
30
 
    GBDATA *gb_key_data;
31
 
    gb_key_data = GB_search(cbs->gb_main, cbs->selector->change_key_path, GB_CREATE_CONTAINER);
32
 
    AWUSE(dummy);
33
 
 
34
 
    cbs->aws->clear_selection_list(cbs->id);
35
 
 
36
 
    if (cbs->add_pseudo_fields) {
37
 
        cbs->aws->insert_selection(cbs->id, PSEUDO_FIELD_ANY_FIELD, PSEUDO_FIELD_ANY_FIELD);
38
 
        cbs->aws->insert_selection(cbs->id, PSEUDO_FIELD_ALL_FIELDS, PSEUDO_FIELD_ALL_FIELDS);
39
 
    }
40
 
 
41
 
    for (GBDATA *gb_key = GB_entry(gb_key_data,CHANGEKEY); gb_key; gb_key = GB_nextEntry(gb_key)) {
42
 
        GBDATA *gb_key_type = GB_entry(gb_key,CHANGEKEY_TYPE);
43
 
        if ( !( ((long)cbs->def_filter) & (1<<GB_read_int(gb_key_type)))) continue; // type does not match filter
44
 
 
45
 
        GBDATA *gb_key_name = GB_entry(gb_key,CHANGEKEY_NAME);
46
 
        if (!gb_key_name) continue;                 // key w/o name -> don't show
47
 
 
48
 
        const char *name = GB_read_char_pntr(gb_key_name);
49
 
        if (!name) {
50
 
            fprintf(stderr, "WARNING: can't read key name (Reason: %s)", GB_await_error());
51
 
            name = "<unnamedKey?>";
52
 
        }
53
 
 
54
 
        long       *hiddenPtr = GBT_read_int(gb_key, CHANGEKEY_HIDDEN);
55
 
        const char *display   = 0;
56
 
 
57
 
        if (!hiddenPtr) {                           // it's an older db version w/o hidden flag -> add it
58
 
            GB_ERROR error = GBT_write_int(gb_key, CHANGEKEY_HIDDEN, 0); // default is "not hidden"
59
 
            if (error) {
60
 
                GB_warningf("WARNING: can't create " CHANGEKEY_HIDDEN " (Reason: %s)\n", error);
61
 
            }
62
 
 
63
 
            static long not_hidden = 0;;
64
 
            hiddenPtr              = &not_hidden;
65
 
        }
66
 
 
67
 
        if (*hiddenPtr) { // hidden ?
68
 
            if (cbs->include_hidden_fields) {       // show hidden fields ?
69
 
                display = GBS_global_string("[hidden] %s", name);
70
 
            }
71
 
        }
72
 
        else display = name;
73
 
 
74
 
        if (display) cbs->aws->insert_selection(cbs->id, display, name);
75
 
    }
76
 
 
77
 
    cbs->aws->insert_default_selection( cbs->id, "????", "----" );
78
 
    cbs->aws->update_selection_list( cbs->id );
79
 
}
80
 
 
81
 
 
82
 
AW_CL awt_create_selection_list_on_scandb(GBDATA                 *gb_main,
83
 
                                          AW_window              *aws,
84
 
                                          const char             *varname,
85
 
                                          long                    type_filter,
86
 
                                          const char             *scan_xfig_label,
87
 
                                          const char             *rescan_xfig_label,
88
 
                                          const ad_item_selector *selector,
89
 
                                          size_t                  columns,
90
 
                                          size_t                  visible_rows,
91
 
                                          awt_selected_fields     field_filter,
92
 
                                          const char             *popup_button_id)
93
 
{
94
 
    /* show fields of a item (e.g. species, SAI, gene)
95
 
     * 'varname'                is the awar set by the selection list
96
 
     * 'type_filter'            is a bitstring which controls what types are shown in the selection list
97
 
     *                          (e.g '1<<GB_INT || 1 <<GB_STRING' enables ints and strings)
98
 
     * 'scan_xfig_label'        is the position of the selection box (or selection button)
99
 
     * 'rescan_xfig_label'      if not NULL, a 'RESCAN' button is added at that position
100
 
     * 'selector'               describes the item type, for which fields are shown
101
 
     * 'columns'/'visible_rows' specify the size of the selection list
102
 
     * 'field_filter'           controls if pseudo-fields and/or hidden fields are added
103
 
     * 'popup_button_id'        if not NULL, a button (with this id) is inserted.
104
 
     *                          When clicked a popup window containing the selection list opens.
105
 
     */
106
 
 
107
 
 
108
 
    AW_selection_list *id              = 0;
109
 
    GBDATA            *gb_key_data;
110
 
    AW_window         *win_for_sellist = aws;
111
 
 
112
 
    GB_push_transaction(gb_main);
113
 
 
114
 
    if (scan_xfig_label) aws->at(scan_xfig_label);
115
 
 
116
 
    if (popup_button_id) { 
117
 
        // create HIDDEN popup window containing the selection list
118
 
        {
119
 
            AW_window_simple *aw_popup = new AW_window_simple;
120
 
            aw_popup->init(aws->get_root(), "SELECT_LIST_ENTRY", "SELECT AN ENTRY");
121
 
            //         aw_popup->load_xfig(0, true);
122
 
 
123
 
            aw_popup->auto_space(10, 10);
124
 
            aw_popup->at_newline();
125
 
 
126
 
            aw_popup->callback((AW_CB0)AW_POPDOWN);
127
 
            id = aw_popup->create_selection_list(varname, 0, "", columns, visible_rows);
128
 
 
129
 
            aw_popup->at_newline();
130
 
            aw_popup->callback((AW_CB0)AW_POPDOWN);
131
 
            aw_popup->create_button("CLOSE", "CLOSE", "C");
132
 
 
133
 
            aw_popup->window_fit();
134
 
 
135
 
            win_for_sellist = aw_popup;
136
 
        }
137
 
 
138
 
        // and bind hidden window popup to button 
139
 
        aws->button_length(columns);
140
 
        aws->callback((AW_CB2)AW_POPUP,(AW_CL)awt_existing_window, (AW_CL)win_for_sellist);
141
 
        aws->create_button(popup_button_id, varname);
142
 
 
143
 
    }
144
 
    else { // otherwise just insert the selection list at point
145
 
        id = aws->create_selection_list(varname,0,"",columns,visible_rows); // 20,10);
146
 
    }
147
 
 
148
 
    struct adawcbstruct *cbs = new adawcbstruct;
149
 
    memset(cbs, 0, sizeof(*cbs));
150
 
 
151
 
    cbs->aws                   = win_for_sellist;
152
 
    cbs->awr                   = win_for_sellist->get_root();
153
 
    cbs->gb_main               = gb_main;
154
 
    cbs->id                    = id;
155
 
    cbs->def_filter            = (char *)type_filter;
156
 
    cbs->selector              = selector;
157
 
    cbs->add_pseudo_fields     = field_filter & AWT_SF_PSEUDO;
158
 
    cbs->include_hidden_fields = field_filter & AWT_SF_HIDDEN;
159
 
 
160
 
    if (rescan_xfig_label) {
161
 
        int x, y;
162
 
        aws->get_at_position(&x, &y);
163
 
 
164
 
        aws->at(rescan_xfig_label);
165
 
        aws->callback(selector->selection_list_rescan_cb, (AW_CL)cbs->gb_main,(AW_CL)-1);
166
 
        aws->create_button(rescan_xfig_label, "RESCAN","R");
167
 
 
168
 
        if (popup_button_id) aws->at(x, y); // restore 'at' position if popup_list_in_window
169
 
    }
170
 
 
171
 
    populate_selection_list_on_scandb_cb(0,cbs);
172
 
 
173
 
    gb_key_data = GB_search(gb_main, cbs->selector->change_key_path, GB_CREATE_CONTAINER);
174
 
    GB_add_callback(gb_key_data, GB_CB_CHANGED, (GB_CB)populate_selection_list_on_scandb_cb, (int *)cbs);
175
 
 
176
 
    GB_pop_transaction(gb_main);
177
 
    return (AW_CL)cbs;
178
 
}
179
 
 
180
 
 
181
 
 
182
 
 
183