void ControlPanelGroupDialog::makeGroupList(int item)
{
    XmString *xmstrings;
    int      items = this->panelManager->getGroupCount();
    int      i = -1;

    if (items != 0)
    {
        xmstrings = new XmString[items];
	for(i=0; i < items; i++)
	{
            xmstrings[i] = 
		XmStringCreateSimple((char*)this->panelManager->getPanelGroup(i+1, NULL));
        }
    }
    else
    {
        items = 1;
        xmstrings = new XmString[1];
        xmstrings[0] = XmStringCreateSimple("(none)");
    }

    XtVaSetValues(this->list, 
    	XmNitemCount,        items,
    	XmNvisibleItemCount, items,
    	XmNitems,            xmstrings,
    	NULL);

    this->lastIndex = 0;

    if(i < 0 OR item == 0)
    {
	XmTextSetString(this->text, NULL);
	XtVaSetValues(this->changebtn, XmNsensitive, False, NULL);
	XtVaSetValues(this->deletebtn, XmNsensitive, False, NULL);
    	XmListDeselectAllItems(this->list);
	this->setToggles();
    }
    else
    {
	if(item > 0)
	     XmListSelectPos(this->list, item > items ? 0 : item, True);
	else
	{
	     char *name = XmTextGetString(this->text);
	     for(i=1; i<=items; i++)
		if(EqualString(name, 
			       (char*)this->panelManager->getPanelGroup(i,NULL)))
		   break;
	     XmListSelectPos(this->list, i, True);
	     XtFree(name);   //	AJ
	}
    }

    for (i=0 ; i<items ; i++)
        XmStringFree(xmstrings[i]);

    delete xmstrings;
}
Пример #2
0
// Update list of arguments
static void update_arguments(Widget dialog, Widget arguments_w,
			     StringArray& arguments, const string& last,
			     bool& updated)
{
    if (updated || dialog == 0)
	return;

    bool *selected = new bool[arguments.size()];
    int pos = -1;
    for (int i = 0; i < arguments.size(); i++)
    {
	if (arguments[i] == last)
	    pos = i;
	selected[i] = false;
    }
    if (pos >= 0)
	selected[pos] = true;

    setLabelList(arguments_w, arguments.values(),
		 selected, arguments.size(), false, false);

    if (pos >= 0)
	XmListSelectPos(arguments_w, pos + 1, False);

    delete[] selected;

    Widget text_w = XmSelectionBoxGetChild(dialog, XmDIALOG_TEXT);
    XmTextSetString(text_w, XMST(last.chars()));

    updated = true;
}
Пример #3
0
void set_history_from_line(const string& line,
			   bool ignore_history_commands)
{
    if (ignore_history_commands && private_gdb_history)
	return;

    while (gdb_history.size() < 1)
	gdb_history += "";
    gdb_history[gdb_history.size() - 1] = line;

    if (gdb_history_w)
    {
	int pos = gdb_history.size();

	// XmListReplaceItemsPos() disturbs the current selection, so
	// save it here
	int *selected;
	int selected_count;
	if (!XmListGetSelectedPos(gdb_commands_w, &selected, &selected_count))
	    selected = 0;

	MString xm_line(line, LIST_CHARSET);
	XmString xms = xm_line.xmstring();
	XmListReplaceItemsPos(gdb_commands_w, &xms, 1, pos);

	if (selected)
	{
	    // Restore old selection
	    for (int i = 0; i < selected_count; i++)
		XmListSelectPos(gdb_commands_w, selected[i], False);
	    XtFree((char *)selected);
	}
    }
}
Пример #4
0
/*-------------------------------------------------------------------------*/
static void updateUsersetList(void)
{
   lList *al;
   XmString *selectedItems;
   Cardinal selectedItemCount;
   Cardinal itemCount;
   
   DENTER(GUI_LAYER, "updateUsersetList");

   al = qmonMirrorList(SGE_US_LIST);
   lPSortList(al, "%I+", US_name);
   UpdateXmListFromCull(userset_names, XmFONTLIST_DEFAULT_TAG, al, 
                           US_name);
   XtVaGetValues( userset_names,
                  XmNselectedItems, &selectedItems,
                  XmNselectedItemCount, &selectedItemCount,
                  XmNitemCount, &itemCount,
                  NULL);

   if (selectedItemCount)
      XmListSelectItem(userset_names, selectedItems[0], True);
   else if (itemCount)
      XmListSelectPos(userset_names, 1, True);

   DEXIT;
}
Пример #5
0
/***********************************************************************
 *                                                                     *
 *   Copy selected items from the left list to the right list.         *
 *                                                                     *
 ***********************************************************************/
