Exemplo n.º 1
0
void SetMacroNameDialog::manage()
{
    Network *n = this->network;
    char *cat = (char *)n->getCategoryString();

    if(cat)
    	XmTextSetString(this->category, cat);
    else
    	XmTextSetString(this->category, "Macros");

    XmTextSetString(this->macroName, (char *)n->getNameString());
    XmTextSetString(this->description, (char *)n->getDescriptionString());

    boolean sens = (this->network == theDXApplication->network);
    Pixel color = sens ? theDXApplication->getForeground()
		       : theDXApplication->getInsensitiveColor();
    SetTextSensitive(this->macroName, sens, color); 
    SetTextSensitive(this->category,  sens, color);
    SetTextSensitive(this->description,  sens, color);

    this->Dialog::manage();

    if(sens)
    {
   	XmProcessTraversal(this->description, XmTRAVERSE_CURRENT);
   	XmProcessTraversal(this->description, XmTRAVERSE_CURRENT);
    }
}
Exemplo n.º 2
0
void processAct(Widget w, XEvent *e, String *params, Cardinal *num_params)
{
    if (app_data.source_editing && w == source_view->source())
    {
	// Process event in source window
	string action = "self-insert";   // Default action
	String *action_params      = 0;
	Cardinal num_action_params = 0;
	if (num_params != 0 && *num_params > 0)
	{
	    action = params[0];
	    action_params = params + 1;
	    num_action_params = *num_params - 1;
	}

	XtCallActionProc(w, action.chars(), e, action_params, num_action_params);
	return;
    }

    if (e->type != KeyPress && e->type != KeyRelease)
	return;			// Forward only keyboard events

    if (!XtIsRealized(gdb_w))
	return;			// We don't have a console yet

    if (app_data.console_has_focus == Off)
	return;			// No forwarding

    if (app_data.console_has_focus == Auto && !have_command_window())
	return;			// The console is closed

    static bool running = false;

    if (running)
	return;			// We have already entered this procedure

    running = true;

#if 0
    clear_isearch();		// Why would this be needed?  -AZ
#endif

    // Give focus to GDB console
    XmProcessTraversal(gdb_w, XmTRAVERSE_CURRENT);

    // Forward event to GDB console
    Window old_window = e->xkey.window;
    e->xkey.window = XtWindow(gdb_w);
    XtDispatchEvent(e);
    e->xkey.window = old_window;

    // Return focus to original widget
    XmProcessTraversal(w, XmTRAVERSE_CURRENT);

    running = false;
}
Exemplo n.º 3
0
/*ARGSUSED*/
static void 
Arm(
        Widget wid,
        XEvent *event,
        String *params,		/* unused */
        Cardinal *num_params)	/* unused */
{
  XmArrowButtonWidget aw = (XmArrowButtonWidget) wid;
  XmArrowButtonCallbackStruct call_value;
  
  (void) XmProcessTraversal((Widget) aw, XmTRAVERSE_CURRENT);
  
  aw->arrowbutton.selected = True;
  aw->arrowbutton.armTimeStamp = event->xbutton.time; /* see MultiActivate */
  
  DrawArrow(aw, aw->primitive.bottom_shadow_GC,
	    aw->primitive.top_shadow_GC, NULL);
  
  if (aw->arrowbutton.arm_callback)
    {
      XFlush(XtDisplay(aw));
      
      call_value.reason = XmCR_ARM;
      call_value.event = event;
      XtCallCallbackList((Widget) aw, 
			 aw->arrowbutton.arm_callback, 
			 &call_value);
    }
}
Exemplo n.º 4
0
Arquivo: DrawnB.c Projeto: att/uwin
static void
Arm(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    XmProcessTraversal(w, XmTRAVERSE_CURRENT);

    if (!DB_Armed(w))
    {
	DB_Armed(w) = True;
	if (event)
	    DB_ArmTimeStamp(w) = event->xbutton.time;

	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, NULL);

	if (DB_ArmCallback(w))
	{
	    cbs.reason = XmCR_ARM;
	    cbs.event = event;
	    cbs.window = XtWindow(w);
	    cbs.click_count = DB_ClickCount(w);

	    XFlush(XtDisplay(w));

	    XtCallCallbackList(w,
			       DB_ArmCallback(w),
			       (XtPointer)&cbs);
	}
    }
}
Exemplo n.º 5
0
void iupdrvActivate(Ihandle* ih)
{
  if (iupStrEqual(ih->iclass->name, "text") || iupStrEqual(ih->iclass->name, "multiline"))
    XmProcessTraversal(ih->handle, XmTRAVERSE_CURRENT);
  else
    XtCallActionProc(ih->handle, "ArmAndActivate", 0, 0, 0 );
}
Exemplo n.º 6
0
void
display_note_equip_poplist (Widget w,
                            XtPointer client_data,
                            XtPointer call_data)
{
   if (notesc_poplist_shell == NULL)
      create_notesc_poplist_shell (notes_create_shell);

   /* Populate the list. The subscr_no values are not saved in a
   ** list structure, but are retrieved from the db every time the 
   ** poplist button is activated.
   */

   XmListDeleteAllItems (notesc_poplist);
   populate_note_subscr_no_list();
   XmListAddItems (notesc_poplist, note_subscr_no_strings,
      num_note_subscr_no_codes, 0);

   /* Set the text field that will be populated when user selects
    * a value from the list.
    */
   XtVaSetValues (notesc_poplist, XmNuserData, notes_equip_txt, NULL);

   position_poplist (w, notesc_poplist_shell);
   XtManageChild (notesc_poplist_form);
   XtPopup (notesc_poplist_shell, XtGrabNone);
   XmProcessTraversal (notesc_poplist, XmTRAVERSE_CURRENT);
}
Exemplo n.º 7
0
void iupdrvActivate(Ihandle* ih)
{
  if (IupClassMatch(ih, "text"))
    XmProcessTraversal(ih->handle, XmTRAVERSE_CURRENT);
  else
    XtCallActionProc(ih->handle, "ArmAndActivate", 0, 0, 0 );
}
Exemplo n.º 8
0
void
display_note_text_poplist (Widget w,
                           XtPointer client_data,
                           XtPointer call_data)
{
int status;

   if (notesc_poplist_shell == NULL)
      create_notesc_poplist_shell (notes_create_shell);

   /* Populate the list */
   XmListDeleteAllItems (notesc_poplist);
   status = populate_note_text_list();
   if (status != SUCCESS) return;

   XmListAddItems (notesc_poplist, note_text_strings,
      num_note_text_codes, 0);

   /* Set the text field that will be populated when user selects
    * a value from the list.
    */
   XtVaSetValues (notesc_poplist, XmNuserData, notes_text_txt, NULL);

   position_poplist (w, notesc_poplist_shell);
   XtManageChild (notesc_poplist_form);
   XtPopup (notesc_poplist_shell, XtGrabNone);
   XmProcessTraversal (notesc_poplist, XmTRAVERSE_CURRENT);
}
Exemplo n.º 9
0
void
display_notes_create_screen (Widget w,
                             XtPointer client_data,
                             XtPointer call_data)
{
  
  /* Display the screen that lets the user enter a new note */

  if (notes_create_shell == NULL)
  {
    create_notes_create_shell(notes_shell);
    notes_create_add_event_handlers();
    get_user_note_duration();
  }

  init_notes_create_screen ();

  /* Get account_no from global var */
  XmTextSetString (nc_accountid_txt, gacct_external_id);
  XmTextSetString (nc_accountname_txt, gaccount_name);

  set_editable_off (nc_accountid_txt);
  set_editable_off (nc_accountname_txt);
  set_editable_off (notes_text_txt);

  XtManageChild(notes_create_form);
  XtPopup (notes_create_shell, XtGrabNone);

  /* Set global to indicate that this window is up */
  notes_create_shell_up = TRUE;

  /* Position the cursor on the subscr_no field */
  XmProcessTraversal (notes_equip_txt, XmTRAVERSE_CURRENT);
}
Exemplo n.º 10
0
/*----------------------------------------------------------------------*/
static void
ActionHighlight(Widget item,XEvent * event,char ** params,Cardinal * nparams)
{
	Widget w = XfeIsComboBox(item) ? item : _XfeParent(item);
	
	XmProcessTraversal(w,XmTRAVERSE_CURRENT);
}
Exemplo n.º 11
0
void XttMotif::open_input_dialog( const char *text, const char *title,
				  const char *init_text,
				  void (*ok_cb)( Xtt *, char *))
{
  Arg		args[10];
  int 		i;
  XmString	cstr;

  i = 0;
  XtSetArg(args[0], XmNlabelString,
		cstr=XmStringCreateLtoR( (char*) text, (char*) "ISO8859-1") ); i++;
  XtSetValues( india_label, args, i);
  XmStringFree( cstr);
  i = 0;
  XtSetArg(args[0], XmNdialogTitle,
		cstr=XmStringCreateLtoR( (char*) title, (char*) "ISO8859-1") ); i++;
  XtSetValues( india_widget, args, i);
  XmStringFree( cstr);

  XmTextSetString( india_text, (char*) init_text);

  XtManageChild( india_widget);

  XmProcessTraversal( india_text, XmTRAVERSE_CURRENT);

  india_ok_cb = ok_cb;
}
Exemplo n.º 12
0
void
Process_Resize( void )
{
  int flag;
  char old_width[10], old_height[10];
  static char *untitledStr = NULL;

  if ( DialogFlag == NEW ) {
    strcpy(undo_file, last_fname);
    last_fname[0] = '\0';
    SavedOnce = False;
    Backup_Icons();    /* for undo */
    flag = DO_NOT_SAVE;
    Init_Icons(icon_width, icon_height, flag);
    if (!untitledStr)
      untitledStr = GETSTR(2,20, "UNTITLED");
    strcpy(last_fname, untitledStr);
    strcat(last_fname, ".m.pm");
    last_fname[strlen(last_fname)] = '\0';
    ChangeTitle();
    Repaint_Exposed_Tablet();
    Dirty = False;
    NewFlag = TRUE;
    }
  else{
    sprintf(old_width, "%d", icon_width);
    XmTextFieldSetString(newWidthText, old_width);
    sprintf(old_height, "%d", icon_height);
    XmTextFieldSetString(newHeightText, old_height);
    XtManageChild(newIconDialog);
    XmProcessTraversal(newWidthText, XmTRAVERSE_CURRENT);
    XmTextFieldSetSelection(newWidthText, 0, 3, CurrentTime); }
}
Exemplo n.º 13
0
/************************************************************************
 *
 * XtActionProc - CancelOut() - this is the callback which gets
 *        called when a user type 'Space' in a text widget which has
 *        this translation tied to it.
 *
 ***********************************************************************/
