Пример #1
0
int OnTxtBubbleIBrowser(void *w, int mx, int my, char *txt)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  OBJECT     *adr_form =  wnd->DlgData->BaseObject ;
  int        objet, trouve = 1 ;

  objet = objc_find( adr_form, 0, MAX_DEPTH, mx, my ) ; 
  switch( objet )
  {
    case IMGB_OPEN       : strcpy(txt, msg[MSG_HIBOPEN]) ;
                           break ;

    case IMGB_PREVIOUS   : strcpy(txt, msg[MSG_HIBPREV]) ;
                           break ;

    case IMGB_NEXT       : strcpy(txt, msg[MSG_HIBNEXT]) ;
                           break ;

    case IMGB_SCALE      : strcpy(txt, msg[MSG_HIBSCALE]) ;
                           break ;

    case IMGB_EDIT       : strcpy(txt, msg[MSG_HIBEDIT]) ;
                           break ;

    case IMGB_DELETE     : strcpy(txt, msg[MSG_HIBDELETE]) ;
                           break ;

    case IMGB_PRINT      : strcpy(txt, msg[MSG_HIBPRINT]) ;
                           break ;

    default              : trouve = 0 ;
  }

  return( trouve ) ; 
}
Пример #2
0
/*----------------------------------------------------------------------------------------*/
static int16 hv_objc_find( OBJECT *tree, int16 start, int16 depth, int16 x, int16 y )
{
	int16	obj;
	
	obj = objc_find( tree, start, depth, x, y );

	if( (obj != -1) && ( !(tree[obj].ob_flags & 0x8000) || (tree[obj].ob_flags & HIDETREE) || (tree[obj].ob_state & DISABLED)) )
		obj = -1;

	return obj;
}
Пример #3
0
int OnTxtBubblePref(void *w, int mx, int my, char *txt)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  OBJECT     *adr_form =  wnd->DlgData->BaseObject ;
  int        objet, trouve = 1 ;

  objet = objc_find( adr_form, 0, MAX_DEPTH, mx, my ) ; 
  switch( objet )
  {
    case PREF_PECRAN     :
    case PREF_TPECRAN    : strcpy(txt, msg[MSG_HPREFFULLSCR]) ;
                           break ;
    case PREF_QUIT       :
    case PREF_TQUIT      : strcpy(txt, msg[MSG_HPREFQUIT]) ;
                           break ;
    case PREF_WKIND      :
    case PREF_TWKIND     : strcpy(txt, msg[MSG_HPREFINFO]) ;
                           break ;
    case PREF_MVISEUR    :
    case PREF_TMVISEUR   : strcpy(txt, msg[MSG_HPREFMOUSE]) ;
                           break ;
    case PREF_CLIP       :
    case PREF_TCLIP      : strcpy(txt, msg[MSG_HPREFCLIP]) ;
                           break ;
    case PREF_AIDE       :
    case PREF_TAIDE      : strcpy(txt, msg[MSG_HPREFHELP]) ;
                           break ;
    case PREF_LONGFNAME  :
    case PREF_TLONGFNAME : strcpy(txt, msg[MSG_HLONGFNAME]) ;
                           break ;
    case PREF_DITHERAUTO :
    case PREF_TDITHERAUTO: strcpy(txt, msg[MSG_HDITHERAUTO]) ;
                           break ;
    case PREF_DSP        : strcpy(txt, msg[MSG_HPREFDSP]) ;
                           break ;
    case PREF_PATHS      : strcpy(txt, msg[MSG_HPREFPATH]) ;
                           break ;
    case PREF_CP         : strcpy(txt, msg[MSG_HPREFGEMP]) ;
                           break ;
    case PREF_DITHER     : strcpy(txt, msg[MSG_HPREFDITHER]) ;
                           break ;
    case PREF_SPLASH     : 
    case PREF_TSPLASH    : strcpy(txt, msg[MSG_HSPLASH]) ;
                           break ;
    default              : trouve = 0 ;
  }

  return( trouve ) ; 
}
Пример #4
0
VOID spol_down(WORD mx, WORD my)
{
	GRECT		m;
	WORD		curr_ob;

	curr_ob = objc_find((OBJECT FAR *)ad_spol, ROOT, MAX_DEPTH, mx, my);

	if ( (curr_ob == ROOT) || (curr_ob == SPOLBOX) )
	{
		m.g_x = mx;
		m.g_y = my;
		graf_rubbox(mx, my, 6, 6, &m.g_w, &m.g_h);
		act_allchg(curr_ob, &m, SELECTED, TRUE);
	}
}
Пример #5
0
int OnTxtBubbleSldShow(void *w, int mx, int my, char *txt)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  OBJECT     *adr_form =  wnd->DlgData->BaseObject ;
  int        objet, trouve = 1 ;

  objet = objc_find( adr_form, 0, MAX_DEPTH, mx, my ) ; 
  switch( objet )
  {
    case SSH_TRANSITION  : strcpy( txt, msg[MSG_HSSHTRANSIT] ) ;
                           break ;
    case SSH_CYCLE       : 
    case SSH_TCYCLE      : 
                           strcpy( txt, msg[MSG_HSSHCYCLE] ) ;
                           break ;
    case SSH_WAITMINI    : 
    case SSH_TWAITMINI   : 
                           strcpy( txt, msg[MSG_HSSHWAITMINI] ) ;
                           break ;
    case SSH_CLSSCREEN   :
    case SSH_TCLSSCREEN  :
                           strcpy( txt, msg[MSG_HSSHCLS] ) ;
                           break ;
    case SSH_SHOWNAME    :
    case SSH_TSHOWNAME   :
                           strcpy( txt, msg[MSG_HSSHAFFNAME] ) ;
                           break ;
    case SSH_AFFZOOM     :
    case SSH_TAFFZOOM    :
                           strcpy( txt, msg[MSG_HSSHAFFZOOM] ) ;
                           break ;
    case SSH_AFFREDUC    :
    case SSH_TAFFREDUC   :
                           strcpy( txt, msg[MSG_HSSHAFFREDUC] ) ;
                           break ;
    case SSH_SHOWPROG    :
    case SSH_TSHOWPROG   :
                           strcpy( txt, msg[MSG_HSSHAFFPROG] ) ;
                           break ;
    case SSH_NOTIMER     :
    case SSH_TNOTIMER    :
                           strcpy( txt, msg[MSG_HSSHNOTIMER] ) ;
                           break ;
    default              : trouve = 0 ;
  }

  return( trouve ) ; 
}
Пример #6
0
static
WORD
own_form_do(OBJECT *tree,WORD editobj)
{
  int ant_klick;
  WORD buffert[16];
  WORD happ;
  int knapplage;
  int tangent;
  int tanglage;
  int x;
  int y;
  int newobj;

  while(1)
  {
    happ = evnt_multi(MU_KEYBD | MU_BUTTON,2,LEFT_BUTTON,LEFT_BUTTON,
                      0,0,0,0,0,0,
                      0,0,0,0,buffert,0,&x,&y,&knapplage,&tanglage,
                      &tangent,&ant_klick);
    
    if((happ & MU_KEYBD) && (tangent == 0x1071))
    {
      break;
    }
		
    if(happ & MU_KEYBD)
    {
      fprintf(stderr,"kc=%04x\r\n",tangent);
    }
		
    if(happ & MU_BUTTON)
    {
      WORD object = objc_find(tree,0,9,x,y);
      
      if(object != -1)
      {
        fprintf(stderr,"form_button()=%d",
                form_button(tree,object,ant_klick,&newobj));
        fprintf(stderr," newobj=%d\r\n",newobj);
      }
    }
  }
	
  return 0;
}
Пример #7
0
int OnTxtBubbleAlb(void *w, int mx, int my, char *txt)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  OBJECT     *adr_form =  wnd->DlgData->BaseObject ;
  int        objet, trouve = 1 ;

  objet = objc_find( adr_form, 0, MAX_DEPTH, mx, my ) ; 
  switch( objet )
  {
    case ALBUM_NEW       : strcpy(txt, msg[MSG_HALMNEW]) ;
                           break ;
    case ALBUM_OPEN      : strcpy(txt, msg[MSG_HALMOPEN]) ;
                           break ;
    case ALBUM_INFOS     : strcpy(txt, msg[MSG_HALMINFOS]) ;
                           break ;
    case ALBUM_PPAL      :
    case ALBUM_PTPAL     : strcpy(txt, msg[MSG_HALMPAL]) ;
                           break ;
    case ALBUM_INFOIMG   : strcpy(txt, msg[MSG_HALMLOAD]) ;
                           break ;
    case ALBUM_ADDIMG    : strcpy(txt, msg[MSG_HALMADD]) ;
                           break ;
    case ALBUM_ADDFOLDER : strcpy(txt, msg[MSG_HALMADDF]) ;
                           break ;
    case ALBUM_REMOVE    : strcpy(txt, msg[MSG_HALMREMOVE]) ;
                           break ;
    case ALBUM_CONFIG    : strcpy(txt, msg[MSG_HALMCONFIG]) ;
                           break ;
    case ALBUM_UPDATE    : strcpy(txt, msg[MSG_HALMUPDATE]) ;
                           break ;
    case ALBUM_CATEGORIE1:
    case ALBUM_CATEGORIE2:
    case ALBUM_CATEGORIE3: sprintf(txt, msg[MSG_HALMCAT], 1+objet-ALBUM_CATEGORIE1) ;
                           break ;
    case ALBUM_IMAGE     : strcpy(txt, msg[MSG_HALMIMG]) ;
                           break ;
    case ALBUM_TOVSS     : strcpy(txt, msg[MSG_HALMTOVSS]) ;
                           break ;
    default              : trouve = 0 ;
                           break ;
  }

  return( trouve ) ; 
}
Пример #8
0
VOID hndl_spsel(WORD mx, WORD my, WORD mb, WORD ks)
{
	WORD		curr_ob;
	WORD		state, shifted;
	LONG		tree;

	tree = ad_spol;

	shifted = (ks & K_LSHIFT) || (ks & K_RSHIFT);
	curr_ob = objc_find((OBJECT FAR *)tree, ROOT, MAX_DEPTH, mx, my);
	if ( (curr_ob >= F1NAME) &&
	     (curr_ob <= F12NAME) &&
	     (gl_sppfn[curr_ob - F1NAME] != NULL) )
	{
		state = the_spol[curr_ob].ob_state;
		if ( !shifted )
		{
			if ( !(state & SELECTED) )
			{
				act_allchg(curr_ob, &the_spol[0].ob_x, SELECTED, FALSE);
				state |= SELECTED;
			}
		}
		else
		{
			if (state & SELECTED)
				state &= ~SELECTED;
			else
				state |= SELECTED;
		}
 		if (state != the_spol[curr_ob].ob_state )
			spol_chg(curr_ob, state);
	}
	else
	{
		act_allchg(curr_ob, &the_spol[0].ob_x, SELECTED, FALSE);
	}

	graf_mkstate(&mx, &my, &mb, &ks);
	if (mb & 0x0001)
		spol_down(mx, my);
}
Пример #9
0
void  coup_mu_button( short m_x, short m_y, short breturn )
{
	short obj_x, obj_y ;			/* object x and y return values		*/
	short no_exit ;
	char names[60] ;				/* string in which to format names	*/

	coup_form.next_object = objc_find( coup_form.fm_ptr, ROOT, MAX_DEPTH, m_x, m_y ) ;
	if( coup_form.next_object == NIL )
	{
		Bconout( 2, '\a' ) ;
		objc_edit( coup_form.fm_ptr, coup_form.edit_object, 0,
							&(coup_form.cursor_position), ED_END ) ;
		coup_form.edit_object = 0 ;
	}
	else
	{
		no_exit = form_button( coup_form.fm_ptr, coup_form.next_object,
								breturn, &(coup_form.next_object) ) ;
		if( !no_exit )
		{
			coup_form.next_object &= ~DOUBLE_CLICK ;
									/* deselect object if it an exit button	*/
			if( coup_form.fm_ptr[coup_form.next_object].ob_flags & EXIT )
				coup_form.fm_ptr[coup_form.next_object].ob_state &= ~SELECTED ;
			switch( coup_form.next_object )
			{
				case C_CANCEL :
					close_couple() ;
					break ;
				case C_OK :
					save_couple( edit_coup_ref, edit_coup_block, edit_coup_cptr ) ;
					close_couple() ;
					break ;
				case C_DELETE :
					if( q_del_coup( edit_coup_ref, edit_coup_block,
														edit_coup_cptr ) )
						close_couple() ;
						else  objc_draw( coup_form.fm_ptr, C_DELETE, MAX_DEPTH,
													ELTS( coup_form.fm_box ) ) ;
					break ;
				case C_HELP :
					help( marriage_help ) ;
					objc_draw( coup_form.fm_ptr, C_HELP, 0, ELTS( coup_form.fm_box ) ) ;
					break ;
				case MALE :
					if( male = get_person_reference( NULL, FALSE ) )
					{
						names_only( male, names, 40, FALSE ) ;
						strcpy( c_form_addrs.male, names ) ;
						objc_draw( coup_form.fm_ptr, MALE, 0,
							(int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y,
 							(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
						sprintf( c_form_addrs.m_ref, "%10d", male ) ;
						objc_draw( coup_form.fm_ptr, M_REF, 0,
							(int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y,
 							(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
					}
					break ;
				case FEMALE :
					if( female = get_person_reference( NULL, FALSE ) )
					{
						names_only( female, names, 40, FALSE ) ;
						strcpy( c_form_addrs.female, names ) ;
						objc_draw( coup_form.fm_ptr, FEMALE, 0,
							(int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y,
 							(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
						sprintf( c_form_addrs.f_ref, "%10d", female ) ;
						objc_draw( coup_form.fm_ptr, F_REF, 0,
							(int) coup_form.fm_box.g_x,(int) coup_form.fm_box.g_y,
 							(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
 					}
					break ;
				case WED_QUALIFIER :
					popup_date_qualifier( c_form_addrs.wed_qual, coup_form.fm_ptr, WED_QUALIFIER ) ;
					break ;
				case C_SOURCE :
					wind_form_do( &co_src_form, WF_SOURCE ) ;
					break ;
				case C_DIVORCE :
					wind_form_do( &divorce_form, DI_DATE ) ;
					break ;
				case PROG0 :
				case PROG1 :
				case PROG2 :
				case PROG3 :
				case PROG4 :
				case PROG5 :
				case PROG6 :
				case PROG7 :
				case PROG8 :
				case PROG9 :
					select_progeny( coup_form.next_object - PROG0,
														coup_form.fm_box ) ;
					break ;
				case C_SLIDER :
					prog_oset = move_slide( coup_form.fm_ptr,
								C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ;
					prog_oset = 30 * prog_oset / 1000 ;
					update_progeny() ;
					objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH,
								(int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y,
								(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
					break ;
				case C_UP :
					if( prog_oset > 0 )
					{
						prog_oset-- ;
						set_slide( prog_oset, 30,
							coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ;
						update_progeny() ;
						objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH,
									(int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y,
									(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
					}
					break ;
				case C_DOWN :
					if( prog_oset < 30 )
					{	prog_oset++ ;
						set_slide( prog_oset, 30,
							coup_form.fm_ptr, C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ;
						update_progeny() ;
						objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH,
									(int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y,
									(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
					}
					break ;
				case C_SLIDERANGE :
					objc_offset( coup_form.fm_ptr, C_SLIDER, &obj_x, &obj_y ) ;
					if( m_y > obj_y )
					{
						prog_oset += 9 ;
						if( prog_oset > 30 )  prog_oset = 30 ;
					}
					else
					{
						prog_oset -= 9 ;
						if( prog_oset < 0 )  prog_oset = 0 ;
					}
					set_slide( prog_oset, 30, coup_form.fm_ptr,
								C_SLIDER, C_SLIDERANGE, &coup_form.fm_box ) ;
					update_progeny() ;
					objc_draw( coup_form.fm_ptr, PROGENY, MAX_DEPTH,
									(int) coup_form.fm_box.g_x, (int) coup_form.fm_box.g_y,
									(int) coup_form.fm_box.g_w, (int) coup_form.fm_box.g_h ) ;
					break ;
				default :
#ifndef NDEBUG
					report( 0x300 + coup_form.next_object ) ;
#endif
					break ;
			}
		}
	}
	change_edit_object( &coup_form, MU_BUTTON ) ;
}
Пример #10
0
/* ------------------------ */
button_click()
{
register int object;

/*		'TOP LINE': oberste Begrenzung aller Zeichen.						*/
/* 'ASCENT LINE': oberste Zeile aller Gro�buchstaben					 */
/*	 'HALF LINE': oberste Zeile aller Kleinbuchstaben 				 */
/*	 'BASE LINE': unterste Zeile aller Zeichen ohne Unterl�nge */
/*'DESCENT LINE': unterste Zeile aller Zeichen mit Unterl�ngen */
/* 'BOTTOM LINE': unterste Begrenzung aller Zeichen.					 */

object = objc_find(font_back, ROOT, MAX_DEPTH, mousex, mousey);
switch(object)
	{
	case TOP:
	case ASCENT:
	case HALF:
	case BASE:
	case BOTTOM:
	case DESCENT:
	 	if (clicks == 1 && object != TOP)
			move_line(object);
		else
			switch(object)
				{
			  case TOP:
					form_alert(1, "[1]['TOP LINE':| |oberste Begrenzung aller |Zeichen.][ OK ]");
					break;

			  case ASCENT:
					form_alert(1, "[1]['ASCENT LINE':| |oberste Zeile aller |Gro�buchstaben.][ OK ]");
					break;

				case HALF:
					form_alert(1, "[1]['HALF LINE':| |oberste Zeile aller |Kleinbuchstaben.][ OK ]");
					break;

				case BASE:
					form_alert(1, "[1]['BASE LINE':| |unterste Zeile aller |Zeichen ohne Unterl�nge][ OK ]");
					break;

				case BOTTOM:
					form_alert(1, "[1]['BOTTOM LINE':| |unterste Begrenzung |aller Zeichen.][ OK ]");
					break;

				case DESCENT:
					form_alert(1, "[1]['DESCENT LINE':| |unterste Zeile aller |Zeichen mit Unterl�ngen.][ OK ]");
					break;
				}

		break;

	case F_BKG: 												/* Editierfeld */
		draw_fpoint();
		break;

	case SCL_RGT: 											/* Skala rechts */
		scale_right();
		break;

	case SCL_LFT: 											/* Skala links */
		scale_left();
		break;

	case ROOT:													/* Hintergrund */
		break;

	case FONTNAME:											/* Fontname */
		edit_name();
		break;

	case UP:														/* Editorzeile hoch */
		edit_up();
		break;					

	case DOWN:													/* Editorzeile runter */
		edit_dwn();		
		break;

	case LEFT:													/* Editorspalte links */
		edit_lft();
		break;
		
	case RIGHT:													/* Editorspalte rechts */
		edit_rgt();
		break;
				
	default:														/* FONTLINE */
		new_character();
		break;
	}
}
Пример #11
0
/* Pop_Up()
 *==========================================================================
 * DESCRIPTION: Entry point for performing popup menu items.
 *
 * IN:	char *items[]:		Pointer to string array.
 *				Note: Text must already be formated to
 *				be min of 2 blanks in front of text.
 * 				and 1 blank after longest menu item.
 *				The remaining menu items must be padded
 *				to be equal to the longest item.
 * 				The text will be right justified in the
 *				objects.
 *	int num_items:		The number of menu objects - 1 based.
 *	int default_item:	The default menu item. ( zero based )
 *				This is the index into the text array
 *				If -1, don't check any item.
 *	int font_size:		Either IBM or SMALL text
 *	GRECT *button:		The GRECT of the button pressed.
 * 	GRECT *world:		The GRECT of the CPX.
 *				Note: the GRECT.g_x and GRECT.g_y must
 *				already be fixed up with objc_offset()
 *
 *	Pop_Up() will perform its redraw by copying the cpx and then
 *  	redrawing by blitting the original screen back in. This way
 * 	the Pop_Up() routines do not need to know about the original
 *	tree and is therefore, independent.
 *
 *	There are only 5 slots available for the menu items.
 *	If more menu items are needed, Pop_Up() will change slot 1 and
 *	slot 5 to up and down scroll arrows respectively.
 *
 * OUT: Returns -1 if failed for any reason, (ie: not enough memory )
 *		   Or the user clicked outside of the popup box.
 *      Returns the object index into the text array if a menu item was
 *	selected.
 *
 * When clicking on a menu item, if the user lets go of the button,
 * the user must click to execute an operation. Ergo, of the user is
 * still holding down the button, the user must let go of the button for
 * an operation to occur.
 */
short
cdecl
Pop_Up( char *items[], int num_items, int default_item,
        int font_size, GRECT *button, GRECT *world )
{
    OBJECT *tree;			/* Our OBJECT Tree....    	*/
    int    offset;			/* Offset if scrolling box	*/
    int    aflag = 0;			/* Flag if arrows used..  	*/
    long   PopPtr;			/* Pointer to malloced mem	*/

    GRECT  base;				/* GRECT of POPUP box	  	*/
    int    obj;				/* object selected	  	*/
    MRETS  mk;				/* mouse structures	  	*/
    int    oldobj;			/* old object		  	*/
    int    dirflag;   			/* direction for mouse hot spot */
    int    done = FALSE;			/* Done flag to return..	*/
    int    event;			/* Mouse button event flag	*/
    /* TRUE = event occurred	*/
    GRECT  wall;				/* GRECT of mouse hotspot	*/
    int    outobj;			/* return obj ( adjusted )	*/
    int    exit_state;			/* looking for up or down button*/
    GRECT  work;
    int    dummy;

    Pop_FixUp();
    offset = Pop_Text( items, num_items, default_item,
                       font_size, ( button->g_w + 3 ) );
    aflag = (offset & 0x8000 );
    offset &= 0x7FFF;
    work = Pop_Offset( button, world );
    if( !Pop_Blit( &PopPtr, &work, 0 ))
        return( -1 );

    Objc_draw( ad_object, QBASE, MAX_DEPTH, &work );

    ActiveTree( ad_object );
    base = ObRect( QBASE );
    objc_offset( ad_object, QBASE, &base.g_x, &base.g_y );

    Evnt_timer( XDELAY );
    Graf_mkstate( &mk );
    exit_state = ( mk.buttons ^ TRUE );

    oldobj  = -1;
    obj = objc_find( ad_object, QBASE, MAX_DEPTH, mk.x, mk.y );
    dirflag = (( obj == -1 ) ? ( LOOK_IN ) : ( LOOK_OUT ));

    do
    {
        if( obj != -1 )
        {
            if( obj != oldobj )
            {
                Select( obj );
                wall = ObRect( obj );
                objc_offset( ad_object, obj, &wall.g_x, &wall.g_y );
                if( oldobj != -1 )
                {
                    Deselect( oldobj );
                    Objc_draw( ad_object, oldobj, 0, NULL );
                }
                dirflag = LOOK_OUT;
                Objc_draw( ad_object, obj, 0, NULL );
            }
        }
        else
        {
            wall = base;
            dirflag = LOOK_IN;
            if( oldobj != -1 )
            {
                Deselect( oldobj );
                Objc_draw( ad_object, oldobj, 0, NULL );
            }
        }

        oldobj = obj;

        Graf_mkstate( &mk );
        event = FALSE;
        if( (xy_inrect(mk.x, mk.y, &wall ) && dirflag ) ||
                ( !xy_inrect(mk.x, mk.y, &wall ) && !dirflag ) )
            event = rub_wait( &wall, dirflag, exit_state );

        Graf_mkstate( &mk );
        obj = objc_find( ad_object, QBASE, MAX_DEPTH, mk.x, mk.y );

        if( event && aflag && (( obj == Q1 ) || ( obj == Q5 ) ))
        {
            event = FALSE;
            Pop_Arrow( obj, &offset, num_items, items );
            Evnt_timer( DELAY );
        }

        if( event )
            done = TRUE;

    } while( !done );

    /* Get rid of the Check Mark */
    if( default_item != -1 )
        *items[ default_item ] = 0x20;

    Pop_Blit( &PopPtr, &base, 1 );
    /*   Evnt_button( 1, 1, 0, &mk ); cjg - 05/12/92 */
    /* Wait for up Button! */
    do
    {
        Graf_mkstate( &mk );
    } while( mk.buttons );

    if( obj == -1 )
        outobj = obj;
    else
        outobj = (( aflag ) ? ( obj - Q2 + offset ) : ( obj - Q1 + offset ) );

    return( outobj );
}
Пример #12
0
int popup(char *string,int selected, OBJECT *tree,int object,char *choice)
{
  POPUP_DATA pop;
  EVENT_DATA evnt;
  int        dummy;

  pop.select=selected;
  pop.s_antal=20;
  pop.d_antal=0;
  pop.number=0;
  pop.size=0;
  pop.tree=tree;
  pop.object=object;
  pop.string=string;
  pop.offset=-1;

  if(string==NULL)
    return(selected);
  
  init_popup(&pop);
  evnt.check=NOLL;
  evnt.end=FALSE;
  if(choice!=NULL)
    strcpy(choice,poptree[pop.number+P_CHOOSE0].ob_spec);
  do
  {
    if(evnt.check==NOLL)
      evnt.check=evnt_multi(MU_KEYBD|MU_BUTTON,258,MO_LEFT|MO_RIGHT,0,0,0,0,0,0,0,0,0,0,0,0,0,0,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r);
    if((evnt.check&MU_BUTTON)&&(evnt.mo_b==MO_LEFT))
    {
      evnt.d1=objc_find(poptree,ROOT,MAX_DEPTH,evnt.mo_x,evnt.mo_y);
      if((evnt.mo_x<poptree[ROOT].ob_x)||(evnt.mo_x>poptree[ROOT].ob_x+poptree[ROOT].ob_width)||(evnt.mo_y<poptree[ROOT].ob_y)||(evnt.mo_y>poptree[ROOT].ob_y+poptree[ROOT].ob_height))
      {
        evnt.end=TRUE;
        evnt.check&=~MU_BUTTON;
      }
      else if((evnt.d1>=P_CHOOSE0)&&(evnt.d1<=P_CHOOSE19)&&(poptree[evnt.d1].ob_type==G_STRING)&&(!(poptree[evnt.d1].ob_state&DISABLED)))
      {
        if((pop.number!=FAIL)&&(pop.number!=evnt.d1-P_CHOOSE0))
        {
          objc_change(poptree,pop.number+P_CHOOSE0,0,screenx,screeny,screenw,screenh,NOLL,TRUE);
          objc_change(poptree,evnt.d1,0,screenx,screeny,screenw,screenh,SELECTED,TRUE);
        }
        else if(pop.number==FAIL)
        {
          objc_change(poptree,evnt.d1,0,screenx,screeny,screenw,screenh,SELECTED,TRUE);
        }
        pop.number=evnt.d1-P_CHOOSE0;
        pop.select=pop.offset+pop.number;
        objc_offset(poptree,pop.number+P_CHOOSE0,&evnt.xy[X],&evnt.xy[Y]);
        evnt.xy[W]=poptree[pop.number+P_CHOOSE0].ob_width;
        evnt.xy[H]=poptree[pop.number+P_CHOOSE0].ob_height;
        dummy=evnt_multi(MU_BUTTON|MU_M1,1,MO_LEFT,MO_NO_BUTT,1,evnt.xy[X],evnt.xy[Y],evnt.xy[W],evnt.xy[H],0,0,0,0,0,0,0,0,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r);
        if(dummy&MU_BUTTON)
        {
          selected=pop.offset+pop.number;
          if(choice!=NULL)
            strcpy(choice,poptree[pop.number+P_CHOOSE0].ob_spec);
          evnt.end=TRUE;
        }
      }
      else
      {
        switch(evnt.d1)
        {
          break;
          case POPUP_UP:
          case POPUP_UP_IMG:
            if(pop.offset>0)
            {
              if(!(poptree[POPUP_UP].ob_state&SELECTED))
              {
                poptree[POPUP_UP].ob_state|=SELECTED;
                objc_draw(poptree,POPUP_UP,1,screenx,screeny,screenw,screenh);
              }
              pop.offset--;
              if(pop.number!=FAIL)
              {
                poptree[pop.number+++P_CHOOSE0].ob_state=NOLL;
                if(pop.number>P_CHOOSE19-P_CHOOSE0)
                  pop.number=FAIL; 
              }
              if(pop.number==FAIL)
              {
                if((pop.select-pop.offset>FAIL)&&(pop.select-pop.offset<9))
                  pop.number=pop.select-pop.offset;
               }
              if(pop.number!=FAIL)
                poptree[pop.number+P_CHOOSE0].ob_state=SELECTED;

              for(dummy=P_CHOOSE19; dummy>P_CHOOSE0; dummy--)
                poptree[dummy].ob_spec=poptree[dummy-1].ob_spec;
              for(;*pop.pointer1!='\0';pop.pointer1--);
              pop.pointer1--;
              poptree[P_CHOOSE0].ob_spec=pop.pointer1+2;
              pop.pointer2=(char *)poptree[P_CHOOSE19].ob_spec;
              dummy=poptree[ROOT].ob_y;
              objc_draw(poptree,ROOT,MAX_DEPTH,poptree[ROOT].ob_x,dummy+poptree[P_CHOOSE0].ob_y,poptree[P_CHOOSE0].ob_width+1,dummy+poptree[P_CHOOSE19].ob_y+poptree[P_CHOOSE19].ob_height);
              dummy=evnt_multi(MU_BUTTON|MU_M1|MU_TIMER,1,MO_LEFT,MO_NO_BUTT,1,evnt.xy[X],evnt.xy[Y],evnt.xy[W],evnt.xy[H],0,0,0,0,0,0,0,100,&evnt.mo_x,&evnt.mo_y,&evnt.mo_b,&evnt.k_s,&evnt.key,&evnt.m_r);
              if(dummy&(MU_BUTTON|MU_M1))
              {
                poptree[POPUP_UP].ob_state&=~SELECTED;
                objc_draw(poptree,POPUP_UP,1,screenx,screeny,screenw,screenh);
              }
            }
            break;
          case POPUP_DOWN:
          case POPUP_DOWN_IMG:
            if(pop.offset+pop.s_antal<pop.d_antal)
            {
              pop.offset++;
              if(pop.number!=FAIL)
                poptree[pop.number--+P_CHOOSE0].ob_state=NOLL;
              if(pop.number==FAIL)
              {
                if((pop.select-pop.offset>FAIL)&&(pop.select-pop.offset<9))
                  pop.number=pop.select-pop.offset;
              }
              if(pop.number!=FAIL)
                poptree[pop.number+P_CHOOSE0].ob_state=SELECTED;
              
              for(dummy=P_CHOOSE0; dummy<P_CHOOSE19; dummy++)
                poptree[dummy].ob_spec=poptree[dummy+1].ob_spec;
              for(;*pop.pointer2!='\0';pop.pointer2++);
              pop.pointer2++;
              poptree[P_CHOOSE19].ob_spec=pop.pointer2;
              pop.pointer1=(char *)poptree[P_CHOOSE0].ob_spec-2;
              dummy=poptree[ROOT].ob_y;
              objc_draw(poptree,ROOT,MAX_DEPTH,poptree[ROOT].ob_x,dummy+poptree[P_CHOOSE0].ob_y,poptree[P_CHOOSE0].ob_width+1,dummy+poptree[P_CHOOSE19].ob_y+poptree[P_CHOOSE19].ob_height);
            }
            break;
          default:
            break;
        }
        evnt.check&=~MU_BUTTON;
      }
    }
    else if((evnt.check&MU_BUTTON)&&(evnt.mo_b|MO_RIGHT))
    {
      evnt.end=TRUE;
      evnt.check&=~MU_BUTTON;
    }
    else if(evnt.check&MU_KEYBD)
    {
      evnt.end=TRUE;
      evnt.check&=~MU_KEYBD;
    }
  } while(!evnt.end);

  deinit_popup(&pop);
  return(selected);
}
Пример #13
0
/*----------------------------------------------------------------------------------------*/
int16	menu_context( int16 mx, int16 my )
{
	int16 obj, pob, wh;

	wh = wind_find( mx, my );
	
	set_state( tools, POP_ORIGIN, DISABLED, TRUE );
	set_state( tools, POP_ITOPEN, DISABLED, TRUE );
	set_flag( tools, POP_ITCLOSE, HIDETREE, TRUE );
	set_flag( tools, POP_ITOPEN, HIDETREE, FALSE );

	if( wh == wdial->win_handle && wdial->mode == WD_OPEN )
	{
		obj = objc_find( wdial->tree, ROOT, MAX_DEPTH, mx, my );
		
		if( obj > -1 )
		{
			dyn_fnode( wdial, obj );
			
			if( clnode )
			{
				my -= tools[POP_ITOPEN].ob_y;
			
				if( clnode->type == ItemTag && file_exist(clnode->attr.item->path) )
				{
					set_state( tools, POP_ORIGIN, DISABLED, FALSE );
					set_state( tools, POP_ITOPEN, DISABLED, FALSE );
				}
				else if( clnode->type == FolderTag )
				{
					set_state( tools, POP_ITOPEN, DISABLED, FALSE );
					if( clnode->attr.folder->open )
					{
						set_flag( tools, POP_ITOPEN, HIDETREE, TRUE );
						set_flag( tools, POP_ITCLOSE, HIDETREE, FALSE );					
					}
				}
			}
		}
		
		pob = icn_popup( TOOLS, POPUP, mx, my );
		
		switch( pob )
		{
			case POP_INFO:
				simple_mdial( about, 0 );
				break;
			case POP_ORIGIN:
				av_xwind( clnode->attr.item->path );
				break;
			case POP_ITCLOSE:
			case POP_ITOPEN:
				click_node( clnode, wdial, obj );
				break;
			case POP_HELP:
				open_hyp( "*:\\mcontrol.hyp", "" );
				break;				
			default:
				break;
		}
	}
	
	return 0;
}
Пример #14
0
int ev2_loop(WINDFORM *wind,int mx,int my)
{
	int x,y,kstate,key,clicks,event,state,org_state;
	int obj_id,ev2exit,fgexit=0;
	int pipe[8];
	CORDS t;

	if((obj_id=objc_find(wind->formtree,CTRL_FIRST,1,mx,my))>=0)
	{
		if(wind->formtree[obj_id].ob_flags & SELECTABLE)
		{
			org_state=wind->formtree[obj_id].ob_state & SELECTED;
			toggle_object(wind,obj_id,TOGGLE);

			objc_offset(wind->formtree,obj_id,&t.x,&t.y);
			t.w=wind->formtree[obj_id].ob_width;
			t.h=wind->formtree[obj_id].ob_height;
			ev2exit=0;
			do {
				event = evnt_multi( MU_MESAG | MU_TIMER | MU_BUTTON | MU_M1 | MU_M2,
									1, 0x1, 0x0,
									0, t.x, t.y, t.w, t.h,
									1, t.x, t.y, t.w, t.h,
									pipe,
									time_slice, 0,
									&x, &y, &state, &kstate, &key, &clicks );

				if (event & MU_TIMER)
					if (replay)
					{
						if(first_init)
							checkhang();
						load(1);
						update_time();
					}
			
				if (event & MU_MESAG)
					fgexit=handle_message(pipe);

				if (event & MU_M1) /* Enter area */
				{
					if(org_state==(wind->formtree[obj_id].ob_state & SELECTED))
						toggle_object(wind,obj_id,TOGGLE);
				}
				if (event & MU_M2) /* Leave area */
				{
					if(org_state!=(wind->formtree[obj_id].ob_state & SELECTED))
						toggle_object(wind,obj_id,TOGGLE);
				}
			
				if (event & MU_BUTTON)
				{
					if(obj_id==objc_find(wind->formtree,CTRL_FIRST,1,x,y))
					{
						if(wind->formtree[obj_id].ob_flags & KEEPSELECT)
						{
							if(org_state && (wind->formtree[obj_id].ob_state & SELECTED))
								toggle_object(wind,obj_id,SET_NORMAL);
							if(!org_state && !(wind->formtree[obj_id].ob_state & SELECTED))
								toggle_object(wind,obj_id,SET_SELECTED);
						}
						else if(wind->formtree[obj_id].ob_state & SELECTED)
							toggle_object(wind,obj_id,SET_NORMAL);

						fgexit=do_formstuff(obj_id);
					}
					else
					{
						objc_change(wind->formtree,obj_id,0,wind->form.x,
							wind->form.y,wind->form.w,wind->form.h,org_state,0);
						update_objects(wind,obj_id,1,0);
					}
					ev2exit=1;
				}

		
			} while (((replay || fgbg==FG) && !fgexit) && !ev2exit);
			event=0;
			return 1;
		}
	}
	return 0;
}		
Пример #15
0
/*----------------------------------------------------------------------------------------*/
int16	icn_popup( int16 ptree, int16 obj, int16 x_off, int16 y_off )
{
	OBJECT	*tree;
	GRECT		rect, desk, rect1, rect2;
	GRECT		kl_rect = {0,0,0,0};
	int16		item, founditem, olditem;
	int16		first_child, last_child;
	int16		event, ret;
	UWORD		uret;
	int16		bclicks, bmask, bstate;
	BOOL		leave, found;
	EVNTDATA ev;

	rsrc_gaddr(R_TREE, ptree, &tree);

	first_child = (tree[obj].ob_head);
	last_child  = (tree[obj].ob_tail);

	olditem = -1;

	while(last_child != -1)
	{
		olditem = last_child;
		last_child = (tree[last_child].ob_tail);
	}

	last_child = olditem;

	tree[R_TREE].ob_x = 0;			/* Anpassen des Parent-Objekts */
	tree[R_TREE].ob_y = 0;

	tree[obj].ob_x = x_off;			/* Anpassen der Popup-Box */
	tree[obj].ob_y = y_off;

	wind_get(0,WF_WORKXYWH, &desk.g_x, &desk.g_y, &desk.g_w, &desk.g_h);

	/* Das POPUP darf nicht ausserhalb des Bildschirms erscheinen) */
	if( (tree[obj].ob_x + tree[obj].ob_width) > (desk.g_x + desk.g_w) )
		tree[obj].ob_x = (desk.g_x + desk.g_w - tree[obj].ob_width);

	if( (tree[obj].ob_y + tree[obj].ob_height) > (desk.g_y + desk.g_h) )
		tree[obj].ob_y = (desk.g_y + desk.g_h - tree[obj].ob_height);

	if(tree[obj].ob_x < 0) tree[obj].ob_x = desk.g_x;
	if(tree[obj].ob_y < 0) tree[obj].ob_y = desk.g_y;

	rect.g_x = tree[obj].ob_x - 8;
	rect.g_y = tree[obj].ob_y - 8;
	rect.g_w = tree[obj].ob_width  + 16;
	rect.g_h = tree[obj].ob_height + 16;

	form_dial(FMD_START, &kl_rect, &rect);

	graf_mkstate( &ev );

	olditem   = NIL;
	founditem = item = objc_find(tree, obj, 1, ev.x, ev.y);	/* In Men� ? */

	if (item != NIL)
		if ((tree[item].ob_state & DISABLED) || !(tree[item].ob_flags & SELECTABLE))
			item = NIL;

	if (item != NIL) tree[item].ob_state |= SELECTED;

	objc_draw(tree, obj, MAX_DEPTH, &rect);

	wind_update(BEG_MCTRL);								/* Ich will die Kontrolle */

	do
	{
		if (founditem != NIL)							/* In Men�eintrag */
		{
			leave = TRUE;
			objc_rect (tree, founditem, &rect1);
		}
		else													/* Au�erhalb Pop-Up-Men� */
		{
			leave = FALSE;
			objc_rect (tree, obj, &rect1);
		}

		graf_mkstate( &ev );

		if( !((ev.bstate) & 3) )
			bclicks = 258;
		else
			bclicks = 0;

		bmask = 3;
		bstate = 0;

		event = evnt_multi (	MU_KEYBD | MU_BUTTON | MU_M1,
									bclicks, bmask, bstate,
									leave, &rect1, 0, &kl_rect,
									NULL, 0, &ev, (int16 *)&uret, (int16 *)&ret);

		olditem   = item;

		if(!(event & MU_KEYBD))
		{
			founditem = item = objc_find (tree, obj, 1, ev.x, ev.y);

			if (item != NIL)
			{
			   if ((tree[item].ob_state & DISABLED) || !(tree[item].ob_flags & SELECTABLE))
			   	item = NIL;
			}
		}
		else
		{
			if((uret >> 8) == 80) /* Pfeil runter */
			{
				found = FALSE;
				while(!found)
				{
					item++;

					if((item < first_child) || (item > last_child))
					{
						item = first_child;
					}
				   if ((tree[item].ob_flags & SELECTABLE))
				   {
				   	if( tree[item].ob_state & DISABLED )
				   		found = FALSE;
				   	else
				   		found = TRUE;
				   }
				}
			}

			if((uret >> 8) == 72) /* Pfeil rauf */
			{
				found = FALSE;
				while(!found)
				{
					item--;

					if((item < first_child) || (item > last_child))
					{
						item = last_child;
					}
				   if ((tree[item].ob_flags & SELECTABLE))
				   {
				   	if( tree[item].ob_state & DISABLED )
				   		found = FALSE;
				   	else
				   		found = TRUE;
				   }
				}
			}
			if(((uret >> 8) == 28)||((uret >> 8) == 114))	/* Enter/Return */
				event = MU_BUTTON;

			if(((uret >> 8) == 01)||((uret >> 8) == 97))		/* Esc/UNDO */
			{
				item = NIL;
				event = MU_BUTTON;
			}
		}

		if (olditem != item)
		{
			if (olditem != NIL)
			{
				if(tree[olditem].ob_state & SELECTED)
					tree[olditem].ob_state &= ~SELECTED;
				else
					tree[olditem].ob_state |= SELECTED;
				objc_rect(tree, olditem, &rect2);
				objc_draw(tree, obj, MAX_DEPTH, &rect2);
			}

			if (item != NIL)
			{
				if(tree[item].ob_state & SELECTED)
					tree[item].ob_state &= ~SELECTED;
				else
					tree[item].ob_state |= SELECTED;
				objc_rect(tree, item, &rect2);
				objc_draw(tree, obj, MAX_DEPTH, &rect2);
			}
		}
	}	while (! (event & MU_BUTTON));

	wind_update(END_MCTRL);

	form_dial(FMD_FINISH, &kl_rect, &rect);

	if (item != NIL) tree[item].ob_state &= ~SELECTED;

	graf_mkstate( &ev );

	bclicks = 0;

	if (~ev.bstate & bmask)
		evnt_button (bclicks, bmask, 0x00, &ev);		/* Warte auf Mausknopf */

	return(item);
}
Пример #16
0
int aform_do(OBJECT *db,int start, int *cured, int movob)
{
	int edob,nob,which,cont;
	int idx,mx,my,mb,ks,kr,br;

	nob=init_field(db,start);
	edob=0;
	cont=TRUE;

	wind_update(BEG_UPDATE);
	wind_update(BEG_MCTRL);

	while (cont)
	{
		if ( nob ne 0 and edob ne nob )
		{
			edob=nob;
			nob=0;
			objc_edit(db,edob,0,&idx,ED_INIT);
		}

		which=evnt_multi(
			MU_KEYBD|MU_BUTTON,
			2,1,1,
			0,0,0,0,0,
			0,0,0,0,0,
			0,0,0,
			&mx,&my,&mb,
			&ks,&kr,&br);

		if (which & MU_KEYBD)
		{
			cont=form_keybd(db,edob,nob,kr,&nob,&kr);
			if (kr)
				objc_edit(db,edob,kr,&idx,ED_CHAR);
		}

		if (which & MU_BUTTON)
		{
			nob=objc_find(db,0,MAX_DEPTH,mx,my);
			if (nob eq -1)
			{
				ping;
				nob=0;
			othw
				cont = (movob and nob eq movob)
					 ? FALSE
					 : form_button(db,nob,br,&nob);
			}
		}
		
		if (!cont or (nob ne 0 and nob ne edob) )
			objc_edit(db,edob,0,&idx,ED_END);
	}
	
	wind_update(END_MCTRL);
	wind_update(END_UPDATE);

	if (cured)
		*cured=edob;
	return nob;
}
Пример #17
0
/* ---------------------
	 | Form-do in window |
	 --------------------- */
int win_formdo(OBJECT *tree, int start_fld, int wind_id)
{
    int edit_obj;
    int next_obj;
    int which, cont;
    int idx;
    int mx, my, mb, ks, kr, br, msg[8];
    int x, y, w, h;

    if (start_fld != -1)
        next_obj = fm_inifld(tree, start_fld);
    else
        next_obj = 0;

    edit_obj = 0;
    cont = TRUE;
    while(cont)
    {
        if (next_obj && edit_obj != next_obj)
        {
            edit_obj = next_obj;
            next_obj = 0;

            objc_edit(tree, edit_obj, 0, &idx, ED_INIT);
        }

        if (start_fld == -1)
            which = evnt_multi(MU_MESAG|MU_TIMER|MU_KEYBD,
                               0, 0, 0,
                               0, 0, 0, 0, 0,
                               0, 0, 0, 0, 0,
                               msg,
                               100, 0,
                               &mx, &my, &mb, &ks, &kr, &br);
        else
            which = evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,
                               0x02, 0x01, 0x01,
                               0, 0, 0, 0, 0,
                               0, 0, 0, 0, 0,
                               msg,
                               0, 0,
                               &mx, &my, &mb, &ks, &kr, &br);

        if (which & MU_KEYBD)
        {
            wind_update(BEG_UPDATE);

            cont = form_keybd(tree, edit_obj, next_obj, kr, &next_obj, &kr);
            if (kr)
                objc_edit(tree, edit_obj, kr, &idx, ED_CHAR);

            wind_update(END_UPDATE);
        }

        if (which & MU_BUTTON)
        {
            wind_update(BEG_UPDATE);

            next_obj = objc_find(tree, ROOT, MAX_DEPTH, mx, my);
            if (next_obj == NIL)
            {
                Cconout(0x7);
                next_obj = 0;
            }
            else
                cont = form_button(tree, next_obj, br, &next_obj);

            wind_update(END_UPDATE);
        }

        if (which & MU_MESAG)
        {
            switch(msg[0])
            {
            case WM_REDRAW:
                red_x = msg[4];
                red_y = msg[5];
                red_w = msg[6];
                red_h = msg[7];

                if (msg[3] == wind_id)
                {
                    if (edit_obj)
                        objc_edit(tree, edit_obj, 0, &idx, ED_END);

                    dialog_window(wind_id, tree, RDW_DIA, ROOT);

                    if (edit_obj)
                        objc_edit(tree, edit_obj, 0, &idx, ED_INIT);
                }
                else
                {
                    sample_redraw(msg[3]);
                    seqs_redraw(msg[3]);
                }
                break;

            case WM_MOVED:
                if (msg[3] == wind_id)
                {
                    wind_set(wind_id, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
                    wind_get(wind_id, WF_WORKXYWH, &x, &y, &w, &h);
                    tree[ROOT].ob_x = x;
                    tree[ROOT].ob_y = y;
                }
                break;
            }
        }

        if (!cont || (next_obj && next_obj != edit_obj))
            objc_edit(tree, edit_obj, 0, &idx, ED_END);

        if (start_fld == -1 && which == MU_TIMER)
            break;

        if (start_fld == -1 && which == MU_KEYBD)
            break;
    }

    if (start_fld == -1)
        return ((kr & 0xFF) == 0x1B);
    else
        return(next_obj);
}
Пример #18
0
/*---------------------------------------------------*/
void event_handler()
{
	int dummy,ev_bkstate,ev_bkreturn,ev_bbutton,ev_breturn,ev_bmx,ev_bmy;
	int mbuff[8]/*,xs[4]*/;
	int mwhich,obn;
	int col,ba;

	while(1)
	{
		mwhich=evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,1,1,
			1,0,0,
			0,0,0,
			0,0,0,0,
			0,mbuff,0,
			0,&ev_bmx,&ev_bmy,
			&ev_bbutton,&ev_bkstate,
			&ev_bkreturn,&ev_breturn);
		
		if (mwhich&MU_KEYBD);
		
		
		if (mwhich&MU_BUTTON)
		{
			obn=objc_find(rs_object,0,10,ev_bmx,ev_bmy);
			if ((obn==SAVE)&!(rs_object[SAVE].ob_state&DISABLED))

			{
				rs_object[SAVE].ob_state=SELECTED;
				redraw(SAVE);
				save();
				rs_object[SAVE].ob_state=0;
				redraw(SAVE);
			}
			else
			if ((obn==SAVER)&!(rs_object[SAVER].ob_state&DISABLED))
			{
				saver_flag=!saver_flag;
				rs_object[SAVER].ob_state=SELECTED*saver_flag;
				redraw(SAVER);
				get_modes(saver_flag,-3); /* Saver setzten */
			}
			else
			{
				col=(obn-COL2R1)/5;
				ba=obn-5*col-COL2R1;
				if ((col>=0)&&(col<5)&&(ba>=0)&&(ba<=2)&&
					!(rs_object[COL2R1+5*col+ba].ob_state&DISABLED))
				{
					radio(COL2R1+5*col+ba,COL2R1+5*col,COL2R1+5*col+2);
					if (ba==2)
					{
						get_modes(col,0);
					}
					else  
					{
						get_modes(col,1+ba);
					}
					redraw(COL2BOX+5*col);
				}
			}
			(void)evnt_button(1,1,0,&dummy,&dummy,&dummy,&dummy);	
		}
		
		if (mwhich&MU_MESAG)
		{
			if (mbuff[0]==WM_REDRAW)
			{	
				get_conf();
				redraw(TREE1);
			}
			if (mbuff[0]==WM_MOVED)
			{	
				wind_set(wid,WF_CURRXYWH,
		 			mbuff[4],mbuff[5],mbuff[6],mbuff[7]);
		 		(void)wind_get(wid,WF_WORKXYWH,
					&rs_object[TREE1].ob_x,&rs_object[TREE1].ob_y,
					&dummy,&dummy);
			}
			if ((mbuff[0]==WM_TOPPED)||(mbuff[0]==WM_NEWTOP))
				wind_set(wid,WF_TOP);
			if (mbuff[0]==WM_CLOSED)
				quit_all();
			if ((mbuff[0]==AC_OPEN)&&(!open_f))
			{
				open_w();
			}
			if ((mbuff[0]==AC_CLOSE)&(open_f))
			{
				open_f=0;
			}
			if ((mbuff[0]==WM_ICONIFY)||(mbuff[0]==WM_ALLICONIFY))
			{
				wind_set(wid,WF_ICONIFY,mbuff[4],mbuff[5],82,32+24);
			}
			if ((mbuff[0]==WM_UNICONIFY))
			{
				wind_set(wid,WF_UNICONIFY,mbuff[4],mbuff[5],mbuff[6],mbuff[7]);
			}
		}
	}
}
Пример #19
0
/* ***enhanced form-do main function*** */
short wdial_formdo(int dwhndl, OBJECT *tree, short strt_fld, void (*msghndlr)(int msgbf[]), long msec, void (*tmrhndlr)())
{
 int  edit_obj;
 int next_obj;
 register int  which;
 int events=MU_KEYBD|MU_BUTTON|MU_MESAG;
 int  cont;
 int  idx;
 short kshift, kcode;
 int  mx, my, mb, br;
 int  obx, oby, obw, obh;           /* Koordinaten des Dialogs */
 int msgbuf[8];

 if(msec>=0)  events|=MU_TIMER;

 next_obj=fm_inifld(tree, strt_fld);
 edit_obj=0;
 cont=TRUE;

 while(cont && !endeflag)
  {

   if( (next_obj!=0) && (edit_obj!=next_obj) )
    {
     edit_obj=next_obj;
     next_obj=0;
     objc_edit(tree, edit_obj, 0, idx, ED_INIT, &idx);
    }

   which=evnt_multi(events, 2, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb,
                    &kshift, &kcode, &br);

   if(which & MU_MESAG)
    {
     if(msgbuf[3]==dwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP)
      {
       switch(msgbuf[0])
        {
         case WM_REDRAW:
           wdial_redraw(dwhndl, tree, (GRECT *)(&msgbuf[4]));
           if(edit_obj) objc_edit(tree, edit_obj, 0, idx, ED_INIT, &idx);
           break;
         case WM_TOPPED:
           wind_set(dwhndl, WF_TOP, 0L, 0L);
           break;
         case WM_MOVED:
           wind_set(dwhndl, WF_CURRXYWH, msgbuf[4], msgbuf[5],
                 msgbuf[6], msgbuf[7]);
           wind_calc(WC_WORK, NAME|MOVER, msgbuf[4], msgbuf[5],
                 msgbuf[6], msgbuf[7], &obx, &oby, &obw, &obh);
           tree[ROOT].ob_x=obx;
           tree[ROOT].ob_y=oby;
           break;
        }
      }
     else if( msghndlr )  msghndlr(msgbuf);
    }

   if( (which & MU_TIMER) && tmrhndlr )   tmrhndlr();

   if(which & MU_KEYBD)
    {
     cont=form_keybd(tree, edit_obj, next_obj, kcode, &next_obj, &kcode);
     if(kcode)
       objc_edit(tree, edit_obj, kcode, idx, ED_CHAR, &idx);
    }

   if(which & MU_BUTTON)
    {
     next_obj=objc_find(tree, ROOT, MAX_DEPTH, mx, my);
     if(next_obj == NO_OBJECT)                /* outside of object? */
       next_obj=0;
      else
       cont=form_button(tree, next_obj, br, &next_obj);
    }

   if( /*(which & (MU_BUTTON|MU_KEYBD)) &&*/ edit_obj!=0 &&
      ((!cont) || (next_obj!=0 && next_obj!=edit_obj)) )
    {
     objc_edit(tree, edit_obj, 0, idx, ED_END, &idx);
    }

  }

 return( next_obj );
}
Пример #20
0
 /* button handling using XFORM_DO
 */
int
handle_button( int button, WORD *msg )
{
    OBJECT *tree  = (OBJECT *)rs_trindex[GENERAL];
    int    done = FALSE;
    BOOLEAN  click_flag = FALSE;
    MRETS  mk;
    int    ox, oy;
       
    if( ( button != -1 ) && ( button & 0x8000 ) )
    {
      click_flag = TRUE;
      button &= 0x7FFF;
    }

    switch( button )
    {
       case GSAVE:   if( (*xcpb->XGen_Alert)( SAVE_DEFAULTS ) )
       		     {
       			 (*xcpb->CPX_Save)( &cur_value, sizeof( GEN ) );
       			 push_data();
       			 Set_Data();
       		     }
       		     XDeselect( tree, GSAVE );
       		     break;
       		     
       case GOK:     done = TRUE;
       		     Set_Data();
       		     Deselect( GOK );
       		     break;
       			
       case GCANCEL: done = TRUE;
       		     pop_data();
       		     Deselect( GCANCEL );
       		     break;
       
       case STATUS:  graf_mkstate( &mk.x, &mk.y, &mk.buttons, &mk.kstate );
       		     if( objc_find( tree, ROOT, MAX_DEPTH, mk.x, mk.y ) == STATUS )
       		         do_status();
       		     break;
       		     
       case BELL:    keybell_handle( BELLICON, &cur_value.bell );
       		     break;
       		     
       case KEYCLICK:keybell_handle( KEYICON, &cur_value.keyclick );
       		     break;
       		     
       case M0:
       case M1:
       case M2:
       case M3:
       case M4:	     Dclick_Select( button );
       		     break;
       		     
       case DOUBLE:  Dclick_Handle( click_flag, button );
        	     break;

       	case KREPEAT:   (*xcpb->MFsave )( MFSAVE, &Other );
       			if( AES_Version >= 0x0320 )
       			    graf_mouse( FLAT_HAND, 0L );


		        if(( AES_Version >= 0x0330 )
	      		    && ( numcol > LWHITE ) )
	     		    XSelect( tree, KREPEAT );

		        graf_mkstate( &ox, &mk.y, &mk.buttons, &mk.kstate );
	  		do
	  		{
	     		   graf_mkstate( &mk.x, &mk.y, &mk.buttons, &mk.kstate );
	  		}while( mk.buttons && ( mk.x == ox ));

			if( mk.buttons && ( mk.x != ox ))
			{
       			   (*xcpb->Sl_dragx)( tree, REPTBASE, KREPEAT, KEYMIN,
       					      KEYMAX, &cur_value.repeat,
       	                                      KRepeat );
       	                   Set_Kbrate();
			}
			
          		if(( AES_Version >= 0x0330 )
	       		     && ( numcol > LWHITE ) )
	     		     XDeselect( tree, KREPEAT );
       	                
       	                (*xcpb->MFsave)( MFRESTORE, &Other );
       			break;
 	       					
       	case KRESPONS:  (*xcpb->MFsave)( MFSAVE, &Other );
       			if( AES_Version >= 0x0320 )
       			    graf_mouse( FLAT_HAND, 0L );
       			    
		        if(( AES_Version >= 0x0330 )
	      		    && ( numcol > LWHITE ) )
	     		    XSelect( tree, KRESPONS );

		        graf_mkstate( &ox, &mk.y, &mk.buttons, &mk.kstate );
	  		do
	  		{
	     		   graf_mkstate( &mk.x, &mk.y, &mk.buttons, &mk.kstate );
	  		}while( mk.buttons && ( mk.x == ox ));

			if( mk.buttons && ( mk.x != ox ))
			{
       			   (*xcpb->Sl_dragx)( tree, RESPBASE, KRESPONS, KEYMIN,
       					      KEYMAX, &cur_value.response,
       	                                      KResponse );
       	                   Set_Kbrate();                  
			}
			
          		if(( AES_Version >= 0x0330 )
	       		     && ( numcol > LWHITE ) )
	     		     XDeselect( tree, KRESPONS );

       	                (*xcpb->MFsave)( MFRESTORE, &Other );
       			break;
       			
       	case RRESP:     (*xcpb->Sl_arrow)( tree, RESPBASE, KRESPONS, RRESP,
       	                                  1, KEYMIN, KEYMAX,
       	                                  &cur_value.response, HORIZONTAL,
       	                                  KResponse );
       	                Set_Kbrate();
       	 		break;
 	       	
       	case LRESP:     (*xcpb->Sl_arrow)( tree, RESPBASE, KRESPONS, LRESP,
       	                                  -1, KEYMIN, KEYMAX,
       	                                  &cur_value.response, HORIZONTAL,
       	                                  KResponse );
       	                Set_Kbrate();
       			break;
 	       	
       	case RREPEAT:   (*xcpb->Sl_arrow)( tree, REPTBASE, KREPEAT, RREPEAT,
       	                                  1, KEYMIN, KEYMAX,
       	                                  &cur_value.repeat, HORIZONTAL,
       	                                  KRepeat );
       	                Set_Kbrate();
       			break;
 	       	
       	case LREPEAT:   (*xcpb->Sl_arrow)( tree, REPTBASE, KREPEAT, LREPEAT,
       	                                  -1, KEYMIN, KEYMAX,
       	                                  &cur_value.repeat, HORIZONTAL,
       	                                  KRepeat );
       	                Set_Kbrate();
       			break;

	case REPTBASE:  Graf_mkstate( &mk );
			objc_offset( tree, KREPEAT, &ox, &oy );
			oy = (( mk.x < ox ) ? ( -3 ) : ( 3 ) );
       			(*xcpb->Sl_arrow)( tree, REPTBASE, KREPEAT, -1,
       			                  oy, KEYMIN, KEYMAX,
       			                  &cur_value.repeat, HORIZONTAL,
       			                  KRepeat );
       			Set_Kbrate();
  			break;
			
	case RESPBASE:  Graf_mkstate( &mk );
			objc_offset( tree, KRESPONS, &ox, &oy );
			oy = (( mk.x < ox ) ? ( -3 ) : ( 3 ));
       			(*xcpb->Sl_arrow)( tree, RESPBASE, KRESPONS, -1,
       			                  oy, KEYMIN, KEYMAX,
       			                  &cur_value.response, HORIZONTAL,
       			                  KResponse );
       			Set_Kbrate();
			break;
			

	case BLK1BUTT:  Do_Speed();
			break;
			
	case BLK2BUTT:  Do_Block2();
        		
	default:	if( button == -1 )
  			{
     			   switch( msg[0] )
     			   {
     			     case WM_REDRAW: Redraw_Objects();
     			     		     break;
     			     		     
     			     case AC_CLOSE:  done = TRUE;
     			     		     pop_data();	
     			     		     break;
     			     		     
     			     case WM_CLOSED: done = TRUE;
     			     		     Set_Data();
					     break;
     			     default:
     			     		break;
     			   }
     			}
     			break;
    }
    return( done );
}
Пример #21
0
/* ***PopUp darstellen*** */
short wdial_popup(OBJECT *ptree, short *pitem, short popupx, short popupy, void (*msghndlr)(int msgbf[]), unsigned long msec, void (*tmrhndlr)())
{
 int mpopupret, pwhndl;
 int dx, dy, dw, dh;
 int newitem=-1, olditem=-1;
 int msgbuf[8]; int which;
 int mx, my, mb, br;

 wind_get(0, WF_WORKXYWH, &dx, &dy, &dw, &dh); /* Desktopgr��e */

 if(popupx+ptree->ob_width > dx+dw)
  popupx=dx+dw-ptree->ob_width;
 if(popupx<dx)  popupx=dx;
 ptree->ob_x=popupx;
 if(*pitem > 0)  popupy-=ptree[*pitem].ob_y;
 if(popupy+ptree->ob_height > dy+dh)
   popupy=dy+dh-ptree->ob_height;
 if(popupy<dy)  popupy=dy;
 ptree->ob_y=popupy;

 wind_calc(WC_BORDER, 0, ptree->ob_x, ptree->ob_y,
           ptree->ob_width, ptree->ob_height, &dx, &dy, &dw, &dh);
 pwhndl=wind_create(0, dx, dy, dw, dh);  /* Fenster anmelden */
 if(pwhndl<0)  return(FALSE);
 wind_open(pwhndl, dx, dy, dw, dh);               /* Fenster �ffnen */
 /*objc_draw(ptree, 0, 1, dx, dy, dw, dh); ->Durch WM_REDRAW zeichnen lassen*/

 do graf_mkstate(&mx, &my, &mb, &dx); while(mb);  /* Maustasten vorher loslassen */

 do
  {
   which=evnt_multi(MU_MESAG|MU_BUTTON|MU_TIMER, 1,1,1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb,
                    &dx, &dx, &br);

   if(which&MU_MESAG)
    {
     if(msgbuf[3]==pwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP)
      {
       switch(msgbuf[0])
        {
         case WM_REDRAW:
           wdial_redraw(pwhndl, ptree, (GRECT *)(&msgbuf[4]));
           break;
         case WM_TOPPED:
           wind_set(pwhndl, WF_TOP, 0L, 0L);
           break;
        }
      }
     else if( msghndlr )  msghndlr(msgbuf);
    }

   if(which&MU_TIMER)
    {
     newitem=objc_find(ptree, 0, 1, mx, my);
     if(newitem>0 && newitem!=olditem)
      {
       if( (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) )
        {
         GRECT prct;
         ptree[olditem].ob_state&=~SELECTED;
         ptree[newitem].ob_state|=SELECTED;
         prct.g_x=ptree->ob_x+ptree[olditem].ob_x;
         prct.g_y=ptree->ob_y+ptree[olditem].ob_y;
         prct.g_w=ptree[olditem].ob_width; prct.g_h=ptree[olditem].ob_height;
         wdial_redraw(pwhndl, ptree, &prct);
         prct.g_x=ptree->ob_x+ptree[newitem].ob_x;
         prct.g_y=ptree->ob_y+ptree[newitem].ob_y;
         prct.g_w=ptree[newitem].ob_width; prct.g_h=ptree[newitem].ob_height;
         wdial_redraw(pwhndl, ptree, &prct);
         olditem=newitem;
        }
        else
         newitem=olditem;
      }
      else
       newitem=olditem;
     if( tmrhndlr )  tmrhndlr();
    }

  }
 while(mb!=1);  /* Bis Maustaste gedr�ckt */

 newitem=objc_find(ptree, 0, 1, mx, my);
 if(newitem>0 && (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) )
  { *pitem=newitem; mpopupret=TRUE; }
  else { mpopupret=FALSE; }
 if(olditem>0) ptree[olditem].ob_state&=~SELECTED;

 wind_close(pwhndl);  wind_delete(pwhndl);        /* Fenster schliessen */

 return(mpopupret);
}
Пример #22
0
/* ................................................................
 * Handle user interaction with a form in open window `w'.
 *
 * Initial conditions are as follows:
 * w->x is the address of the form.
 * window is open, with appropriate WINFO rects & coordinates set
 * form is drawn within window, at correct virtual coordinates
 * ROOT object of form has correct x,y coordinates
 *
 * This routine works just like form_do, but dispatches window
 * events, redrawing and fixing up the object tree as appropriate,
 * and maintaining the various rects and coordinates in the WINFO struct.
 *
 * Returns exit object selected, |= 0x8000 if double clicked a TOUCHEXIT,
 * OR -1 if a message was received which couldn't be handled.
 * In the latter case, the `puntmsg' array is filled with the message buffer
 * which xform_do() couldn't handle, and the application is responsible for
 * picking up where xform_do() left off.  A cop-out, I know.
 *
 * NOTE: form_dial( FMD_START,... ) and form_dial( FMD_FINISH,... )
 *		should NOT be used with xform_do().
 *
 * User defined objects could cause problems with this routine, as
 * the boundary of the object may lie outside the window coordinates.
 * Caveat programmer.
 */
WORD
cdecl
xform_do( OBJECT *tree, WORD start_field, WORD puntmsg[] )
{
	WORD	next_obj, edit_obj, idx;
	BOOLEAN	cont, doedit;
	WORD	event;
	MRETS	m;
	WORD	key, clicks;
	DIRS	direction; /* form_keybd */
	GRECT	rect;
		
	cpx_tree = tree;
	SetAccCloseState( FALSE );
	SetWmCloseState( FALSE );
	/*
	 * Get the next editable object
	 */
	if( start_field == 0 )
		next_obj = find_obj( tree, 0, FORWARD );
	else
		next_obj = start_field;

	edit_obj = 0;
	cont = TRUE;
	
	cursor = FALSE;
	
	while( cont ) {

		/*
		 * Put the cursor in the edit field
		 * Note: This is skipped if there is only one field.
		 */
		if( (next_obj != 0) && (edit_obj != next_obj) ) {
			edit_obj = next_obj;
			next_obj = 0;
			doedit = can_edit( tree, edit_obj );
			if( doedit && !cursor )
			{
				objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
				cursor = TRUE;
			}	
		}
		wind_update( FALSE );
		/*
		 * Wait...
		 */
		event = Evnt_multi( MU_KEYBD|MU_BUTTON|MU_MESAG, 2, 1, 1,
							NULL, NULL, msg, 0L, &m, &key, &clicks );
		wind_update( TRUE );

		if( EvMessage() ) {
			switch( MsgType(msg) ) {
				case AC_OPEN:   acc_open( (int *)msg );
						break;
						
				case WM_TOPPED:
				case WM_NEWTOP:
					        Wm_Topped( ( int *)msg );
						doedit = can_edit( tree, edit_obj );
					        if( doedit && !cursor )
					        {
					           objc_edit( tree, edit_obj, 0, (int *)&idx, ED_INIT );
						   cursor = TRUE;
					        }
						break;
						
				case WM_SIZED:
					doedit = can_edit( tree, edit_obj );
					
				/* fall through */
				case WM_MOVED:	/* if moving, that means we are on top, therefore, cursor is already on */
						doedit = can_edit( tree, edit_obj );
						if( !doedit )
							cursor = FALSE;
				case WM_REDRAW:
				case WM_FULLED:
				case WM_ARROWED:
				case WM_HSLID:
				case WM_VSLID:
				/* redraw 'n' shit */
						
					if( edit_obj && ( msg[0] == WM_REDRAW ))
					{
					    NoEdit( edit_obj );
					    rect = ObRect( edit_obj );
					    objc_offset( tree, edit_obj, &rect.g_x, &rect.g_y );

					    /* The offsets will take care of the blinking cursor
					     * area that needs to be redraw to erase it.
					     */
					    rect.g_y -= 3;
					    rect.g_w += 3;
					    rect.g_h += 6;

					    /* Clip the rectangle to the work area of the form.*/
					    rc_intersect( &w.work, &rect ); 

					    /* The redraw is necessary to turn off the blinking cursor.
					     * We are going to need to send a redraw message to the calling
					     * cpx in case they have any custom redraws that need to be done.
					     */
					    Redraw_XForm_Do( &rect );
					    
					    if( msg[0] == WM_REDRAW )
					    {	
					       for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					    }

					}
					/* Here we redraw/move the area that is dirtied */    
					do_windows( (int *)msg, (int *)&event );
					if( edit_obj )
					    MakeEditable( edit_obj );
					doedit = can_edit( tree, edit_obj );
					if( !doedit )
						cursor = FALSE;
					if( msg[0] == WM_REDRAW )
					{	
					   for( idx = 0; idx < 8; idx++ )
						   puntmsg[idx] = msg[idx];
					   return -1;
					}
				break;

				default:if( msg[0] == AC_CLOSE )
						SetAccCloseState( TRUE );
					if( msg[0] == AP_TERM )
					{
					    SetAccCloseState( TRUE );
					    msg[0] = AC_CLOSE;
					}
					if( msg[0] == WM_CLOSED )
					        SetWmCloseState( TRUE );
					for( idx = 0; idx < 8; idx++ )
						puntmsg[idx] = msg[idx];
					return -1;
			}
		}


/*
 * What about hot keys?? AIEEE!!
 */
		if( EvKey() ) {

			/*
			 * form_keybd() encapsulated here
			 */
			direction = NODIR;
			switch( key ) {

				case K_RETURN:
				case K_ENTER:
					next_obj = 0;
					direction = DEFAULTDIR;
					break;

				case K_BACKTAB:
				case K_UP:
					direction = BACKWARD;
					break;

				case K_TAB:
				case K_DOWN:
					direction = FORWARD;
					break;
			}

			if( direction != NODIR ) {
				key = 0;
				next_obj = find_obj( tree, edit_obj, direction );
				if( (direction == DEFAULTDIR) && (next_obj != 0) ) {
					Objc_change( tree, next_obj, &w.work,
 				        ObState(next_obj)|SELECTED, TRUE );
					cont = FALSE;
				}
			}
			/*
			 * End of form_keybd()
			 */

			/* The above code clears 'key', therefore, we'll
			 * check key FIRST, then test the ASCII and 
			 * scancode
			 */
			if( key && ( !( key & 0xff ) )  )
			{
			  if( ( key != K_UP     )  &&
			      ( key != K_DOWN   )  &&
			      ( key != K_RIGHT  )  &&
			      ( key != K_LEFT   )  &&
			      ( key != K_RETURN )  &&
			      ( key != K_ENTER  )  &&
			      ( key != K_TAB )	   &&
			      ( key != K_BACKTAB)
			    )
			    {
			      puntmsg[0] = CT_KEY;
			      puntmsg[3] = key;
			      return -1;
			    }  
			}

			if( key && doedit )
				objc_edit( tree, edit_obj, key, (int *)&idx, ED_CHAR );
		}

		if( EvButton() ) {
			next_obj = objc_find( tree, ROOT, MAX_DEPTH, m.x, m.y );
			if( next_obj == NIL ) {
				Bconout( 2, 7 );
				next_obj = 0;
			} else {
				cont = fm_button( tree, next_obj, clicks, &next_obj );
			}
		}

		if(  doedit && (!cont || (next_obj != 0)) && ( next_obj != edit_obj) )
		{
		   objc_edit( tree, edit_obj, 0, (int *)&idx, ED_END );
		   cursor = FALSE;
		}   		
	}

	return next_obj;
}
Пример #23
0
static int xw_do_menu(WINDOW *w, int x, int y)
{
	int title, otitle, item, p, i, c, exit_mstate;
	int pxy[8];
	long mem;
	OBJECT *menu = w->xw_menu;
	RECT r, box;
	int stop, draw;
	MFDB bmfdb, smfdb;

	if (menu == NULL)
		return FALSE;

	xw_bar_rect(w, &r);

	if (xd_inrect(x, y, &r) == FALSE)
		return FALSE;

	p = menu[w->xw_bar].ob_head;

	exit_mstate = (xe_button_state() & 1) ? 0 : 1;

	if (((title = objc_find(menu, p, MAX_DEPTH, x, y)) >= 0) && (menu[title].ob_type == G_TITLE))
	{
		xd_wdupdate(BEG_UPDATE);
		xd_wdupdate(BEG_MCTRL);

		item = -1;
		stop = FALSE;

		do
		{
			menu[title].ob_state |= SELECTED;
			xw_redraw_menu(w, title, &r);

			i = menu[p].ob_head;
			c = 0;

			/* Zoek welke titel geselekteerd is */

			while (i != title)
			{
				i = menu[i].ob_next;
				c++;
			}

			i = menu[w->xw_mparent].ob_head;

			/* Zoek de bijbehorende box */

			while (c > 0)
			{
				i = menu[i].ob_next;
				c--;
			}

			xd_objrect(menu, i, &box);

			box.x -= 1;
			box.y -= 1;
			box.w += 2;
			box.h += 2;

			mem = xd_initmfdb(&box, &bmfdb);

			otitle = title;

			if ((bmfdb.fd_addr = (*xd_malloc)(mem)) == NULL)
				stop = TRUE;
			else
			{
				if ((draw = xd_rcintersect(&box, &xd_desk, &box)) == TRUE)
				{
					xd_rect2pxy(&box, pxy);
					pxy[4] = 0;
					pxy[5] = 0;
					pxy[6] = box.w - 1;
					pxy[7] = box.h - 1;
					smfdb.fd_addr = NULL;

					xw_copy_screen(&bmfdb, &smfdb, pxy);
					xw_menu_draw(menu, i, &box);
				}

				do
				{
					int mx, my, oitem, dummy;

					oitem = item;

					stop = xe_mouse_event(exit_mstate, &mx, &my, &dummy);

					if ((title = objc_find(menu, p, MAX_DEPTH, mx, my)) < 0)
					{
						title = otitle;

						if (((item = objc_find(menu, i, MAX_DEPTH, mx, my)) >= 0) && (menu[item].ob_state & DISABLED))
							item = -1;
					}
					else
					{
						item = -1;
						if (exit_mstate != 0)
							stop = FALSE;
					}

					if (item != oitem)
					{
						if (oitem >= 0)
							xw_menu_change(menu, oitem, FALSE, &box);
						if (item >= 0)
							xw_menu_change(menu, item, TRUE, &box);
					}
				}
				while ((title == otitle) && (stop == FALSE));

				if (item >= 0)
					menu[item].ob_state &= ~SELECTED;

				if (draw == TRUE)
				{
					pxy[0] = 0;
					pxy[1] = 0;
					pxy[2] = box.w - 1;
					pxy[3] = box.h - 1;
					xd_rect2pxy(&box, &pxy[4]);
					smfdb.fd_addr = NULL;
					xw_copy_screen(&smfdb, &bmfdb, pxy);
				}
				(*xd_free)(bmfdb.fd_addr);
			}

			if (item < 0)
			{
				menu[otitle].ob_state &= ~SELECTED;
				xw_redraw_menu(w, otitle, &r);
			}
		}
		while (stop == FALSE);

		/* Wacht tot muisknop wordt losgelaten. */

		while (xe_button_state() & 1);

		xd_wdupdate(END_MCTRL);
		xd_wdupdate(END_UPDATE);

		if (item >= 0)
			w->xw_func->wd_hndlmenu(w, title, item);
	}
	return TRUE;
}