From 46ea8bc12e435b7ca6593bc43498ef6aae3e261a Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 13 Apr 2005 14:07:59 +0000 Subject: Expanded the tabs into spaces to make the indenting independant of the editing environment (emacs vs vi for example). --- generic/Window.c | 240 +++++++++++++++++++++++++++---------------------------- 1 file changed, 120 insertions(+), 120 deletions(-) (limited to 'generic/Window.c') diff --git a/generic/Window.c b/generic/Window.c index d02c302..e00d7ec 100644 --- a/generic/Window.c +++ b/generic/Window.c @@ -1,8 +1,8 @@ /* * Window.c -- Implementation of Window item. * - * Authors : Patrick LECOANET - * Creation date : Fri May 12 11:25:53 2000 + * Authors : Patrick LECOANET + * Creation date : Fri May 12 11:25:53 2000 */ /* @@ -43,24 +43,24 @@ static const char compile_id[] = "$Compile: " __FILE__ " " __DATE__ " " __TIME__ ********************************************************************************** */ typedef struct _WindowItemStruct { - ZnItemStruct header; + ZnItemStruct header; /* Public data */ - ZnPoint pos; - Tk_Anchor anchor; - Tk_Anchor connection_anchor; - Tk_Window win; - int width; - int height; + ZnPoint pos; + Tk_Anchor anchor; + Tk_Anchor connection_anchor; + Tk_Window win; + int width; + int height; /* Private data */ - ZnPoint pos_dev; - int real_width; - int real_height; + ZnPoint pos_dev; + int real_width; + int real_height; } WindowItemStruct, *WindowItem; -static ZnAttrConfig wind_attrs[] = { +static ZnAttrConfig wind_attrs[] = { { ZN_CONFIG_ANCHOR, "-anchor", NULL, Tk_Offset(WindowItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, { ZN_CONFIG_BOOL, "-composealpha", NULL, @@ -107,13 +107,13 @@ static ZnAttrConfig wind_attrs[] = { * * WindowDeleted -- * - * Do the bookeeping after a managed window deletion. + * Do the bookeeping after a managed window deletion. * ********************************************************************************** */ static void -WindowDeleted(ClientData client_data, - XEvent *event) +WindowDeleted(ClientData client_data, + XEvent *event) { WindowItem wind = (WindowItem) client_data; @@ -135,8 +135,8 @@ WindowDeleted(ClientData client_data, * A managed window changes requested dimensions. */ static void -WindowItemRequest(ClientData client_data, - Tk_Window win) +WindowItemRequest(ClientData client_data, + Tk_Window win) { WindowItem wind = (WindowItem) client_data; @@ -148,14 +148,14 @@ WindowItemRequest(ClientData client_data, * to another geometry manager. */ static void -WindowItemLostSlave(ClientData client_data, - Tk_Window win) +WindowItemLostSlave(ClientData client_data, + Tk_Window win) { WindowItem wind = (WindowItem) client_data; ZnWInfo *wi = ((ZnItem) wind)->wi; Tk_DeleteEventHandler(wi->win, StructureNotifyMask, WindowDeleted, - (ClientData) wind); + (ClientData) wind); if (wi->win != Tk_Parent(wind->win)) { Tk_UnmaintainGeometry(wind->win, wi->win); } @@ -164,9 +164,9 @@ WindowItemLostSlave(ClientData client_data, } static Tk_GeomMgr wind_geom_type = { - "zincwindow", /* name */ - WindowItemRequest, /* requestProc */ - WindowItemLostSlave, /* lostSlaveProc */ + "zincwindow", /* name */ + WindowItemRequest, /* requestProc */ + WindowItemLostSlave, /* lostSlaveProc */ }; @@ -178,11 +178,11 @@ static Tk_GeomMgr wind_geom_type = { ********************************************************************************** */ static int -Init(ZnItem item, - int *argc, - Tcl_Obj *CONST *args[]) +Init(ZnItem item, + int *argc, + Tcl_Obj *CONST *args[]) { - WindowItem wind = (WindowItem) item; + WindowItem wind = (WindowItem) item; /* Init attributes */ SET(item->flags, ZN_VISIBLE_BIT); @@ -210,9 +210,9 @@ Init(ZnItem item, ********************************************************************************** */ static void -Clone(ZnItem item) +Clone(ZnItem item) { - WindowItem wind = (WindowItem) item; + WindowItem wind = (WindowItem) item; /* * The same Tk widget can't be shared by to Window items. @@ -229,17 +229,17 @@ Clone(ZnItem item) ********************************************************************************** */ static void -Destroy(ZnItem item) +Destroy(ZnItem item) { - ZnWInfo *wi = item->wi; - WindowItem wind = (WindowItem) item; + ZnWInfo *wi = item->wi; + WindowItem wind = (WindowItem) item; /* * Unmanage the widget. */ if (wind->win) { Tk_DeleteEventHandler(wind->win, StructureNotifyMask, WindowDeleted, - (ClientData) item); + (ClientData) item); Tk_ManageGeometry(wind->win, (Tk_GeomMgr *) NULL, (ClientData) NULL); if (wi->win != Tk_Parent(wind->win)) { Tk_UnmaintainGeometry(wind->win, wi->win); @@ -257,15 +257,15 @@ Destroy(ZnItem item) ********************************************************************************** */ static int -Configure(ZnItem item, - int argc, - Tcl_Obj *CONST argv[], - int *flags) +Configure(ZnItem item, + int argc, + Tcl_Obj *CONST argv[], + int *flags) { - WindowItem wind = (WindowItem) item; - ZnWInfo *wi = item->wi; - ZnItem old_connected; - Tk_Window old_win; + WindowItem wind = (WindowItem) item; + ZnWInfo *wi = item->wi; + ZnItem old_connected; + Tk_Window old_win; old_connected = item->connected_item; old_win = wind->win; @@ -279,8 +279,8 @@ Configure(ZnItem item, * to the old one. */ if ((item->connected_item == ZN_NO_ITEM) || - (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) && - (item->parent == item->connected_item->parent))) { + (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) && + (item->parent == item->connected_item->parent))) { ZnITEM.UpdateItemDependency(item, old_connected); } else { @@ -291,14 +291,14 @@ Configure(ZnItem item, if (ISSET(*flags, ZN_WINDOW_FLAG)) { if (old_win != NULL) { Tk_DeleteEventHandler(old_win, StructureNotifyMask, - WindowDeleted, (ClientData) item); + WindowDeleted, (ClientData) item); Tk_ManageGeometry(old_win, (Tk_GeomMgr *) NULL, (ClientData) NULL); Tk_UnmaintainGeometry(old_win, wi->win); Tk_UnmapWindow(old_win); } if (wind->win != NULL) { Tk_CreateEventHandler(wind->win, StructureNotifyMask, - WindowDeleted, (ClientData) item); + WindowDeleted, (ClientData) item); Tk_ManageGeometry(wind->win, &wind_geom_type, (ClientData) item); } } @@ -321,9 +321,9 @@ Configure(ZnItem item, ********************************************************************************** */ static int -Query(ZnItem item, - int argc, - Tcl_Obj *CONST argv[]) +Query(ZnItem item, + int argc, + Tcl_Obj *CONST argv[]) { if (ZnQueryAttribute(item->wi->interp, item, wind_attrs, argv[0]) == TCL_ERROR) { return TCL_ERROR; @@ -341,11 +341,11 @@ Query(ZnItem item, ********************************************************************************** */ static void -ComputeCoordinates(ZnItem item, - ZnBool force) +ComputeCoordinates(ZnItem item, + ZnBool force) { - ZnWInfo *wi = item->wi; - WindowItem wind = (WindowItem) item; + ZnWInfo *wi = item->wi; + WindowItem wind = (WindowItem) item; ZnResetBBox(&item->item_bounding_box); @@ -374,8 +374,8 @@ ComputeCoordinates(ZnItem item, */ if (item->connected_item != ZN_NO_ITEM) { item->connected_item->class->GetAnchor(item->connected_item, - wind->connection_anchor, - &wind->pos_dev); + wind->connection_anchor, + &wind->pos_dev); } else { ZnPoint pos; @@ -384,7 +384,7 @@ ComputeCoordinates(ZnItem item, } ZnAnchor2Origin(&wind->pos_dev, (ZnReal) wind->real_width, (ZnReal) wind->real_height, - wind->anchor, &wind->pos_dev); + wind->anchor, &wind->pos_dev); wind->pos_dev.x = ZnNearestInt(wind->pos_dev.x); wind->pos_dev.y = ZnNearestInt(wind->pos_dev.y); @@ -393,7 +393,7 @@ ComputeCoordinates(ZnItem item, */ ZnAddPointToBBox(&item->item_bounding_box, wind->pos_dev.x, wind->pos_dev.y); ZnAddPointToBBox(&item->item_bounding_box, wind->pos_dev.x+wind->real_width, - wind->pos_dev.y+wind->real_height); + wind->pos_dev.y+wind->real_height); item->item_bounding_box.orig.x -= 1.0; item->item_bounding_box.orig.y -= 1.0; item->item_bounding_box.corner.x += 1.0; @@ -410,18 +410,18 @@ ComputeCoordinates(ZnItem item, ********************************************************************************** * * ToArea -- - * Tell if the object is entirely outside (-1), - * entirely inside (1) or in between (0). + * Tell if the object is entirely outside (-1), + * entirely inside (1) or in between (0). * ********************************************************************************** */ static int -ToArea(ZnItem item, - ZnToArea ta) +ToArea(ZnItem item, + ZnToArea ta) { - WindowItem wind = (WindowItem) item; - ZnBBox box; - int w=0, h=0; + WindowItem wind = (WindowItem) item; + ZnBBox box; + int w=0, h=0; box.orig = wind->pos_dev; if (wind->win != NULL) { @@ -442,10 +442,10 @@ ToArea(ZnItem item, ********************************************************************************** */ static void -Draw(ZnItem item) +Draw(ZnItem item) { - ZnWInfo *wi = item->wi; - WindowItem wind = (WindowItem) item; + ZnWInfo *wi = item->wi; + WindowItem wind = (WindowItem) item; if (wind->win == NULL) { return; @@ -472,19 +472,19 @@ Draw(ZnItem item) */ if (wi->win == Tk_Parent(wind->win)) { if ((wind->pos_dev.x != Tk_X(wind->win)) || - (wind->pos_dev.y != Tk_Y(wind->win)) || - (wind->real_width != Tk_Width(wind->win)) || - (wind->real_height != Tk_Height(wind->win))) { + (wind->pos_dev.y != Tk_Y(wind->win)) || + (wind->real_width != Tk_Width(wind->win)) || + (wind->real_height != Tk_Height(wind->win))) { Tk_MoveResizeWindow(wind->win, - (int) wind->pos_dev.x, (int) wind->pos_dev.y, - wind->real_width, wind->real_height); + (int) wind->pos_dev.x, (int) wind->pos_dev.y, + wind->real_width, wind->real_height); } Tk_MapWindow(wind->win); } else { Tk_MaintainGeometry(wind->win, wi->win, - (int) wind->pos_dev.x, (int) wind->pos_dev.y, - wind->real_width, wind->real_height); + (int) wind->pos_dev.x, (int) wind->pos_dev.y, + wind->real_width, wind->real_height); } } @@ -498,8 +498,8 @@ Draw(ZnItem item) ********************************************************************************** */ static ZnBool -IsSensitive(ZnItem item, - int item_part) +IsSensitive(ZnItem item, + int item_part) { /* * Sensitivity can't be controlled. @@ -516,13 +516,13 @@ IsSensitive(ZnItem item, ********************************************************************************** */ static double -Pick(ZnItem item, - ZnPick ps) +Pick(ZnItem item, + ZnPick ps) { - WindowItem wind = (WindowItem) item; - ZnBBox box; - ZnReal dist = 1e40; - ZnPoint *p = ps->point; + WindowItem wind = (WindowItem) item; + ZnBBox box; + ZnReal dist = 1e40; + ZnPoint *p = ps->point; box.orig = wind->pos_dev; if (wind->win != NULL) { @@ -545,8 +545,8 @@ Pick(ZnItem item, ********************************************************************************** */ static void -PostScript(ZnItem item, - ZnBool prepass) +PostScript(ZnItem item, + ZnBool prepass) { } @@ -559,15 +559,15 @@ PostScript(ZnItem item, ********************************************************************************** */ static void -GetAnchor(ZnItem item, - Tk_Anchor anchor, - ZnPoint *p) +GetAnchor(ZnItem item, + Tk_Anchor anchor, + ZnPoint *p) { - WindowItem wind = (WindowItem) item; + WindowItem wind = (WindowItem) item; if (wind->win != NULL) { ZnOrigin2Anchor(&wind->pos_dev, (ZnReal) wind->real_width, - (ZnReal) wind->real_height, anchor, p); + (ZnReal) wind->real_height, anchor, p); } else { p->x = p->y = 0.0; @@ -579,17 +579,17 @@ GetAnchor(ZnItem item, ********************************************************************************** * * GetClipVertices -- - * Get the clipping shape. + * Get the clipping shape. * ********************************************************************************** */ static ZnBool -GetClipVertices(ZnItem item, - ZnTriStrip *tristrip) +GetClipVertices(ZnItem item, + ZnTriStrip *tristrip) { - WindowItem wind = (WindowItem) item; - int w=0, h=0; - ZnPoint *points; + WindowItem wind = (WindowItem) item; + int w=0, h=0; + ZnPoint *points; ZnListAssertSize(ZnWorkPoints, 2); if (wind->win != NULL) { @@ -610,32 +610,32 @@ GetClipVertices(ZnItem item, ********************************************************************************** * * Coords -- - * Return or edit the item origin. This doesn't take care of - * the possible attachment. The change will be effective at the - * end of the attachment. + * Return or edit the item origin. This doesn't take care of + * the possible attachment. The change will be effective at the + * end of the attachment. * ********************************************************************************** */ static int -Coords(ZnItem item, - int contour, - int index, - int cmd, - ZnPoint **pts, - char **controls, - unsigned int *num_pts) +Coords(ZnItem item, + int contour, + int index, + int cmd, + ZnPoint **pts, + char **controls, + unsigned int *num_pts) { - WindowItem wind = (WindowItem) item; + WindowItem wind = (WindowItem) item; if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, - " windows can't add or remove vertices", NULL); + " windows can't add or remove vertices", NULL); return TCL_ERROR; } else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) { if (*num_pts == 0) { Tcl_AppendResult(item->wi->interp, - " coords command need 1 point on windows", NULL); + " coords command need 1 point on windows", NULL); return TCL_ERROR; } wind->pos = (*pts)[0]; @@ -660,7 +660,7 @@ static ZnItemClassStruct WINDOW_ITEM_CLASS = { "window", sizeof(WindowItemStruct), wind_attrs, - 0, /* num_parts */ + 0, /* num_parts */ ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */ Tk_Offset(WindowItemStruct, pos), Init, @@ -668,25 +668,25 @@ static ZnItemClassStruct WINDOW_ITEM_CLASS = { Destroy, Configure, Query, - NULL, /* GetFieldSet */ + NULL, /* GetFieldSet */ GetAnchor, GetClipVertices, - NULL, /* GetContours */ + NULL, /* GetContours */ Coords, - NULL, /* InsertChars */ - NULL, /* DeleteChars */ - NULL, /* Cursor */ - NULL, /* Index */ - NULL, /* Part */ - NULL, /* Selection */ - NULL, /* Contour */ + NULL, /* InsertChars */ + NULL, /* DeleteChars */ + NULL, /* Cursor */ + NULL, /* Index */ + NULL, /* Part */ + NULL, /* Selection */ + NULL, /* Contour */ ComputeCoordinates, ToArea, Draw, - Draw, /* Render use the same code as Draw. */ + Draw, /* Render use the same code as Draw. */ IsSensitive, Pick, - NULL, /* PickVertex */ + NULL, /* PickVertex */ PostScript }; -- cgit v1.1