mfolder.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1986 AT&T
* All Rights Reserved
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
#include <stdio.h>
#include "wish.h"
#include "menu.h"
#include "menudefs.h"
#include "vtdefs.h"
#include "terror.h"
#include "ctl.h"
#include "sizes.h"
/*
* This is a special version of menu_make ( called folder_make ) and
* menu_reinit ( called folder_reinit ) that are used soley for
* file folder display. Lots of assumptions are made, like that
* rows is always specified as 18.
*/
int num; /* menu number */
char *title; /* menu title */
int startrow; /* start row for the menu frame */
int startcol; /* start column for the menu frame */
int menurows; /* default menu rows */
int menucols; /* default menu cols */
char *arg;
{
register int total; /* total items */
register int itemwidth; /* width of longest item */
register int descwidth; /* width of longest description */
register int menuwidth; /* width of the menu */
int i_num; /* tmp var */
char *shrink_folder();
bool has_description = FALSE;
menurows = 18;
menucols = 0;
/*
* Determine ITEMWIDTH and DESCRIPTION WIDTH
* as well as the TOTAL number of items
*/
if (ml.description) {
}
}
if (!total)
if (has_description) {
/*
* Now truncate the highlite so that the entire description fits
* we only truncate the highlight if there was a description.
* If there is no description, we have already truncated the
* highlite in the dir_disp.
*/
itemwidth = 0;
}
/*
* If ANY item has a description, then stay single column,
*
* width = longest highlight +
* longest description +
* 3 (for the " - ") +
* 2 (for space between text and sides)
*
*/
/*
* actual rows = min(specified rows,
* fittable rows,
* needed rows);
*/
;
menucols = 1;
/*
* if the description is too long, then truncate
*/
;
}
else {
/*
* determine probable rows, then probable columns
*
* probable rows = min(specified rows, "fittable" rows)
*/
;
/*
* determine actual rows and columns
*/
/*
* menu not displayable in multi-columns ...
*
* actual rows = probable rows
* actual cols = 1
*
* truncate the menu if necessary
*/
menucols = 1;
menuwidth--;
}
else {
/*
* actual rows = probable cols == 1 ?
* min(specified rows, fittable rows) :
* probable rows
* actual cols = probable cols
*/
if (probcols == 1) {
;
}
else
}
/*
* Eliminate white-space from unused rows
*/
}
/*
* Make sure the menu VT (frame) can house the title
* vt_create adds the border cols hence FIXED_TITLE - 2
*/
/* made it FIXED_TITLE -3 to min. testing impact. -2 is better in longterm */
/*
* Create a VT (frame) to house the menu
*/
menuwidth)) == VT_UNDEFINED)
{
/*
* try putting the VT anywhere
*/
}
/*
* If the menu still can't be displayed then return FAIL
*/
if (vid == VT_UNDEFINED) {
mess_temp("Object can not be displayed, frame may be too large for the screen");
}
if (num >= 0)
}
unsigned flags;
int menurows;
int menucols;
char *arg;
{
char *s;
if (oldmid >= 0)
else
}
return newmid;
}
/* shrink_folder truncates the provided string so it will fit in a
** window thats the screen width minus reserved_col wide. The
** end of the string is replaced with TRUNCATE_STR to show that
** the string was truncated.
** RETURN VALUE: Pointer to the truncated string.
** SIDE AFFECTS: The string parameter is itself may be modified.
** this routine does not make a copy before truncation.
** If called with the result of a multi_eval, the
** cur field of the attribute will be modified, affecting
** future multi_evals if the descriptor is not
** EVAL_ALWAYS
*/
char *
char *str;
int max_len;
{
return(str);
}