[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] menu_popup() ideas



Hello

> lør, 01,.10.2005 kl. 16.56 +0200, skrev olivier.landemarre@utbm.fr:
> > Selon Odd Skancke <ozk@atari.org>:
> >
> > > Hi list,
> > >
> > > the enable-value, but was changed to -1 in later revisions.
> >
> > According to Atari documentation:
> > mn_scroll: The scroll field status of the menu:
> >                     0: The menu not scroll
> >                     !0: The menu will scroll if the number of menu items
> exceed
> > the menu scroll height. The non-zero value is the object at which scrolling
> will
> > begin. This will allow one to have a menu in which the scrollable region is
> only
> > a part of the whole menu. The value must be a menu item in the menu.
>
>  Ah, this is news to me. According to my epxeriences, any positive value
> turns scrolling off. Only negative values turn scrolling on. But then
> again, I dont have that much experience :) Any apps that use this?

I not see, should probably do some tests.

>
>  Does this mean that the relative Y coordinate of the item whose number
> is given in mn_scroll is to be used as the height of the scroll-box? And
> the number is the object number and not the row-count, so to speak? In
> anycase, this looks like what I was proposing, so if it is already
> existing, does it work in N.AES? Because if it isnt existing or working
> properly, I was gonna propose a way for apps to check for these
> extentions via appl_getinfo().
>
>  And on the subject of appl_getinfo(); The values returned by
> appl_getinfo(AES_MENU), are those values or is it a bitmask? Can we use
> bit 1 of ap_gout3 to indicate the availability of mn_scroll height
> extention? This means that AES implementing the stuggestion here will
> yield 3 and not just 1. Anyone know this for sure?

???

>
>
> >
> <snipt>
> > conclusion that as of now, only a 'scroll' value of -1 should enable
> > > scroll when more than 8 entries are present.
> > >
> > >  Now for the extention I want to propose;
> > >
> > >  1. If ('scroll' == -1), enable scrolling when entries > 8
> > Agree if NAES do it we should do it too, this is not incompatible with
> Atari
> > documentation because if refer to this an application should not use it!.
>
>  Ok, then this is definitive?
>
> > >
> > >  2. If ('scroll' > 1), enable scrolling when
> > >     entries > ('scroll' < 8 ? 8 : 'scroll')
> > Why would you restrict to max 8, application should perhaps prefer 10 or
> other,
> > in fact it should be restrict to max possible scroll item that AES can
> redraw
> > on screen.
>
>  If you look closely you will notice the "scroll < 8" :) This means that
> you cannot have less than 8 entries in a scroll-list.
>
> > And probably it is possible to have scroll==1 with only 1 object display
>
>  Yes, perhaps. But I think this is not possible, as it looks as if aMail
> uses a positive value here. And N.AES does not render a scroll-list.

I have find new documentation in addendum part I copy here

- Popup menus and submenus with greater than sixteen item can be scrolled if
their scroll flag is set. The number of items to scroll at can be adjusted with
menu_settings (Ol -> I suppose to said ther is no limitation ????,
menu_setting() really I not see ????)

- Setting the scroll flag to one of the menu items will initiate scrolling from
that menu item if the number of items exceed the menu height limit

- One should NOT set the scroll object to the last menu item of a menu

- Setting the scroll object to a value less than the first menu item defaults to
the first menu item

- Setting the scroll object to a value greater than or equal to the last menu
item defaults to the first menu item.



>
> >
> > >
> > >  3. If ('scroll' >= 0 && 'scroll' < 2) then disable scroll.
> >
> > >
> > >
> > >  This should not break any existing apps, since I think most apps
> > > actually use -1 to enable popup, while offering a way to set the number
> > > of entries to the app.
> > >
> > >  This implementation is present in XaAES as of next cvs checkin from me,
> > > but if there are strong objections I will remove it again. Ideas?
> > > Comments?
> > >
> > My point of view, I never test it at this time, perhaps I'm wrong.
> >
> > If I look TOS 4.04 AES code this look something like this.
>
>  I dont understand..?

Someone have put AES source code of TOS 4.04

I copy here a small part for menu_popup() but I should find all functions need
to understand.

Regards

Olivier


/* mn_popup()
 * ================================================================
 * Displays a First Level Popup Menu.
 *
 * GLOBALS: There are several MENUBAR globals used so that this
 *          is compatible with the menubar routines. There shouldn't
 *          be any interference with them.
 *
 * IN:  WORD   id        Process id
 *      MENU   *Menu     Contains the tree, menu, start item and scroll flag
 *      WORD   xpos      The xpos we want the menu to start on
 *      WORD   ypos      The ypos we want the menu to start on
 *	MENU   *MData    Returns the tree, menu, item and scroll flag
 *			 of the submenu that was selected.
 *
 * OUT: TRUE - The return MENU structure is valid
 *
 *      FALSE - the return Menu Structure is invalid
 *	      - FALSE means that the user clicked either on a disabled
 *		menu item, or clicked outside of any menu.
 */
