예제 #1
0
void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
{
    HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST);
    ListBox_ResetContent(hList);

    //
    // If we don't have a valid material, we should be disabled
    //
    Mtl* mtl = pb->GetMtl(kMtlMtl);
    if (!mtl)
    {
        EnableWindow(hList, FALSE);
        return;
    }
    else
        EnableWindow(hList, TRUE);

    //
    // Load the events
    //
    int idx;

    idx = ListBox_AddStringData(hList, "(Begin)", kAnimEventBegin);
    if (pb->GetInt(kMtlBegin))
        ListBox_SetSel(hList, TRUE, idx);

    idx = ListBox_AddStringData(hList, "(End)", kAnimEventEnd);
    if (pb->GetInt(kMtlEnd))
        ListBox_SetSel(hList, TRUE, idx);

    if (mtl)
    {
        ST::string mtlAnim = ST::string::from_utf8(pb->GetStr(kMtlAnim));

        // Get the shared animations for all the nodes this component is applied to
        plNotetrackAnim anim(mtl, nil);
        plAnimInfo info = anim.GetAnimInfo(mtlAnim);

        RemoveDeadMarkers(pb, kMtlMarkers, info);

        // Get all the markers in this animation
        ST::string marker;
        while (!(marker = info.GetNextMarkerName()).is_empty())
        {
            idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker);

            if (IsMarkerSelected(pb, kMtlMarkers, marker))
                ListBox_SetSel(hList, TRUE, idx);
        }
    }
}
예제 #2
0
void plAnimEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
{
    HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST);
    ListBox_ResetContent(hList);

    plAnimComponentBase* comp;
    plMaxNode* node;

    //
    // If we don't have a valid comp and node, we should be disabled
    //
    if (!GetCompAndNode(pb, (plComponentBase*&)comp, node))
    {
        EnableWindow(hList, FALSE);
        return;
    }
    else
        EnableWindow(hList, TRUE);

    //
    // Load the events
    //
    int idx;

    idx = ListBox_AddStringData(hList, "(Begin)", kAnimEventBegin);
    if (pb->GetInt(kAnimBegin))
        ListBox_SetSel(hList, TRUE, idx);

    idx = ListBox_AddStringData(hList, "(End)", kAnimEventEnd);
    if (pb->GetInt(kAnimEnd))
        ListBox_SetSel(hList, TRUE, idx);

    if (comp)
    {
        // Get the shared animations for all the nodes this component is applied to
        plNotetrackAnim anim(comp, nil);
        plAnimInfo info = anim.GetAnimInfo(comp->GetAnimName());

        RemoveDeadMarkers(pb, kAnimMarkers, info);

        // Get all the markers in this animation
        ST::string marker;
        while (!(marker = info.GetNextMarkerName()).is_empty())
        {
            idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker);

            if (IsMarkerSelected(pb, kAnimMarkers, marker))
                ListBox_SetSel(hList, TRUE, idx);
        }
    }
}
예제 #3
0
파일: outbask.c 프로젝트: cixonline/ameol
/* This function removes an item from the outbasket.
 */
void FASTCALL DeleteFromOutBasket( LPOB lpob )
{
   /* Now closes down the window if there is one
    * YH 03/05/96
    */
   HWND hwndSay;

   if( hwndSay = Amob_GetEditWindow( lpob ) )
      SendDlgCommand( hwndSay, IDCANCEL, BN_CLICKED );
   if( NULL != hwndOutBasket && !fIgnoreDeleteEvent )
      {
      HWND hwndList;

      hwndList = GetDlgItem( hwndOutBasket, IDD_LIST );
      if( hwndList )
         {
         int wCount;
         int nSel;

         wCount = ListBox_GetCount( hwndList );
         for( nSel = 0; nSel < wCount; ++nSel )
            if( (LPOB)ListBox_GetItemData( hwndList, nSel ) == lpob )
               {
               if( ListBox_DeleteString( hwndList, nSel ) == nSel )
                  --nSel;
               if( ListBox_GetSelCount( hwndList ) == 0 )
                  ListBox_SetSel( hwndList, TRUE, nSel );
               break;
               }
         }
      UpdateOutBasketStatus();
      }
}
예제 #4
0
/* 
 * LookListSetContents: Set contents & highlight of list box in Look dialog.
 */
