/************************************************************************ ** ** FILE : hastename.c ** ** ZWECK : ** ** AUTOR : Michael C. Ancutici ** Universitaet Stuttgart, Fakultaet Informatik ** ** DATUM : 14.03.93 ** *************************************************************************/ #include "hastename.h" #include "hawin.h" #include "haste.h" #include "ste.h" #include "cellname.h" #include "harefreshx.h" /************************************************************************* ** FUNKTION: HaSteNDrawX ** ZWECK: zeichnet den Namen einer Stelle in Pixmap ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaSteNDrawX( SNr, ActualGC) int SNr; GC ActualGC; { int n; if ( (n = strlen(SteStelle[ SNr]->Name)) == 0) return; XDrawImageString( MyDisplay, HaGraphPixmap, ActualGC, SteStelle[ SNr]->PosName.x, SteStelle[ SNr]->PosName.y, SteStelle[ SNr]->Name, n); } /************************************************************************* ** FUNKTION: HaSteNDraw ** ZWECK: zeichnet den Namen einer Stelle in Pixmap und Window ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaSteNDraw( SNr, ActualGC) int SNr; GC ActualGC; { int n; int x, y; if ( (n = strlen(SteStelle[ SNr]->Name)) == 0) return; XDrawImageString( MyDisplay, HaGraphPixmap, ActualGC, (x = SteStelle[ SNr]->PosName.x), (y = SteStelle[ SNr]->PosName.y), SteStelle[ SNr]->Name, n); y -= 10; XCopyArea( MyDisplay, HaGraphPixmap, XtWindow( HaGraphPlane), DefaultGCOfScreen( XtScreen( HaGraphPlane)), x, y, 100, 20, x, y); } /************************************************************************* ** FUNKTION: HaSteNReplX ** ZWECK: ersetzt alten Namen der Stelle durch neuen. ** In SteStelle und grapfisch in Pixmap. ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaSteNReplX( SNr, Neu) int SNr; char *Neu; { char *Alt; int n; if ( (strcmp( (Alt = SteStelle[ SNr]->Name), Neu)) == 0) return; /**** ALTEN NAMEN LOESCHEN *********************************************/ if ( (n = strlen( Alt)) != 0) { XSetForeground( MyDisplay, SteGC, HaBackColor); CellSteNDel( SNr, XTextWidth( HaNameFont, Alt, n)); HaSteNDrawX( SNr, SteGC); XSetForeground( MyDisplay, SteGC, HaSteColor); HaRefreshXFromRL(); } /**** NEUEN NAMEN SETZEN *********************************************/ strcpy( Alt, Neu); if ( (n = strlen( Neu)) != 0) { CellSteNEin( SNr, XTextWidth( HaNameFont, Neu, n), &(SteStelle[ SNr]->PosName.x), &(SteStelle[ SNr]->PosName.y) ); HaSteNDrawX( SNr, SteGC); } } /************************************************************************* ** FUNKTION: HaSteNRepl ** ZWECK: ersetzt alten Namen der Stelle durch neuen. ** In SteStelle und grapfisch in Pixmap und Window. ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaSteNRepl( SNr, Neu) int SNr; char *Neu; { char *Alt; int n; if ( (strcmp( (Alt = SteStelle[ SNr]->Name), Neu)) == 0) return; /**** ALTEN NAMEN LOESCHEN *********************************************/ if ( (n = strlen( Alt)) != 0) { XSetForeground( MyDisplay, SteGC, HaBackColor); CellSteNDel( SNr, XTextWidth( HaNameFont, Alt, n)); HaRefreshXFromRL(); HaSteNDraw( SNr, SteGC); XSetForeground( MyDisplay, SteGC, HaSteColor); } /**** NEUEN NAMEN SETZEN *********************************************/ strcpy( Alt, Neu); if ( (n = strlen( Neu)) != 0) { CellSteNEin( SNr, XTextWidth( HaNameFont, Neu, n), &(SteStelle[ SNr]->PosName.x), &(SteStelle[ SNr]->PosName.y) ); HaSteNDraw( SNr, SteGC); } }