1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
38
#include <Xmt/WidgetType.h>
39
#include <Xmt/InputField.h>
40
#include <Xmt/Procedures.h>
42
#include "sge_usageL.h"
45
#include "gdi/sge_gdi.h"
46
#include "sge_parse_num_par.h"
47
#include "sge_complex_schedd.h"
48
#include "sge_range.h"
49
#include "sge_answer.h"
51
#include "sge_qinstance.h"
52
#include "sge_subordinate.h"
53
#include "sge_centry.h"
56
#include "sge_mailrec.h"
58
#include "qmon_rmon.h"
59
#include "qmon_quarks.h"
60
#include "qmon_matrix.h"
61
#include "qmon_load.h"
62
#include "qmon_message.h"
63
#include "qmon_util.h"
66
static Widget CreateMatrixSimple(Widget parent, String name, ArgList arglist, Cardinal argcount);
67
static Widget CreateMatrix(Widget parent, String name, ArgList arglist, Cardinal argcount);
68
static void qmonMatrixLoseFocus(Widget w, XtPointer cld, XtPointer cad);
69
static void qmonMatrixTraverse(Widget w, XtPointer cld, XtPointer cad);
70
static void DeleteLines(Widget w, XtPointer cld, XtPointer cad);
71
static void ColumnZeroNoEdit(Widget w, XtPointer cld, XtPointer cad);
72
static void ColumnNoEdit(Widget w, XtPointer cld, XtPointer cad);
73
static void set_2xN(Widget w, XtPointer address, XrmQuark type, Cardinal size);
74
static void get_2xN(Widget w, XtPointer address, XrmQuark type, Cardinal size);
75
static void set_CE_Type(Widget w, XtPointer address, XrmQuark type, Cardinal size);
76
static Boolean getCE_TypeValues(lListElem *ep, const char **ce_entry);
77
static Boolean setCE_TypeValues(lListElem *ep, char **ce_entry);
78
static void set_CX_Type(Widget w, XtPointer address, XrmQuark type, Cardinal size);
79
static void get_CX_Type(Widget w, XtPointer address, XrmQuark type, Cardinal size);
83
static XmtWidgetType widgets[] = {
85
"Matrix_2xN", /* name */
87
CreateMatrix, /* constructor */
88
set_2xN, /* procedure to set a value on widget */
89
get_2xN, /* procedure to get a value from widget */
90
False /* not a popup widget */
93
"UserMatrix", /* name */
95
CreateMatrix, /* constructor */
96
NULL, /* procedure to set a value on widget */
97
NULL, /* procedure to get a value from widget */
98
False /* not a popup widget */
134
/*-------------------------------------------------------------------------*/
136
/*-------------------------------------------------------------------------*/
137
void QmonRegisterMatrixWidgets(void)
139
QmonInitQuarks(); /* initialize the quarks */
140
XmtRegisterWidgetTypes(widgets, XtNumber(widgets));
143
/*-------------------------------------------------------------------------*/
145
/*-------------------------------------------------------------------------*/
146
static Widget CreateMatrixSimple(
153
#ifndef TEXTCHILD_BUG
157
matrix = XtCreateWidget(name, xbaeMatrixWidgetClass, parent,
160
#ifndef TEXTCHILD_BUG
161
XtVaGetValues(matrix, XmNtextField, &textChild, NULL);
162
XtAddCallback(textChild, XmNlosingFocusCallback,
163
qmonMatrixLoseFocus, (XtPointer) matrix);
166
** register callback procedures
168
XmtVaRegisterCallbackProcedures(
169
"DeleteLines", DeleteLines, XtRWidget,
170
"ColumnZeroNoEdit", ColumnZeroNoEdit, NULL,
171
"ColumnNoEdit", ColumnNoEdit, NULL,
178
/*-------------------------------------------------------------------------*/
179
static Widget CreateMatrix(
188
matrix = XtCreateWidget(name, xbaeMatrixWidgetClass, parent,
191
#ifndef TEXTCHILD_BUG
192
XtVaGetValues(matrix, XmNtextField, &textChild, NULL);
193
XtAddCallback(textChild, XmNlosingFocusCallback,
194
qmonMatrixLoseFocus, (XtPointer) matrix);
196
XtAddCallback(matrix, XmNtraverseCellCallback,
197
qmonMatrixTraverse, NULL);
198
XtAddCallback(matrix, XmNselectCellCallback,
199
qmonMatrixSelect, NULL);
201
** register callback procedures
203
XmtVaRegisterCallbackProcedures(
204
"DeleteLines", DeleteLines, XtRWidget,
205
"ColumnZeroNoEdit", ColumnZeroNoEdit, NULL,
206
"ColumnNoEdit", ColumnNoEdit, NULL,
212
/*-------------------------------------------------------------------------*/
213
void qmonMatrixSelect(Widget w, XtPointer cld, XtPointer cad)
215
XbaeMatrixSelectCellCallbackStruct *cbs =
216
(XbaeMatrixSelectCellCallbackStruct*) cad;
219
Widget* matrices = (Widget*) cld;
221
DENTER(GUI_LAYER, "qmonMatrixSelect");
223
if (cbs->params && !strcmp(cbs->params[0], "begin")) {
224
XbaeMatrixDeselectAll(w);
225
while (matrices && *matrices) {
226
XbaeMatrixDeselectAll(*matrices);
229
XbaeMatrixSelectRow(w, cbs->row);
232
if (cbs->params && !strcmp(cbs->params[0], "end")) {
233
while (matrices && *matrices) {
234
XbaeMatrixDeselectAll(*matrices);
237
select_begin = XbaeMatrixFirstSelectedRow(w);
238
if (select_begin == -1) {
239
XbaeMatrixSelectRow(w, cbs->row);
243
if (cbs->row < select_begin) {
244
for (i=cbs->row; i<select_begin; i++)
245
XbaeMatrixSelectRow(w, i);
248
for (i=select_begin; i<=cbs->row; i++)
249
XbaeMatrixSelectRow(w, i);
252
if (cbs->params && !strcmp(cbs->params[0], "toggle")) {
253
if (XbaeMatrixIsRowSelected(w, cbs->row)) {
254
DPRINTF(("XbaeMatrixDeselectRow\n"));
255
XbaeMatrixDeselectRow(w, cbs->row);
258
XbaeMatrixSelectRow(w, cbs->row);
259
DPRINTF(("XbaeMatrixSelectRow\n"));
263
if (cbs->params && !strcmp(cbs->params[0], "editall")) {
264
XbaeMatrixEditCell(w, cbs->row, cbs->column);
267
if (cbs->params && !strcmp(cbs->params[0], "edit") && cbs->column != 0) {
268
XbaeMatrixEditCell(w, cbs->row, cbs->column);
275
/*-------------------------------------------------------------------------*/
276
static void DeleteLines(Widget w, XtPointer cld, XtPointer cad)
278
Widget matrix = (Widget) cld;
281
int rows_to_delete = 0;
286
DENTER(GUI_LAYER, "DeleteLines");
293
/* max_rows = XbaeMatrixVisibleRows(matrix); */
295
rows = rows_old = XbaeMatrixNumRows(matrix);
297
for (i=0; i<rows; i++)
298
if (XbaeMatrixIsRowSelected(matrix, i))
303
if (XbaeMatrixIsRowSelected(matrix, i)) {
304
XbaeMatrixDeleteRows(matrix, i, 1);
311
if ((rows_old - rows_to_delete) < max_rows)
312
XbaeMatrixAddRows(matrix, rows, NULL, NULL, NULL, (max_rows - rows));
314
/* reset attribute line */
315
XbaeMatrixDeselectAll(matrix);
317
/* refresh the matrix */
318
XbaeMatrixRefresh(matrix);
324
/*-------------------------------------------------------------------------*/
325
static void ColumnZeroNoEdit(Widget w, XtPointer cld, XtPointer cad)
327
XbaeMatrixEnterCellCallbackStruct *cbs =
328
(XbaeMatrixEnterCellCallbackStruct*) cad;
330
DENTER(GUI_LAYER, "ColumnZeroNoEdit");
332
if (cbs->column == 0)
338
/*-------------------------------------------------------------------------*/
339
static void ColumnNoEdit(Widget w, XtPointer cld, XtPointer cad)
341
XbaeMatrixEnterCellCallbackStruct *cbs =
342
(XbaeMatrixEnterCellCallbackStruct*) cad;
344
DENTER(GUI_LAYER, "ColumnNoEdit");
354
/*-------------------------------------------------------------------------*/
355
static void qmonMatrixTraverse(Widget w, XtPointer cld, XtPointer cad)
357
XbaeMatrixTraverseCellCallbackStruct *cbs =
358
(XbaeMatrixTraverseCellCallbackStruct*) cad;
359
static XrmQuark QDown = NULLQUARK;
360
static XrmQuark QRight = NULLQUARK;
361
static XrmQuark QUp = NULLQUARK;
363
DENTER(GUI_LAYER, "qmonMatrixTraverse");
366
* Get the Quarks we care about
368
if (QDown == NULLQUARK) {
369
QDown = XrmStringToQuark("Down");
370
QUp = XrmStringToQuark("Up");
371
QRight = XrmStringToQuark("Right");
375
** if we are moving up don't jump to last row when we are in row 0
377
if ((cbs->qparam == QUp && cbs->row == 0)) {
378
cbs->next_row = cbs->row;
382
* If we are moving down, and we are at the last row, add a new row
383
* and traverse to it.
385
if ((cbs->qparam == QDown && cbs->row == cbs->num_rows - 1) ||
386
(cbs->qparam == QRight && cbs->row == cbs->num_rows - 1 &&
387
cbs->column == cbs->num_columns)) {
388
XbaeMatrixAddRows(w, cbs->num_rows, NULL, NULL, NULL, 1);
389
cbs->next_row = cbs->num_rows;
390
cbs->next_column = cbs->column;
396
/*-------------------------------------------------------------------------*/
397
static void qmonMatrixLoseFocus(Widget w, XtPointer cld, XtPointer cad)
399
Widget matrix = (Widget) cld;
400
XbaeMatrixCommitEdit(matrix, False);
403
/*-------------------------------------------------------------------------*/
412
if (type != QmonQVA_Type && type != QmonQCE2_Type &&
413
type != QmonQHS_Type && type != QmonQMR_Type &&
414
type != QmonQPN_Type && type != QmonQAT_Type &&
415
type != QmonQSO_Type && type != QmonQUA_Type) {
416
XmtWarningMsg("XmtDialogSetDialogValues", "XbaeMatrix",
417
"Type Mismatch: Widget '%s':\n\tCan't set widget values"
418
" from a resource of type '%s'",
419
XtName(w), XrmQuarkToString(type));
424
if (size == sizeof(lList*))
425
lp = *(lList**) address;
429
if (type == QmonQVA_Type)
430
qmonSet2xN(w, lp, VA_variable, VA_value);
431
else if ( type == QmonQCE2_Type )
432
qmonSet2xN(w, lp, CE_name, CE_stringval);
433
else if ( type == QmonQHS_Type )
434
qmonSet2xN(w, lp, HS_name, HS_value);
435
else if ( type == QmonQMR_Type )
436
qmonSet2xN(w, lp, MR_user, MR_host);
437
else if ( type == QmonQPN_Type )
438
qmonSet2xN(w, lp, PN_path, PN_host);
439
else if ( type == QmonQAT_Type )
440
qmonSet2xN(w, lp, AT_account, AT_cell);
441
else if ( type == QmonQSO_Type )
442
qmonSet2xN(w, lp, SO_name, SO_threshold);
443
else if ( type == QmonQUA_Type )
444
qmonSet2xN(w, lp, UA_name, UA_value);
449
/*-------------------------------------------------------------------------*/
458
if (type != QmonQVA_Type && type != QmonQCE2_Type &&
459
type != QmonQHS_Type && type != QmonQMR_Type &&
460
type != QmonQPN_Type && type != QmonQAT_Type &&
461
type != QmonQSO_Type && type != QmonQUA_Type) {
462
XmtWarningMsg("XmtDialogGetDialogValues", "XbaeMatrix",
463
"Type Mismatch: Widget '%s':\n\tCan't get widget values"
464
" from a resource of type '%s'",
465
XtName(w), XrmQuarkToString(type));
470
if (type == QmonQVA_Type)
471
lp = qmonGet2xN(w, VA_Type, VA_variable, VA_value);
472
else if ( type == QmonQCE2_Type )
473
lp = qmonGet2xN(w, CE_Type, CE_name, CE_stringval);
474
else if ( type == QmonQHS_Type )
475
lp = qmonGet2xN(w, HS_Type, HS_name, HS_value);
476
else if ( type == QmonQMR_Type )
477
lp = qmonGet2xN(w, MR_Type, MR_user, MR_host);
478
else if ( type == QmonQPN_Type )
479
lp = qmonGet2xN(w, PN_Type, PN_path, PN_host);
480
else if ( type == QmonQAT_Type )
481
lp = qmonGet2xN(w, AT_Type, AT_account, AT_cell);
482
else if ( type == QmonQSO_Type )
483
lp = qmonGet2xN(w, SO_Type, SO_name, SO_threshold);
484
else if ( type == QmonQUA_Type )
485
lp = qmonGet2xN(w, UA_Type, UA_name, UA_value);
487
*(lList**)address = lp;
491
/*-------------------------------------------------------------------------*/
508
DENTER(GUI_LAYER, "qmonSetNxN");
511
XtVaSetValues(w, XmNcells, NULL, NULL);
518
field = (int *)malloc(num_fields*sizeof(int));
519
col = (const char **)malloc(num_fields*sizeof(char *));
520
if (field == NULL || col == NULL) {
524
va_start(ap, num_fields);
525
for(i=0; i<num_fields; i++)
526
field[i] = va_arg(ap, int);
528
XtVaGetValues(w, XmNrows, &max_rows, NULL);
530
for (ep = lFirst(lp), row = 0; ep; ep = lNext(ep), row++) {
531
if (row == max_rows) {
534
NULL, /* empty rows */
535
NULL, /* no lables */
536
NULL, /* no different colors */
537
1); /* we add 1 rows */
541
memset(col, 0, num_fields*sizeof(char *));
547
for(i=0; i<num_fields; i++) {
549
switch (lGetType(lGetListDescr(lp), field[i])) {
551
col[i] = (StringConst)lGetString(ep, field[i]);
554
col[i] = (StringConst)lGetHost(ep,field[i]);
557
val = (int)lGetUlong(ep, field[i]);
560
sprintf(buf, "%d", val);
566
sprintf(buf, "%d", val);
571
dval = lGetDouble(ep, field[i]);
572
sprintf(buf, "%.2f", dval);
580
for(i=0; i<num_fields; i++)
581
XbaeMatrixSetCell(w, row, i, col[i] ? (String)col[i] : "");
591
/*-------------------------------------------------------------------------*/
606
DENTER(GUI_LAYER, "qmonGetNxN");
608
field = (int *)malloc(num_fields*sizeof(int));
609
col = (char **)malloc(num_fields*sizeof(char *));
610
if (field == NULL || col == NULL) {
614
va_start(ap, num_fields);
615
for(i=0; i<num_fields; i++)
616
field[i] = va_arg(ap, int);
618
XtVaGetValues(w, XmNrows, &max_rows, NULL);
620
for (row=0; row<max_rows; row++) {
621
memset(col, 0, num_fields*sizeof(char *));
622
for(i=0; i<num_fields; i++)
623
col[i] = XbaeMatrixGetCell(w, row, i);
624
if (col[0] && col[0][0] != '\0') {
626
lp = lCreateList(XtName(w), dp);
627
ep = lCreateElem(dp);
631
* retrieve values from columns
634
for(i=0; i<num_fields; i++) {
635
switch(lGetType(lGetListDescr(lp), field[i])) {
637
lSetString(ep, field[i], col[i] ? col[i] : "" );
640
lSetHost(ep, field[i], col[i] ? col[i] : "");
643
lSetUlong(ep, field[i], col[i] ? atoi(col[i]) : 0);
646
lSetDouble(ep, field[i], col[i] ? atof(col[i]) : 0.0);
665
/*-------------------------------------------------------------------------*/
672
qmonSetNxN(w, lp, 2, field1, field2);
676
/*-------------------------------------------------------------------------*/
683
return qmonGetNxN(w, dp, 2, field1, field2);
688
/*-------------------------------------------------------------------------*/
698
const char *col1 = NULL, *col2 = NULL;
703
DENTER(GUI_LAYER, "qmonSet2xN");
706
XtVaSetValues(w, XmNcells, NULL, NULL);
713
XtVaGetValues(w, XmNrows, &max_rows, NULL);
715
for (ep = lFirst(lp), row = 0; ep; ep = lNext(ep), row++) {
716
if (row == max_rows) {
719
NULL, /* empty rows */
720
NULL, /* no lables */
721
NULL, /* no different colors */
722
1); /* we add 1 rows */
726
** the first column of the matrix can be string or host type
729
switch (lGetType(lGetListDescr(lp), field1)) {
731
col1 = (StringConst)lGetString(ep, field1);
734
col1 = (StringConst)lGetHost(ep,field1);
738
** the second column can be of different type
740
switch (lGetType(lGetListDescr(lp), field2)) {
742
col2 = (StringConst)lGetString(ep, field2);
745
col2 = (StringConst)lGetHost(ep,field2);
748
val = (int)lGetUlong(ep, field2);
750
sprintf(buf, "%d", val);
757
dval = lGetDouble(ep, field2);
758
sprintf(buf, "%.2f", dval);
765
XbaeMatrixSetCell(w, row, 0 , col1 ? (String)col1 : "");
767
XbaeMatrixSetCell(w, row, 1 , col2 ? (String)col2 : "");
774
/*-------------------------------------------------------------------------*/
787
DENTER(GUI_LAYER, "qmonGet2xN");
789
XtVaGetValues(w, XmNrows, &max_rows, NULL);
791
for (row=0; row<max_rows; row++) {
792
col1 = XbaeMatrixGetCell(w, row, 0);
793
col2 = XbaeMatrixGetCell(w, row, 1);
794
if (col1 && col1[0] != '\0') {
796
lp = lCreateList(XtName(w), dp);
797
ep = lCreateElem(dp);
801
** the first field in the column can be host or string
804
switch(lGetType(lGetListDescr(lp), field1)) {
806
lSetString(ep, field1, col1 ? col1 : "");
809
lSetHost(ep, field1, col1 ? col1 : "");
814
** the second field can be of different type
816
switch(lGetType(lGetListDescr(lp), field2)) {
818
lSetString(ep, field2, col2 ? col2 : "" );
821
lSetHost(ep, field2, col2 ? col2 : "");
824
lSetUlong(ep, field2, col2 ? atoi(col2) : 0);
827
lSetDouble(ep, field2, col2 ? atof(col2) : 0.0);
842
/*-------------------------------------------------------------------------*/
843
/*-------------------------------------------------------------------------*/
844
/*-------------------------------------------------------------------------*/
845
/*-------------------------------------------------------------------------*/
846
static void set_CE_Type(
854
if (type != QmonQCE_Type) {
855
XmtWarningMsg("XmtDialogSetDialogValues", "XbaeMatrix",
856
"Type Mismatch: Widget '%s':\n\tCan't set widget values"
857
" from a resource of type '%s'; QmonQCE_Type expected.",
858
XtName(w), XrmQuarkToString(type));
863
if (size == sizeof(lList*))
864
lp = *(lList**) address;
868
qmonSetCE_Type(w, lp, CE_TYPE_REDUCED);
872
/*-------------------------------------------------------------------------*/
881
const char *ce_entry[CE_MAX];
884
DENTER(GUI_LAYER, "qmonSetCE_Type");
886
XtVaGetValues(w, XmNrows, &max_rows, NULL);
889
XtVaSetValues(w, XmNcells, NULL, NULL);
891
for (ep = lFirst(lp), row = 0; ep; ep = lNext(ep), row++) {
892
if (row == max_rows) {
895
NULL, /* empty rows */
896
NULL, /* no lables */
897
NULL, /* no different colors */
898
1); /* we add 1 row */
901
if (getCE_TypeValues(ep, ce_entry)) {
903
for (i=0; i<CE_MAX; i++) {
905
XbaeMatrixSetCell(w, row, i,
906
ce_entry[i] ? (String)ce_entry[i] : "");
911
XbaeMatrixSetCell(w, row, 0,
912
ce_entry[CE_NAME] ? (String)ce_entry[CE_NAME] : "");
914
XbaeMatrixSetCell(w, row, 1,
915
ce_entry[CE_TYPE] ? (String)ce_entry[CE_TYPE] : "");
917
XbaeMatrixSetCell(w, row, 2,
918
ce_entry[CE_RELOP] ? (String)ce_entry[CE_RELOP] : "");
922
DPRINTF(("qmonSetCE_Type failure\n"));
929
/*-------------------------------------------------------------------------*/
930
static Boolean getCE_TypeValues(
932
StringConst *ce_entry
934
DENTER(GUI_LAYER, "getCE_TypeValues");
936
if (!ep || !ce_entry ) {
941
/* name type relation value */
942
ce_entry[CE_NAME] = (StringConst)lGetString(ep, CE_name);
943
ce_entry[CE_SHORTCUT] = (StringConst)lGetString(ep, CE_shortcut);
944
ce_entry[CE_TYPE] = (StringConst)map_type2str(lGetUlong(ep, CE_valtype));
946
switch (lGetUlong(ep, CE_relop)) {
948
ce_entry[CE_RELOP] = "<";
951
ce_entry[CE_RELOP] = ">";
954
ce_entry[CE_RELOP] = "<=";
957
ce_entry[CE_RELOP] = ">=";
960
ce_entry[CE_RELOP] = "==";
963
ce_entry[CE_RELOP] = "!=";
966
ce_entry[CE_RELOP] = "??";
968
ce_entry[CE_REQUEST] = lGetUlong(ep, CE_requestable) == REQU_FORCED ? "FORCED" :
969
(lGetUlong(ep, CE_requestable) == REQU_YES ? "YES" : "NO");
970
ce_entry[CE_CONSUMABLE] = lGetBool(ep, CE_consumable) ? "YES" : "NO";
971
ce_entry[CE_DEFAULT] = (StringConst)lGetString(ep, CE_default);
972
ce_entry[CE_URGENCY] = (StringConst)lGetString(ep, CE_urgency_weight);
978
/*-------------------------------------------------------------------------*/
979
static Boolean setCE_TypeValues(
984
u_long32 requestable = REQU_NO;
986
DENTER(GUI_LAYER, "setCE_TypeValues");
993
/* name type relation value */
994
lSetString(ep, CE_name, ce_entry[CE_NAME] ? qmon_trim(ce_entry[CE_NAME]): "");
995
lSetString(ep, CE_shortcut, ce_entry[CE_SHORTCUT] ? qmon_trim(ce_entry[CE_SHORTCUT]): "" );
998
for (i=TYPE_FIRST; !type && i<=TYPE_CE_LAST; i++) {
999
if (!strcasecmp(ce_entry[CE_TYPE], map_type2str(i)))
1003
DPRINTF(("setCE_TypeValues: unknown type\n"));
1007
lSetUlong(ep, CE_valtype, type);
1010
for (i=CMPLXEQ_OP; !relop && i<=CMPLXNE_OP; i++) {
1011
if (!strcmp(ce_entry[CE_RELOP], map_op2str(i)))
1015
DPRINTF(("invalid relation operator: %s\n", ce_entry[CE_RELOP]));
1019
lSetUlong(ep, CE_relop, relop);
1021
if (!strcasecmp(ce_entry[CE_REQUEST], "y")
1022
|| !strcasecmp(ce_entry[CE_REQUEST], "yes"))
1023
requestable = REQU_YES;
1024
else if (!strcasecmp(ce_entry[CE_REQUEST], "n")
1025
|| !strcasecmp(ce_entry[CE_REQUEST], "no"))
1026
requestable = REQU_NO;
1027
else if (!strcasecmp(ce_entry[CE_REQUEST], "f")
1028
|| !strcasecmp(ce_entry[CE_REQUEST], "forced")) {
1029
requestable = REQU_FORCED;
1032
DPRINTF(("invalid requestable entry: %s\n", ce_entry[CE_REQUEST]));
1035
lSetUlong(ep, CE_requestable, requestable);
1037
if (!strcasecmp(ce_entry[CE_CONSUMABLE], "y")
1038
|| !strcasecmp(ce_entry[CE_CONSUMABLE], "yes"))
1039
lSetBool(ep, CE_consumable, true);
1040
else if (!strcasecmp(ce_entry[CE_CONSUMABLE], "n")
1041
|| !strcasecmp(ce_entry[CE_CONSUMABLE], "no"))
1042
lSetBool(ep, CE_consumable, false);
1044
lSetString(ep, CE_default, ce_entry[CE_DEFAULT] ? qmon_trim(ce_entry[CE_DEFAULT]): "");
1045
lSetString(ep, CE_urgency_weight, ce_entry[CE_URGENCY] ? qmon_trim(ce_entry[CE_URGENCY]): "");
1052
/*-------------------------------------------------------------------------*/
1053
/*-------------------------------------------------------------------------*/
1054
/*-------------------------------------------------------------------------*/
1055
/*-------------------------------------------------------------------------*/
1056
static void set_CX_Type(
1064
if (type != QmonQCX_Type) {
1065
XmtWarningMsg("XmtDialogSetDialogValues", "XbaeMatrix",
1066
"Type Mismatch: Widget '%s':\n\tCan't set widget values"
1067
" from a resource of type '%s'; QmonQCX_Type expected.",
1068
XtName(w), XrmQuarkToString(type));
1073
if (size == sizeof(lList*))
1074
lp = *(lList**) address;
1078
qmonSetCE_Type(w, lp, CE_TYPE_FULL);
1083
/*-------------------------------------------------------------------------*/
1084
static void get_CX_Type(
1092
if (type != QmonQCX_Type) {
1093
XmtWarningMsg("XmtDialogSetDialogValues", "XbaeMatrix",
1094
"Type Mismatch: Widget '%s':\n\tCan't get widget values"
1095
" from a resource of type '%s'; QmonQCX_Type expected.",
1096
XtName(w), XrmQuarkToString(type));
1101
lp = qmonGetCE_Type(w);
1103
*(lList**)address = lp;
1108
/*-------------------------------------------------------------------------*/
1109
lList* qmonGetCE_Type(
1116
char *ce_entry[CE_MAX];
1119
DENTER(GUI_LAYER, "qmonGetCE_Type");
1121
XtVaGetValues(w, XmNrows, &max_rows, NULL);
1122
lp = lCreateList(XtName(w), CE_Type);
1123
for (row=0; row<max_rows && lp; row++) {
1124
for (k=0; k<CE_MAX; k++)
1125
ce_entry[k] = XbaeMatrixGetCell(w, row, k);
1126
if (ce_entry[CE_NAME] && ce_entry[CE_NAME][0] != '\0') {
1127
ep = lCreateElem(CE_Type);
1128
setCE_TypeValues(ep, ce_entry);
1129
lAppendElem(lp, ep);