void LookListSetContents(HWND hwndListBox, list_type contents, int flags)
{
   list_type l;
   object_node *obj;
   
   WindowBeginUpdate(hwndListBox);
   ListBox_ResetContent(hwndListBox);
   
   /* Fill in list box with stuff from passed-in list */
   for (l = contents; l != NULL; l = l->next)
   {
      /* We need to make a copy of this object, because the original object
         might be freed by the game before this dialog ends */
      obj = ObjectCopy((object_node *) (l->data));
      ItemListAddItem(hwndListBox, obj, -1, !(flags & LD_AMOUNTS));  /* Add to end */
   }
   WindowEndUpdate(hwndListBox);
   
   /* In single selection box, make 1st item default.  In multiple selection,
    * only highlight 1st item if there is just 1 item AND item doesn't need an amount */
   if ((flags & LD_MULTIPLESEL) && contents->next == NULL)
   {
      obj = (object_node *) contents->data;
      if (!(info->flags & LD_AMOUNTS) || !IsNumberObj(obj->id))
      {
         ListBox_SetSel(hwndListBox, TRUE, 0);
         info->selected[0] = True;
      }
   }
   else ListBox_SetCurSel(hwndListBox, 0); 
}
예제 #5
0
/*
 * LookSelChange:  We received a LBN_SELCHANGE message for the list box; see
 *   if a number item is being selected, and thus we should prompt for an amount.
 */
void LookSelChange(HWND hList)
{
   int i, count;
   Bool selected;
   
   count = ListBox_GetCount(hList);
   for (i=0; i < count; i++)
   {
      selected = (ListBox_GetSel(hList, i) > 0);
      
      if (info->flags & LD_AMOUNTS && !info->selected[i] && selected)
      {
         // Selecting item
         if (!GetAmountListBox(hList, i))
         {
            ListBox_SetSel(hList, FALSE, i);
            info->selected[i] = False;
            continue;
         }
      }
      
      info->selected[i] = selected;
   }
   
}
예제 #6
0
파일: pcp_listbox.c 프로젝트: now/slackedit
void ListBox_MoveAllStrings(HWND hwndListBox, int iAmount)
{
    int iCount = ListBox_GetSelCount(hwndListBox), i;
    LPINT lpiItems = (LPINT)Mem_Alloc(iCount * sizeof(INT));

    SetWindowRedraw(hwndListBox, FALSE);

    ListBox_GetSelItems(hwndListBox, iCount, lpiItems);

    if (iAmount < 0)
    {
        for (i = 0; i < iCount; i++)
        {
            int nIndex = ListBox_MoveString(hwndListBox, lpiItems[i], iAmount, TRUE);
            ASSERT(nIndex != LB_ERR);
        }
    }
    else
    {
        for (i = (iCount - 1); i > -1; i--)
        {
            int nIndex = ListBox_MoveString(hwndListBox, lpiItems[i], iAmount, TRUE);
            ASSERT(nIndex != LB_ERR);
        }
    }

    // Reselect all the items moved
    for (i = 0; i < iCount; i++)
        ListBox_SetSel(hwndListBox, TRUE, lpiItems[i] + iAmount);

    SetWindowRedraw(hwndListBox, TRUE);
    RedrawWindow(hwndListBox, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);

    Mem_Free(lpiItems);
}
예제 #7
0
LOCAL void DragEnd(HWND hWindow)
/***********************************************************************/
{
// get the listbox data pointer, if we don't have one, get out
LPLISTBOXDATA lpData = ListBox_GetData(hWindow);
if (!lpData)
	return;

// see if we ever started dragging
if (lpData->fDragging)
	{
	// if we had a cursor, reset it
	if (lpData->hCursor)
		SetCursor(lpData->hOldCursor);
    // do the move if we successfully dragged
    if (lpData->fSuccess) 
    	{
        int nItem, iTopItem;       
        TCHAR szString[256];  
        
		// save the top index, so we can reset it
		iTopItem = ListBox_GetTopIndex(hWindow);
        // turn of painting while working with list
		SetWindowRedraw(hWindow, FALSE);
        // save text of item
		ListBox_GetText(hWindow, lpData->iOldPos, szString);
        
        // delete the item
		ListBox_DeleteString(hWindow, lpData->iOldPos);
             
		// adjust index because of DeleteString
		int iNewPos = lpData->iNewPos;
        if (iNewPos > lpData->iOldPos)
        	iNewPos--;
      	// add the new string at the right spot                       
		nItem = ListBox_InsertString(hWindow, iNewPos, szString);

		// select the item we moved
		DWORD dwStyle = GetWindowLong(hWindow, GWL_STYLE);
		if (dwStyle & (LBS_MULTIPLESEL, LBS_EXTENDEDSEL))
	        ListBox_SetSel(hWindow, TRUE, nItem);
		else
	        ListBox_SetCurSel(hWindow, nItem);

		// reset the top index
		ListBox_SetTopIndex(hWindow, iTopItem);
		// turn drawing back on
		SetWindowRedraw(hWindow, TRUE);
		// inform the dialog of the move
		FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow),
							hWindow, LBN_MOVEITEM, SendMessage);
       	}
   	}