static void copy_cb(Widget w, XtPointer cd, XmAnyCallbackStruct *cbs)
{
   int         icnt, pos, pcnt, *posl;
   XmString   *items;

   if (XmListGetSelectedPos(var2NtSList, &posl, &pcnt)) {
      pos = posl[pcnt-1] + 1;
      XtFree((char *)posl);
   } else
      pos = 0;
   XmListDeselectAllItems(var2NtSList);

   if (w == exprNtSText) {

      char     *expr = XmTextGetString(w);

      if (!strempty(expr)) {
         XmString xms = XmStringCreateSimple(expr);

         XmListAddItem(var2NtSList, xms, pos);

         XmStringFree(xms);
      }
      XtFree(expr);

      /*
       * ugly... I don't want to show the scanner after hitting the
       * KActivate in the text widget
       */
      no_scan = True;

   } else if (w == copyNtSButton) {

      XtVaGetValues(var1NtSList, XmNselectedItemCount, &icnt,
                                 XmNselectedItems,     &items,
                                 NULL);

      XmListAddItems(var2NtSList, items, icnt, pos);

   } else if (w == copyAllNtSButton) {

      XtVaGetValues(var1NtSList, XmNitemCount, &icnt,
                                 XmNitems,     &items,
                                 NULL);

      clear_selector_columns(2);
      XmListAddItems(var2NtSList, items, icnt, pos);

   } else if (w == var1NtSList) {

      XmListCallbackStruct *cbsl = (XmListCallbackStruct *) cbs;
      if (cbsl->event->type == ButtonRelease)
         XmListAddItem(var2NtSList, cbsl->item, pos);

   }
   XmListSelectPos(var2NtSList, pos, False);
}
Пример #6
0
static void oneDHistListCB(Widget w, nTuBrowserInfo *nTuBrDummy,
                               caddr_t call_data)
{
    int i, idPos, *posList, count, id, l, jn, uid, ivar;
    float aa, bb;                               
    nTuBrowserInfo *nTuBr;
    nTuBroHs1D *nTuH1;

    XmListGetSelectedPos(OneDHistHistoListW, &posList, &count);
    if (count < 1) return;
    id = OneDHistListedIDs[((*posList) -1)];
    uid = hs_uid(id);
    /*
    ** Select the variable associated with this histogram.
    */
    nTuBr = oneDHistNTupleSource(id);
    if (nTuBr != CurrentNTupleBrowserSelected ) 
                    if (!mcfioC_SetSpecificNTupleBr(nTuBr)) return;
    for(i=0; i<CurrentNTupleBrowserSelected->sizeOfLists; i++) {
       nTuH1 = (nTuBroHs1D *) CurrentNTupleBrowserSelected->hsItemList[i];
       if (nTuH1 == NULL) continue;
       if (nTuH1->id == id) break;
    } 
    if (nTuH1 == NULL) {
         DialogF(DF_ERR, OneDHistShellW, 1,
                 "Internal Error in oneDHistListCB\nPlease report",
		"Acknowledged");
         return;
    }     
    ivar =  nTuH1->varNumber;
    XmListSelectPos(OneDHistVariableListW, (ivar+1), False);
    l = hs_title(id, BrowseUtil2htitle);
    XmTextSetString(OneDHistTitleW, BrowseUtil2htitle);
    l = hs_1d_hist_num_bins(id);
    SetIntText(OneDHistNumBinsW, l);
    hs_1d_hist_range(id, &aa, &bb);
    SetFloatText(OneDHistLowBinW, aa);
    SetFloatText(OneDHistHighBinW, bb);
    /*
    ** We now have to related this histogram to the associated Ntuple 
    */
    for (i=0; i<nTuBr->sizeOfLists; i++) {
       if (nTuBr->hsItemList[i] == NULL) continue;
           if (nTuBr->hsItemList[i]->id == id) {
               nTuH1 = (nTuBroHs1D *) nTuBr->hsItemList[i];
               if (nTuH1->subBlock == -1)  
                   XmTextSetString(OneDHistMultW, "All");
                else 
                   SetIntText(OneDHistMultW, nTuH1->subBlock);
            }
            break;
    }
    XtSetSensitive(OneDHistModifyW, True);
    XtSetSensitive(OneDHistDeleteW, True);
}
Пример #7
0
void pglpfw_popup ( void )
/************************************************************************
 * pglpfw_popup								*
 *									*
 * This function loads and displays the layer product files into the	*
 * file selection dialog box.						*
 *									*
 * void pglpfw_popup ( )						*
 *									*
 * Input parameters:							*
 *									*
 * Output parameters:							*
 * Return parameters:							*
 *			NONE						*
 *									*
 **									*
 * Log:									*
 * T. Lee/SAIC		04/02	Created					*
 ***********************************************************************/
{
    int		ipos;
    XmString	xmstr;
/*---------------------------------------------------------------------*/

    /*
     * set the dialog title 
     */
    xmstr = XmStringCreateLocalized("Open Layer Product File");

    pglpfw_managePanes (OPEN_POPUP);

    XtVaSetValues (_fileSelW, XmNdialogTitle, xmstr, NULL);
    XtVaSetValues (_browsePopup, XmNdialogTitle, xmstr, NULL);
    XmStringFree (xmstr);

    /*
     * hi-light the current directory
     */
    ipos = _dirPos;
    XmListSelectPos (_dirSel_listW, ipos, TRUE);

    ipos += (VISIBLE_ITEM / 2);
    if (ipos < VISIBLE_ITEM) ipos = VISIBLE_ITEM;
    if (ipos > _lpfUsrTbl.nitems) ipos = _lpfUsrTbl.nitems;

    XmListSetBottomPos (_dirSel_listW, ipos);

    /*
     * set file list.
     */

    pglpfw_setFileList ();

    XtManageChild(_fileSelW);
}
Пример #8
0
void RGISGrpPanel::Remove (DBObjTableField *group)

	{
	int *selectPos, selectCount;

	if(!XmListGetSelectedPos (GroupListWGT,&selectPos,&selectCount)) return;
	if (selectCount > 1) { XtFree ((char *) selectPos); return; }
	XmListDeleteItemsPos (GroupListWGT,1,selectPos [0]);
	if (GroupLIST != (DBObjectLIST<DBObjTableField> *) NULL)
		XmListSelectPos (GroupListWGT,selectPos [0],True);
	}
