/***************************************************************************** FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/xgui/sources/ui_mainP.c,v $ SHORTNAME : mainP.c SNNS VERSION : 4.2 PURPOSE : PURPOSE : contains callback routines of the gui window NOTES : AUTHOR : Tilman Sommer DATE : 1.4.1990 CHANGED BY : Michael Vogt, Guenter Mamier RCS VERSION : $Revision: 2.26 $ LAST CHANGE : $Date: 1998/05/20 15:00:40 $ Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG ******************************************************************************/ #include #include #include /* For the Syntax message */ #include #include #include #include "ui.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "kr_ui.h" #include "ui_info.h" #include "ui_setup.h" #include "ui_layer.h" #include "ui_layerP.h" #include "ui_file.h" #include "ui_fileP.h" #include "ui_netGraph.h" #include "ui_netUpdate.h" #include "ui_event.h" #include "ui_key.h" #include "ui_confirmer.h" #include "ui_xWidgets.h" #include "ui_lists.h" #include "ui_display.h" #include "ui_control.h" #include "ui_controlP.h" #include "ui_edit.h" #include "ui_xGraphic.h" #include "ui_textP.h" #include "ui_funcdispl.h" #include "ui_action.h" #include "ui_result.h" #include "ui_main.h" #include "ui_print.h" #include "ui_color.h" #include "ui_infoP.h" #include "ui_mainP.ph" #ifdef PARAGON_KERNEL #include "kr_ipmp.h" #endif /***************************************************************************** FUNCTION : ui_createGC PURPOSE : create the GC and load the graphic font RETURNS : void NOTES : window is any existing window of a widget on the screen used by xgui. UPDATE : 20.9.1990 ******************************************************************************/ void ui_xCreateGC (Window window) { int count; char buf[255]; char **fontList; ui_fontStruct = XLoadQueryFont(ui_display, ui_dfontName); if (ui_fontStruct == 0) { printf("Can't find display font specified in command line\n"); exit(1); }else{ fontList = XListFonts(ui_display, ui_dfontName, 1, &count); if (count != 0) { sprintf (buf, "Display-Font %s loaded\n", *fontList); ui_tw_printMessage(buf); } XFreeFontNames(fontList); } ui_gcValues.line_width = 0; ui_gcValues.line_style = LineSolid; /* Set (or get) the next two attributes, because ui_drawUnit() in the file ui_netGraphics.c need this information */ ui_gc = XCreateGC(ui_display, window, GCLineWidth | GCLineStyle, &ui_gcValues); XSetFunction(ui_display,ui_gc, GXcopy); XSetFont(ui_display, ui_gc, ui_fontStruct->fid); } /***************************************************************************** FUNCTION : ui_printMessage PURPOSE : display a message in the manager panel RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ void ui_printMessage (char *msgString) { ui_xSetLabel(ui_message, msgString); XFlush(ui_display); } /***************************************************************************** FUNCTION : ui_displayDone PURPOSE : close a xgui display RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ void ui_displayDone (Widget widget, struct Ui_DisplayType *displayPtr, caddr_t call_data) { XtDestroyWidget(XtParent(displayPtr->frameWidget)); displayPtr->frameWidget = NULL; displayPtr->widget = NULL; displayPtr->drawable = 0; ui_displ_freeItem(displayPtr); } /***************************************************************************** FUNCTION : ui_helpDone PURPOSE : close a xgui help window RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ /*ARGSUSED*/ static void ui_helpDone (Widget widget, struct HelpType *helpPtr, caddr_t call_data) { struct HelpType *listPtr; if (ui_help_listPtr == helpPtr) { ui_help_listPtr = helpPtr->nextPtr; helpPtr->nextPtr = ui_help_freeListPtr; ui_help_freeListPtr = helpPtr; XtDestroyWidget(helpPtr->shellWidget); } else { listPtr = ui_help_listPtr; while (listPtr->nextPtr != NULL AND listPtr->nextPtr != helpPtr) listPtr = listPtr->nextPtr; if (listPtr->nextPtr == helpPtr) { listPtr->nextPtr = helpPtr->nextPtr; helpPtr->nextPtr = ui_help_freeListPtr; ui_help_freeListPtr = helpPtr; XtDestroyWidget(helpPtr->shellWidget); } } } /***************************************************************************** FUNCTION : ui_listPopupDone PURPOSE : close a list panel RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ static void ui_listPopupDone (Widget widget, struct SimpleListType *listDescriptorPtr, caddr_t call_data) { int i; XtDestroyWidget(ui_popList); ui_pop_exit = TRUE; /* signal to leave temporary event loop */ XFlush(ui_display); /* keep the allocated space of the array, but free all the space of valid strings */ for (i = 1; i<= listDescriptorPtr->noOfItems; i++) free((listDescriptorPtr->listPtr)[i-1]); listDescriptorPtr->noOfItems = 0; } /***************************************************************************** FUNCTION : ui_editPopupDone PURPOSE : close a edit panel RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ static void ui_editPopupDone (Widget widget, struct SimpleListType *listDescriptorPtr, caddr_t call_data) { int i; XtDestroyWidget(ui_popEdit); /* keep the allocated space of the array, but free all the space of valid strings */ for (i = 1; i<= listDescriptorPtr->noOfItems; i++) free((listDescriptorPtr->listPtr)[i-1]); listDescriptorPtr->noOfItems = 0; } /***************************************************************************** FUNCTION : ui_popupDone PURPOSE : close other panels and windows RETURNS : void NOTES : UPDATE : 1.2.1990 ******************************************************************************/ /*ARGSUSED*/ void ui_popupDone (Widget widget, int client_data, caddr_t call_data) { char buf[80]; int gridSize, i; switch (client_data) { case UI_POPUP_DUMMY: XtDestroyWidget(ui_popDummy); break; case UI_POPUP_SETUP: ui_setupIsCreated = FALSE; gridSize = ui_xIntFromAsciiWidget(ui_set_gridWidthWidget); if (gridSize >= 1) ui_set_displayPtr->gridSize = gridSize; ui_set_displayPtr->origin.x = ui_xIntFromAsciiWidget(ui_set_originXWidget); ui_set_displayPtr->origin.y = ui_xIntFromAsciiWidget(ui_set_originYWidget); ui_set_displayPtr->subNetNo = ui_xIntFromAsciiWidget(ui_set_subnetWidget); sprintf(buf,"snns-display %d - subnet: %d", ui_set_displayPtr->displayNo, ui_set_displayPtr->subNetNo); ui_actualZvalue = ui_xIntFromAsciiWidget(ui_set_zWidget); XStoreName(ui_display, XtWindow(XtParent(ui_set_displayPtr->frameWidget)), buf); ui_net_completeRefresh(ui_set_displayPtr, UI_LOCAL); XtDestroyWidget(ui_popSetup); break; case UI_POPUP_FILE: ui_fileIsCreated = FALSE; ui_filePannelPoppedUp = FALSE; XtDestroyWidget(ui_popFile); break; case UI_POPUP_LAYER: ui_layer_setLayerNames(); XtDestroyWidget(ui_popLayer); ui_pop_exit = TRUE; /* signal to leave temporary loop */ XFlush(ui_display); break; case UI_POPUP_CONTROL: for (i=0; i