void
CancelOut(
        Widget widget,
        XEvent *event,
        XtPointer params,
        XtPointer num_params)
{
   FileMgrData *file_mgr_data;
   FileMgrRec *file_mgr_rec;
   Arg args[2];
 
   if(strcmp(widget->core.name, "nameChangeT") == 0)
   {
      FileViewData *fileViewData;

      file_mgr_data = ReturnDesktopPtr(XtParent(widget));
      XtUnmanageChild(widget);
      XtDestroyWidget(widget);
      file_mgr_rec = (FileMgrRec *)file_mgr_data->file_mgr_rec;
      file_mgr_rec->menuStates |= RENAME;
      if(file_mgr_data->selected_file_count == 1)
      {
         fileViewData = file_mgr_data->selection_list[0];
         XmProcessTraversal(fileViewData->widget, XmTRAVERSE_CURRENT);
      }
   }
   else if(strcmp(widget->core.name, "nameChangeT_DT") == 0)
   {
      UnpostDTTextField ();
   }
   else if(strcmp(widget->core.name, FAST_RENAME) == 0)
   {
      file_mgr_data =
             ReturnDesktopPtr(XtParent(XtParent(XtParent(XtParent(widget)))));
      file_mgr_rec = (FileMgrRec *)file_mgr_data->file_mgr_rec;

      XmProcessTraversal(file_mgr_rec->file_window, XmTRAVERSE_CURRENT);
      XtSetArg (args[0], XmNallowShellResize, False);
      XtSetValues(file_mgr_rec->shell, args, 1);
      XtUnmanageChild(file_mgr_rec->current_directory_text);
      XtSetArg (args[0], XmNallowShellResize, True);
      XtSetValues(file_mgr_rec->shell, args, 1);
      file_mgr_data->fast_cd_enabled = False;
   }
}
Exemplo n.º 14
0
/* initialize user interface */
void UIInit(int argc, char **argv)
{

    {
        extern int _alloc;

        ui = (UI) malloc((1) * sizeof(ui[0]));
        _alloc += (1) * sizeof(ui[0]);
        if( ui == 0 ){
            err("cant allocate %d bytes for  ui; %d already allocated",
                (1) * sizeof(ui[0]), _alloc);
        }
        if( memwatch ){
            (void) printf("malloc %s=%d\n", " ui", (1) * sizeof(ui[0]));
        }
    };

    ui->wide = UI_HITE;
    ui->hite = UI_HITE;
    ui->first = 1;
    ui->hzoom = 0;
    ui->vzoom = 0;
    ui->x1 = NO_INDEX;
    ui->y1 = NO_INDEX;
    ui->x2 = NO_INDEX;
    ui->y2 = NO_INDEX;
    ui->v1 = NO_INDEX;
    ui->v2 = NO_INDEX;
    ui->across = 0;
    ui->down = 0;
    ui->delta = 1;
    ui->pickmode = PICK_VALUE;
    ui->a_shell = 0;
    ui->s_shell = 0;
    ui->z_shell = 0;
    ui->l_shell = 0;
    ui->t_shell = 0;
    ui->f_shell = 0;
    ui->shell = 0;
    ui->style = view->style;
    /* start up motif application */
    ui->application =
        XtVaAppInitialize(&ui->context, "test", NULL, 0, &argc, argv, NULL,
                          NULL);

    /* motif main window */
    ui->main =
        XtVaCreateManagedWidget("main", xmMainWindowWidgetClass,
                                ui->application, NULL);
    /* make the menubar */
    UIMenuInit(ui->main);
    /* create window array */
    UIWindowInit(ui->main);
    XtRealizeWidget(ui->application);
    XmProcessTraversal(ui->canvas, XmTRAVERSE_CURRENT);
}
Exemplo n.º 15
0
void
display_notes_screen(Widget w,
                     XtPointer client_data,
                     XtPointer call_data)
{
   /* Bring up the main notes screen that has filter/sort/browse. */

   show_busy_cursor(custinfo_shell, ON);

   if (notes_shell == NULL)
   {
      create_notes_shell(custinfo_shell);

      XtAddEventHandler(notes_filter_from_txt, KeyPressMask,False,
                        check_date, NULL);
      XtAddEventHandler(notes_filter_to_txt, KeyPressMask,False,
                        check_date, NULL);
      
                /* Initialize the notes sort/filter structures */
      init_sort_names();
      init_db_names();

      /* Set up data structs for each sort toggle button. These structures
       * are used to know what position the button is in and what ascending/
       * descending toggle button is associated with it. */
      equip_sort_data.position = EQUIP_NUM;
      equip_sort_data.asc_desc_btn = &notes_equip_ad_tog;
      type_sort_data.position = NOTE_TYPE;
      type_sort_data.asc_desc_btn = &notes_type_ad_tog;
      date_sort_data.position = DATE_TIME;
      date_sort_data.asc_desc_btn = &notes_date_ad_tog;
      userid_sort_data.position = USER_ID;
      userid_sort_data.asc_desc_btn = &notes_userid_ad_tog;

      populate_note_type_list();

   }

   /* Set the account_no using the global variable, gacct_external_id */
   XmTextSetString (notes_accountid_txt, gacct_external_id);
   XmTextSetString (notes_account_name_txt, gaccount_name);

   set_editable_off (notes_accountid_txt);
   set_editable_off (notes_account_name_txt);

   reset_notes_filter(NULL,NULL,NULL);
   reset_notes_sort(NULL, NULL, NULL); /* this is a callback */

   get_notes ();

   XtPopup (notes_shell, XtGrabNone);
   XMapRaised (XtDisplay(notes_shell),XtWindow(notes_shell));

   show_busy_cursor(custinfo_shell, OFF);
   XmProcessTraversal(notes_filter_type_txt, XmTRAVERSE_CURRENT);
}
Exemplo n.º 16
0
void ShowRateChangeDialog(struct rpar_object *rp,int focus)
{
	Arg          args[1];
	char		tempString[LINEMAX];
	Widget		focusTo;
	XmString    XmTemp;
	char *insert;
	int insertlen;
		
	cur_rpar = rp;
	if(cur_rpar != NULL)
	{
		XmTemp=XmStringCreate("Change Rate Parameter",XmSTRING_DEFAULT_CHARSET);
		XtSetArg(args[0],XmNdialogTitle,XmTemp);
		XtSetValues(rate_dlg,args,1);
		
		if(cur_rpar->tag != NULL)
			XmTextFieldSetString(rate_tag,cur_rpar->tag);
		else
			XmTextFieldSetString(rate_tag,"");
		
		sprintf(tempString,"%f",cur_rpar->value);	
		XmTextFieldSetString(rate_rate,tempString);
		
		switch(focus)
		{
			case 0:
				focusTo=rate_tag;
				break;
			default:
				focusTo=rate_rate;
		}
		
	}
	else
	{
		XmTemp=XmStringCreate("Create Rate Parameter",XmSTRING_DEFAULT_CHARSET);
		XtSetArg(args[0],XmNdialogTitle,XmTemp);
		XtSetValues(rate_dlg,args,1);
		
		XmTextFieldSetString(rate_tag,"");
		XmTextFieldSetString(rate_rate,"");
		focusTo = rate_tag;
	}		
	XmStringFree(XmTemp);
	XtManageChild(rate_dlg);
	
	XmProcessTraversal(focusTo,XmTRAVERSE_CURRENT);
	
	insert=XmTextFieldGetString(focusTo);
	insertlen=strlen(insert);
	XmTextFieldSetSelection(focusTo,0,insertlen,XtLastTimestampProcessed(XtDisplay(focusTo)));
	XmTextFieldSetHighlight(focusTo,0,insertlen,XmHIGHLIGHT_SELECTED);
	XtFree(insert);
	
}
Exemplo n.º 17
0
void XFE_PrefsLdapPropDialog::show()
{
    // Manage the top level

    XFE_Dialog::show();

    // Set focus to the OK button

    XmProcessTraversal(m_okButton, XmTRAVERSE_CURRENT);
}
Exemplo n.º 18
0
static void
renameError_ok_callback(
	Widget w,
	XtPointer client_data,
	XtPointer call_data)
{
  XtDestroyWidget((Widget)client_data);
  XmProcessTraversal(G_rename_text, XmTRAVERSE_CURRENT);

  return;
}
Exemplo n.º 19
0
void print_result (Widget text_w, XtPointer client_data,
                        XtPointer call_data)
{
    char *value = XmTextFieldGetString (text_w);
    char *label = (char *) client_data;

    printf ("%s %s\n", label, value);
    XtFree (value);

    XmProcessTraversal (text_w, XmTRAVERSE_NEXT_TAB_GROUP);
}
Exemplo n.º 20
0
static void
SetFocus(
        ChangeDirRec *change_dir_rec,
        ChangeDirData *change_dir_data )
{
   Widget text;

   /* Force the focus to the text field */
   text = XmSelectionBoxGetChild (change_dir_rec->change_dir, XmDIALOG_TEXT);
   XmProcessTraversal(text, XmTRAVERSE_CURRENT);
}
Exemplo n.º 21
0
void XFE_PrefsDiskMoreDialog::show()
{
	// TODO: Initialize the dialog

	// Manage the top level

	XFE_Dialog::show();

	// Set focus to the OK button

	XmProcessTraversal(m_okButton, XmTRAVERSE_CURRENT);
}
Exemplo n.º 22
0
void WUtedGtk::questionbox( char *question_title,
			 char	  *question_text,
			 void	  (* yes_procedure) (WUted *),
			 void	  (* no_procedure) (WUted *),
			 void	  (* cancel_procedure) (WUted *), 
			 pwr_tBoolean cancel) 
{
#if 0
  Arg		args[5];
  int 		i;
  XmString	cstr;
  XmString	cstr2;
  XmString	help_label;
  GtkWidget		help_button;
  GtkWidget		yes_button;

  cstr = XmStringCreateLtoR( question_text, "ISO8859-1");
  cstr2 = XmStringCreateLtoR( question_title, "ISO8859-1");
  help_button = XmMessageBoxGetChild(widgets.questionbox, 
				     XmDIALOG_HELP_BUTTON);
  yes_button = XmMessageBoxGetChild( widgets.questionbox, 
				     XmDIALOG_OK_BUTTON);
  
  if (cancel)
    help_label = XmStringCreateLtoR("Cancel", "ISO8859-1");
  else
    help_label = XmStringCreateLtoR("Help", "ISO8859-1");

  i=0;
  XtSetArg(args[i], XmNhelpLabelString, help_label); i++;
  XtSetArg(args[i], XmNmessageString, cstr); i++;
  XtSetArg (args[i], XmNdialogTitle, cstr2); i++;
  XtSetValues( widgets.questionbox, args,i);                    
  
  if (cancel)
    XtVaSetValues(help_button, XmNsensitive, 1, NULL);
  else
    XtVaSetValues(help_button, XmNsensitive, 0, NULL);

  XtManageChild( widgets.questionbox);

  XmStringFree( cstr);
  XmStringFree( cstr2);
  XmStringFree(help_label);

  /* Store the yes and no functions in the context */
  questionbox_yes = yes_procedure;        
  questionbox_no = no_procedure;
  questionbox_cancel = cancel_procedure;

  XmProcessTraversal(yes_button, XmTRAVERSE_CURRENT);
#endif
}
Exemplo n.º 23
0
/*
** Look for a widget in the widget tree w, with a mnemonic matching
** keycode.  When one is found, simulate a button press on that widget
** and give it the keyboard focus.  If the mnemonic is on a label,
** look in the userData field of the label to see if it points to
** another widget, and give that the focus.  This routine is just
** sufficient for NEdit, no doubt it will need to be extended for
** mnemonics on widgets other than just buttons and text fields.
*/
static void findAndActivateMnemonic(Widget w, unsigned int keycode)
{
    WidgetList children;
    int numChildren, i, isMenu;
    KeySym mnemonic = '\0';
    char mneString[2];
    Widget userData;
    unsigned char rowColType;
    
    if (XtIsComposite(w)) {
	if (XtClass(w) == xmRowColumnWidgetClass) {
	    XtVaGetValues(w, XmNrowColumnType, &rowColType, 0);
	    isMenu = rowColType != XmWORK_AREA;
	} else
	    isMenu = False;
	if (!isMenu) {
	    XtVaGetValues(w, XmNchildren, &children, XmNnumChildren,
		    &numChildren, 0);
	    for (i=0; i<numChildren; i++)
    		findAndActivateMnemonic(children[i], keycode);
    	}
    } else {
	XtVaGetValues(w, XmNmnemonic, &mnemonic, 0);
	if (mnemonic != '\0') {
	    mneString[0] = mnemonic; mneString[1] = '\0';
	    if (XKeysymToKeycode(XtDisplay(XtParent(w)),
	    	    XStringToKeysym(mneString)) == keycode) {
	    	if (XtClass(w) == xmLabelWidgetClass ||
	    		XtClass(w) == xmLabelGadgetClass) {
	    	    XtVaGetValues(w, XmNuserData, &userData, 0);
	    	    if (userData!=NULL && XtIsWidget(userData))
	    	    	XmProcessTraversal(userData, XmTRAVERSE_CURRENT);
	    	} else {
	    	    XmProcessTraversal(w, XmTRAVERSE_CURRENT);
	    	    SimulateButtonPress(w);
	    	}
	    }
	}
    }
}
Exemplo n.º 24
0
/*----------------------------------------------------------------------*/
/* extern */ void
_XfePrimitiveFocus(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
	/* Make sure we are not pretending to be insensitive */
	if (!_XfeIsSensitive(w))
	{
		return;
	}

	XmProcessTraversal(w,XmTRAVERSE_CURRENT);

	/* Invoke Focus Callbacks */
	_XfeInvokeCallbacks(w,_XfeFocusCallbacks(w),XmCR_FOCUS,event,False);
}
Exemplo n.º 25
0
/*=== cor_filter_cb =========================================================
 * Called when the user hits 'Filter' -OR- 'Sort'.
 */