// turn off dragging
lpData->fDragging = FALSE;    
KillTimer(hWindow, lpData->idTimer);    
}
예제 #8
0
파일: outbask.c 프로젝트: cixonline/ameol
/* This function simply inserts the pointer to the out-basket object into the
 * list box for the out-basket then updates the total of out-basket items. It
 * does not check to ascertain whether the object already appears in the list,
 * so this function should only be called for new out-basket items.
 */
void FASTCALL AddStringToOutBasket( HWND hwnd, LPOB lpob )
{
   HWND hwndList;

   hwndList = GetDlgItem( hwnd, IDD_LIST );
   if( hwndList )
      {
      ListBox_InsertString( hwndList, -1, lpob );
      if( ListBox_GetSelCount( hwndList ) == 0 )
         ListBox_SetSel( hwndList, TRUE, 0 );
      ShowOutBasketTotal( hwnd );
      }
}
예제 #9
0
파일: pcp_listbox.c 프로젝트: now/slackedit
int ListBox_MoveStringUp(HWND hwndList, int nIndex)
{
    int nNewIndex;

    SetWindowRedraw(hwndList, FALSE);
    nNewIndex = ListBox_MoveString(hwndList, nIndex, -1, TRUE);
    ASSERT(nNewIndex != LB_ERR);
    if (ListBox_SetSel(hwndList, TRUE, nNewIndex) == LB_ERR)
    {
        // Try and use ListBox_SetCurSel() (for single selection listbox)
        ListBox_SetCurSel(hwndList, nNewIndex);
    }
    SetWindowRedraw(hwndList, TRUE);
    RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);

    return (nNewIndex);
}
예제 #10
0
파일: outbask.c 프로젝트: cixonline/ameol
/* This function processes the WM_COMMAND message.
 */