BOOLEAN
mn_popup( id, Menu, xpos, ypos, MData )
WORD    id;			/* Process id			 */
MENU    *Menu;			/* the Input Menu Structure	 */
WORD	xpos;			/* the xpos that we want to start*/
WORD	ypos;			/* the ypos that we want to start*/
MENU	*MData;			/* the output menu structure	 */
{
    REG OBJECT   *tree;
    REG MENU_PTR MenuPtr;	/* Ptr to the Menu Node  	 */
    WORD         MenuID;	/* The menu id for the menu node */
    LONG         obj;		/* return value from evnt_submenu*/
    GRECT        rect;		/* GRECT for dummy variable      */
    BOOLEAN      flag = FALSE;	/* VALID/INVALID variable        */
    MRETS	 mk;

    flag = FALSE;		/* Set to Invalid return data    */

    ActiveTree( Menu->mn_tree );

    obj = -1L;			/* Set it to no object selected  */
    if( !MenuBar_Mode )		/* PopUp Menu Routines!          */
    {
      wm_update( BEG_MCTRL );	/* Lock the menus and mouse      */

      /* Wait for the up button */
/*
      do
      {
        gr_mkstate( &mk.x, &mk.y, &mk.buttons, &mk.kstate );
      }while( mk.buttons );
*/

      do
      {
      }while( gl_button );
			        /* moved 03/23/92 cjg 		 */

      /* Get the new Menu ID! */
      if( ( MenuID = Menu_Insert( tree, Menu->mn_menu )) > 0 )
      {
        MenuPtr = GetMenuPtr( MenuID );			/* Get the ptr   */
        MWIDTH( MenuPtr )  = ObW( MPARENT( MenuPtr ));  /* Set the width */
        MHEIGHT( MenuPtr ) = ObH( MPARENT( MenuPtr ));  /* and height    */

	/* Initialize the menu data. Set the starting item */
        AssignMenuData( MenuPtr, Menu->mn_item );

	/* Adjust for scrolling, if its wanted. Do this by checking
         * the height of the menu.
         */

	/* Make sure we stay within the limits */
	if( Menu->mn_scroll )
	{
	    Menu->mn_scroll = max( Menu->mn_scroll, ObHead( Menu->mn_menu ) );

	    if( Menu->mn_scroll >= ( ObTail( Menu->mn_menu ) - 1 ) )
		Menu->mn_scroll = ObHead( Menu->mn_menu );
	}

	MSCROLL( MenuPtr ) = Menu->mn_scroll;
        if( Menu->mn_scroll )
            CheckMenuHeight( MenuPtr );

	/* Adjust the x and y position of the popup */
        AdjustMenuPosition( MenuPtr, xpos, ypos, &rect, FALSE, TRUE );

	/* Save the area underneath the menu */
        if( Pop_Blit( MenuPtr, FALSE ) )
        {
	  ObjcDraw( tree, MPARENT( MenuPtr ), &gl_rfull );

          obj = EvntSubMenu( id, MenuPtr ); 	         /* Do EVNT!*/
          Pop_Blit( MenuPtr, TRUE );			 /* Restore */
        }
        else
          obj = -2L;   /* Memory Allocation Error */
        RestoreMenu( MenuPtr );				   /* Rebuild menu  */
        Menu_Delete( MenuID );				   /* Delete Node   */
      }
    }
    else
    { /* MENU BAR ROUTINES  */

      obj = EvntSubMenu( id, gl_menuptr );	      /* Go Do IT!          */
      MData->mn_tree   = NULL;			      /* set the variables  */
      MData->mn_menu   = NIL;
      MData->mn_item   = NIL;
      MData->mn_keystate = 0;
      MData->mn_scroll = FALSE;

      if( obj == -1L )				      /* set flag if AOK      */
        flag = TRUE;				      /* For the Menu bar only*/
    }

    /* MenuID and MenuPtr are reused here...*/
    if( ( obj != -1L ) && ( obj != -2L ) )	      /* For PopUPs!       */
    {						      /* Set your variables*/
	MData->mn_tree   = CurTree;		      /* The tree!         */
	MData->mn_menu   = CurMenu;		      /* The menu          */
	MData->mn_item   = CurObject;		      /* The menu item     */
	MData->mn_scroll = CurScroll;		      /* Scroll field      */
	flag    = TRUE;
    }

    /* Always return the keystate - regardless */
    MData->mn_keystate = CurKeyState;

    /* 03/23/92 cjg - this is so that the popups disappear immediately
     *                but the menubar itself has its own WaitForUpButton()
     */
    if( !MenuBar_Mode )
    {
/*
      do
      {
        gr_mkstate( &mk.x, &mk.y, &mk.buttons, &mk.kstate );
      }while( mk.buttons );
*/

      do
      {
      }while( gl_button );

      wm_update( END_MCTRL );
    }
    return( flag );
}


>
>
>  Best Regards,
> Odd Skancke
>
>
>
>
>
>


--