void
cor_filter_cb(Widget    w,
              XtPointer client_data,
              XtPointer call_data)
{
  char *tmp;
  char  plan[CORRIDOR_TEXT_LEN];
  char  point_origin[POINT_ORIGIN_LEN];
  char  point_target[POINT_TARGET_LEN];
  int   corridor_plan_id;
  int   found;
  int   i;

  tmp = XmTextGetString(cor_filter_plan_txt);
  strcpy(plan, tmp);
  XtFree(tmp);

  if (strlen(plan))
  {
    found = FALSE;
    for (i = 0; i < gnum_corplans; i++)
      if (strcmp(plan, gcorplans[i].description) == 0)
      {
        corridor_plan_id = gcorplans[i].db_code;
        found = TRUE;
      }
    if (! found)
    {
      post_dialog(cor_shell, XmDIALOG_ERROR,
                  "Invalid Corridor Plan.");
      XmProcessTraversal(cor_filter_plan_txt, XmTRAVERSE_CURRENT);
      return;
    }
  }
  else
    corridor_plan_id = 0;

  tmp = XmTextGetString(cor_filter_origin_txt);
  strcpy(point_origin, tmp);
  XtFree(tmp);
  tmp = XmTextGetString(cor_filter_target_txt);
  strcpy(point_target, tmp);
  XtFree(tmp);
  
  populate_corridor_list(corridor_plan_id,
                         point_origin,
                         point_target,
                         cor_sort_order);
}
Exemplo n.º 26
0
static void motCanvasInputCallback(Widget w, Ihandle *ih, XtPointer call_data)
{
  XEvent *evt = ((XmDrawingAreaCallbackStruct*)call_data)->event;

  if (!XtWindow(w) || !ih) return;

  switch (evt->type)
  {
  case ButtonPress:
    /* Force focus on canvas click */
    if (iupAttribGetBoolean(ih, "CANFOCUS"))
      XmProcessTraversal(w, XmTRAVERSE_CURRENT);
    /* break missing on purpose... */
  case ButtonRelease:
    {
      XButtonEvent *but_evt = (XButtonEvent*)evt;
      Boolean cont = True;
      iupmotButtonPressReleaseEvent(w, ih, evt, &cont);
      if (cont == False)
        return;

      if ((evt->type==ButtonPress) && (but_evt->button==Button4 || but_evt->button==Button5))
      {                                             
        IFnfiis wcb = (IFnfiis)IupGetCallback(ih, "WHEEL_CB");
        if (wcb)
        {
          char status[IUPKEY_STATUS_SIZE] = IUPKEY_STATUS_INIT;
          int delta = but_evt->button==Button4? 1: -1;
          iupmotButtonKeySetStatus(but_evt->state, but_evt->button, status, 0);

          wcb(ih, (float)delta, but_evt->x, but_evt->y, status);
        }
        else
        {
          IFniff scb = (IFniff)IupGetCallback(ih,"SCROLL_CB");
          float posy = ih->data->posy;
          int delta = but_evt->button==Button4? 1: -1;
          int op = but_evt->button==Button4? IUP_SBUP: IUP_SBDN;
          posy -= delta*iupAttribGetFloat(ih, "DY")/10.0f;
          IupSetFloat(ih, "POSY", posy);
          if (scb)
            scb(ih,op,ih->data->posx,ih->data->posy);
        }
      }
    }
    break;
  }
}
Exemplo n.º 27
0
Arquivo: ssX.c Projeto: q3k/ski
static void loadOkCallback(CALLBACK_ARGS)
{
    Widget fsd = (Widget)client_data;
    XmFileSelectionBoxCallbackStruct *cbs =
	(XmFileSelectionBoxCallbackStruct *)call_data;
    char *loadStr, s[100];

    (void)XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &loadStr);
    (void)sprintf(s, "load %s\n", loadStr);