void FASTCALL OutBasket_OnCommand( HWND hwnd, int id, HWND hwndCtl, UINT codeNotify )
{
   switch( id )
      {
      case IDM_QUICKPRINT:
      case IDM_PRINT:
         CmdPrintOutbasket( hwnd );
         break;

      case IDD_HELP:
         HtmlHelp( hwnd, szHelpFile, HH_HELP_CONTEXT, idsOUTBASKET );
         break;

      case IDCANCEL:
         SendMessage( hwnd, WM_CLOSE, 0, 0L );
         break;

      case IDD_DELETE: {
         HWND hwndList;

         hwndList = GetDlgItem( hwnd, IDD_LIST );
         if( IsWindowEnabled( GetDlgItem( hwnd, id ) ) )
            if( fMessageBox( hwnd, 0, GS(IDS_STR253), MB_YESNO|MB_ICONINFORMATION ) == IDYES )
               {
               int cDeleted;
               int nCount;
               int nSel;
               int c;

               /* Set fIgnoreDeleteEvent because we could be
                * deleting lots of items, and we don't want each
                * deletion from the out-basket to be individual.
                */
               nCount = ListBox_GetCount( hwndList );
               SetWindowRedraw( hwndList, FALSE );
               cDeleted = c = 0;
               nSel = -1;
               fIgnoreDeleteEvent = TRUE;
               while( c < nCount )
                  {
                  if( ListBox_GetSel( hwndList, c ) > 0 )
                     {
                     OBINFO obinfo;
                     LPOB lpob;
         
                     lpob = (LPOB)ListBox_GetItemData( hwndList, c );
                     Amob_GetObInfo( lpob, &obinfo );
                     if( !( obinfo.obHdr.wFlags & OBF_ACTIVE ) && !( obinfo.obHdr.wFlags & OBF_PENDING ) )
                        {
                        ListBox_DeleteString( hwndList, c );
                        nSel = c;
                        Amob_RemoveObject( lpob, FALSE );
                        ++cDeleted;
                        --nCount;
                        }
                     else
                        ++c;
                     }
                  else
                      ++c;
                  }
               if( nSel >= nCount )
                  nSel = nCount - 1;
               SetWindowRedraw( hwndList, TRUE );
               if( cDeleted )
                  {
                  InvalidateRect( hwndList, NULL, TRUE );
                  UpdateWindow( hwndList );
                  if( nSel > -1 )
                     ListBox_SetSel( hwndList, TRUE, nSel );
                  Amob_SaveOutBasket( FALSE );
                  UpdateOutBasketStatus();
                  ShowOutBasketTotal( hwndOutBasket );
                  }
               fIgnoreDeleteEvent = FALSE;
               OutBasket_OnSetFocus( hwnd, NULL );
               }
         SetFocus( hwndList );
         break;
         }

      case IDD_HOLD: {
         HWND hwndList;
         int nCount;
         BOOL fFirst;
         BOOL fHold;
         int c;

         hwndList = GetDlgItem( hwnd, IDD_LIST );
         nCount = ListBox_GetCount( hwndList );
         fFirst = TRUE;                        
         fHold = FALSE;
         for( c = 0; c < nCount; ++c )
            if( ListBox_GetSel( hwndList, c ) )
               {
               OBINFO obinfo;
               LPOB lpob;
               RECT rc;

               lpob = (LPOB)ListBox_GetItemData( hwndList, c );
               Amob_GetObInfo( lpob, &obinfo );
               if( !( obinfo.obHdr.wFlags & OBF_ACTIVE ) && !( obinfo.obHdr.wFlags & OBF_PENDING ) )
                  {
                  if( fFirst )
                     {
                     if( obinfo.obHdr.wFlags & OBF_HOLD )
                        {
                        SetWindowText( GetDlgItem( hwnd, IDD_HOLD ), GS(IDS_STR281) );
                        fHold = FALSE;
                        }
                     else
                        {
                        SetWindowText( GetDlgItem( hwnd, IDD_HOLD ), GS(IDS_STR282) );
                        fHold = TRUE;
                        }
                     fFirst = FALSE;
                     }
                  obinfo.obHdr.wFlags &= ~OBF_ERROR;
                  if( fHold )
                     obinfo.obHdr.wFlags |= OBF_HOLD;
                  else
                     obinfo.obHdr.wFlags &= ~OBF_HOLD;
                  Amob_SetObInfo( lpob, &obinfo );
                  ListBox_GetItemRect( hwndList, c, &rc );
                  if( !IsRectEmpty( &rc ) )
                     InvalidateRect( hwndList, &rc, FALSE );
                  }
               }
         // !!SM!! 2.55.2035
         Amob_SaveOutBasket( FALSE );
         UpdateOutBasketStatus();
         ShowOutBasketTotal( hwndOutBasket );
         // !!SM!! 2.55.2035

         UpdateWindow( hwndList );
         SetFocus( hwndList );
         break;
         }

      case IDD_KEEP: {
         HWND hwndList;
         int nCount;
         BOOL fFirst;
         BOOL fKeep;
         int c;

         hwndList = GetDlgItem( hwnd, IDD_LIST );
         nCount = ListBox_GetCount( hwndList );
         fFirst = TRUE;
         fKeep = FALSE;
         for( c = 0; c < nCount; ++c )
            {
            if( ListBox_GetSel( hwndList, c ) )
               {
               OBINFO obinfo;
               LPOB lpob;
               RECT rc;

               lpob = (LPOB)ListBox_GetItemData( hwndList, c );
               Amob_GetObInfo( lpob, &obinfo );
               if( fFirst )
                  {
                  if( obinfo.obHdr.wFlags & OBF_KEEP )
                     {
                     fKeep = FALSE;
                     SetWindowText( GetDlgItem( hwnd, IDD_KEEP ), GS(IDS_STR319) );
                     }
                  else
                     {
                     fKeep = TRUE;
                     SetWindowText( GetDlgItem( hwnd, IDD_KEEP ), GS(IDS_STR318) );
                     }
                  fFirst = FALSE;
                  }
               obinfo.obHdr.wFlags &= ~OBF_ERROR;
               if( fKeep )
                  obinfo.obHdr.wFlags |= OBF_KEEP;
               else
                  obinfo.obHdr.wFlags &= ~OBF_KEEP;
               Amob_SetObInfo( lpob, &obinfo );
               ListBox_GetItemRect( hwndList, c, &rc );
               if( !IsRectEmpty( &rc ) )
                  InvalidateRect( hwndList, &rc, FALSE );
               }
            }
         // !!SM!! 2.55.2035
         Amob_SaveOutBasket( FALSE );
         UpdateOutBasketStatus();
         ShowOutBasketTotal( hwndOutBasket );
         // !!SM!! 2.55.2035

         UpdateWindow( hwndList );
         SetFocus( hwndList );
         break;
         }

      case IDD_LIST:
         if( codeNotify == LBN_SELCHANGE )
            {
            UpdateOutBasketStatus();
            break;
            }
         else if( codeNotify != LBN_DBLCLK )
            break;
         if( !IsWindowEnabled( GetDlgItem( hwnd, IDOK ) ) )
            break;

      case IDOK: {
         HWND hwndList;
         int nCount;
         int c;

         hwndList = GetDlgItem( hwnd, IDD_LIST );
         nCount = ListBox_GetCount( hwndList );
         for( c = 0; c < nCount; ++c )
            if( ListBox_GetSel( hwndList, c ) > 0 )
               {
               OBINFO obinfo;
               LPOB lpob;

               lpob = (LPOB)ListBox_GetItemData( hwndList, c );
               Amob_GetObInfo( lpob, &obinfo );
               if( Amob_IsEditable( obinfo.obHdr.clsid ) && !( obinfo.obHdr.wFlags & OBF_ACTIVE ) && !( obinfo.obHdr.wFlags & OBF_PENDING ) )
                  Amob_Edit( lpob );
               }
         break;
         }
      }
}
예제 #11
0
void ListBox::ClearSelection()
{
    vector<int> selection = GetSelectedItemsIndex();
    for (unsigned int i = 0; i < selection.size(); i++)
        ListBox_SetSel(ThisWindow, FALSE, selection[i]);
}
예제 #12
0
/*
 * LookCommand:  Handle WM_COMMAND messages.
 */ 