Пример #9
0
// Enter LINE in history
void add_to_history(const string& line)
{
    if (!gdb->isReadyWithPrompt())
	return;

    set_history_from_line(line);

    if (gdb_history.size() < 2 || line != gdb_history[gdb_history.size() - 2])
    {
	gdb_history += "";

	if (gdb_history_w)
	{
	    MString xm_line(line, LIST_CHARSET);
	    int pos = gdb_history.size();
	    XmListAddItem(gdb_commands_w, xm_line.xmstring(), pos - 1);
	    XmListSelectPos(gdb_commands_w, 0, False);
	    XmListSetBottomPos(gdb_commands_w, 0);
	}
    }

    gdb_current_history = gdb_history.size();
    set_history_from_line("");

    if (gdb_history_w)
    {
	XmListSelectPos(gdb_commands_w, 0, False);
	XmListSetBottomPos(gdb_commands_w, 0);
    }

    gdb_new_history = false;

    add_to_arguments(line);
    update_arguments();
    update_combo_boxes(line);

#if WITH_READLINE
    add_history(line.chars());
#endif
}
Пример #10
0
static void motListDragTransferProc(Widget drop_context, Ihandle* ih, Atom *seltype, Atom *type, XtPointer value, unsigned long *length, int format)
{
  Atom atomListItem = XInternAtom(iupmot_display, "LIST_ITEM", False);
  int idDrag = (int)value;  /* starts at 1 */
  int idDrop = iupAttribGetInt(ih, "_IUPLIST_DROPITEM");  /* starts at 1 */

  if (idDrop==0)
    return;

  /* shift to start at 0 */
  idDrag--;
  idDrop--;

  if (*type == atomListItem)
  {
    int is_ctrl;

    if (iupListCallDragDropCb(ih, idDrag, idDrop, &is_ctrl) == IUP_CONTINUE)  /* starts at 0 */
    {
      char* text = motListGetIdValueAttrib(ih, idDrag+1); /* starts at 1 */
      int count = iupdrvListGetCount(ih);
        
      /* Copy the item to the idDrop position */
      if (idDrop >= 0 && idDrop < count) /* starts at 0 */
      {
        iupdrvListInsertItem(ih, idDrop, text);   /* starts at 0, insert before */
        if (idDrag > idDrop)
          idDrag++;
      }
      else  /* idDrop = -1 */
      {
        iupdrvListAppendItem(ih, text);
        idDrop = count;  /* new item is the previous count */
      }

      /* Selects the drop item */
      XmListSelectPos(ih->handle, idDrop+1, FALSE);    /* starts at 1 */
      iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", idDrop+1);  /* starts at 1 */

      /* Remove the Drag item if moving */
      if (!is_ctrl)
        iupdrvListRemoveItem(ih, idDrag);   /* starts at 0 */
    }
  }

  iupAttribSet(ih, "_IUPLIST_DROPITEM", NULL);

  (void)drop_context;
  (void)seltype;
  (void)format;
  (void)length;
}
Пример #11
0
void wxListBox::DoSetSelection(int N, bool select)
{
    m_inSetValue = true;
    if (select)
    {
#if 0
        if (m_windowStyle & wxLB_MULTIPLE)
        {
            int *selections = NULL;
            int n = GetSelections (&selections);

            // This hack is supposed to work, to make it possible
            // to select more than one item, but it DOESN'T under Motif 1.1.

            XtVaSetValues ((Widget) m_mainWidget,
                           XmNselectionPolicy, XmMULTIPLE_SELECT,
                           NULL);

            int i;
            for (i = 0; i < n; i++)
                XmListSelectPos ((Widget) m_mainWidget,
                                 selections[i] + 1, False);

            XmListSelectPos ((Widget) m_mainWidget, N + 1, False);

            XtVaSetValues ((Widget) m_mainWidget,
                           XmNselectionPolicy, XmEXTENDED_SELECT,
                           NULL);
        }
        else
#endif // 0
            XmListSelectPos ((Widget) m_mainWidget, N + 1, False);

    }
    else
        XmListDeselectPos ((Widget) m_mainWidget, N + 1);

    m_inSetValue = false;
}
Пример #12
0
/* Routine to set the default signal used by "Quick Kill", or
   Point and Kill. 
*/ 
void
popup_default_kill_dialog( Widget button, XtPointer client_data,
			   XtPointer call_data)
{
  Widget dialog_box, signal_list;
  int i;
  XmStringTable xmstr;
  
#include "help/kill_signal.h"

  /* Create the user name dialog */
  dialog_box = NewDialog(button, "set_kill_signal", "Set Kill Signal", 
			 True,  help_callback           , kill_signal_help,
			 True,  destroy_widget_callback , NULL,
			 True,  set_kill_signal_callback, &dialog_signal_pos);


  dialog_signal_pos = last_global_signal_pos;
  xmstr = ( XmString * ) XtMalloc (sizeof ( XmString ) * sigmap_elts ) ;

  /* Create list skipping over the 0th item -- no action. */
  for  ( i = 1; i < sigmap_elts; i++ ) {
    xmstr[i-1] = XmStringCreateLtoR ( signal_map[i].signal_name, 
				      XmFONTLIST_DEFAULT_TAG );
  }

  signal_list = XmCreateScrolledList( dialog_box, "signal_list", NULL, 0 );
  XtManageChild(signal_list);
  XtVaSetValues(signal_list, 
		 XmNitems, xmstr,
		 XmNitemCount, sigmap_elts-1,
		 XmNvisibleItemCount, 6, 
		 XmNselectionPolicy,   XmSINGLE_SELECT, 
		 NULL );

  for  ( i = 0; i < sigmap_elts-1; i++ ) {
    XmStringFree ( xmstr[i] );
  }
  XtFree((char *) xmstr);

  XtAddCallback( signal_list, XmNdefaultActionCallback, 
		 set_kill_signal_callback, &dialog_signal_pos);
  XtAddCallback( signal_list, XmNsingleSelectionCallback, 
		 SignalListCallback, &dialog_signal_pos);


  XmListSelectPos(signal_list, last_global_signal_pos+1, False);

  XtManageChild(dialog_box);
}
Пример #13
0
void ShowHelpDialog (Widget w, XtPointer cl_data, XtPointer ca_data)
{
    VStringConst topic = (VStringConst) cl_data;
    int i;

    /* Create the help dialog if it doesn't already exist: */
    if (! helpDialog) {
	CreateHelpDialog ();
	XmListSelectPos (helpTopics, 1, TRUE);
    }

    /* If a topic was specified, bring it into view: */
    if (topic) {
	for (i = 0; i < ntopics; i++)
	    if (strcmp (topic, topics[i].topic) == 0)
		break;
	if (i < ntopics)
	    XmListSelectPos (helpTopics, i + 1, TRUE);
    }

    /* Pop-up the help dialog: */
    XtManageChild (helpDialog);
    XRaiseWindow (myDisplay, XtWindow (helpDialog));
}
Пример #14
0
/*-------------------------------------------------------------------------*/
void qmonPopupCkptConfig(Widget w, XtPointer cld, XtPointer cad)
{
    Widget shell;
    lList *alp = NULL;

    DENTER(GUI_LAYER, "qmonPopupCkptConfig");

    /* set busy cursor */
    XmtDisplayBusyCursor(w);

    if (!qmon_ckpt) {
        shell = XmtGetTopLevelShell(w);
        qmon_ckpt = qmonCreateCkptConfig(shell);
        XmtAddDeleteCallback(shell, XmDO_NOTHING,
                             qmonPopdownCkptConfig, NULL);
        /*
        ** create ask layout
        */
        ckpt_ask_layout = qmonCreateCkptAsk(qmon_ckpt);

    }
    XSync(XtDisplay(qmon_ckpt), 0);
    XmUpdateDisplay(qmon_ckpt);

    qmonMirrorMultiAnswer(CKPT_T, &alp);
    if (alp) {
        qmonMessageBox(w, alp, 0);
        lFreeList(&alp);
        /* set default cursor */
        XmtDisplayDefaultCursor(w);
        DEXIT;
        return;
    }


    qmonTimerAddUpdateProc(CKPT_T, "updateCkptList", updateCkptList);
    qmonStartTimer(CKPT_T);
    updateCkptList();
    XmListSelectPos(ckpt_names, 1, True);

    XtManageChild(qmon_ckpt);
    XRaiseWindow(XtDisplay(XtParent(qmon_ckpt)), XtWindow(XtParent(qmon_ckpt)));

    /* set default cursor */
    XmtDisplayDefaultCursor(w);

    DEXIT;
}
Пример #15
0
static void motListDragMotionCallback(Widget drop_context, Ihandle *ih, XmDragMotionCallbackStruct* drag_motion)
{
  (void)drop_context;
  if (!iupAttribGet(ih, "NODRAGFEEDBACK"))
  {
    int idDrop;
    int x = drag_motion->x;
    int y = drag_motion->y;
    iupdrvScreenToClient(ih, &x, &y);
    
    idDrop = motListConvertXYToPos(ih, x, y);  /* starts at 1 */
    iupAttribSetInt(ih, "_IUPLIST_DROPITEM", idDrop);  /* starts at 1 */

    XmListSelectPos(ih->handle, idDrop, FALSE);  /* starts at 1 */
  }
}
Пример #16
0
static void all_pops_dialog(Widget w, KLUDGE *shit, XmAnyCallbackStruct *cb)
{
    int n = 0;
    Arg wargs[2];
    
    reset_pops_dialog(w, shit, cb);
    
    XtSetArg(wargs[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++;
    XtSetValues(shit->w, wargs, n);
    
    for (n=1; n<=shit->n; n++)
        XmListSelectPos(shit->w, n, (n == shit->n) ? True : False);
    
    n = 0;
    XtSetArg(wargs[n], XmNselectionPolicy, XmEXTENDED_SELECT); n++;
    XtSetValues(shit->w, wargs, n);
}
Пример #17
0
/***********************************************************************
 *                                                                     *
 *   Clear the selector columns.                                       *
 *                                                                     *
 ***********************************************************************/
void clear_selector_columns(int option)
{
   if (selector_dialog) {
      if (option == 0 || option == 1) {
         XmListSetPos(var1NtSList, 1);
         XmListDeselectAllItems(var1NtSList);
         XmListDeleteAllItems(var1NtSList);
         XmListSelectPos(var1NtSList, 1, False);
      }

      if (option == 0 || option == 2) {
         XmListSetPos(var2NtSList, 1);
         XmListDeselectAllItems(var2NtSList);
         XmListDeleteAllItems(var2NtSList);
      }
   }
}
Пример #18
0
/*-------------------------------------------------------------------------*/
static void qmonUsersetDelete(Widget w, XtPointer cld, XtPointer cad)
{
   lList *lp = NULL;
   lList *alp = NULL;
   Cardinal itemCount = 0;
   lEnumeration *what = NULL;
   Boolean answer;

   DENTER(GUI_LAYER, "qmonUsersetDelete");

   lp = XmStringToCull(userset_names, US_Type, US_name, SELECTED_ITEMS);
      
   if (lp) {
      XmtAskForBoolean(w, "xmtBooleanDialog", 
                  "@{userset.askdel.Do you really want to delete\nthe selected userset lists ?}", 
                  "@{Delete}", "@{Cancel}", NULL, XmtNoButton, XmDIALOG_WARNING, 
                  False, &answer, NULL);
         
      if (answer) { 
         what = lWhat("%T(ALL)", US_Type);
         alp = qmonDelList(SGE_US_LIST, 
                           qmonMirrorListRef(SGE_US_LIST),
                           US_name, &lp, NULL, what);

         qmonMessageBox(w, alp, 0);
         
         lFreeWhat(&what);
         lFreeList(&lp);
         lFreeList(&alp);

         updateUsersetList();
         XtVaGetValues( userset_names,
                        XmNitemCount, &itemCount,
                        NULL);
         if (itemCount)
            XmListSelectPos(userset_names, 1, True);
         else
            qmonUsersetFillConf(userset_names, NULL);
      }
   }
   DEXIT;

}
Пример #19
0
/*-------------------------------------------------------------------------*/
static void qmonCalendarDelete(Widget w, XtPointer cld, XtPointer cad)
{
   lList *lp = NULL;
   lList *alp = NULL;
   lEnumeration *what = NULL;
   Cardinal itemCount = 0;
   Boolean status, answer;

   DENTER(GUI_LAYER, "qmonCalendarDelete");
    
   lp = XmStringToCull(cal_names, CAL_Type, CAL_name, SELECTED_ITEMS); 

   if (lp) {
      status = XmtAskForBoolean(w, "xmtBooleanDialog", 
                     "@{calendar.askdel.Do you really want to delete the\nselected Calendar Configuration ?}",
                     "@{Delete}", "@{Cancel}", NULL, XmtNoButton, XmDIALOG_WARNING, 
                     False, &answer, NULL);
      if (answer) { 
         what = lWhat("%T(ALL)", CAL_Type);
         alp = qmonDelList(SGE_CAL_LIST, 
                           qmonMirrorListRef(SGE_CAL_LIST),
                                 CAL_name, &lp, NULL, what);

         qmonMessageBox(w, alp, 0);

         lFreeWhat(&what);
         lFreeList(&alp);

         updateCalendarList();
         XtVaGetValues( cal_names,
                        XmNitemCount, &itemCount,
                        NULL);
         if (itemCount) {
            XmListSelectPos(cal_names, 1, True);
         } else {
            qmonCalendarFillConf(cal_names, NULL);
         }   

      }
      lFreeList(&lp);
   }
   DEXIT;
}
Пример #20
0
/* We've just init'd a new history list widget; look at the window's
   history and load 'er up. */
static void mo_load_history_list (mo_window *win, Widget list)
{
  mo_node *node;
  
  for (node = win->history; node != NULL; node = node->next)
    {
      XmString xmstr = 
	XmxMakeXmstrFromString (get_pref_boolean(eDISPLAY_URLS_NOT_TITLES) ?
                                node->url : node->title);
      XmListAddItemUnselected 
        (list, xmstr, 0);
      XmStringFree (xmstr);
    }
  
  XmListSetBottomPos (list, 0);
  if (win->current_node)
    XmListSelectPos (win->history_list, win->current_node->position, False);

  return;
}
Пример #21
0
void AliasListUiItem::handleDeleteButtonPress()
{
  Widget list_widget = this->getWidget();
  int *p_list, p_count;

  // get the selected position
  if(XmListGetSelectedPos(list_widget,
			  &p_list,
			  &p_count))
    {
      
      if(deleted_items == NULL)
	{
	  deleted_items = new DtVirtArray<char *>(10);
	}	

      deleted_items->append(strdup((*list_items)[p_list[0] -1]->label));

      // delete the item from our list 
      this->list_items->remove(p_list[0] - 1); // remove only first

      // delete the item from the widget
      XmListDeletePos(list_widget, p_list[0]);

      XtVaSetValues(this->getKeyWidget(),
                        XmNvalue,"",
                        NULL);

      XtVaSetValues(this->getValueWidget(),
                        XmNvalue,"",
                        NULL);

      XmListSelectPos(list_widget,
		      p_list[0],
		      TRUE);

      props_changed = TRUE;
      
    }

}
Пример #22
0
static void 
wspAllWsCB(
        Widget buttonW,
        WmScreenData *pSD,
        XmToggleButtonCallbackStruct *xmTbcs )
{
    PtrWsPresenceData pPres = &pSD->presence;
    int wsnum;
    XmString *pxmsSelected;
    Arg args[5];
    int n;

    if (xmTbcs->reason == XmCR_VALUE_CHANGED)
    {
	if (xmTbcs->set)
	{
	    pxmsSelected = (XmString *)
		XtMalloc (pSD->numWorkspaces * sizeof (XmString));

	    for (wsnum = 0; wsnum < pSD->numWorkspaces; wsnum++)
	    {
		pxmsSelected[wsnum] = pPres->ItemStrings[wsnum];
	    }

	    /* set the selected items */
	    n = 0;
	    XtSetArg (args[n], XmNselectedItems, pxmsSelected);		n++;
	    XtSetArg (args[n], XmNselectedItemCount, pSD->numWorkspaces); n++;
	    XtSetValues (pPres->workspaceListW, args, n);

	    XtFree ((char *) pxmsSelected);
	}
	else
	{
	    /* select current workspace */
	    XmListDeselectAllItems (pPres->workspaceListW);
	    XmListSelectPos (pPres->workspaceListW, pPres->currentWsItem, TRUE);
	}
    }
} /* END OF FUNCTION   */
Пример #23
0
static void _UISymbolTextValueChangedCBK (Widget widget,Widget list,XmTextVerifyCallbackStruct *callData)

	{
	char *aString;
	UISymbol *editSymbol;
	int *itemPosList, itemPosCount;
	XmString xmString [1];

	if (callData->reason != XmCR_VALUE_CHANGED) return;
	if (!XmListGetSelectedPos (list,&itemPosList,&itemPosCount)) return;
	if (itemPosCount > 1) { XtFree ((char *) itemPosList); return; }

	XtVaGetValues (widget, XmNuserData,	&editSymbol, NULL);
	aString = XmTextFieldGetString (widget);
	editSymbol->Name (aString);
	xmString [0] = XmStringCreate (aString,UICharSetNormal);
	XtFree (aString);
	XmListReplaceItemsPos (list,xmString,itemPosCount,itemPosList [0]);
	XmListSelectPos (list,itemPosList [0],false);
	XmStringFree (xmString [0]);
	XtFree ((char *) itemPosList);
	}
Пример #24
0
static void
netlist_select (Widget w, void *v, XmListCallbackStruct * cbs)
{
  XmString str;
  int pos = cbs->item_position;
  LibraryMenuTypePtr net = & (PCB->NetlistLib.Menu[pos - 1]);
  char *name = net->Name;
  if (name[0] == ' ')
    {
      name[0] = '*';
      net->flag = 0;
    }
  else
    {
      name[0] = ' ';
      net->flag = 1;
    }

  str = XmStringCreatePCB (name);
  XmListReplaceItemsPos (netlist_list, &str, 1, pos);
  XmStringFree (str);
  XmListSelectPos (netlist_list, pos, False);
}
Пример #25
0
void polygonformpop()
{
  int ival, i, j;

   XmListDeselectAllItems(pmatsellist);

   for (j = 0; j < numlist; j++)
     {
      i = listmat[j];
      if (active_mat[i])
         XmListSelectPos(pmatsellist,j+1,FALSE);
     }

   ival = (int) (pexplodefact * 100.);
   XmScaleSetValue(pexplode,ival);
   XmToggleButtonGadgetSetState(pshade,polysflag,FALSE);
   XmToggleButtonGadgetSetState(pline,linesflag,FALSE);
   XmToggleButtonGadgetSetState(stipplebut,polystiplflag,FALSE);

   shadedraw = polysflag;
   linedraw = linesflag;

   MyManageChild(polygonform);
}
Пример #26
0
/*************************************<->*************************************
 *
 *  wspCreateWorkspaceList (mgrW, pPres, pSD)
 *
 *
 *  Description:
 *  -----------
 *  Creates a list widget containing all the workspaces defined for a 
 *  screen.
 *
 *  Inputs:
 *  ------
 *  mgrW = manager widget (parent of this child)
 *  pPres = pointer to presence data
 *  pSD = ptr to screen data
 * 
 *  Outputs:
 *  -------
 *  Return = widget created.
 *
 *  Comments:
 *  ---------
 ******************************<->***********************************/
static Widget 
wspCreateWorkspaceList(
        Widget mgrW,
        PtrWsPresenceData pPres,
        WmScreenData *pSD )
{
    Arg setArgs[20];
    int i;
    Widget listW;
    int numVisible;

#define MIN_VISIBLE	6

    /*
     * Create the array of strings that will go into the list.
     */
    if (((pPres->ItemStrings = (XmStringTable) XtMalloc 
		(pSD->numWorkspaces * sizeof(XmString *))) == NULL) ||
	((pPres->ItemSelected = (Boolean *) XtMalloc 
		(pSD->numWorkspaces * sizeof(Boolean))) == NULL))
    {
	Warning (((char *)GETMESSAGE(52, 5, "Insufficient memory to create Occupy Workspace dialog.")));
	return (NULL);
    }

    pPres->numWorkspaces = pSD->numWorkspaces;

    for (i = 0; i < pSD->numWorkspaces; i++)
    {
	pPres->ItemStrings[i] = XmStringCopy (pSD->pWS[i].title);

	if (pSD->pWS[i].id == pSD->pActiveWS->id)
	{
	    pPres->currentWsItem = 1+i;
	}
    }


    /* 
     * Create the widget
     */
    i = 0;

    XtSetArg (setArgs[i], XmNitemCount, pSD->numWorkspaces);	i++;

    XtSetArg (setArgs[i], XmNitems, pPres->ItemStrings);	i++;

    XtSetArg (setArgs[i], XmNselectionPolicy, XmEXTENDED_SELECT); i++;

    XtSetArg (setArgs[i], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); i++;

    listW = XmCreateScrolledList (mgrW, "list", setArgs, i);
    XtManageChild (listW);

    if (pPres->pCDforClient)
    {
	/*
	 * Highlight the workspaces this client resides in
	 */
	for (i = 0; i < pPres->pCDforClient->pSD->numWorkspaces; i++)
	{
	    if (ClientInWorkspace (&pPres->pCDforClient->pSD->pWS[i], 
					pPres->pCDforClient))
	    {
		XmListSelectPos (listW, i+1, TRUE);
		pPres->ItemSelected[i] = True;
	    }
	    else
	    {
		pPres->ItemSelected[i] = False;
	    }
	}
    }

    /*
     * Insure a minimum number are visible.
     */
    i = 0;
    XtSetArg (setArgs[i], XmNvisibleItemCount, &numVisible);	i++;
    XtGetValues (listW, setArgs, i);

    if (numVisible < MIN_VISIBLE)
    {
	i = 0;
	XtSetArg (setArgs[i], XmNvisibleItemCount, MIN_VISIBLE);i++;
	XtSetValues (listW, setArgs, i);
    }

    XtAddCallback (listW, XmNextendedSelectionCallback,
		(XtCallbackProc) wspExtendedSelectCB, (XtPointer)pSD);
    /* Handle the double-click just like if the Ok button was pressed */
    XtAddCallback (listW, XmNdefaultActionCallback,
		(XtCallbackProc) wspOkCB, (XtPointer)pSD); 


    return (listW);
} /* END OF FUNCTION   */
Пример #27
0
void
UpdatePresenceWorkspaces(
        WmScreenData *pSD )
{
    PtrWsPresenceData pPres = &pSD->presence;
    int wsnum;
    XmString xmsTmp;

    if (pPres->shellW)
    {
	if (pPres->numWorkspaces < pSD->numWorkspaces)
	{
	    if (((pPres->ItemStrings = (XmStringTable) XtRealloc 
		    ((char *)pPres->ItemStrings,
		    (pSD->numWorkspaces * sizeof(XmString *)))) == NULL) ||
		((pPres->ItemSelected = (Boolean *) XtRealloc 
		    ((char *)pPres->ItemSelected,
		    (pSD->numWorkspaces * sizeof(Boolean)))) == NULL))
	    {
		Warning (((char *)GETMESSAGE(52, 5, "Insufficient memory to create Occupy Workspace dialog.")));
		pPres->shellW = NULL;
		return;
	    }
	}

	/*
	 * Replace the names in the dialog's list
	 */
	for (wsnum = 0; wsnum < pPres->numWorkspaces; wsnum++)
	{
	    if (wsnum < pSD->numWorkspaces)
	    {
		xmsTmp = XmStringCopy (pSD->pWS[wsnum].title);

		if (!XmStringCompare (xmsTmp, pPres->ItemStrings[wsnum]))
		{
		    /* 
		     * Replace the string in our local list
		     */
		    XmStringFree (pPres->ItemStrings[wsnum]);
		    pPres->ItemStrings[wsnum] = xmsTmp;

		    /* 
		     * Replace the item in the scrolled list.
		     */
		    XmListDeletePos (pPres->workspaceListW, 1+wsnum);
		    XmListAddItem (pPres->workspaceListW, xmsTmp, 1+wsnum);
		}
		else
		{
		    XmStringFree (xmsTmp);
		}
	    }
	    else
	    {
		/*
		 * Delete this workspace from the list
		 */
		XmStringFree (pPres->ItemStrings[wsnum]);
		pPres->ItemStrings[wsnum] = NULL;
		XmListDeletePos (pPres->workspaceListW, 1+wsnum);
	    }
	}
	for (; wsnum < pSD->numWorkspaces; wsnum++)
	{
	    /*
	     * Add these workspaces to the list.
	     */
	    xmsTmp = XmStringCopy (pSD->pWS[wsnum].title);
	    pPres->ItemStrings[wsnum] = xmsTmp;
	    XmListAddItem (pPres->workspaceListW, xmsTmp, 1+wsnum);

	    if (pPres->pCDforClient && 
	        (ClientInWorkspace (&pPres->pCDforClient->pSD->pWS[wsnum], 
					pPres->pCDforClient)))
	    {
		XmListSelectPos (pPres->workspaceListW, 1+wsnum, TRUE);
		pPres->ItemSelected[wsnum] = True;
	    }
	    else
	    {
		pPres->ItemSelected[wsnum] = False;
	    }
	}

	pPres->numWorkspaces = pSD->numWorkspaces;
    }

} /* END OF FUNCTION UpdatePresenceWorkspaces */
Пример #28
0
void ui_show_lightspanel()
{
  set_light(light_count() > 0 ? 1 : 0);
  XmListSelectPos(lightslist, uistate.current_light + 1, False);
}
Пример #29
0
static int motListSetValueAttrib(Ihandle* ih, const char* value)
{
  if (ih->data->has_editbox)
  {
    Widget cbedit;
    XtVaGetValues(ih->handle, XmNtextField, &cbedit, NULL);
    if (!value) value = "";

    iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", "1"); /* disable callbacks */

    iupmotTextSetString(cbedit, value);

    iupAttribSet(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
  }
  else 
  {
    if (ih->data->is_dropdown)
    {
      int pos;
      if (iupStrToInt(value, &pos)==1)
      {
        XtRemoveCallback(ih->handle, XmNselectionCallback, (XtCallbackProc)motListComboBoxSelectionCallback, (XtPointer)ih);

        XtVaSetValues(ih->handle, XmNselectedPosition, pos-1, NULL);  /* IUP starts at 1 */
        iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", pos);

        XtAddCallback(ih->handle, XmNselectionCallback, (XtCallbackProc)motListComboBoxSelectionCallback, (XtPointer)ih);
      }
    }
    else
    {
      if (!ih->data->is_multiple)
      {
        int pos;
        if (iupStrToInt(value, &pos)==1)
        {
          XmListSelectPos(ih->handle, pos, FALSE);   /* XmListSelectPos starts at 1 */
          iupAttribSetInt(ih, "_IUPLIST_OLDVALUE", pos);
        }
        else
        {
          XmListDeselectAllItems(ih->handle);
          iupAttribSet(ih, "_IUPLIST_OLDVALUE", NULL);
        }
      }
      else
      {
        /* User has changed a multiple selection on a simple list. */
	      int i, count, len;

        /* Clear all selections */
        XmListDeselectAllItems(ih->handle);

        if (!value)
        {
          iupAttribSet(ih, "_IUPLIST_OLDVALUE", NULL);
          return 0;
        }

        XtVaGetValues(ih->handle, XmNitemCount, &count, NULL);
        len = strlen(value);
        if (len < count) 
          count = len;

        XtVaSetValues(ih->handle, XmNselectionPolicy, XmMULTIPLE_SELECT, NULL);

        /* update selection list */
        for (i = 0; i<count; i++)
        {
          if (value[i]=='+')
            XmListSelectPos(ih->handle, i+1, False);  /* XmListSelectPos starts at 1 */
        }

        XtVaSetValues(ih->handle, XmNselectionPolicy, XmEXTENDED_SELECT, 
                                  XmNselectionMode, XmNORMAL_MODE, NULL);  /* must also restore this */
        iupAttribSetStr(ih, "_IUPLIST_OLDVALUE", value);
      }
    }
  }

  return 0;
}
Пример #30
0
/***********************************************************************
 *                                                                     *
 *   Show (manage) the column selector dialog.                         *
 *                                                                     *
 ***********************************************************************/
void show_columnSelector(Widget w, XtPointer cd,
                         XmAnyCallbackStruct *call_data)
{
   MenuCbStruct   *scan_button;
   int             icnt;
   XmString       *items;

   if (!selector_dialog) {
      selector_dialog = create_columnSelection(w);

      /*
       *   Install callbacks
       */
      scan_button = make_menuStruct(w, selector_dialog);
      InstallMwmCloseCallback(XtParent(selector_dialog),
                              (XtCallbackProc)cancel_cb,
                              (XtPointer)scan_button);

      /*
       *   Install event handler on EnterNotify events
       */
      XtAddEventHandler(XtParent(selector_dialog), EnterWindowMask, False,
                        (XtEventHandler)enter_ntuple_viewer, NULL);

      XtAddCallback(exprNtSText, XmNactivateCallback,
                    (XtCallbackProc)copy_cb, NULL);
      XtAddCallback(copyNtSButton, XmNactivateCallback,
                    (XtCallbackProc)copy_cb, NULL);
      XtAddCallback(copyAllNtSButton, XmNactivateCallback,
                    (XtCallbackProc)copy_cb, NULL);
      XtAddCallback(var1NtSList, XmNdefaultActionCallback,
                    (XtCallbackProc)copy_cb, NULL);
      XtAddCallback(scanNtSButton, XmNactivateCallback,
                    (XtCallbackProc)show_ntupleScanner, NULL);
      XtAddCallback(deleteNtSButton, XmNactivateCallback,
                    (XtCallbackProc)reset_cb, NULL);
      XtAddCallback(resetNtSButton, XmNactivateCallback,
                    (XtCallbackProc)reset_cb, NULL);
      XtAddCallback(cancelNtSButton, XmNactivateCallback,
                    (XtCallbackProc)cancel_cb, scan_button);

      /* store MenuCbSruct in userData */
      XtVaSetValues(selector_dialog, XmNuserData, scan_button, NULL);
   }

   /* clear left list */
   XmListSetPos(var1NtSList, 1);
   XmListDeselectAllItems(var1NtSList);
   XmListDeleteAllItems(var1NtSList);

   /*
    * Copy var list from ntupleBrowser to left list of columnSelection
    * dialog. In case there are no variables in the ntupleBrowser return.
    */
   XtVaGetValues(varNtList, XmNitemCount, &icnt,
                            XmNitems,     &items, NULL);
   if (!icnt) return;

   XmListAddItems(var1NtSList, items, icnt, 1);
   XmListSelectPos(var1NtSList, 1, False);

   /* Make scan button on ntupleBrowser insensitive and popup dialog */
   XtSetSensitive(w, False);
   XtManageChild(selector_dialog);
}