home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume10
/
contool
/
part01
/
load.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-30
|
3KB
|
95 lines
/************************************************************************/
/* Copyright 1988-1990 by Chuck Musciano and Harris Corporation */
/* */
/* Permission to use, copy, modify, and distribute this software */
/* and its documentation for any purpose and without fee is */
/* hereby granted, provided that the above copyright notice */
/* appear in all copies and that both that copyright notice and */
/* this permission notice appear in supporting documentation, and */
/* that the name of Chuck Musciano and Harris Corporation not be */
/* used in advertising or publicity pertaining to distribution */
/* of the software without specific, written prior permission. */
/* Chuck Musciano and Harris Corporation make no representations */
/* about the suitability of this software for any purpose. It is */
/* provided "as is" without express or implied warranty. This */
/* software may not be sold without the prior explicit permission */
/* of Harris Corporation. */
/************************************************************************/
/************************************************************************/
/* */
/* load.c contool load dialog manager */
/* */
/************************************************************************/
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/xv_xrect.h>
#include "manifest.h"
#include "contool.h"
#include "contool_ui.h"
PRIVATE contool_load_objects *contool_load = NULL;
/************************************************************************/
EXPORT Menu_item popup_load_config(item, op)
Menu_item item;
Menu_generate op;
{ contool_base_objects * ip = (contool_base_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
if (op == MENU_NOTIFY) {
if (contool_load == NULL) {
contool_load = contool_load_objects_initialize(NULL, ip->base);
xv_set(contool_load->load_file,
PANEL_NOTIFY_LEVEL, PANEL_SPECIFIED,
PANEL_NOTIFY_STRING, "\n\r ",
NULL);
xv_set(contool_load->load_type, PANEL_VALUE, 3, NULL);
place_dialog(ip->base, contool_load->load);
}
xv_set(contool_load->load_file, PANEL_VALUE, filter_file, NULL);
xv_set(contool_load->load, XV_SHOW, TRUE, NULL);
}
return item;
}
/************************************************************************/
EXPORT void load_filters(item, event)
Panel_item item;
Event *event;
{ contool_load_objects *ip = (contool_load_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
int kind;
char *path;
path = expand_tilde(xv_get(ip->load_file, PANEL_VALUE));
if (lex_init(path)) {
yyparse();
if (parse_errors_occured) {
error("Error in configuration file. Configuration not loaded");
xv_set(ip->accept_load, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
}
else {
kind = (int) xv_get(ip->load_type, PANEL_VALUE);
if (kind & 1 && parsed_defaults)
defaults = *parsed_defaults;
if (kind & 2)
filters = parsed_filters;
free(parsed_defaults);
filter_file = path;
}
}
else {
error("Unable to read configuration file");
xv_set(ip->accept_load, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
free(path);
}
}