#if 0
    cmdExLin(s);
#else
    printf("(In loadOkCallback)  Call cmdExLin: cmd = %s\n", s);
#endif
    XtUnmanageChild(fsd);
    (void)XmProcessTraversal(cmd, XmTRAVERSE_CURRENT);
}
Exemplo n.º 28
0
void
mgv_magstep_edit(Widget w, XtPointer closure, XtPointer call)
{
	MGV   *m = (MGV *)closure;
	Widget text;
	Arg    a;
	USEUP(w); USEUP(call);
	assert(MgvOK(m));

	text = wl_find1(m->main, "*statusLine*magstepFrame*text");
	XtManageChild(text);

	XtSetArg(a, XmNrightWidget, text);
	XtSetValues(wl_find1(m->main, "*statusLine*magstepFrame*label"), &a, 1);

	XtUnmanageChild(wl_find1(m->main, "*statusLine*magstepFrame*value"));
	XmProcessTraversal(text, XmTRAVERSE_CURRENT);
}
Exemplo n.º 29
0
static void B1_press(Widget w, XEvent *event, char **str, Cardinal *num) 
{
  XmTextPosition pos;
  XButtonEvent *ev = (XButtonEvent *)event;
  XmProcessTraversal(w, XmTRAVERSE_CURRENT);
  /* we're replacing the built-in take_focus action here, so do it by hand, but leave listener blue, so to speak */
  if (w != listener_text)
    XtVaSetValues(w, XmNbackground, ss->sgx->white, NULL);
  else XmTextClearSelection(listener_text, CurrentTime); /* should this happen in other windows as well? */
  pos = XmTextXYToPos(w, (Position)(ev->x), (Position)(ev->y));
  XmTextSetCursorPosition(w, pos);
  down_pos = pos;
  last_pos = pos;
  if (XEN_HOOKED(listener_click_hook))
    run_hook(listener_click_hook,
	     XEN_LIST_1(C_TO_XEN_INT((int)pos)),
	     S_listener_click_hook);
}
/*
 * Class:     java_awt_KeyboardFocusManager
 * Method:    clearGlobalFocusOwner
 * Signature: ()V
 */
