Debian Codegraph @

src/web/www/js/qry_dlg.js

raw symbols SCIP
1 function qry_dlg_show(cb_func, qtype) {
2 var sym = ed_get_cur_word();
3
4 var qpanel = document['dlg_qry_p'];
5 qpanel['cb_func'] = cb_func;
6
7 var bnode = qpanel.bodyNode;
8
9 if (!qtype) {
10 qtype = 'REF';
11 }
12 var qtype_node = bnode.one('#qtype')
13 qtype_node.set('value', qtype);
14
15 var sym_node = bnode.one('#symbol')
16 sym_node.set('value', sym);
17
18 var substring_node = bnode.one('#substring')
19 substring_node.set('checked', false);
20
21 var ignorecase_node = bnode.one('#ignorecase')
22 ignorecase_node.set('checked', false);
23
24 sym_node.select();
25 qpanel.show();
26 sym_node.focus();
27 }
28
29 YUI().use("panel", function (Y) {
30
31 var qry_arr = [
32 ['REF', 'References to'],
33 ['DEF', 'Definition of'],
34 //['<--', 'Called Functions'],
35 ['-->', 'Calling Functions'],
36 //['TXT', 'Find Text'],
37 ['GREP', 'Find Egrep'],
38 ['FIL', 'Find File'],
39 ['INC', 'Include/Import'],
40 ['CTREE', 'Call Tree'],
41 ['CLGRAPH', 'Class Graph'],
42 ['CLGRAPHD', 'Class Graph Dir'],
43 ['FFGRAPH', 'File Func Graph'],
44 ];
45 var qtype = '<select id="qtype"">';
46 var is_disabled = false;
47 for (var i = 0; i < qry_arr.length; i++) {
48 v = qry_arr[i];
49 if (v[0] == 'CTREE') {
50 is_disabled = true;
51 }
52 if (is_disabled) {
53 qtype += '<option value="' + v[0] + '" disabled>' + v[1] + '</option>';
54 } else {
55 qtype += '<option value="' + v[0] + '" >' + v[1] + '</option>';
56 }
57 }
58 qtype += '</select>';
59 var body = '<table>' +
60 '<tr> <td>Type</td> <td>' + qtype + '</td> </tr>' +
61 '<tr> <td>Symbol</td> <td><input type="text" id="symbol"></td> </tr>' +
62 '<tr> <td></td> <td><input type="checkbox" id="substring">Substring</td> </tr>' +
63 '<tr> <td></td> <td><input type="checkbox" id="ignorecase">Case Insensitive</td> </tr>' +
64 '</table>';
65
66 function okAction(e) {
67 e.preventDefault();
68 qpanel.hide();
69 var bnode = qpanel.bodyNode;
70
71 var qtype = bnode.one('#qtype').get('value');
72 if (!qtype) {
73 return;
74 }
75
76 var symbol = bnode.one('#symbol').get('value');
77 if (!symbol) {
78 return;
79 }
80
81 var opt = [];
82 if (bnode.one('#substring').get('checked')) {
83 opt.push('substring');
84 }
85 if (bnode.one('#ignorecase').get('checked')) {
86 opt.push('ignorecase');
87 }
88
89 var cb_func = qpanel['cb_func'];
90 var q_args = {
91 qtype : qtype,
92 symbol : symbol,
93 opt : opt,
94 };
95 if (!cb_func) {
96 return;
97 }
98 cb_func(q_args);
99 }
100
101 var qpanel = new Y.Panel({
102 bodyContent: body,
103 // width : 250,
104 zIndex : 6,
105 centered : true,
106 modal : true,
107 render : '#qryPanel',
108 buttons: [
109 {
110 value : 'Cancel',
111 section: Y.WidgetStdMod.FOOTER,
112 action : function (e) {
113 e.preventDefault();
114 qpanel.hide();
115 }
116 },
117 {
118 value : 'Ok',
119 section: Y.WidgetStdMod.FOOTER,
120 //isDefault: true,
121 action : okAction,
122 }
123 ]
124 });
125
126 qpanel.bodyNode.on('key', okAction, 'enter');
127
128 qpanel.hide();
129
130 document['dlg_qry_y'] = Y;
131 document['dlg_qry_p'] = qpanel;
132 });