[comp.soft-sys.andrew] Rasters and RasterViews.

hassan@INFORMATICS.WUSTL.EDU (Scott Hassan) (07/14/90)

Hello,

I have been trying to work with the raster inset in order to create
icons and labels.  I must be doing something wrong because grey lines
always surround my rasters.  It's kind of annoying.  

My program code is as follows:
  

      do {
	if((temp_book = bs_BookData(self->bookshelf)) != NULL)
	  {
	    temp_info = book_GetInfo(temp_book);

	    book_width = (float)temp_info->size / ((float)self->min_size /
(float)MIN_BOOK) ;
	    book_height = 60;

	    if(book_width > MAX_BOOK)
	      book_width = MAX_BOOK;

	    if(strcmp(temp_info->picloc,"") && temp_info->pic==NULL)
	      {
		temp_info->pic = raster_New();
		temp_info->picview = rasterview_New();

		rasterview_SetDataObject(temp_info->picview, 
				            temp_info->pic);

		fp = fopen(temp_info->picloc, "r");
		raster_Read(temp_info->pic, fp, 1);
		fclose(fp);
		
	      }

	    if(temp_info->pic != NULL)
	      {
		RasterRect.width = raster_GetWidth(temp_info->pic);
		RasterRect.height = raster_GetHeight(temp_info->pic);
		if(RasterRect.width > book_width)
		  book_width = RasterRect.width;
		else
		  RasterRect.width = book_width;

		book_height = RasterRect.height + 4;

		RasterRect.left = position;
		RasterRect.top = baseline - RasterRect.height - 2;
		
		rasterview_InsertView(temp_info->picview, self,  &RasterRect);
		rasterview_AutoCenter(temp_info->picview);
		rasterview_FullUpdate(temp_info->picview, view_FullRedraw, 0, 0, 50, 50);
	      }


[An Andrew ToolKit view (a raster image) was included here, but could
not be displayed.]	

You can see the problem if you click on the raster above and drag the
mouse to create a region.  Then click in the text and the frame will
change to a grey shade.

I was wondering if anyone has done work with the raster object and
figured out what to do about this slight annoyance.

				Thanks, (in advance)
	

				Scott Hassan
				hassan@informatics.wustl.edu
				Medical Informatics
				Department of Internal Medicine
				Washington University
				St. Louis, MO   63130
				(314) 362-3422

NOTE:  Deleting this message is be considered desecration of the United
States of America's National Flag.  

wjh+@ANDREW.CMU.EDU (Fred Hansen) (07/16/90)

Excerpts from internet.info-andrew: 13-Jul-90 Rasters and RasterViews.
Scott Hassan@informatics (2052+3)

> You can see the problem if you click on the raster above and drag the
> mouse to create a region.  Then click in the text and the frame will
> change to a grey shade.

This is not a bug, it's a design decision.  The grey border indicates
the current selection in the raster when the raster does not have the
input focus.  When it once again gets the input focus the grey border
turns to a black line inside a white line.

The ATK notion is that an inset is supposed to indicate whether it has
the input focus or not.  In text this is done by completely removing the
indication of the current selection, which unfortunately cannot be
distinguished from the case where the selection is elsewhere in the file
than the visible part of the file.  For rasters the choice was to change
the selection border as indicated above.

If there is consensus as to how to indicate the focus/no-focus
condition, the raster inset could be changed.

Fred Hansen