diff options
author | Matt Turner <mattst88@gmail.com> | 2011-08-02 00:38:59 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2011-08-02 00:38:59 -0400 |
commit | 4b7af3dca51bccb86816d7c0e8995ce009f9999e (patch) | |
tree | f8e1037d6e583ffc5f7b571e188fc5fdeadd39bb /src/SimpleMenu.c | |
parent | 004a1d1746c62bb44b440df66f196d27d12d16d6 (diff) |
Strip trailing whitespace.
Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/SimpleMenu.c')
-rw-r--r-- | src/SimpleMenu.c | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/src/SimpleMenu.c b/src/SimpleMenu.c index 7d177c1..e1b9169 100644 --- a/src/SimpleMenu.c +++ b/src/SimpleMenu.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium. * Date: April 3, 1989 * * By: Chris D. Peterson - * MIT X Consortium + * MIT X Consortium * kit@expo.lcs.mit.edu */ @@ -53,7 +53,7 @@ in this Software without prior written authorization from the X Consortium. #define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field) -static XtResource resources[] = { +static XtResource resources[] = { /* * Label Resources. @@ -93,21 +93,21 @@ static XtResource resources[] = { {XtNpopupOnEntry, XtCPopupOnEntry, XtRWidget, sizeof(Widget), offset(popup_entry), XtRWidget, NULL}, {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), - offset(backing_store), + offset(backing_store), XtRImmediate, (XtPointer) (Always + WhenMapped + NotUseful)}, {XtNjumpScroll, XtCJumpScroll, XtRInt, sizeof(int), offset(jump_val), XtRImmediate, (XtPointer)1}, -}; +}; #undef offset static char defaultTranslations[] = "<EnterWindow>: highlight() \n\ <LeaveWindow>: unhighlight() \n\ <BtnMotion>: highlight() \n\ - <BtnUp>: notify() unhighlight() popdown()"; + <BtnUp>: notify() unhighlight() popdown()"; /* - * Semi Public function definitions. + * Semi Public function definitions. */ static void Redisplay(), Realize(), Resize(), ChangeManaged(); @@ -123,7 +123,7 @@ static void PopupCB(), PopupSubMenu(), PopdownSubMenu(); static void Highlight(), Unhighlight(), Notify(), PositionMenuAction(); static void Popdown(); -/* +/* * Private Function Definitions. */ @@ -142,7 +142,7 @@ static XtActionsRec actionsList[] = {"unhighlight", Unhighlight}, {"popdown", Popdown} }; - + static CompositeClassExtensionRec extension_rec = { /* next_extension */ NULL, /* record_type */ NULLQUARK, @@ -152,7 +152,7 @@ static CompositeClassExtensionRec extension_rec = { }; #define superclass (&overrideShellClassRec) - + SimpleMenuClassRec simpleMenuClassRec = { { /* superclass */ (WidgetClass) superclass, @@ -169,7 +169,7 @@ SimpleMenuClassRec simpleMenuClassRec = { /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, - /* compress_motion */ TRUE, + /* compress_motion */ TRUE, /* compress_exposure */ TRUE, /* compress_enterleave*/ TRUE, /* visible_interest */ FALSE, @@ -178,8 +178,8 @@ SimpleMenuClassRec simpleMenuClassRec = { /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ SetValuesHook, - /* set_values_almost */ XtInheritSetValuesAlmost, - /* get_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, @@ -237,7 +237,7 @@ ClassInitialize() /* Function Name: ClassInitialize * Description: Class Part Initialize routine, called for every - * subclass. Makes sure that the subclasses pick up + * subclass. Makes sure that the subclasses pick up * the extension record. * Arguments: wc - the widget class of the subclass. * Returns: none. @@ -288,7 +288,7 @@ Cardinal *num_args; XtAddCallback(new, XtNpopupCallback, PopupCB, NULL); - if (smw->simple_menu.label_class == NULL) + if (smw->simple_menu.label_class == NULL) smw->simple_menu.label_class = smeBSBObjectClass; if (smw->simple_menu.label_string != NULL) @@ -322,7 +322,7 @@ Cardinal *num_args; * Description: Redisplays the contents of the widget. * Arguments: w - the simple menu widget. * event - the X event that caused this redisplay. - * region - the region the needs to be repainted. + * region - the region the needs to be repainted. * Returns: none. */ @@ -383,7 +383,7 @@ Region region; point[1].y = s + SMW_ARROW_SIZE; point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2; point[2].y = s + SMW_ARROW_SIZE; - XFillPolygon(XtDisplay(w), smw->core.window, + XFillPolygon(XtDisplay(w), smw->core.window, tdw->threeD.bot_shadow_GC, point, 3, Convex, CoordModeOrigin); @@ -420,7 +420,7 @@ Region region; } /* - if (region != NULL) + if (region != NULL) switch (XRectInRegion(region, (int)(*entry)->rectangle.x, (int)(*entry)->rectangle.y, (unsigned int)(*entry)->rectangle.width, @@ -472,7 +472,7 @@ XSetWindowAttributes * attrs; else *mask &= ~CWBackingStore; - /* check if the menu is too big */ + /* check if the menu is too big */ if (smw->core.height >= HeightOfScreen(XtScreen(w))) { smw->simple_menu.too_tall = TRUE; smw->core.height = HeightOfScreen(XtScreen(w)); @@ -525,9 +525,9 @@ Cardinal *num_args; SimpleMenuWidget smw_old = (SimpleMenuWidget) current; SimpleMenuWidget smw_new = (SimpleMenuWidget) new; Boolean ret_val = FALSE, layout = FALSE; - + if (!XtIsRealized(current)) return(FALSE); - + if (!smw_new->simple_menu.recursive_set_values) { if (smw_new->core.width != smw_old->core.width) { smw_new->simple_menu.menu_width = (smw_new->core.width != 0); @@ -542,25 +542,25 @@ Cardinal *num_args; if (smw_old->simple_menu.cursor != smw_new->simple_menu.cursor) XDefineCursor(XtDisplay(new), XtWindow(new), smw_new->simple_menu.cursor); - - if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) + + if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) if (smw_new->simple_menu.label_string == NULL) /* Destroy. */ XtDestroyWidget((Widget) smw_old->simple_menu.label); else if (smw_old->simple_menu.label_string == NULL) /* Create. */ CreateLabel(new); else { /* Change. */ Arg arglist[1]; - + XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string); XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE); } - + if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class) XtAppWarning(XtWidgetToApplicationContext(new), "No Dynamic class change of the SimpleMenu Label."); - + if ((smw_old->simple_menu.top_margin != smw_new->simple_menu.top_margin) || - (smw_old->simple_menu.bottom_margin != + (smw_old->simple_menu.bottom_margin != smw_new->simple_menu.bottom_margin) /* filler................. */ ) { layout = TRUE; ret_val = TRUE; @@ -591,7 +591,7 @@ Cardinal *num_args; * Returns: none */ -/* +/* * If the user actually passed a width and height to the widget * then this MUST be used, rather than our newly calculated width and * height. @@ -605,10 +605,10 @@ Cardinal *num_args; { Cardinal i; Dimension width, height; - + width = w->core.width; height = w->core.height; - + for ( i = 0 ; i < *num_args ; i++) { if ( streq(arglist[i].name, XtNwidth) ) width = (Dimension) arglist[i].value; @@ -671,7 +671,7 @@ XtWidgetGeometry * request, * reply; if ( mode & XtCWQueryOnly ) { entry->rectangle.width = old_width; - entry->rectangle.height = old_height; + entry->rectangle.height = old_height; } else { /* Actually perform the layout */ @@ -681,11 +681,11 @@ XtWidgetGeometry * request, * reply; } else { entry->rectangle.width = old_width; - entry->rectangle.height = old_height; + entry->rectangle.height = old_height; if ( ((reply->width == request->width) && !(mode & CWHeight)) || ((reply->height == request->height) && !(mode & CWWidth)) || - ((reply->width == request->width) && + ((reply->width == request->width) && (reply->height == request->height)) ) answer = XtGeometryNo; else { @@ -716,10 +716,10 @@ Widget w; /************************************************************ * * Global Action Routines. - * + * * These actions routines will be added to the application's - * global action list. - * + * global action list. + * ************************************************************/ /* Function Name: PositionMenuAction @@ -738,7 +738,7 @@ Widget w; XEvent * event; String * params; Cardinal * num_params; -{ +{ Widget menu; XPoint loc; @@ -758,7 +758,7 @@ Cardinal * num_params; XtAppWarning(XtWidgetToApplicationContext(w), error_buf); return; } - + switch (event->type) { case ButtonPress: case ButtonRelease: @@ -781,12 +781,12 @@ Cardinal * num_params; PositionMenu(menu, (XPoint *)NULL); break; } -} +} /************************************************************ * * Widget Action Routines. - * + * ************************************************************/ /* Function Name: Unhighlight @@ -804,13 +804,13 @@ Widget w; XEvent * event; String * params; Cardinal * num_params; -{ +{ SimpleMenuWidget smw = (SimpleMenuWidget) w; SimpleMenuWidget sub = (SimpleMenuWidget) smw->simple_menu.sub_menu; SmeObject entry = smw->simple_menu.entry_set; SmeObjectClass class; int old_pos; - + if (entry == NULL || entry == GetEventEntry(w, event)) { smw->simple_menu.entry_set = NULL; PopdownSubMenu(smw); @@ -832,7 +832,7 @@ Cardinal * num_params; /* backup, then restore, original entry position */ old_pos = entry->rectangle.y; entry->rectangle.y -= smw->simple_menu.first_y; - + (class->sme_class.unhighlight) ((Widget) entry); entry->rectangle.y = old_pos; @@ -858,9 +858,9 @@ Cardinal * num_params; SmeObject entry; SmeObjectClass class; int old_pos; - + if (!XtIsSensitive(w)) return; - + entry = GetEventEntry(w, event); if (entry == smw->simple_menu.entry_set) return; @@ -882,7 +882,7 @@ Cardinal * num_params; /* backup, then restore, original entry position */ old_pos = entry->rectangle.y; entry->rectangle.y -= smw->simple_menu.first_y; - + (class->sme_class.highlight) ((Widget) entry); if (XtIsSubclass((Widget)entry, smeBSBObjectClass)) PopupSubMenu(smw); @@ -910,9 +910,9 @@ Cardinal * num_params; SimpleMenuWidget smw = (SimpleMenuWidget) w; SmeObject entry = smw->simple_menu.entry_set; SmeObjectClass class; - + if ( (entry == NULL) || !XtIsSensitive((Widget) entry ) ) return; - + class = (SmeObjectClass) entry->object.widget_class; (class->sme_class.notify)( (Widget) entry ); } @@ -922,7 +922,7 @@ Cardinal * num_params; * Public Functions. * ************************************************************/ - + /* Function Name: XawSimpleMenuAddGlobalActions * Description: adds the global actions to the simple menu widget. * Arguments: app_con - the appcontext. @@ -939,9 +939,9 @@ XtAppContext app_con; { XtInitializeWidgetClass(simpleMenuWidgetClass); XmuCallInitializers( app_con ); -} +} + - /* Function Name: XawSimpleMenuGetActiveEntry * Description: Gets the currently active (set) entry. * Arguments: w - the smw widget. @@ -959,7 +959,7 @@ Widget w; SimpleMenuWidget smw = (SimpleMenuWidget) w; return( (Widget) smw->simple_menu.entry_set); -} +} /* Function Name: XawSimpleMenuClearActiveEntry * Description: Unsets the currently active (set) entry. @@ -978,7 +978,7 @@ Widget w; SimpleMenuWidget smw = (SimpleMenuWidget) w; smw->simple_menu.entry_set = NULL; -} +} /************************************************************ * @@ -990,7 +990,7 @@ Widget w; * Description: Creates a the menu label. * Arguments: w - the smw widget. * Returns: none. - * + * * Creates the label object and makes sure it is the first child in * in the list. */ @@ -1009,7 +1009,7 @@ Widget w; char error_buf[BUFSIZ]; (void) sprintf(error_buf, "Xaw Simple Menu Widget: %s or %s, %s", - "label string is NULL", "label already exists", + "label string is NULL", "label already exists", "no label is being created."); XtAppWarning(XtWidgetToApplicationContext(w), error_buf); return; @@ -1017,8 +1017,8 @@ Widget w; XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string); XtSetArg(args[1], XtNjustify, XtJustifyCenter); - smw->simple_menu.label = (SmeObject) - XtCreateManagedWidget("menuLabel", + smw->simple_menu.label = (SmeObject) + XtCreateManagedWidget("menuLabel", smw->simple_menu.label_class, w, args, TWO); @@ -1035,7 +1035,7 @@ Widget w; /* Function Name: Layout * Description: lays the menu entries out all nice and neat. * Arguments: w - See below (+++) - * width_ret, height_ret - The returned width and + * width_ret, height_ret - The returned width and * height values. * Returns: none. * @@ -1088,7 +1088,7 @@ Dimension *width_ret, *height_ret; { if (!XtIsManaged((Widget)*entry)) continue; - if (smw->simple_menu.row_height != 0 && + if (smw->simple_menu.row_height != 0 && *entry != smw->simple_menu.label) (*entry)->rectangle.height = smw->simple_menu.row_height; @@ -1105,7 +1105,7 @@ Dimension *width_ret, *height_ret; height = smw->simple_menu.row_height * smw->composite.num_children; height += tdw->threeD.shadow_width * 2; } - + if (smw->simple_menu.menu_width) width = smw->core.width; else if (allow_change_size) @@ -1120,7 +1120,7 @@ Dimension *width_ret, *height_ret; if (do_layout) { ForAllChildren(smw, entry) - if (XtIsManaged((Widget)*entry)) + if (XtIsManaged((Widget)*entry)) (*entry)->rectangle.width = width; if (allow_change_size) @@ -1132,7 +1132,7 @@ Dimension *width_ret, *height_ret; if (height != 0) *height_ret = height; } } - + /* Function Name: AddPositionAction * Description: Adds the XawPositionSimpleMenu action to the global * action list for this appcon. @@ -1161,13 +1161,13 @@ XPointer data; * Returns: the menu widget or NULL. */ -static Widget +static Widget FindMenu(widget, name) Widget widget; String name; { Widget w, menu; - + for ( w = widget ; w != NULL ; w = XtParent(w) ) if ( (menu = XtNameToWidget(w, name)) != NULL ) return(menu); @@ -1189,14 +1189,14 @@ XPoint * location; SimpleMenuWidget smw = (SimpleMenuWidget) w; SmeObject entry; XPoint t_point; - + if (location == NULL) { Window junk1, junk2; int root_x, root_y, junkX, junkY; unsigned int junkM; - + location = &t_point; - if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, + if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, &root_x, &root_y, &junkX, &junkY, &junkM) == FALSE) { char error_buf[BUFSIZ]; (void) sprintf(error_buf, "%s %s", "Xaw Simple Menu Widget:", @@ -1207,15 +1207,15 @@ XPoint * location; location->x = (short) root_x; location->y = (short) root_y; } - + /* * The width will not be correct unless it is realized. */ - + XtRealizeWidget(w); - + location->x -= (Position) w->core.width/2; - + if (smw->simple_menu.popup_entry == NULL) entry = smw->simple_menu.label; else @@ -1232,7 +1232,7 @@ XPoint * location; * to be fully visable if menu_on_screen is TRUE. * Arguments: w - the simple menu widget. * x, y - the current location of the widget. - * Returns: none + * Returns: none */ static void @@ -1242,19 +1242,19 @@ Position x, y; { SimpleMenuWidget smw = (SimpleMenuWidget) w; Arg arglist[2]; - + if (smw->simple_menu.menu_on_screen) { int width = w->core.width + 2 * w->core.border_width; int height = w->core.height + 2 * w->core.border_width; - + if (x >= 0) { int scr_width = WidthOfScreen(XtScreen(w)); if (x + width > scr_width) x = scr_width - width; } - if (x < 0) + if (x < 0) x = 0; - + if (y >= 0) { int scr_height = HeightOfScreen(XtScreen(w)); if (y + height > scr_height) @@ -1263,7 +1263,7 @@ Position x, y; if (y < 0) y = 0; } - + XtSetArg(arglist[0], XtNx, x); XtSetArg(arglist[1], XtNy, y); XtSetValues(w, arglist, TWO); @@ -1284,15 +1284,15 @@ Widget w; XtPointer junk, garbage; { SimpleMenuWidget smw = (SimpleMenuWidget) w; - + /* * The event mask here is what is currently in the MIT implementation. * There really needs to be a way to get the value of the mask out * of the toolkit (CDP 5/26/89). */ - + XChangeActivePointerGrab(XtDisplay(w), ButtonPressMask|ButtonReleaseMask, - smw->simple_menu.cursor, + smw->simple_menu.cursor, XtLastTimestampProcessed(XtDisplay(w))); } @@ -1310,7 +1310,7 @@ Widget w; Dimension width, height; { SimpleMenuWidget smw = (SimpleMenuWidget) w; - + if ( !smw->simple_menu.recursive_set_values ) { if ( (smw->core.width != width) || (smw->core.height != height) ) { Arg arglist[2]; @@ -1399,18 +1399,18 @@ Widget w, w_ent; SimpleMenuWidget smw = (SimpleMenuWidget) w; Dimension width, widest = (Dimension) 0; SmeObject * entry; - - if ( smw->simple_menu.menu_width ) + + if ( smw->simple_menu.menu_width ) return(smw->core.width); ForAllChildren(smw, entry) { XtWidgetGeometry preferred; if (!XtIsManaged( (Widget) *entry)) continue; - + if (*entry != cur_entry) { XtQueryGeometry((Widget) *entry, (XtWidgetGeometry *)NULL, &preferred); - + if (preferred.request_mode & CWWidth) width = preferred.width; else @@ -1418,11 +1418,11 @@ Widget w, w_ent; } else width = (*entry)->rectangle.width; - + if ( width > widest ) widest = width; } - + return(widest); } @@ -1440,20 +1440,20 @@ Widget w; ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD; SmeObject * entry; Dimension height; - + if (smw->simple_menu.menu_height) return(smw->core.height); height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin; height += tdw->threeD.shadow_width * 2; - + if (smw->simple_menu.row_height == 0) { - ForAllChildren(smw, entry) - if (XtIsManaged ((Widget) *entry)) + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget) *entry)) height += (*entry)->rectangle.height; - } else + } else height += smw->simple_menu.row_height * smw->composite.num_children; - + return(height); } @@ -1580,7 +1580,7 @@ SimpleMenuWidget smw; popleft = (smw->simple_menu.state & SMW_POPLEFT) != 0; - if (popleft) + if (popleft) XtTranslateCoords((Widget)smw, -(int)XtWidth(menu), XtY(entry) - XtBorderWidth(menu), &menu_x, &menu_y); else |