void LookCommand(HWND hDlg, int ctrl_id, HWND hwndCtl, UINT codeNotify) 
{
   int index, num_entries, i, amount, currentAmount;
   list_type selection;
   object_node *obj;
   char buf[MAXNAME + 1], temp[16];

   switch(ctrl_id)
   {
   case IDC_ITEMFIND:
      if (codeNotify == EN_UPDATE)
      {
	 /* Go to object in list that user has named */
	 Edit_GetText(info->hwndFind, buf, MAXNAME);
	 index = ListBox_FindString(info->hwndListBox, -1, buf);

	 if (index != LB_ERR)
	    if (info->flags & LD_MULTIPLESEL)
	       ListBox_SetCaretIndex(info->hwndListBox, index);
	    else ListBox_SetCurSel(info->hwndListBox, index);
      }
      break;

   case IDC_ALL:
      /* In multiple selection box only, select all objects.  If we require that
       * user give amounts, don't select amount objects */
      num_entries = ListBox_GetCount(info->hwndListBox);

      ListBox_SetSel(info->hwndListBox, TRUE, -1);

      WindowBeginUpdate(info->hwndQuanList);
      // Select all for number items
      for (i=0; i < num_entries; i++)
      {
	 info->selected[i] = True;
	 obj = (object_node *) ListBox_GetItemData(info->hwndListBox, i);
	 if (IsNumberObj(obj->id))
	    amount = obj->amount;
	 else
	    amount = 1;
	 obj->temp_amount = amount;
	 ListBox_DeleteString(info->hwndQuanList,i);
	 sprintf(temp, "%d", amount);
	 ListBox_InsertString(info->hwndQuanList,i,temp);
	 ListBox_SetItemData(info->hwndQuanList,i,amount);
      }
      WindowEndUpdate(info->hwndQuanList);
      break;

   case IDC_ITEMLIST:
      switch (codeNotify)
      {
      case LBN_DBLCLK:
	 /* Look at item */
	 index = ListBox_GetCaretIndex(info->hwndListBox);
	 if (index != LB_ERR)
	 {
	    obj = (object_node *) ListBox_GetItemData(info->hwndListBox, index);
	    RequestLook(obj->id);
	    SetDescParams(hDlg, DESC_NONE);
	    ListBox_SetSel(info->hwndListBox, FALSE, index);
	    info->selected[index] = False;
	 }
	 break;

      case LBN_SELCHANGE:
#if 0
	 LookSelChange(hwndCtl);
#else
	 index = ListBox_GetCurSel(info->hwndListBox);
	 obj = (object_node *) ListBox_GetItemData(info->hwndListBox, index);
	 WindowBeginUpdate(info->hwndQuanList);
	 ListBox_DeleteString(info->hwndQuanList,index);
	 if (ListBox_GetSel(info->hwndListBox,index))
	 {
	    if (IsNumberObj(obj->id))
	       amount = obj->amount;
	    else
	       amount = 1;
	    sprintf(temp, "%d", amount);
	 }
	 else
	 {
	    amount = 0;
	    strcpy(temp," ");
	 }
	 ListBox_InsertString(info->hwndQuanList,index,temp);
	 ListBox_SetItemData(info->hwndQuanList,index,amount);
	 ListBox_SetSel(info->hwndListBox,amount > 0,index);
	 info->selected[index] = (amount > 0);
	 obj->temp_amount = amount;
	 ListBox_SetSel(info->hwndQuanList,FALSE,index);
	 WindowEndUpdate(info->hwndQuanList);

#endif
	 break;
      }
      break;

   case IDC_QUANLIST:
      if (codeNotify == LBN_SELCHANGE)
      {
	 char temp[16];
	 index = (int)ListBox_GetCurSel(info->hwndQuanList);
	 obj = (object_node *) ListBox_GetItemData(info->hwndListBox, index);
	 currentAmount = (int)ListBox_GetItemData(info->hwndQuanList, index);
	 amount = currentAmount;
	 if (ListBox_GetItemData(info->hwndQuanList, index) > 0)
	 {
	    if (IsNumberObj(obj->id))
	    {
	       MEASUREITEMSTRUCT m;
	       int startAmount = currentAmount;
	       if (currentAmount == 0)
		  startAmount = obj->amount;
	       /* Place amount dialog just beneath selected item */
	       ItemListMeasureItem(info->hwndQuanList, &m);
	       // Force highlight on (we are editing it)
	       ListBox_SetSel(info->hwndListBox,TRUE,index);
	       if(InputNumber(hDlg,info->hwndQuanList,
		  0,(index - ListBox_GetTopIndex(info->hwndQuanList) + 1) * (m.itemHeight - 1),
		  &amount,startAmount,1,obj->amount))
	       {
		  ListBox_DeleteString(info->hwndQuanList,index);
		  if (amount > 0)
		  {
		     sprintf(temp, "%d", amount);
		     ListBox_InsertString(info->hwndQuanList, index, temp);
		  }
		  else
		  {
		     ListBox_InsertString(info->hwndQuanList,index," ");
		  }
		  ListBox_SetItemData(info->hwndQuanList, index, amount);
	       }
	       else
		  amount = currentAmount;
	       // reset highlight based on quantity - off if zero, on otherwise
	       ListBox_SetSel(info->hwndListBox,
		  (ListBox_GetItemData(info->hwndQuanList,index) > 0),
		  index);
	    }
	    else
	    {
	       ListBox_DeleteString(info->hwndQuanList,index);
	       if (currentAmount == 0)
	       {
		  amount = 1;
		  strcpy(temp,"1");
	       }
	       else
	       {
		  amount = 0;
		  strcpy(temp," ");
	       }
	       ListBox_InsertString(info->hwndQuanList,index,temp);
	       ListBox_SetItemData(info->hwndQuanList,index,amount);
	    }
	 }
	 ListBox_SetSel(info->hwndListBox,amount > 0,index);
	 info->selected[index] = (amount > 0);
	 obj->temp_amount = amount;
	 ListBox_SetCurSel(info->hwndQuanList,-1);
      }
      break;

   case IDOK:
      /* Get user's selection(s) */
      num_entries = ListBox_GetCount(info->hwndListBox);
      selection = NULL;
      
      for (i = 0; i < num_entries; i++)
      {
	 /* If item is selected, add to selection list, else free */
	 obj = (object_node *) ListBox_GetItemData(info->hwndListBox, i);
	 if (ListBox_GetSel(info->hwndListBox, i) > 0)
	    selection = list_add_item(selection, obj);
	 else 
	    ObjectDestroyAndFree(obj);
      }

      LookDialogRetval = selection;
      EndDialog(hDlg, IDOK);
      break;
      
   case IDCANCEL:
      LookListFreeContents(info->hwndListBox);
      
      LookDialogRetval = NULL;
      EndDialog(hDlg, IDCANCEL);
      break;
   }
}