JNIEXPORT void JNICALL
Java_java_awt_KeyboardFocusManager__1clearGlobalFocusOwner
    (JNIEnv *env, jobject self)
{
  /* Redirect focus to the focus proxy of the active Window. The effect
     we want is for the active Window to remain active, but for none of
     its children to be the focus owner. AWT maintains state to know
     that any key events delivered after this call (but before focus is
     re-established elsewhere) get ignored. */

    jobject activeWindow;
    Widget proxy;

    if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
        return;
    }

    AWT_LOCK();

    activeWindow = (*env)->CallStaticObjectMethod
        (env, keyboardFocusManagerIDs.keyboardFocusManagerCls,
         keyboardFocusManagerIDs.markClearGlobalFocusOwnerMID);

    if (activeWindow != NULL) {
        // Setting focus owner to proxy will be equivalent haveing
        // null focus owner in Java layer while we will still be
        // able to receive key events.
        proxy = findWindowsProxy(activeWindow, env);

        if (proxy != NULL) {
            Widget curFocusWidget = XmGetFocusWidget(proxy);
            if (curFocusWidget != NULL) {
                callFocusHandler(curFocusWidget, FocusOut);
            }

            // Disable all but proxy widgets
            processTree(curFocusWidget, proxy, False);
            
            XmProcessTraversal(proxy, XmTRAVERSE_CURRENT);
        }
    }

    AWT_UNLOCK();
}